|
The main screen contains a split pane with Scalar Set Refresh Screen in the left side and Columnar Set Refresh Screen in the right side. In this topic, you will learn to design the Scalar Set Refresh Screen and Columnar Set Refresh Screen. These panels will be integrated in the main screen later.
Creating the SaveLoadScreen
Create a new screen using the menu command File-->New-->Screen. This invokes the Screen Builder wizard.
Select the 'Build Type' as Dialog and click Next to proceed to next screen.
Select the 'Screen Template' as Blank Screen and click Next to proceed to the next screen.
Provide the name as SaveLoadScreen and the appropriate title in the respective text boxes and click the Finish button.
Select the SwingBeans.list tab from the available list.
Drop a JLabel bean in the draw area.
Double click the JLabel. In the property form that is displayed enter the text value as Enter the File Name.
Drop a JTextField bean in the draw area below the Jlabel.
Double click the JTextField. In the property form that is displayed enter the text value as ConfigTask and the instance name as destFile.
Drop two JButtons adjacent to the Label and Textbox.
Double click the first JButton. In the property form that is displayed enter the label value as OK and the instance name as okBtn.
Double click the second JButton. In the property form that is displayed enter the label value as Cancel and the instance name as cancel.
Right-click on the screen's draw area and select Layout -> Grid Bag Layout
Right-click on the screen's draw area and select Layout Properties
GridBagLayout Customizer dialog will be displayed.
Click on Jlabel1 in the 'GridBagLayout Customizer' and set the following properties. GridX : 0, GridY : 0, Fill : BOTH, Anchor : SOUTH, Insets : 5, 5, 5, 5
Click on destFile in the 'GridBagLayout Customizer' and set the following properties. GridX : 0, GridY : 1, Fill : BOTH, Anchor : WEST, WeightX : 0.1, Insets : 5, 5, 5, 5
Click on okBtn in the 'GridBagLayout Customizer' and set the following properties. GridX : 1, GridY : 0, Fill : NONE, Anchor : CENTER, Insets : 5, 5, 5, 5
Click on cancel in the 'GridBagLayout Customizer' and set the following properties. GridX : 1, GridY : 1, Fill : NONE, Anchor : CENTER, Insets : 5, 5, 5, 5
Click on Apply button and then on OK button
Resize the screen to the desired length and width.
Right click the Cancel button. Select Interaction Wizard from the popup menu. Select action > actionPerformed. And drop the line in the Cancel button itself. The interaction wizard for cancel_cancel_conn is displayed.
Click Next in this screen and the subsequent two screens.
In the Listener method : actionPerformed user code area add the following code :
public void actionPerformed( java.awt.event.ActionEvent arg0)
|
{ SaveLoadScreen.this.cancelCalled = true; SaveLoadScreen.this.setVisible(false); }
|
Click the Finish button to complete the wizard.
Right click the OK button. Select Interaction Wizard from the popup menu. Select action > actionPerformed. And drop the line in the OK button itself. The interaction wizard for okBtn_okBtn_conn is displayed.
Click Next in this screen and the subsequent two screens.
In the Listener method : actionPerformed user code area add the following code :
public void actionPerformed( java.awt.event.ActionEvent arg0)
|
{ if(destFile.getText().trim().equals("")) { javax.swing.JOptionPane.showMessageDialog(null,"Please Enter the Task File Name","Alert",javax.swing.JOptionPane.ERROR_MESSAGE); return; } if(mode != null && mode.trim().equals("load")) { java.io.File f = new java.io.File("." + File.separator + "configtasks" +File.separator + "User" + File.separator + destFile.getText() + ".xml"); if(!f.exists()) { javax.swing.JOptionPane.showMessageDialog(null,"Cannot Load informations, The Task file " + f.toString() + " does not exist","Alert",javax.swing.JOptionPane.ERROR_MESSAGE); return; } } setTaskFile(destFile.getText()); SaveLoadScreen.this.setVisible(false); }
|
|
|
Note: If required, you can view the code in the SaveLoadScreen in the sample eBon project. In the "Project Tree" pane, select "SaveLoadScreen". Select the "Component" tab. Expand the "Connections" node and double-click on each of the connections to view the code area for the cancel button and the ok button.
|
Click on the Source tab present at the bottom of the screen. Source code of the screen will be displayed. Paste the code given below in bold letters. Paste the code below the global declaration as done below.
|
public class SaveLoadScreen extends JDialog implements com.adventnet.apiutils.ParameterChangeListener { //<Begin_Variable_Declarations> private boolean initialized = false; private java.applet.Applet applet = null; ... //<End_Variable_Declarations>
boolean cancelCalled = false; private String taskFile = null; private String mode = null; public SaveLoadScreen(String mode) { this.mode = mode; pack(); } public String getTaskFile() { return taskFile; } public void setTaskFile(String str) { taskFile = str; } ...
|
Save the screen and compile the screen using the menu command Build-->Compile.
Creating the Scalar Set Refresh
Create a new screen using the menu command File-->New-->Screen. This invokes the Screen Builder wizard.
Select the 'Build Type' as 'Panel' and click Next to proceed to next screen.
Select the 'Screen Template' as 'Scalar Set Refresh' and click Next to proceed to next screen.
Select the scalar attributes, namely 'cardDesc' and 'cardVersion' found under the following node in the XML tree and click Next.
DSLAMModule-->org-->dod->internet-->private->enterprises-->adventnet-->switch-->dslamsystem-->dslamCardInfo
Provide the 'Screen Title' as 'Scalar Set Screen' and 'Screen Name' as 'ScalarSetScreen'. Change the display name of the selected node 'cardDesc' as 'cardDescription' and click Next.
Click Finish to create the screen. A new node named 'ScalarSetScreen' is created in the project tree.
Delete the Refresh button.
Click and drop JButton bean in JPanel2 from SwingBeans.list tab of Beans Palette.
Change the following properties of the JButton using the Property Form.
|
Property |
Value |
|
InstanceName |
saveBtn |
|
horizontalAlignment |
CENTER |
|
icon |
save.png under <Client Builder Home>/images |
|
text |
Save |
Right-click Save button. Select InteractionWizard-->action-->actionPerformed from the menu displayed. Drop the rubber band line in the Save button itself to invoke the Interaction Wizard.
Select the 'Create New Connection class' radio button. Click Next button.
Click on 'Save Configuration Task/Profile' radio button. Click Next button twice. There will be a TextField with File Name as label.
Type 'ConfigSave' in the File Name text field. Click 'Next' button three times.
Delete the below code present inside the actionPerformed method.
|
//Begin_SaveConfigurationProfile try { addGroupsToSave(null); saveConfigurationInformation(); } catch(java.lang.Exception ex) { ex.printStackTrace(); } //End_SaveConfigurationProfile
|
Provide the following user code under actionPerformed() method and click Finish to close the wizard.
|
String taskName = null; SaveLoadScreen scr = new SaveLoadScreen(); scr.setModal(true); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); scr.setLocation(new Point((dim.width/2-scr.getSize().width/2),(dim.height/2-scr.getSize().height/2 ))); scr.setVisible(true); if(scr.cancelCalled) { return; } else { taskName = scr.getTaskFile(); } //Begin_SaveConfigurationProfile try { ConfigCache1.saveConfigInfo("this_group1", "group1", ScalarSetScreen.this, null); ConfigCache1.SaveIntoXMLAtServer(taskName, true); addGroupsToSave(null); saveConfigurationInformation(); }catch(java.lang.Exception ex) { ex.printStackTrace(); } //End_SaveConfigurationProfile
|
Click and drop JButton bean in JPanel2 from SwingBeans.list tab of Beans Palette.
Change the following properties of the JButton using the Property Form.
|
Property |
Value |
|
InstanceName |
loadBtn |
|
horizontalAlignment |
CENTER |
|
icon |
load.png under <Client Builder Home>/images |
|
text |
Load |
Right-click Load button. Select InteractionWizard-->action-->actionPerformed from the menu displayed. Drop the rubber band line in the Load button itself to invoke the Interaction Wizard.
Click on Create New Connection class radio button. Click Next button.
Click on Load Configuraion Task/Profile radio button. Click Next button twice.
There will be a text field with a label "File Name". Type SaveConfig in the File Name textfield. Click Next button three thrice.
Delete the below code present inside the actionPerformed method
|
//Begin_LoadConfigurationProfile try { loadXmlAtServer(); } catch(java.lang.Exception ex) { ex.printStackTrace(); } //End_LoadConfigurationProfile
|
Provide the following user code under actionPerformed() method and click Finish to close the wizard.
|
String taskName = null; SaveLoadScreen scr = new SaveLoadScreen(); scr.setModal(true); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); scr.setLocation(new Point((dim.width/2-scr.getSize().width/2),(dim.height/2-scr.getSize().height/2 ))); scr.setVisible(true); if(scr.cancelCalled) { return; } else{ taskName = scr.getTaskFile(); } //Begin_LoadConfigurationProfile try { ConfigCache1.loadCacheValueFromXMLAtServer(taskName, true); loadXmlAtServer(); }catch(java.lang.Exception ex) { ex.printStackTrace(); } //End_LoadConfigurationProfile
|
Save the screen and compile the screen using the menu command Build-->Compile.
Creating the Columnar Set Refresh
Create a new screen using the menu command File-->New-->Screen. This invokes the Screen Builder wizard.
Select the 'Build Type' as 'Panel' and click Next to proceed to next screen.
Select the 'Screen Template' as 'Columnar Set Refresh' and click Next to proceed to next screen.
Select the columnar attributes, namely 'slotIndex', 'cardNo', 'cardType','cardAdminStatus', and 'cardOperationStatus' found under the following node in the XML tree and click Next.
DSLAMModule-->org-->dod->internet-->private->enterprises-->adventnet-->switch-->dslamsystem-->dslamCardInfo-->cardTable
Type Columnar Set Screen in the Screen Title textfield. Type ColumnarSetScreen in the Screen Name textfield.
Change the display names of the selected nodes 'cardNumber' as 'cardNo' and 'cardOperationStatus' as 'cardOpStatus', and click Next.
Click Finish to create the screen. A new node named 'ColumnarSetScreen' is created in the project tree.
Delete the Refresh button.
Save the screen and compile the screen using the menu command Build-->Compile.
This completes the Designing Panel for Main Screen.
This completes the Designing Panel for Main Screen.
|