http://www.jpicedt.org

jpicedt.graphic.model
Class PicGroup

java.lang.Object
  extended byjpicedt.graphic.model.AbstractElement
      extended byjpicedt.graphic.model.BranchElement
          extended byjpicedt.graphic.model.PicGroup
All Implemented Interfaces:
ActionFactory, Collection, CustomizerFactory, Element, PicObjectConstants
Direct Known Subclasses:
DefaultSelectionHandler

public class PicGroup
extends BranchElement
implements CustomizerFactory, ActionFactory

A concrete implementation of BranchElement that is suited for building groups of elements. It allows easy global resize/translate transformation by providing 8 control points that can be used by mouse operation.

Since:
PicEdt 1.0
Author:
Sylvain Reynal

Nested Class Summary
 class PicGroup.GroupPointIterator
          An iterator over PicPoint's that can serve as anchors for grid alignment.
 
Field Summary
static int FIRST_PT
           
static int LAST_PT
           
static int LL
           
static int LM
           
static int LR
           
static int ML
           
static int MR
           
static int UL
           
static int UM
           
static int UR
           
 
Fields inherited from class jpicedt.graphic.model.BranchElement
changeLock, children, ptsX, ptsY
 
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, parent, view
 
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
 
Constructor Summary
PicGroup()
          construct a PicGroup with no parent and a default PicAttributeSet
PicGroup(BranchElement src)
          Cloning constructor.
PicGroup(Collection c)
          Simply call superclass's constructor.
PicGroup(PicAttributeSet attributeSet)
          construct a PicGroup with no parent and the given PicAttributeSet
 
Method Summary
 PointIndexIterator anchorPointsIterator()
          Create an Iterator over points that can serve as anchor points for grid alignment.
 Object clone()
          Return a deep copy of this PicGroup
 PEAction[] createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)
          Creates an array of Action's related to this object
 AbstractCustomizer createCustomizer()
          Returns a customizer (Swing) component
 int getFirstPointIndex()
          Return the index of the first user-controlled point that can be retrieved by getPoint()
 int getLastPointIndex()
          Return the index of the last user-controlled point that can be retrieved by getPoint()
 String getName()
          Return a non-localised string representing this element's name.
 double getPointX(int numPoint)
          Same as getPoint(), yet return the x-coordinate only.
 double getPointY(int numPoint)
          This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.
 void setPoint(int numPoint, PicPoint ptNew, EditPointConstraint constraint)
          Set the point numbered by "numPoint" to the "pt" value, and scales inward object accordingly
 String toString()
          Returns a String representing the group for debugging use only.
 
Methods inherited from class jpicedt.graphic.model.BranchElement
add, addAll, addChild, addChild, bringBackward, bringForward, bringToBack, bringToFront, children, clear, contains, contains, containsAll, containsClass, createFilteredCollection, equals, forwardChangedUpdate, getAllowsChildren, getBoundingBox, getChildAt, getChildCount, getChildIndex, getPoint, isEmpty, isToBack, isToFront, iterator, remove, removeAll, removeAllChildren, removeChild, removeView, replaceChild, retainAll, rotate, scale, scale, setAttribute, setAttributeSet, setPoint, setViewFromFactory, shear, size, toArray, toArray, translate, updateBoundingBox
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
fireChangedUpdate, getAttribute, getAttributeSet, getDrawing, getParent, getView, setParent
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Field Detail

FIRST_PT

public static final int FIRST_PT
See Also:
Constant Field Values

UL

public static final int UL
See Also:
Constant Field Values

UM

public static final int UM
See Also:
Constant Field Values

UR

public static final int UR
See Also:
Constant Field Values

ML

public static final int ML
See Also:
Constant Field Values

MR

public static final int MR
See Also:
Constant Field Values

LL

public static final int LL
See Also:
Constant Field Values

LM

public static final int LM
See Also:
Constant Field Values

LR

public static final int LR
See Also:
Constant Field Values

LAST_PT

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

PicGroup

public PicGroup()
construct a PicGroup with no parent and a default PicAttributeSet


PicGroup

public PicGroup(PicAttributeSet attributeSet)
construct a PicGroup with no parent and the given PicAttributeSet


PicGroup

public PicGroup(BranchElement src)
Cloning constructor. Simply call superclass's constructor.


PicGroup

public PicGroup(Collection c)
Simply call superclass's constructor.

Method Detail

clone

public Object clone()
Return a deep copy of this PicGroup

Specified by:
clone in interface Element
Specified by:
clone in class BranchElement
Returns:
a clone of this element
Since:
PicEdt 1.0

getName

public String getName()
Description copied from interface: Element
Return a non-localised string representing this element's name. This may be used by a UI to display some information related to this element, or by a localizer to fetch a i18n'd string.

Specified by:
getName in interface Element
Returns:
a localised string that represents this object's name

getFirstPointIndex

public int getFirstPointIndex()
Description copied from interface: Element
Return the index of the first user-controlled point that can be retrieved by getPoint()

Specified by:
getFirstPointIndex in interface Element
Overrides:
getFirstPointIndex in class BranchElement
Returns:
the index of the first point that can be retrieved by getPoint This default implementation returns 0.

getLastPointIndex

public int getLastPointIndex()
Description copied from interface: Element
Return the index of the last user-controlled point that can be retrieved by getPoint()

Specified by:
getLastPointIndex in interface Element
Overrides:
getLastPointIndex in class BranchElement
Returns:
the index of the last point that can be retrieved by getPoint This default implementation returns the greater index allowed in ptsX (or ptsY).

getPointX

public double getPointX(int numPoint)
Description copied from interface: Element
Same as getPoint(), yet return the x-coordinate only.

Specified by:
getPointX in interface Element
Overrides:
getPointX in class BranchElement
Parameters:
numPoint - the point index, should be greater or equal to the value returned by getFirstPointIndex, and lower or equal to getLastPointIndex.
Returns:
the X-coord of the point indexed by numPoint.
Since:
PicEdt 1.0

getPointY

public double getPointY(int numPoint)
Description copied from class: BranchElement
This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.

Specified by:
getPointY in interface Element
Overrides:
getPointY in class BranchElement
Parameters:
numPoint - the point index, should be greater or equal to the value returned by getFirstPointIndex, and lower or equal to getLastPointIndex.
Returns:
the Y-coord of the point indexed by numPoint.
Since:
PicEdt 1.0

setPoint

public void setPoint(int numPoint,
                     PicPoint ptNew,
                     EditPointConstraint constraint)
Set the point numbered by "numPoint" to the "pt" value, and scales inward object accordingly

Specified by:
setPoint in interface Element
Overrides:
setPoint in class BranchElement
Parameters:
constraint - not used here, may be safely set to null
Since:
PicEdt 1.0

anchorPointsIterator

public PointIndexIterator anchorPointsIterator()
Description copied from class: AbstractElement
Create an Iterator over points that can serve as anchor points for grid alignment. This implementation returns a DefaultPointIndexIterator which simply iterates through all user-controlled points in ascending order.

Specified by:
anchorPointsIterator in interface Element
Overrides:
anchorPointsIterator in class AbstractElement
Returns:
an Iterator over points that can serve as anchor points for grid alignment. This implementation returns a default PointIterator which simply iterates through control points.

toString

public String toString()
Returns a String representing the group for debugging use only.

Overrides:
toString in class BranchElement

createActions

public PEAction[] createActions(ActionDispatcher actionDispatcher,
                                ActionLocalizer localizer,
                                HitInfo hi)
Creates an array of Action's related to this object

Specified by:
createActions in interface ActionFactory
Parameters:
actionDispatcher - dispatcher used to create a PEAction
localizer - used to localizer action parameters
hi - a HitInfo containing information related to the mouse-event which triggered the popup menu.

createCustomizer

public AbstractCustomizer createCustomizer()
Description copied from interface: CustomizerFactory
Returns a customizer (Swing) component

Specified by:
createCustomizer in interface CustomizerFactory
Returns:
a Customizer for geometry editing

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org