Class RowLayout
java.lang.Object
docking.widgets.fieldpanel.support.RowLayout
- All Implemented Interfaces:
Layout
- Direct Known Subclasses:
SingleRowLayout
RowLayout handles a single row layout that may be part of a multiple row layout that
is generic enough to be used by the SingleRowLayout or the MultiRowLayout.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int yPos) Returns true if the given yPos lies within this layout.intcursorBeginning(FieldLocation cursorLoc) Sets the given FieldLocation as far to the left as possible.booleancursorDown(FieldLocation cursorLoc, int lastX) Moves the cursor up down row from its current position.intcursorEnd(FieldLocation cursorLoc) Sets the given FieldLocation as far to the right as possible.intcursorLeft(FieldLocation cursorLoc) Sets the given FieldLocation one position to the left.intcursorRight(FieldLocation cursorLoc) Sets the given FieldLocation one position to the right.booleancursorUp(FieldLocation cursorLoc, int lastX) Moves the cursor up one row from its current position.booleanenterLayout(FieldLocation cursorLoc, int lastX, boolean fromTop) Tries to move the cursor into this layout.intgetBeginRowFieldNum(int field1) intReturns the smallest possible width of this layout that can display its full contentsgetCursorRect(int fieldNum, int row, int col) Returns a rectangle which bounds the given cursor position.intgetEndRowFieldNum(int field2) getField(int index) Returns the i'th Field in this Layout.getFieldBounds(int index) Returns the bounds of the given field (in coordinates relative to the layout)intgetFieldIndex(int x, int y) Returns the index of the field at the given coordinates (relative to the layout)intReturns the total height of this layout.intReturns the height above the baseline.intReturns the height below the baseline.intReturns the number of indexes consumed by this layout.intReturns the number of Fields in this Layout.intReturns the vertical offset (in pixels) of the start of the primary field in the layout.intgetRowID()Returns the row number of this layout with respect to its containing layout.intgetScrollableUnitIncrement(int topOfScreen, int direction) Returns the amount to scroll to reveal the line of text.voidinsertSpaceAbove(int size) Inserts empty space above the layoutvoidinsertSpaceBelow(int size) Inserts empty space below the layoutvoidpaint(JComponent c, Graphics g, PaintContext context, Rectangle rect, LayoutBackgroundColorManager colorManager, FieldLocation cursorLocation) Paints this layout on the screen.intsetCursor(FieldLocation cursorLoc, int x, int y) Sets the cursor to the given point location.toString()
-
Constructor Details
-
RowLayout
Constructs a RowLayout from an array of fields- Parameters:
fields- the set of fields that make up the entire layoutrowID- the rowID of this row layout in the overall layout.
-
-
Method Details
-
getHeight
public int getHeight()Description copied from interface:LayoutReturns the total height of this layout. -
getCompressableWidth
public int getCompressableWidth()Description copied from interface:LayoutReturns the smallest possible width of this layout that can display its full contents- Specified by:
getCompressableWidthin interfaceLayout- Returns:
- the smallest possible width of this layout that can display its full contents
-
getHeightAbove
public int getHeightAbove()Returns the height above the baseline.- Returns:
- the height above the baseline.
-
getHeightBelow
public int getHeightBelow()Returns the height below the baseline.- Returns:
- the height below the baseline.
-
getRowID
public int getRowID()Returns the row number of this layout with respect to its containing layout.- Returns:
- the row number of this layout with respect to its containing layout.
-
insertSpaceAbove
public void insertSpaceAbove(int size) Description copied from interface:LayoutInserts empty space above the layout- Specified by:
insertSpaceAbovein interfaceLayout- Parameters:
size- the amount of space to insert above the layout
-
insertSpaceBelow
public void insertSpaceBelow(int size) Description copied from interface:LayoutInserts empty space below the layout- Specified by:
insertSpaceBelowin interfaceLayout- Parameters:
size- the amount of space to insert below the layout
-
getNumFields
public int getNumFields()Description copied from interface:LayoutReturns the number of Fields in this Layout.- Specified by:
getNumFieldsin interfaceLayout
-
getField
Description copied from interface:LayoutReturns the i'th Field in this Layout. -
paint
public void paint(JComponent c, Graphics g, PaintContext context, Rectangle rect, LayoutBackgroundColorManager colorManager, FieldLocation cursorLocation) Description copied from interface:LayoutPaints this layout on the screen.- Specified by:
paintin interfaceLayout- Parameters:
g- The graphics context with which to paint.context- contains various information needed to do the paintrect- the screen area that needs to be painted.colorManager- indicates where the selection existscursorLocation- the location of the cursor or null if the cursor is not in this layout
-
setCursor
Description copied from interface:LayoutSets the cursor to the given point location. The cursor will be positioned to the row column position that is closest to the given point.- Specified by:
setCursorin interfaceLayout- Parameters:
cursorLoc- the location that is to be filled in.x- the x coordinate of the point to be translated into a cursor location.y- the y coordinate of the point to be translated into a cursor location.- Returns:
- the x coordinated of the computed cursor location.
-
getCursorRect
Description copied from interface:LayoutReturns a rectangle which bounds the given cursor position.- Specified by:
getCursorRectin interfaceLayout- Parameters:
fieldNum- the index of the field containing the cursor position.row- the text row in the field containing the cursor position.col- the character position in the row containing the cursor position.
-
cursorUp
Description copied from interface:LayoutMoves the cursor up one row from its current position. -
cursorDown
Description copied from interface:LayoutMoves the cursor up down row from its current position.- Specified by:
cursorDownin interfaceLayout- Parameters:
cursorLoc- the cursor location object to be modifiedlastX- the x coordinate of the cursor before the move.- Returns:
- true if the cursor was successfully moved down without leaving the layout.
-
cursorBeginning
Description copied from interface:LayoutSets the given FieldLocation as far to the left as possible.- Specified by:
cursorBeginningin interfaceLayout- Parameters:
cursorLoc- the cursor location object to be modified.- Returns:
- the x coordinate of the cursor after the operation.
-
cursorEnd
Description copied from interface:LayoutSets the given FieldLocation as far to the right as possible. -
cursorLeft
Description copied from interface:LayoutSets the given FieldLocation one position to the left. If already at the left most position, it tries to move to the end of the previous row.- Specified by:
cursorLeftin interfaceLayout- Parameters:
cursorLoc- the cursor location object to be modified.- Returns:
- the x coordinate of the cursor after the operation. Returns -1 if it was already at the top, left most position.
-
cursorRight
Description copied from interface:LayoutSets the given FieldLocation one position to the right. If already at the right most position, it tries to move to the beginning of the next row.- Specified by:
cursorRightin interfaceLayout- Parameters:
cursorLoc- the cursor location object to be modified.- Returns:
- the x coordinate of the cursor after the operation. Returns -1 if it was already at the bottom, right most position.
-
enterLayout
Description copied from interface:LayoutTries to move the cursor into this layout.- Specified by:
enterLayoutin interfaceLayout- Parameters:
cursorLoc- the field location to hold new location.lastX- the last valid x coordinate.fromTop- true if entering from the above this layout- Returns:
- true if the cursor successfully moves into this layout.
-
getScrollableUnitIncrement
public int getScrollableUnitIncrement(int topOfScreen, int direction) Description copied from interface:LayoutReturns the amount to scroll to reveal the line of text.- Specified by:
getScrollableUnitIncrementin interfaceLayout- Parameters:
topOfScreen- the y coordinate that represents the top or bottom of the screendirection- the direction to scroll
-
contains
public boolean contains(int yPos) Description copied from interface:LayoutReturns true if the given yPos lies within this layout. -
getPrimaryOffset
public int getPrimaryOffset()Description copied from interface:LayoutReturns the vertical offset (in pixels) of the start of the primary field in the layout.- Specified by:
getPrimaryOffsetin interfaceLayout- Returns:
- -1 if layout does not have a primary field.
-
getFieldBounds
Description copied from interface:LayoutReturns the bounds of the given field (in coordinates relative to the layout)- Specified by:
getFieldBoundsin interfaceLayout- Parameters:
index- the field id for the field for which to get bounds
-
getIndexSize
public int getIndexSize()Description copied from interface:LayoutReturns the number of indexes consumed by this layout.- Specified by:
getIndexSizein interfaceLayout
-
getBeginRowFieldNum
public int getBeginRowFieldNum(int field1) - Specified by:
getBeginRowFieldNumin interfaceLayout
-
getEndRowFieldNum
public int getEndRowFieldNum(int field2) - Specified by:
getEndRowFieldNumin interfaceLayout
-
getFieldIndex
public int getFieldIndex(int x, int y) Description copied from interface:LayoutReturns the index of the field at the given coordinates (relative to the layout)- Specified by:
getFieldIndexin interfaceLayout- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the index of the field at the given coordinates (relative to the layout)
-
toString
-