Package org.jdesktop.swingx
Class JXLabel.Renderer
java.lang.Object
javax.swing.text.View
javax.swing.text.CompositeView
javax.swing.text.BoxView
javax.swing.text.WrappedPlainView
org.jdesktop.swingx.JXLabel.Renderer
- All Implemented Interfaces:
SwingConstants
,TabExpander
- Enclosing class:
JXLabel
Root text view that acts as an renderer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ViewFactory
private float
(package private) JXLabel
(package private) boolean
private View
private float
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFetches the attributes to use when rendering.Fetches the container hosting the view.Returns the document model underlying the view.int
float
getPreferredSpan
(int axis) getView
(int n) Gets the n-th view in this container.int
Returns the number of views in this view.Fetches the factory to be used for building the various view fragments that make up the view that represents the model.int
getWidth()
void
Renders the view.void
preferenceChanged
(View child, boolean width, boolean height) void
Sets the view parent.void
setSize
(float width, float height) Sets the view size.protected void
Methods inherited from class javax.swing.text.WrappedPlainView
calculateBreakPosition, changedUpdate, drawLine, drawLine, drawSelectedText, drawSelectedText, drawUnselectedText, drawUnselectedText, getLineBuffer, getMaximumSpan, getMinimumSpan, getTabSize, insertUpdate, loadChildren, nextTabStop, removeUpdate
Methods inherited from class javax.swing.text.BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getOffset, getResizeWeight, getSpan, getViewAtPoint, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, replace, setAxis, viewToModel
Methods inherited from class javax.swing.text.CompositeView
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getViewAtPosition, getViewIndex, getViewIndexAtPosition, modelToView, setInsets, setParagraphInsets
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdateToView, getBreakWeight, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, viewToModel
-
Field Details
-
host
JXLabel host -
invalidated
boolean invalidated -
width
private float width -
height
private float height -
view
-
factory
-
-
Constructor Details
-
Renderer
Renderer(JXLabel c, ViewFactory f, View v, boolean wordWrap)
-
-
Method Details
-
updateLayout
- Overrides:
updateLayout
in classView
-
preferenceChanged
- Overrides:
preferenceChanged
in classBoxView
-
getAttributes
Fetches the attributes to use when rendering. At the root level there are no attributes. If an attribute is resolved up the view hierarchy this is the end of the line.- Overrides:
getAttributes
in classView
-
paint
Renders the view.- Overrides:
paint
in classWrappedPlainView
- Parameters:
g
- the graphics contextallocation
- the region to render into
-
setParent
Sets the view parent.- Overrides:
setParent
in classCompositeView
- Parameters:
parent
- the parent view
-
getViewCount
public int getViewCount()Returns the number of views in this view. Since this view simply wraps the root of the view hierarchy it has exactly one child.- Overrides:
getViewCount
in classCompositeView
- Returns:
- the number of views
- See Also:
-
getView
Gets the n-th view in this container.- Overrides:
getView
in classCompositeView
- Parameters:
n
- the number of the view to get- Returns:
- the view
-
getDocument
Returns the document model underlying the view.- Overrides:
getDocument
in classView
- Returns:
- the model
-
setSize
public void setSize(float width, float height) Sets the view size.- Overrides:
setSize
in classWrappedPlainView
- Parameters:
width
- the widthheight
- the height
-
getPreferredSpan
public float getPreferredSpan(int axis) - Overrides:
getPreferredSpan
in classWrappedPlainView
-
getContainer
Fetches the container hosting the view. This is useful for things like scheduling a repaint, finding out the host components font, etc. The default implementation of this is to forward the query to the parent view.- Overrides:
getContainer
in classView
- Returns:
- the container
-
getViewFactory
Fetches the factory to be used for building the various view fragments that make up the view that represents the model. This is what determines how the model will be represented. This is implemented to fetch the factory provided by the associated EditorKit.- Overrides:
getViewFactory
in classView
- Returns:
- the factory
-
getWidth
public int getWidth() -
getHeight
public int getHeight()
-