|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ignotus.aifile.DisplayComponent
com.ignotus.aifile.CustomComponent
public class CustomComponent
Permits the addition of arbitrary, non-printing, custom information to file output.
Constructor Summary | |
---|---|
CustomComponent(PApplet parent)
|
|
CustomComponent(PApplet parent,
String tagIdentifier,
String tagValue)
|
Method Summary | |
---|---|
void |
accept(ComponentVisitor visitor)
Accepts a ComponentVisitor that traverses a document structure tree. |
void |
accept(ComponentVisitor visitor,
boolean order)
Accepts a ComponentVisitor that traverses a document structure tree in preorder or postorder. |
void |
add(ArrayList<? extends DisplayComponent> comps)
Adds all components in a list to this component, throws an UnsupportedOperationException if component is terminal. |
void |
add(DisplayComponent component)
Adds a component to children of this component, throws an UnsupportedOperationException if component is terminal. |
ArrayList<DisplayComponent> |
children()
Returns null : this is a terminal node, with no children. |
void |
draw()
Draws geometry or text to the Processing window. |
DisplayComponent |
get(int index)
Returns the component at index from the children of this component, throws an UnsupportedOperationException if component is terminal. |
boolean |
isTerminal()
|
Iterator<DisplayComponent> |
iterator()
Returns an iterator over children, throws an UnsupportedOperationException if component is terminal. |
boolean |
remove(DisplayComponent component)
Removes a component from children of this component, throws an UnsupportedOperationException if component is terminal. |
void |
setTagIdentifier(String tagIdentifier)
Sets key used to identify custom data. |
void |
setTagValue(String tagValue)
|
String |
tagIdentifier()
|
String |
tagValue()
Sets the value of custom data. |
void |
transform(Matrix3 matx)
Transforms geometry of shapes and location of text using the supplied matrix. |
void |
write(PrintWriter pw)
Writes an Adobe Illustrator 7.0 file format encoding structure, geometry and text. |
Methods inherited from class com.ignotus.aifile.DisplayComponent |
---|
hide, id, isLocked, isVisible, parentComponent, setLocked, setParentComponent, setVisible, show |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomComponent(PApplet parent)
parent
- PApplet used for calls to the Processing environment, notably for drawingpublic CustomComponent(PApplet parent, String tagIdentifier, String tagValue)
tagIdentifier
- String to identify custom datatagValue
- Custom data to save to file (non-printing).Method Detail |
---|
public String tagIdentifier()
public void setTagIdentifier(String tagIdentifier)
tagIdentifier
- the tagIdentifier to setpublic String tagValue()
public void setTagValue(String tagValue)
tagValue
- the tagValue to setpublic void add(DisplayComponent component)
DisplayComponent
UnsupportedOperationException
if component is terminal.
add
in class DisplayComponent
component
- DisplayComponent to add to this component's children
UnsupportedOperationException,
- CustomComponent is a terminal (leaf) nodepublic void add(ArrayList<? extends DisplayComponent> comps)
DisplayComponent
UnsupportedOperationException
if component is terminal.
add
in class DisplayComponent
comps
- an ArrayList of DisplayComponents
UnsupportedOperationException,
- CustomComponent is a terminal (leaf) nodepublic boolean remove(DisplayComponent component)
DisplayComponent
UnsupportedOperationException
if component is terminal.
remove
in class DisplayComponent
component
- DisplayComponent to remove from this component's children
UnsupportedOperationException,
- CustomComponent is a terminal (leaf) nodepublic DisplayComponent get(int index)
DisplayComponent
UnsupportedOperationException
if component is terminal.
Throws an IndexOutOfBoundsException
if index is out of range (index < 0 || index >= size).
get
in class DisplayComponent
index
- index to component
UnsupportedOperationException,
- CustomComponent is a terminal (leaf) nodepublic Iterator<DisplayComponent> iterator()
DisplayComponent
UnsupportedOperationException
if component is terminal.
iterator
in class DisplayComponent
UnsupportedOperationException,
- CustomComponent is a terminal (leaf) nodepublic ArrayList<DisplayComponent> children()
null
: this is a terminal node, with no children.
children
in class DisplayComponent
public boolean isTerminal()
isTerminal
in class DisplayComponent
true
, this is a terminal component.DisplayComponent.isTerminal()
public void draw()
DisplayComponent
draw
in class DisplayComponent
public void write(PrintWriter pw)
DisplayComponent
write
in class DisplayComponent
pw
- a PrintWriter for file output.public void transform(Matrix3 matx)
DisplayComponent
transform
in class DisplayComponent
matx
- a Matrix3 that encapsulates an affine geometric transform.public void accept(ComponentVisitor visitor)
Visitable
When called from an object that implements the Visitable
interface:
accept( visitor )
on all its children
The reference is passed back to the visitor through a method of the form
visitor.visit<ComponentClassName>( this );
See ComponentVisitor
The order of steps 1 and 2 determines if traversal of the composite structure is preorder or postorder. As shown above, it's preorder. Depending on what you want to do, one traversal may be better suited than the other. Preorder visits parents first, postorder visits children first.
visitor
- a ComponentVisitor
public void accept(ComponentVisitor visitor, boolean order)
Visitable
visitor
- a ComponentVisitor
order
- boolean to determine if traversal is preorder or postorder
accept( visitor )
should implement the default order of traversal,
accept( visitor, <false>
) should implement the other order.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |