- Timestamp:
- 07/04/08 13:41:43 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java
r5525 r5528 35 35 import java.awt.image.BufferedImage; 36 36 import java.util.ArrayList; 37 import java.util.Collection; 37 38 import java.util.HashMap; 38 39 import java.util.Iterator; 40 import java.util.LinkedHashMap; 39 41 import java.util.List; 40 42 import java.util.Map; … … 60 62 import org.openmicroscopy.shoola.agents.imviewer.util.HistoryItem; 61 63 import org.openmicroscopy.shoola.agents.imviewer.util.PreferencesDialog; 64 import org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjectionDialog; 65 import org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjectionRef; 62 66 import org.openmicroscopy.shoola.agents.imviewer.util.UnitBarSizeDialog; 63 67 import org.openmicroscopy.shoola.agents.imviewer.util.player.MoviePlayerDialog; … … 80 84 import org.openmicroscopy.shoola.util.ui.component.AbstractComponent; 81 85 import pojos.ExperimenterData; 86 import pojos.ImageData; 82 87 83 88 /** … … 116 121 static final String ANNOTATION = "The annotations"; 117 122 118 /** The message if rendering setting to annotation. */119 static final String RATING = "The rating";120 121 123 /** The Model sub-component. */ 122 124 private ImViewerModel model; … … 149 151 private boolean saveBeforeCopy; 150 152 153 /** The possible projections options. */ 154 private Map<Integer, String> projections; 155 156 /** The projection dialog. */ 157 private ProjectionDialog projection; 158 151 159 /** Creates an history item. */ 152 160 private void createHistoryItem() … … 733 741 pref.isHistory()) { 734 742 if (image != null) 735 view.setRestoreSize(image.getWidth(), image.getHeight()); 743 view.setRestoreSize(image.getWidth(), 744 image.getHeight()); 736 745 //boolean oldValue = view.isHistoryShown(); 737 746 view.showHistory(true); … … 2399 2408 } 2400 2409 2410 /** 2411 * Implemented as specified by the {@link ImViewer} interface. 2412 * @see ImViewer#showProjection() 2413 */ 2414 public void showProjection() 2415 { 2416 if (model.getState() == DISCARDED) 2417 throw new IllegalArgumentException("This method cannot be invoked" + 2418 " in the DISCARDED state."); 2419 if (projections == null) { 2420 projections = new LinkedHashMap<Integer, String>(); 2421 projections.put(RenderingControl.MAX_INTENSITY, 2422 "Maximum Intensity"); 2423 projections.put(RenderingControl.MEAN_INTENSITY, 2424 "Mean Intensity"); 2425 projections.put(RenderingControl.SUM_INTENSITY, 2426 "Sum Intensity"); 2427 } 2428 if (projection == null) { 2429 projection = new ProjectionDialog(view, projections, 2430 model.getMaxZ()+1, 2431 model.getBrowser().getBackgroundColor(), 2432 model.getImageName(), 2433 model.getOriginalImage()); 2434 projection.addPropertyChangeListener(controller); 2435 projection.setProjectedImage(model.getOriginalImage()); 2436 UIUtilities.incrementRelativeToAndShow(view.getBounds(), 2437 projection); 2438 } else { 2439 projection.setVisible(true); 2440 } 2441 } 2442 2443 /** 2444 * Implemented as specified by the {@link ImViewer} interface. 2445 * @see ImViewer#projectImage(ProjectionRef) 2446 */ 2447 public void projectImage(ProjectionRef ref) 2448 { 2449 if (model.getState() == DISCARDED) 2450 throw new IllegalArgumentException("This method cannot be invoked" + 2451 " in the DISCARDED state."); 2452 if (projection == null) return; 2453 if (!projection.isVisible()) return; 2454 UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 2455 un.notifyInfo("Projection preview", "Not yet implemented"); 2456 projection.setVisible(false); 2457 projection.dispose(); 2458 projection = null; 2459 //model.fireProjectImage(ref); 2460 } 2461 2462 /** 2463 * Implemented as specified by the {@link ImViewer} interface. 2464 * @see ImViewer#setRenderProjected(BufferedImage) 2465 */ 2466 public void setRenderProjected(BufferedImage image) 2467 { 2468 if (image == null) { 2469 UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 2470 un.notifyInfo("Projection preview", "An error has occurred " + 2471 "while projecting the data."); 2472 } 2473 projection.setProjectedImage(image); 2474 } 2475 2476 /** 2477 * Implemented as specified by the {@link ImViewer} interface. 2478 * @see ImViewer#projectionPreview(ProjectionRef) 2479 */ 2480 public void projectionPreview(ProjectionRef ref) 2481 { 2482 if (model.getState() == DISCARDED) 2483 throw new IllegalArgumentException("This method cannot be invoked" + 2484 " in the DISCARDED state."); 2485 if (projection == null) return; 2486 if (!projection.isVisible()) return; 2487 2488 /* 2489 BufferedImage img = null; 2490 try { 2491 img = model.renderProjected(ref.getStartZ(), ref.getEndZ(), 2492 ref.getStepping(), ref.getType()); 2493 } catch (Exception e) { 2494 projection.setProjectedImage(null); 2495 UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 2496 un.notifyInfo("Projection preview", "An error has occurred " + 2497 "while projecting the data."); 2498 } 2499 projection.setProjectedImage(img); 2500 */ 2501 model.fireRenderProjected(ref); 2502 } 2503 2504 /** 2505 * Implemented as specified by the {@link ImViewer} interface. 2506 * @see ImViewer#setContainers(Collection) 2507 */ 2508 public void setContainers(Collection containers) 2509 { 2510 if (model.getState() == DISCARDED) 2511 throw new IllegalArgumentException("This method cannot be invoked" + 2512 " in the DISCARDED state."); 2513 if (projection == null) return; 2514 if (!projection.isVisible()) return; 2515 projection.setContainers(containers); 2516 } 2517 2518 /** 2519 * Implemented as specified by the {@link ImViewer} interface. 2520 * @see ImViewer#loadContainers() 2521 */ 2522 public void loadContainers() 2523 { 2524 if (model.getState() == DISCARDED) 2525 throw new IllegalArgumentException("This method cannot be invoked" + 2526 " in the DISCARDED state."); 2527 if (projection == null) return; 2528 if (!projection.isVisible()) return; 2529 model.fireContainersLoading(); 2530 } 2531 2532 /** 2533 * Implemented as specified by the {@link ImViewer} interface. 2534 * @see ImViewer#setProjectedImage(ImageData) 2535 */ 2536 public void setProjectedImage(ImageData image) 2537 { 2538 UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 2539 String message; 2540 if (image == null) 2541 message = "An error has occurred while creating the " + 2542 "projected image."; 2543 else message = "The image, "+image.getName() +" has been successfully " 2544 +"created"; 2545 un.notifyInfo("Projection", message); 2546 projection.setVisible(false); 2547 projection.dispose(); 2548 projection = null; 2549 } 2550 2401 2551 }
