Package docking.widgets.fieldpanel.field
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
contains(int x, int y)
Returns true if the given point is in this fieldint
getCol(int row, int x)
Returns the cursor column position for the given x coordinate on the given rowjava.awt.Rectangle
getCursorBounds(int row, int col)
Returns a bounding rectangle for the cursor at the given positionint
getHeight()
Returns the height of this field when populated with the given dataint
getHeightAbove()
Returns the height above the baseLineint
getHeightBelow()
Returns the height below the baseLineint
getNumCols(int row)
Returns the number of columns in the given rowint
getNumDataRows()
Returns the number of data model rows represented by this field.int
getNumRows()
Returns the number of rows in this fieldint
getPreferredWidth()
The minimum required width to paint the contents of this fieldint
getRow(int y)
Returns the row containing the given y coordinateint
getScrollableUnitIncrement(int topOfScreen, int direction, int max)
Returns the amount to scroll to the next or previous lineint
getStartX()
Returns the horizontal position of this fieldjava.lang.String
getText()
Returns a string containing all the text in the fieldjava.lang.String
getTextWithLineSeparators()
Returns a string containing all the text in the field with extra newlinesint
getWidth()
Returns the current width of this fieldint
getX(int row, int col)
Returns the x coordinate for the given cursor positionint
getY(int row)
Returns the y coordinate for the given rowboolean
isPrimary()
Returns true if this field is "primary" (the most important) field; used to determine the "primary" line in the layoutboolean
isValid(int row, int col)
Returns true if the given row and column represent a valid location for this field with the given datavoid
paint(javax.swing.JComponent c, java.awt.Graphics g, PaintContext context, java.awt.Rectangle clip, FieldBackgroundColorManager colorManager, RowColLocation cursorLoc, int rowHeight)
Paints this fieldvoid
rowHeightChanged(int heightAbove, int heightBelow)
notifies field that the rowHeight changedint
screenLocationToTextOffset(int row, int col)
Returns the text offset in the overall field text string for the given row and columnRowColLocation
textOffsetToScreenLocation(int textOffset)
Returns the row, column position for an offset into the string returned by getText()
-
-
-
Method Detail
-
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(javax.swing.JComponent c, java.awt.Graphics g, PaintContext context, java.awt.Rectangle clip, FieldBackgroundColorManager colorManager, RowColLocation cursorLoc, int rowHeight)
Paints this field- Parameters:
c
- the component to paint ontog
- the graphics contextcontext
- common paint parametersclip
- the clipping region to paint intocolorManager
- contains background color information for the fieldcursorLoc
- the row,column cursor location within the field or null if the field does not contain the cursorrowHeight
- 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 pointy
- 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 interestcol
- 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 onx
- 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 rowcol
- the character position- Returns:
- tru if valid
-
getCursorBounds
java.awt.Rectangle getCursorBounds(int row, int col)
Returns a bounding rectangle for the cursor at the given position- Parameters:
row
- the text rowcol
- 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 screendirection
- 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 baselineheightBelow
- the height below the baseline
-
getText
java.lang.String getText()
Returns a string containing all the text in the field- Returns:
- the string
-
getTextWithLineSeparators
java.lang.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 rowcol
- the column- Returns:
- the offset
-
-