|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.nexttext.TextObject
public abstract class TextObject
An object in the core text data.
The core data of a NextText application is a bunch of text, with properties to define its behaviour on the screen. The text and properties are stored in a tree data structure, whose nodes are TextObjects. The terminal and non-terminal nodes of this tree are instances of two different subclasses of TextObject.
TextObject contains the common facilities of these subclasses, most importantly a list of properties. There is intentionally no removeProperty() method, so that behaviours can call properties.init() for all the properties that they need when they are attached to an object, and then they do not need to handle the case where getProperty() returns null. To change the value of a property, modify the returned Property object.
The tree structure is maintained inside the TextObject. This allows tree traversal and modification to be easily done by several methods in this class.
Method Summary | |
---|---|
void |
attachToLeft(TextObject newLeftSibling)
Attach the given TextObject to the left of this one. |
void |
attachToRight(TextObject newRightSibling)
Attach the given TextObject to the right of this one. |
void |
detach()
Detach this from the TextObjectTree. |
CoordinateSystem |
getAbsoluteCoordinateSystem()
Get the coordinate system which maps between this object's and global coordinates. |
Book |
getBook()
Get the book whose TextObject hierarchy this object is attached to. |
java.awt.Polygon |
getBoundingPolygon()
Returns the object's bounding polygon in absolute (screen) coordinates. |
java.awt.Rectangle |
getBounds()
Convenience wrapper around getBoundingPolygon().getBounds(). |
processing.core.PVector |
getCenter()
Returns the center coordinates of the globalBoundingPolygon |
ColorProperty |
getColor()
A getter for the standard "Color" property. |
java.awt.Color |
getColorAbsolute()
Returns the absolute color of an Object, inheriting from the parent if the ColorProperty has been configured as such. |
abstract int |
getHeight()
Get the greatest number of layers between this TextObject and the leaves of the tree. |
TextObject |
getLeftSibling()
Get the left Sibling, or null if there isn't one. |
abstract java.awt.Polygon |
getLocalBoundingPolygon()
Returns the object's bounding box expressed in local untransformed coordinates. |
processing.core.PVector |
getLocation()
Returns the object's location in absolute coordinates. |
TextObjectGroup |
getParent()
Get the parent, or null if this is the root. |
PVectorProperty |
getPosition()
A getter for the standard "Position" property. |
processing.core.PVector |
getPositionAbsolute()
The absolute position, rather than the usual relative position. |
Property |
getProperty(java.lang.String name)
Get a single of property. |
java.util.Set<java.lang.String> |
getPropertyNames()
Get the names of all properties. |
java.awt.Polygon |
getRelativeBoundingPolygon()
Returns a convex polygon which encloses all of the object's geometry. |
CoordinateSystem |
getRelativeCoordinateSystem()
Get the coordinate system which maps between this object's and its parent's coordinates. |
TextObject |
getRightSibling()
Get the right Sibling, or null if there isn't one. |
NumberProperty |
getRotation()
A getter for the standard "Rotation" property. |
StrokeProperty |
getStroke()
A getter for the standard "Stroke" property. |
java.awt.BasicStroke |
getStrokeAbsolute()
Returns the absolute stroke of an Object, inheriting from the parent if the StrokeProperty has been configured as such. |
ColorProperty |
getStrokeColor()
A getter for the standard "StrokeColor" property. |
java.awt.Color |
getStrokeColorAbsolute()
Returns the absolute stroke color of an Object, inheriting from the parent if the ColorProperty has been configured as such. |
void |
init(java.lang.String name,
Property property)
Initialize a single of property. |
void |
initProperties(java.util.Map<java.lang.String,Property> propertyMap)
Initialize a bunch of properties. |
void |
invalidateLocalBoundingPolygon()
|
boolean |
isFilled()
Get the flag telling if the fill colour is activated or not. |
boolean |
isStroked()
Get the flag telling if the stroke is activated or not. |
abstract java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public TextObject getLeftSibling()
public TextObject getRightSibling()
public TextObjectGroup getParent()
public boolean isStroked()
public boolean isFilled()
public void attachToRight(TextObject newRightSibling)
public void attachToLeft(TextObject newLeftSibling)
public void detach()
public abstract int getHeight()
public void invalidateLocalBoundingPolygon()
public java.awt.Polygon getBoundingPolygon()
Do not modify the returned Polygon, because it may be cached.
XXXBUG: This method always returns a box-shaped unless we write an algorithm to find the convex hull of a set of points.
TextObjectGlyph.getLocalBoundingPolygon()
,
TextObjectGroup.getLocalBoundingPolygon()
public java.awt.Rectangle getBounds()
public processing.core.PVector getCenter()
public java.awt.Polygon getRelativeBoundingPolygon()
Do not modify the returned Polygon, because it may be cached.
The returned polygon is in the same coordinate system as the object's position, which is its parent's coordinate system.
public abstract java.awt.Polygon getLocalBoundingPolygon()
Do not modify the returned Polygon, because it may be cached.
public CoordinateSystem getRelativeCoordinateSystem()
A TextObjectGlyph's control points can be transformed out of this coordinate system into its parent's coordinates.
public CoordinateSystem getAbsoluteCoordinateSystem()
A TextObjectGlyph's control points can be transformed out of this coordinate system into the global (or screen) coordinates.
public void initProperties(java.util.Map<java.lang.String,Property> propertyMap)
public void init(java.lang.String name, Property property)
public Property getProperty(java.lang.String name)
public java.util.Set<java.lang.String> getPropertyNames()
public PVectorProperty getPosition()
public ColorProperty getColor()
public ColorProperty getStrokeColor()
public StrokeProperty getStroke()
public NumberProperty getRotation()
public Book getBook()
public processing.core.PVector getPositionAbsolute()
The absolute position is expressed in terms of screen coordinates.
public java.awt.Color getColorAbsolute()
public java.awt.Color getStrokeColorAbsolute()
public java.awt.BasicStroke getStrokeAbsolute()
public abstract java.lang.String toString()
toString
in class java.lang.Object
public processing.core.PVector getLocation()
getLocation
in interface Locatable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |