View Javadoc
1 /*** 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/client/browser/ConceptsTreeDialog.java,v 1.16 2003/08/30 23:09:45 farrukh_najmi Exp $ 3 */ 4 package com.sun.xml.registry.client.browser; 5 6 import java.util.*; 7 import javax.xml.registry.*; 8 import javax.xml.registry.infomodel.*; 9 10 import java.awt.*; 11 import java.awt.event.*; 12 import javax.swing.*; 13 import javax.swing.event.*; 14 15 import java.beans.*; 16 17 /*** 18 * Base class for all JAXR Browser dialogs. 19 * 20 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 21 */ 22 public class ConceptsTreeDialog extends JBDialog { 23 24 private ConceptsTree conceptsTree = null; 25 26 public static final String PROPERTY_SELECTED_CONCEPTS = "selectedConcepts"; 27 28 29 public ConceptsTreeDialog(JDialog parent, boolean modal) { 30 super(parent, modal); 31 ConceptsTreeDialog_initialize(); 32 } 33 34 public ConceptsTreeDialog(JFrame parent, boolean modal) { 35 super(parent, modal); 36 ConceptsTreeDialog_initialize(); 37 } 38 39 void ConceptsTreeDialog_initialize() { 40 setTitle("Classification Schemes"); 41 42 GridBagConstraints c = new GridBagConstraints(); 43 GridBagLayout gbl1 = new GridBagLayout(); 44 45 //Top level panel 46 JPanel panel = mainPanel; 47 panel.setLayout(gbl1); 48 49 //The conceptsTree 50 conceptsTree = new ConceptsTree(true); 51 JScrollPane conceptsTreePane = new JScrollPane(conceptsTree); 52 c.gridx = 0; 53 c.gridy = 0; 54 c.gridwidth = 1; 55 c.gridheight = 1; 56 c.weightx = 1.0; 57 c.weighty = 1.0; 58 c.fill = GridBagConstraints.BOTH; 59 c.anchor = GridBagConstraints.CENTER; 60 c.insets = new Insets(4, 4, 0, 4); 61 gbl1.setConstraints(conceptsTreePane, c); 62 panel.add(conceptsTreePane); 63 64 pack(); 65 66 } 67 68 ConceptsTree getModel() { 69 return conceptsTree; 70 } 71 72 protected void okAction() { 73 super.okAction(); 74 if (conceptsTree != null) { 75 String test = new String(); 76 firePropertyChange(PROPERTY_SELECTED_CONCEPTS, test, getSelectedObjects()); 77 //System.err.println("firePropertyChange"); 78 } 79 else { 80 //System.err.println("Missed firePropertyChange " + conceptsTree); 81 } 82 83 dispose(); 84 } 85 86 public ArrayList getSelectedObjects() { 87 ArrayList selectedObjects = null; 88 89 if (conceptsTree != null) { 90 selectedObjects = conceptsTree.getSelectedObjects(); 91 } 92 return selectedObjects; 93 } 94 95 public ArrayList getSelectedConcepts() { 96 ArrayList selectedObjects = null; 97 98 if (conceptsTree != null) { 99 selectedObjects = conceptsTree.getSelectedConcepts(); 100 } 101 return selectedObjects; 102 } 103 104 public ArrayList getSelectedClassificationSchemes() { 105 ArrayList selectedObjects = null; 106 107 if (conceptsTree != null) { 108 selectedObjects = conceptsTree.getSelectedClassificationSchemes(); 109 } 110 return selectedObjects; 111 } 112 113 public static ConceptsTreeDialog showSchemes(Component parent, boolean modal, boolean editable) { 114 ConceptsTreeDialog dialog = null; 115 RegistryBrowser.setWaitCursor(); 116 117 Window window = (Window)(SwingUtilities.getRoot(parent)); 118 if (window instanceof JFrame) { 119 dialog = new ConceptsTreeDialog((JFrame)window, modal); 120 } 121 else if (window instanceof JDialog) { 122 dialog = new ConceptsTreeDialog((JDialog)window, modal); 123 } 124 125 dialog.setEditable(editable); 126 dialog.setLocation((int)(window.getLocation().getX()+30), (int)(window.getLocation().getY()+30)); 127 dialog.setVisible(true); 128 129 RegistryBrowser.setDefaultCursor(); 130 131 return dialog; 132 } 133 134 public static void clearCache() { 135 ConceptsTree.clearCache(); 136 } 137 138 /*** 139 * Sets whether this dialog is read-only or editable. 140 */ 141 public void setEditable(boolean editable) { 142 if (this.editable != editable) { 143 super.setEditable(editable); 144 conceptsTree.setEditable(editable); 145 } 146 } 147 148 149 }

This page was automatically generated by Maven