Class MultiRowLayout

java.lang.Object
docking.widgets.fieldpanel.support.MultiRowLayout
All Implemented Interfaces:
Layout

public class MultiRowLayout extends Object implements Layout
Handles layouts with muliple rows.
  • Constructor Details

    • MultiRowLayout

      public MultiRowLayout(RowLayout layout, int indexSize)
      Constructs a new MultiRowLayout with a single layout row.
      Parameters:
      layout - the single layout to add to this MultiRowLayout.
    • MultiRowLayout

      public MultiRowLayout(RowLayout[] layouts, int indexSize)
  • Method Details

    • getHeight

      public int getHeight()
      Description copied from interface: Layout
      Returns the total height of this layout.
      Specified by:
      getHeight in interface Layout
    • getCompressableWidth

      public int getCompressableWidth()
      Description copied from interface: Layout
      Returns the smallest possible width of this layout that can display its full contents
      Specified by:
      getCompressableWidth in interface Layout
      Returns:
      the smallest possible width of this layout that can display its full contents
    • getNumFields

      public int getNumFields()
      Description copied from interface: Layout
      Returns the number of Fields in this Layout.
      Specified by:
      getNumFields in interface Layout
    • getField

      public Field getField(int index)
      Description copied from interface: Layout
      Returns the i'th Field in this Layout.
      Specified by:
      getField in interface Layout
      Parameters:
      index - the index of the field to retrieve.
    • paint

      public void paint(JComponent c, Graphics g, PaintContext context, Rectangle rect, LayoutBackgroundColorManager colorManager, FieldLocation cursorLocation)
      Description copied from interface: Layout
      Paints this layout on the screen.
      Specified by:
      paint in interface Layout
      Parameters:
      g - The graphics context with which to paint.
      context - contains various information needed to do the paint
      rect - the screen area that needs to be painted.
      colorManager - indicates where the selection exists
      cursorLocation - the location of the cursor or null if the cursor is not in this layout
    • setCursor

      public int setCursor(FieldLocation cursorLoc, int x, int y)
      Description copied from interface: Layout
      Sets 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:
      setCursor in interface Layout
      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.
    • getFieldIndex

      public int getFieldIndex(int x, int y)
      Description copied from interface: Layout
      Returns the index of the field at the given coordinates (relative to the layout)
      Specified by:
      getFieldIndex in interface Layout
      Parameters:
      x - the x coordinate
      y - the y coordinate
      Returns:
      the index of the field at the given coordinates (relative to the layout)
    • getCursorRect

      public Rectangle getCursorRect(int fieldNum, int row, int col)
      Description copied from interface: Layout
      Returns a rectangle which bounds the given cursor position.
      Specified by:
      getCursorRect in interface Layout
      Parameters:
      fieldNum - the index of the field containing the cursor position.
      row - the the text row in the field containing the cursor position.
      col - the character position in the row containing the cursor position.
    • cursorUp

      public boolean cursorUp(FieldLocation cursorLoc, int lastX)
      Description copied from interface: Layout
      Moves the cursor up one row from its current position.
      Specified by:
      cursorUp in interface Layout
      Parameters:
      cursorLoc - the cursor location object to be modified
      lastX - the x coordinate of the cursor before the move.
      Returns:
      true if the cursor was successfully moved up without leaving the layout.
    • cursorDown

      public boolean cursorDown(FieldLocation cursorLoc, int lastX)
      Description copied from interface: Layout
      Moves the cursor up down row from its current position.
      Specified by:
      cursorDown in interface Layout
      Parameters:
      cursorLoc - the cursor location object to be modified
      lastX - the x coordinate of the cursor before the move.
      Returns:
      true if the cursor was successfully moved down without leaving the layout.
    • cursorBeginning

      public int cursorBeginning(FieldLocation cursorLoc)
      Description copied from interface: Layout
      Sets the given FieldLocation as far to the left as possible.
      Specified by:
      cursorBeginning in interface Layout
      Parameters:
      cursorLoc - the cursor location object to be modified.
      Returns:
      the x coordinate of the cursor after the operation.
    • cursorEnd

      public int cursorEnd(FieldLocation cursorLoc)
      Description copied from interface: Layout
      Sets the given FieldLocation as far to the right as possible.
      Specified by:
      cursorEnd in interface Layout
      Parameters:
      cursorLoc - the cursor location object to be modified.
      Returns:
      the x coordinate of the cursor after the operation.
    • cursorLeft

      public int cursorLeft(FieldLocation cursorLoc)
      Description copied from interface: Layout
      Sets 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:
      cursorLeft in interface Layout
      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

      public int cursorRight(FieldLocation cursorLoc)
      Description copied from interface: Layout
      Sets 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:
      cursorRight in interface Layout
      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

      public boolean enterLayout(FieldLocation cursorLoc, int lastX, boolean fromTop)
      Description copied from interface: Layout
      Tries to move the cursor into this layout.
      Specified by:
      enterLayout in interface Layout
      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: Layout
      Returns the amount to scroll to reveal the line of text.
      Specified by:
      getScrollableUnitIncrement in interface Layout
      Parameters:
      topOfScreen - the y coordinate that represents the top or bottom of the screen
      direction - the direction to scroll
    • contains

      public boolean contains(int yPos)
      Description copied from interface: Layout
      Returns true if the the given yPos lies within this layout.
      Specified by:
      contains in interface Layout
      Parameters:
      yPos - the vertical coordinate to check if in this layout.
    • getPrimaryOffset

      public int getPrimaryOffset()
      Description copied from interface: Layout
      Returns the vertical offset (in pixels) of the start of the primary field in the layout.
      Specified by:
      getPrimaryOffset in interface Layout
      Returns:
      -1 if layout does not have a primary field.
    • getFieldBounds

      public Rectangle getFieldBounds(int index)
      Description copied from interface: Layout
      Returns the bounds of the given field (in coordinates relative to the layout)
      Specified by:
      getFieldBounds in interface Layout
      Parameters:
      index - the field id for the field for which to get bounds
    • insertSpaceAbove

      public void insertSpaceAbove(int size)
      Description copied from interface: Layout
      Inserts empty space above the layout
      Specified by:
      insertSpaceAbove in interface Layout
      Parameters:
      size - the amount of space to insert above the layout
    • insertSpaceBelow

      public void insertSpaceBelow(int size)
      Description copied from interface: Layout
      Inserts empty space below the layout
      Specified by:
      insertSpaceBelow in interface Layout
      Parameters:
      size - the amount of space to insert below the layout
    • fillHeights

      public void fillHeights(int[] rowHeights)
      Fills in the given array with the heights of all the layouts in the MultiRowLayout
      Parameters:
      rowHeights - the array to be filled in with heights. Each height is stored at its layoutRow id as the index into the array.
    • align

      public void align(int[] rowHeights)
      Aligns the heights in this MultiRowLayout to match those in the give row heights array. Extra is inserted to align the rows in this layout to match those specified in the given array.
      Parameters:
      rowHeights - the aray of row height to align to.
    • getIndexSize

      public int getIndexSize()
      Description copied from interface: Layout
      Returns the number of indexes consumed by this layout.
      Specified by:
      getIndexSize in interface Layout
    • getBeginRowFieldNum

      public int getBeginRowFieldNum(int fieldIndex)
      Specified by:
      getBeginRowFieldNum in interface Layout
    • getEndRowFieldNum

      public int getEndRowFieldNum(int fieldIndex)
      Specified by:
      getEndRowFieldNum in interface Layout
    • getFirstRowID

      public int getFirstRowID()