ini.trakem2.display
Class DLabel

java.lang.Object
  extended by ini.trakem2.persistence.DBObject
      extended by ini.trakem2.display.Displayable
          extended by ini.trakem2.display.DLabel
All Implemented Interfaces:
Paintable, VectorData

public class DLabel
extends Displayable
implements VectorData

This class is named funny to avoid confusion with java.awt.Label. The 'D' stands for Displayable Label. Types: - text - arrow - dot All of them can contain text, editable through double-click.


Nested Class Summary
 
Nested classes/interfaces inherited from class ini.trakem2.display.Displayable
Displayable.DataPackage, Displayable.DoEdit, Displayable.DoEdits, Displayable.DoTransforms, Displayable.SliderListener
 
Field Summary
static int ARROW
           
static int DOT
           
static int TEXT
           
 
Fields inherited from class ini.trakem2.display.Displayable
alpha, annotation, at, color, COMPOSITE_ADD, COMPOSITE_COLOR_YCBCR, COMPOSITE_DIFFERENCE, COMPOSITE_MULTIPLY, COMPOSITE_NORMAL, COMPOSITE_SUBTRACT, compositeModes, height, hs_linked, last_color, layer, linked_props, linked_props_origins, locked, props, TAG_ATTR1, TAG_ATTR2, title, visible, width
 
Fields inherited from class ini.trakem2.persistence.DBObject
id, project
 
Constructor Summary
DLabel(Project project, long id, java.util.HashMap<java.lang.String,java.lang.String> ht, java.util.HashMap<Displayable,java.lang.String> ht_links)
          To reconstruct from an XML entry.
DLabel(Project project, long id, java.lang.String text, float width, float height, int type, java.lang.String font_name, int font_style, int font_size, boolean locked, java.awt.geom.AffineTransform at)
          For reconstruction purposes.
DLabel(Project project, java.lang.String text, double x, double y)
           
 
Method Summary
 void adjustProperties()
          Shows a dialog to adjust properties of this object.
 boolean apply(Layer la, java.awt.geom.Area roi, mpicbg.models.CoordinateTransform ict)
          Applies the 2D transform @ict (which is expected to operate on the world coordinates version of the data contained here) only to the data that falls within the @param roi (in world coords), and then recomputes the bounding box and affine transform (to a translation or identity).
 boolean apply(VectorDataTransform vdt)
           
 Displayable clone(Project pr, boolean copy_id)
          Performs a deep copy of this object, except for the Layer pointer.
 void edit()
           
static void exportDTD(java.lang.StringBuilder sb_header, java.util.HashSet<java.lang.String> hs, java.lang.String indent)
           
 void exportXML(java.lang.StringBuilder sb_body, java.lang.String indent, java.lang.Object any)
          The oid is this objects' id, whereas the 'id' tag will be the id of the wrapper Thing object.
 void flush()
           
 java.awt.Rectangle getBoundingBox(java.awt.Rectangle r)
          Saves one allocation, returns the same Rectangle, modified (or a new one if null).
 java.awt.Font getFont()
           
 java.awt.Polygon getPerimeter()
          Subclasses can override this method to provide the exact contour, otherwise it returns the transformed bounding box of the data.
 java.awt.Polygon getPerimeter(int w, int n, int e, int s)
          Returns the perimeter enlarged in all West, North, East and South directions, in pixels.
 java.lang.String getShortTitle()
          Sublcasses can override this method to provide a proper String, otherwise calls getTitle()
 int getType()
           
 boolean isDeletable()
           
 void keyPressed(java.awt.event.KeyEvent ke)
           
 void mouseDragged(java.awt.event.MouseEvent me, Layer layer, int x_p, int y_p, int x_d, int y_d, int x_d_old, int y_d_old)
           
 void mousePressed(java.awt.event.MouseEvent me, Layer layer, int x_p, int y_p, double mag)
           
 void mouseReleased(java.awt.event.MouseEvent me, Layer layer, int x_p, int y_p, int x_d, int y_d, int x_r, int y_r)
           
 void paint(java.awt.Graphics2D g, java.awt.Rectangle srcRect, double magnification, boolean active, int channels, Layer active_layer, java.util.List<Layer> layers)
           
 void setText(java.lang.String title, boolean update)
           
 void setTitle(java.lang.String title)
          Does not accept null or zero-length titles.
 void setType(int type)
           
 java.lang.String toString()
          Minimal info that identifies this object as unique, for display on a JTree node.
 
Methods inherited from class ini.trakem2.display.Displayable
areThereLayerCrossLinks, canSendTo, clone, clone, commonDTDChildren, contains, contains, deselect, destroy, displacePoints, exportDTD, exportSVG, findById, findNearestPoint, findNearestPoint, getAffineTransform, getAffineTransformCopy, getAlpha, getAnnotation, getArea, getAreaAt, getAreaForBucket, getBoundingBox, getBoundingBox, getBounds, getBounds, getBucketable, getColor, getComposite, getComposite, getCompositeMode, getHeight, getIntersection, getLayer, getLayerIds, getLayerSet, getLayersWithData, getLinked, getLinked, getLinkedBox, getLinkedGroup, getLinkedProperties, getLinkedProperties, getLinkedProperty, getLinkedProperty, getMinimalBoundingBox, getNameId, getProperties, getProperty, getProperty, getTitle, getWidth, getX, getXMLSafeValue, getXMLSafeValue, getY, hasLinkedGroupWithinLayer, hasProperties, intersects, intersects, intersects, intersects, inverseTransformPoint, isLinked, isLinked, isLinked, isLocked, isLocked2, isOnlyLinkedTo, isOnlyLinkedTo, isOutOfRepaintingClip, isOutOfRepaintingClip, isRoughlyInside, isVisible, link, link, linkPatches, makeAdjustPropertiesDialog, measure, mouseWheelMoved, paintAsBox, paintOffscreen, paintSnapshot, prePaint, preTransform, processAdjustPropertiesDialog, remove, remove2, removeLinkedProperties, removeLinkedPropertiesFromOrigins, repaint, restXML, rotate, rotate, rotatePoints, scale, scale, scalePoints, setAffineTransform, setAlpha, setAlpha, setAnnotation, setColor, setCompositeMode, setDimensions, setDimensions, setLayer, setLayer, setLinkedProperties, setLinkedProperty, setLocation, setLocked, setProperty, setVisible, setVisible, snapTo, softRemove, transform, transformPoint, transformPoint, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformPoints, transformRectangle, translate, translate, unlink, unlink, unlinkAll, updateBucket, updateInDatabase, xmlError, xmlError
 
Methods inherited from class ini.trakem2.persistence.DBObject
addToDatabase, getId, getInfo, getProject, getUniqueIdentifier, removeFromDatabase, updateInDatabase
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT

public static final int TEXT
See Also:
Constant Field Values

ARROW

public static final int ARROW
See Also:
Constant Field Values

DOT

public static final int DOT
See Also:
Constant Field Values
Constructor Detail

DLabel

public DLabel(Project project,
              java.lang.String text,
              double x,
              double y)

DLabel

public DLabel(Project project,
              long id,
              java.lang.String text,
              float width,
              float height,
              int type,
              java.lang.String font_name,
              int font_style,
              int font_size,
              boolean locked,
              java.awt.geom.AffineTransform at)
For reconstruction purposes.


DLabel

public DLabel(Project project,
              long id,
              java.util.HashMap<java.lang.String,java.lang.String> ht,
              java.util.HashMap<Displayable,java.lang.String> ht_links)
To reconstruct from an XML entry.

Method Detail

getType

public int getType()

getFont

public java.awt.Font getFont()

flush

public void flush()

setTitle

public void setTitle(java.lang.String title)
Description copied from class: Displayable
Does not accept null or zero-length titles.

Overrides:
setTitle in class Displayable

setText

public void setText(java.lang.String title,
                    boolean update)

getShortTitle

public java.lang.String getShortTitle()
Description copied from class: DBObject
Sublcasses can override this method to provide a proper String, otherwise calls getTitle()

Overrides:
getShortTitle in class Displayable

toString

public java.lang.String toString()
Description copied from class: Displayable
Minimal info that identifies this object as unique, for display on a JTree node.

Overrides:
toString in class Displayable

setType

public void setType(int type)

paint

public void paint(java.awt.Graphics2D g,
                  java.awt.Rectangle srcRect,
                  double magnification,
                  boolean active,
                  int channels,
                  Layer active_layer,
                  java.util.List<Layer> layers)
Specified by:
paint in interface Paintable
Overrides:
paint in class Displayable

getBoundingBox

public java.awt.Rectangle getBoundingBox(java.awt.Rectangle r)
Saves one allocation, returns the same Rectangle, modified (or a new one if null). This method is overriden so that the x,y, which underlies the text, is translated upward by the height to generate a box that encloses the text and not just sits under it.

Overrides:
getBoundingBox in class Displayable

getPerimeter

public java.awt.Polygon getPerimeter()
Description copied from class: Displayable
Subclasses can override this method to provide the exact contour, otherwise it returns the transformed bounding box of the data.

Overrides:
getPerimeter in class Displayable

getPerimeter

public java.awt.Polygon getPerimeter(int w,
                                     int n,
                                     int e,
                                     int s)
Returns the perimeter enlarged in all West, North, East and South directions, in pixels.

Overrides:
getPerimeter in class Displayable

mousePressed

public void mousePressed(java.awt.event.MouseEvent me,
                         Layer layer,
                         int x_p,
                         int y_p,
                         double mag)
Overrides:
mousePressed in class Displayable

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me,
                         Layer layer,
                         int x_p,
                         int y_p,
                         int x_d,
                         int y_d,
                         int x_d_old,
                         int y_d_old)
Overrides:
mouseDragged in class Displayable

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me,
                          Layer layer,
                          int x_p,
                          int y_p,
                          int x_d,
                          int y_d,
                          int x_r,
                          int y_r)
Overrides:
mouseReleased in class Displayable

isDeletable

public boolean isDeletable()
Specified by:
isDeletable in class Displayable

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Overrides:
keyPressed in class Displayable

edit

public void edit()

exportXML

public void exportXML(java.lang.StringBuilder sb_body,
                      java.lang.String indent,
                      java.lang.Object any)
Description copied from class: Displayable
The oid is this objects' id, whereas the 'id' tag will be the id of the wrapper Thing object.

Overrides:
exportXML in class Displayable

exportDTD

public static void exportDTD(java.lang.StringBuilder sb_header,
                             java.util.HashSet<java.lang.String> hs,
                             java.lang.String indent)

adjustProperties

public void adjustProperties()
Description copied from class: Displayable
Shows a dialog to adjust properties of this object.

Overrides:
adjustProperties in class Displayable

clone

public Displayable clone(Project pr,
                         boolean copy_id)
Performs a deep copy of this object, except for the Layer pointer.

Specified by:
clone in class Displayable

apply

public boolean apply(Layer la,
                     java.awt.geom.Area roi,
                     mpicbg.models.CoordinateTransform ict)
              throws java.lang.Exception
Description copied from interface: VectorData
Applies the 2D transform @ict (which is expected to operate on the world coordinates version of the data contained here) only to the data that falls within the @param roi (in world coords), and then recomputes the bounding box and affine transform (to a translation or identity). Does not consider links.

Specified by:
apply in interface VectorData
Parameters:
la - Only data at this Layer may be transformed.
roi - Only data inside this world-coordinates Area may be transformed.
ict - The transform to apply to the data that is in @param la and within @param roi.
Throws:
java.lang.Exception

apply

public boolean apply(VectorDataTransform vdt)
              throws java.lang.Exception
Specified by:
apply in interface VectorData
Throws:
java.lang.Exception