Altova StyleVision 2024 Professional Edition

Im unten gezeigten Code sehen Sie wie grundlegende Events behandelt werden. Bei Aufruf der StyleVisionControl-Methode open oder beim Öffnen einer Datei über das Menü oder die Projektstruktur wird das onOpenedOrFocused Event an den dazugehörigen Event Handler gesendet. Im Prinzip wird dieses Event behandelt, indem die Datei durch Aufruf der open-Methode des StyleVisionDocumentControl geöffnet wird.

 

 

01       // Open the PXF file when button is pressed

02       btnOpenPxf.addActionListener( new ActionListener() {

03         public void actionPerformed(ActionEvent e) {

04           try {

05             styleVisionControl.open( strExamplesFolder + "OrgChart.pxf" );

06           } catch (AutomationException e1) {

07             e1.printStackTrace();

08           }

09         }

10       } );

11       public void onOpenedOrFocused( String i_strFileName, boolean i_bOpenWithThisControl, boolean i_bFileAlreadyOpened ) throws AutomationException

12   {

13     // Handle the New/Open events coming from the Project tree or from the menus

14     if ( !i_bFileAlreadyOpened )

15     {

16       // This is basically an SDI interface, so open the file in the already existing document control

17       try {

18         StyleVisionContainer.initStyleVisionDocument();

19         StyleVisionContainer.styleVisionDocument.open( i_strFileName );

20       } catch (Exception e) {

21         e.printStackTrace();

22       }

23     }

24   }

 

© 2017-2023 Altova GmbH