Altova StyleVision 2024 Enterprise Edition

The StyleVision installation package contains an example Java project, located in the ActiveX Examples folder of the application folder: <ApplicationFolder>\Examples\ActiveX\Java\.

 

The Java example shows how to integrate the StyleVisionControl in a common desktop application created with Java. You can test it directly from the command line using the batch file BuildAndRun.bat, or you can compile and run the example project from within Eclipse. See below for instructions on how to use these procedures.

 

File list

The Java examples folder contains all the files required to run the example project. These files are listed below:

 

.classpath

Eclipse project helper file

.project        

Eclipse project file

AltovaAutomation.dll

Java-COM bridge: DLL part (for the 32-bit installation)

AltovaAutomation_x64.dll

Java-COM bridge: DLL part (for the 64-bit installation)

AltovaAutomation.jar

Java-COM bridge: Java library part

BuildAndRun.bat

Batch file to compile and run example code from the command line prompt. Expects folder where Java Virtual Machine resides as parameter.

StyleVisionActiveX.jar

Java classes of the StyleVision ActiveX control

StyleVisionActiveX_JavaDoc.zip

Javadoc file containing help documentation for the Java API

StyleVisionContainer.java

Java example source code

StyleVisionContainerEventHandler.java

Java example source code

StyleVisionDialog.java

Java example source code

 

What the example does

The example places one StyleVision document editor window, the StyleVision project window, the StyleVision schema tree window and the StyleVision design overview window in an AWT frame window. It reads out the main menu defined for StyleVision and creates an AWT menu with the same structure. You can use this menu or the project window to open and work with files in the document editor.

 

You can modify the example in any way you like.

 

The following specific features are described in code listings:

 

Creating the ActiveX Controls: Starts StyleVision, which is registered as an automation server, or activates StyleVision if it is already running.

Loading Data in the Controls: Locates one of the example documents installed with StyleVision and opens it.

Basic Event Handling: Changes the view of all open documents to Text View. The code also shows how to iterate through open documents.

Menus: Validates the active document and shows the result in a message box. The code shows how to use output parameters.

UI Update Event Handling: Shows how to handle StyleVision events.

Creating a StyleVision Node Tree: Shows how to create a StyleVision node tree and prepare it for modal activation.

 

Updating the path to the Examples folder

Before running the provided sample, you may need to edit the StyleVisionContainer.java file. Namely, check that the following path refers to the actual folder where the StyleVision example files are stored on your operating system:

 

// Locate samples installed with the product.
final String strExamplesFolder = System.getenv( "USERPROFILE" ) + "\\Documents\\Altova\\StyleVision2024\\StyleVisionExamples\\";

 

 

Running the example from the command line

To run the example from the command line:

 

1.Check that all prerequisites are met (see Prerequisites).

2.Open a command prompt window, change the current directory to the sample Java project folder, and type:

buildAndRun.bat "<Path-to-the-Java-bin-folder>"

3.Press Enter.

 

The Java source in StyleVisionContainer.java will be compiled and then executed.

 

Compiling and running the example in Eclipse

To import the sample Java project into Eclipse:

 

1.Check that all prerequisites are met (see Prerequisites).

2.On the File menu, click Import.

3.Select Existing Projects into Workspace, and browse for the Eclipse project file located at <ApplicationFolder>\Examples\ActiveX\Java\. Since you may not have write-access in this folder, it is recommended to select the Copy projects into workspace check box on the Import dialog box.

 

To run the example application, right-click the project in Package Explorer and select the command Run as | Java Application.

 

Help for Java API classes is available through comments in code as well as the Javadoc view of Eclipse. To enable the Javadoc view in Eclipse, select the menu command Window | Show View | JavaDoc.

 

© 2017-2023 Altova GmbH