Package com.tonic.vellum.widget
Class ScrollSection
- java.lang.Object
-
- com.tonic.vellum.Section
-
- com.tonic.vellum.widget.ScrollSection
-
- Direct Known Subclasses:
LogSection
public class ScrollSection extends Section
Vertically scrollable lines of text, scrolled with UP/DOWN/PAGE_UP/PAGE_DOWN/HOME/END. Optional follow-tail keeps the view pinned to the bottom as lines are appended.
-
-
Constructor Summary
Constructors Constructor Description ScrollSection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScrollSectionfollowTail(boolean follow)Sets whether the view stays pinned to the bottom as lines are appended.intlineCount()ScrollSectionmaxLines(int max)Caps the retained lines, dropping the oldest beyondmax; 0 means unlimited.intscrollTop()ScrollSectionsetLines(java.util.List<java.lang.String> newLines)Replaces all lines; scrolls to the bottom when following the tail.ScrollSectionstyle(Style style)Sets the text style.ScrollSectionwrap(boolean wrap)Enables width-aware word wrapping; scrolling then operates over wrapped display lines.
-
-
-
Method Detail
-
maxLines
public ScrollSection maxLines(int max)
Caps the retained lines, dropping the oldest beyondmax; 0 means unlimited.- Parameters:
max- the maximum retained lines, or 0 for unlimited- Returns:
- this ScrollSection for chaining
-
followTail
public ScrollSection followTail(boolean follow)
Sets whether the view stays pinned to the bottom as lines are appended. Enabling it scrolls to the bottom immediately.- Parameters:
follow-trueto follow the tail- Returns:
- this ScrollSection for chaining
-
wrap
public ScrollSection wrap(boolean wrap)
Enables width-aware word wrapping; scrolling then operates over wrapped display lines.- Parameters:
wrap-trueto enable wrapping- Returns:
- this ScrollSection for chaining
-
style
public ScrollSection style(Style style)
Sets the text style.- Parameters:
style- the style- Returns:
- this ScrollSection for chaining
-
setLines
public ScrollSection setLines(java.util.List<java.lang.String> newLines)
Replaces all lines; scrolls to the bottom when following the tail.- Parameters:
newLines- the new lines- Returns:
- this ScrollSection for chaining
-
lineCount
public int lineCount()
- Returns:
- the number of logical lines
-
scrollTop
public int scrollTop()
- Returns:
- the index of the first visible line
-
-