1 29 38 39 package org.planetamessenger.mos.forms; 40 41 import javax.swing.*; 42 import javax.swing.tree.*; 43 import javax.swing.event.*; 44 import java.awt.Dimension ; 45 import java.awt.event.*; 46 import java.util.*; 47 import java.sql.*; 48 import com.jgoodies.forms.builder.*; 49 import com.jgoodies.forms.layout.*; 50 import com.jgoodies.forms.debug.*; 51 import org.planetamessenger.plugin.*; 52 import org.planetamessenger.mos.engine.*; 53 import org.planetamessenger.mos.forms.preferences.*; 54 55 56 public class JMOSPreferencesDlg extends JDialog implements TreeSelectionListener { 57 58 private final int ITEM_EMPTY = 0; 59 private final int ITEM_ROOT = -1000; 60 private final int ITEM_PLUGINS = -1001; 61 private final int SUB_ITEM_AVAILABLE_PLUGINS = -1002; 62 private final int ITEM_PLUGIN_MANAGEMENT = -1003; 63 private final int SUB_ITEM_INSTALLED_PLUGINS = -1004; 64 private final int SUB_ITEM_PROXY_SETTINGS = -1005; 65 private final int ITEM_PROFILE_SETTINGS = -1006; 66 private final int SUB_ITEM_LANGUAGE_SETTINGS = -1007; 67 private final int SUB_ITEM_LAF_SETTINGS = -1008; 68 private final int SUB_ITEM_ADD_EXISTING_USER = -1009; 69 private final int SUB_ITEM_ADD_NEW_USER = -1010; 70 private final int SUB_ITEM_CHANGE_PASSWD = -1011; 71 private final int SUB_ITEM_UNREGISTER_USER = -1012; 72 private final int SUB_ITEM_REMOVE_PLUGIN = -1013; 73 private final int SUB_ITEM_PRIVACY_CONTROL = -1014; 74 75 private JTree optionsTree = null; 76 private JScrollPane optionsScrollPane = null; 77 private JSplitPane splitPane = null; 78 private JButton okButton = null; 79 private JButton cancelButton = null; 80 private JButton applyButton = null; 81 private DefaultMutableTreeNode rootNode = null; 82 private DefaultMutableTreeNode installedPluginsNode = null; 83 private JAvailablePluginsPanel availablePluginsPanel = null; 84 private JPrivacyControlPanel privacyControlPanel = null; 85 private JProxySettingsPanel proxySettingsPanel = null; 86 private JRegisterUserPanel registerUserPanel = null; 87 private JLanguagesPanel languagesPanel = null; 88 private JYesNoPanel unregisterUserPanel = null; 89 private JYesNoPanel removePluginPanel = null; 90 private WindowAdapter windowAdapter = null; 91 private boolean bEnableApply = false; 92 private JUserInfo userInfo = null; 93 private JPlugin selectedPlugin = null; 94 private JMOSMessageDialog messageDlg = null; 95 private JUserRegistrationListener userRegistrationObject = null; 96 97 98 103 public JMOSPreferencesDlg( java.awt.Frame parent, boolean bModal ) { 104 105 super( parent, bModal ); 106 initComponents(); 107 } 108 109 114 public DefaultMutableTreeNode addNode( DefaultMutableTreeNode parentNode, JDataField item ) { 115 116 DefaultMutableTreeNode newNode = new DefaultMutableTreeNode( item ); 117 118 parentNode.add( newNode ); 119 120 return newNode; 121 } 122 123 127 public void EnableApply( boolean bEnabled ) { 128 129 applyButton.setEnabled( bEnabled ); 130 } 131 132 135 public void updateLanguage() { 136 137 String strItem = JSharedObjects.getLanguageManager().getStringEx( "OPTIONS" ); 138 JDataField item = new JDataField( strItem, strItem, new Integer ( ITEM_ROOT ) ); 139 140 rootNode = new DefaultMutableTreeNode( item ); 141 142 DefaultTreeModel treeModel = new DefaultTreeModel( rootNode ); 143 144 optionsTree.removeAll(); 145 optionsTree.setModel( treeModel ); 146 applyButton.setText( JSharedObjects.getLanguageManager().getStringEx( "APPLY" ) ); 147 okButton.setText( JSharedObjects.getLanguageManager().getStringEx( "OK" ) ); 148 cancelButton.setText( JSharedObjects.getLanguageManager().getStringEx( "CANCEL" ) ); 149 setTitle( JSharedObjects.getLanguageManager().getStringEx( "MY_MESSENGER" ) ); 150 fillOptionsTree(); 151 152 JSharedObjects.getPluginPreferencesManager().fireOnLanguageChanged( "" ); 154 } 155 156 161 public void updateLAF() { 162 163 DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); 164 165 optionsTree.setCellRenderer( renderer ); 166 renderer.setLeafIcon( null ); 167 renderer.setOpenIcon( null ); 168 renderer.setClosedIcon( null ); 169 170 javax.swing.SwingUtilities.updateComponentTreeUI( this ); 171 JSharedObjects.getPluginPreferencesManager().fireOnLookAndFeelChanged(); 172 } 173 174 178 public void setVisible( boolean bVisible ) { 179 180 if( bVisible ) { 181 DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) optionsTree.getLastSelectedPathComponent(); 182 183 if( node != null ) { 184 JDataField item = ( JDataField ) node.getUserObject(); 185 JSharedObjects.getPluginPreferencesManager().fireOnShow( ( ( Integer ) item.getObject() ).intValue(), item ); 186 } 187 } 188 189 super.setVisible( bVisible ); 190 } 191 192 196 public void EnableComponents( boolean bEnabled ) { 197 198 optionsTree.setEnabled( bEnabled ); 199 200 okButton.setEnabled( bEnabled ); 201 cancelButton.setEnabled( bEnabled ); 202 203 if( !bEnabled ) { 204 bEnableApply = applyButton.isEnabled(); 205 applyButton.setEnabled( false ); 206 removeWindowListener( windowAdapter ); 207 } 208 else { 209 applyButton.setEnabled( bEnableApply ); 210 addWindowListener( windowAdapter ); 211 } 212 } 213 214 217 public void setParentOfCurrentSelection() { 218 219 optionsTree.setSelectionPath( optionsTree.getSelectionPath().getParentPath() ); 220 } 221 222 226 private void initComponents() { 227 228 Box btnsPanel = Box.createHorizontalBox(); 229 FormLayout layout = new FormLayout( "fill:100dlu:grow", 230 "fill:75dlu:grow, fill:3dlu, fill:pref" ); 231 PanelBuilder builder = new PanelBuilder( layout ); 232 CellConstraints cellConst = new CellConstraints(); 234 DefaultTreeCellRenderer renderer = null; 235 236 237 setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); 238 windowAdapter = new java.awt.event.WindowAdapter () { 239 public void windowClosing( java.awt.event.WindowEvent evt ) { 240 closeDialog( evt ); 241 } 242 }; 243 244 addWindowListener( windowAdapter ); 245 builder.setDefaultDialogBorder(); 246 247 okButton = new JButton(); 249 cancelButton = new JButton(); 250 applyButton = new JButton(); 251 optionsTree = new JTree(); 252 optionsScrollPane = new JScrollPane( optionsTree ); 253 splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, optionsScrollPane, JSharedObjects.getPluginPreferencesManager().getPreferencesScrollPane() ); 254 availablePluginsPanel = new JAvailablePluginsPanel( this ); 255 registerUserPanel = new JRegisterUserPanel( this ); 256 unregisterUserPanel = new JYesNoPanel( "USER_UNREGISTRATION_QUESTION" ); 257 removePluginPanel = new JYesNoPanel( "REMOVE_PLUGIN_QUESTION" ); 258 privacyControlPanel = new JPrivacyControlPanel(); 259 proxySettingsPanel = new JProxySettingsPanel(); 260 languagesPanel = new JLanguagesPanel(); 261 renderer = ( DefaultTreeCellRenderer ) optionsTree.getCellRenderer(); 262 263 renderer.setLeafIcon( null ); 264 renderer.setOpenIcon( null ); 265 renderer.setClosedIcon( null ); 266 267 optionsTree.putClientProperty( "JTree.lineStyle", "Angled" ); 268 optionsTree.addTreeSelectionListener( this ); 269 optionsTree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); 270 optionsScrollPane.setPreferredSize( new Dimension ( optionsScrollPane.getPreferredSize().width + 150, optionsScrollPane.getPreferredSize().height ) ); 271 builder.add( splitPane, cellConst.xy( 1, 1 ) ); 272 273 applyButton.setFont( JSystemFonts.FONT ); 275 applyButton.setIcon( JSharedObjects.getResources().getIcon( JResources.APPLY_BUTTON_ICON ) ); 276 applyButton.setPreferredSize( new java.awt.Dimension ( JResources.DEFAULT_BUTTON_WIDTH, JResources.DEFAULT_BUTTON_HEIGHT ) ); 277 applyButton.setMinimumSize( applyButton.getPreferredSize() ); 278 applyButton.setEnabled( false ); 279 280 okButton.setFont( JSystemFonts.FONT ); 282 okButton.setIcon( JSharedObjects.getResources().getIcon( JResources.OK_BUTTON_ICON ) ); 283 okButton.setPreferredSize( new java.awt.Dimension ( JResources.DEFAULT_BUTTON_WIDTH, JResources.DEFAULT_BUTTON_HEIGHT ) ); 284 okButton.setMinimumSize( okButton.getPreferredSize() ); 285 286 cancelButton.setFont( JSystemFonts.FONT ); 288 cancelButton.setIcon( JSharedObjects.getResources().getIcon( JResources.CLOSE_BUTTON_ICON ) ); 289 cancelButton.setPreferredSize( new java.awt.Dimension ( JResources.DEFAULT_BUTTON_WIDTH, JResources.DEFAULT_BUTTON_HEIGHT ) ); 290 cancelButton.setMinimumSize( cancelButton.getPreferredSize() ); 291 292 applyButton.addActionListener( new ActionListener() { 294 295 public void actionPerformed( java.awt.event.ActionEvent evt ) { 296 applyButtonActionPerformed( evt ); 297 } 298 } 299 ); 300 301 okButton.addActionListener( new ActionListener() { 303 304 public void actionPerformed( java.awt.event.ActionEvent evt ) { 305 okButtonActionPerformed( evt ); 306 } 307 } 308 ); 309 310 cancelButton.addActionListener( new ActionListener() { 312 313 public void actionPerformed( java.awt.event.ActionEvent evt ) { 314 cancelButtonActionPerformed( evt ); 315 } 316 } 317 ); 318 319 unregisterUserPanel.addEventListener( new ActionListener() { 321 322 public void actionPerformed( ActionEvent evt ) { 323 unregisterUserPanelActionPerformed( evt ); 324 } 325 } 326 ); 327 328 removePluginPanel.addEventListener( new ActionListener() { 330 331 public void actionPerformed( ActionEvent evt ) { 332 removePluginPanelActionPerformed( evt ); 333 } 334 } 335 ); 336 337 userRegistrationObject = new JUserRegistrationAdapter() { 339 340 public void onUnregisterUserSucessfull() { 341 342 TreePath path = optionsTree.getSelectionPath(); 343 344 selectedPlugin.removeRegistrationEngineListener( this ); 345 JSharedObjects.getProfileManager().userDel( selectedPlugin.getPluginProperties().getPluginId(), userInfo ); 346 JOptionPane.showMessageDialog( messageDlg, JSharedObjects.getLanguageManager().getStringEx( "SUCCESSFULL_UNREGISTRATION_USER_WARNING" ), JSharedObjects.getLanguageManager().getStringEx( "INFORMATION" ), JOptionPane.INFORMATION_MESSAGE ); 347 messageDlg.setEnabled( false ); 348 messageDlg.setVisible( false ); 349 optionsTree.setSelectionPath( path.getParentPath().getParentPath() ); 350 fillInstalledPluginsOptionsTree(); 351 } 352 }; 353 354 btnsPanel.add( javax.swing.Box.createHorizontalGlue() ); 355 btnsPanel.add( cancelButton ); 356 btnsPanel.add( javax.swing.Box.createHorizontalStrut( 2 ) ); 357 btnsPanel.add( okButton ); 358 btnsPanel.add( javax.swing.Box.createHorizontalStrut( 20 ) ); 359 btnsPanel.add( applyButton ); 360 builder.add( btnsPanel, cellConst.xy( 1, 3 ) ); 361 362 updateLanguage(); 363 getContentPane().add( builder.getPanel() ); 364 365 splitPane.setOneTouchExpandable( true ); 367 splitPane.setDividerLocation( JSharedObjects.getConfiguration().getPreferencesSplitPosition() ); 368 setSize( JSharedObjects.getConfiguration().getPreferencesWindowSize() ); 369 setLocation( JSharedObjects.getConfiguration().getPreferencesWindowLocation() ); 370 setResizable( true ); 371 } 372 373 376 private void fillOptionsTree() { 377 378 String strItem = JSharedObjects.getLanguageManager().getStringEx( "PLUGIN_MANAGEMENT" ); 379 JDataField item = new JDataField( strItem, strItem, new Integer ( ITEM_PLUGIN_MANAGEMENT ) ); 380 DefaultMutableTreeNode node = addNode( rootNode, item ); 381 382 strItem = "AVAILABLE_PLUGINS"; 384 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_AVAILABLE_PLUGINS ) ); 385 addNode( node, item ); 386 387 strItem = "INSTALLED_PLUGINS"; 388 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_INSTALLED_PLUGINS ) ); 389 installedPluginsNode = addNode( node, item ); 390 391 strItem = "PROFILE_SETTINGS"; 392 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( ITEM_PROFILE_SETTINGS ) ); 393 node = addNode( rootNode, item ); 394 395 strItem = "PROXY_SETTINGS"; 396 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_PROXY_SETTINGS ) ); 397 addNode( node, item ); 398 399 strItem = "LANGUAGE_SETTINGS"; 400 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_LANGUAGE_SETTINGS ) ); 401 addNode( node, item ); 402 403 strItem = "LAF_SETTINGS"; 404 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_LAF_SETTINGS ) ); 405 addNode( node, item ); 406 407 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_AVAILABLE_PLUGINS, availablePluginsPanel ); 409 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_PROXY_SETTINGS, proxySettingsPanel ); 410 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_LANGUAGE_SETTINGS, languagesPanel ); 411 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_ADD_EXISTING_USER, registerUserPanel ); 412 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_ADD_NEW_USER, registerUserPanel ); 413 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_CHANGE_PASSWD, registerUserPanel ); 414 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_UNREGISTER_USER, unregisterUserPanel ); 415 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_REMOVE_PLUGIN, removePluginPanel ); 416 JSharedObjects.getPluginPreferencesManager().add( SUB_ITEM_PRIVACY_CONTROL, privacyControlPanel ); 417 418 fillInstalledPluginsOptionsTree(); 419 optionsTree.expandPath( optionsTree.getPathForRow( 0 ) ); 420 } 421 422 426 private void okButtonActionPerformed( ActionEvent evt ) { 427 428 applyButtonActionPerformed( null ); 429 closeDialog( null ); 430 } 431 432 437 private void applyButtonActionPerformed( ActionEvent evt ) { 438 439 if( JSharedObjects.getPluginPreferencesManager().fireOnApply() ) 440 applyButton.setEnabled( false ); 441 } 442 443 447 private void cancelButtonActionPerformed( ActionEvent evt ) { 448 449 JSharedObjects.getPluginPreferencesManager().fireOnCancel(); 450 closeDialog( null ); 451 } 452 453 457 private void unregisterUserPanelActionPerformed( ActionEvent evt ) { 458 459 TreePath path = optionsTree.getSelectionPath(); 460 DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) path.getParentPath().getLastPathComponent(); 461 462 463 if( evt.getID() == JYesNoPanel.YES_BUTTON ) { 464 465 if( parentNode != null ) { 467 468 JDataField parentItem = ( JDataField ) parentNode.getUserObject(); 469 int nPluginId = ( ( Integer ) parentItem.getObject() ).intValue(); 470 471 if( nPluginId >= 0 ) { 472 selectedPlugin = JSharedObjects.getPluginEngine().get( nPluginId ); 473 474 if( selectedPlugin.isConnected() ) { 475 userInfo = JSharedObjects.getProfileManager().getUserInfo( nPluginId ); 476 messageDlg = null; 477 messageDlg = new JMOSMessageDialog( this, JSharedObjects.getLanguageManager().getStringEx( "CONFIRM_UNREGISTRATION" ), 478 JSharedObjects.getLanguageManager().getStringEx( "USER_UNREGISTRATION_QUESTION" ) + " " + userInfo.getUserId() + " " + JSharedObjects.getLanguageManager().getStringEx( "QUESTION_SYMBOL" ), true ); 479 480 messageDlg.setVisible( true ); 481 482 if( messageDlg.getButtonResult() == JMOSMessageDialog.YES_BUTTON ) { 484 selectedPlugin.addRegistrationEngineListener( userRegistrationObject ); 485 messageDlg.setEnabled( false ); 486 selectedPlugin.fireOnUnregisterUser(); 487 } 488 } 489 else 490 javax.swing.JOptionPane.showMessageDialog( this, 491 JSharedObjects.getLanguageManager().getStringEx( "DISCONNECTED_PLUGIN_WARNING" ), 492 JSharedObjects.getLanguageManager().getStringEx( "INFORMATION" ), javax.swing.JOptionPane.INFORMATION_MESSAGE ); 493 } 494 } 495 } 496 else 497 optionsTree.setSelectionPath( path.getParentPath() ); 498 } 499 500 504 private void removePluginPanelActionPerformed( ActionEvent evt ) { 505 506 TreePath path = optionsTree.getSelectionPath(); 507 DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) path.getParentPath().getLastPathComponent(); 508 509 510 if( evt.getID() == JYesNoPanel.YES_BUTTON ) { 511 512 if( parentNode != null ) { 514 515 JDataField parentItem = ( JDataField ) parentNode.getUserObject(); 516 int nPluginId = ( ( Integer ) parentItem.getObject() ).intValue(); 517 518 if( nPluginId >= 0 ) { 519 selectedPlugin = JSharedObjects.getPluginEngine().get( nPluginId ); 520 messageDlg = null; 521 messageDlg = new JMOSMessageDialog( this, JSharedObjects.getLanguageManager().getStringEx( "REMOVE_PLUGIN" ), 522 JSharedObjects.getLanguageManager().getStringEx( "REMOVE_PLUGIN_QUESTION" ) + " " + selectedPlugin.toString() + " " + JSharedObjects.getLanguageManager().getStringEx( "QUESTION_SYMBOL" ), true ); 523 524 messageDlg.setVisible( true ); 525 526 if( messageDlg.getButtonResult() == JMOSMessageDialog.YES_BUTTON ) { 528 529 userInfo = JSharedObjects.getProfileManager().getUserInfo( nPluginId ); 530 JSharedObjects.getProfileManager().userDel( nPluginId, userInfo ); 531 JSharedObjects.getProfileManager().removePlugin( nPluginId, JSharedObjects.getProfileManager().getProfileId() ); 532 JSharedObjects.getPluginEngine().remove( selectedPlugin ); 533 534 optionsTree.setSelectionPath( path.getParentPath().getParentPath() ); 535 fillInstalledPluginsOptionsTree(); 536 } 537 } 538 } 539 } 540 else 541 optionsTree.setSelectionPath( path.getParentPath() ); 542 } 543 544 549 private void closeDialog( WindowEvent evt ) { 550 551 JSharedObjects.getConfiguration().setPreferencesSplitPosition( splitPane.getDividerLocation() ); 552 JSharedObjects.getConfiguration().setPreferencesWindowProperties( this.getLocation(), this.getSize() ); 553 JSharedObjects.getPluginPreferencesManager().clearScrollPane(); 554 applyButton.setEnabled( false ); 555 setVisible( false ); 556 } 557 558 562 private void reload( TreeNode node ) { 563 564 ( ( DefaultTreeModel )optionsTree.getModel() ).reload( node ); 565 } 566 567 570 public void fillInstalledPluginsOptionsTree() { 571 572 int nPluginId; 573 long nProfileId = JSharedObjects.getProfileManager().getProfileId(); 574 boolean bNoAvail = true; 575 ResultSet rs = JSharedObjects.getProfileManager().getAllPlugins().getResultSet(); 576 577 578 JSharedObjects.getPluginEngine().loadAllPlugins( nProfileId, false ); 579 580 585 JPlugin plugins[] = JSharedObjects.getPluginEngine().toArray(); 586 587 588 installedPluginsNode.removeAllChildren(); 589 590 if( plugins != null ) { 591 592 for( int nCount = 0; nCount < plugins.length; nCount++ ) { 593 594 JPlugin plugin = plugins[nCount]; 595 596 597 nPluginId = plugin.getPluginProperties().getPluginId(); 598 599 if( JSharedObjects.getProfileManager().checkPluginInstall( nPluginId, nProfileId ) ) { 600 JPluginProperties properties = plugin.getPluginProperties(); 601 JDataField item = new JDataField( properties.getName(), properties.getName(), new Integer ( nPluginId ) ); 602 DefaultMutableTreeNode node = addNode( installedPluginsNode, item ); 603 604 if( !JSharedObjects.getProfileManager().checkForPluginUser( nPluginId ) ) { 606 607 String strItem = "REGISTER_EXISTING_USER"; 608 609 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_ADD_EXISTING_USER ) ); 610 addNode( node, item ); 611 612 if( plugin.getPluginCapabilities().getBool( JPluginCapabilities.CAPABILITY_REGISTER_NEW_USER ) ) { 613 strItem = "REGISTER_NEW_USER"; 614 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_ADD_NEW_USER ) ); 615 addNode( node, item ); 616 } 617 618 strItem = "REMOVE_PLUGIN"; 619 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_REMOVE_PLUGIN ) ); 620 addNode( node, item ); 621 } 622 else { 623 String strItem = "CHANGE_PASSWORD"; 624 625 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_CHANGE_PASSWD ) ); 626 addNode( node, item ); 627 628 strItem = "UNREGISTER_USER"; 629 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_UNREGISTER_USER ) ); 630 addNode( node, item ); 631 632 strItem = "REMOVE_PLUGIN"; 633 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_REMOVE_PLUGIN ) ); 634 addNode( node, item ); 635 636 if( plugin.getPluginCapabilities().getBool( JPluginCapabilities.CAPABILITY_PRIVACY_CONTROL_ENABLED ) ) { 638 strItem = "PRIVACY_CONTROL"; 639 item = new JDataField( strItem, JSharedObjects.getLanguageManager().getStringEx( strItem ), new Integer ( SUB_ITEM_PRIVACY_CONTROL ) ); 640 addNode( node, item ); 641 } 642 643 } 645 bNoAvail = false; 646 } 647 } 648 649 if( bNoAvail ) { 650 String strItem = JSharedObjects.getLanguageManager().getStringEx( "NO_INSTALLED_PLUGINS" ); 651 JDataField item = new JDataField( strItem, strItem, new Integer ( ITEM_EMPTY ) ); 652 653 addNode( installedPluginsNode, item ); 654 } 655 } 656 657 reload( installedPluginsNode ); 658 } 659 660 667 public void valueChanged( javax.swing.event.TreeSelectionEvent treeSelectionEvent ) { 668 669 TreePath path = treeSelectionEvent.getPath(); 670 DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) path.getLastPathComponent(); 671 DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) path.getParentPath().getLastPathComponent(); 672 JDataField item = ( JDataField ) node.getUserObject(); 673 JDataField parentItem = null; 674 675 if( parentNode != null ) { 677 678 int nPluginId = -1; 679 int nMode = JRegisterUserPanel.MODE_NONE; 680 681 682 switch( ( ( Integer ) item.getObject() ).intValue() ) { 683 684 case SUB_ITEM_ADD_NEW_USER : nMode = JRegisterUserPanel.MODE_REGISTER_NEW_USER; break; 685 686 case SUB_ITEM_ADD_EXISTING_USER : nMode = JRegisterUserPanel.MODE_REGISTER_USER; break; 687 688 case SUB_ITEM_CHANGE_PASSWD : nMode = JRegisterUserPanel.MODE_CHANGE_PASSWD; break; 689 } 690 691 parentItem = ( JDataField ) parentNode.getUserObject(); 692 nPluginId = ( ( Integer ) parentItem.getObject() ).intValue(); 693 privacyControlPanel.setPluginId( nPluginId ); 694 registerUserPanel.setPluginId( nPluginId ); 695 registerUserPanel.setMode( nMode ); 696 } 697 698 JSharedObjects.getPluginPreferencesManager().fireOnShow( ( ( Integer ) item.getObject() ).intValue(), item ); 699 } 700 } 701 | Popular Tags |