Interface Field

All Known Subinterfaces:
ListingField, TextField
All Known Implementing Classes:
ClangTextField, ClippingTextField, CompositeVerticalLayoutTextField, EmptyTextField, ErrorListingField, FlowLayoutTextField, ImageFactoryField, IndentField, ListingTextField, OpenCloseField, ReverseClippingTextField, SimpleImageField, SimpleTextField, VerticalLayoutTextField, WrappingVerticalLayoutTextField

public interface Field
Interface for display fields used by the FieldPanel
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int x, int y)
    Returns true if the given point is in this field
    int
    getCol(int row, int x)
    Returns the cursor column position for the given x coordinate on the given row
    getCursorBounds(int row, int col)
    Returns a bounding rectangle for the cursor at the given position
    int
    Returns the height of this field when populated with the given data
    int
    Returns the height above the baseLine
    int
    Returns the height below the baseLine
    int
    getNumCols(int row)
    Returns the number of columns in the given row
    int
    Returns the number of data model rows represented by this field.
    int
    Returns the number of rows in this field
    int
    The minimum required width to paint the contents of this field
    int
    getRow(int y)
    Returns the row containing the given y coordinate
    int
    getScrollableUnitIncrement(int topOfScreen, int direction, int max)
    Returns the amount to scroll to the next or previous line
    int
    Returns the horizontal position of this field
    Returns a string containing all the text in the field
    Returns a string containing all the text in the field with extra newlines
    int
    Returns the current width of this field
    int
    getX(int row, int col)
    Returns the x coordinate for the given cursor position
    int
    getY(int row)
    Returns the y coordinate for the given row
    boolean
    Returns true if this field is "primary" (the most important) field; used to determine the "primary" line in the layout
    boolean
    isValid(int row, int col)
    Returns true if the given row and column represent a valid location for this field with the given data
    void
    paint(JComponent c, Graphics g, PaintContext context, Rectangle clip, FieldBackgroundColorManager colorManager, RowColLocation cursorLoc, int rowHeight)
    Paints this field
    void
    rowHeightChanged(int heightAbove, int heightBelow)
    notifies field that the rowHeight changed
    int
    screenLocationToTextOffset(int row, int col)
    Returns the text offset in the overall field text string for the given row and column
    Returns the row, column position for an offset into the string returned by getText()
  • Method Details

    • getWidth

      int getWidth()
      Returns the current width of this field
      Returns:
      the current width of this field
    • getPreferredWidth

      int getPreferredWidth()
      The minimum required width to paint the contents of this field
      Returns:
      the minimum required width to paint the contents of this field
    • getHeight

      int getHeight()
      Returns the height of this field when populated with the given data
      Returns:
      the height
    • getHeightAbove

      int getHeightAbove()
      Returns the height above the baseLine
      Returns:
      the height above
    • getHeightBelow

      int getHeightBelow()
      Returns the height below the baseLine
      Returns:
      the height below
    • getStartX

      int getStartX()
      Returns the horizontal position of this field
      Returns:
      the position
    • paint

      void paint(JComponent c, Graphics g, PaintContext context, Rectangle clip, FieldBackgroundColorManager colorManager, RowColLocation cursorLoc, int rowHeight)
      Paints this field
      Parameters:
      c - the component to paint onto
      g - the graphics context
      context - common paint parameters
      clip - the clipping region to paint into
      colorManager - contains background color information for the field
      cursorLoc - the row,column cursor location within the field or null if the field does not contain the cursor
      rowHeight - the number of pixels in each row of text in the field
    • contains

      boolean contains(int x, int y)
      Returns true if the given point is in this field
      Parameters:
      x - the horizontal coordinate of the point
      y - the relative y position in this layout
      Returns:
      true if the given point is in this field
    • getNumDataRows

      int getNumDataRows()
      Returns the number of data model rows represented by this field. Some fields may change the row count by wrapping or truncating. The value returned here will be the original data row count before any transformations were applied.
      Returns:
      the number of data rows
    • getNumRows

      int getNumRows()
      Returns the number of rows in this field
      Returns:
      the number of rows in this field
    • getNumCols

      int getNumCols(int row)
      Returns the number of columns in the given row
      Parameters:
      row - the row from which to get the number of columns; this is the screen row
      Returns:
      the number of columns
    • getX

      int getX(int row, int col)
      Returns the x coordinate for the given cursor position
      Parameters:
      row - the text row of interest
      col - the character column
      Returns:
      the x value
    • getY

      int getY(int row)
      Returns the y coordinate for the given row
      Parameters:
      row - the text row of interest
      Returns:
      the y value
    • getRow

      int getRow(int y)
      Returns the row containing the given y coordinate
      Parameters:
      y - vertical pixel coordinate relative to the top of the screen
      Returns:
      the row
    • getCol

      int getCol(int row, int x)
      Returns the cursor column position for the given x coordinate on the given row
      Parameters:
      row - the text row to find the column on
      x - the horizontal pixel coordinate for which to find the character position
      Returns:
      the column
    • isValid

      boolean isValid(int row, int col)
      Returns true if the given row and column represent a valid location for this field with the given data
      Parameters:
      row - the text row
      col - the character position
      Returns:
      true if valid
    • getCursorBounds

      Rectangle getCursorBounds(int row, int col)
      Returns a bounding rectangle for the cursor at the given position
      Parameters:
      row - the text row
      col - the character position
      Returns:
      the rectangle
    • getScrollableUnitIncrement

      int getScrollableUnitIncrement(int topOfScreen, int direction, int max)
      Returns the amount to scroll to the next or previous line
      Parameters:
      topOfScreen - the current y position of the top of the screen
      direction - the direction of the scroll (1 down, -1 up)
      max - the maximum amount to scroll for the entire row - will be positive for down, and negative for up)
      Returns:
      the scroll amount
    • isPrimary

      boolean isPrimary()
      Returns true if this field is "primary" (the most important) field; used to determine the "primary" line in the layout
      Returns:
      true if this field is "primary"
    • rowHeightChanged

      void rowHeightChanged(int heightAbove, int heightBelow)
      notifies field that the rowHeight changed
      Parameters:
      heightAbove - the height above the baseline
      heightBelow - the height below the baseline
    • getText

      String getText()
      Returns a string containing all the text in the field
      Returns:
      the string
    • getTextWithLineSeparators

      String getTextWithLineSeparators()
      Returns a string containing all the text in the field with extra newlines
      Returns:
      a string containing all the text in the field with extra newlines
    • textOffsetToScreenLocation

      RowColLocation textOffsetToScreenLocation(int textOffset)
      Returns the row, column position for an offset into the string returned by getText()
      Parameters:
      textOffset - the offset into the entire text string for this field
      Returns:
      a RowColLocation that contains the row,column location in the field for a position in the overall field text
    • screenLocationToTextOffset

      int screenLocationToTextOffset(int row, int col)
      Returns the text offset in the overall field text string for the given row and column
      Parameters:
      row - the row
      col - the column
      Returns:
      the offset