• No results found

Designing Main Screen - Switch Configuration Screen

5. IMPLEMENTATION

5.7 Client-side Implementation

5.7.2 Building Configuration Screen

5.7.2.1 Designing Main Screen - Switch Configuration Screen

The main screen of the Configuration Management Application has a tree in the left side, tabbed pane in the right side and a panel with buttons at the bottom of the screen. The figure below shows the components in the main screen.

Design Time View

Steps Involved Initial Settings

1. Create a new screen under the "EMS_Configuration" project and rename it as

"SwitchConfiguration".

2. Change the build type of the Screen to "NMS Frame" using the menu command Build >

Type > NMS Frame.

3. Change the layout of the Screen to "Border Layout" by right-clicking the Draw Area to invoke the screen pop-up menu, select Layouts > Border Layout.

Dropping and Laying out the Components

1. Drop the AdventNetTree bean and change its instance name by following the steps below o Switch to the "Project Classes" tab of Beans Palette.

o Provide the value "com.adventnet.beans.utilbeans.AdventNetTree" in the "Enter the Class Name" text field.

o Click and drop the "bean" button in the "West" position of the Draw Area . o Change the instance name of the AdventNetTree bean instance as "Switch_Tree"

using the Property Form.

2. Drop the JTabbedPane bean and change its instance name by following the steps below o Switch to the "SwingBeans.list" tab of Beans Palette.

o Click and drop the JTabbedPane bean in the "Center" position of the Draw Area.

o Change the instance name of the JTabbed bean instance as "Details_TabbedPane"

using the Property Form.

3. Drop the JPanel bean and change its instance name by following the steps below o Switch to the "SwingBeans.list" tab of Beans Palette.

o Click and drop the "JPanel" bean in the "South" position of the Draw Area.

o Change the instance name of the JPanel bean instance as "Button_Panel" using the Property Form.

Invoke the "Border Layout" dialog to arrange the components by right-clicking the Draw Area and select "Layout Properties" menu item.

Select each component in the "Component" combo box and ensure the parameters are as in the table given below, if not provide the values and click "OK" button to close the dialog.

Component Position HGap VGap

Button_panel South Switch_Tree West Details_TappedPane Center

5 5

Designing Switch_Tree Bean

1. Double-click the "Switch_Tree" bean to invoke the Property Form.

2. Select the TreeValues and Click "Click to edit Titles and class or File names" button against it to invoke the "Tree Values" dialog.

3. Add the "Configure Switches" node by following the steps below

5. Close the Property Form using the "Close" button.

6. Right-click the "Switch_Tree" bean, select Interaction Wizard > treeSelection >

valueChanged to get a rubber band line. Bring the rubber band line into "Switch_Tree"

bean itself to invoke the Interaction Wizard.

o Ensure that the "Create New Connection class" option is selected in the first screen of the Interaction Wizard. click "Next" button.

o Ensure the "General Component Interaction" is selected and Click "Next"

button twice to go to the final screen of the Interaction Wizard.

o Insert the following code in the valueChanged method String name=null;

if (userOperations.toString().indexOf("Ems") != -1) {

if ( userOperations.contains("Ems Configure All") &&

(! userOperations.contains("Ems Configure None"))) {

Details_TabbedPane.setEnabledAt(1,false);

Details_TabbedPane.setEnabledAt(2,false);

} }

if (userOperations.toString().indexOf("Ems") == -1) {

if (userOperations.toString().indexOf("Ems") != -1) {

if ( userOperations.contains("Ems Configure All") && (!

userOperations.contains("Ems Configure None")))

if (userOperations.toString().indexOf("Ems") != -1) {

if ( (userOperations.contains("Ems Configure Scalar") ||

userOperations.contains("Ems Configure All")) && ! userOperations.contains("Ems Configure None")) {

configure.setEnabled(true);

} }

if (userOperations.toString().indexOf("Ems") == -1) {

o Click "Finish" to close the Interaction Wizard.

7. Switch to Source View tab and scroll to the setVisible method. Write the following code under the //<End_setVisible_boolean> tag.

if(bl)

if (userOperations.toString().indexOf("Ems") != -1) {

if(userOperations.contains("Ems Configure Scalar") && ( !

userOperations.contains("Ems Configure All") && ! (userOperations.contains("Ems Configure None"))

if (userOperations.contains("Ems Configure None")) {

configure.setEnabled(false);

} } }

10. Add the following code in the init method before the closing braces ("}") of this method as given below :

checkUserOperations();

setResizable(false);

11. Add the following code in stop method before the closing braces ("}") of this method as given below :

PortDetails1.stop();

12. Add the following code in start method after the opening braces ("{") of this method as given below :

PortDetails1.start();

Custom code that need to be added in the Configuration management screen to cater for Security administration

In the Configuration wizard, we have created the screens for configuring the Switches. In the SwitchConfiguration.java file of the EMS configuration project, the following code was accommodated in order to cater for Security administration.

When the switch configuration screen is invoked from the client, the checkUserOperations() method makes a RMI lookup to the AuthorizationEngineAPI for retrieving the operations for the logged-in user.

if(BEHostName.trim().equalsIgnoreCase("localhost")) try

} handle to Authorization Engine " + ex.getMessage());

}

catch(Exception exp) {

System.out.println("Exception while getting RMI handle to Authorization Engine " + exp.getMessage());

} }

Whenever a component in the UI is added, disabled or enabled, a check is made if the user logged in has the required permission to perform the operation. Based on the user operation, the component is enabled or disabled.

if(userOperations.toString().indexOf("Ems") != -1)

Designing the Button_Panel Bean

1. Ensure that the layout of Button_Panel is flow layout.

2. Drop a JButton from the SwingBeans.list tab of BeansPalette and change its instance name as "configure" and provide "text" property value "Configure" in the Property Form.

Similarly drop three more JButtons and change their properties in Property Form as given in the table below:

Instance Name Text Property

refresh Refresh help Help close Close

Related documents