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.
the data field for the text label
the data field for the icon location. This value
in the data field should be an Icon
, or null for no icon. If the
iconField
parameter is null, no icon at all will be drawn.
Creates a new LabelRenderer.
Creates a new LabelRenderer. Draws a text label using the given text data field and does not draw an icon.
the data field for the text label.
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.
the item for which to select an icon to draw
the icon to use, or null for no icon
prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
Returns the text to draw.
Returns the text to draw. Subclasses can override this class to perform custom text selection.
the item to represent as a String
a String
to draw
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.
the horizontal alignment, one of { @link prefuse.Constants#LEFT}, { @link prefuse.Constants#RIGHT}, or { @link prefuse.Constants#CENTER}.
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.
the horizontal alignment, one of { @link prefuse.Constants#LEFT}, { @link prefuse.Constants#RIGHT}, or { @link prefuse.Constants#CENTER}.
Gets the horizontal icon alignment within the layout.
Gets the horizontal icon alignment within the layout. One of
prefuse.Constants#LEFT
, prefuse.Constants#RIGHT
, or
prefuse.Constants#CENTER
. The default is a centered icon.
the horizontal icon alignment
Sets the horizontal icon alignment within the layout.
Sets the horizontal icon alignment within the layout. One of
prefuse.Constants#LEFT
, prefuse.Constants#RIGHT
, or
prefuse.Constants#CENTER
. The default is a centered icon.
the desired horizontal icon alignment
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.
the horizontal padding
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.
the horizontal padding to set
Gets the horizontal text alignment within the layout.
Gets the horizontal text alignment within the layout. One of
prefuse.Constants#LEFT
, prefuse.Constants#RIGHT
, or
prefuse.Constants#CENTER
. The default is centered text.
the horizontal text alignment
Sets the horizontal text alignment within the layout.
Sets the horizontal text alignment within the layout. One of
prefuse.Constants#LEFT
, prefuse.Constants#RIGHT
, or
prefuse.Constants#CENTER
. The default is centered text.
the desired horizontal text alignment
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.
the data field for icon locations, or null for no icon
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 the
iconField
parameter is null, no icons at all will be
drawn.
the data field for icon locations, or null for no icons
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
, or
Constants#BOTTOM
. The default is left.
the icon position
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
, or
Constants#BOTTOM
. The default is left.
the desired icon position
Gets the padding, in pixels, between an icon and text.
Gets the padding, in pixels, between an icon and text.
the padding between an icon and text
Sets the padding, in pixels, between an icon and text.
Sets the padding, in pixels, between an icon and text.
the padding to use between an icon and text
The holder for the currently computed bounding box
The holder for the currently computed bounding box
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).
the maximum width of the text or -1 for no limit
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.
prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
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.
the width of the curved corner
the height of the curved corner
Gets the field name to use for text labels.
Gets the field name to use for text labels.
the data field for text labels, or null for no text
Sets the field name to use for text labels.
Sets the field name to use for text labels.
the data field for text labels, or null for no text
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.
the vertical alignment, one of { @link prefuse.Constants#TOP}, { @link prefuse.Constants#BOTTOM}, or { @link prefuse.Constants#CENTER}.
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.
the vertical alignment, one of { @link prefuse.Constants#TOP}, { @link prefuse.Constants#BOTTOM}, or { @link prefuse.Constants#CENTER}.
Gets the vertical icon alignment within the layout.
Gets the vertical icon alignment within the layout. One of
prefuse.Constants#TOP
, prefuse.Constants#BOTTOM
, or
prefuse.Constants#CENTER
. The default is a centered icon.
the vertical icon alignment
Sets the vertical icon alignment within the layout.
Sets the vertical icon alignment within the layout. One of
prefuse.Constants#TOP
, prefuse.Constants#BOTTOM
, or
prefuse.Constants#CENTER
. The default is a centered icon.
the desired vertical icon alignment
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.
the vertical padding
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.
the vertical padding
Gets the vertical text alignment within the layout.
Gets the vertical text alignment within the layout. One of
prefuse.Constants#TOP
, prefuse.Constants#BOTTOM
, or
prefuse.Constants#CENTER
. The default is centered text.
the vertical text alignment
Sets the vertical text alignment within the layout.
Sets the vertical text alignment within the layout. One of
prefuse.Constants#TOP
, prefuse.Constants#BOTTOM
, or
prefuse.Constants#CENTER
. The default is centered text.
the desired vertical text alignment
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(String)
method. To perform custom String selection, subclass this Renderer and override the#getText(VisualItem)
method. When the text field isnull
, 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(String)
method. The value of the icon field should be anIcon
instance to use.The position of the icon relative to text can be set using the
#setIconPosition(int)
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(int)
). By default, both the text and icon are centered along both the horizontal and vertical directions.