Changeset 5345
- Timestamp:
- 04/11/08 08:21:31 (7 months ago)
- Location:
- trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser
- Files:
-
- 4 added
- 1 removed
- 20 modified
-
DataFilter.java (modified) (1 diff)
-
DataObjectCreator.java (added)
-
IconManager.java (modified) (2 diffs)
-
browser/Browser.java (modified) (3 diffs)
-
browser/BrowserComponent.java (deleted)
-
browser/BrowserModel.java (modified) (5 diffs)
-
graphx/eclipse_external_tools16.png (added)
-
graphx/nuvola_filenew16.png (added)
-
graphx/roll_over_image16.png (added)
-
layout/FlatLayout.java (modified) (2 diffs)
-
layout/Layout.java (modified) (1 diff)
-
layout/LayoutFactory.java (modified) (3 diffs)
-
layout/LayoutUtils.java (modified) (4 diffs)
-
layout/SquaryLayout.java (modified) (5 diffs)
-
view/DataBrowser.java (modified) (2 diffs)
-
view/DataBrowserComponent.java (modified) (4 diffs)
-
view/DataBrowserControl.java (modified) (2 diffs)
-
view/DataBrowserFactory.java (modified) (1 diff)
-
view/DataBrowserModel.java (modified) (5 diffs)
-
view/DataBrowserToolBar.java (modified) (9 diffs)
-
view/DataBrowserUI.java (modified) (2 diffs)
-
view/ImageTable.java (modified) (4 diffs)
-
view/ImageTableNode.java (modified) (1 diff)
-
view/ImageTableView.java (modified) (1 diff)
-
view/ImagesModel.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/DataFilter.java
r5342 r5345 138 138 viewer.setFilteredNodes(filteredNodes); 139 139 } 140 141 140 } 142 141 -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/IconManager.java
r5342 r5345 109 109 public static int ANNOTATION_8 = 19; 110 110 111 /** The <code>Manager</code> icon. */ 112 public static int MANAGER = 20; 113 114 /** The <code>Manager</code> icon. */ 115 public static int ROLL_OVER = 21; 116 117 /** The <code>Create</code> icon. */ 118 public static int CREATE = 22; 119 111 120 /** 112 121 * The maximum ID used for the icon IDs. 113 122 * Allows to correctly build arrays for direct indexing. 114 123 */ 115 private static int MAX_ID = 19;124 private static int MAX_ID = 22; 116 125 117 126 /** Paths of the icon files. */ … … 140 149 relPaths[TRANSPARENT] = "eclipse_transparent16.png"; 141 150 relPaths[ANNOTATION_8] = "nuvola_knotes8.png"; 151 relPaths[MANAGER] = "eclipse_external_tools16.png"; 152 relPaths[ROLL_OVER] = "roll_over_image16.png"; 153 relPaths[CREATE] = "nuvola_filenew16.png"; 142 154 } 143 155 -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/browser/Browser.java
r5332 r5345 36 36 37 37 //Application-internal dependencies 38 import org.openmicroscopy.shoola.agents.dataBrowser.layout.Layout; 38 39 import org.openmicroscopy.shoola.util.ui.component.ObservableComponent; 39 40 import pojos.DataObject; … … 207 208 208 209 /** 209 * Sets the layout index. 210 * 211 * @param index The index of the layout. 212 */ 213 public void setSelectedLayout(int index); 214 215 /** 216 * Returns the index of the selected layout. 217 * 218 * @return See above. 219 */ 220 public int getSelectedLayout(); 210 * Sets the selected layout. 211 * 212 * @param layout The layout. 213 */ 214 public void setSelectedLayout(Layout layout); 221 215 222 216 /** … … 349 343 public List<ImageNode> getVisibleImageNodes(); 350 344 345 public Layout getSelectedLayout(); 346 351 347 } -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/browser/BrowserModel.java
r5332 r5345 38 38 //Application-internal dependencies 39 39 import org.openmicroscopy.shoola.agents.dataBrowser.Colors; 40 import org.openmicroscopy.shoola.agents.dataBrowser.layout.Layout; 40 41 import org.openmicroscopy.shoola.agents.dataBrowser.layout.LayoutFactory; 41 42 import org.openmicroscopy.shoola.agents.dataBrowser.visitor.NodesFinder; … … 87 88 private RootDisplay rootDisplay; 88 89 89 /** The index of theselected layout. */90 private int selectedLayout;90 /** The selected layout. */ 91 private Layout selectedLayout; 91 92 92 93 /** … … 389 390 /** 390 391 * Implemented as specified by the {@link Browser} interface. 391 * @see Browser#setSelectedLayout(int) 392 */ 393 public void setSelectedLayout(int index) 394 { 395 int oldIndex = selectedLayout; 396 switch (index) { 392 * @see Browser#setSelectedLayout(Layout) 393 */ 394 public void setSelectedLayout(Layout layout) 395 { 396 if (layout == null) return; 397 Layout oldLayout = selectedLayout; 398 switch (layout.getIndex()) { 397 399 case LayoutFactory.SQUARY_LAYOUT: 398 400 case LayoutFactory.FLAT_LAYOUT: 399 selectedLayout = index;401 selectedLayout = layout; 400 402 break; 401 default:402 selectedLayout = LayoutFactory.SQUARY_LAYOUT;403 403 } 404 firePropertyChange(LAYOUT_PROPERTY, new Integer(oldIndex), 405 new Integer(selectedLayout)); 404 firePropertyChange(LAYOUT_PROPERTY, oldLayout, selectedLayout); 406 405 } 407 406 … … 410 409 * @see Browser#getSelectedLayout() 411 410 */ 412 public int getSelectedLayout() { return selectedLayout; }411 public Layout getSelectedLayout() { return selectedLayout; } 413 412 414 413 /** … … 469 468 desktop.removeAll(); 470 469 Iterator i; 471 if (selectedLayout == LayoutFactory.SQUARY_LAYOUT) { 472 i = rootChildren.iterator(); 473 ImageDisplay child; 474 while (i.hasNext()) { 475 child = (ImageDisplay) i.next(); 476 desktop.add(child); 477 addToDesktop(child); 478 } 479 } else if (selectedLayout == LayoutFactory.FLAT_LAYOUT) { 480 i = getImageNodes().iterator(); 481 while (i.hasNext()) 482 desktop.add((ImageDisplay) i.next()); 483 } 470 switch (selectedLayout.getIndex()) { 471 case LayoutFactory.SQUARY_LAYOUT: 472 i = rootChildren.iterator(); 473 ImageDisplay child; 474 while (i.hasNext()) { 475 child = (ImageDisplay) i.next(); 476 desktop.add(child); 477 addToDesktop(child); 478 } 479 break; 480 481 case LayoutFactory.FLAT_LAYOUT: 482 i = getImageNodes().iterator(); 483 while (i.hasNext()) 484 desktop.add((ImageDisplay) i.next()); 485 } 484 486 rootDisplay.setCursor( 485 487 Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/FlatLayout.java
r5317 r5345 77 77 private Set oldNodes; 78 78 79 /** The number of items per row. */ 80 private int itemsPerRow; 81 79 82 /** 80 83 * Package constructor so that objects can only be created by the … … 137 140 */ 138 141 public void setOldNodes(Set oldNodes) { this.oldNodes = oldNodes; } 142 143 /** 144 * Implemented as specified by the {@link Layout} interface. 145 * @see Layout#setImagesPerRow(int) 146 */ 147 public void setImagesPerRow(int number) { itemsPerRow = number; } 139 148 140 149 } -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/Layout.java
r5317 r5345 74 74 */ 75 75 public void setOldNodes(Set oldNodes); 76 77 /** 78 * Sets the number of images per row. 79 * 80 * @param number The value to set. 81 */ 82 public void setImagesPerRow(int number); 83 76 84 } -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/LayoutFactory.java
r5342 r5345 56 56 * Creates the specified layout. 57 57 * 58 * @param type One of the constants defined by this class. 59 * @param sorter Class used to sort the nodes by date or alphabetically. 58 * @param type One of the constants defined by this class. 59 * @param sorter Class used to sort the nodes by date or 60 * alphabetically. 61 * @param itemsPerRow The number of items oer row. 60 62 * @return A layout object for the given layout <code>type</code>. 61 63 * @throws IllegalArgumentException If <code>type</code> is not one of 62 64 * the constants defined by this class. 63 65 */ 64 public static Layout createLayout(int type, ViewerSorter sorter) 66 public static Layout createLayout(int type, ViewerSorter sorter, int 67 itemsPerRow) 65 68 { 66 69 if (sorter == null) … … 68 71 switch (type) { 69 72 case SQUARY_LAYOUT: 70 return new SquaryLayout(sorter );73 return new SquaryLayout(sorter, itemsPerRow); 71 74 case FLAT_LAYOUT: 72 75 return new FlatLayout(sorter); … … 80 83 * Returns the default layout. 81 84 * 82 * @param sorter Class used to sort the nodes by date or alphabetically. 85 * @param sorter Class used to sort the nodes by date or 86 * alphabetically. 87 * @param itemsPerRow The number of images per row. 83 88 * @return See above. 84 89 */ 85 public static Layout getDefaultLayout(ViewerSorter sorter )90 public static Layout getDefaultLayout(ViewerSorter sorter, int itemsPerRow) 86 91 { 87 return createLayout(getDefaultLayoutIndex(), sorter );92 return createLayout(getDefaultLayoutIndex(), sorter, itemsPerRow); 88 93 } 89 94 -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/LayoutUtils.java
r5342 r5345 162 162 n = (int) Math.floor(Math.sqrt(n))+1; 163 163 Dimension d; 164 164 165 try { 165 166 for (int i = 0; i < n; ++i) { … … 187 188 * in the parent <code>node</code>. 188 189 * 189 * @param node The parent node. Mustn't be <code>null</code>. 190 * @param sorter The sorter. 191 */ 192 static void doSquareGridLayout(ImageDisplay node, ViewerSorter sorter) 190 * @param node The parent node. Mustn't be <code>null</code>. 191 * @param sorter The sorter. 192 * @param itemsPerRow The number of items per row. 193 */ 194 static void doSquareGridLayout(ImageDisplay node, ViewerSorter sorter, int 195 itemsPerRow) 193 196 { 194 197 //First find out the max dim among children. … … 209 212 List l = new ArrayList(); 210 213 for (int i = 0; i < comps.length; i++) { 211 if (comps[i] instanceof ImageDisplay) {214 if (comps[i] instanceof ImageDisplay) 212 215 l.add(comps[i]); 213 }214 216 } 215 n = l.size(); 216 n = (int) Math.floor(Math.sqrt(n))+1; //See note. 217 //l = sorter.sort(l); 218 if (itemsPerRow > 1) { 219 n = itemsPerRow; 220 } else { 221 n = l.size(); 222 n = (int) Math.floor(Math.sqrt(n))+1; //See note. 223 } 224 217 225 218 226 //Finally do layout. … … 222 230 223 231 ImageDisplay child; 224 225 226 227 228 232 Iterator children = l.iterator(); 229 233 try { -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/SquaryLayout.java
r5342 r5345 82 82 /** Collection of nodes previously layed out. */ 83 83 private Set oldNodes; 84 85 /** The number of items per row. */ 86 private int itemsPerRow; 84 87 85 88 /** Maximum width of the BrowserView.*/ … … 221 224 * {@link LayoutFactory}. 222 225 * 223 * @param sorter A {@link ViewerSorter sorter} to order nodes. 224 */ 225 SquaryLayout(ViewerSorter sorter) 226 * @param sorter A {@link ViewerSorter sorter} to order nodes. 227 * @param itemsPerRow The number of items per row. 228 */ 229 SquaryLayout(ViewerSorter sorter, int itemsPerRow) 226 230 { 227 231 setBrowserSize(); 228 232 this.sorter = sorter; 233 this.itemsPerRow = itemsPerRow; 229 234 } 230 235 … … 243 248 } 244 249 if (node.containsImages()) 245 LayoutUtils.doSquareGridLayout(node, sorter );250 LayoutUtils.doSquareGridLayout(node, sorter, itemsPerRow); 246 251 else visitContainerNode(node); 247 252 } else { … … 274 279 } 275 280 if (node.containsImages()) 276 LayoutUtils.doSquareGridLayout(node, sorter );281 LayoutUtils.doSquareGridLayout(node, sorter, itemsPerRow); 277 282 else visitContainerNode(node); 278 283 } … … 310 315 */ 311 316 public void setOldNodes(Set oldNodes) { this.oldNodes = oldNodes; } 317 318 /** 319 * Implemented as specified by the {@link Layout} interface. 320 * @see Layout#setImagesPerRow(int) 321 */ 322 public void setImagesPerRow(int number) { itemsPerRow = number; } 312 323 313 324 } -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowser.java
r5342 r5345 58 58 59 59 /** Loads the thumbnails when we have <code>100</code> or less values. */ 60 public static final int MAX_ENTRIES = 1; 61 62 63 public static final int ANNOTATE_SELECTION = 100; 64 65 public static final int ANNOTATE_IMAGES = 101; 66 67 public static final int ANNOTATE_CHILDREN = 102; 60 public static final int MAX_ENTRIES = 100; 68 61 69 62 /** Indicates to lay out the nodes as thumbnails. */ … … 231 224 public void setFilteredNodes(List<DataObject> objects); 232 225 226 /** 227 * Filters the images. 228 * 229 * @param context The filtering context. 230 */ 233 231 public void filterByContext(FilterContext context); 234 232 235 public void annotate(int index); 236 233 /** Loads the existing tags. */ 237 234 public void loadExistingTags(); 238 235 236 /** 237 * Sets the existing tags. 238 * 239 * @param collection The collection to set. 240 */ 239 241 public void setExistingTags(Collection collection); 240 242 -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserComponent.java
r5342 r5345 28 28 import java.util.ArrayList; 29 29 import java.util.Collection; 30 import java.util.HashSet;31 30 import java.util.Iterator; 32 31 import java.util.List; 33 import java.util.Set;34 32 import javax.swing.JComponent; 35 33 … … 44 42 import org.openmicroscopy.shoola.agents.dataBrowser.visitor.NodesFinder; 45 43 import org.openmicroscopy.shoola.agents.dataBrowser.visitor.RegexFinder; 46 import org.openmicroscopy.shoola.agents.metadata.MetadataViewerAgent;47 44 import org.openmicroscopy.shoola.env.data.util.FilterContext; 48 import org.openmicroscopy.shoola.env.event.EventBus;49 45 import org.openmicroscopy.shoola.env.ui.UserNotifier; 50 46 import org.openmicroscopy.shoola.util.ui.RegExFactory; 51 47 import org.openmicroscopy.shoola.util.ui.component.AbstractComponent; 52 48 import pojos.DataObject; 53 import pojos.ImageData;54 49 55 50 /** … … 159 154 { 160 155 Object object = node.getHierarchyObject(); 161 if (object instanceof DataObject) 162 firePropertyChange(SELECTED_NODE_DISPLAY_PROPERTY, null, object); 156 List<Object> objects = new ArrayList<Object>(); 157 objects.add(object); 158 if (object instanceof DataObject) { 159 ImageDisplay p = node.getParentDisplay(); 160 Object parent = p.getHierarchyObject(); 161 if (!(parent instanceof DataObject)) 162 parent = model.getParent(); 163 objects.add(parent); 164 } 165 firePropertyChange(SELECTED_NODE_DISPLAY_PROPERTY, null, objects); 163 166 } 164 167 … … 321 324 fireStateChange(); 322 325 } 323 324 /**325 * Implemented as specified by the {@link DataBrowser} interface.326 * @see DataBrowser#annotate(int)327 */328 public void annotate(int index)329 {330 Browser browser = model.getBrowser();331 Collection nodes = null;332 switch (index) {333 case ANNOTATE_CHILDREN:334 335 //TODO336 case ANNOTATE_IMAGES:337 nodes = browser.getVisibleImages();338 case ANNOTATE_SELECTION:339 Set display = browser.getSelectedDisplays();340 if (display != null) {341 Iterator i = display.iterator();342 ImageDisplay node;343 nodes = new HashSet();344 Object ho;345 while (i.hasNext()) {346 node = (ImageDisplay) i.next();347 ho = node.getHierarchyObject();348 if (ho instanceof ImageData) {349 nodes.add(ho);350 }351 }352 }353 break;354 355 default:356 throw new IllegalArgumentException("Annotation index " +357 "not supported.");358 }359 EventBus bus = MetadataViewerAgent.getRegistry().getEventBus();360 System.err.println(nodes);361 //if (nodes != null)362 // bus.post(new ViewMetadata(nodes));363 }364 326 365 327 /** -
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserControl.java
r5337 r5345 136 136 } 137 137 138 /**139 * Forwards call the {@link DataBrowser model}.140 *141 * @param index One the annotation contants defined by {@link DataBrowser}.142 */143 void annotate(int index) { model.annotate(index); }144 145 138 /** 146 139 * Loads data, filters nodes or sets the selected node. … … 162 155 model.loadExistingTags(); 163 156 } else if (Browser.ROLL_OVER_PROPERTY.equals(name)) { 164 165 157 if (view.isRollOver()) { 166
