public abstract class BaseView extends View
Modifier and Type | Field and Description |
---|---|
protected int |
helperInd
Index of this view as child view in its parent.
|
protected Insets |
insets
Border insets of this view.
|
protected static int |
INSETS_BOTTOM
Bottom insets paint type.
|
protected static int |
INSETS_TOP
Top insets paint type.
|
protected static int |
MAIN_AREA
Main area paint type.
|
protected boolean |
packed
Is this view packed
|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Modifier and Type | Method and Description |
---|---|
void |
displayHierarchy()
Display view hierarchy on console.
|
float |
getAlignment(int axis)
Get aligment along an X_AXIS or Y_AXIS
|
protected abstract int |
getBaseX(int y) |
JTextComponent |
getComponent()
Get component hosting this view.
|
protected EditorUI |
getEditorUI()
Get editor UI
|
abstract int |
getHeight()
Get height of the view
|
Insets |
getInsets()
Get insets of this view.
|
protected abstract int |
getPaintAreas(Graphics g,
int clipY,
int clipHeight)
Returns binary composition of regions that should be painted.
|
protected abstract int |
getPosFromY(int y)
Get position when knowing y-coord
|
float |
getPreferredSpan(int axis)
Get preferred span over axis
|
protected int |
getStartY()
Get y base value for this view.
|
protected abstract int |
getViewStartY(BaseView view,
int helperInd)
Get child view's y base value.
|
protected abstract int |
getYFromPos(int pos)
Get y-coord value from position
|
protected void |
invalidateStartY()
Informs the view that if it had cached start y of itself
it should invalidate it as it is no longer valid and it should call
getViewStartY() to get updated value. |
boolean |
isPacked()
Getter for packed flag
|
void |
paint(Graphics g,
Shape allocation)
It divides painting into three areas:
INSETS_TOP, MAIN_AREA, INSETS_BOTTOM.
|
protected abstract void |
paintAreas(Graphics g,
int clipY,
int clipHeight,
int paintAreas)
Paint either top insets, main area, or bottom insets.
|
protected void |
setHelperInd(int ind)
This function is used to correct information
about which index this child view occupies in parent view's
array of children.
|
void |
setPacked(boolean packed)
Setter for packed flag
|
String |
toString() |
abstract void |
updateMainHeight()
Update height of main area as result of some important change.
|
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setParent, setSize, updateChildren, updateLayout, viewToModel, viewToModel
protected static final int INSETS_TOP
protected static final int MAIN_AREA
protected static final int INSETS_BOTTOM
protected boolean packed
protected int helperInd
protected Insets insets
public boolean isPacked()
public void setPacked(boolean packed)
public float getAlignment(int axis)
getAlignment
in class View
protected abstract int getYFromPos(int pos) throws BadLocationException
BadLocationException
protected abstract int getPosFromY(int y)
protected abstract int getBaseX(int y)
protected abstract int getPaintAreas(Graphics g, int clipY, int clipHeight)
g
- Graphics to paint throughclip
- clipping area of graphics objectprotected abstract void paintAreas(Graphics g, int clipY, int clipHeight, int paintAreas)
g
- Graphics to paint throughclip
- clipping area of graphics objectpaintAreas
- binary composition of paint areaspublic void paint(Graphics g, Shape allocation)
paintArea()
method until it returns false.
This implementation also supposes that allocation
is
instance of Rectangle
to save object creations. The root
view in TextUI implementation will take care to ensure child views will
get rectangle instances.public JTextComponent getComponent()
public Insets getInsets()
protected void setHelperInd(int ind)
protected abstract int getViewStartY(BaseView view, int helperInd)
view
- is child view of this view for which
the offset should be computed.helperInd
- is index that child view has cached to ease
the parent view to search for it in its children array.
If this index is correct, parent uses it. If it's incorrect
parent view searches through the whole array of its children
to find the child. It then calls children's
setParentInd()
to correct its location index.protected void invalidateStartY()
getViewStartY()
to get updated value.protected int getStartY()
public abstract int getHeight()
public abstract void updateMainHeight()
public float getPreferredSpan(int axis)
getPreferredSpan
in class View
protected EditorUI getEditorUI()
public void displayHierarchy()
Built on October 25 2023. | Copyright © 2017-2023 Apache Software Foundation. All Rights Reserved.