Class TagView
java.lang.Object
javax.swing.text.View
javax.swing.text.CompositeView
javax.swing.text.BoxView
net.simplace.ui.xmleditorkit.TagView
- All Implemented Interfaces:
SwingConstants
View of an XML tag: its rows are laid out vertically, indented by the collapse area. Tags with children show a
box to collapse them to their first row.
- Author:
- Stanislav Lapitsky
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intsize of the collapse box and left indent of the content in pixelsFields 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 TypeMethodDescriptionfloatgetAlignment(int axis) floatgetMaximumSpan(int axis) floatgetMinimumSpan(int axis) protected intgetNextEastWestVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) Moves the caret horizontally; in a collapsed tag the caret skips the hidden rows (to the end of the tag or back to the first row).floatgetPreferredSpan(int axis) booleanvoidPaints the tag (clipped to its allocation if collapsed) and, if it has more than one row, the collapse box with a plus or minus sign and the line to the end tag.voidsetExpanded(boolean expanded) Methods inherited from class BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModelMethods inherited from class CompositeView
getBottomInset, getInsideAllocation, getLeftInset, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, loadChildren, modelToView, setInsets, setParagraphInsets, setParentMethods inherited from class View
append, breakView, changedUpdate, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, updateChildren, updateLayout, viewToModel
-
Field Details
-
AREA_SHIFT
public static final int AREA_SHIFTsize of the collapse box and left indent of the content in pixels- See Also:
-
-
Constructor Details
-
TagView
- Parameters:
elem- the tag element of the document
-
-
Method Details
-
getAlignment
public float getAlignment(int axis) - Overrides:
getAlignmentin classBoxView- Parameters:
axis- the axis- Returns:
- always 0 (left/top aligned)
-
paint
-
getPreferredSpan
public float getPreferredSpan(int axis) - Overrides:
getPreferredSpanin classBoxView- Parameters:
axis- the axis- Returns:
- the preferred span; if collapsed, the height of the first row only
-
getMinimumSpan
public float getMinimumSpan(int axis) - Overrides:
getMinimumSpanin classBoxView- Parameters:
axis- the axis- Returns:
- the minimum span; if collapsed, the height of the first row only
-
getMaximumSpan
public float getMaximumSpan(int axis) - Overrides:
getMaximumSpanin classBoxView- Parameters:
axis- the axis- Returns:
- the preferred span
-
isExpanded
public boolean isExpanded()- Returns:
trueif the children of the tag are shown
-
setExpanded
public void setExpanded(boolean expanded) - Parameters:
expanded-trueto show the children,falseto collapse the tag
-
getNextEastWestVisualPositionFrom
protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) throws BadLocationException Moves the caret horizontally; in a collapsed tag the caret skips the hidden rows (to the end of the tag or back to the first row).- Overrides:
getNextEastWestVisualPositionFromin classCompositeView- Parameters:
pos- the current positionb- the bias of the positiona- the allocated areadirection-SwingConstants.EASTorWESTbiasRet- returns the bias of the new position- Returns:
- the new position
- Throws:
BadLocationException- if the position is invalid
-