class IconLabelRenderer extends AbstractShapeRenderer
Renderer that draws a label, which consists of a text string,
an icon, or both. This is based on the prefuse LabelRenderer
class, but changes image for icon. It was converted from Java to Scala,
so the code looks a bit ugly.
When created using the default constructor, the renderer attempts
to use text from the "label" field. To use a different field, use the
appropriate constructor or use the setTextField
method.
To perform custom String selection, subclass this Renderer and override the
getText
method. When the text field is
null
, no text label will be shown. Labels can span multiple
lines of text, determined by the presence of newline characters ('\n')
within the text string.
By default, no icon is shown. To show an icon, the icon field needs
to be set, either using the appropriate constructor or the
setIconField
method. The value of the icon field should
be an Icon
instance to use.
The position of the icon relative to text can be set using the
setIconPosition
method. Images can be placed to the
left, right, above, or below the text. The horizontal and vertical
alignments of either the text or the icon can be set explicitly
using the appropriate methods of this class (e.g.,
setHorizontalTextAlignment
). By default, both the
text and icon are centered along both the horizontal and
vertical directions.
- Alphabetic
- By Inheritance
- IconLabelRenderer
- AbstractShapeRenderer
- Renderer
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new IconLabelRenderer(textField: String, iconField: String)
Creates a new LabelRenderer.
Creates a new LabelRenderer. Draws a text label using the given text data field, and draws the icon at the location reported by the given icon data field.
- textField
the data field for the text label
- iconField
the data field for the icon location. This value in the data field should be an
Icon
, or null for no icon. If theiconField
parameter is null, no icon at all will be drawn.
- new IconLabelRenderer(textField: String)
Creates a new LabelRenderer.
Creates a new LabelRenderer. Draws a text label using the given text data field and does not draw an icon.
- textField
the data field for the text label.
- new IconLabelRenderer()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def drawShape(arg0: Graphics2D, arg1: VisualItem, arg2: Shape): Unit
- Attributes
- protected[prefuse.render]
- Definition Classes
- AbstractShapeRenderer
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getIcon(item: VisualItem): Icon
Returns the icon to draw.
Returns the icon to draw. Subclasses can override this class to perform custom icon selection beyond looking up the value from a data field.
- item
the item for which to select an icon to draw
- returns
the icon to use, or null for no icon
- Attributes
- protected
- def getRawShape(item: VisualItem): Shape
- Attributes
- protected
- Definition Classes
- IconLabelRenderer → AbstractShapeRenderer
- See also
prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
- def getRenderType(arg0: VisualItem): Int
- Definition Classes
- AbstractShapeRenderer
- def getShape(arg0: VisualItem): Shape
- Definition Classes
- AbstractShapeRenderer
- def getStroke(arg0: VisualItem): BasicStroke
- Attributes
- protected[prefuse.render]
- Definition Classes
- AbstractShapeRenderer
- def getText(item: VisualItem): String
Returns the text to draw.
Returns the text to draw. Subclasses can override this class to perform custom text selection.
- item
the item to represent as a
String
- returns
a
String
to draw
- Attributes
- protected
- def getTransform(arg0: VisualItem): AffineTransform
- Attributes
- protected[prefuse.render]
- Definition Classes
- AbstractShapeRenderer
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def horizontalAlignment: Int
Gets the horizontal alignment of this node with respect to its x, y coordinates.
Gets the horizontal alignment of this node with respect to its x, y coordinates.
- returns
the horizontal alignment, one of { @link prefuse.Constants#LEFT}, { @link prefuse.Constants#RIGHT}, or { @link prefuse.Constants#CENTER}.
- def horizontalAlignment_=(value: Int): Unit
Sets the horizontal alignment of this node with respect to its x, y coordinates.
Sets the horizontal alignment of this node with respect to its x, y coordinates.
- value
the horizontal alignment, one of { @link prefuse.Constants#LEFT}, { @link prefuse.Constants#RIGHT}, or { @link prefuse.Constants#CENTER}.
- def horizontalIconAlignment: Int
Gets the horizontal icon alignment within the layout.
Gets the horizontal icon alignment within the layout. One of
Constants.LEFT
,Constants.RIGHT
, orConstants.CENTER
. The default is a centered icon.- returns
the horizontal icon alignment
- def horizontalIconAlignment_=(value: Int): Unit
Sets the horizontal icon alignment within the layout.
Sets the horizontal icon alignment within the layout. One of
Constants.LEFT
,Constants.RIGHT
, orConstants.CENTER
. The default is a centered icon.- value
the desired horizontal icon alignment
- def horizontalPadding: Int
Returns the amount of padding in pixels between the content and the border of this item along the horizontal dimension.
Returns the amount of padding in pixels between the content and the border of this item along the horizontal dimension.
- returns
the horizontal padding
- def horizontalPadding_=(value: Int): Unit
Sets the amount of padding in pixels between the content and the border of this item along the horizontal dimension.
Sets the amount of padding in pixels between the content and the border of this item along the horizontal dimension.
- value
the horizontal padding to set
- def horizontalTextAlignment: Int
Gets the horizontal text alignment within the layout.
Gets the horizontal text alignment within the layout. One of
Constants.LEFT
,Constants.RIGHT
, orConstants.CENTER
. The default is centered text.- returns
the horizontal text alignment
- def horizontalTextAlignment_=(value: Int): Unit
Sets the horizontal text alignment within the layout.
Sets the horizontal text alignment within the layout. One of
Constants.LEFT
,Constants.RIGHT
, orConstants.CENTER
. The default is centered text.- value
the desired horizontal text alignment
- def iconField: String
Gets the data field for icon locations.
Gets the data field for icon locations. The value stored in the data field should be an
Icon
, or null for no icon.- returns
the data field for icon locations, or null for no icon
- def iconField_=(value: String): Unit
Sets the data field for icon locations.
Sets the data field for icon locations. The value stored in the data field should be an
Icon
, or null for no icon. If theiconField
parameter is null, no icons at all will be drawn.- value
the data field for icon locations, or null for no icons
- def iconPosition: Int
Gets the icon position, determining where the icon is placed with respect to the text.
Gets the icon position, determining where the icon is placed with respect to the text. One of
Constants.LEFT
,Constants.RIGHT
,Constants.TOP
, orConstants.BOTTOM
. The default is left.- returns
the icon position
- def iconPosition_=(value: Int): Unit
Sets the icon position, determining where the icon is placed with respect to the text.
Sets the icon position, determining where the icon is placed with respect to the text. One of
Constants.LEFT
,Constants.RIGHT
,Constants.TOP
, orConstants.BOTTOM
. The default is left.- value
the desired icon position
- def iconTextPadding: Int
Gets the padding, in pixels, between an icon and text.
Gets the padding, in pixels, between an icon and text.
- returns
the padding between an icon and text
- def iconTextPadding_=(value: Int): Unit
Sets the padding, in pixels, between an icon and text.
Sets the padding, in pixels, between an icon and text.
- value
the padding to use between an icon and text
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def locatePoint(arg0: Point2D, arg1: VisualItem): Boolean
- Definition Classes
- AbstractShapeRenderer → Renderer
- var m_arcHeight: Int
- Attributes
- protected
- var m_arcWidth: Int
- Attributes
- protected
- var m_bBox: RectangularShape
The holder for the currently computed bounding box
The holder for the currently computed bounding box
- Attributes
- protected
- var m_delim: String
- Attributes
- protected
- var m_font: Font
- Attributes
- protected
- var m_hIconAlign: Int
- Attributes
- protected
- var m_hTextAlign: Int
- Attributes
- protected
- var m_horizBorder: Int
- Attributes
- protected
- var m_iconMargin: Int
- Attributes
- protected
- var m_iconName: String
- Attributes
- protected
- var m_iconPos: Int
- Attributes
- protected
- var m_labelName: String
- Attributes
- protected
- var m_maxTextWidth: Int
- Attributes
- protected
- var m_pt: Point2D
- Attributes
- protected
- var m_text: String
- Attributes
- protected
- var m_textDim: Dimension
- Attributes
- protected
- var m_vIconAlign: Int
- Attributes
- protected
- var m_vTextAlign: Int
- Attributes
- protected
- var m_vertBorder: Int
- Attributes
- protected
- var m_xAlign: Int
- Attributes
- protected
- var m_yAlign: Int
- Attributes
- protected
- def maximumTextWidth: Int
- def maximumTextWidth_=(value: Int): Unit
Sets the maximum width that should be allowed of the text label.
Sets the maximum width that should be allowed of the text label. A value of -1 specifies no limit (this is the default).
- value
the maximum width of the text or -1 for no limit
- def mkAlignedPoint(p: Point2D, item: VisualItem, w: Double, h: Double, xAlign: Int, yAlign: Int): Unit
Helper method, which calculates the top-left co-ordinate of an item given the item's alignment.
Helper method, which calculates the top-left co-ordinate of an item given the item's alignment.
- Attributes
- protected
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def render(g: Graphics2D, item: VisualItem): Unit
- Definition Classes
- IconLabelRenderer → AbstractShapeRenderer → Renderer
- See also
prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
- def setBounds(arg0: VisualItem): Unit
- Definition Classes
- AbstractShapeRenderer → Renderer
- def setManageBounds(arg0: Boolean): Unit
- Definition Classes
- AbstractShapeRenderer
- def setRenderType(arg0: Int): Unit
- Definition Classes
- AbstractShapeRenderer
- def setRoundedCorner(arcWidth: Int, arcHeight: Int): Unit
Rounds the corners of the bounding rectangle in which the text string is rendered.
Rounds the corners of the bounding rectangle in which the text string is rendered. This will only be seen if either the stroke or fill color is non-transparent.
- arcWidth
the width of the curved corner
- arcHeight
the height of the curved corner
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def textField: String
Gets the field name to use for text labels.
Gets the field name to use for text labels.
- returns
the data field for text labels, or null for no text
- def textField_=(value: String): Unit
Sets the field name to use for text labels.
Sets the field name to use for text labels.
- value
the data field for text labels, or null for no text
- def toString(): String
- Definition Classes
- AnyRef → Any
- def verticalAlignment: Int
Gets the vertical alignment of this node with respect to its x, y coordinates.
Gets the vertical alignment of this node with respect to its x, y coordinates.
- returns
the vertical alignment, one of { @link prefuse.Constants#TOP}, { @link prefuse.Constants#BOTTOM}, or { @link prefuse.Constants#CENTER}.
- def verticalAlignment_=(value: Int): Unit
Sets the vertical alignment of this node with respect to its x, y coordinates.
Sets the vertical alignment of this node with respect to its x, y coordinates.
- value
the vertical alignment, one of { @link prefuse.Constants#TOP}, { @link prefuse.Constants#BOTTOM}, or { @link prefuse.Constants#CENTER}.
- def verticalIconAlignment: Int
Gets the vertical icon alignment within the layout.
Gets the vertical icon alignment within the layout. One of
Constants.TOP
,Constants.BOTTOM
, orConstants.CENTER
. The default is a centered icon.- returns
the vertical icon alignment
- def verticalIconAlignment_=(value: Int): Unit
Sets the vertical icon alignment within the layout.
Sets the vertical icon alignment within the layout. One of
Constants.TOP
,Constants.BOTTOM
, orConstants.CENTER
. The default is a centered icon.- value
the desired vertical icon alignment
- def verticalPadding: Int
Returns the amount of padding in pixels between the content and the border of this item along the vertical dimension.
Returns the amount of padding in pixels between the content and the border of this item along the vertical dimension.
- returns
the vertical padding
- def verticalPadding_=(value: Int): Unit
Sets the amount of padding in pixels between the content and the border of this item along the vertical dimension.
Sets the amount of padding in pixels between the content and the border of this item along the vertical dimension.
- value
the vertical padding
- def verticalTextAlignment: Int
Gets the vertical text alignment within the layout.
Gets the vertical text alignment within the layout. One of
Constants.TOP
,Constants.BOTTOM
, orConstants.CENTER
. The default is centered text.- returns
the vertical text alignment
- def verticalTextAlignment_=(value: Int): Unit
Sets the vertical text alignment within the layout.
Sets the vertical text alignment within the layout. One of
Constants.TOP
,Constants.BOTTOM
, orConstants.CENTER
. The default is centered text.- value
the desired vertical text alignment
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated