Changeset 8274
- Timestamp:
- 2004-10-11T15:07:57+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/gems
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java
r8270 r8274 88 88 89 89 static private Configuration config = null; 90 static p ublicMetadataSetManager msm = new MetadataSetManager();90 static private MetadataSetManager msm = new MetadataSetManager(); 91 91 92 92 private AddElementActionListener add_element_action_listener = null; … … 171 171 } 172 172 173 new GEMS( null, NORMAL);173 new GEMS(); 174 174 } 175 175 … … 179 179 * @param action a systematic action that should be performed 180 180 */ 181 public GEMS( MetadataSet set, int action)181 public GEMS() 182 182 { 183 183 this.dialog_options = new String[2]; … … 206 206 upper_pane.setOpaque(false); 207 207 208 // Load all the core metadata sets (in the GLI "metadata" directory) 208 209 model = new GEMSModel(); 210 File metadata_directory = new File(Utility.METADATA_DIR); 211 if (metadata_directory.exists()) { 212 // Load just those .mds files in this directory, and return them 213 File[] directory_files = metadata_directory.listFiles(); 214 for (int i = 0; i < directory_files.length; i++) { 215 File child_file = directory_files[i]; 216 if (!child_file.isDirectory() && child_file.getName().endsWith(".mds")) { 217 System.err.println("Found mds file: " + child_file); 218 MetadataSet metadata_set = msm.loadMetadataSet(child_file); 219 model.add(null, metadata_set, GEMSNode.SET); 220 } 221 } 222 } 209 223 210 224 JPanel mds_tree_pane = new JPanel(); … … 218 232 mds_tree.setSelectionColor(config.getColor("coloring.collection_selection_background", false)); 219 233 mds_tree.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false)); 220 // We may have been asked to select a cetain initial set221 if(set != null) {222 GEMSNode root = (GEMSNode) model.getRoot();223 for(int i = 0; i < root.getChildCount(); i++) {224 GEMSNode child = (GEMSNode) root.getChildAt(i);225 if(set.equals(child.getUserObject())) {226 TreePath path = new TreePath(child.getPath());227 mds_tree.setSelectionPath(path);228 mds_tree.expandPath(path);229 path = null;230 }231 child = null;232 }233 root = null;234 }235 234 236 235 details_pane = new JPanel(); … … 545 544 content_pane.add(button_pane, BorderLayout.SOUTH); 546 545 547 // Callback - we may have been asked to perform some systematic action, but we can't do that until the dialog is visible, which in itself causes a problem as the dialog is modal and setVisible won't return until the dialog is cancelled. The solution is to spawn a task on a new thread which waits until the dialog is visible then calls doClick on the appropriate button.548 if(action != NORMAL) {549 ActionTask task = new ActionTask(action);550 task.start();551 }552 546 // Display 553 547 setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2); -
trunk/gli/src/org/greenstone/gatherer/gems/GEMSNode.java
r8270 r8274 191 191 return text; 192 192 } 193 private void mapChildren() { 194 ///ystem.err.println("Mapping the children of " + this); 193 194 195 private void mapChildren() 196 { 195 197 children = new Vector(); 198 196 199 // How we build children depends on the node type 197 switch(type) { 198 case PROFILER: // Add the collections as children 199 // ArrayList a = GEMS.msm.profiler.getCollections(); 200 // for(int i = 0; i < a.size(); i++) { 201 // children.add(new GEMSNode(COLLECTION, a.get(i), this)); 202 // } 203 // a = null; 204 break; 205 case ROOT: 206 Vector v = GEMS.msm.getSets(); 207 for(int i = 0; i < v.size(); i++) { 208 children.add(new GEMSNode(SET, v.get(i), this)); 209 } 210 v = null; 211 // Add the profile set. 212 children.add(new GEMSNode(PROFILER, Dictionary.get("MEM.Profiles"), this)); 213 break; 214 case SET: // Add the elements as children 200 if (type == SET) { 201 // Add the elements as children 215 202 MetadataSet set = (MetadataSet) userObject; 216 203 NodeList elements = set.getElements(); 217 set = null; 218 for(int i = 0; i < elements.getLength(); i++) { 204 for (int i = 0; i < elements.getLength(); i++) { 219 205 children.add(new GEMSNode(ELEMENT, new ElementWrapper((Element) elements.item(i)), this)); 220 206 } 221 elements = null;222 break;223 case COLLECTION:224 case ELEMENT:225 default:226 207 } 227 208 }
Note:
See TracChangeset
for help on using the changeset viewer.