Starten und Beenden der Applikation
Im nachstehenden Code wird gezeigt, wie man die Applikation startet und beendet.
Starten der Applikation
Bevor Sie die Applikation starten müssen die entsprechenden Klassen importiert werden (siehe unten).
01 // Access general JAVA-COM bridge classes
02 import com.altova.automation.libs.*;
03
04 // Access StyleVision Java-COM bridge
05 import com.altova.automation.StyleVision.*;
06 import com.altova.automation.StyleVision.Enums.ENUMApplicationStatus;
07
08 /**
09 * A simple example that starts the COM server and performs a View operations on it.
10 * Feel free to extend.
11 */
12 public class RunStyleVision
13 {
14 public static void main(String[] args)
15 {
16 // An instance of the application.
17 Application stylevision = null;
18
19 // Instead of COM error-handling, use Java exception mechanism.
20 try
21 {
22 // Start StyleVision as COM server.
23 stylevision = new Application();
24
25 ENUMApplicationStatus status = ENUMApplicationStatus.eApplicationRunning;
26 do{
27 // Check the application status
28 status = stylevision.getStatus();
29 System.out.println("status : " + status + "\n");
30 } while (status != ENUMApplicationStatus.eApplicationRunning);
31
32 // COM servers start up invisible, so we make the server visible
33 stylevision.setVisible(true);
34
35 ...
36 }
37 }
38 }
Beenden der Applikation
Die Applikation kann wie unten gezeigt beendet werden.
1 {
2 // Make sure that StyleVision can shut down properly.
3 if (stylevision != null)
4 stylevision.dispose();
5
6 // Since the COM server was made visible and still is visible, it will keep running
7 // and needs to be closed manually.
8 System.out.println("Now close StyleVision!");
9 }