Package docking.widgets.fieldpanel

# Interface Layout

All Known Implementing Classes:
  `AnchoredLayout`, `MultiRowLayout`, `RowLayout`, `SingleRowLayout`

public interface Layout
Interface for a set of data fields that represent one indexable set of information in the model. The fields in a layout are arranged into rows. The height of the row is the height of the tallest field in that row. Each field contains one or more lines of text.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `contains(int yPos)`
  Returns true if the the given yPos lies within this layout.
  `int`
  `cursorBeginning(FieldLocation cursorLoc)`
  Sets the given FieldLocation as far to the left as possible.
  `boolean`
  `cursorDown(FieldLocation cursorLoc, int lastX)`
  Moves the cursor up down row from its current position.
  `int`
  `cursorEnd(FieldLocation cursorLoc)`
  Sets the given FieldLocation as far to the right as possible.
  `int`
  `cursorLeft(FieldLocation cursorLoc)`
  Sets the given FieldLocation one position to the left.
  `int`
  `cursorRight(FieldLocation cursorLoc)`
  Sets the given FieldLocation one position to the right.
  `boolean`
  `cursorUp(FieldLocation cursorLoc, int lastX)`
  Moves the cursor up one row from its current position.
  `boolean`
  `enterLayout(FieldLocation cursorLoc, int lastX, boolean fromTop)`
  Tries to move the cursor into this layout.
  `int`
  `getBeginRowFieldNum(int field1)`
  `int`
  `getCompressableWidth()`
  Returns the smallest possible width of this layout that can display its full contents
  `Rectangle`
  `getCursorRect(int fieldNum, int row, int col)`
  Returns a rectangle which bounds the given cursor position.
  `int`
  `getEndRowFieldNum(int field2)`
  `Field`
  `getField(int index)`
  Returns the i'th Field in this Layout.
  `Rectangle`
  `getFieldBounds(int index)`
  Returns the bounds of the given field (in coordinates relative to the layout)
  `int`
  `getFieldIndex(int x, int y)`
  Returns the index of the field at the given coordinates (relative to the layout)
  `int`
  `getHeight()`
  Returns the total height of this layout.
  `int`
  `getIndexSize()`
  Returns the number of indexes consumed by this layout.
  `int`
  `getNumFields()`
  Returns the number of Fields in this Layout.
  `int`
  `getPrimaryOffset()`
  Returns the vertical offset (in pixels) of the start of the primary field in the layout.
  `int`
  `getScrollableUnitIncrement(int topOfScreen, int direction)`
  Returns the amount to scroll to reveal the line of text.
  `void`
  `insertSpaceAbove(int size)`
  Inserts empty space above the layout
  `void`
  `insertSpaceBelow(int size)`
  Inserts empty space below the layout
  `void`
  `paint(JComponent c, Graphics g, PaintContext context, Rectangle rect, LayoutBackgroundColorManager layoutColorMap, FieldLocation cursorLocation)`
  Paints this layout on the screen.
  `int`
  `setCursor(FieldLocation cursorLoc, int x, int y)`
  Sets the cursor to the given point location.

- ## Method Details

  - ### getHeight

    int getHeight()
    Returns the total height of this layout.

  - ### getPrimaryOffset

    int getPrimaryOffset()
    Returns the vertical offset (in pixels) of the start of the primary field in the layout.
    Returns:
      -1 if layout does not have a primary field.

  - ### insertSpaceAbove

    void insertSpaceAbove(int size)
    Inserts empty space above the layout
    Parameters:
      `size` - the amount of space to insert above the layout

  - ### insertSpaceBelow

    void insertSpaceBelow(int size)
    Inserts empty space below the layout
    Parameters:
      `size` - the amount of space to insert below the layout

  - ### getNumFields

    int getNumFields()
    Returns the number of Fields in this Layout.

  - ### getField

    Field getField(int index)
    Returns the i'th Field in this Layout.
    Parameters:
      `index` - the index of the field to retrieve.

  - ### paint

    void paint(JComponent c, Graphics g, PaintContext context, Rectangle rect, LayoutBackgroundColorManager layoutColorMap, FieldLocation cursorLocation)
    Paints this layout on the screen.
    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.
      `layoutColorMap` - indicates where the selection exists
      `cursorLocation` - the location of the cursor or null if the cursor is not in this layout

  - ### setCursor

    int setCursor(FieldLocation cursorLoc, int x, int y)
    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.
    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

    Rectangle getCursorRect(int fieldNum, int row, int col)
    Returns a rectangle which bounds the given cursor position.
    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

    boolean cursorUp(FieldLocation cursorLoc, int lastX)
    Moves the cursor up one row from its current position.
    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

    boolean cursorDown(FieldLocation cursorLoc, int lastX)
    Moves the cursor up down row from its current position.
    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

    int cursorBeginning(FieldLocation cursorLoc)
    Sets the given FieldLocation as far to the left as possible.
    Parameters:
      `cursorLoc` - the cursor location object to be modified.
    Returns:
      the x coordinate of the cursor after the operation.

  - ### cursorEnd

    int cursorEnd(FieldLocation cursorLoc)
    Sets the given FieldLocation as far to the right as possible.
    Parameters:
      `cursorLoc` - the cursor location object to be modified.
    Returns:
      the x coordinate of the cursor after the operation.

  - ### cursorLeft

    int cursorLeft(FieldLocation cursorLoc)
    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.
    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

    int cursorRight(FieldLocation cursorLoc)
    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.
    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

    boolean enterLayout(FieldLocation cursorLoc, int lastX, boolean fromTop)
    Tries to move the cursor into this 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

    int getScrollableUnitIncrement(int topOfScreen, int direction)
    Returns the amount to scroll to reveal the line of text.
    Parameters:
      `topOfScreen` - the y coordinate that represents the top or bottom of the screen
      `direction` - the direction to scroll

  - ### contains

    boolean contains(int yPos)
    Returns true if the the given yPos lies within this layout.
    Parameters:
      `yPos` - the vertical coordinate to check if in this layout.

  - ### getFieldBounds

    Rectangle getFieldBounds(int index)
    Returns the bounds of the given field (in coordinates relative to the layout)
    Parameters:
      `index` - the field id for the field for which to get bounds

  - ### getIndexSize

    int getIndexSize()
    Returns the number of indexes consumed by this layout.

  - ### getBeginRowFieldNum

    int getBeginRowFieldNum(int field1)

  - ### getEndRowFieldNum

    int getEndRowFieldNum(int field2)

  - ### getCompressableWidth

    int getCompressableWidth()
    Returns the smallest possible width of this layout that can display its full contents
    Returns:
      the smallest possible width of this layout that can display its full contents

  - ### getFieldIndex

    int getFieldIndex(int x, int y)
    Returns the index of the field at the given coordinates (relative to the layout)
    Parameters:
      `x` - the x coordinate
      `y` - the y coordinate
    Returns:
      the index of the field at the given coordinates (relative to the layout)