Boxes can be sized explicitly via dimensions(int, int) or left to
autosize based on content. When no dimensions are set, width and height are
derived from the longest line and line count of the content respectively.
The rendered string is cached after the first call to get() and
invalidated whenever content(String) or content(String, TextAlign)
is called.
Note
This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private TextAlign | |
| private final BorderChars | |
| private static final String | |
| private String | |
| private final BoxConfiguration | |
| private String | |
| private int | |
| private static final String | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Box | |
| public Box | |
| public Box | Returns: this box instancethe total outer width of the box; must be greater than 0 width, int the total outer height of the box; must be greater than 0 height)Sets explicit dimensions for this box. |
| public boolean | equals(Object o)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public String | Returns: the rendered box as a stringImplements io. Renders and returns the box as a string. |
| public int | |
| private void | |
| private void | |
| pack-priv WidthAwareList | |
| pack-priv void | |
| pack-priv TextAlign | |
| public String | |
| pack-priv void |
| align | back to summary |
|---|---|
| private TextAlign align | |
| borderChars | back to summary |
|---|---|
| private final BorderChars borderChars | |
| BOX_CONTENT_NOT_NULL | back to summary |
|---|---|
| private static final String BOX_CONTENT_NOT_NULL | |
| cachedString | back to summary |
|---|---|
| private String cachedString | |
| configuration | back to summary |
|---|---|
| private final BoxConfiguration configuration | |
| content | back to summary |
|---|---|
| private String content | |
| height | back to summary |
|---|---|
| private int height | |
| TEXT_ALIGN_NOT_NULL | back to summary |
|---|---|
| private static final String TEXT_ALIGN_NOT_NULL | |
| width | back to summary |
|---|---|
| private int width | |
| Box | back to summary |
|---|---|
| public Box(BoxType type, BoxConfiguration configuration) | |
| Box | back to summary |
|---|---|
| public Box(BoxType type) | |
| Box | back to summary |
|---|---|
| public Box(BoxConfiguration configuration) | |
| Box | back to summary |
|---|---|
| public Box() | |
| content | back to summary |
|---|---|
| public Box content(String content) Sets the content of this box and invalidates the render cache. Text alignment is inherited from the
| |
| content | back to summary |
|---|---|
| public Box content(String content, TextAlign align) Sets the content and text alignment of this box, invalidating the render cache. The provided
| |
| dimensions | back to summary |
|---|---|
| public Box dimensions(int width, int height) Sets explicit dimensions for this box. When dimensions are set, content that exceeds the usable inner width
(width minus padding) or the specified height will throw an
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| get | back to summary |
|---|---|
| public String get() Implements io. Renders and returns the box as a string. The result is cached after the first invocation and reused on subsequent
calls until the content is updated. Text alignment is resolved from the
per-call override set via
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| nullCachedString | back to summary |
|---|---|
| private void nullCachedString() | |
| resolveDimensions | back to summary |
|---|---|
| private void resolveDimensions(WidthAwareList cells) | |
| resolveLines | back to summary |
|---|---|
| pack-priv WidthAwareList resolveLines() | |
| styleBorders | back to summary |
|---|---|
| pack-priv void styleBorders() | |
| textAlign | back to summary |
|---|---|
| pack-priv TextAlign textAlign() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| validateTypeAndConfig | back to summary |
|---|---|
| pack-priv void validateTypeAndConfig(BoxType type, BoxConfiguration config) | |