Methods Summary |
---|
public float | getAlignment(int axis)Gets the alignment for an axis.
if (axis == View.X_AXIS) {
return 0;
}
return super.getAlignment(axis);
|
protected int | getCharactersPerTab()
return 8;
|
public float | getMinimumSpan(int axis)Determines the minimum span for this view along an
axis. The preformatted line should refuse to be
sized less than the preferred size.
return getPreferredSpan(axis);
|
protected float | getPreTab(float x, int tabOffset)Returns the location for the tab.
Document d = getDocument();
View v = getViewAtPosition(tabOffset, null);
if ((d instanceof StyledDocument) && v != null) {
// Assume f is fixed point.
Font f = ((StyledDocument)d).getFont(v.getAttributes());
Container c = getContainer();
FontMetrics fm = (c != null) ? c.getFontMetrics(f) :
Toolkit.getDefaultToolkit().getFontMetrics(f);
int width = getCharactersPerTab() * fm.charWidth('W");
int tb = (int)getTabBase();
return (float)((((int)x - tb) / width + 1) * width + tb);
}
return 10.0f + x;
|
public int | getResizeWeight(int axis)Gets the resize weight for the specified axis.
switch (axis) {
case View.X_AXIS:
return 1;
case View.Y_AXIS:
return 0;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
|
public boolean | isVisible()Preformatted lines are not suppressed if they
have only whitespace, so they are always visible.
return true;
|
protected void | layout(int width, int height)Lays out the children. If the layout span has changed,
the rows are rebuilt. The superclass functionality
is called after checking and possibly rebuilding the
rows. If the height has changed, the
preferenceChanged method is called
on the parent since the vertical preference is
rigid.
super.layout(Integer.MAX_VALUE - 1, height);
|
public float | nextTabStop(float x, int tabOffset)Returns the next tab stop position given a reference position.
This view implements the tab coordinate system, and calls
getTabbedSpan on the logical children in the process
of layout to determine the desired span of the children. The
logical children can delegate their tab expansion upward to
the paragraph which knows how to expand tabs.
LabelView is an example of a view that delegates
its tab expansion needs upward to the paragraph.
This is implemented to try and locate a TabSet
in the paragraph element's attribute set. If one can be
found, its settings will be used, otherwise a default expansion
will be provided. The base location for for tab expansion
is the left inset from the paragraphs most recent allocation
(which is what the layout of the children is based upon).
// If the text isn't left justified, offset by 10 pixels!
if (getTabSet() == null &&
StyleConstants.getAlignment(getAttributes()) ==
StyleConstants.ALIGN_LEFT) {
return getPreTab(x, tabOffset);
}
return super.nextTabStop(x, tabOffset);
|