public class TextCell extends AbstractContainer<GuiOutputManager>
Modifier and Type | Class and Description |
---|---|
static class |
TextCell.VerticalAlignment
Defines vertical alignment enumeration type.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
bold
Flag indicating if the text must be bold.
|
private CoordinatesConversion |
cc
Coordinate converter
|
private GuiColorResolver |
colorResolver
The colors resolver
|
private GuiFontResolver |
fontResolver
Font resolver
|
private GuiDriver |
gd
Screen driver
|
private double |
heightInChars
Represents the cell's height given in character units
|
private ColorRgb |
preferredBgColor
The preferred background color
|
private ColorRgb |
preferredFgColor
The preferred foreground color
|
private GuiOutputManager |
screen
Output manager
|
private boolean |
selected
Indicates that this text cell is selected or not.
|
private java.lang.String |
text
The given displayed text
|
private TextCell.VerticalAlignment |
verticalAlignment
The given vertical alignment of the displayed text within this cell.
|
private GuiWidgetFactory |
widgetsFactory
GUI widgets factory
|
private double |
widthInChars
Represents the cell's width given in character units
|
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
TextCell(double widthInChars,
double heightInChars,
java.lang.String text,
GuiColorResolver colorResolver,
GuiFontResolver fontResolver)
Creates this text cell using the given size in character units and displaying the given
text at the bottom.
|
TextCell(double widthInChars,
double heightInChars,
java.lang.String text,
TextCell.VerticalAlignment verticalAlignment,
GuiColorResolver colorResolver,
GuiFontResolver fontResolver)
Creates this text cell using the given size in character units and displaying the given
text according its vertical alignment.
|
Modifier and Type | Method and Description |
---|---|
private int |
calculateYOffset(int cellHeight,
int fontHeight)
Calculates the vertical offset of this text cell.
|
Dimension |
dimension()
Calculates the size of this widget in character units.
|
void |
draw()
Implements the main method for drawing this widget.
|
ColorRgb |
getPreferredBgColor()
Gets the preferred background color.
|
ColorRgb |
getPreferredFgColor()
Gets the preferred foreground color.
|
java.lang.String |
getText()
Gets the displayed text.
|
double |
height()
Returns the height of this widget.
|
boolean |
isSelected()
Tests if the displayed text is selected
|
Dimension |
minimumSize()
Returns the minimum size of this cell text.
|
void |
setBold(boolean bold)
Set the
bold flag. |
void |
setColorResolver(GuiColorResolver colorResolver)
Sets the new color resolver.
|
void |
setFontResolver(GuiFontResolver fontResolver)
Sets the new font resolver.
|
void |
setPreferredBgColor(ColorRgb preferredBgColor)
Sets the preferred background color.
|
void |
setPreferredFgColor(ColorRgb preferredFgColor)
Sets the preferred foreground color.
|
void |
setSelected(boolean selected)
Sets the selected state of the displayed text.
|
void |
setSize(double width,
double height)
Sets the new size of this text cell.
|
void |
setText(java.lang.String text)
Sets the displayed text.
|
double |
width()
Returns the width of this widget.
|
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, currentFocus, cycleFocus, defaultFocus, deregisterSelectedWidget, destroy, detach, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusTraversable, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, insets, lastFocus, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, processKeyEvent, reflectAncestorChange, reflectLocationChange, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setTabItemList, setWidth, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, config, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unregisterWidgetStateListener, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
widgetsAsList
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, config, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isDirectManipulable, isDirectManipulationActive, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetStateListener, validateDisplayValue, window
private GuiDriver gd
private GuiOutputManager screen
private GuiWidgetFactory widgetsFactory
private CoordinatesConversion cc
private double widthInChars
private double heightInChars
private java.lang.String text
private TextCell.VerticalAlignment verticalAlignment
private boolean selected
private ColorRgb preferredBgColor
private ColorRgb preferredFgColor
private GuiColorResolver colorResolver
private GuiFontResolver fontResolver
private boolean bold
public TextCell(double widthInChars, double heightInChars, java.lang.String text, GuiColorResolver colorResolver, GuiFontResolver fontResolver)
widthInChars
- The given width in character unitsheightInChars
- The given height in character unitstext
- The given textcolorResolver
- The color resolverfontResolver
- The font resolverpublic TextCell(double widthInChars, double heightInChars, java.lang.String text, TextCell.VerticalAlignment verticalAlignment, GuiColorResolver colorResolver, GuiFontResolver fontResolver)
widthInChars
- The given width in character unitsheightInChars
- The given height in character unitstext
- The given textverticalAlignment
- The given vertical alignmentcolorResolver
- The color resolverfontResolver
- The font resolverpublic java.lang.String getText()
public void setText(java.lang.String text)
text
- The text to setpublic boolean isSelected()
public void setSelected(boolean selected)
selected
- The selected state to setpublic ColorRgb getPreferredBgColor()
public void setPreferredBgColor(ColorRgb preferredBgColor)
preferredBgColor
- The preferred background color to setpublic ColorRgb getPreferredFgColor()
public void setPreferredFgColor(ColorRgb preferredFgColor)
preferredFgColor
- The preferred foreground color to setpublic Dimension dimension()
dimension
in interface Widget<GuiOutputManager>
dimension
in class AbstractContainer<GuiOutputManager>
public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class AbstractContainer<GuiOutputManager>
public void setFontResolver(GuiFontResolver fontResolver)
fontResolver
- The font resolverpublic void setColorResolver(GuiColorResolver colorResolver)
colorResolver
- The color resolverprivate int calculateYOffset(int cellHeight, int fontHeight)
cellHeight
- The cell heightfontHeight
- The font heightpublic double height()
height
in interface Widget<GuiOutputManager>
height
in class AbstractContainer<GuiOutputManager>
public Dimension minimumSize()
minimumSize
in interface Widget<GuiOutputManager>
minimumSize
in class AbstractContainer<GuiOutputManager>
public double width()
width
in interface Widget<GuiOutputManager>
width
in class AbstractContainer<GuiOutputManager>
public void setBold(boolean bold)
bold
flag.bold
- The new bold value.public void setSize(double width, double height)
setSize
in interface Container<GuiOutputManager>
setSize
in class AbstractContainer<GuiOutputManager>
width
- The new widthheight
- The new height