http://www.jpicedt.org

jpicedt.graphic.model
Class BranchElement

java.lang.Object
  extended by jpicedt.graphic.model.AbstractElement
      extended by jpicedt.graphic.model.BranchElement
All Implemented Interfaces:
Iterable<Element>, Collection<Element>, List<Element>, Element, ActionFactory
Direct Known Subclasses:
Drawing.RootElement, PicGroup

public class BranchElement
extends AbstractElement
implements List<Element>

A class for Element's that allow children, eg, primarily:

In both cases the geometry specification mostly delegates to the children, except for the bounding-box, which is backed by an array of coordinates.

The implementation of the Collection interface is done through calls to addChild, removeChild, children, removeAllChildren, except for the addAll method which is implemented from scratch so as to fire a changed-event only once all elements have been added.
As a result, subclasses only need to override these methods to change the behaviour of content-modifying methods.

This element has only one control point, namely, the bottom-left corner of the bounding box. Moving this point result in a global translation of the element (however no rescale capability is available here using the setCtrlPt() method, use the PicGroup class instead).

Since:
jPicEdt 1.1; custom path behaviour added as of jpicedt 1.5
Author:
Sylvain Reynal

Nested Class Summary
static class BranchElement.CompoundMode
          This BranchElement can be displayed, either as a group of objects (=children, "SEPARATE" mode), or as a single path constructed by piecing children's paths together ("JOINT" mode).
 
Field Summary
protected  boolean changeLock
          A semaphor that signals a change of state is underway in this BranchElement and it shouldn't process events coming from its children before the change is completed (hence this is used inside forwardChangedUpdate()); set it to true each time you start modifying children in batch mode and you don't want events to be forwarded to the root of the hierarchy before everything is completed (e.g. to get rid of side-effects, or to reduce the burden for the repaint manager).
protected  ArrayList<Element> children
          the array that contains children
protected  BranchElement.CompoundMode compoundMode
          current CompoundMode
static int DEFAULT_LIFTPEN
          [underway] liftpen not used yet.
protected  boolean isPathClosed
          whether the path is closed or not (in "JOINT" mode)
protected  int liftPen
          see PSTricks' doc, page 36; may take only integer values b/w 0 and 2; default to 0 ; [underway] liftpen not use yet.
protected  double[] ptsX
          An array of X-coordinates representing the two opposite corner of the bounding box that contains all children
protected  double[] ptsY
          an array of Y-coordinates representing the two opposite corner of the bounding box that contains all children
protected  GeneralPath shape
          a path constructed by appending every child's path, aka pscustom; may be null if N/A
 
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, name, parent, view
 
Constructor Summary
BranchElement()
          Construct a BranchElement with no parent and a default PicAttributeSet.
BranchElement(BranchElement src)
          Cloning constructor (though with no parent and no view): attribute set is deeply copied.
BranchElement(Collection<? extends Element> c)
          Create a new BranchElement from the content of the given Collection of Element's.
BranchElement(PicAttributeSet attributeSet)
          Construct a BranchElement with no parent and the given PicAttributeSet
 
Method Summary
 boolean add(Element child)
          Add the given child to this BranchElement, setting its parent to this.
 void add(int position, Element child)
          Insert the given child in this BranchElement at the given position, setting its parent to this, and create a view for the child using the ViewFactory that produced the View for this BranchElement.
 boolean addAll(Collection<? extends Element> c)
          Appends all the elements in the given collection that are instance of Element as children of this BranchElement.
 boolean addAll(int index, Collection<? extends Element> c)
          Inserts all the elements in the given collection that are instance of Element as children of this BranchElement, at the given position.
 void bringBackward(Element obj)
          Move the given child one position backward, i.e. removes it from its current position and insert it one position backward.
 void bringForward(Element obj)
          Move the given child one position forward, i.e. removes it from its current position and insert it one position forward.
 void bringToBack(Element obj)
          Move the given child to back (i.e. following z-ordering policy), i.e. removes it from its current position and insert it at position 0
Does nothing if the given child can't be found in this Drawing or is already to back.
 void bringToFront(Element obj)
          Move the given child to front, i.e. removes it from its current position and appends to the drawing.
 void clear()
          Remove all children from this BranchElement, set each child's parent to null.
 BranchElement clone()
          Returns a clone of this Element
 void closePath()
          Closes the path generated by the children of this BranchElement.
 boolean contains(Object o)
          Returns true if the given Element (or one of its ancestor) is contained in this BranchElement.
 boolean containsAll(Collection<?> c)
          Returns true if this BranchElement contains all of the elements in the specified collection, possibly through indirect lineage.
 boolean containsClass(Class<? extends Element> clazz)
          Returns whether this BranchElement contains children, grandchildren, etc. that are of the same type of inherit from the given clazz.
<T extends Element>
ArrayList<T>
createFilteredCollection(Class<T> clazz)
          Returns a list containing children, grand-children, etc. of this BranchElement that are of the same type or inherit the given clazz.
 Shape createShape()
          Creates a GeneralPath generated by the shapes of the children of this BranchElement (aka PSTricks' pscustom object).
 boolean equals(Object o)
           
 void forwardChangedUpdate(Element child, DrawingEvent.EventType eventType)
          Called by a child of this BranchElement to inform its parent of some change that occured to it or one of its children.
 Element get(int childIndex)
           
 Rectangle2D getBoundingBox(Rectangle2D r)
          Returns the bounding box (i.e. the surrounding rectangle) in double precision Used e.g. to determine the arguments of the \begin{picture} command.
 BranchElement.CompoundMode getCompoundMode()
          Returns whether this group should be painted as single path or not.
 PicPoint getCtrlPt(int numPoint, PicPoint dest)
          Return the user-controlled point having the given index.
 CtrlPtSubset getCtrlPtSubset(ConvexZoneGroup csg, BitSet czExtension)
          Renvoie un la partie des points de contrôle qui satisfont à l'un des deux critères suivants: ceux compris dans l'ensemble de zones convexes csg, et ceux en relation avec les points de contrôle satisfaisant au première critère selon une relation définies par czExtension
 double getCtrlPtX(int numPoint)
           
 double getCtrlPtY(int numPoint)
          This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.
 String getDefaultName()
           
 int getFirstPointIndex()
          Return the index of the first user-controlled point that can be retrieved by getCtrlPt()
 int getLastPointIndex()
          Return the index of the last user-controlled point that can be retrieved by getCtrlPt()
 int getLiftPen()
          Returns the value of the liftPen parameter.
 int hashCode()
           
 int indexOf(Object child)
          Returns the index of the given child amongst the offspring of this BranchElement.
 boolean isEmpty()
           
 boolean isPathClosed()
          Returns whether the path generated by the children of this BranchElement is closed or not.
 boolean isToBack(Element obj)
           
 boolean isToFront(Element obj)
           
 Iterator<Element> iterator()
          Returns an iterator over children.
 int lastIndexOf(Object o)
          Returns the index of the given child amongst the offspring of this BranchElement.
 ListIterator<Element> listIterator()
           
 ListIterator<Element> listIterator(int index)
           
 void mirror(PicPoint ptOrg, PicVector normalVector)
          Effectue une reflection sur le PicGroup.
 void openPath()
          Closes the path generated by the children of this BranchElement.
 Element remove(int index)
          Remove the child with the given index from this BranchElement.
 boolean remove(Object child)
          Remove the given child from this BranchElement, setting its parent to null so that the given child become (possibly) eligible for garbage collection if there are no other reference to it.
 boolean removeAll(Collection<?> c)
          Removes all this collection's elements that are also contained in the specified collection.
 void removeView()
          Remove the view that render this element and propagate to children ; this may be used to remove any reference to the view, and render it eligible for garbage collection ; if no View, does nothing.
 void replace(Element src, Element dest)
          Replace the given "src" element with the given "dest" element, if "src" belongs to this BranchElement.
 boolean retainAll(Collection<?> c)
          Retains only the elements in this BranchElement that are contained in the specified collection.
 void rotate(PicPoint ptOrg, double angle)
          Rotate this Element by the given angle along the given point
 void scale(double ptOrgX, double ptOrgY, double sx, double sy, UserConfirmationCache ucc)
          Scale children by (sx,sy) using (ptOrgX,ptOrgY) as origin; sx or sy can be negative.
 Element set(int position, Element newChild)
          Replace the child at the given position by the given child.
<T> void
setAttribute(PicAttributeName<T> name, T value)
          Set an Attribute for this BranchElement and propagate to children.
 void setAttributeSet(PicAttributeSet set)
          Set AttributeSet for this BranchElement and propagate to children.
 void setCompoundMode(BranchElement.CompoundMode m)
          If s is true, the associated view will attempt to paint this BranchElement as a single path made up by piecing childrens' shapes (aka PSTricks' pscustom).
 void setCtrlPt(int index, PicPoint pt)
          Deprecated. use setCtrlPt(int, PicPoint, EditPointConstraint) instead.
 void setCtrlPt(int numPoint, PicPoint pt, EditPointConstraint c)
          Set the point indexed by "numPoint" to the given value using the given constraint.
 void setLiftPen(int i)
          Sets the value of the liftPen parameter.
 void setViewFromFactory(ViewFactory f)
          Set the view for this Element from the given view factory, then set the view for children.
 void shear(PicPoint ptOrg, double shx, double shy)
          Cisaille cet élément par (shx,shy) en utilisant ptOrg comme origine.
 void shear(PicPoint ptOrg, double shx, double shy, UserConfirmationCache ucc)
          Shear this Element by the given params wrt to the given origin.
 int size()
          Return the number of children in this BranchElement (direct offspring only).
 List<Element> subList(int fromIndex, int toIndex)
           
 void syncArrowGeometry(ArrowView v, ArrowView.Direction d)
          Helper for the associated View.
 Object[] toArray()
          Returns an array containing all of the elements in this collection.
<T> T[]
toArray(T[] a)
          Returns an array containing all of the elements in this collection whose runtime type is that of the specified array.
 void toggleCompoundMode()
          Toggles whether this group should be painted as a single path or not.
 void togglePathClosure()
          Toggles the closure of the path generated by the children of this BranchElement.
 String toString()
          Returns a String representing the group for debugging use only.
 void translate(double dx, double dy)
          Translate children by the given vector.
protected  void updateBoundingBox()
          Update the bounding box by "unioning" the children's bounding box (actually computes the two specification points defining the diagonal of the box).
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
anchorPointsIterator, createActions, fireChangedUpdate, getAttribute, getAttributeSet, getDrawing, getName, getParent, getView, pullOutOfGroup, replaceBy, scale, scale, scale, setName, setParent
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

children

protected ArrayList<Element> children
the array that contains children


changeLock

protected boolean changeLock
A semaphor that signals a change of state is underway in this BranchElement and it shouldn't process events coming from its children before the change is completed (hence this is used inside forwardChangedUpdate()); set it to true each time you start modifying children in batch mode and you don't want events to be forwarded to the root of the hierarchy before everything is completed (e.g. to get rid of side-effects, or to reduce the burden for the repaint manager).

Example of use: whenever we call translate() on this BranchElement,


ptsX

protected double[] ptsX
An array of X-coordinates representing the two opposite corner of the bounding box that contains all children


ptsY

protected double[] ptsY
an array of Y-coordinates representing the two opposite corner of the bounding box that contains all children


shape

protected GeneralPath shape
a path constructed by appending every child's path, aka pscustom; may be null if N/A


compoundMode

protected BranchElement.CompoundMode compoundMode
current CompoundMode


isPathClosed

protected boolean isPathClosed
whether the path is closed or not (in "JOINT" mode)


liftPen

protected int liftPen
see PSTricks' doc, page 36; may take only integer values b/w 0 and 2; default to 0 ; [underway] liftpen not use yet.


DEFAULT_LIFTPEN

public static final int DEFAULT_LIFTPEN
[underway] liftpen not used yet.

See Also:
Constant Field Values
Constructor Detail

BranchElement

public BranchElement()
Construct a BranchElement with no parent and a default PicAttributeSet.


BranchElement

public BranchElement(PicAttributeSet attributeSet)
Construct a BranchElement with no parent and the given PicAttributeSet


BranchElement

public BranchElement(BranchElement src)
Cloning constructor (though with no parent and no view):
  1. attribute set is deeply copied.
  2. source's children are cloned, then the copy is added to this BranchElement.


BranchElement

public BranchElement(Collection<? extends Element> c)
Create a new BranchElement from the content of the given Collection of Element's. Children are cloned as well (i.e. this isa deep copy).

Method Detail

clone

public BranchElement clone()
Description copied from class: AbstractElement
Returns a clone of this Element

Specified by:
clone in interface Element
Specified by:
clone in class AbstractElement
Returns:
A clone of this element.

getDefaultName

public String getDefaultName()
Specified by:
getDefaultName in class AbstractElement

get

public Element get(int childIndex)
Specified by:
get in interface List<Element>
Returns:
The child at the given index, or null if no children.

add

public boolean add(Element child)
Add the given child to this BranchElement, setting its parent to this. Since a child can't have two parents, this also remove the child from its former parent, if any.
If view is non-null, use the associated ViewFactory to create View's for the new child.

Specified by:
add in interface Collection<Element>
Specified by:
add in interface List<Element>

add

public void add(int position,
                Element child)
Insert the given child in this BranchElement at the given position, setting its parent to this, and create a view for the child using the ViewFactory that produced the View for this BranchElement.

Specified by:
add in interface List<Element>

set

public Element set(int position,
                   Element newChild)
Replace the child at the given position by the given child. If the given child belonged to this BranchElement, this has no effect.

Specified by:
set in interface List<Element>
Parameters:
newChild - if null, this calls remove(position)

replace

public void replace(Element src,
                    Element dest)
Replace the given "src" element with the given "dest" element, if "src" belongs to this BranchElement. No effect if "dest" already belongs to this BranchElement.


remove

public boolean remove(Object child)
Remove the given child from this BranchElement, setting its parent to null so that the given child become (possibly) eligible for garbage collection if there are no other reference to it.

Specified by:
remove in interface Collection<Element>
Specified by:
remove in interface List<Element>
Parameters:
child - any children of this BranchElement, possibly through undirect lineage.

remove

public Element remove(int index)
Remove the child with the given index from this BranchElement.

Specified by:
remove in interface List<Element>

removeAll

public boolean removeAll(Collection<?> c)
Removes all this collection's elements that are also contained in the specified collection. After this call returns, this collection will contain no elements in common with the specified collection.

Specified by:
removeAll in interface Collection<Element>
Specified by:
removeAll in interface List<Element>
Parameters:
c - elements to be removed from this collection.
Returns:
true if this collection changed as a result of the call

clear

public void clear()
Remove all children from this BranchElement, set each child's parent to null.

Specified by:
clear in interface Collection<Element>
Specified by:
clear in interface List<Element>

getFirstPointIndex

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

Specified by:
getFirstPointIndex in interface Element
Returns:
the index of the first point that can be retrieved by getCtrlPt. This returns PT_ANCHOR.

getLastPointIndex

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

Specified by:
getLastPointIndex in interface Element
Returns:
the index of the last point that can be retrieved by getCtrlPt This returns PT_ANCHOR.

getCtrlPtX

public double getCtrlPtX(int numPoint)
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

getCtrlPtY

public double getCtrlPtY(int numPoint)
This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.

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

getCtrlPt

public PicPoint getCtrlPt(int numPoint,
                          PicPoint dest)
Return the user-controlled point having the given index. The general contract in Element is to return an IMMUTABLE instance of PicPoint, so that the only way to alter the geometry of this element is by calling the setCtrlPt method, hence this implementation simply calls getCtrlPtX() and getCtrlPtY().

Specified by:
getCtrlPt in interface Element
Parameters:
numPoint - the point index, should be greater or equal to the value returned by getFirstPointIndex, and lower or equal to getLastPointIndex.
Returns:
the point indexed by numPoint ; if src is null, allocates a new PicPoint and return it, otherwise directly modifies src and returns it as well for convenience.
Since:
PicEdt 1.0

setCtrlPt

public void setCtrlPt(int index,
                      PicPoint pt)
Deprecated. use setCtrlPt(int, PicPoint, EditPointConstraint) instead.

Set the user-controlled point with the given index to the given value. This default implementation simply call setCtrlPt with a null constraint, then fires a change-update of type GEOMETRY_CHANGE.

Specified by:
setCtrlPt in interface Element
Overrides:
setCtrlPt in class AbstractElement

setCtrlPt

public void setCtrlPt(int numPoint,
                      PicPoint pt,
                      EditPointConstraint c)
Set the point indexed by "numPoint" to the given value using the given constraint.

Specified by:
setCtrlPt in interface Element
c - a geometry constraint, or null if no particular constraint is being imposed (aka default).

translate

public void translate(double dx,
                      double dy)
Translate children by the given vector.

Specified by:
translate in interface Element
Parameters:
dx - The X coordinate of translation vector
dy - The Y coordinate of translation vector
Since:
jPicEdt

getCtrlPtSubset

public CtrlPtSubset getCtrlPtSubset(ConvexZoneGroup csg,
                                    BitSet czExtension)
Description copied from interface: Element
Renvoie un la partie des points de contrôle qui satisfont à l'un des deux critères suivants:
  1. ceux compris dans l'ensemble de zones convexes csg, et
  2. ceux en relation avec les points de contrôle satisfaisant au première critère selon une relation définies par czExtension

Specified by:
getCtrlPtSubset in interface Element
Overrides:
getCtrlPtSubset in class AbstractElement
Parameters:
csg - un ensemble de zones convexes
czExtension - un BitSet permettant d'étendre l'ensemble des points de contrôle compris dans l'ensemble de zones convexes csg. La signification des bit est selon l'énuméré CtrlPtSubset.CZExtension.
Returns:
null
See Also:
jpicedt.graphic.model

scale

public void scale(double ptOrgX,
                  double ptOrgY,
                  double sx,
                  double sy,
                  UserConfirmationCache ucc)
Scale children by (sx,sy) using (ptOrgX,ptOrgY) as origin; sx or sy can be negative.

Specified by:
scale in interface Element
ucc - une valeur UserConfirmationCache permettant de demander à l'utilisateur confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.

mirror

public void mirror(PicPoint ptOrg,
                   PicVector normalVector)
Effectue une reflection sur le PicGroup.

Specified by:
mirror in interface Element
Parameters:
ptOrg - le PicPoint par lequel passe l'axe de la réflexion.
normalVector - le PicVector normal à l'axe de la réflexion.

rotate

public void rotate(PicPoint ptOrg,
                   double angle)
Rotate this Element by the given angle along the given point

Specified by:
rotate in interface Element
Parameters:
angle - rotation angle in radians

shear

public void shear(PicPoint ptOrg,
                  double shx,
                  double shy)
Description copied from class: AbstractElement
Cisaille cet élément par (shx,shy) en utilisant ptOrg comme origine. Ceci est une commodité d'appel de shear(ptOrg, shx, shy,UserConfirmationCache.DEFAULT).

Specified by:
shear in interface Element
Overrides:
shear in class AbstractElement

shear

public void shear(PicPoint ptOrg,
                  double shx,
                  double shy,
                  UserConfirmationCache ucc)
Shear this Element by the given params wrt to the given origin.

Specified by:
shear in interface Element
ucc - une valeur UserConfirmationCache permettant de demander à l'utilisateur confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.

setCompoundMode

public void setCompoundMode(BranchElement.CompoundMode m)
If s is true, the associated view will attempt to paint this BranchElement as a single path made up by piecing childrens' shapes (aka PSTricks' pscustom). The associated formatter is expected to do likewise if its hosting content-type supports it. If s is false, this is the legacy behaviour, that is, every child is painted independently.


getCompoundMode

public BranchElement.CompoundMode getCompoundMode()
Returns whether this group should be painted as single path or not.


toggleCompoundMode

public void toggleCompoundMode()
Toggles whether this group should be painted as a single path or not.


closePath

public void closePath()
Closes the path generated by the children of this BranchElement. This only makes sense in "JOINT" mode.


openPath

public void openPath()
Closes the path generated by the children of this BranchElement. This only makes sense in "JOINT" mode.


isPathClosed

public boolean isPathClosed()
Returns whether the path generated by the children of this BranchElement is closed or not. This only makes sense in "JOINT" mode.


togglePathClosure

public void togglePathClosure()
Toggles the closure of the path generated by the children of this BranchElement. This only makes sense in "JOINT" mode.


setLiftPen

public void setLiftPen(int i)
Sets the value of the liftPen parameter. See PSTricks' doc, page 36. [underway] liftpen not used yet.


getLiftPen

public int getLiftPen()
Returns the value of the liftPen parameter. See PSTricks' doc, page 36. [underway] liftpen not used yet.


createShape

public Shape createShape()
Creates a GeneralPath generated by the shapes of the children of this BranchElement (aka PSTricks' pscustom object).

Specified by:
createShape in interface Element
Overrides:
createShape in class AbstractElement

syncArrowGeometry

public void syncArrowGeometry(ArrowView v,
                              ArrowView.Direction d)
Helper for the associated View. This implementation does nothing by default. [SR: underway]

Specified by:
syncArrowGeometry in interface Element
Overrides:
syncArrowGeometry in class AbstractElement

forwardChangedUpdate

public void forwardChangedUpdate(Element child,
                                 DrawingEvent.EventType eventType)
Called by a child of this BranchElement to inform its parent of some change that occured to it or one of its children. This gives a chance to the receiver to update its layout, then to propagate the change-event upward.
This implementation update the bounding-box, then fire a changedUpdate event ONLY if changeLock is false. Otherwise, does nothing (this is the exact semantic behind "changeLock").

Parameters:
eventType - the event type
child -

setViewFromFactory

public void setViewFromFactory(ViewFactory f)
Set the view for this Element from the given view factory, then set the view for children.

Specified by:
setViewFromFactory in interface Element
Overrides:
setViewFromFactory in class AbstractElement

removeView

public void removeView()
Remove the view that render this element and propagate to children ; this may be used to remove any reference to the view, and render it eligible for garbage collection ; if no View, does nothing.

Specified by:
removeView in interface Element
Overrides:
removeView in class AbstractElement

bringToBack

public void bringToBack(Element obj)
Move the given child to back (i.e. following z-ordering policy), i.e. removes it from its current position and insert it at position 0
Does nothing if the given child can't be found in this Drawing or is already to back.


bringToFront

public void bringToFront(Element obj)
Move the given child to front, i.e. removes it from its current position and appends to the drawing.
Does nothing if the given obj can't be found in this Drawing or if it's already to front.


bringBackward

public void bringBackward(Element obj)
Move the given child one position backward, i.e. removes it from its current position and insert it one position backward.
Does nothing if the given obj can't be found in this Drawing, or if it's already to back.


bringForward

public void bringForward(Element obj)
Move the given child one position forward, i.e. removes it from its current position and insert it one position forward.
Does nothing if the given obj can't be found in this Drawing, or if it's already to front.


isToBack

public boolean isToBack(Element obj)
Returns:
true if the given object has the lowest z-value of all objects in this drawing.

isToFront

public boolean isToFront(Element obj)
Returns:
true if the given object has the highest z-value of all objects in this drawing.

getBoundingBox

public Rectangle2D getBoundingBox(Rectangle2D r)
Returns the bounding box (i.e. the surrounding rectangle) in double precision Used e.g. to determine the arguments of the \begin{picture} command.

Straigthforwardly computed from the diagonal.

Specified by:
getBoundingBox in interface Element
Returns:
null if this BranchElement has no children
Since:
PicEdt 1.0

updateBoundingBox

protected void updateBoundingBox()
Update the bounding box by "unioning" the children's bounding box (actually computes the two specification points defining the diagonal of the box). Should be called each time the content of this element gets modified : this may include addition or deletion of a child, and modification of a child by the child itself.


setAttributeSet

public void setAttributeSet(PicAttributeSet set)
Set AttributeSet for this BranchElement and propagate to children.

Specified by:
setAttributeSet in interface Element
Overrides:
setAttributeSet in class AbstractElement

setAttribute

public <T> void setAttribute(PicAttributeName<T> name,
                             T value)
Set an Attribute for this BranchElement and propagate to children.

Specified by:
setAttribute in interface Element
Overrides:
setAttribute in class AbstractElement

toString

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

Overrides:
toString in class AbstractElement

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<Element>
Specified by:
hashCode in interface List<Element>
Overrides:
hashCode in class Object

addAll

public boolean addAll(Collection<? extends Element> c)
Appends all the elements in the given collection that are instance of Element as children of this BranchElement.

Specified by:
addAll in interface Collection<Element>
Specified by:
addAll in interface List<Element>

addAll

public boolean addAll(int index,
                      Collection<? extends Element> c)
Inserts all the elements in the given collection that are instance of Element as children of this BranchElement, at the given position.

Specified by:
addAll in interface List<Element>

size

public int size()
Return the number of children in this BranchElement (direct offspring only).

Specified by:
size in interface Collection<Element>
Specified by:
size in interface List<Element>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<Element>
Specified by:
isEmpty in interface List<Element>
Returns:
true if this BranchElement contains no children

contains

public boolean contains(Object o)
Returns true if the given Element (or one of its ancestor) is contained in this BranchElement.

Specified by:
contains in interface Collection<Element>
Specified by:
contains in interface List<Element>

iterator

public Iterator<Element> iterator()
Returns an iterator over children.

Specified by:
iterator in interface Iterable<Element>
Specified by:
iterator in interface Collection<Element>
Specified by:
iterator in interface List<Element>

subList

public List<Element> subList(int fromIndex,
                             int toIndex)
Specified by:
subList in interface List<Element>

listIterator

public ListIterator<Element> listIterator()
Specified by:
listIterator in interface List<Element>

listIterator

public ListIterator<Element> listIterator(int index)
Specified by:
listIterator in interface List<Element>

lastIndexOf

public int lastIndexOf(Object o)
Returns the index of the given child amongst the offspring of this BranchElement.

Specified by:
lastIndexOf in interface List<Element>
Returns:
-1 if not found

indexOf

public int indexOf(Object child)
Returns the index of the given child amongst the offspring of this BranchElement.

Specified by:
indexOf in interface List<Element>
Returns:
-1 if not found

toArray

public Object[] toArray()
Returns an array containing all of the elements in this collection.

Specified by:
toArray in interface Collection<Element>
Specified by:
toArray in interface List<Element>

toArray

public <T> T[] toArray(T[] a)
Returns an array containing all of the elements in this collection whose runtime type is that of the specified array.

Specified by:
toArray in interface Collection<Element>
Specified by:
toArray in interface List<Element>

containsAll

public boolean containsAll(Collection<?> c)
Returns true if this BranchElement contains all of the elements in the specified collection, possibly through indirect lineage.

Specified by:
containsAll in interface Collection<Element>
Specified by:
containsAll in interface List<Element>

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<Element>
Specified by:
equals in interface List<Element>
Overrides:
equals in class Object

retainAll

public boolean retainAll(Collection<?> c)
Retains only the elements in this BranchElement that are contained in the specified collection.

Specified by:
retainAll in interface Collection<Element>
Specified by:
retainAll in interface List<Element>
Parameters:
c - elements to be retained in this collection.
Returns:
true if this collection changed as a result of the call

createFilteredCollection

public <T extends Element> ArrayList<T> createFilteredCollection(Class<T> clazz)
Returns a list containing children, grand-children, etc. of this BranchElement that are of the same type or inherit the given clazz. Search down the children tree stops whenever a matching class is encountered.

Since:
jpicedt 1.4pre5

containsClass

public boolean containsClass(Class<? extends Element> clazz)
Returns whether this BranchElement contains children, grandchildren, etc. that are of the same type of inherit from the given clazz.

Since:
jpicedt 1.4pre5

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org