Class MultiRowLayout
- java.lang.Object
-
- docking.widgets.fieldpanel.support.MultiRowLayout
-
-
Constructor Summary
Constructors Constructor Description MultiRowLayout(RowLayout[] layouts, int indexSize)MultiRowLayout(RowLayout layout, int indexSize)Constructs a new MultiRowLayout with a single layout row.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalign(int[] rowHeights)Aligns the heights in this MultiRowLayout to match those in the give row heights array.voidalign(MultiRowLayout layout, Field dummyField)synchronizeadjusts this layout and the layout passed as a parameter by adding and resizing rows as necessary to make their vertical layouts match.booleancontains(int yPos)Returns true if the 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.voidfillHeights(int[] rowHeights)Fills in the given array with the heights of all the layouts in the MultiRowLayoutintgetBeginRowFieldNum(int fieldIndex)intgetCompressableWidth()Returns the smallest possible width of this layout that can display its full contentsjava.awt.RectanglegetCursorRect(int fieldNum, int row, int col)Returns a rectangle which bounds the given cursor position.intgetEndRowFieldNum(int fieldIndex)FieldgetField(int index)Returns the i'th Field in this Layout.java.awt.RectanglegetFieldBounds(int index)Returns the bounds of the given field (in coordinates relative to the layout)intgetFirstRowID()intgetHeight()Returns the total height of this layout.intgetIndexSize()Returns the number of indexes consumed by this layout.intgetNumFields()Returns the number of Fields in this Layout.intgetPrimaryOffset()Returns the vertical offset (in pixels) of the start of the primary field in the 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(javax.swing.JComponent c, java.awt.Graphics g, PaintContext context, java.awt.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.
-
-
-
Method Detail
-
getHeight
public int getHeight()
Description copied from interface:LayoutReturns the total height of this layout.- Specified by:
getHeightin interfaceLayout- See Also:
Layout.getHeight()
-
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
-
getNumFields
public int getNumFields()
Description copied from interface:LayoutReturns the number of Fields in this Layout.- Specified by:
getNumFieldsin interfaceLayout- See Also:
Layout.getNumFields()
-
getField
public Field getField(int index)
Description copied from interface:LayoutReturns the i'th Field in this Layout.- Specified by:
getFieldin interfaceLayout- Parameters:
index- the index of the field to retrieve.- See Also:
Layout.getField(int)
-
paint
public void paint(javax.swing.JComponent c, java.awt.Graphics g, PaintContext context, java.awt.Rectangle rect, LayoutBackgroundColorManager colorManager, FieldLocation cursorLocation)Description copied from interface:LayoutPaints this layout on the screen.- Specified by:
paintin interfaceLayoutg- 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- See Also:
docking.widgets.fieldpanel.Layout#paint(java.awt.Graphics, docking.widgets.fieldpanel.internal.PaintContext, java.awt.Rectangle, ghidra.util.bean.field.LayoutSelection, ghidra.util.bean.field.LayoutSelection, int, int, int)
-
setCursor
public int setCursor(FieldLocation cursorLoc, int x, int y)
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.
- See Also:
Layout.setCursor(docking.widgets.fieldpanel.support.FieldLocation, int, int)
-
getCursorRect
public java.awt.Rectangle getCursorRect(int fieldNum, int row, int col)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 the text row in the field containing the cursor position.col- the character position in the row containing the cursor position.- See Also:
Layout.getCursorRect(int, int, int)
-
cursorUp
public boolean cursorUp(FieldLocation cursorLoc, int lastX)
Description copied from interface:LayoutMoves the cursor up one row from its current position.- Specified by:
cursorUpin 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 up without leaving the layout.
- See Also:
Layout.cursorUp(docking.widgets.fieldpanel.support.FieldLocation, int)
-
cursorDown
public boolean cursorDown(FieldLocation cursorLoc, int lastX)
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.
- See Also:
Layout.cursorDown(docking.widgets.fieldpanel.support.FieldLocation, int)
-
cursorBeginning
public int cursorBeginning(FieldLocation cursorLoc)
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.
- See Also:
Layout.cursorBeginning(docking.widgets.fieldpanel.support.FieldLocation)
-
cursorEnd
public int cursorEnd(FieldLocation cursorLoc)
Description copied from interface:LayoutSets the given FieldLocation as far to the right as possible.- Specified by:
cursorEndin interfaceLayout- Parameters:
cursorLoc- the cursor location object to be modified.- Returns:
- the x coordinate of the cursor after the operation.
- See Also:
Layout.cursorEnd(docking.widgets.fieldpanel.support.FieldLocation)
-
cursorLeft
public int cursorLeft(FieldLocation cursorLoc)
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.
- See Also:
Layout.cursorLeft(docking.widgets.fieldpanel.support.FieldLocation)
-
cursorRight
public int cursorRight(FieldLocation cursorLoc)
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.
- See Also:
Layout.cursorRight(docking.widgets.fieldpanel.support.FieldLocation)
-
enterLayout
public boolean enterLayout(FieldLocation cursorLoc, int lastX, boolean fromTop)
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.
- See Also:
Layout.enterLayout(docking.widgets.fieldpanel.support.FieldLocation, int, boolean)
-
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- See Also:
Layout.getScrollableUnitIncrement(int, int)
-
contains
public boolean contains(int yPos)
Description copied from interface:LayoutReturns true if the the given yPos lies within this layout.- Specified by:
containsin interfaceLayout- Parameters:
yPos- the vertical coordinate to check if in this layout.- See Also:
Layout.contains(int)
-
align
public void align(MultiRowLayout layout, Field dummyField)
synchronizeadjusts this layout and the layout passed as a parameter by adding and resizing rows as necessary to make their vertical layouts match.- Parameters:
layout- the other multi-row layout that is to be synchronized with.dummyField- empty field used for spacing.
-
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.
- See Also:
Layout.getPrimaryOffset()
-
getFieldBounds
public java.awt.Rectangle getFieldBounds(int index)
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- See Also:
Layout.getFieldBounds(int)
-
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- See Also:
Layout.insertSpaceAbove(int)
-
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- See Also:
Layout.insertSpaceBelow(int)
-
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:LayoutReturns the number of indexes consumed by this layout.- Specified by:
getIndexSizein interfaceLayout
-
getBeginRowFieldNum
public int getBeginRowFieldNum(int fieldIndex)
- Specified by:
getBeginRowFieldNumin interfaceLayout
-
getEndRowFieldNum
public int getEndRowFieldNum(int fieldIndex)
- Specified by:
getEndRowFieldNumin interfaceLayout
-
getFirstRowID
public int getFirstRowID()
-
-