Changeset 5620
- Timestamp:
- 09/19/08 15:18:05 (2 months ago)
- Location:
- trunk/SRC/org/openmicroscopy/shoola/agents/metadata
- Files:
-
- 15 modified
-
ContainersLoader.java (modified) (3 diffs)
-
browser/Browser.java (modified) (1 diff)
-
browser/BrowserComponent.java (modified) (4 diffs)
-
browser/BrowserControl.java (modified) (4 diffs)
-
browser/BrowserFactory.java (modified) (1 diff)
-
browser/BrowserModel.java (modified) (5 diffs)
-
browser/BrowserUI.java (modified) (1 diff)
-
editor/Editor.java (modified) (2 diffs)
-
editor/EditorComponent.java (modified) (2 diffs)
-
editor/EditorControl.java (modified) (1 diff)
-
editor/EditorModel.java (modified) (14 diffs)
-
editor/EditorUI.java (modified) (2 diffs)
-
view/MetadataViewer.java (modified) (2 diffs)
-
view/MetadataViewerComponent.java (modified) (3 diffs)
-
view/MetadataViewerModel.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/ContainersLoader.java
r5564 r5620 58 58 59 59 /** Either <code>DatasetData</code> or <code>ProjectData</code>. */ 60 private Class type;60 private Class type; 61 61 62 62 /** The ID of the parent of the {@link #refNode}. */ 63 private long id; 64 65 private StructuredDataResults data; 63 private long id; 64 66 65 67 66 /** Handle to the async call so that we can cancel it. */ … … 90 89 * @param viewer The viewer this data loader is for. 91 90 * Mustn't be <code>null</code>. 92 * @param data 91 * @param type The data type of the edited object. 92 * @param id The id of the currently edited object. 93 93 */ 94 public ContainersLoader(MetadataViewer viewer, StructuredDataResults data)94 public ContainersLoader(MetadataViewer viewer, Class type, long id) 95 95 { 96 96 super(viewer, null); 97 if (data == null) 98 throw new IllegalArgumentException("No element to handle."); 99 this.data = data; 100 type = data.getRelatedObject().getClass(); 101 id = ((DataObject) data.getRelatedObject()).getId(); 97 this.type = type; 98 this.id = id; 99 //type = data.getRelatedObject().getClass(); 100 //id = ((DataObject) data.getRelatedObject()).getId(); 102 101 } 103 102 … … 124 123 { 125 124 if (viewer.getState() == MetadataViewer.DISCARDED) return; //Async cancel. 126 if (data == null) 127 viewer.setContainers(refNode, result); 128 else { 129 data.setParents((Collection) result); 130 } 125 viewer.setContainers(refNode, result); 131 126 } 132 127 -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/Browser.java
r5564 r5620 125 125 */ 126 126 public void setParents(TreeBrowserDisplay node, Collection parents); 127 128 /**129 * Converts the results into the corresponding UI components.130 * and adds them to the display.131 *132 * @param node The node to handle. Mustn't be <code>null</code>.133 * @param results The results to handle.134 */135 public void setStructuredDataResults(TreeBrowserDisplay node,136 StructuredDataResults results);137 127 138 128 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/BrowserComponent.java
r5564 r5620 34 34 35 35 //Application-internal dependencies 36 import org.openmicroscopy.shoola.env.data.util.StructuredDataResults;37 36 import org.openmicroscopy.shoola.util.ui.component.AbstractComponent; 38 37 import org.openmicroscopy.shoola.util.ui.component.ObservableComponent; 39 38 import pojos.ProjectData; 40 39 import pojos.ScreenData; … … 87 86 } 88 87 89 /** Links up the MVC triad. */ 90 void initialize() 88 /** 89 * Links up the MVC triad. 90 * 91 * @param comp The component to register. 92 */ 93 void initialize(ObservableComponent comp) 91 94 { 92 95 controller.initialize(this, view); 96 comp.addPropertyChangeListener(controller); 93 97 view.initialize(model, controller); 94 98 } … … 171 175 public void setParents(TreeBrowserDisplay node, Collection parents) 172 176 { 173 if (node == null) 174 throw new IllegalArgumentException("No node to handle.");177 if (node == null) node = model.getRoot(); 178 // throw new IllegalArgumentException("No node to handle."); 175 179 if (parents == null || parents.size() == 0) { 176 180 view.addDefaultNode(node, BrowserUI.NO_PARENTS_MSG); … … 190 194 view.setNodes(node, nodes); 191 195 } 192 193 /**194 * Implemented as specified by the {@link Browser} interface.195 * @see Browser#setStructuredDataResults(TreeBrowserDisplay,196 * StructuredDataResults)197 */198 public void setStructuredDataResults(TreeBrowserDisplay node,199 StructuredDataResults results)200 {201 if (node == null)202 throw new IllegalArgumentException("No node to handle.");203 Object userObject = node.getUserObject();204 if (userObject != results.getRelatedObject()) return;205 if (results == null) {206 return;207 }208 //parents209 setParents(node, results.getParents());210 }211 196 212 197 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/BrowserControl.java
r5299 r5620 25 25 26 26 //Java imports 27 import java.beans.PropertyChangeEvent; 28 import java.beans.PropertyChangeListener; 27 29 import java.util.ArrayList; 28 30 import java.util.HashMap; … … 44 46 import org.openmicroscopy.shoola.agents.metadata.actions.BrowserAction; 45 47 import org.openmicroscopy.shoola.agents.metadata.actions.CollapseAction; 48 import org.openmicroscopy.shoola.agents.metadata.view.MetadataViewer; 46 49 import org.openmicroscopy.shoola.env.event.EventBus; 47 50 import org.openmicroscopy.shoola.env.ui.UserNotifier; … … 64 67 */ 65 68 class BrowserControl 69 implements PropertyChangeListener 66 70 { 67 71 … … 230 234 bus.post(evt); 231 235 } 236 237 /** 238 * Adds a dummy node to the view when the parents are loaded. 239 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) 240 */ 241 public void propertyChange(PropertyChangeEvent evt) 242 { 243 String name = evt.getPropertyName(); 244 if (MetadataViewer.LOADING_PARENTS_PROPERTY.equals(name)) { 245 view.addDefaultNode(BrowserUI.LOADING_MSG); 246 } 247 } 232 248 233 249 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/BrowserFactory.java
r5247 r5620 60 60 BrowserComponent component = new BrowserComponent(model); 61 61 model.initialize(component); 62 component.initialize( );62 component.initialize(parent); 63 63 return component; 64 64 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/BrowserModel.java
r5298 r5620 27 27 import java.awt.Point; 28 28 import java.util.ArrayList; 29 import java.util.Collection; 29 30 import java.util.Iterator; 30 31 import java.util.List; … … 34 35 //Application-internal dependencies 35 36 import org.openmicroscopy.shoola.agents.metadata.view.MetadataViewer; 37 import org.openmicroscopy.shoola.env.data.util.StructuredDataResults; 36 38 37 39 … … 61 63 /** The parent of this browser. */ 62 64 private MetadataViewer parent; 65 66 /** The UI object hosting the edited root object. */ 67 private TreeBrowserSet root; 63 68 64 69 /** Reference to the component that embeds this model. */ … … 138 143 { 139 144 selectedNodes.clear(); 140 TreeBrowserSet node= new TreeBrowserSet(refObject);141 selectedNodes.add( node);142 parent.loadMetadata( node);145 root = new TreeBrowserSet(refObject); 146 selectedNodes.add(root); 147 parent.loadMetadata(root); 143 148 } 144 149 … … 159 164 parent.loadContainers(node); 160 165 } 161 166 167 /** 168 * Returns the UI object hosting the edited object. 169 * 170 * @return See above. 171 */ 172 TreeBrowserSet getRoot() { return root; } 173 162 174 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/BrowserUI.java
r5486 r5620 348 348 } 349 349 350 /** 351 * Creates a dummy loading node whose parent is the specified node. 350 /** 351 * Creates a dummy loading node whose parent is the specified node. 352 * 353 * @param message The value of the default node. 354 */ 355 void addDefaultNode(String message) 356 { 357 addDefaultNode(model.getRoot(), message); 358 } 359 360 /** 361 * Creates a dummy loading node to the specified node. 352 362 * 353 363 * @param node The parent of the default node. -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/editor/Editor.java
r5450 r5620 61 61 public static final int GRID_LAYOUT = MetadataViewer.GRID_LAYOUT;; 62 62 63 /** 64 * Feeds the metadata back to the editor. 65 * 66 * @param result The result to feed back. 67 */ 68 public void setStructuredDataResults(StructuredDataResults result); 63 /** Feeds the metadata back to the editor. */ 64 public void setStructuredDataResults(); 69 65 70 66 /** … … 181 177 */ 182 178 public void setSelectionMode(boolean single); 179 180 /** Loads the container hosting the currently edited object. */ 181 public void loadParents(); 183 182 184 183 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/editor/EditorComponent.java
r5603 r5620 111 111 /** 112 112 * Implemented as specified by the {@link Browser} interface. 113 * @see Editor#setStructuredDataResults(StructuredDataResults) 114 */ 115 public void setStructuredDataResults(StructuredDataResults result) 116 { 117 if (result == null) return; 118 model.setStructuredDataResults(result); 113 * @see Editor#setStructuredDataResults() 114 */ 115 public void setStructuredDataResults() 116 { 119 117 view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 120 118 view.layoutUI(); … … 305 303 view.setSelectionMode(single); 306 304 } 305 306 /** 307 * Implemented as specified by the {@link Browser} interface. 308 * @see Editor#loadParents() 309 */ 310 public void loadParents() 311 { 312 model.loadParents(); 313 } 307 314 308 315 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/editor/EditorControl.java
r5394 r5620 81 81 void showImageInfo() { model.showImageInfo(); } 82 82 83 /** 84 * Loads the container hosting the currently edited object, 85 * forwards call to the model. 86 */ 87 void loadParents() { model.loadParents(); } 88 83 89 /** 84 90 * Reacts to property change. -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/editor/EditorModel.java
r5577 r5620 43 43 import org.openmicroscopy.shoola.agents.metadata.AttachmentsLoader; 44 44 import org.openmicroscopy.shoola.agents.metadata.ChannelDataLoader; 45 import org.openmicroscopy.shoola.agents.metadata.ContainersLoader; 45 46 import org.openmicroscopy.shoola.agents.metadata.DiskSpaceLoader; 46 47 import org.openmicroscopy.shoola.agents.metadata.EditorLoader; … … 99 100 /** Reference to the component that embeds this model. */ 100 101 private Editor component; 101 102 /** The object hosting the various annotations linked to an object. */103 private StructuredDataResults data;104 102 105 103 /** The object this editor later. */ … … 427 425 Collection getUrls() 428 426 { 427 StructuredDataResults data = parent.getStructuredData(); 429 428 if (data == null) return null; 430 429 return data.getUrls(); … … 450 449 Collection getTags() 451 450 { 451 StructuredDataResults data = parent.getStructuredData(); 452 452 if (data == null) return null; 453 453 Collection tags = data.getTags(); … … 475 475 Collection getAttachments() 476 476 { 477 StructuredDataResults data = parent.getStructuredData(); 477 478 if (data == null) return null; 478 479 return data.getAttachments(); … … 498 499 Collection getViewedBy() 499 500 { 501 StructuredDataResults data = parent.getStructuredData(); 500 502 if (data == null) return null; 501 503 Collection l = data.getViewedBy(); … … 520 522 int getRatingCount() 521 523 { 524 StructuredDataResults data = parent.getStructuredData(); 522 525 Collection ratings = data.getRatings(); 523 526 if (ratings == null) return 0; … … 532 535 int getUserRating() 533 536 { 537 StructuredDataResults data = parent.getStructuredData(); 534 538 if (data == null) return 0; 535 539 Collection ratings = data.getRatings(); … … 553 557 int getRatingAverage() 554 558 { 559 StructuredDataResults data = parent.getStructuredData(); 555 560 if (data == null) return 0; 556 561 Collection ratings = data.getRatings(); … … 585 590 Collection getTextualAnnotations() 586 591 { 592 StructuredDataResults data = parent.getStructuredData(); 587 593 if (data == null) return null; 588 594 return data.getTextualAnnotations(); … … 663 669 return textualAnnotationsByUsers; 664 670 } 665 666 /**667 * Sets the structured data.668 *669 * @param data The value to set.670 */671 void setStructuredDataResults(StructuredDataResults data)672 {673 this.data = data;674 }675 671 676 672 /** … … 686 682 textualAnnotationsByUsers = null; 687 683 textualAnnotationsByDate = null; 688 data = null;689 684 existingAttachments = null; 690 685 existingURLs = null; … … 1045 1040 boolean isArchived() 1046 1041 { 1042 StructuredDataResults data = parent.getStructuredData(); 1047 1043 if (data == null) return false; 1048 1044 return data.isArchived(); … … 1127 1123 } 1128 1124 1129 void loadParents() 1130 { 1131 if (data == null) return; 1132 if (data.getParents() != null) return; 1133 parent.loadParents(data); 1134 } 1125 /** 1126 * Fires an asynchronous retrieval of containers hosting the currently 1127 * edited object. 1128 */ 1129 void loadParents() { parent.loadParents(); } 1130 1131 /** Cancels any ongoing parents retrieval. */ 1132 void cancelParentsLoading() { } 1135 1133 1136 1134 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/editor/EditorUI.java
r5564 r5620 218 218 viewedByUI.buildUI(); 219 219 } 220 221 /** 222 * Loads or cancels any on-going loading of containers hosting 223 * the edited object. 224 * 225 * @param b Pass <code>true</code> to load, <code>false</code> to cancel. 226 */ 227 private void loadParents(boolean b) 228 { 229 if (b) controller.loadParents(); 230 else model.cancelParentsLoading(); 231 } 220 232 221 233 /** Initializes the UI components. */ … … 232 244 public void propertyChange(PropertyChangeEvent evt) { 233 245 String name = evt.getPropertyName(); 234 if (TreeComponent.EXPANDED_PROPERTY.equals(name)) { 235 model.loadParents(); 236 } 246 if (TreeComponent.EXPANDED_PROPERTY.equals(name)) 247 loadParents((Boolean) evt.getNewValue()); 237 248 } 238 249 -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/view/MetadataViewer.java
r5564 r5620 75 75 "experimenterUpdated"; 76 76 77 /** Inidicates to layout all the components vertically. */ 77 /** 78 * Bound property indicating that parents of the currently edited objects 79 * are loaded. 80 */ 81 public static final String LOADING_PARENTS_PROPERTY = "loadingParents"; 82 83 /** Indicates to layout all the components vertically. */ 78 84 public static final int VERTICAL_LAYOUT = 0; 79 85 80 /** In idicates to layout all the components vertically. */86 /** Indicates to layout all the components vertically. */ 81 87 public static final int GRID_LAYOUT = 1; 82 88 … … 265 271 public void onExperimenterUpdated(ExperimenterData data); 266 272 267 public void loadParents(StructuredDataResults data); 268 269 public void setParents(StructuredDataResults data); 273 /** 274 * Loads the containers hosting the currently edited object. 275 */ 276 public void loadParents(); 277 278 /** 279 * Returns the metadata linked to the currently edited object 280 * or <code>null</code> if not loaded. 281 * 282 * @return See above. 283 */ 284 public StructuredDataResults getStructuredData(); 270 285 271 286 } -
trunk/SRC/org/openmicroscopy/shoola/agents/metadata/view/MetadataViewerComponent.java
r5603 r5620 184 184 Browser browser = model.getBrowser(); 185 185 if (result instanceof StructuredDataResults) { 186 browser.setStructuredDataResults(node,187 (StructuredDataResults) result);188 model.getEditor().setStructuredDataResults(189 (StructuredDataResults) result);190 186 model.setStructuredDataResults((StructuredDataResults) result);
