AddDomainDialogpublic class AddDomainDialog extends JDialog
Fields Summary |
---|
private JComboBox | domainsComboBox | private JComboBox | instancesComboBox | private JPasswordField | targetKeyDBPwdField | private JPasswordField | sourceCertPwdField | private JPasswordField | targetCertAuthPwdField | public static final int | JKStoJKS | public static final int | NSStoNSS | public static final int | NSStoJKS | public static final int | JKStoNSS | private int | currentSourceToVersion | private com.sun.enterprise.util.i18n.StringManager | stringManager | private Logger | logger | private List | domainList | private List | instanceList | private Hashtable | domainMap | private com.sun.enterprise.tools.upgrade.common.CommonInfoModel | commonInfo | private Vector | dialogListeners |
Constructors Summary |
---|
public AddDomainDialog(Frame parent, boolean modal, com.sun.enterprise.tools.upgrade.common.CommonInfoModel commonInfo, int currentStoT)Creates new form AddDomainDialog
super(parent, modal);
this.setTitle(stringManager.getString("upgrade.gui.adddomainpanel.dialogTitle"));
this.domainList = commonInfo.getDomainList();
this.domainMap = commonInfo.getDomainMapping();
this.instanceList = new ArrayList();
this.currentSourceToVersion = currentStoT;
this.commonInfo = commonInfo;
initComponents();
|
Methods Summary |
---|
private void | addComponetWithConstraints(javax.swing.JComponent compo, java.awt.Container parent, int gx, int gy, int gw, int gh, int fill, java.awt.Insets in, double wx, double wy)
java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = gx; gridBagConstraints.gridy = gy;
gridBagConstraints.gridwidth = gw; gridBagConstraints.gridheight = gh;
gridBagConstraints.fill = fill;
gridBagConstraints.insets = in;
gridBagConstraints.weightx = wx;
gridBagConstraints.weighty = wy;
parent.add(compo, gridBagConstraints);
| public void | addDialogListener(DialogListener listener)
this.dialogListeners.addElement(listener);
| private void | cancelButtonActionPerformed()
DialogEvent de = new DialogEvent(this, DialogEvent.CANCEL_ACTION);
for(int i=0 ; i<this.dialogListeners.size(); i++){
((DialogListener)dialogListeners.elementAt(i)).dialogProcessed(de);
}
| public void | clearFields()
sourceCertPwdField.setText("");
targetKeyDBPwdField.setText("");
if(targetCertAuthPwdField != null)
targetCertAuthPwdField.setText("");
| private void | domainsComboBoxItemStateChanged()
// Add your handling code here:
DomainInfo dInfo = (DomainInfo)domainMap.get((String)domainsComboBox.getSelectedItem());
instanceList = dInfo.getInstanceNames();
if(commonInfo.getSourceVersion().equals(UpgradeConstants.VERSION_7X)){
instanceList.remove("admin-server");
}
instancesComboBox.setModel(new javax.swing.DefaultComboBoxModel(instanceList.toArray()));
| private javax.swing.JPanel | getButtonsPanel()
javax.swing.JPanel buttonsPanel = new javax.swing.JPanel();
javax.swing.JButton okButton = new javax.swing.JButton();
javax.swing.JButton cancelButton = new javax.swing.JButton();
javax.swing.JButton helpButton = new javax.swing.JButton();
buttonsPanel.setLayout(new java.awt.GridBagLayout());
okButton.setText(stringManager.getString("upgrade.gui.adddomainpanel.okButtonText"));
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed();
}
});
this.addComponetWithConstraints(okButton, buttonsPanel, 1, 0, 1,1, GridBagConstraints.NONE, new Insets(5, 5, 10, 10), 0.0,0.0);
cancelButton.setText(stringManager.getString("upgrade.gui.adddomainpanel.cancelButtonText"));
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed();
}
});
this.addComponetWithConstraints(cancelButton, buttonsPanel, 2, 0, 1,1, GridBagConstraints.NONE, new Insets(5, 5, 10, 10), 0.0,0.0);
helpButton.setText(stringManager.getString("upgrade.gui.adddomainpanel.helpButtonText"));
helpButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
helpButtonActionPerformed();
}
});
this.addComponetWithConstraints(helpButton, buttonsPanel, 3, 0, 1,1, GridBagConstraints.NONE, new Insets(5, 5, 10, 10), 0.0,0.0);
this.addComponetWithConstraints(new JPanel(), buttonsPanel, 0, 0, 1,1, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 10, 10), 1.0,0.0);
if(Utils.getHelpBroker() != null)
Utils.getHelpBroker().enableHelpOnButton(helpButton, "ADD_DOMAIN_DIALOG", null);
return buttonsPanel;
| private javax.swing.JPanel | getPasswordPanelWith2Fields()
javax.swing.JPanel passwordPanel = new javax.swing.JPanel();
javax.swing.JLabel sourceCertPwdLabel = new javax.swing.JLabel();
sourceCertPwdField = new javax.swing.JPasswordField();
javax.swing.JLabel targetKeyDBPwdLabel = new javax.swing.JLabel();
targetKeyDBPwdField = new javax.swing.JPasswordField();
passwordPanel.setLayout(new java.awt.GridBagLayout());
passwordPanel.setBorder(new javax.swing.border.TitledBorder(stringManager.getString("upgrade.gui.adddomainpanel.certTitleBorder")));
String[] labelAndToolTipStrings = new String[4];
if(this.currentSourceToVersion == this.JKStoJKS){
labelAndToolTipStrings[0] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoJKS.sourceCertLabelTooltip");
labelAndToolTipStrings[1] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoJKS.targetKeyDBTooltip");
labelAndToolTipStrings[2] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoJKS.sourceCertLabel");
labelAndToolTipStrings[3] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoJKS.targetKeyDBLabel");
}else{
labelAndToolTipStrings[0] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoNSS.sourceCertLabelTooltip");
labelAndToolTipStrings[1] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoNSS.targetKeyDBTooltip");
labelAndToolTipStrings[2] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoNSS.sourceCertLabel");
labelAndToolTipStrings[3] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoNSS.targetKeyDBLabel");
}
sourceCertPwdLabel.setText(labelAndToolTipStrings[2]);
sourceCertPwdLabel.setToolTipText(labelAndToolTipStrings[0]);
this.addComponetWithConstraints(sourceCertPwdLabel,passwordPanel, 0, 0, 1,1, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 5, 10), 1.0,0.0);
sourceCertPwdField.setToolTipText(labelAndToolTipStrings[0]);
this.addComponetWithConstraints(sourceCertPwdField,passwordPanel, 0, 1, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 7, 10), 1.0,0.0);
targetKeyDBPwdLabel.setText(labelAndToolTipStrings[3]);
targetKeyDBPwdLabel.setToolTipText(labelAndToolTipStrings[1]);
this.addComponetWithConstraints(targetKeyDBPwdLabel,passwordPanel, 0, 2, 1,1, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 5, 10), 1.0,0.0);
targetKeyDBPwdField.setToolTipText(labelAndToolTipStrings[1]);
this.addComponetWithConstraints(targetKeyDBPwdField,passwordPanel, 0, 3, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 7, 10), 1.0,0.0);
return passwordPanel;
| private javax.swing.JPanel | getPasswordPanelWith3Fields()
javax.swing.JPanel passwordPanel = new javax.swing.JPanel();
javax.swing.JLabel sourceCertPwdLabel = new javax.swing.JLabel();
sourceCertPwdField = new javax.swing.JPasswordField();
javax.swing.JLabel targetKeyDBPwdLabel = new javax.swing.JLabel();
targetKeyDBPwdField = new javax.swing.JPasswordField();
targetCertAuthPwdField = new javax.swing.JPasswordField();
javax.swing.JLabel targetCertAuthPwdLabel = new javax.swing.JLabel();
passwordPanel.setLayout(new java.awt.GridBagLayout());
passwordPanel.setBorder(new javax.swing.border.TitledBorder(stringManager.getString("upgrade.gui.adddomainpanel.certTitleBorder")));
String[] labelAndToolTipStrings = new String[6];
if(this.currentSourceToVersion == this.NSStoJKS){
labelAndToolTipStrings[0] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoJKS.sourceCertLabelTooltip");
labelAndToolTipStrings[1] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoJKS.targetKeyDBTooltip");
labelAndToolTipStrings[2] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoJKS.targetCATooltip");
labelAndToolTipStrings[3] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoJKS.sourceCertLabel");
labelAndToolTipStrings[4] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoJKS.targetKeyDBLabel");
labelAndToolTipStrings[5] = stringManager.getString("upgrade.gui.adddomainpanel.NSStoJKS.targetCALabel");
}else{
labelAndToolTipStrings[0] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoNSS.sourceCertLabelTooltip");
labelAndToolTipStrings[1] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoNSS.targetKeyDBTooltip");
labelAndToolTipStrings[2] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoNSS.targetCATooltip");
labelAndToolTipStrings[3] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoNSS.sourceCertLabel");
labelAndToolTipStrings[4] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoNSS.targetKeyDBLabel");
labelAndToolTipStrings[5] = stringManager.getString("upgrade.gui.adddomainpanel.JKStoNSS.targetCALabel");
}
sourceCertPwdLabel.setText(labelAndToolTipStrings[3]);
sourceCertPwdLabel.setToolTipText(labelAndToolTipStrings[0]);
this.addComponetWithConstraints(sourceCertPwdLabel,passwordPanel, 0, 0, 1,1, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 5, 10), 1.0,0.0);
sourceCertPwdField.setToolTipText(labelAndToolTipStrings[0]);
this.addComponetWithConstraints(sourceCertPwdField,passwordPanel, 0, 1, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 7, 10), 1.0,0.0);
targetKeyDBPwdLabel.setText(labelAndToolTipStrings[4]);
targetKeyDBPwdLabel.setToolTipText(labelAndToolTipStrings[1]);
this.addComponetWithConstraints(targetKeyDBPwdLabel,passwordPanel, 0, 2, 1,1, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 5, 10), 1.0,0.0);
targetKeyDBPwdField.setToolTipText(labelAndToolTipStrings[1]);
this.addComponetWithConstraints(targetKeyDBPwdField,passwordPanel, 0, 3, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 7, 10), 1.0,0.0);
targetCertAuthPwdLabel.setText(labelAndToolTipStrings[5]);
targetCertAuthPwdLabel.setToolTipText(labelAndToolTipStrings[2]);
this.addComponetWithConstraints(targetCertAuthPwdLabel,passwordPanel, 0, 4, 1,1, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 5, 10), 1.0,0.0);
targetCertAuthPwdField.setToolTipText(labelAndToolTipStrings[2]);
this.addComponetWithConstraints(targetCertAuthPwdField,passwordPanel, 0, 5, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 7, 10), 1.0,0.0);
return passwordPanel;
| private void | helpButtonActionPerformed()
DialogEvent de = new DialogEvent(this, DialogEvent.HELP_ACTION);
for(int i=0 ; i<this.dialogListeners.size(); i++){
((DialogListener)dialogListeners.elementAt(i)).dialogProcessed(de);
}
| private void | initComponents()This method is called from within the constructor to
initialize the form.
WARNING: Do NOT modify this code. The content of this method is
always regenerated by the Form Editor.
java.awt.GridBagConstraints gridBagConstraints;
javax.swing.JLabel domainNameLabel = new javax.swing.JLabel();
domainsComboBox = new javax.swing.JComboBox();
instancesComboBox = new javax.swing.JComboBox();
javax.swing.JPanel passwordPanel = null;
getContentPane().setLayout(new java.awt.GridBagLayout());
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
cancelButtonActionPerformed();
}
});
domainsComboBox.setModel(new javax.swing.DefaultComboBoxModel(domainList.toArray()));
domainsComboBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
domainsComboBoxItemStateChanged();
}
});
this.addComponetWithConstraints(domainsComboBox,getContentPane(), 0, 1, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 10, 60), 1.0,0.0);
if(commonInfo.getSourceVersion().equals(UpgradeConstants.VERSION_7X)) {
domainNameLabel.setText(stringManager.getString("upgrade.gui.adddomainpanel.instanceBoxLabel"));
DomainInfo dInfo = (DomainInfo)domainMap.get((String)domainsComboBox.getSelectedItem());
instanceList = dInfo.getInstanceNames();
instanceList.remove("admin-server");
instancesComboBox.setModel(new javax.swing.DefaultComboBoxModel(instanceList.toArray()));
instancesComboBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
instancesComboBoxItemStateChanged();
}
});
this.addComponetWithConstraints(instancesComboBox,getContentPane(), 0, 2, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 10, 60), 1.0,0.0);
} else {
domainNameLabel.setText(stringManager.getString("upgrade.gui.adddomainpanel.listBoxLabel"));
}
this.addComponetWithConstraints(domainNameLabel,getContentPane(), 0, 0, 1,1, GridBagConstraints.HORIZONTAL, new Insets(10,10,5,60), 1.0,0.0);
if((this.currentSourceToVersion == this.NSStoJKS) || (this.currentSourceToVersion == this.JKStoNSS)){
passwordPanel = this.getPasswordPanelWith3Fields();
}else{
passwordPanel = this.getPasswordPanelWith2Fields();
}
this.addComponetWithConstraints(passwordPanel,getContentPane(), 0, 3, 1,1, GridBagConstraints.BOTH, new Insets(5, 10, 10, 60), 1.0,1.0);
this.addComponetWithConstraints(getButtonsPanel(),getContentPane(), 0, 4, 1,1, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 1.0,0.0);
this.setSize(400, 350);
| private void | instancesComboBoxItemStateChanged()
// Add your handling code here:
| public static void | main(java.lang.String[] args)
//new AddDomainDialog(new javax.swing.JFrame(), true).show();
| private void | okButtonActionPerformed()
DialogEvent de = new DialogEvent(this, DialogEvent.FINISH_ACTION);
Vector data = new Vector();
de.setObject(data);
data.add(new Integer(this.currentSourceToVersion));
data.add(domainsComboBox.getSelectedItem());
if(instanceList.isEmpty()) {
data.add("server");
} else {
data.add(instancesComboBox.getSelectedItem());
}
if((sourceCertPwdField.getPassword() != null) && (!("".equals(new String(sourceCertPwdField.getPassword()).trim())))){
data.add(new String(sourceCertPwdField.getPassword()));
}
if((targetKeyDBPwdField.getPassword() != null) && (!("".equals(new String(targetKeyDBPwdField.getPassword()).trim())))){
data.add(new String(targetKeyDBPwdField.getPassword()));
}
if((this.currentSourceToVersion == this.NSStoJKS) || (this.currentSourceToVersion == this.JKStoNSS)){
if((targetCertAuthPwdField.getPassword() != null) && (!("".equals(new String(targetCertAuthPwdField.getPassword()).trim())))){
data.add(new String(targetCertAuthPwdField.getPassword()));
}
}
for(int i=0 ; i<this.dialogListeners.size(); i++){
((DialogListener)dialogListeners.elementAt(i)).dialogProcessed(de);
}
| public void | removeDialogListener(DialogListener listener)
this.dialogListeners.removeElement(listener);
|
|