Package ghidra.app.util.viewer.format

# Class FormatManager

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

All Implemented Interfaces:
  `OptionsChangeListener`

public class FormatManager extends Object implements OptionsChangeListener
Class to manage the set of format models.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ARRAY_DISPLAY_DESCRIPTION`
  `static final String`
  `ARRAY_DISPLAY_OPTIONS`
  `static final String`
  `ARRAY_OPTIONS_GROUP`
  `static final String`
  `HIGHLIGHT_ALT_COLOR_NAME`
  `static final String`
  `HIGHLIGHT_COLOR_NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FormatManager(ToolOptions displayOptions, ToolOptions fieldOptions)`
  Constructs a new FormatManager.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFormatModelListener(FormatModelListener listener)`
  Adds a listener to be notified when a format changes.
  `void`
  `addHighlightProvider(ListingHighlightProvider provider)`
  Adds a HighlightProvider
  `FormatManager`
  `createClone()`
  `void`
  `dispose()`
  `FieldFormatModel`
  `getCodeUnitFormat()`
  Returns the format model for a code unit.
  `ToolOptions`
  `getDisplayOptions()`
  Returns the Options used for display properties.
  `FieldFormatModel`
  `getDividerModel()`
  Returns the format model for the address break (divider).
  `ToolOptions`
  `getFieldOptions()`
  Returns the Options used for field specific properties.
  `ListingHighlightProvider`
  `getFormatHighlightProvider()`
  Returns the `ListingHighlightProvider` that should be used when creating `FieldFactory` objects.
  `FieldFormatModel`
  `getFunctionFormat()`
  Returns the format model for the function signature.
  `FieldFormatModel`
  `getFunctionVarFormat()`
  Returns the format model for the function variables.
  `List<ListingHighlightProvider>`
  `getHighlightProviders()`
  Gets all `ListingHighlightProvider`s installed on this FormatManager via the `addHighlightProvider(ListingHighlightProvider)`.
  `int`
  `getMaxNumRows()`
  Returns the maximum number of possible rows in a layout.
  `int`
  `getMaxRowCount()`
  `int`
  `getMaxWidth()`
  Returns the width of the widest model in this manager.
  `FieldFormatModel`
  `getModel(int index)`
  Returns the format model for the given index.
  `int`
  `getNumModels()`
  Returns the total number of model in the format manager.
  `FieldFormatModel`
  `getOpenDataFormat(Data data)`
  Returns the format model to use for the internals of open structures.
  `FieldFormatModel`
  `getPlateFormat()`
  Returns the format model for the plate field.
  `List<String>`
  `getQuickToggleFieldNames()`
  Returns a list of field names that should have quick toggle actions..
  `ServiceProvider`
  `getServiceProvider()`
  `TemplateSimplifier`
  `getTemplateSimplifier()`
  Returns the template simplifier.
  `void`
  `modelChanged(FieldFormatModel model)`
  Notifies listeners that the given model has changed.
  `void`
  `optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue)`
  Notification that an option changed.
  `void`
  `readState(SaveState saveState)`
  Restores the state of this LayoutController from the given SaveState object.
  `void`
  `removeFormatModleListener(FormatModelListener listener)`
  Removes the given listener from the list of listeners to be notified of a format change.
  `void`
  `removeHighlightProvider(ListingHighlightProvider provider)`
  Removes the provider
  `void`
  `saveState(SaveState saveState)`
  Saves the state of this LayoutManager to the SaveState object.
  `void`
  `setDefaultFormat(int modelID)`
  Resets the model with the given id to its default format.
  `void`
  `setDefaultFormats()`
  Resets all format models to their default format.
  `void`
  `setServiceProvider(ServiceProvider provider)`
  Sets the service provider used by the field factory objects.
  `void`
  `toggleField(String name)`
  Toggle the enablement for the field with the given name.
  `void`
  `update()`
  update all listeners that a model has changed.

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

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

- ## Field Details

  - ### ARRAY_OPTIONS_GROUP

    public static final String ARRAY_OPTIONS_GROUP
    See Also:
      - Constant Field Values

  - ### HIGHLIGHT_COLOR_NAME

    public static final String HIGHLIGHT_COLOR_NAME
    See Also:
      - Constant Field Values

  - ### HIGHLIGHT_ALT_COLOR_NAME

    public static final String HIGHLIGHT_ALT_COLOR_NAME
    See Also:
      - Constant Field Values

  - ### ARRAY_DISPLAY_OPTIONS

    public static final String ARRAY_DISPLAY_OPTIONS
    See Also:
      - Constant Field Values

  - ### ARRAY_DISPLAY_DESCRIPTION

    public static final String ARRAY_DISPLAY_DESCRIPTION
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### FormatManager

    public FormatManager(ToolOptions displayOptions, ToolOptions fieldOptions)
    Constructs a new FormatManager.
    Parameters:
      `displayOptions` - the Options containing display options (color, fonts, etc)
      `fieldOptions` - the Options contains specific field options.

- ## Method Details

  - ### createClone

    public FormatManager createClone()

  - ### dispose

    public void dispose()

  - ### setServiceProvider

    public void setServiceProvider(ServiceProvider provider)
    Sets the service provider used by the field factory objects.
    Parameters:
      `provider` - the service provider

  - ### addFormatModelListener

    public void addFormatModelListener(FormatModelListener listener)
    Adds a listener to be notified when a format changes.
    Parameters:
      `listener` - the listener to be added

  - ### removeFormatModleListener

    public void removeFormatModleListener(FormatModelListener listener)
    Removes the given listener from the list of listeners to be notified of a format change.
    Parameters:
      `listener` - the listener to be removed.

  - ### getNumModels

    public int getNumModels()
    Returns the total number of model in the format manager.
    Returns:
      the total number of model in the format manager

  - ### getModel

    public FieldFormatModel getModel(int index)
    Returns the format model for the given index.
    Parameters:
      `index` - the index of the format model to return.
    Returns:
      the format model for the given index

  - ### getDividerModel

    public FieldFormatModel getDividerModel()
    Returns the format model for the address break (divider).
    Returns:
      the format model for the address break (divider)

  - ### getPlateFormat

    public FieldFormatModel getPlateFormat()
    Returns the format model for the plate field.
    Returns:
      the format model for the plate field

  - ### getFunctionFormat

    public FieldFormatModel getFunctionFormat()
    Returns the format model for the function signature.
    Returns:
      the format model for the function signature

  - ### getFunctionVarFormat

    public FieldFormatModel getFunctionVarFormat()
    Returns the format model for the function variables.
    Returns:
      the format model for the function variables

  - ### getCodeUnitFormat

    public FieldFormatModel getCodeUnitFormat()
    Returns the format model for a code unit.
    Returns:
      the format model for a code unit

  - ### getOpenDataFormat

    public FieldFormatModel getOpenDataFormat(Data data)
    Returns the format model to use for the internals of open structures.
    Parameters:
      `data` - the data code unit to get the format model for.
    Returns:
      the format model to use for the internals of open structures.

  - ### toggleField

    public void toggleField(String name)
    Toggle the enablement for the field with the given name.
    Parameters:
      `name` - the of the field to toggle

  - ### update

    public void update()
    update all listeners that a model has changed.

  - ### getDisplayOptions

    public ToolOptions getDisplayOptions()
    Returns the Options used for display properties.
    Returns:
      the Options used for display properties.

  - ### getFieldOptions

    public ToolOptions getFieldOptions()
    Returns the Options used for field specific properties.
    Returns:
      the Options used for field specific properties

  - ### getTemplateSimplifier

    public TemplateSimplifier getTemplateSimplifier()
    Returns the template simplifier.
    Returns:
      the template simplifier.

  - ### modelChanged

    public void modelChanged(FieldFormatModel model)
    Notifies listeners that the given model has changed.
    Parameters:
      `model` - the format model that changed.

  - ### getMaxWidth

    public int getMaxWidth()
    Returns the width of the widest model in this manager.
    Returns:
      the width of the widest model in this manager.

  - ### getMaxRowCount

    public int getMaxRowCount()

  - ### getQuickToggleFieldNames

    public List<String> getQuickToggleFieldNames()
    Returns a list of field names that should have quick toggle actions..
    Returns:
      a list of field names that should have quick toggle actions.

  - ### getMaxNumRows

    public int getMaxNumRows()
    Returns the maximum number of possible rows in a layout. This would only occur if some address had every possible type of information to be displayed.
    Returns:
      the maximum number of possible rows in a layout.

  - ### setDefaultFormat

    public void setDefaultFormat(int modelID)
    Resets the model with the given id to its default format.
    Parameters:
      `modelID` - the id of the model to reset.

  - ### setDefaultFormats

    public void setDefaultFormats()
    Resets all format models to their default format.

  - ### addHighlightProvider

    public void addHighlightProvider(ListingHighlightProvider provider)
    Adds a HighlightProvider
    Parameters:
      `provider` - the provider to use.
    See Also:
      - `removeHighlightProvider(ListingHighlightProvider)`
      - `getHighlightProviders()`

  - ### removeHighlightProvider

    public void removeHighlightProvider(ListingHighlightProvider provider)
    Removes the provider
    Parameters:
      `provider` - the provider to remove.
    See Also:
      - `addHighlightProvider(ListingHighlightProvider)`

  - ### getHighlightProviders

    public List<ListingHighlightProvider> getHighlightProviders()
    Gets all `ListingHighlightProvider`s installed on this FormatManager via the `addHighlightProvider(ListingHighlightProvider)`.
    Returns:
      all `ListingHighlightProvider`s installed on this FormatManager.

  - ### getFormatHighlightProvider

    public ListingHighlightProvider getFormatHighlightProvider()
    Returns the `ListingHighlightProvider` that should be used when creating `FieldFactory` objects.
    Returns:
      the provider

  - ### optionsChanged

    public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue)
    Description copied from interface: `OptionsChangeListener`
    Notification that an option changed.

    Note: to reject an options change, you can throw a `OptionsVetoException`.

    Specified by:
      `optionsChanged` in interface `OptionsChangeListener`
    Parameters:
      `options` - options object containing the property that changed
      `name` - name of option that changed
      `oldValue` - old value of the option
      `newValue` - new value of the option

  - ### saveState

    public void saveState(SaveState saveState)
    Saves the state of this LayoutManager to the SaveState object.
    Parameters:
      `saveState` - the SaveState object to write to.

  - ### readState

    public void readState(SaveState saveState)
    Restores the state of this LayoutController from the given SaveState object.
    Parameters:
      `saveState` - the SaveState to read from.

  - ### getServiceProvider

    public ServiceProvider getServiceProvider()