public class SceneComponent extends Object implements AppearanceChangeListener
An implementation of the SceneNode
interface that provides bean
conform "get" and "set" methods for all properties. Properties that are
objects are not copied but stored as references, so changes made to them
after using them to set a property will affect the behaviour of the
SceneComponent
.
Child nodes can be added and removed.
A SceneComponent
registers as an
AppearanceChangeListener
with all of its children and reacts to
appearance changes of its children by notifiying its own
appearanceChange
listeners that its own appearance (which is
meant to include those of its children) has changed.
Another object can register as a DragListener
in order to be
notified when this node is dragged. Note that dragging of a child node does
not automatically lead to the parent receiving drag events. If one wants
dragging of a children to affect the parent, one has to register an
appropriate DragListener
with the child.
Constructor and Description |
---|
SceneComponent()
Creates a SceneComponent with all properties that are objects set to
null . |
SceneComponent(SceneComponent s) |
Modifier and Type | Method and Description |
---|---|
void |
addAppearanceChangeListener(AppearanceChangeListener l) |
void |
addChild(int index,
SceneComponent s) |
void |
addChild(SceneComponent s)
Adds a child node.
|
void |
addDragListener(DragListener l)
Adds
l to the list of listeners that are notified when this
node is dragged. |
void |
addMouseOverListener(MouseOverListener l)
Adds
l to the list of listeners that are notified when this
node is over this component. |
void |
appearanceChange(AppearanceChangeEvent e)
Take notice that the appearance of some scene node has changed (meaning
that a repaint is needed).
|
void |
copyAttributesFrom(SceneComponent s) |
void |
drag(TransformedMouseEvent e) |
void |
dragEnd(TransformedMouseEvent e) |
void |
dragStart(TransformedMouseEvent e) |
void |
fireAppearanceChange()
Notifies all registered AppearanceChangeListeners that the appearance of
this node has changed (meaning that a repaint is needed).
|
Boolean |
getAnnotated() |
Integer |
getAnnotationMargin() |
Paint |
getAnnotationPaint() |
List<Annotation> |
getAnnotations() |
SceneComponent |
getChild(int index) |
int |
getChildCount() |
Boolean |
getFilled() |
Font |
getFont() |
Paint |
getHighlightAnnotationPaint() |
Boolean |
getHighlighted() |
Paint |
getHighlightOutlinePaint() |
Paint |
getHighlightPaint() |
Paint |
getHighlightPointPaint() |
List<Icon2D> |
getIcons() |
String |
getName() |
Boolean |
getOutlined() |
Paint |
getOutlinePaint() |
Paint |
getPaint() |
Boolean |
getPointFilled() |
Boolean |
getPointOutlined() |
Paint |
getPointPaint() |
List<Point2D.Double> |
getPoints() |
Shape |
getPointShape() |
Stroke |
getPointStroke() |
Shape |
getShape() |
Stroke |
getStroke() |
AffineTransform |
getTransform() |
boolean |
isAnnotationDragEnabled() |
boolean |
isAreaDragEnabled() |
boolean |
isIconDragEnabled() |
boolean |
isMouseOverEnabled() |
boolean |
isOutlineDragEnabled() |
boolean |
isPointDragEnabled() |
boolean |
isVisible() |
void |
mouseEnter(TransformedMouseEvent e) |
void |
mouseLeave(TransformedMouseEvent e) |
void |
removeAllChildren() |
void |
removeAppearanceChangeListener(AppearanceChangeListener l) |
void |
removeChild(SceneComponent node)
Removes a child node.
|
void |
removeDragListener(DragListener l)
Remove
l from the list of listeners that are notified when
this node is component. |
void |
removeMouseOverListener(MouseOverListener l)
Remove
l from the list of listeners that are notified when
this mouse is over this component. |
void |
setAnnotated(Boolean b)
Sets the Boolean that tells whether the textual annotation of this node
should be drawn.
|
void |
setAnnotationDragEnabled(boolean annotationDragEnabled) |
void |
setAnnotationMargin(Integer a)
Sets the amount (in screen space) by which the text of the annotation is
shifted up and to the right relative to points inducated by the
annotation.
|
void |
setAnnotationPaint(Paint p)
Sets the paint to be used for drawing the text of the annotation.
|
void |
setAreaDragEnabled(boolean b)
Determine whether the shape of this node takes part in picking.
|
void |
setFilled(Boolean b)
Sets the Boolean that tells whether the shape of this node should be
filled.
|
void |
setFont(Font f)
Sets the stroke to be used for drawing the outline of the points of this
node.
|
void |
setHighlightAnnotationPaint(Paint highlightAnnotationPaint) |
void |
setHighlighted(Boolean highlighted) |
void |
setHighlightOutlinePaint(Paint highlightOutlinePaint) |
void |
setHighlightPaint(Paint highlightPaint) |
void |
setHighlightPointPaint(Paint highlightPointPaint) |
void |
setIconDragEnabled(boolean iconDragEnabled) |
void |
setMouseOverEnabled(boolean areaMouseOverEnabled) |
void |
setName(String name) |
void |
setOutlined(Boolean b)
Sets the Boolean that tells whether the outline of this node's shape
should be drawn.
|
void |
setOutlineDragEnabled(boolean b)
Determine whether the outline of this node's shape takes part in picking.
|
void |
setOutlinePaint(Paint p)
Sets the paint to be used for drawing the outline of the shape or of the
point set.
|
void |
setPaint(Paint p)
Sets the paint to be used for filling the shape.
|
void |
setPointDragEnabled(boolean b)
Tells whether the points of this node (or rather the shapes created by
this node's stamp) take part in picking.
|
void |
setPointFilled(Boolean b)
Sets the Boolean that tells whether the points of this node should be
filled.
|
void |
setPointOutlined(Boolean b)
Sets the Boolean that tells whether the outline of the points of this
node should be drawn.
|
void |
setPointPaint(Paint p)
Sets the paint to be used for filling the points.
|
void |
setPointShape(Shape s)
Sets the stamp to be used for creating a shape for each point in the
point set.
|
void |
setPointStroke(Stroke s)
Sets the stroke to be used for drawing the outline of the points of this
node.
|
void |
setShape(Shape s)
Sets the shape of this node.
|
void |
setStroke(Stroke s)
Sets the stroke to be used for drawing the outline of the shape.
|
void |
setTransform(AffineTransform t)
Sets the affine transformation of this node (mapping coordinates in the
parent node to this node's own coordinates).
|
void |
setVisible(boolean b) |
public SceneComponent()
null
. The three booleans controlling the participation in
dragging are all set to false
.public SceneComponent(SceneComponent s)
public void addAppearanceChangeListener(AppearanceChangeListener l)
public void addChild(int index, SceneComponent s)
public void addChild(SceneComponent s)
public void addDragListener(DragListener l)
l
to the list of listeners that are notified when this
node is dragged.public void addMouseOverListener(MouseOverListener l)
l
to the list of listeners that are notified when this
node is over this component.public void appearanceChange(AppearanceChangeEvent e)
AppearanceChangeListener
appearanceChange
in interface AppearanceChangeListener
public void copyAttributesFrom(SceneComponent s)
public void drag(TransformedMouseEvent e)
public void dragEnd(TransformedMouseEvent e)
public void dragStart(TransformedMouseEvent e)
public void fireAppearanceChange()
public Boolean getAnnotated()
public Integer getAnnotationMargin()
public Paint getAnnotationPaint()
public List<Annotation> getAnnotations()
public SceneComponent getChild(int index)
public int getChildCount()
public Boolean getFilled()
public Font getFont()
public Paint getHighlightAnnotationPaint()
public Boolean getHighlighted()
public Paint getHighlightOutlinePaint()
public Paint getHighlightPaint()
public Paint getHighlightPointPaint()
public String getName()
public Boolean getOutlined()
public Paint getOutlinePaint()
public Paint getPaint()
public Boolean getPointFilled()
public Boolean getPointOutlined()
public Paint getPointPaint()
public List<Point2D.Double> getPoints()
public Shape getPointShape()
public Stroke getPointStroke()
public Shape getShape()
public Stroke getStroke()
public AffineTransform getTransform()
public boolean isAnnotationDragEnabled()
public boolean isAreaDragEnabled()
public boolean isIconDragEnabled()
public boolean isMouseOverEnabled()
public boolean isOutlineDragEnabled()
public boolean isPointDragEnabled()
public boolean isVisible()
public void mouseEnter(TransformedMouseEvent e)
public void mouseLeave(TransformedMouseEvent e)
public void removeAllChildren()
public void removeAppearanceChangeListener(AppearanceChangeListener l)
public void removeChild(SceneComponent node)
public void removeDragListener(DragListener l)
l
from the list of listeners that are notified when
this node is component.public void removeMouseOverListener(MouseOverListener l)
l
from the list of listeners that are notified when
this mouse is over this component.public void setAnnotated(Boolean b)
public void setAnnotationDragEnabled(boolean annotationDragEnabled)
public void setAnnotationMargin(Integer a)
public void setAnnotationPaint(Paint p)
public void setAreaDragEnabled(boolean b)
public void setFilled(Boolean b)
public void setFont(Font f)
public void setHighlightAnnotationPaint(Paint highlightAnnotationPaint)
public void setHighlighted(Boolean highlighted)
public void setHighlightOutlinePaint(Paint highlightOutlinePaint)
public void setHighlightPaint(Paint highlightPaint)
public void setHighlightPointPaint(Paint highlightPointPaint)
public void setIconDragEnabled(boolean iconDragEnabled)
public void setMouseOverEnabled(boolean areaMouseOverEnabled)
public void setName(String name)
public void setOutlined(Boolean b)
public void setOutlineDragEnabled(boolean b)
public void setOutlinePaint(Paint p)
public void setPaint(Paint p)
public void setPointDragEnabled(boolean b)
public void setPointFilled(Boolean b)
public void setPointOutlined(Boolean b)
public void setPointPaint(Paint p)
public void setPointShape(Shape s)
public void setPointStroke(Stroke s)
public void setShape(Shape s)
public void setStroke(Stroke s)
public void setTransform(AffineTransform t)
public void setVisible(boolean b)