ini.trakem2.display
Class Display

java.lang.Object
  extended by ini.trakem2.persistence.DBObject
      extended by ini.trakem2.display.Display
All Implemented Interfaces:
ij.IJEventListener, java.awt.event.ActionListener, java.util.EventListener

public final class Display
extends DBObject
implements java.awt.event.ActionListener, ij.IJEventListener

A Display is a class to show a Layer and enable mouse and keyboard manipulation of all its components.


Nested Class Summary
protected  class Display.GridOverlay
           
 
Field Summary
protected  Dispatcher dispatcher
          A thread to handle user actions, for example an event sent from a popup menu.
protected  Display.GridOverlay gridoverlay
           
protected static int REPAINT_MULTI_LAYER
           
protected static int REPAINT_RGB_LAYER
           
protected static int REPAINT_SINGLE_LAYER
           
 
Fields inherited from class ini.trakem2.persistence.DBObject
id, project
 
Fields inherited from interface ij.IJEventListener
BACKGROUND_COLOR_CHANGED, COLOR_PICKER_CLOSED, FOREGROUND_COLOR_CHANGED, LOG_WINDOW_CLOSED, TOOL_CHANGED
 
Constructor Summary
Display(Project project, Layer layer)
          A new Display from scratch, to show the given Layer.
Display(Project project, Layer layer, Displayable displ)
          Open a new Display centered around the given Displayable.
Display(Project project, long id, Layer layer, java.util.HashMap<java.lang.String,java.lang.String> ht)
          Reconstruct a Display from an XML entry, to be opened when everything is ready.
Display(Project project, long id, Layer layer, java.lang.Object[] props)
          For reconstruction purposes.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
           
protected static void add(Layer layer, Displayable displ)
           
protected static void add(Layer layer, Displayable displ, boolean activate)
          Find the displays that show the given Layer, and add the given Displayable to the GUI and sets it active only in the front Display and only if 'activate' is true.
protected static void add(LayerSet set, ZDisplayable zdispl)
          Add the ZDisplayable to all Displays that show a Layer belonging to the given LayerSet.
protected static void addAll(Layer layer, java.util.Collection<? extends Displayable> coll)
           
protected static void addAll(LayerSet set, java.util.Collection<? extends ZDisplayable> coll)
           
 int addTab(java.lang.String title, java.awt.Component comp)
          Returns the tab index in this Display's JTabbedPane.
 void adjustProperties()
           
 void animateBrowsingTo(Coordinate<?> c)
           
protected  java.awt.Image applyFilters(java.awt.Image img)
           
protected  ij.ImagePlus applyFilters(ij.ImagePlus imp)
           
protected  ij.ImagePlus applyFilters(ij.process.ImageProcessor ip)
           
 void center(Coordinate<?> c)
           
 void center(double x, double y)
          Center the view, if possible, on x,y.
static void centerAt(Coordinate c)
           
static void centerAt(Coordinate<Displayable> c, boolean select, boolean shift_down)
           
 void centerIfNotWithinSrcRect(Coordinate<?> c)
           
protected  void choose(int screen_x_p, int screen_y_p, int x_p, int y_p)
           
protected  void choose(int screen_x_p, int screen_y_p, int x_p, int y_p, boolean shift_down, java.lang.Class<?> c)
          Find a Displayable to add to the selection under the given point (which is in offscreen coords); will use a popup menu to give the user a range of Displayable objects to select from.
protected  void choose(int screen_x_p, int screen_y_p, int x_p, int y_p, java.lang.Class<?> c)
           
 void clearColumnScreenshots()
           
static void clearColumnScreenshots(LayerSet ls)
           
static void clearSelection()
           
static void clearSelection(Layer layer)
           
static void clearSelection(Project p)
           
static void close(Layer layer)
          Find all Display instances that contain the layer and close them and remove the Display from the database.
static void close(Project project)
          Find all Display instances that contain a Layer of the given project and close them without removing the Display entries from the database.
static void createDisplay(Project project, Layer layer)
          Creates a new Display with adjusted magnification to fit in the screen.
protected  void destroy()
          Release all resources held by this Display and close the frame.
protected  void duplicateLinkAndSendTo(Displayable active, int position, Layer other_layer)
           
 void eventOccurred(int eventID)
           
static void exportDTD(java.lang.StringBuilder sb_header, java.util.HashSet<java.lang.String> hs, java.lang.String indent)
          Export the DTD that defines this object.
static void exportXML(Project project, java.io.Writer writer, java.lang.String indent, java.lang.Object any)
          Export all displays of the given project as XML entries.
static void flush(Displayable displ)
          Cleanup internal lists that may contain the given Displayable.
static void flushAll()
          Release memory captured by the offscreen images
 Displayable getActive()
           
 java.awt.Rectangle getBounds()
           
 DisplayCanvas getCanvas()
           
 int getChannelAlphas()
           
 int getChannelAlphasState()
           
protected  java.util.Set<java.lang.Class<?>> getClassesToMultiPaint()
          Only Patch, Stack; AreaList, Profile; and DLabel are considered.
 int getDisplayChannelAlphas()
           
static int getDisplayCount()
           
static java.util.Vector<Display> getDisplays()
           
 javax.swing.JFrame getFrame()
           
static Display getFront()
          Can be null.
static Display getFront(Project project)
          Get a pointer to a Display for @param project, or null if none.
static Layer getFrontLayer()
          Get the layer of the front Display, or null if none.
static Layer getFrontLayer(Project project)
          Get the layer of an open Display of the given Project, or null if none.
 Layer getLayer()
           
protected  byte getLayerCompositeMode(Layer layer)
           
 LayerSet getLayerSet()
           
 java.awt.Point getLocation()
           
 Mode getMode()
           
 DisplayNavigator getNavigator()
           
static Display getOrCreateFront(Project project)
           
protected  int getPaintMode(java.util.HashMap<java.awt.Color,Layer> hm, java.util.ArrayList<LayerPanel> list)
          Sets the values atomically, returns the painting mode.
protected  javax.swing.JPopupMenu getPopupMenu()
          Return a context-sensitive popup menu.
 ij.gui.Roi getRoi()
          Get the current ROI, if any.
 int getScrollStep()
          The number of layers to scroll through with the wheel; 1 by default.
static java.util.List<Displayable> getSelected()
          Return the list of selected Displayable objects of the front Display, or an emtpy list if no Display or none selected.
static java.util.List<? extends Displayable> getSelected(java.lang.Class<? extends Displayable> c)
          Return the list of selected Displayable objects of class @param c of the front Display, or an emtpy list if no Display or none selected.
 Selection getSelection()
           
 javax.swing.JTabbedPane getTabbedPane()
          Feel free to add more tabs.
 void hideDeselected(boolean not_images)
           
 void imageClosed(ij.ImagePlus imp)
           
 void imageOpened(ij.ImagePlus imp)
           
protected  Bureaucrat importImage()
           
protected  Bureaucrat importNextImage()
           
protected  boolean isActiveWindow()
           
 boolean isLiveFilteringEnabled()
           
 boolean isPartiallyWithinViewport(Displayable d)
          Check if a panel for the given Displayable is partially visible in the JScrollPane
 boolean isReadOnly()
           
 boolean isSelected(Displayable d)
           
 boolean isShowing(Layer layer)
           
 boolean isTransforming()
          Find out whether this Display is Transforming its active Displayable.
static boolean isTransforming(Displayable displ)
          Find whether any Display is transforming the given Displayable.
 boolean isWithinViewport(Displayable d)
          Check if a panel for the given Displayable is completely visible in the JScrollPane
 void nextLayer(int modifiers)
          If shift is down, scroll to the next non-empty layer; otherwise, if scroll_step is larger than 1, then scroll 'scroll_step' layers ahead; else just the next Layer.
static Bureaucrat openLater()
          After reloading a project from the database, open the Displays that the project had.
 void pack()
           
static void pack(LayerSet ls)
           
 boolean paintsBelow(Displayable base, Displayable other)
          If the other paints under the base.
 void previousLayer(int modifiers)
          If shift is down, scroll to the previous non-empty layer; otherwise, if scroll_step is larger than 1, then scroll 'scroll_step' layers backward; else just the previous Layer.
 boolean remove(boolean check)
          Subclasses can override this method to perform other tasks before removing itself from the database.
static void remove(Layer layer)
          Find all Display instances that are showing the layer and either move to the next or previous layer, or close it if none.
static void remove(Layer layer, Displayable displ)
          Find the displays that show the given Layer, and remove the given Displayable from the GUI.
static void remove(ZDisplayable zdispl)
           
static Bureaucrat removeAlphaMasks(java.util.Collection<Patch> patches)
           
 Bureaucrat removeCoordinateTransforms(java.util.List<Patch> patches)
           
 Bureaucrat removeScalingRotationShear(java.util.List<Patch> patches)
           
static void repaint()
          Call repaint on all open Displays.
static void repaint(Displayable d)
           
static void repaint(Layer layer)
          Repaint the entire Layer, in all Displays showing it, including the tabs.
static void repaint(Layer layer, Displayable displ)
          Repaint the DisplayablePanel (and DisplayNavigator) only for the given Displayable, in all Displays showing the given Layer.
static void repaint(Layer layer, Displayable displ, int extra)
           
static void repaint(Layer layer, Displayable displ, java.awt.Rectangle r, int extra)
           
static void repaint(Layer layer, Displayable displ, java.awt.Rectangle r, int extra, boolean repaint_navigator)
          Find the displays that show the given Layer, and repaint the given Displayable; does NOT update graphics for the offscreen image.
static void repaint(Layer layer, Displayable displ, java.awt.Rectangle r, int extra, boolean update_graphics, boolean repaint_navigator)
           
static void repaint(Layer layer, int extra, java.awt.Rectangle r, boolean update_navigator)
           
static void repaint(Layer layer, int extra, java.awt.Rectangle r, boolean update_navigator, boolean update_graphics)
           
static void repaint(Layer layer, java.awt.Rectangle r, int extra)
          Repaint the given Rectangle in all Displays showing the layer, updating the offscreen image if any.
static void repaint(Layer layer, java.awt.Rectangle r, int extra, boolean update_graphics)
          Repaint the given Rectangle in all Displays showing the layer, optionally updating the offscreen image (if any).
static void repaint(LayerSet set)
          Repaint the entire LayerSet, in all Displays showing a Layer of it.
static void repaint(LayerSet set, Displayable displ, int extra)
           
static void repaint(LayerSet set, Displayable displ, java.awt.Rectangle r, int extra)
           
static void repaint(LayerSet set, Displayable displ, java.awt.Rectangle r, int extra, boolean repaint_navigator)
          Repaint the Displayable in every Display that shows a Layer belonging to the given LayerSet.
static void repaint(LayerSet set, java.awt.Rectangle box)
          Repaint the given box in the LayerSet, in all Displays showing a Layer of it.
 void repaintAll()
          Repaint both the canvas and the navigator, updating the graphics, and the title and tabs.
 void repaintAll2()
          Repaint the canvas updating graphics, the navigator without updating graphics, and the title.
 void repaintAll3()
          Repaint the canvas updating graphics, and the navigator without updating graphics.
static void repaintSnapshot(Displayable displ)
          Repaint the snapshot for the given Displayable both at the DisplayNavigator and on its panel,and only if it has not been painted before.
protected static void repaintSnapshots(Layer layer)
           
protected static void repaintSnapshots(LayerSet set)
           
static void repaintToolbar()
           
 void repairGUI()
          Repair possibly missing panels and other components by simply resetting the same Layer
protected  void resetLayerAlphas()
          Set all layer alphas to zero, and repaint canvas.
protected  void resetLayerColors()
          Remove all red/blue coloring of layers, and repaint canvas.
protected  void resetLayerComposites()
           
 void resizeCanvas()
           
 void resizeCanvas(java.awt.Rectangle bounds)
           
 void select(Displayable d)
           
 void select(Displayable d, boolean shift_down)
          Select/deselect accordingly to the current state and the shift key.
protected  void setActive(Displayable displ)
          Used by the Selection exclusively.
static void setActive(java.lang.Object event, Displayable displ)
           
 void setActiveChannel(Channel channel)
          Set the channel as active and the others as inactive.
 void setChannel(int c, float alpha)
          Make the given channel have the given alpha (transparency).
protected  void setColorChannel(Layer layer, java.awt.Color color)
          Set a layer to be painted as a specific color channel in the canvas.
protected  void setCursor(java.awt.Cursor c)
           
static void setCursorToAll(java.awt.Cursor c)
           
static void setFront(Layer layer, Displayable displ)
          Grab the last selected display (or create an new one if none) and show in it the layer,centered on the Displayable object.
 void setLayer(Layer new_layer)
           
protected  void setLayerCompositeMode(Layer layer, byte compositeMode)
           
 void setLocation(java.awt.Point p)
           
 void setMode(Mode mode)
           
static void setReceivesInput(Project project, boolean b)
          Toggle user input; pan and zoom are always enabled though.
protected static void setRepaint(boolean b)
          Set a flag to enable/disable repainting of all Display instances.
 void setScrollStep(int scroll_step)
           
 void setTransparencySlider(float transp)
           
protected  void setTranspOverlayAreas(boolean b)
           
protected  void setTranspOverlayImages(boolean b)
           
protected  void setTranspOverlayTextLabels(boolean b)
           
 void setUpdateGraphics(boolean b)
          Whether to update the offscreen images or not.
static void setUpdateGraphics(Layer layer, boolean update)
          Flag the DisplayCanvas of Displays showing the given Layer to update their offscreen images.
static void setUpdateGraphics(Layer layer, Displayable displ)
          Mark the canvas for updating the offscreen images if the given Displayable is NOT the active.
 void show(Layer layer, Displayable displ, boolean select, boolean shift_down)
          Set this Display to show the specific layer, centered at the @param displ, and perhaps selected, adding to the selection instead of clearing it if @param shift_down is true.
static void showCentered(Layer layer, Displayable displ, boolean select, boolean shift_down)
          Show the given Displayable centered and selected.
static void showFront(Layer layer)
          Show the layer in the front Display, or in a new Display if the front Display is showing a layer from a different LayerSet.
protected  void showPopup(java.awt.Component c, int x, int y)
           
static Bureaucrat snap(Patch patch)
          Snap a Patch to the most overlapping Patch, if any.
protected  void storeLayerAlpha(LayerPanel lp, float a)
          Add to layer_alpha table, or remove if alpha is zero.
 void toLayer(Layer la)
          Calls setLayer(la) on the SetLayerThread.
static void toolChanged(int tool)
           
static void toolChanged(java.lang.String tool_name)
           
static void update()
          Update the entire GUI: 1 - The layer scroller 2 - The visible tab panels 3 - The toolbar 4 - The navigator 5 - The canvas
static void update(Layer layer)
          Find all Display instances that contain the layer and repaint them, in the Swing GUI thread.
static void update(LayerSet set)
           
static void update(LayerSet set, boolean update_canvas_dimensions)
          Find all Display instances showing a Layer of this LayerSet, and update the dimensions of the navigator and canvas and snapshots, and repaint, in the Swing GUI thread.
static void updateCheckboxes(java.util.Collection<Displayable> displs, int cb)
          Update the checkbox @param cb state to an appropriate value for each Displayable.
static void updateCheckboxes(java.util.Collection<Displayable> displs, int cb, boolean state)
          Set the checkbox @param cb state to @param state value, for each Displayable.
static void updateCheckboxes(Displayable displ, int cb, boolean state)
          Used by the Displayable to update the visibility and locking state checkboxes in other Displays.
static void updateComponentTreeUI()
           
 void updateFrameTitle()
          Set a new title in the JFrame, showing info on the layer 'z' and the magnification.
static void updateLayerScroller(LayerSet set)
           
protected  void updateMultiPaint()
           
static void updatePanel(Layer layer, Displayable displ)
           
static void updatePanelIndex(Layer layer, Displayable displ)
           
static void updateSelection()
           
static void updateSelection(Display calling)
           
static void updateTitle(Layer layer)
          Update the Display's title in all Displays showing the given Layer.
static void updateTitle(Layer layer, Displayable displ)
          Update the title of the given Displayable in its DisplayablePanel, if any.
static void updateTitle(LayerSet ls)
          Update the Display's title in all Displays showing a Layer of the given LayerSet.
static void updateTitle(Project project)
           
static void updateTransform(Displayable displ)
          Update in all displays the Transform for the given Displayable if it's selected.
static void updateVisibleTabs()
           
static void updateVisibleTabs(Project p)
           
static boolean willPaint(Displayable displ)
          Check if any display will paint the given Displayable within its srcRect.
 
Methods inherited from class ini.trakem2.persistence.DBObject
addToDatabase, exportXML, getId, getInfo, getProject, getShortTitle, getTitle, getUniqueIdentifier, removeFromDatabase, updateInDatabase, updateInDatabase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dispatcher

protected final Dispatcher dispatcher
A thread to handle user actions, for example an event sent from a popup menu.


gridoverlay

protected Display.GridOverlay gridoverlay

REPAINT_SINGLE_LAYER

protected static final int REPAINT_SINGLE_LAYER
See Also:
Constant Field Values

REPAINT_MULTI_LAYER

protected static final int REPAINT_MULTI_LAYER
See Also:
Constant Field Values

REPAINT_RGB_LAYER

protected static final int REPAINT_RGB_LAYER
See Also:
Constant Field Values
Constructor Detail

Display

public Display(Project project,
               long id,
               Layer layer,
               java.lang.Object[] props)
For reconstruction purposes. The Display will be stored in the ht_later.


Display

public Display(Project project,
               Layer layer)
A new Display from scratch, to show the given Layer.


Display

public Display(Project project,
               Layer layer,
               Displayable displ)
Open a new Display centered around the given Displayable.


Display

public Display(Project project,
               long id,
               Layer layer,
               java.util.HashMap<java.lang.String,java.lang.String> ht)
Reconstruct a Display from an XML entry, to be opened when everything is ready.

Method Detail

getDisplays

public static final java.util.Vector<Display> getDisplays()

getDisplayCount

public static final int getDisplayCount()

clearColumnScreenshots

public static final void clearColumnScreenshots(LayerSet ls)

clearColumnScreenshots

public final void clearColumnScreenshots()

createDisplay

public static void createDisplay(Project project,
                                 Layer layer)
Creates a new Display with adjusted magnification to fit in the screen.


openLater

public static Bureaucrat openLater()
After reloading a project from the database, open the Displays that the project had.


repaintToolbar

public static void repaintToolbar()

getCanvas

public DisplayCanvas getCanvas()

setLayer

public void setLayer(Layer new_layer)

updateVisibleTabs

public static void updateVisibleTabs()

updateVisibleTabs

public static void updateVisibleTabs(Project p)

setTransparencySlider

public void setTransparencySlider(float transp)

setUpdateGraphics

public static void setUpdateGraphics(Layer layer,
                                     Displayable displ)
Mark the canvas for updating the offscreen images if the given Displayable is NOT the active.


setUpdateGraphics

public static void setUpdateGraphics(Layer layer,
                                     boolean update)
Flag the DisplayCanvas of Displays showing the given Layer to update their offscreen images.


setUpdateGraphics

public void setUpdateGraphics(boolean b)
Whether to update the offscreen images or not.


update

public static void update()
Update the entire GUI: 1 - The layer scroller 2 - The visible tab panels 3 - The toolbar 4 - The navigator 5 - The canvas


update

public static void update(Layer layer)
Find all Display instances that contain the layer and repaint them, in the Swing GUI thread.


update

public static void update(LayerSet set)

update

public static void update(LayerSet set,
                          boolean update_canvas_dimensions)
Find all Display instances showing a Layer of this LayerSet, and update the dimensions of the navigator and canvas and snapshots, and repaint, in the Swing GUI thread.


destroy

protected void destroy()
Release all resources held by this Display and close the frame.


close

public static void close(Project project)
Find all Display instances that contain a Layer of the given project and close them without removing the Display entries from the database.


close

public static void close(Layer layer)
Find all Display instances that contain the layer and close them and remove the Display from the database.


remove

public static void remove(Layer layer)
Find all Display instances that are showing the layer and either move to the next or previous layer, or close it if none.


remove

public boolean remove(boolean check)
Description copied from class: DBObject
Subclasses can override this method to perform other tasks before removing itself from the database.

Overrides:
remove in class DBObject

getLayer

public Layer getLayer()

getLayerSet

public LayerSet getLayerSet()

isShowing

public boolean isShowing(Layer layer)

getNavigator

public DisplayNavigator getNavigator()

repaintAll

public void repaintAll()
Repaint both the canvas and the navigator, updating the graphics, and the title and tabs.


repaintAll2

public void repaintAll2()
Repaint the canvas updating graphics, the navigator without updating graphics, and the title.


repaintAll3

public void repaintAll3()
Repaint the canvas updating graphics, and the navigator without updating graphics.


repaintSnapshots

protected static void repaintSnapshots(LayerSet set)

repaintSnapshots

protected static void repaintSnapshots(Layer layer)

pack

public void pack()

pack

public static void pack(LayerSet ls)

setFront

public static void setFront(Layer layer,
                            Displayable displ)
Grab the last selected display (or create an new one if none) and show in it the layer,centered on the Displayable object.


add

protected static void add(Layer layer,
                          Displayable displ,
                          boolean activate)
Find the displays that show the given Layer, and add the given Displayable to the GUI and sets it active only in the front Display and only if 'activate' is true.


add

protected static void add(Layer layer,
                          Displayable displ)

add

protected static void add(LayerSet set,
                          ZDisplayable zdispl)
Add the ZDisplayable to all Displays that show a Layer belonging to the given LayerSet.


addAll

protected static void addAll(Layer layer,
                             java.util.Collection<? extends Displayable> coll)

addAll

protected static void addAll(LayerSet set,
                             java.util.Collection<? extends ZDisplayable> coll)

remove

public static void remove(Layer layer,
                          Displayable displ)
Find the displays that show the given Layer, and remove the given Displayable from the GUI.


remove

public static void remove(ZDisplayable zdispl)

repaint

public static void repaint(Layer layer,
                           Displayable displ,
                           int extra)

repaint

public static void repaint(Layer layer,
                           Displayable displ,
                           java.awt.Rectangle r,
                           int extra)

repaint

public static void repaint(Layer layer,
                           Displayable displ,
                           java.awt.Rectangle r,
                           int extra,
                           boolean repaint_navigator)
Find the displays that show the given Layer, and repaint the given Displayable; does NOT update graphics for the offscreen image.


repaint

public static void repaint(Layer layer,
                           Displayable displ,
                           java.awt.Rectangle r,
                           int extra,
                           boolean update_graphics,
                           boolean repaint_navigator)
Parameters:
layer - The layer to repaint
r - The Rectangle to repaint, in world coordinates (aka pixel coordinates or canvas coordinates).
extra - The number of pixels to pad @param r with.
update_graphics - Whether to recreate the offscreen image of the canvas, which is necessary for images.
repaint_navigator - Whether to repaint the navigator.

repaint

public static void repaint(Displayable d)

repaintSnapshot

public static void repaintSnapshot(Displayable displ)
Repaint the snapshot for the given Displayable both at the DisplayNavigator and on its panel,and only if it has not been painted before. This method is intended for the loader to know when to paint a snap, to avoid overhead.


repaint

public static void repaint(Layer layer,
                           java.awt.Rectangle r,
                           int extra)
Repaint the given Rectangle in all Displays showing the layer, updating the offscreen image if any.


repaint

public static void repaint(Layer layer,
                           int extra,
                           java.awt.Rectangle r,
                           boolean update_navigator)

repaint

public static void repaint(Layer layer,
                           int extra,
                           java.awt.Rectangle r,
                           boolean update_navigator,
                           boolean update_graphics)

repaint

public static void repaint(Layer layer,
                           java.awt.Rectangle r,
                           int extra,
                           boolean update_graphics)
Repaint the given Rectangle in all Displays showing the layer, optionally updating the offscreen image (if any).


repaint

public static void repaint(Layer layer,
                           Displayable displ)
Repaint the DisplayablePanel (and DisplayNavigator) only for the given Displayable, in all Displays showing the given Layer.


repaint

public static void repaint(LayerSet set,
                           Displayable displ,
                           int extra)

repaint

public static void repaint(LayerSet set,
                           Displayable displ,
                           java.awt.Rectangle r,
                           int extra)

repaint

public static void repaint(LayerSet set,
                           Displayable displ,
                           java.awt.Rectangle r,
                           int extra,
                           boolean repaint_navigator)
Repaint the Displayable in every Display that shows a Layer belonging to the given LayerSet.


repaint

public static void repaint(LayerSet set)
Repaint the entire LayerSet, in all Displays showing a Layer of it.


repaint

public static void repaint(LayerSet set,
                           java.awt.Rectangle box)
Repaint the given box in the LayerSet, in all Displays showing a Layer of it.


repaint

public static void repaint(Layer layer)
Repaint the entire Layer, in all Displays showing it, including the tabs.


repaint

public static void repaint()
Call repaint on all open Displays.


setRepaint

protected static void setRepaint(boolean b)
Set a flag to enable/disable repainting of all Display instances.


getBounds

public java.awt.Rectangle getBounds()

getLocation

public java.awt.Point getLocation()

getFrame

public javax.swing.JFrame getFrame()

getTabbedPane

public javax.swing.JTabbedPane getTabbedPane()
Feel free to add more tabs. Don't remove any of the existing tabs or the sky will fall on your head.


addTab

public int addTab(java.lang.String title,
                  java.awt.Component comp)
Returns the tab index in this Display's JTabbedPane.


setLocation

public void setLocation(java.awt.Point p)

getActive

public Displayable getActive()

select

public void select(Displayable d)

select

public void select(Displayable d,
                   boolean shift_down)
Select/deselect accordingly to the current state and the shift key.


choose

protected void choose(int screen_x_p,
                      int screen_y_p,
                      int x_p,
                      int y_p,
                      java.lang.Class<?> c)

choose

protected void choose(int screen_x_p,
                      int screen_y_p,
                      int x_p,
                      int y_p)

choose

protected void choose(int screen_x_p,
                      int screen_y_p,
                      int x_p,
                      int y_p,
                      boolean shift_down,
                      java.lang.Class<?> c)
Find a Displayable to add to the selection under the given point (which is in offscreen coords); will use a popup menu to give the user a range of Displayable objects to select from.


setActive

protected void setActive(Displayable displ)
Used by the Selection exclusively. This method will change a lot in the near future, and may disappear in favor of getSelection().getActive(). All this method does is update GUI components related to the currently active and the newly active Displayable; called through SwingUtilities.invokeLater.


paintsBelow

public boolean paintsBelow(Displayable base,
                           Displayable other)
If the other paints under the base.


setActive

public static void setActive(java.lang.Object event,
                             Displayable displ)

isTransforming

public boolean isTransforming()
Find out whether this Display is Transforming its active Displayable.


isTransforming

public static boolean isTransforming(Displayable displ)
Find whether any Display is transforming the given Displayable.


getFrontLayer

public static Layer getFrontLayer()
Get the layer of the front Display, or null if none.


getFrontLayer

public static Layer getFrontLayer(Project project)
Get the layer of an open Display of the given Project, or null if none.


getFront

public static Display getFront(Project project)
Get a pointer to a Display for @param project, or null if none.


getSelected

public static java.util.List<Displayable> getSelected()
Return the list of selected Displayable objects of the front Display, or an emtpy list if no Display or none selected.


getSelected

public static java.util.List<? extends Displayable> getSelected(java.lang.Class<? extends Displayable> c)
Return the list of selected Displayable objects of class @param c of the front Display, or an emtpy list if no Display or none selected.


isReadOnly

public boolean isReadOnly()

showPopup

protected void showPopup(java.awt.Component c,
                         int x,
                         int y)

getPopupMenu

protected javax.swing.JPopupMenu getPopupMenu()
Return a context-sensitive popup menu.


removeScalingRotationShear

public Bureaucrat removeScalingRotationShear(java.util.List<Patch> patches)

removeCoordinateTransforms

public Bureaucrat removeCoordinateTransforms(java.util.List<Patch> patches)

isWithinViewport

public boolean isWithinViewport(Displayable d)
Check if a panel for the given Displayable is completely visible in the JScrollPane


isPartiallyWithinViewport

public boolean isPartiallyWithinViewport(Displayable d)
Check if a panel for the given Displayable is partially visible in the JScrollPane


updateTitle

public static void updateTitle(Layer layer,
                               Displayable displ)
Update the title of the given Displayable in its DisplayablePanel, if any.


updateTitle

public static void updateTitle(Layer layer)
Update the Display's title in all Displays showing the given Layer.


updateTitle

public static void updateTitle(Project project)

updateTitle

public static void updateTitle(LayerSet ls)
Update the Display's title in all Displays showing a Layer of the given LayerSet.


updateFrameTitle

public void updateFrameTitle()
Set a new title in the JFrame, showing info on the layer 'z' and the magnification.


nextLayer

public void nextLayer(int modifiers)
If shift is down, scroll to the next non-empty layer; otherwise, if scroll_step is larger than 1, then scroll 'scroll_step' layers ahead; else just the next Layer.


toLayer

public void toLayer(Layer la)
Calls setLayer(la) on the SetLayerThread.


previousLayer

public void previousLayer(int modifiers)
If shift is down, scroll to the previous non-empty layer; otherwise, if scroll_step is larger than 1, then scroll 'scroll_step' layers backward; else just the previous Layer.


updateLayerScroller

public static void updateLayerScroller(LayerSet set)

updatePanel

public static void updatePanel(Layer layer,
                               Displayable displ)

updatePanelIndex

public static void updatePanelIndex(Layer layer,
                                    Displayable displ)

repairGUI

public void repairGUI()
Repair possibly missing panels and other components by simply resetting the same Layer


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

adjustProperties

public void adjustProperties()

updateTransform

public static void updateTransform(Displayable displ)
Update in all displays the Transform for the given Displayable if it's selected.


getScrollStep

public int getScrollStep()
The number of layers to scroll through with the wheel; 1 by default.


setScrollStep

public void setScrollStep(int scroll_step)

importImage

protected Bureaucrat importImage()

importNextImage

protected Bureaucrat importNextImage()

setChannel

public void setChannel(int c,
                       float alpha)
Make the given channel have the given alpha (transparency).


setActiveChannel

public void setActiveChannel(Channel channel)
Set the channel as active and the others as inactive.


getDisplayChannelAlphas

public int getDisplayChannelAlphas()

getChannelAlphas

public int getChannelAlphas()

getChannelAlphasState

public int getChannelAlphasState()

showFront

public static void showFront(Layer layer)
Show the layer in the front Display, or in a new Display if the front Display is showing a layer from a different LayerSet.


showCentered

public static void showCentered(Layer layer,
                                Displayable displ,
                                boolean select,
                                boolean shift_down)
Show the given Displayable centered and selected. If select is false, the selection is cleared.


show

public void show(Layer layer,
                 Displayable displ,
                 boolean select,
                 boolean shift_down)
Set this Display to show the specific layer, centered at the @param displ, and perhaps selected, adding to the selection instead of clearing it if @param shift_down is true.


center

public final void center(double x,
                         double y)
Center the view, if possible, on x,y. It's not possible when zoomed out, in which case it will try to do its best.


center

public final void center(Coordinate<?> c)

centerIfNotWithinSrcRect

public final void centerIfNotWithinSrcRect(Coordinate<?> c)

animateBrowsingTo

public final void animateBrowsingTo(Coordinate<?> c)

centerAt

public static final void centerAt(Coordinate c)

centerAt

public static final void centerAt(Coordinate<Displayable> c,
                                  boolean select,
                                  boolean shift_down)

eventOccurred

public void eventOccurred(int eventID)
Specified by:
eventOccurred in interface ij.IJEventListener

imageClosed

public void imageClosed(ij.ImagePlus imp)

imageOpened

public void imageOpened(ij.ImagePlus imp)

flushAll

public static void flushAll()
Release memory captured by the offscreen images


getFront

public static Display getFront()
Can be null.


getOrCreateFront

public static Display getOrCreateFront(Project project)

setCursorToAll

public static void setCursorToAll(java.awt.Cursor c)

setCursor

protected void setCursor(java.awt.Cursor c)

updateCheckboxes

public static void updateCheckboxes(Displayable displ,
                                    int cb,
                                    boolean state)
Used by the Displayable to update the visibility and locking state checkboxes in other Displays.


updateCheckboxes

public static void updateCheckboxes(java.util.Collection<Displayable> displs,
                                    int cb,
                                    boolean state)
Set the checkbox @param cb state to @param state value, for each Displayable. Assumes all Displayable objects belong to one specific project.


updateCheckboxes

public static void updateCheckboxes(java.util.Collection<Displayable> displs,
                                    int cb)
Update the checkbox @param cb state to an appropriate value for each Displayable. Assumes all Displayable objects belong to one specific project.


isActiveWindow

protected boolean isActiveWindow()

setReceivesInput

public static void setReceivesInput(Project project,
                                    boolean b)
Toggle user input; pan and zoom are always enabled though.


exportDTD

public static void exportDTD(java.lang.StringBuilder sb_header,
                             java.util.HashSet<java.lang.String> hs,
                             java.lang.String indent)
Export the DTD that defines this object.


exportXML

public static void exportXML(Project project,
                             java.io.Writer writer,
                             java.lang.String indent,
                             java.lang.Object any)
                      throws java.lang.Exception
Export all displays of the given project as XML entries.

Throws:
java.lang.Exception

toolChanged

public static void toolChanged(java.lang.String tool_name)

toolChanged

public static void toolChanged(int tool)

isLiveFilteringEnabled

public boolean isLiveFilteringEnabled()

applyFilters

protected java.awt.Image applyFilters(java.awt.Image img)

applyFilters

protected ij.ImagePlus applyFilters(ij.process.ImageProcessor ip)

applyFilters

protected ij.ImagePlus applyFilters(ij.ImagePlus imp)

getSelection

public Selection getSelection()

isSelected

public final boolean isSelected(Displayable d)

updateSelection

public static void updateSelection()

updateSelection

public static void updateSelection(Display calling)

clearSelection

public static void clearSelection(Layer layer)

clearSelection

public static void clearSelection()

clearSelection

public static void clearSelection(Project p)

willPaint

public static boolean willPaint(Displayable displ)
Check if any display will paint the given Displayable within its srcRect.


hideDeselected

public void hideDeselected(boolean not_images)

flush

public static void flush(Displayable displ)
Cleanup internal lists that may contain the given Displayable.


resizeCanvas

public void resizeCanvas(java.awt.Rectangle bounds)

resizeCanvas

public void resizeCanvas()

duplicateLinkAndSendTo

protected void duplicateLinkAndSendTo(Displayable active,
                                      int position,
                                      Layer other_layer)

setTranspOverlayImages

protected void setTranspOverlayImages(boolean b)

setTranspOverlayAreas

protected void setTranspOverlayAreas(boolean b)

setTranspOverlayTextLabels

protected void setTranspOverlayTextLabels(boolean b)

updateMultiPaint

protected void updateMultiPaint()

getClassesToMultiPaint

protected java.util.Set<java.lang.Class<?>> getClassesToMultiPaint()
Only Patch, Stack; AreaList, Profile; and DLabel are considered. The rest paints in other layers with color cues.


getLayerCompositeMode

protected byte getLayerCompositeMode(Layer layer)

setLayerCompositeMode

protected void setLayerCompositeMode(Layer layer,
                                     byte compositeMode)

resetLayerComposites

protected void resetLayerComposites()

resetLayerColors

protected void resetLayerColors()
Remove all red/blue coloring of layers, and repaint canvas.


resetLayerAlphas

protected void resetLayerAlphas()
Set all layer alphas to zero, and repaint canvas.


storeLayerAlpha

protected void storeLayerAlpha(LayerPanel lp,
                               float a)
Add to layer_alpha table, or remove if alpha is zero.


getPaintMode

protected int getPaintMode(java.util.HashMap<java.awt.Color,Layer> hm,
                           java.util.ArrayList<LayerPanel> list)
Sets the values atomically, returns the painting mode.


setColorChannel

protected void setColorChannel(Layer layer,
                               java.awt.Color color)
Set a layer to be painted as a specific color channel in the canvas. Only Color.red and Color.blue are accepted. Color.green is reserved for the current layer.


updateComponentTreeUI

public static final void updateComponentTreeUI()

snap

public static final Bureaucrat snap(Patch patch)
Snap a Patch to the most overlapping Patch, if any. This method is a shallow wrap around AlignTask.snap, setting proper undo steps.


setMode

public void setMode(Mode mode)

getMode

public Mode getMode()

removeAlphaMasks

public static Bureaucrat removeAlphaMasks(java.util.Collection<Patch> patches)

getRoi

public ij.gui.Roi getRoi()
Get the current ROI, if any.