DataCollectionPanelpublic class DataCollectionPanel extends JPanel
Fields Summary |
---|
private FlowLabel | flowContentLabel | private FlowLabel | sourceHelpLabel | private JLabel | sourceDirLabel | private JLabel | destDirLabel | private JTextField | sourceDirTextField | private JTextField | destDirTextField | private JButton | sourceDirectoryBrowseButton | private JButton | destDirBrowseButton | private JPanel | containerPanel | private JCheckBox | upgradeCertificates | private JTextField | adminUserTextField | private JPasswordField | adminPWTextField | private JPasswordField | masterPWTextField | private JFileChooser | fileChooser | private Vector | dialogListeners | private CommonInfoModel | commonInfoModel | private com.sun.enterprise.util.i18n.StringManager | stringManager | private Logger | logger |
Constructors Summary |
---|
public DataCollectionPanel(CommonInfoModel coInfoModel)Data Collection Panel Constructor
this.commonInfoModel = coInfoModel;
initialize();
|
Methods Summary |
---|
public void | addDialogListener(DialogListener listener)
this.dialogListeners.addElement(listener);
| private void | destActionPerformed(java.awt.event.ActionEvent evt)
getfileChooser().setCurrentDirectory(new java.io.File(destDirTextField.getText()));
int returnedValue = getfileChooser().showOpenDialog(this);
if(returnedValue == javax.swing.JFileChooser.APPROVE_OPTION){
destDirTextField.setText(String.valueOf(getfileChooser().getSelectedFile()));
this.processDialogEvent();
}
| public java.lang.String | getAdminPassword()Method to get admin password from GUI panel
return this.adminPWTextField.getText();
| public java.lang.String | getAdminUserName()Method to get admin user name from GUI panel
return this.adminUserTextField.getText();
| private javax.swing.JPanel | getAdminUserPasswordPanel()
javax.swing.JPanel panel = new javax.swing.JPanel();
java.awt.GridBagConstraints gridBagConstraints;
javax.swing.JLabel admiUserLabel = new javax.swing.JLabel();
javax.swing.JLabel admiPWLabel = new javax.swing.JLabel();
adminUserTextField = new javax.swing.JTextField();
adminPWTextField = new javax.swing.JPasswordField();
panel.setLayout(new java.awt.GridBagLayout());
admiUserLabel.setText(stringManager.getString("upgrade.gui.detailspanel.adminUserLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 3, 20);
gridBagConstraints.weightx = 1.0;
panel.add(admiUserLabel, gridBagConstraints);
admiPWLabel.setText(stringManager.getString("upgrade.gui.detailspanel.adminPWLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(10, 20, 3, 10);
gridBagConstraints.weightx = 1.0;
panel.add(admiPWLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 5, 20);
gridBagConstraints.weightx = 1.0;
panel.add(adminUserTextField, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 20, 5, 10);
gridBagConstraints.weightx = 1.0;
panel.add(adminPWTextField, gridBagConstraints);
if(!UpgradeConstants.EDITION_PE.equals(commonInfoModel.getSourceEdition())){
javax.swing.JLabel masterPWLabel = new javax.swing.JLabel();
masterPWTextField = new javax.swing.JPasswordField();
masterPWLabel.setText(stringManager.getString("upgrade.gui.detailspanel.masterPWLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 3, 5);
gridBagConstraints.weightx = 1.0;
panel.add(masterPWLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 5);
gridBagConstraints.weightx = 1.0;
panel.add(masterPWTextField, gridBagConstraints);
javax.swing.JPanel dummyPanel = new javax.swing.JPanel();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 20, 10, 5);
gridBagConstraints.weightx = 1.0;
panel.add(dummyPanel, gridBagConstraints);
}
return panel;
| public java.lang.String | getDestinationDirectoryPath()Method to get destination directory from GUI panel
return this.destDirTextField.getText();
| public java.lang.String | getMasterPassword()Method to get master password from GUI panel
return this.masterPWTextField.getText();
| public java.lang.String | getSourceDirectoryPath()Method to get source directory from GUI panel
return this.sourceDirTextField.getText();
| private javax.swing.JFileChooser | getfileChooser()
if (fileChooser == null) {
fileChooser = new javax.swing.JFileChooser();
fileChooser.setName("fileChooser");
fileChooser.setBounds(668, 49, 500, 300);
fileChooser.setDialogTitle(stringManager.getString("upgrade.gui.detailspanel.fileChooseTitle"));
}
return fileChooser;
| private void | initComponents()This method is called from within the constructor to
initialize the form.
always regenerated by the Form Editor.
java.awt.GridBagConstraints gridBagConstraints;
flowContentLabel = new FlowLabel();
sourceHelpLabel = new FlowLabel();
sourceDirLabel = new javax.swing.JLabel();
sourceDirTextField = new javax.swing.JTextField();
sourceDirectoryBrowseButton = new javax.swing.JButton();
destDirLabel = new javax.swing.JLabel();
destDirTextField = new javax.swing.JTextField();
destDirBrowseButton = new javax.swing.JButton();
containerPanel = new javax.swing.JPanel();
containerPanel.setLayout(new java.awt.GridBagLayout());
flowContentLabel.setText(stringManager.getString("upgrade.gui.detailspanel.flowContentLable"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 5, 0);
gridBagConstraints.weightx = 1.0;
containerPanel.add(flowContentLabel, gridBagConstraints);
sourceDirLabel.setText(stringManager.getString("upgrade.gui.detailspanel.sourceDirLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 3, 10);
gridBagConstraints.weightx = 1.0;
containerPanel.add(sourceDirLabel, gridBagConstraints);
sourceDirTextField.setToolTipText(stringManager.getString("upgrade.gui.detailspanel.sourceHelpLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 5);
gridBagConstraints.weightx = 1.0;
containerPanel.add(sourceDirTextField, gridBagConstraints);
sourceDirectoryBrowseButton.setText(stringManager.getString("upgrade.gui.detailspanel.browseButtonText"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.insets = new java.awt.Insets(0, 5, 10, 10);
containerPanel.add(sourceDirectoryBrowseButton, gridBagConstraints);
destDirLabel.setText(stringManager.getString("upgrade.gui.detailspanel.targetDirLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 3, 10);
gridBagConstraints.weightx = 1.0;
containerPanel.add(destDirLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 5);
gridBagConstraints.weightx = 1.0;
containerPanel.add(destDirTextField, gridBagConstraints);
destDirBrowseButton.setText(stringManager.getString("upgrade.gui.detailspanel.browseButtonText"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 4;
gridBagConstraints.insets = new java.awt.Insets(0, 5, 10, 5);
containerPanel.add(destDirBrowseButton, gridBagConstraints);
upgradeCertificates = new javax.swing.JCheckBox(stringManager.getString("upgrade.gui.detailspanel.transferCertCheckBoxText"),false);
upgradeCertificates.setVisible(false);
upgradeCertificates.setSelected(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 5);
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 0;
containerPanel.add(upgradeCertificates, gridBagConstraints);
javax.swing.JPanel adminUserPwPanel = getAdminUserPasswordPanel();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6;
gridBagConstraints.gridheight = 1; gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 3, 10);
gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.0;
containerPanel.add(adminUserPwPanel, gridBagConstraints);
if(UpgradeConstants.EDITION_PE.equals(commonInfoModel.getSourceEdition())){
javax.swing.JPanel dummyPanel = new javax.swing.JPanel();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7;
gridBagConstraints.gridheight = 1; gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 3, 10);
gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0;
containerPanel.add(dummyPanel, gridBagConstraints);
}
| private void | initialize()Method to initialize the components and set action listeners.
Also to set the values in the different text boxes.
initComponents();
this.setLayout(new java.awt.BorderLayout());
HeaderPanel headerPanel = new HeaderPanel(
stringManager.getString("upgrade.gui.detailspanel.headerPanel"));
headerPanel.setInsets(new java.awt.Insets(12, 10, 5, 10));
add(headerPanel, "North");
add(containerPanel, "Center");
//Add action listener for source browse button
sourceDirectoryBrowseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sourceActionPerformed(evt);
}
});
//Add action listenener for target browse button
destDirBrowseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
destActionPerformed(evt);
}
});
//Set file selection mode
getfileChooser().setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY);
java.awt.event.KeyAdapter keyAdapter = new java.awt.event.KeyAdapter(){
public void keyReleased(java.awt.event.KeyEvent ke){
processDialogEvent();
}
};
//Set values in the source and target text boxes
sourceDirTextField.addKeyListener(keyAdapter);
destDirTextField.addKeyListener(keyAdapter);
String sourceDir=commonInfoModel.getSourceInstallDir();
String targetDir=commonInfoModel.getTargetDomainRoot();
if(sourceDir != null && !(sourceDir.equals("")))
sourceDirTextField.setText(sourceDir);
if(targetDir != null && !(targetDir.equals("")))
destDirTextField.setText(targetDir);
//Set values in the adminuser and password text boxes
String adminUserName = commonInfoModel.getAdminUserName();
String adminPassword = commonInfoModel.getAdminPassword();
adminUserTextField.addKeyListener(keyAdapter);
adminPWTextField.addKeyListener(keyAdapter);
if(adminUserName != null && !(adminUserName.equals("")))
adminUserTextField.setText(adminUserName);
if(adminPassword != null && !(adminPassword.equals("")))
adminPWTextField.setText(adminPassword);
//Set value in the master password text box
if(!UpgradeConstants.EDITION_PE.equals(commonInfoModel.getSourceEdition())){
String masterPassword = commonInfoModel.getMasterPassword();
masterPWTextField.addKeyListener(keyAdapter);
if(masterPassword != null && !(masterPassword.equals("")))
masterPWTextField.setText(masterPassword);
}
| public boolean | isUpgradeCertificatesSelected()Method to get input from Transfer security certificates
checkbox in GUI panel
return this.upgradeCertificates.isSelected();
| private void | processDialogEvent()
DialogEvent de = new DialogEvent(this, DialogEvent.CHANGE_ACTION);
for(int i=0 ; i<this.dialogListeners.size(); i++){
((DialogListener)dialogListeners.elementAt(i)).dialogProcessed(de);
}
| public void | removeDialogListener(DialogListener listener)
this.dialogListeners.removeElement(listener);
| private void | sourceActionPerformed(java.awt.event.ActionEvent evt)
getfileChooser().setCurrentDirectory(new java.io.File(sourceDirTextField.getText()));
int returnedValue = getfileChooser().showOpenDialog(this);
if(returnedValue == javax.swing.JFileChooser.APPROVE_OPTION){
sourceDirTextField.setText(String.valueOf(getfileChooser().getSelectedFile()));
this.processDialogEvent();
}
|
|