1 19 20 package org.netbeans.modules.j2ee.clientproject.ui.wizards; 21 22 import java.beans.PropertyChangeEvent ; 23 import java.beans.PropertyChangeListener ; 24 import java.text.MessageFormat ; 25 import java.util.ArrayList ; 26 import java.util.List ; 27 import java.util.Set ; 28 import java.util.StringTokenizer ; 29 import java.util.TreeSet ; 30 import javax.swing.DefaultComboBoxModel ; 31 import javax.swing.event.DocumentListener ; 32 import javax.swing.event.DocumentEvent ; 33 import org.netbeans.api.project.Project; 34 import org.netbeans.api.project.ProjectInformation; 35 import org.netbeans.api.project.ProjectUtils; 36 import org.netbeans.api.project.ui.OpenProjects; 37 import org.netbeans.modules.j2ee.clientproject.ui.FoldersListSettings; 38 import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment; 39 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; 40 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModuleContainer; 41 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform; 42 import org.netbeans.modules.j2ee.deployment.devmodules.api.ServerManager; 43 import org.openide.WizardDescriptor; 44 import org.openide.WizardValidationException; 45 import org.openide.util.NbBundle; 46 import org.openide.util.Utilities; 47 48 51 public class PanelOptionsVisual extends SettingsPanel implements PropertyChangeListener { 52 53 private final PanelConfigureProject panel; 54 private boolean valid; 55 56 private List <Project> earProjects; 57 private final DefaultComboBoxModel serversModel = new DefaultComboBoxModel (); 58 private J2eeVersionWarningPanel warningPanel; 59 60 private static final String J2EE_SPEC_15_LABEL = NbBundle.getMessage(PanelOptionsVisual.class, "J2EESpecLevel_15"); 61 private static final String J2EE_SPEC_14_LABEL = NbBundle.getMessage(PanelOptionsVisual.class, "J2EESpecLevel_14"); 62 63 64 public PanelOptionsVisual( PanelConfigureProject panel ) { 65 initComponents(); 66 setJ2eeVersionWarningPanel(); 67 initEnterpriseApplications(); 68 this.panel = panel; 69 initServers(FoldersListSettings.getDefault().getLastUsedServer()); 70 if (j2eeSpecComboBox.getModel().getSize() > 0) { 72 j2eeSpecComboBox.setSelectedIndex(0); 73 } 74 this.mainClassTextField.getDocument().addDocumentListener( new DocumentListener () { 75 76 public void insertUpdate(DocumentEvent e) { 77 mainClassChanged(); 78 } 79 80 public void removeUpdate(DocumentEvent e) { 81 mainClassChanged(); 82 } 83 84 public void changedUpdate(DocumentEvent e) { 85 mainClassChanged(); 86 } 87 88 }); 89 } 90 91 public void propertyChange(PropertyChangeEvent event) { 92 if (PanelProjectLocationVisual.PROP_PROJECT_NAME.equals(event.getPropertyName())) { 93 String newProjectName = NewAppClientProjectWizardIterator.getPackageName((String ) event.getNewValue()); 94 if (!Utilities.isJavaIdentifier(newProjectName)) { 95 newProjectName = NbBundle.getMessage(PanelOptionsVisual.class, "TXT_PackageNameSuffix", newProjectName); 96 } 97 this.mainClassTextField.setText(MessageFormat.format( 98 NbBundle.getMessage(PanelOptionsVisual.class,"TXT_ClassName"), new Object [] {newProjectName} 99 )); 100 } 101 } 102 103 108 private void initComponents() { 110 java.awt.GridBagConstraints gridBagConstraints; 111 112 setAsMainCheckBox = new javax.swing.JCheckBox (); 113 mainClassTextField = new javax.swing.JTextField (); 114 addToAppLabel = new javax.swing.JLabel (); 115 serverInstanceLabel = new javax.swing.JLabel (); 116 serverInstanceComboBox = new javax.swing.JComboBox (); 117 addToAppComboBox = new javax.swing.JComboBox (); 118 j2eeSpecComboBox = new javax.swing.JComboBox (); 119 j2eeSpecLabel = new javax.swing.JLabel (); 120 warningPlaceHolderPanel = new javax.swing.JPanel (); 121 mainClassLabel = new javax.swing.JLabel (); 122 manageServersButton = new javax.swing.JButton (); 123 124 setLayout(new java.awt.GridBagLayout ()); 125 126 setAsMainCheckBox.setSelected(true); 127 org.openide.awt.Mnemonics.setLocalizedText(setAsMainCheckBox, org.openide.util.NbBundle.getBundle(PanelOptionsVisual.class).getString("LBL_setAsMainCheckBox")); setAsMainCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 129 gridBagConstraints = new java.awt.GridBagConstraints (); 130 gridBagConstraints.gridx = 0; 131 gridBagConstraints.gridy = 5; 132 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 133 gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; 134 gridBagConstraints.weightx = 1.0; 135 gridBagConstraints.weighty = 1.0; 136 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 137 add(setAsMainCheckBox, gridBagConstraints); 138 setAsMainCheckBox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelOptionsVisual.class).getString("ACSN_setAsMainCheckBox")); setAsMainCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelOptionsVisual.class).getString("ACSD_setAsMainCheckBox")); 141 mainClassTextField.setText("com.myapp.Main"); 142 gridBagConstraints = new java.awt.GridBagConstraints (); 143 gridBagConstraints.gridx = 1; 144 gridBagConstraints.gridy = 3; 145 gridBagConstraints.gridwidth = 2; 146 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 147 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 148 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 0); 149 add(mainClassTextField, gridBagConstraints); 150 mainClassTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelOptionsVisual.class).getString("ASCN_mainClassTextField")); mainClassTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelOptionsVisual.class).getString("ASCD_mainClassTextField")); 153 addToAppLabel.setLabelFor(addToAppComboBox); 154 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/clientproject/ui/wizards/Bundle"); org.openide.awt.Mnemonics.setLocalizedText(addToAppLabel, bundle.getString("LBL_NWP1_AddToEApp_CheckBox")); gridBagConstraints = new java.awt.GridBagConstraints (); 157 gridBagConstraints.gridx = 0; 158 gridBagConstraints.gridy = 0; 159 gridBagConstraints.gridwidth = 2; 160 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 161 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 11); 162 add(addToAppLabel, gridBagConstraints); 163 164 serverInstanceLabel.setLabelFor(serverInstanceComboBox); 165 org.openide.awt.Mnemonics.setLocalizedText(serverInstanceLabel, org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "LBL_NWP1_Server_Label")); gridBagConstraints = new java.awt.GridBagConstraints (); 167 gridBagConstraints.gridx = 0; 168 gridBagConstraints.gridy = 1; 169 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 170 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 11); 171 add(serverInstanceLabel, gridBagConstraints); 172 173 serverInstanceComboBox.setModel(serversModel); 174 serverInstanceComboBox.addActionListener(new java.awt.event.ActionListener () { 175 public void actionPerformed(java.awt.event.ActionEvent evt) { 176 serverInstanceComboBoxActionPerformed(evt); 177 } 178 }); 179 gridBagConstraints = new java.awt.GridBagConstraints (); 180 gridBagConstraints.gridx = 1; 181 gridBagConstraints.gridy = 1; 182 gridBagConstraints.gridwidth = 2; 183 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 184 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 185 gridBagConstraints.weightx = 1.0; 186 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 0); 187 add(serverInstanceComboBox, gridBagConstraints); 188 serverInstanceComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "ACS_LBL_IW_SelectServerInstance_A11YDesc")); 190 gridBagConstraints = new java.awt.GridBagConstraints (); 191 gridBagConstraints.gridx = 2; 192 gridBagConstraints.gridy = 0; 193 gridBagConstraints.gridwidth = 2; 194 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 195 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 196 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 0); 197 add(addToAppComboBox, gridBagConstraints); 198 199 j2eeSpecComboBox.setPrototypeDisplayValue("MMMMMMMMM" ); 200 j2eeSpecComboBox.addActionListener(new java.awt.event.ActionListener () { 201 public void actionPerformed(java.awt.event.ActionEvent evt) { 202 j2eeSpecComboBoxActionPerformed(evt); 203 } 204 }); 205 gridBagConstraints = new java.awt.GridBagConstraints (); 206 gridBagConstraints.gridx = 1; 207 gridBagConstraints.gridy = 2; 208 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 209 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 210 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 0); 211 add(j2eeSpecComboBox, gridBagConstraints); 212 j2eeSpecComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "ACS_LBL_IW_SelectJ2EEVersion_A11YDesc")); 214 j2eeSpecLabel.setLabelFor(j2eeSpecComboBox); 215 org.openide.awt.Mnemonics.setLocalizedText(j2eeSpecLabel, NbBundle.getBundle("org/netbeans/modules/j2ee/clientproject/ui/wizards/Bundle").getString("LBL_NWP1_J2EESpecLevel_Label")); gridBagConstraints = new java.awt.GridBagConstraints (); 217 gridBagConstraints.gridx = 0; 218 gridBagConstraints.gridy = 2; 219 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 220 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 11); 221 add(j2eeSpecLabel, gridBagConstraints); 222 223 warningPlaceHolderPanel.setLayout(new java.awt.BorderLayout ()); 224 gridBagConstraints = new java.awt.GridBagConstraints (); 225 gridBagConstraints.gridx = 0; 226 gridBagConstraints.gridy = 4; 227 gridBagConstraints.gridwidth = 3; 228 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 229 gridBagConstraints.weightx = 1.0; 230 add(warningPlaceHolderPanel, gridBagConstraints); 231 232 mainClassLabel.setLabelFor(mainClassTextField); 233 org.openide.awt.Mnemonics.setLocalizedText(mainClassLabel, org.openide.util.NbBundle.getBundle(PanelOptionsVisual.class).getString("LBL_NWP1_MainClass_Label")); mainClassLabel.setAlignmentX(0.5F); 235 gridBagConstraints = new java.awt.GridBagConstraints (); 236 gridBagConstraints.gridx = 0; 237 gridBagConstraints.gridy = 3; 238 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 239 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 11); 240 add(mainClassLabel, gridBagConstraints); 241 242 org.openide.awt.Mnemonics.setLocalizedText(manageServersButton, org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "LBL_ManageServers")); manageServersButton.addActionListener(new java.awt.event.ActionListener () { 244 public void actionPerformed(java.awt.event.ActionEvent evt) { 245 manageServersButtonActionPerformed(evt); 246 } 247 }); 248 gridBagConstraints = new java.awt.GridBagConstraints (); 249 gridBagConstraints.gridx = 3; 250 gridBagConstraints.gridy = 1; 251 gridBagConstraints.insets = new java.awt.Insets (0, 6, 11, 0); 252 add(manageServersButton, gridBagConstraints); 253 manageServersButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "ASCN_ManageServers")); manageServersButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "ASCD_ManageServers")); 256 getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "ACSN_PanelOptionsVisual")); getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelOptionsVisual.class, "ACSD_PanelOptionsVisual")); } 260 private void manageServersButtonActionPerformed(java.awt.event.ActionEvent evt) { ServerInstanceWrapper serverInstanceWrapper = (ServerInstanceWrapper) serversModel.getSelectedItem(); 262 String lastSelectedServerInstanceID = null; 263 if (serverInstanceWrapper != null) { 264 lastSelectedServerInstanceID = serverInstanceWrapper.getServerInstanceID(); 265 } 266 ServerManager.showCustomizer(lastSelectedServerInstanceID); 267 String lastSelectedJ2eeSpecLevel = (String ) j2eeSpecComboBox.getSelectedItem(); 268 initServers(lastSelectedServerInstanceID); 270 if (lastSelectedJ2eeSpecLevel != null) { 271 j2eeSpecComboBox.setSelectedItem(lastSelectedJ2eeSpecLevel); 272 } 273 } 275 private void serverInstanceComboBoxActionPerformed(java.awt.event.ActionEvent evt) { String prevSelectedItem = (String ) j2eeSpecComboBox.getSelectedItem(); 277 ServerInstanceWrapper serverInstanceWrapper = (ServerInstanceWrapper) serversModel.getSelectedItem(); 279 if (serverInstanceWrapper != null) { 280 J2eePlatform j2eePlatform = Deployment.getDefault().getJ2eePlatform(serverInstanceWrapper.getServerInstanceID()); 281 Set supportedVersions = j2eePlatform.getSupportedSpecVersions(J2eeModule.CLIENT); 282 j2eeSpecComboBox.removeAllItems(); 283 if (supportedVersions.contains(J2eeModule.JAVA_EE_5)) { 284 j2eeSpecComboBox.addItem(J2EE_SPEC_15_LABEL); 285 } 286 if (supportedVersions.contains(J2eeModule.J2EE_14)) { 287 j2eeSpecComboBox.addItem(J2EE_SPEC_14_LABEL); 288 } 289 if (prevSelectedItem != null) { 290 j2eeSpecComboBox.setSelectedItem(prevSelectedItem); 291 } 292 } else { 293 j2eeSpecComboBox.removeAllItems(); 294 } 295 panel.fireChangeEvent(); 297 } 299 private void j2eeSpecComboBoxActionPerformed(java.awt.event.ActionEvent evt) { setJ2eeVersionWarningPanel(); 301 } 303 boolean valid(WizardDescriptor settings) { 304 if (getSelectedServer() == null) { 305 String errMsg = NbBundle.getMessage(PanelOptionsVisual.class, "MSG_NoServer"); 306 settings.putProperty( "WizardPanel_errorMessage", errMsg); return false; 308 } 309 310 if (!valid) { 311 settings.putProperty( "WizardPanel_errorMessage", NbBundle.getMessage(PanelOptionsVisual.class,"ERROR_IllegalMainClassName")); 313 return this.valid; 314 } 315 return true; 316 } 317 318 void read(WizardDescriptor d) { 319 } 321 322 void validate(WizardDescriptor d) throws WizardValidationException { 323 } 325 326 void store( WizardDescriptor d ) { 327 d.putProperty(WizardProperties.MAIN_CLASS, mainClassTextField.getText().trim()); 328 d.putProperty(WizardProperties.SET_AS_MAIN, setAsMainCheckBox.isSelected() ? Boolean.TRUE : Boolean.FALSE ); 329 d.putProperty(WizardProperties.SERVER_INSTANCE_ID, getSelectedServer()); 330 d.putProperty(WizardProperties.J2EE_LEVEL, getSelectedJ2eeSpec()); 331 d.putProperty(WizardProperties.EAR_APPLICATION, getSelectedEarApplication()); 332 if (warningPanel != null && warningPanel.getWarningType() != null && warningPanel.getDowngradeAllowed()) { 333 d.putProperty(WizardProperties.JAVA_PLATFORM, warningPanel.getSuggestedJavaPlatformName()); 334 String j2ee = getSelectedJ2eeSpec(); 335 if (j2ee != null) { 336 String warningType = J2eeVersionWarningPanel.findWarningType(j2ee); 337 FoldersListSettings fls = FoldersListSettings.getDefault(); 338 String srcLevel = "1.6"; if ((warningType.equals(J2eeVersionWarningPanel.WARN_SET_SOURCE_LEVEL_14) 340 || warningType.equals(J2eeVersionWarningPanel.WARN_SET_JDK_14)) 341 && fls.isAgreedSetSourceLevel14()) { 342 srcLevel = "1.4"; } else if ((warningType.equals(J2eeVersionWarningPanel.WARN_SET_SOURCE_LEVEL_15) 344 || warningType.equals(J2eeVersionWarningPanel.WARN_SET_JDK_15)) 345 && fls.isAgreedSetSourceLevel15()) { 346 srcLevel = "1.5"; } 348 d.putProperty(WizardProperties.SOURCE_LEVEL, srcLevel); 349 } 350 } else { 351 d.putProperty(WizardProperties.SOURCE_LEVEL, null); 352 } 353 } 354 355 private javax.swing.JComboBox addToAppComboBox; 357 private javax.swing.JLabel addToAppLabel; 358 private javax.swing.JComboBox j2eeSpecComboBox; 359 private javax.swing.JLabel j2eeSpecLabel; 360 private javax.swing.JLabel mainClassLabel; 361 private javax.swing.JTextField mainClassTextField; 362 private javax.swing.JButton manageServersButton; 363 private javax.swing.JComboBox serverInstanceComboBox; 364 private javax.swing.JLabel serverInstanceLabel; 365 private javax.swing.JCheckBox setAsMainCheckBox; 366 private javax.swing.JPanel warningPlaceHolderPanel; 367 369 private void mainClassChanged() { 370 String mainClassName = this.mainClassTextField.getText().trim(); 371 StringTokenizer tk = new StringTokenizer (mainClassName, "."); boolean valid = tk.countTokens() > 0; 373 while (tk.hasMoreTokens()) { 374 String token = tk.nextToken(); 375 if (token.length() == 0 || !Utilities.isJavaIdentifier(token)) { 376 valid = false; 377 break; 378 } 379 } 380 this.valid = valid; 381 this.panel.fireChangeEvent(); 382 } 383 384 private void setJ2eeVersionWarningPanel() { 385 String j2ee = getSelectedJ2eeSpec(); 386 if (j2ee == null) { 387 return; 388 } 389 String warningType = J2eeVersionWarningPanel.findWarningType(j2ee); 390 if (warningType == null && warningPanel == null) { 391 return; 392 } 393 if (warningPanel == null) { 394 warningPanel = new J2eeVersionWarningPanel(warningType); 395 warningPlaceHolderPanel.add(warningPanel, java.awt.BorderLayout.CENTER); 396 } 397 warningPanel.setWarningType(warningType); 398 } 399 400 404 private void initServers(String selectedServerInstanceID) { 405 serversModel.removeAllElements(); 407 Set <ServerInstanceWrapper> servers = new TreeSet <ServerInstanceWrapper>(); 408 ServerInstanceWrapper selectedItem = null; 409 boolean sjasFound = false; 410 for (String serverInstanceID : Deployment.getDefault().getServerInstanceIDs()) { 411 String displayName = Deployment.getDefault().getServerInstanceDisplayName(serverInstanceID); 412 J2eePlatform j2eePlatform = Deployment.getDefault().getJ2eePlatform(serverInstanceID); 413 if (displayName != null && j2eePlatform != null && j2eePlatform.getSupportedModuleTypes().contains(J2eeModule.CLIENT)) { 414 ServerInstanceWrapper serverWrapper = new ServerInstanceWrapper(serverInstanceID, displayName); 415 if (selectedItem == null || !sjasFound) { 417 if (selectedServerInstanceID != null) { 418 if (selectedServerInstanceID.equals(serverInstanceID)) { 419 selectedItem = serverWrapper; 420 } 421 } else { 422 String shortName = Deployment.getDefault().getServerID(serverInstanceID); 424 if ("J2EE".equals(shortName)) { selectedItem = serverWrapper; 426 sjasFound = true; 427 } 428 else 429 if ("JBoss4".equals(shortName)) { selectedItem = serverWrapper; 431 } 432 } 433 } 434 servers.add(serverWrapper); 435 } 436 } 437 for (ServerInstanceWrapper item : servers) { 438 serversModel.addElement(item); 439 } 440 if (selectedItem != null) { 441 serversModel.setSelectedItem(selectedItem); 443 } else if (serversModel.getSize() > 0) { 444 serversModel.setSelectedItem(serversModel.getElementAt(0)); 446 } 447 } 448 449 private void initEnterpriseApplications() { 450 addToAppComboBox.addItem(NbBundle.getMessage(PanelOptionsVisual.class, "LBL_NWP1_AddToEApp_None")); 451 addToAppComboBox.setSelectedIndex(0); 452 453 Project[] allProjects = OpenProjects.getDefault().getOpenProjects(); 454 earProjects = new ArrayList <Project>(); 455 for (int i = 0; i < allProjects.length; i++) { 456 J2eeModuleContainer container = (J2eeModuleContainer) allProjects[i].getLookup().lookup(J2eeModuleContainer.class); 457 ProjectInformation projectInfo = ProjectUtils.getInformation(allProjects[i]); 458 if (container != null) { 459 earProjects.add(projectInfo.getProject()); 460 addToAppComboBox.addItem(projectInfo.getDisplayName()); 461 } 462 } 463 if (earProjects.size() <= 0) { 464 addToAppComboBox.setEnabled(false); 465 } 466 } 467 468 private String getSelectedJ2eeSpec() { 469 Object item = j2eeSpecComboBox.getSelectedItem(); 470 return item == null ? null 471 : item.equals(J2EE_SPEC_14_LABEL) ? J2eeModule.J2EE_14 472 : item.equals(J2EE_SPEC_15_LABEL) ? J2eeModule.JAVA_EE_5 : J2eeModule.J2EE_13; 473 } 474 475 private String getSelectedServer() { 476 ServerInstanceWrapper serverInstanceWrapper = (ServerInstanceWrapper) serversModel.getSelectedItem(); 477 if (serverInstanceWrapper == null) { 478 return null; 479 } 480 return serverInstanceWrapper.getServerInstanceID(); 481 } 482 483 private Project getSelectedEarApplication() { 484 int idx = addToAppComboBox.getSelectedIndex(); 485 return (idx <= 0) ? null : earProjects.get(idx - 1); 486 } 487 488 492 private static class ServerInstanceWrapper implements Comparable { 493 494 private final String serverInstanceID; 495 private final String displayName; 496 497 ServerInstanceWrapper(String serverInstanceID, String displayName) { 498 this.serverInstanceID = serverInstanceID; 499 this.displayName = displayName; 500 } 501 502 public String getServerInstanceID() { 503 return serverInstanceID; 504 } 505 506 public String toString() { 507 return displayName; 508 } 509 510 public int compareTo(Object o) { 511 return toString().compareTo(o.toString()); 512 } 513 } 514 } 515 516 | Popular Tags |