|
The Main Screen has "Details_TabbedPane" (tabbed pane bean) containing four tabs, but the Main Screen currently has only tab named "Results_Panel" (The "Results" in figure below). This topic explains the integration of the three panel screens into to the Main Screen as tabs of the "Details_TabbedPane" bean and setting action for each button in the "Button_Panel". Follow the steps given below to achieve the same
Design Time View

Steps Involved
Switch to "Project Classes" tab of the Beans Palette and select "com.adventnet.nms.tutorials.ems.SystemConfig" from the "Enter Class Name" combo box. Click and drop the button in the "Details_TabbedPane" bean. Thus you have dropped the "SystemConfig" class as bean. You can find tab with the name "SystemConfig1" in the "Details_TabbedPane" bean. Similarly drop the "com.adventnet.nms.tutorials.ems.STP" and "com.adventnet.nms.tutorials.ems.PortDetails" in the "Details_TabbedPane" bean. You can find the "STP1" and "PortDetails1" in the "Details_TabbedPane" bean.
Designing the Details_TabbedPane Bean
Drop a JPanel1 in "Details_TabbedPane" bean and change its instance name as "Results_Panel" using the Property Form.
Change the layout of the "Results_Panel" bean to "Border" layout.
Click and drop a "ConfigResultTableModel" bean from AdventNetMSBeans.jar tab of the Beans Palette outside the Draw Area. You can find the instance name of the dropped "ConfigResultTableModel" bean is "ConfigResultTableModel1".
Switch to Component tab and edit the ConfigurationResultEventAction under the connections node. Remove the code in the configPerformed method and add the following code :
|
try { ConfigResultTableModel1.addConfigResult( arg0); } catch(java.lang.NullPointerException ex) { ex.printStackTrace(); } |
Drop a JTable bean from "SwingBeans.list" tab of Beans Palette in the "Results_Panel" bean and change its instance name as "Results_Table".
Invoke the Property Form for the "Results_Table" bean and set the model property with "ConfigResultTableModel1" and close the Property Form.
Ensure that the order of screen instance and panel beans in the "Details_TabbedPane" is as in the above Design Time View screen shot.
Invoke the "Layout Properties" dialog for the "Details_TabbedPane" bean by right-clicking it and selecting "Layout Properties" menu item.

Provide the "Title" text field value for "SystemConfig1" bean as "System Configuration" (refer the above figure).
Similarly, provide the "Title" text field value for the other beans in the "Details_TabbedPane" as given in the table below
|
Bean |
Title |
|
STP1 |
STP |
|
PortDetails1 |
PortParameters |
|
Results_Panel |
Results |
Inserting Methods for Button Actions
Switch to Source View tab and scroll down to end of the screen's class.
Insert the following methods "checkUserOperations", "helpAction" and, "screenConfiguration" before the closing braces ("}") for the screen's class. These methods are required for configuring button actions.
|
private void checkUserOperations() { try{ URL BE_Url = NmsClientUtil.applet.getCodeBase(); String BEHostName = "localhost"; BEHostName = BE_Url.getHost(); if(BEHostName.trim().equalsIgnoreCase("localhost")) try { BEHostName = InetAddress.getLocalHost().getHostName(); } catch(UnknownHostException unknownhostexception1) { System.err.println("unknown host : " + unknownhostexception1); } if(BE_Url != null && BEHostName != null) { String name = "//" + BEHostName + "/NmsAuthEngineAPI"; AuthorizationEngine authEngine = (AuthorizationEngine) Naming.lookup(name); if(authEngine == null) { } else { String userName = NmsClientUtil.getUserName(); userOperations = authEngine.getOperationsForUser(userName); } } }catch(Exception exp) { System.out.println("Exception while getting RMI handle to Authorization Engine " + exp.getMessage()); } } public void helpAction() { BrowserControl bc = new BrowserControl(); bc.displayURL(System.getProperty("user.dir")+File.separator+"tutorials"+File.separator+"ems_tutorial"+File.separator+"help"+File.separator+"ems_tutorial"+File.separator+"implementation"+File.separator+"configtutdoc.html"); } public void screenConfiguration() { try{ ConfigResultTableModel1.clearAllRows(); Configurator1.resetAll(); Configurator1.setTaskName("SwitchConfiguration_task"); Configurator1.addGroup("group1", SystemConfig1, null); if (userOperations.toString().indexOf("Ems") != -1) { if ( userOperations.contains("Ems Configure All") && (! userOperations.contains("Ems Configure None"))) { Configurator1.addGroup("group1", STP1, null); PortDetails1.saveTableValues(); Configurator1.addGroupInfoCaches( PortDetails1.getSavedTableValues()); } } else { Configurator1.addGroup("group1", STP1, null); PortDetails1.saveTableValues(); Configurator1.addGroupInfoCaches( PortDetails1.getSavedTableValues()); } Configurator1.doConfiguration(); Switch_Tree.setSelectionInterval((Switch_Tree.getRowCount())-1,(Switch_Tree.getRowCount())-1); } catch(java.lang.Exception ex) { ex.printStackTrace(); } } |
Setting Action for Buttons
For "configure" button
Right-click the "configure" button, select Interaction Wizard > action > actionPerformed to get a rubber band line. Bring the rubber band line into "configure" button itself to invoke the Interaction Wizard.
Ensure that the "Create New Connection class" option is selected in the first screen of the Interaction Wizard. click "Next" button.
Select the "Task based Configuration with Roll Back and Multiple Device Support " option as you need this option in this case.
Click "Next" button.
Steps to be followed in Interaction Wizard
Specifying How to Apply the Configuration
The Configuration is performed by the Configurator Bean. The Configurator Bean does this task by task, each task containing one or more groups.
Select the Configurator Bean to be used for applying the Configuration. This is applicable when there are some Configurator Beans already available in the Screen. Since you do not have a Configurator Bean till now, this Select Instance combo box is disabled. This means you need to instantiate a new one.
Specify the Instance Name in the New Instance Name text field (default is Configurator1).
Processing the Configuration Result
Ensure that the "Create Result Event Connection" is checked, since you need the result of the Configuration in a dialog. The Result Event connection can be created with a name of your choice. This name can be specified in the text field corresponding to Connection Class Name. If you are not in need of the Result Processing Part, the Check Box can be unchecked. Click "Next" button.
Specifying the Device(s) to be Configured
This screen displays a list where you specify the Devices on which the Configuration need to be applied.
Click "Next" button.
Configuration Task Details
This screen asks for information on the configuration task like the Name, whether an option is needed to revert to the previous configuration on failure and if so based on which document that contains the configuration profile.
Ensure the name is "EditedValueChecker_task". If you require details on Roll Back you follow the topic Rolling Back to previous Configuration. Click "Next" button.
Specifying the Group of Interest
This screen displays a group tree on the left, This Tree contains all the available groups in the Screen. Since you have defined only one group, this will be listed. The list on the right contains the different groups that are to be configured with the current operation. You can see that the group has already been added to the Selected Groups list.
Click "Next" button.
Generate the Code for Configuration with the Details Provided
This brings up the screen that has a list (on the left) that displays the components being used in the Screen and components for which references are needed can be added to the list on the right.
Click "Next" button.
In this screen, you can find the code is generated automatically within the actionPerformed method based on the information furnished through all the steps so far in Interaction Wizard. Remove the existing code and Insert the following code in this method
|
screenConfiguration(); |
Click "Finish" to close the Interaction Wizard. If you now go to the Component Tree and click "Connections" you find two new connections created. This completes the construction of the application.
For "refresh" Button
Right-click the "refresh" button, select Interaction Wizard > action > actionPerformed to get a rubber band line. Bring the rubber band line into "refresh" button itself to invoke the Interaction Wizard.
Ensure that the "Create New Connection class" option is selected in the first screen of the Interaction Wizard. click "Next" button.
Ensure the "General Component Interaction" is selected and Click "Next" button twice to go to the final screen of the Interaction Wizard.
Insert the following code in the actionPerformed method
|
PortDetails1.PortParametersTable11.refresh(); SystemConfig1.refresh(); STP1.refresh(); |
Click "Finish" to close the Interaction Wizard.
For "close" Button
Right-click the "close" button, select Interaction Wizard > action > actionPerformed to get a rubber band line. Bring the rubber band line into "close" button itself to invoke the Interaction Wizard.
Ensure that the "Create New Connection class" option is selected in the first screen of the Interaction Wizard. click "Next" button.
Ensure the "General Component Interaction" is selected and Click "Next" button twice to go to the final screen of the Interaction Wizard.
Insert the following code in the actionPerformed method
|
setVisible(false); |
Click "Finish" to close the Interaction Wizard.
For "help" Button
Right-click the "help" button, select Interaction Wizard-->action-->actionPerformed to get a rubber band line. Bring the rubber band line into "help" button itself to invoke the Interaction Wizard.
Ensure that the "Create New Connection class" option is selected in the first screen of the Interaction Wizard. click "Next" button.
Ensure the "General Component Interaction" is selected and Click "Next" button twice to go to the final screen of the Interaction Wizard.
Insert the following code in the actionPerformed method
|
helpAction(); |
Click "Finish" to close the Interaction Wizard.
This completes the building of Main Screen.
|