Changeset 21013
- Timestamp:
- 02/09/08 20:04:02 (10 months ago)
- Files:
-
- juggler/trunk/modules/tweek/ChangeLog (modified) (1 diff)
- juggler/trunk/modules/tweek/VERSION (modified) (1 diff)
- juggler/trunk/modules/tweek/configure.ac (modified) (1 diff)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/GlobalPreferencesServiceImpl.java (modified) (7 diffs)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/BeanContainer.java (modified) (1 diff)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/DirectConnectionDialog.java (moved) (moved from juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/ConnectionDialog.java) (17 diffs)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/GlobalPrefsUpdateEvent.java (modified) (1 diff)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/NamingServiceConnectionDialog.java (copied) (copied from juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/ConnectionDialog.java) (15 diffs)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/PrefsDialog.java (modified) (12 diffs)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/TweekFrame.java (modified) (5 diffs)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/net/CommunicationEvent.java (modified) (1 diff)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/net/corba/CorbaService.java (modified) (8 diffs)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/services/GlobalPreferencesService.java (modified) (1 diff)
- juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/services/GlobalPreferencesServiceProxy.java (modified) (2 diffs)
- juggler/trunk/modules/tweek/test/DirectConnectTestBean (added)
- juggler/trunk/modules/tweek/test/DirectConnectTestBean/Makefile.in (copied) (copied from juggler/trunk/modules/tweek/test/NetworkTestBean/Makefile.in) (4 diffs)
- juggler/trunk/modules/tweek/test/DirectConnectTestBean/NMakefile (copied) (copied from juggler/trunk/modules/tweek/test/NetworkTestBean/NMakefile) (1 diff)
- juggler/trunk/modules/tweek/test/DirectConnectTestBean/main.cpp (copied) (copied from juggler/trunk/modules/tweek/test/NetworkTestBean/main.cpp) (1 diff)
- juggler/trunk/modules/tweek/test/Makefile.in (modified) (1 diff)
- juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.cpp (modified) (13 diffs)
- juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.h (modified) (3 diffs)
- juggler/trunk/modules/tweek/tweek/CORBA/SubjectManagerImpl.cpp (modified) (3 diffs)
- juggler/trunk/modules/tweek/tweek/CORBA/SubjectManagerImpl.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/tweek/ChangeLog
r20763 r21013 1 1 DATE AUTHOR CHANGE 2 2 ---------- ----------- -------------------------------------------------------- 3 2008-02-09 patrick Added the ability to make direct connections to a 4 Subject Manager servant (that is, without involving the 5 CORBA Naming Service). 6 NEW VERSION: 1.3.4 3 7 2007-09-04 patrick Use new environment variable TWEEK_DATA_DIR as a way to 4 8 look up files in TWEEK_BASE_DIR/share/tweek. juggler/trunk/modules/tweek/VERSION
r20763 r21013 1 1.3.4-0 @02/10/2008 02:05:00 UTC@ 1 2 1.3.3-0 @09/05/2007 03:00:00 UTC@ 2 3 1.3.2-0 @07/08/2007 21:15:00 UTC@ juggler/trunk/modules/tweek/configure.ac
r20974 r21013 1474 1474 test/BeanDeliveryTest/Makefile 1475 1475 test/CxxClient/Makefile 1476 test/DirectConnectTestBean/Makefile 1476 1477 test/FileOpenTestBean/Makefile 1477 1478 test/NetworkTestBean/Makefile juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/GlobalPreferencesServiceImpl.java
r20974 r21013 334 334 } 335 335 336 public void setDefaultCorbaHost(String host) 337 { 338 defaultCorbaHost = host; 336 /** 337 * This method was renamed from setDefaultCorbaHost() in version 1.3.4. 338 * 339 * @since 1.3.4 340 */ 341 public void setDefaultNamingServiceHost(String host) 342 { 343 defaultNamingServiceHost = host; 339 344 340 345 Element e = mPrefsDocRoot.getChild("corba"); … … 346 351 } 347 352 348 e.setAttribute("host", host); 349 } 350 351 public String getDefaultCorbaHost() 352 { 353 return defaultCorbaHost; 354 } 355 356 public void setDefaultCorbaPort(int port) 357 { 358 defaultCorbaPort = port; 353 e.setAttribute("nshost", host); 354 } 355 356 /** 357 * This method was renamed from getDefaultCorbaHost() in version 1.3.4. 358 * 359 * @since 1.3.4 360 */ 361 public String getDefaultNamingServiceHost() 362 { 363 return defaultNamingServiceHost; 364 } 365 366 /** 367 * This method was renamed from setDefaultCorbaPort() in version 1.3.4. 368 * 369 * @since 1.3.4 370 */ 371 public void setDefaultNamingServicePort(int port) 372 { 373 defaultNamingServicePort = port; 359 374 360 375 Element e = mPrefsDocRoot.getChild("corba"); … … 366 381 } 367 382 368 e.setAttribute("port", String.valueOf(port)); 369 } 370 371 public int getDefaultCorbaPort() 372 { 373 return defaultCorbaPort; 383 e.setAttribute("nsport", String.valueOf(port)); 384 } 385 386 /** 387 * This method was renamed from getDefaultCorbaPort() in version 1.3.4. 388 * 389 * @since 1.3.4 390 */ 391 public int getDefaultNamingServicePort() 392 { 393 return defaultNamingServicePort; 374 394 } 375 395 … … 392 412 { 393 413 return defaultIiopVersion; 414 } 415 416 /** 417 * Sets the default ORB endpoint host address. 418 * 419 * @since 1.3.4 420 */ 421 public void setDefaultOrbAddress(String addr) 422 { 423 defaultOrbAddress = addr; 424 425 Element e = mPrefsDocRoot.getChild("corba"); 426 427 if ( e == null ) 428 { 429 e = new Element("corba"); 430 mPrefsDocRoot.addContent(e); 431 } 432 433 e.setAttribute("orbaddr", addr); 434 } 435 436 /** 437 * Returns the default ORB endpoint host address. 438 * 439 * @since 1.3.4 440 */ 441 public String getDefaultOrbAddress() 442 { 443 return defaultOrbAddress; 444 } 445 446 /** 447 * Sets the default ORB endpoint port number. 448 * 449 * @since 1.3.4 450 */ 451 public void setDefaultOrbPort(int port) 452 { 453 defaultOrbPort = port; 454 455 Element e = mPrefsDocRoot.getChild("corba"); 456 457 if ( e == null ) 458 { 459 e = new Element("corba"); 460 mPrefsDocRoot.addContent(e); 461 } 462 463 e.setAttribute("orbport", String.valueOf(port)); 464 } 465 466 /** 467 * Returns the deffault ORB endpoint port number. 468 * 469 * @since 1.3.4 470 */ 471 public int getDefaultOrbPort() 472 { 473 return defaultOrbPort; 394 474 } 395 475 … … 474 554 { 475 555 // Read the preferred Naming Service host identifier. 476 Attribute corba_attr = corba_element.getAttribute("host"); 556 Attribute corba_attr = corba_element.getAttribute("nshost"); 557 558 // Check the "host" attribute for backwards compatibility. 559 if ( null == corba_attr ) 560 { 561 corba_attr = corba_element.getAttribute("host"); 562 } 477 563 478 564 if ( null != corba_attr ) 479 565 { 480 default CorbaHost = corba_attr.getValue();566 defaultNamingServiceHost = corba_attr.getValue(); 481 567 } 482 568 483 569 // Read the preferred Naming Service port number. 484 corba_attr = corba_element.getAttribute("port"); 570 corba_attr = corba_element.getAttribute("nsport"); 571 572 // Check the "port" attribute for backwards compatibility. 573 if ( null == corba_attr ) 574 { 575 corba_attr = corba_element.getAttribute("port"); 576 } 485 577 486 578 if ( null != corba_attr ) 487 579 { 488 default CorbaPort = corba_attr.getIntValue();580 defaultNamingServicePort = corba_attr.getIntValue(); 489 581 } 490 582 … … 553 645 554 646 Element corba_element = new Element("corba"); 555 corba_element.setAttribute("host", defaultCorbaHost); 556 corba_element.setAttribute("port", String.valueOf(defaultCorbaPort)); 647 corba_element.setAttribute("orbaddr", defaultOrbAddress); 648 corba_element.setAttribute("orbport", 649 String.valueOf(defaultOrbPort)); 650 corba_element.setAttribute("nshost", defaultNamingServiceHost); 651 corba_element.setAttribute("nsport", 652 String.valueOf(defaultNamingServicePort)); 557 653 corba_element.setAttribute("iiop", defaultIiopVersion); 558 654 mPrefsDocRoot.addContent(corba_element); … … 716 812 private Vector beanViewers = new Vector(); 717 813 718 private int userLevel = 1; 719 private String lookAndFeel = javax.swing.UIManager.getSystemLookAndFeelClassName(); 720 private String beanViewer = null; 721 private int windowWidth = 1024; 722 private int windowHeight = 768; 723 private String chooserStartDir = CWD_START; 814 private int userLevel = 1; 815 private String lookAndFeel = 816 javax.swing.UIManager.getSystemLookAndFeelClassName(); 817 private String beanViewer = null; 818 private int windowWidth = 1024; 819 private int windowHeight = 768; 820 private String chooserStartDir = CWD_START; 724 821 private boolean lazyPanelBeanInstantiation = true; 725 private String defaultCorbaHost = ""; 726 private int defaultCorbaPort = 2809; 727 private String defaultIiopVersion = "1.0"; 822 private String defaultNamingServiceHost = ""; 823 private int defaultNamingServicePort = 2809; 824 private String defaultIiopVersion = "1.0"; 825 private String defaultOrbAddress = ""; 826 private int defaultOrbPort = 12345; 728 827 } juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/BeanContainer.java
r20974 r21013 299 299 300 300 // Attach our observer to the subject. 301 corbaService.registerObject(push_observer, 302 "TweekBeanPusher-" + corbaService.getNameServiceURI()); 301 corbaService.registerObject(push_observer, "TweekBeanPusher"); 303 302 push_subject.attach(push_observer._this()); 304 303 juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/gui/DirectConnectionDialog.java
r20974 r21013 36 36 import javax.swing.event.ListSelectionListener; 37 37 import javax.swing.table.DefaultTableModel; 38 import org.omg.CosNaming.NamingContextPackage.*;39 38 import org.vrjuggler.tweek.beans.BeanRegistry; 40 39 import org.vrjuggler.tweek.beans.TweekBean; … … 48 47 49 48 /** 50 * A modal dialog box used to make a connection with a remote ORB. The Tweek 51 * CORBA Service created as a result of the connection is made available to 52 * external code. 49 * A modal dialog box used to make a direct connection with a remote ORB. The 50 * Tweek CORBA Service created as a result of the connection is made available 51 * to external code. 52 * 53 * @since 1.3.4 53 54 */ 54 public class ConnectionDialog extends JDialog55 public class DirectConnectionDialog extends JDialog 55 56 { 56 public ConnectionDialog(Frame owner, String title)57 public DirectConnectionDialog(Frame owner, String title) 57 58 { 58 59 super(owner, title); … … 68 69 } 69 70 70 mNSHostField.getDocument().addDocumentListener(new AddressFieldValidator()); 71 mNSPortField.getDocument().addDocumentListener(new AddressFieldValidator()); 72 73 this.mSubjectMgrList.addListSelectionListener(new SubjectMgrListSelectionListener(this)); 74 75 // Set defaults for the Naming Service host and the port number. 71 mHostField.getDocument().addDocumentListener(new AddressFieldValidator()); 72 mPortField.getDocument().addDocumentListener(new AddressFieldValidator()); 73 74 // Set defaults for the direct object connection. 76 75 try 77 76 { 78 77 GlobalPreferencesService prefs = new GlobalPreferencesServiceProxy(); 79 78 80 mNSHostField.setText(prefs.getDefaultCorbaHost()); 81 mNSPortField.setText(String.valueOf(prefs.getDefaultCorbaPort())); 82 mNSIiopVerField.setText(String.valueOf(prefs.getDefaultIiopVersion())); 79 mHostField.setText(prefs.getDefaultOrbAddress()); 80 mPortField.setText(String.valueOf(prefs.getDefaultOrbPort())); 83 81 } 84 82 // D'oh! No defaults can be set. … … 91 89 } 92 90 93 // At this point, we may have valid Naming Service connection94 // information, so weshould validate the network address.91 // At this point, we may have valid object connection information, so we 92 // should validate the network address. 95 93 validateNetworkAddress(); 96 94 97 95 // Add an input validator for the port number field. 98 m NSPortField.setInputVerifier(new InputVerifier()96 mPortField.setInputVerifier(new InputVerifier() 99 97 { 100 98 public boolean verify(JComponent input) … … 110 108 } 111 109 112 public int getStatus ()110 public int getStatus() 113 111 { 114 112 return status; 115 }116 117 public String getNameServiceHost ()118 {119 return nameServiceHost;120 }121 122 public int getNameServicePort ()123 {124 return nameServicePort;125 }126 127 public String getNameServiceIiopVersion()128 {129 return nameServiceIiopVersion;130 }131 132 public String getNamingSubcontext ()133 {134 return namingSubcontext;135 113 } 136 114 … … 157 135 private void jbInit() throws Exception 158 136 { 159 mNSConnectBorder = new TitledBorder(new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(142, 142, 142)),"Naming Service Connection"); 160 mSubjectMgrBorder = new TitledBorder(new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(142, 142, 142)),"Subject Manager Choice"); 161 mNSConnectPanel.setLayout(mNSConnectLayout); 162 mNSConnectPanel.setBorder(mNSConnectBorder); 163 mNSConnectPanel.setMinimumSize(new Dimension(450, 175)); 164 165 mNSHostLabel.setHorizontalAlignment(SwingConstants.TRAILING); 166 mNSHostLabel.setLabelFor(mNSHostField); 167 mNSHostLabel.setText("Naming Service Host"); 168 mNSHostField.setMinimumSize(new Dimension(80, 17)); 169 mNSHostField.setPreferredSize(new Dimension(180, 17)); 170 mNSHostField.addFocusListener(new java.awt.event.FocusAdapter() 137 mConnectBorder = new TitledBorder(new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(142, 142, 142)),"CORBA Object Connection"); 138 mConnectPanel.setLayout(mConnectLayout); 139 mConnectPanel.setBorder(mConnectBorder); 140 mConnectPanel.setMinimumSize(new Dimension(450, 175)); 141 142 mHostLabel.setHorizontalAlignment(SwingConstants.TRAILING); 143 mHostLabel.setLabelFor(mHostField); 144 mHostLabel.setText("Host Address"); 145 mHostField.setMinimumSize(new Dimension(80, 17)); 146 mHostField.setPreferredSize(new Dimension(180, 17)); 147 mHostField.addFocusListener(new java.awt.event.FocusAdapter() 171 148 { 172 149 public void focusLost(FocusEvent e) … … 175 152 } 176 153 }); 177 m NSHostField.addActionListener(new java.awt.event.ActionListener()154 mHostField.addActionListener(new java.awt.event.ActionListener() 178 155 { 179 156 public void actionPerformed(ActionEvent e) … … 182 159 } 183 160 }); 184 m NSPortField.addFocusListener(new java.awt.event.FocusAdapter()161 mPortField.addFocusListener(new java.awt.event.FocusAdapter() 185 162 { 186 163 public void focusLost(FocusEvent e) … … 189 166 } 190 167 }); 191 m NSPortField.addActionListener(new java.awt.event.ActionListener()168 mPortField.addActionListener(new java.awt.event.ActionListener() 192 169 { 193 170 public void actionPerformed(ActionEvent e) … … 196 173 } 197 174 }); 198 mSubjectMgrPanel.setBorder(mSubjectMgrBorder); 199 mSubjectMgrPanel.setMinimumSize(new Dimension(450, 200)); 200 mSubjectMgrPanel.setPreferredSize(new Dimension(450, 200)); 201 mSubjectMgrPanel.setLayout(mSubjectMgrLayout); 202 mSubjectMgrSplitPane.setDividerSize(7); 203 mNSConnectButton.setEnabled(false); 204 mNSConnectButton.setSelected(true); 205 mNSConnectButton.setText("Connect"); 206 mNSConnectButton.addActionListener(new java.awt.event.ActionListener() 175 mConnectButton.setEnabled(false); 176 mConnectButton.setSelected(true); 177 mConnectButton.setText("Connect"); 178 mConnectButton.addActionListener(new java.awt.event.ActionListener() 207 179 { 208 180 public void actionPerformed(ActionEvent e) 209 181 { 210 namingServiceConnectAction(e); 211 } 212 }); 213 mOkayButton.setEnabled(false); 214 mSubjectMgrList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 182 objectConnectAction(e); 183 } 184 }); 215 185 mButtonPanel.setMinimumSize(new Dimension(450, 33)); 216 186 mButtonPanel.setPreferredSize(new Dimension(450, 33)); 217 mSubjectMgrListPane.setMinimumSize(new Dimension(100, 90)); 218 mSubjectMgrListPane.setPreferredSize(new Dimension(180, 90)); 219 mSubjectMgrInfoPane.setMinimumSize(new Dimension(100, 90)); 220 mSubjectMgrInfoPane.setPreferredSize(new Dimension(180, 90)); 221 mNSPortLabel.setHorizontalAlignment(SwingConstants.TRAILING); 222 mNSPortLabel.setLabelFor(mNSPortField); 223 mNamingContextLabel.setHorizontalAlignment(SwingConstants.TRAILING); 224 mNamingContextLabel.setLabelFor(mNamingContextField); 225 mNSIiopVerLabel.setHorizontalAlignment(SwingConstants.TRAILING); 226 mNSIiopVerLabel.setLabelFor(mNSIiopVerField); 227 mNSIiopVerLabel.setText("IIOP Version"); 228 mNSIiopVerField.addFocusListener(new java.awt.event.FocusAdapter() 229 { 230 public void focusLost(FocusEvent e) 231 { 232 validateNetworkAddress(); 233 } 234 }); 235 mNSIiopVerField.addActionListener(new java.awt.event.ActionListener() 236 { 237 public void actionPerformed(ActionEvent e) 238 { 239 validateNetworkAddress(); 240 } 241 }); 242 mNSRefreshButton.setEnabled(false); 243 mNSRefreshButton.setText("Refresh"); 244 mNSRefreshButton.addActionListener(new java.awt.event.ActionListener() 245 { 246 public void actionPerformed(ActionEvent e) 247 { 248 namingServiceRefreshAction(); 249 } 250 }); 251 mNSConnectPanel.add(mNSHostLabel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 187 mPortLabel.setHorizontalAlignment(SwingConstants.TRAILING); 188 mPortLabel.setLabelFor(mPortField); 189 mConnectPanel.add(mHostLabel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 252 190 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 47, 18)); 253 m NSConnectPanel.add(mNSHostField, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0191 mConnectPanel.add(mHostField, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0 254 192 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 14, 6)); 255 193 256 m NSPortLabel.setText("Naming Service Port");257 m NSPortField.setMinimumSize(new Dimension(50, 17));258 m NSPortField.setPreferredSize(new Dimension(50, 17));259 m NSConnectPanel.add(mNSPortLabel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0194 mPortLabel.setText("Port Number"); 195 mPortField.setMinimumSize(new Dimension(50, 17)); 196 mPortField.setPreferredSize(new Dimension(50, 17)); 197 mConnectPanel.add(mPortLabel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0 260 198 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 0, 18)); 261 m NSConnectPanel.add(mNSPortField, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0199 mConnectPanel.add(mPortField, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0 262 200 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 10, 6)); 263 201 264 mNSIiopVerField.setMinimumSize(new Dimension(50, 17));265 mNSIiopVerField.setPreferredSize(new Dimension(50, 17));266 mNSConnectPanel.add(mNSIiopVerLabel, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0267 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 0, 18));268 mNSConnectPanel.add(mNSIiopVerField, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0269 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 10, 6));270 271 mNamingContextLabel.setText("Naming Subcontext");272 mNamingContextField.setMinimumSize(new Dimension(80, 17));273 mNamingContextField.setPreferredSize(new Dimension(150, 17));274 275 mOkayButton.setText("OK");276 mOkayButton.setMnemonic('O');277 mOkayButton.setSelected(true);278 mOkayButton.addActionListener(new ActionListener()279 {280 public void actionPerformed (ActionEvent e)281 {282 okButtonAction(e);283 }284 });285 202 286 203 mCancelButton.setText("Cancel"); … … 294 211 }); 295 212 296 this.getContentPane().add(mNSConnectPanel, BorderLayout.NORTH); 297 298 mNSConnectPanel.add(mNamingContextLabel, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0 299 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 0, 18)); 300 mNSConnectPanel.add(mNamingContextField, new GridBagConstraints(2, 3, 1, 1, 1.0, 0.0 301 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 44, 6)); 302 mNSConnectPanel.add(mNSButtonPanel, new GridBagConstraints(1, 4, 2, 1, 0.0, 0.0 213 this.getContentPane().add(mConnectPanel, BorderLayout.NORTH); 214 215 mConnectPanel.add(mButtonPanel, new GridBagConstraints(1, 4, 2, 1, 0.0, 0.0 303 216 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); 304 mNSButtonPanel.add(mNSConnectButton, null);305 mNSButtonPanel.add(mNSRefreshButton, null);306 217 307 218 this.getContentPane().add(mButtonPanel, BorderLayout.SOUTH); 308 mButtonPanel.add(m OkayButton, null);219 mButtonPanel.add(mConnectButton, null); 309 220 mButtonPanel.add(mCancelButton, null); 310 this.getContentPane().add(mSubjectMgrPanel, BorderLayout.CENTER);311 mSubjectMgrPanel.add(mSubjectMgrSplitPane, BorderLayout.CENTER);312 mSubjectMgrSplitPane.add(mSubjectMgrListPane, JSplitPane.LEFT);313 mSubjectMgrSplitPane.add(mSubjectMgrInfoPane, JSplitPane.RIGHT);314 221 } 315 222 316 223 /** 317 224 * Handles the event generated by the user clicking the "Connect" button in 318 * the Naming Serviceconnection panel.225 * the connection panel. 319 226 */ 320 private void namingServiceConnectAction(ActionEvent e) 321 { 322 // Commit the information provided by the user in the data entry fields. 323 commitConnectInfo(); 324 325 // Create a new CORBA service using the information provided by the user. 326 CorbaService new_orb = new CorbaService(this.getNameServiceHost(), 327 this.getNameServicePort(), 328 this.getNameServiceIiopVersion(), 329 this.getNamingSubcontext()); 330 227 private void objectConnectAction(ActionEvent e) 228 { 229 // If we have the Tweek Environment Service, and we should, initialize 230 // the new CORBA service with the command line arguments passed when the 231 // Tweek GUI was started. 331 232 try 332 233 { 333 // If we have the Tweek Environment Service, and we should, initialize 334 // the new CORBA service with the command line arguments passed when 335 // the Tweek GUI was started. 336 try 337 { 338 EnvironmentService env_service = new EnvironmentServiceProxy(); 339 340 // This may throw several types of exceptions, all of which are 341 // handled below. 342 new_orb.init(env_service.getCommandLineArgs()); 343 344 // We initialized the CorbaService object successfully and 345 // connected to the remote Naming Service. 346 corbaService = new_orb; 347 348 // XXX: Should we allow the user to make multiple connections from 349 // a single dialog box? Probably not... 350 mNSConnectButton.setEnabled(false); 351 mNSRefreshButton.setEnabled(true); 352 353 // Create a new list model for the fresh list of Subject Managers. 354 DefaultListModel mgr_list_model = new DefaultListModel(); 355 356 // Get the list of Subject Managers. There had better be at least 357 // one! The list returned is guaranteed to contain valid references 358 // at the time of construction. 359 java.util.Iterator i = new_orb.getSubjectManagerList().iterator(); 360 tweek.SubjectManager cur_mgr; 361 362 while ( i.hasNext() ) 363 { 364 cur_mgr = (tweek.SubjectManager) i.next(); 365 mgr_list_model.addElement(new SubjectManagerWrapper(cur_mgr)); 366 } 367 368 mSubjectMgrList.setModel(mgr_list_model); 369 } 370 catch(org.omg.CosNaming.NamingContextPackage.NotFound nfex) 371 { 372 String reason = ""; 373 374 if ( nfex.why == NotFoundReason.not_context ) 375 { 376 reason = " (naming context is an object)"; 377 } 378 else if ( nfex.why == NotFoundReason.not_object ) 379 { 380 reason = " (object is a naming context)"; 381 } 382 else if ( nfex.why == NotFoundReason.missing_node ) 383 { 384 reason = " (node in name path is missing)"; 385 } 386 else 387 { 388 reason = " (" + nfex.getMessage() + ")"; 389 } 390 391 int answer = 392 JOptionPane.showConfirmDialog(this, 393 "No naming context found" + 394 reason + 395 ".\nDisconnect from this Naming Service?", 396 "Naming Context Lookup Failure", 397 JOptionPane.YES_NO_OPTION, 398 JOptionPane.QUESTION_MESSAGE); 399 400 // Disable this button regardless of the user's answer. A new 401 // connection cannot be attempted until new naming service 402 // connection is entered or the current connection is closed. 403 mNSConnectButton.setEnabled(false); 404 405 // If the user clicked "No," then we need to enable the refresh 406 // button so that an attempt can be made to get a new list of 407 // Subject Managers later. 408 if ( answer == JOptionPane.NO_OPTION ) 409 { 410 corbaService = new_orb; 411 mNSRefreshButton.setEnabled(true); 412 } 413 // If the user clicked "Yes," then ensure that the refresh button 414 // is disabled until the next connection attempt. 415 else 416 { 417 mNSRefreshButton.setEnabled(false); 418 } 419 } 420 catch(org.omg.CORBA.ORBPackage.InvalidName poaNameEx) 421 { 422 JOptionPane.showConfirmDialog(this, poaNameEx.getMessage(), 423 "Root Portable Object Adapter Not Found", 234 EnvironmentService env_service = new EnvironmentServiceProxy(); 235 236 // Create a new CORBA service using the information provided by 237 // the user. This may throw several types of exceptions, all of 238 // which are handled below. 239 corbaService = new CorbaService(env_service.getCommandLineArgs()); 240 241 String host = mHostField.getText(); 242 int port = Integer.parseInt(mPortField.getText()); 243 244 // Construct the corbaloc URI for the direct object connection. 245 String uri = "corbaloc::" + host + ":" + port + "/SubjectManager"; 246 247 tweek.SubjectManager subj_mgr = 248 tweek.SubjectManagerHelper.narrow( 249 corbaService.getORB().string_to_object(uri) 250 ); 251 252 if ( null != subj_mgr ) 253 { 254 corbaService.setSubjectManager(subj_mgr); 255 status = OK_OPTION; 256 dispose(); 257 } 258 else 259 { 260 JOptionPane.showConfirmDialog(this, "No object found at " + uri, 261 "CORBA Object Not Found", 424 262 JOptionPane.OK_OPTION, 425 263 JOptionPane.ERROR_MESSAGE); 426 264 } 427 catch(org.omg.PortableServer.POAManagerPackage.AdapterInactive poaEx) 428 { 429 JOptionPane.showConfirmDialog(this, poaEx.getMessage(), 430 "Root Portable Object Adapter Inactive", 431 JOptionPane.OK_OPTION, 432 JOptionPane.ERROR_MESSAGE); 433 } 434 catch(org.omg.CORBA.UserException userEx) 435 { 436 JOptionPane.showConfirmDialog(this, userEx.getMessage(), 437 "CORBA User Exception", 438 JOptionPane.OK_OPTION, 439 JOptionPane.ERROR_MESSAGE); 440 } 441 catch(RuntimeException ex) 442 { 443 ex.printStackTrace(); 444 } 265 } 266 catch (org.omg.CORBA.ORBPackage.InvalidName poaNameEx) 267 { 268 JOptionPane.showConfirmDialog( 269 this, poaNameEx.getMessage(), 270 "Root Portable Object Adapter Not Found", 271 JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE 272 ); 273 } 274 catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive poaEx) 275 { 276 JOptionPane.showConfirmDialog( 277 this, poaEx.getMessage(), 278 "Root Portable Object Adapter Inactive", JOptionPane.OK_OPTION, 279 JOptionPane.ERROR_MESSAGE 280 ); 281 } 282 catch (org.omg.CORBA.UserException userEx) 283 { 284 JOptionPane.showConfirmDialog(this, userEx.getMessage(), 285 "CORBA User Exception", 286 JOptionPane.OK_OPTION, 287 JOptionPane.ERROR_MESSAGE); 445 288 } 446 289 // Something went wrong with the CORBA service initialization. … … 450 293 // caused the connection to fail, but failure should not disallow any 451 294 // further attempts to connect. 452 mNSConnectButton.setEnabled(true); 453 mNSRefreshButton.setEnabled(false); 295 mConnectButton.setEnabled(true); 454 296 455 297 // Pop up a dialog stating that the connection failed. … … 462 304 sys_ex.printStackTrace(); 463 305 } 464 } 465 466 private void namingServiceRefreshAction() 467 { 468 // Create a new list model for the fresh list of Subject Managers. 469 DefaultListModel mgr_list_model = new DefaultListModel(); 470 471 // Get the list of Subject Managers. There had better be at least 472 // one! The list returned is guaranteed to contain valid references 473 // at the time of construction. 474 java.util.Iterator i = corbaService.getSubjectManagerList().iterator(); 475 tweek.SubjectManager cur_mgr; 476 477 while ( i.hasNext() ) 478 { 479 cur_mgr = (tweek.SubjectManager) i.next(); 480 mgr_list_model.addElement(new SubjectManagerWrapper(cur_mgr)); 481 } 482 483 mSubjectMgrList.setModel(mgr_list_model); 484 mSubjectMgrList.invalidate(); 485 } 486 487 /** 488 * Commits the user-specified information from the text fields to this 489 * object's properties. After calling this method, those properties can be 490 * considered up to date and usable. 491 */ 492 private void commitConnectInfo() 493 { 494 nameServiceHost = mNSHostField.getText(); 495 nameServicePort = Integer.parseInt(mNSPortField.getText()); 496 nameServiceIiopVersion = mNSIiopVerField.getText(); 497 namingSubcontext = mNamingContextField.getText(); 498 } 499 500 private void okButtonAction(ActionEvent e) 501 { 502 status = OK_OPTION; 503 commit(); 504 dispose(); 306 catch (RuntimeException ex) 307 { 308 ex.printStackTrace(); 309 } 505 310 } 506 311 … … 522 327 } 523 328 524 private void commit()525 {526 if ( null != mSubjectManager )527 {528 corbaService.setSubjectManager(mSubjectManager);529 }530 }531 532 329 /** 533 330 * Validates that the network address (hostname and port number) entered 534 * by the user. If the network address is valid, then the Naming Service 535 * connection button is enabled. Otherwise, it is disabled. 331 * by the user. 536 332 */ 537 333 private void validateNetworkAddress() … … 541 337 if ( null == corbaService ) 542 338 { 543 if ( ! mNSHostField.getText().equals("") && 544 validatePortNumber(mNSPortField.getText()) && 545 ! mNSIiopVerField.getText().equals("") ) 546 { 547 mNSConnectButton.setEnabled(true); 339 if ( ! mHostField.getText().equals("") && 340 validatePortNumber(mPortField.getText()) ) 341 { 342 mConnectButton.setEnabled(true); 548 343 } 549 344 else 550 345 { 551 m NSConnectButton.setEnabled(false);346 mConnectButton.setEnabled(false); 552 347 } 553 348 } … … 581 376 /** 582 377 * An implementation of DocumentListener used to validate the network 583 * address entered for the CORBA Naming Service.378 * address entered for the CORBA object URI. 584 379 */ 585 380 private class AddressFieldValidator implements DocumentListener … … 601 396 } 602 397 603 /**604 * An implementation of ListSelectionListener for use with the list of605 * known Tweek Subject Manager references. When a Subject Manager is606 * selected in the list, the table mSubjectMgrInfo is updated to display607 * information queried from that Subject Manager.608 */609 private class SubjectMgrListSelectionListener610 implements ListSelectionListener611 {612 public SubjectMgrListSelectionListener(JDialog parent)613 {614 mParentDialog = parent;615 &nbs
