Package edu.umd.cs.piccolo.nodes
Class PHtmlView
java.lang.Object
edu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.nodes.PHtmlView
- All Implemented Interfaces:
Printable,Serializable,Cloneable
PHtmlView is a Piccolo node for rendering HTML text. It uses a JLabel under
the hood so you have the same restrictions regarding HTML as you have when
using standard Swing components (HTML 3.2 + subset of CSS 1.0).
- Since:
- 1.3
- Author:
- Chris Malley (cmal...@pixelzoom.com), Sam Reid, Allain Lalonde
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode
PNode.PSceneGraphDelegate -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FontDefault font if not otherwise specified in the HTML text, 12 point"SansSerif".static final ColorDefault text color if not otherwise specified in the HTML text,Color.BLACK.static final intThe property code that identifies a change of this node's font (seegetFont).static final intThe property code that identifies a change of this node's HTML text (seegetText).static final intThe property code that identifies a change of this node's HTML text color (seegetTextColor).static final StringThe property name that identifies a change of this node's font (seegetFont).static final StringThe property name that identifies a change of this node's HTML text (seegetText).static final StringThe property name that identifies a change of this node's HTML text color (seegetTextColor).Fields inherited from class edu.umd.cs.piccolo.PNode
FILL_STRATEGY_ASPECT_COVER, FILL_STRATEGY_ASPECT_FIT, FILL_STRATEGY_EXACT_FIT, PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATEFields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty HTML text node with the default font and text color.Create a HTML text node with the specified HTML text and the default font and text color.Create a HTML text node with the specified HTML text, font, and text color. -
Method Summary
Modifier and TypeMethodDescriptiongetFont()Return the font for this HTML text node.getLinkAddressAt(double x, double y) Return the address specified in the HTML link at the specified x and y coordinates in this node's local coordinate system, if any.getLinkAddressAt(Point2D point) Return the address specified in the HTML link at the specified point in this node's local coordinate system, if any.getText()Return the HTML text for this HTML text node.Return the text color for this HTML text node.protected voidpaint(PPaintContext paintContext) Paint this node behind any of its children nodes.booleansetBounds(double x, double y, double width, double height) Set the bounds of this node to the given position and size.booleansetBounds(Rectangle2D newBounds) Set the bounds of this node to the given value.voidSet the font for this HTML text node tofont.voidSet the HTML text for this HTML text node totext.voidsetTextColor(Color textColor) Set the text color for this HTML text node totextColor.Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, addAttribute, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToRelativePosition, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientProperty, getClientPropertyKeysEnumeration, getClientPropertyKeysIterator, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getInputEventListeners, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getName, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, intersects, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paintAfterChildren, paramString, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setName, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, toImage, toImage, transformBy, translate, validateFullBounds, validateFullPaint
-
Field Details
-
DEFAULT_FONT
Default font if not otherwise specified in the HTML text, 12 point"SansSerif". -
DEFAULT_TEXT_COLOR
Default text color if not otherwise specified in the HTML text,Color.BLACK. -
PROPERTY_FONT
The property name that identifies a change of this node's font (seegetFont). Both old and new value will be set in any property change event.- See Also:
-
PROPERTY_CODE_FONT
public static final int PROPERTY_CODE_FONTThe property code that identifies a change of this node's font (seegetFont). Both old and new value will be set in any property change event.- See Also:
-
PROPERTY_TEXT
The property name that identifies a change of this node's HTML text (seegetText). Both old and new value will be set in any property change event.- See Also:
-
PROPERTY_CODE_TEXT
public static final int PROPERTY_CODE_TEXTThe property code that identifies a change of this node's HTML text (seegetText). Both old and new value will be set in any property change event.- See Also:
-
PROPERTY_TEXT_COLOR
The property name that identifies a change of this node's HTML text color (seegetTextColor). Both old and new value will be set in any property change event.- See Also:
-
PROPERTY_CODE_TEXT_COLOR
public static final int PROPERTY_CODE_TEXT_COLORThe property code that identifies a change of this node's HTML text color (seegetTextColor). Both old and new value will be set in any property change event.- See Also:
-
-
Constructor Details
-
PHtmlView
public PHtmlView()Create an empty HTML text node with the default font and text color. -
PHtmlView
Create a HTML text node with the specified HTML text and the default font and text color.- Parameters:
text- HTML text for this HTML text node
-
PHtmlView
Create a HTML text node with the specified HTML text, font, and text color. The font and text color are used to render the HTML text if not otherwise specified via CSS.- Parameters:
text- HTML text for this HTML text nodefont- font for this HTML text nodetextColor- text color for this HTML text node
-
-
Method Details
-
getText
Return the HTML text for this HTML text node.- Returns:
- the HTML text for this HTML text node
-
setText
Set the HTML text for this HTML text node totext.This is a bound property.
- Parameters:
text- HTML text for this HTML text node
-
getFont
Return the font for this HTML text node. This font is used to render the HTML text if not otherwise specified via CSS. Defaults toDEFAULT_FONT.- Returns:
- the font for this HTML text node
-
setFont
Set the font for this HTML text node tofont. This font is used to render the HTML text if not otherwise specified via CSS.This is a bound property.
- Parameters:
font- font for this HTML text node
-
getTextColor
Return the text color for this HTML text node. This text color is used to render the HTML text if not otherwise specified via CSS. Defaults toDEFAULT_TEXT_COLOR.- Returns:
- the text color for this HTML text node
-
setTextColor
Set the text color for this HTML text node totextColor. This text color is used to render the HTML text if not otherwise specified via CSS. This is a bound property.- Parameters:
textColor- text color for this HTML text node
-
setBounds
public boolean setBounds(double x, double y, double width, double height) Set the bounds of this node to the given position and size. These bounds are stored in the local coordinate system of this node. If the width or height is less then or equal to zero then the bound's empty bit will be set to true. Subclasses must call the super.setBounds() method. -
setBounds
Set the bounds of this node to the given value. These bounds are stored in the local coordinate system of this node. -
paint
Paint this node behind any of its children nodes. Subclasses that define a different appearance should override this method and paint themselves there.The HTML text is painted last, so it will appear on top of any child nodes.
-
getLinkAddressAt
Return the address specified in the HTML link at the specified point in this node's local coordinate system, if any.- Parameters:
point- point in this node's local coordinate system- Returns:
- the address specified in the HTML link at the specified point in
this node's local coordinate system, or
nullif no such HTML link exists
-
getLinkAddressAt
Return the address specified in the HTML link at the specified x and y coordinates in this node's local coordinate system, if any.- Parameters:
x- x coordinate in this node's local coordinate systemy- y coordinate in this node's local coordinate system- Returns:
- the address specified in the HTML link at the specified x and y
coordinates in this node's local coordinate system, or
nullif no such HTML link exists
-