uk.ac.starlink.diva
Class DrawLabelFigure

java.lang.Object
  extended by diva.canvas.AbstractFigure
      extended by diva.canvas.toolbox.LabelFigure
          extended by uk.ac.starlink.diva.DrawLabelFigure
All Implemented Interfaces:
CanvasComponent, Figure, VisibleComponent, UserObjectContainer, DrawFigure

public class DrawLabelFigure
extends LabelFigure
implements DrawFigure

Implementation of a LabelFigure for use with a Draw implementation.

Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  EventListenerList listeners
           
protected static boolean transformFreely
          Hint that figures should ignore any transformation constraints
 
Constructor Summary
DrawLabelFigure()
           
DrawLabelFigure(String s)
           
DrawLabelFigure(String s, Font f)
           
DrawLabelFigure(String s, Font font, double padding, int anchor)
           
DrawLabelFigure(String s, String face, int style, int size)
           
 
Method Summary
 void addListener(FigureListener l)
          Registers a listener for to be informed when figure changes occur.
protected  void fireChanged()
          Send a FigureChangedEvent object specifying that this figure has changed.
protected  void fireCreated()
          Send a FigureChangedEvent object specifying that this figure has created to all listeners.
protected  void fireRemoved()
          Send a FigureChangedEvent object specifying that this figure has been removed.
 float getLineWidth()
          Get the line width.
 Paint getStrokePaint()
          Get the outline.
static boolean isTransformFreely()
          Find out if this is an occasion when a figure should give up any constraints and transform freely.
 void removeListener(FigureListener l)
          Remove a listener.
 void setLineWidth(float lineWidth)
          All Figures have a line width.
 void setShape(Shape shape)
          Set the Figure shape.
 void setStrokePaint(Paint outline)
          All Figures have an outline colour.
 void setTransformFreely(boolean state)
          Enable the hint that a figure should allow itself to transform freely, rather than obey any constraints (this is meant for figures that could not otherwise redraw themselves to fit a resized Draw, given their normal constraints, e.g.
 void transform(AffineTransform at)
          Transform the label with the given transform.
 void translate(double x, double y)
          Move the figure the indicated distance.
 
Methods inherited from class diva.canvas.toolbox.LabelFigure
autoAnchor, getAnchor, getAnchorPoint, getBounds, getComposite, getFillPaint, getFont, getOrigin, getPadding, getShape, getString, paint, setAnchor, setComposite, setFillPaint, setFont, setPadding, setString, translateTo, translateTo
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.starlink.diva.DrawFigure
getComposite, getFillPaint, setComposite, setFillPaint, setVisible
 
Methods inherited from interface diva.canvas.Figure
contains, getBounds, getInteractor, getLayer, getOrigin, getParent, getShape, getToolTipText, hit, intersects, setInteractor, setParent, setToolTipText
 
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, paint
 
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext, repaint, repaint
 
Methods inherited from interface diva.util.UserObjectContainer
getUserObject, setUserObject
 

Field Detail

transformFreely

protected static boolean transformFreely
Hint that figures should ignore any transformation constraints


listeners

protected EventListenerList listeners
Constructor Detail

DrawLabelFigure

public DrawLabelFigure()

DrawLabelFigure

public DrawLabelFigure(String s)

DrawLabelFigure

public DrawLabelFigure(String s,
                       String face,
                       int style,
                       int size)

DrawLabelFigure

public DrawLabelFigure(String s,
                       Font f)

DrawLabelFigure

public DrawLabelFigure(String s,
                       Font font,
                       double padding,
                       int anchor)
Method Detail

transform

public void transform(AffineTransform at)
Description copied from class: LabelFigure
Transform the label with the given transform. Note that the anchor of the figure will appear to move -- use translateTo() to move it back again if this method being called to (for example) rotate the label.

Specified by:
transform in interface Figure
Overrides:
transform in class LabelFigure

translate

public void translate(double x,
                      double y)
Description copied from class: AbstractFigure
Move the figure the indicated distance. The default implementation uses the transform method, so most subclasses can probably implement this more efficiently.

Specified by:
translate in interface Figure
Overrides:
translate in class AbstractFigure

setShape

public void setShape(Shape shape)
Description copied from interface: DrawFigure
Set the Figure shape.

Specified by:
setShape in interface DrawFigure

setLineWidth

public void setLineWidth(float lineWidth)
Description copied from interface: DrawFigure
All Figures have a line width.

Specified by:
setLineWidth in interface DrawFigure

getLineWidth

public float getLineWidth()
Description copied from interface: DrawFigure
Get the line width.

Specified by:
getLineWidth in interface DrawFigure

setStrokePaint

public void setStrokePaint(Paint outline)
Description copied from interface: DrawFigure
All Figures have an outline colour.

Specified by:
setStrokePaint in interface DrawFigure

getStrokePaint

public Paint getStrokePaint()
Description copied from interface: DrawFigure
Get the outline.

Specified by:
getStrokePaint in interface DrawFigure

setTransformFreely

public void setTransformFreely(boolean state)
Description copied from interface: DrawFigure
Enable the hint that a figure should allow itself to transform freely, rather than obey any constraints (this is meant for figures that could not otherwise redraw themselves to fit a resized Draw, given their normal constraints, e.g. XRangeFigure).

Specified by:
setTransformFreely in interface DrawFigure

isTransformFreely

public static boolean isTransformFreely()
Find out if this is an occasion when a figure should give up any constraints and transform freely.


addListener

public void addListener(FigureListener l)
Registers a listener for to be informed when figure changes occur.

Specified by:
addListener in interface DrawFigure
Parameters:
l - the FigureListener

removeListener

public void removeListener(FigureListener l)
Remove a listener.

Specified by:
removeListener in interface DrawFigure
Parameters:
l - the FigureListener

fireCreated

protected void fireCreated()
Send a FigureChangedEvent object specifying that this figure has created to all listeners.


fireRemoved

protected void fireRemoved()
Send a FigureChangedEvent object specifying that this figure has been removed.


fireChanged

protected void fireChanged()
Send a FigureChangedEvent object specifying that this figure has changed.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.