Package ghidra.app.util.viewer.format

# Class FieldFormatModel

java.lang.Object
ghidra.app.util.viewer.format.FieldFormatModel

public class FieldFormatModel extends Object
Maintains the size and ordering for a layout of fields.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ARRAY`
  `static final int`
  `DIVIDER`
  `protected FieldFactory[]`
  `factories`
  `static final int`
  `FUNCTION`
  `static final int`
  `FUNCTION_VARS`
  `static final int`
  `INSTRUCTION_OR_DATA`
  `static final int`
  `OPEN_DATA`
  `static final int`
  `PLATE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAllFactories()`
  Adds all unused fields to this model.
  `void`
  `addFactory(FieldFactory factory, int rowIndex, int colIndex)`
  Adds a new field to this format.
  `void`
  `addLayouts(List<RowLayout> list, int index, ProxyObj<?> proxy)`
  Generates the layout objects for the given index and proxy object
  `void`
  `addRow(int index)`
  Adds new empty row at the given position.
  `void`
  `displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue)`
  Notifies that the field display options have changed.
  `void`
  `fieldOptionsChanged(Options options, String optionName, Object oldValue, Object newValue)`
  Notifies that the field options have changed.
  `FieldFactory[]`
  `getAllFactories()`
  `FieldFactory[]`
  `getFactorys()`
  Returns the list of factories used in this format..
  `FieldFactory[]`
  `getFactorys(int row)`
  Returns the factories on the given row.
  `FormatManager`
  `getFormatManager()`
  Returns the FormatManager managing this format..
  `String`
  `getName()`
  Returns the name of this format model..
  `int`
  `getNumFactorys(int row)`
  Returns the number of factories on the given row.
  `int`
  `getNumRows()`
  Returns the number of rows in this format.
  `FieldFactory[]`
  `getUnusedFactories()`
  Returns a list of unused valid fields for this model
  `int`
  `getWidth()`
  Returns the width of this format..
  `void`
  `modelChanged()`
  Notifies the formatMgr that this format model has changed.
  `void`
  `moveFactory(int oldRowIndex, int oldColIndex, int newRowIndex, int newColIndex)`
  Moves the Field at (oldrow,oldCol) to (row,col)
  `void`
  `removeAllFactories()`
  Removes all fields from this model.
  `void`
  `removeFactory(int rowIndex, int colIndex)`
  Removes a field from the format.
  `void`
  `removeRow(int index)`
  Removes the row currently at the given position.
  `void`
  `restoreFromXml(org.jdom.Element root)`
  Restores the format for this model from XML.
  `org.jdom.Element`
  `saveToXml()`
  Saves this format to XML.
  `void`
  `servicesChanged()`
  Notifies each row that the services have changed.
  `void`
  `setBaseRowID(int id)`
  Sets the base id for this model.
  `void`
  `update()`
  Updates users of the formatMgr to indicate the format has changed.
  `void`
  `updateRow(int index)`
  Updates the fields on the given row.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DIVIDER

    public static final int DIVIDER
    See Also:
      - Constant Field Values

  - ### PLATE

    public static final int PLATE
    See Also:
      - Constant Field Values

  - ### FUNCTION

    public static final int FUNCTION
    See Also:
      - Constant Field Values

  - ### FUNCTION_VARS

    public static final int FUNCTION_VARS
    See Also:
      - Constant Field Values

  - ### INSTRUCTION_OR_DATA

    public static final int INSTRUCTION_OR_DATA
    See Also:
      - Constant Field Values

  - ### OPEN_DATA

    public static final int OPEN_DATA
    See Also:
      - Constant Field Values

  - ### ARRAY

    public static final int ARRAY
    See Also:
      - Constant Field Values

  - ### factories

    protected FieldFactory[] factories

- ## Method Details

  - ### setBaseRowID

    public void setBaseRowID(int id)
    Sets the base id for this model. Each row in a model gets an id which must be unique across all models.
    Parameters:
      `id` - the base id for this format.

  - ### update

    public void update()
    Updates users of the formatMgr to indicate the format has changed.

  - ### getFormatManager

    public FormatManager getFormatManager()
    Returns the FormatManager managing this format..
    Returns:
      the FormatManager managing this format.

  - ### addLayouts

    public void addLayouts(List<RowLayout> list, int index, ProxyObj<?> proxy)
    Generates the layout objects for the given index and proxy object
    Parameters:
      `list` - the list to add layouts to
      `index` - the index (represents address)
      `proxy` - the object to get layouts for.

  - ### addRow

    public void addRow(int index)
    Adds new empty row at the given position. The position must be in the interval [0,numRows].
    Parameters:
      `index` - the index to add a new row
    Throws:
      `IllegalArgumentException` - thrown if the position is outside the interval [0,numRows].

  - ### removeRow

    public void removeRow(int index)
    Removes the row currently at the given position.
    Parameters:
      `index` - the index of the row to remove.

  - ### addFactory

    public void addFactory(FieldFactory factory, int rowIndex, int colIndex)
    Adds a new field to this format.
    Parameters:
      `factory` - the FieldFactory to add
      `rowIndex` - the row to add the field to
      `colIndex` - the position in the row for the new field.

  - ### removeFactory

    public void removeFactory(int rowIndex, int colIndex)
    Removes a field from the format.
    Parameters:
      `rowIndex` - the row index of the field to remove.
      `colIndex` - the column index of the field to remove.

  - ### modelChanged

    public void modelChanged()
    Notifies the formatMgr that this format model has changed.

  - ### getNumRows

    public int getNumRows()
    Returns the number of rows in this format.
    Returns:
      the number of rows in this format

  - ### getName

    public String getName()
    Returns the name of this format model..
    Returns:
      the name of this format model.

  - ### getNumFactorys

    public int getNumFactorys(int row)
    Returns the number of factories on the given row.
    Parameters:
      `row` - the row to get the number of factories for
    Returns:
      the number of factories on the given row

  - ### getFactorys

    public FieldFactory[] getFactorys(int row)
    Returns the factories on the given row.
    Parameters:
      `row` - the row to factories for
    Returns:
      the FieldFactorys for a given row

  - ### getFactorys

    public FieldFactory[] getFactorys()
    Returns the list of factories used in this format..
    Returns:
      the list of factories used in this format.

  - ### moveFactory

    public void moveFactory(int oldRowIndex, int oldColIndex, int newRowIndex, int newColIndex)
    Moves the Field at (oldrow,oldCol) to (row,col)
    Parameters:
      `oldRowIndex` - the row containing the field to be moved.
      `oldColIndex` - the column index of the field to be moved.
      `newRowIndex` - the row to move to.
      `newColIndex` - the column to move to.
    Throws:
      `IllegalArgumentException` - thrown if any of the parameters don't map to a valid grid position.

  - ### getWidth

    public int getWidth()
    Returns the width of this format..
    Returns:
      the width of this format.

  - ### updateRow

    public void updateRow(int index)
    Updates the fields on the given row.
    Parameters:
      `index` - the row to update.

  - ### servicesChanged

    public void servicesChanged()
    Notifies each row that the services have changed.

  - ### saveToXml

    public org.jdom.Element saveToXml()
    Saves this format to XML.
    Returns:
      the XML element for the saved format

  - ### restoreFromXml

    public void restoreFromXml(org.jdom.Element root)
    Restores the format for this model from XML.
    Parameters:
      `root` - the root XML element from which to get the format information.

  - ### addAllFactories

    public void addAllFactories()
    Adds all unused fields to this model.

  - ### getUnusedFactories

    public FieldFactory[] getUnusedFactories()
    Returns a list of unused valid fields for this model
    Returns:
      a list of unused valid fields for this model

  - ### getAllFactories

    public FieldFactory[] getAllFactories()

  - ### removeAllFactories

    public void removeAllFactories()
    Removes all fields from this model.

  - ### displayOptionsChanged

    public void displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue)
    Notifies that the field display options have changed.
    Parameters:
      `options` - the Options object that changed.
      `optionName` - the name of the property that changed.
      `oldValue` - the old value of the property.
      `newValue` - the new value of the property.

  - ### fieldOptionsChanged

    public void fieldOptionsChanged(Options options, String optionName, Object oldValue, Object newValue)
    Notifies that the field options have changed.
    Parameters:
      `options` - the Options object that changed.
      `optionName` - the name of the property that changed.
      `oldValue` - the old value of the property.
      `newValue` - the new value of the property.