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 ViewFactoryprivate float(package private) JXLabel(package private) booleanprivate Viewprivate floatFields inherited from class View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISFields inherited from interface 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.intfloatgetPreferredSpan(int axis) getView(int n) Gets the n-th view in this container.intReturns 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.intgetWidth()voidRenders the view.voidpreferenceChanged(View child, boolean width, boolean height) voidSets the view parent.voidsetSize(float width, float height) Sets the view size.protected voidMethods inherited from class WrappedPlainView
calculateBreakPosition, changedUpdate, drawLine, drawLine, drawSelectedText, drawSelectedText, drawUnselectedText, drawUnselectedText, getLineBuffer, getMaximumSpan, getMinimumSpan, getTabSize, insertUpdate, loadChildren, nextTabStop, removeUpdateMethods inherited from class 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, viewToModelMethods inherited from class CompositeView
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getViewAtPosition, getViewIndex, getViewIndexAtPosition, modelToView, setInsets, setParagraphInsetsMethods inherited from class 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:
updateLayoutin classView
-
preferenceChanged
- Overrides:
preferenceChangedin 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:
getAttributesin classView
-
paint
Renders the view.- Overrides:
paintin classWrappedPlainView- Parameters:
g- the graphics contextallocation- the region to render into
-
setParent
Sets the view parent.- Overrides:
setParentin 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:
getViewCountin classCompositeView- Returns:
- the number of views
- See Also:
-
getView
Gets the n-th view in this container.- Overrides:
getViewin classCompositeView- Parameters:
n- the number of the view to get- Returns:
- the view
-
getDocument
Returns the document model underlying the view.- Overrides:
getDocumentin classView- Returns:
- the model
-
setSize
public void setSize(float width, float height) Sets the view size.- Overrides:
setSizein classWrappedPlainView- Parameters:
width- the widthheight- the height
-
getPreferredSpan
public float getPreferredSpan(int axis) - Overrides:
getPreferredSpanin 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:
getContainerin 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:
getViewFactoryin classView- Returns:
- the factory
-
getWidth
-
getHeight
-