# Controller (ARX GUI Documentation)

org.deidentifier.arx.gui

## Class Controller

- java.lang.Object
- - org.deidentifier.arx.gui.Controller

- All Implemented Interfaces:
    IView

      public class Controller
      extends java.lang.Object
      implements IView

  The main controller for the whole tool.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Controller(MainWindow main)` Creates a new controller.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `actionApplyLocalRecoding()` Applies local recoding
    `void` | `actionApplySelectedTransformation()` Applies the selected transformation.
    `void` | `actionClearEventLog()` Clears the event log.
    `void` | `actionCriterionAdd()` Adds a criterion
    `void` | `actionCriterionConfigure(ModelCriterion criterion)` Configures a criterion
    `void` | `actionCriterionEnable(ModelCriterion criterion)` Enables and disables a criterion.
    `void` | `actionCriterionPull(ModelCriterion criterion)` Pull settings into the criterion.
    `void` | `actionCriterionPush(ModelCriterion criterion)` Pushes the settings of the criterion.
    `void` | `actionDataShowGroups()` Toggles the "show groups" option.
    `void` | `actionDataSort(boolean input)` Sorts the data.
    `void` | `actionDataToggleSubset()` Toggles the "subset" option.
    `void` | `actionExpand(ARXLattice.ARXNode transformation)` Expand action
    `void` | `actionMenuEditAnonymize(boolean heuristicSearch)` Starts the anonymization.
    `void` | `actionMenuEditCreateHierarchy()` Starts the wizard.
    `void` | `actionMenuEditCreateTopBottomCodingHierarchy()` Initializes the hierarchy for the currently selected attribute with a scheme for top-/bottom coding.
    `void` | `actionMenuEditFindReplace()` Find and replace action
    `void` | `actionMenuEditInitializeHierarchy()` Initializes the hierarchy for the currently selected attribute
    `void` | `actionMenuEditReset()` Resets the current output
    `void` | `actionMenuEditSettings()` Starts the "edit settings" dialog.
    `void` | `actionMenuFileCreateCertificate()` Creates and displays a certificate
    `void` | `actionMenuFileExit()` File->exit.
    `void` | `actionMenuFileExportData()` File->export data.
    `void` | `actionMenuFileExportHierarchy()` File->Export hierarchy.
    `void` | `actionMenuFileImportData()` File->Import data.
    `void` | `actionMenuFileImportHierarchy()` File->Import hierarchy.
    `void` | `actionMenuFileNew()` File->New project.
    `void` | `actionMenuFileOpen()` File->Open project.
    `void` | `actionMenuFileSave()` File->Save project.
    `void` | `actionMenuFileSaveAs()` File->Save project as.
    `void` | `actionMenuHelpAbout()` Shows the "about" dialog.
    `void` | `actionMenuHelpDebug()` Shows the "debug" dialog.
    `void` | `actionMenuHelpHelp()` Shows the "help" dialog.
    `void` | `actionOpenProject(java.lang.String path)` Internal method for loading a project.
    `void` | `actionShowAuditTrail()` Shows the audit trail
    `java.nio.charset.Charset` | `actionShowCharsetInputDialog(org.eclipse.swt.widgets.Shell shell)` Shows an input dialog for selecting a charset.
    `void` | `actionShowErrorDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String text, java.lang.Throwable t)` Shows an error dialog.
    `java.lang.String` | `actionShowFormatInputDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.util.Locale locale, DataType.DataTypeDescription<?> type, java.util.Collection<java.lang.String> values)` Shows a dialog for selecting a format string for a data type.
    `java.lang.String` | `actionShowFormatInputDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.util.Locale locale, DataType.DataTypeDescription<?> type, java.lang.String[] values)` Shows a dialog for selecting a format string for a data type.
    `java.lang.String` | `actionShowFormatInputDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.lang.String preselected, java.util.Locale locale, DataType.DataTypeDescription<?> type, java.util.Collection<java.lang.String> values)` Shows a dialog for selecting a format string for a data type.
    `void` | `actionShowHelpDialog(java.lang.String id)` Shows a help dialog.
    `void` | `actionShowInfoDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String header, java.lang.String text)` Shows an info dialog.
    `java.lang.String` | `actionShowInputDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String header, java.lang.String text, java.lang.String initial)` Shows an input dialog.
    `java.lang.String` | `actionShowInputDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String header, java.lang.String text, java.lang.String initial, org.eclipse.jface.dialogs.IInputValidator validator)` Shows an input dialog.
    `java.util.List<java.lang.String>` | `actionShowMultiSelectionDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.util.List<java.lang.String> elements, java.util.List<java.lang.String> selected)` Shows a dialog for selecting multiple elements
    `java.lang.String` | `actionShowOpenFileDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String filter)` Shows a "open file" dialog.
    `java.lang.String[]` | `actionShowOrderValuesDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, DataType<?> type, java.util.Locale locale, java.lang.String[] values)` Shows an input dialog for ordering data items.
    `void` | `actionShowProgressDialog(java.lang.String text, Worker<?> worker)` Shows a progress dialog.
    `boolean` | `actionShowQuestionDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String header, java.lang.String text)` Shows a question dialog.
    `boolean` | `actionShowQuestionDialog(java.lang.String header, java.lang.String text)` Shows a question dialog.
    `java.lang.String` | `actionShowSaveFileDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String filter)` Internal method for showing a "save file" dialog.
    `void` | `actionSubsetAll()` Includes all tuples in the research subset.
    `void` | `actionSubsetFile()` Creates a research subset from a file.
    `void` | `actionSubsetNone()` Excludes all tuples from the subset.
    `void` | `actionSubsetQuery()` Creates a subset by executing a query.
    `void` | `actionSubsetRandom()` Creates a subset via random sampling
    `void` | `addListener(ModelEvent.ModelPart target, IView listener)` Registers a listener at the controller.
    `void` | `dispose()` Disposes the view.
    `java.lang.String` | `getDebugData()` Returns debug data.
    `Model` | `getModel()` Returns the current model
    `Resources` | `getResources()` Returns the resources.
    `void` | `removeListener(IView listener)` Unregisters a listener.
    `void` | `reset()` Resets the view.
    `void` | `update(ModelEvent event)` Updates the view.

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

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

- - ### Constructor Detail

    - #### Controller

          public Controller(MainWindow main)

      Creates a new controller.
      Parameters:
        `main` -

  - ### Method Detail

    - #### actionApplyLocalRecoding

          public void actionApplyLocalRecoding()

      Applies local recoding

    - #### actionApplySelectedTransformation

          public void actionApplySelectedTransformation()

      Applies the selected transformation.

    - #### actionClearEventLog

          public void actionClearEventLog()

      Clears the event log.

    - #### actionCriterionAdd

          public void actionCriterionAdd()

      Adds a criterion

    - #### actionCriterionConfigure

          public void actionCriterionConfigure(ModelCriterion criterion)

      Configures a criterion
      Parameters:
        `criterion` -

    - #### actionCriterionEnable

          public void actionCriterionEnable(ModelCriterion criterion)

      Enables and disables a criterion.
      Parameters:
        `criterion` -

    - #### actionCriterionPull

          public void actionCriterionPull(ModelCriterion criterion)

      Pull settings into the criterion.
      Parameters:
        `criterion` -

    - #### actionCriterionPush

          public void actionCriterionPush(ModelCriterion criterion)

      Pushes the settings of the criterion.
      Parameters:
        `criterion` -

    - #### actionDataShowGroups

          public void actionDataShowGroups()

      Toggles the "show groups" option.

    - #### actionDataSort

          public void actionDataSort(boolean input)

      Sorts the data.
      Parameters:
        `input` -

    - #### actionDataToggleSubset

          public void actionDataToggleSubset()

      Toggles the "subset" option.

    - #### actionExpand

          public void actionExpand(ARXLattice.ARXNode transformation)

      Expand action
      Parameters:
        `transformation` -

    - #### actionMenuEditAnonymize

          public void actionMenuEditAnonymize(boolean heuristicSearch)

      Starts the anonymization.
      Parameters:
        `heuristicSearch` -

    - #### actionMenuEditCreateHierarchy

          public void actionMenuEditCreateHierarchy()

      Starts the wizard.

    - #### actionMenuEditCreateTopBottomCodingHierarchy

          public void actionMenuEditCreateTopBottomCodingHierarchy()

      Initializes the hierarchy for the currently selected attribute with a scheme for top-/bottom coding.

    - #### actionMenuEditFindReplace

          public void actionMenuEditFindReplace()

      Find and replace action

    - #### actionMenuEditInitializeHierarchy

          public void actionMenuEditInitializeHierarchy()

      Initializes the hierarchy for the currently selected attribute

    - #### actionMenuEditReset

          public void actionMenuEditReset()

      Resets the current output

    - #### actionMenuEditSettings

          public void actionMenuEditSettings()

      Starts the "edit settings" dialog.

    - #### actionMenuFileCreateCertificate

          public void actionMenuFileCreateCertificate()

      Creates and displays a certificate

    - #### actionMenuFileExit

          public void actionMenuFileExit()

      File->exit.

    - #### actionMenuFileExportData

          public void actionMenuFileExportData()

      File->export data.

    - #### actionMenuFileExportHierarchy

          public void actionMenuFileExportHierarchy()

      File->Export hierarchy.

    - #### actionMenuFileImportData

          public void actionMenuFileImportData()

      File->Import data.

    - #### actionMenuFileImportHierarchy

          public void actionMenuFileImportHierarchy()

      File->Import hierarchy.

    - #### actionMenuFileNew

          public void actionMenuFileNew()

      File->New project.

    - #### actionMenuFileOpen

          public void actionMenuFileOpen()

      File->Open project.

    - #### actionMenuFileSave

          public void actionMenuFileSave()

      File->Save project.

    - #### actionMenuFileSaveAs

          public void actionMenuFileSaveAs()

      File->Save project as.

    - #### actionMenuHelpAbout

          public void actionMenuHelpAbout()

      Shows the "about" dialog.

    - #### actionMenuHelpDebug

          public void actionMenuHelpDebug()

      Shows the "debug" dialog.

    - #### actionMenuHelpHelp

          public void actionMenuHelpHelp()

      Shows the "help" dialog.

    - #### actionOpenProject

          public void actionOpenProject(java.lang.String path)

      Internal method for loading a project.
      Parameters:
        `path` -

    - #### actionShowAuditTrail

          public void actionShowAuditTrail()

      Shows the audit trail

    - #### actionShowCharsetInputDialog

          public java.nio.charset.Charset actionShowCharsetInputDialog(org.eclipse.swt.widgets.Shell shell)

      Shows an input dialog for selecting a charset.
      Parameters:
        `shell` -
      Returns:

    - #### actionShowErrorDialog

          public void actionShowErrorDialog(org.eclipse.swt.widgets.Shell shell,
                                   java.lang.String text,
                                   java.lang.Throwable t)

      Shows an error dialog.
      Parameters:
        `shell` -
        `text` -
        `t` -

    - #### actionShowFormatInputDialog

          public java.lang.String actionShowFormatInputDialog(org.eclipse.swt.widgets.Shell shell,
                                                     java.lang.String title,
                                                     java.lang.String text,
                                                     java.util.Locale locale,
                                                     DataType.DataTypeDescription<?> type,
                                                     java.util.Collection<java.lang.String> values)

      Shows a dialog for selecting a format string for a data type.
      Parameters:
        `shell` - The parent shell
        `title` - The dialog's title
        `text` - The dialog's text
        `locale` - The locale
        `type` - The description of the data type for which to choose a format string
        `values` - The values to check the format string against
      Returns:
        The format string, or `null` if no format was (or could be) selected

    - #### actionShowFormatInputDialog

          public java.lang.String actionShowFormatInputDialog(org.eclipse.swt.widgets.Shell shell,
                                                     java.lang.String title,
                                                     java.lang.String text,
                                                     java.util.Locale locale,
                                                     DataType.DataTypeDescription<?> type,
                                                     java.lang.String[] values)

      Shows a dialog for selecting a format string for a data type.
      Parameters:
        `shell` - The parent shell
        `title` - The dialog's title
        `text` - The dialog's text
        `locale` - The locale
        `type` - The description of the data type for which to choose a format string
        `values` - The values to check the format string against
      Returns:
        The format string, or `null` if no format was (or could be) selected

    - #### actionShowFormatInputDialog

          public java.lang.String actionShowFormatInputDialog(org.eclipse.swt.widgets.Shell shell,
                                                     java.lang.String title,
                                                     java.lang.String text,
                                                     java.lang.String preselected,
                                                     java.util.Locale locale,
                                                     DataType.DataTypeDescription<?> type,
                                                     java.util.Collection<java.lang.String> values)

      Shows a dialog for selecting a format string for a data type.
      Parameters:
        `shell` - The parent shell
        `title` - The dialog's title
        `text` - The dialog's text
        `preselected` - A preselected format string
        `locale` - The locale
        `type` - The description of the data type for which to choose a format string
        `values` - The values to check the format string against
      Returns:
        The format string, or `null` if no format was (or could be) selected

    - #### actionShowHelpDialog

          public void actionShowHelpDialog(java.lang.String id)

      Shows a help dialog.
      Parameters:
        `id` -

    - #### actionShowInfoDialog

          public void actionShowInfoDialog(org.eclipse.swt.widgets.Shell shell,
                                  java.lang.String header,
                                  java.lang.String text)

      Shows an info dialog.
      Parameters:
        `shell` -
        `header` -
        `text` -

    - #### actionShowInputDialog

          public java.lang.String actionShowInputDialog(org.eclipse.swt.widgets.Shell shell,
                                               java.lang.String header,
                                               java.lang.String text,
                                               java.lang.String initial)

      Shows an input dialog.
      Parameters:
        `shell` -
        `header` -
        `text` -
        `initial` -
      Returns:

    - #### actionShowInputDialog

          public java.lang.String actionShowInputDialog(org.eclipse.swt.widgets.Shell shell,
                                               java.lang.String header,
                                               java.lang.String text,
                                               java.lang.String initial,
                                               org.eclipse.jface.dialogs.IInputValidator validator)

      Shows an input dialog.
      Parameters:
        `shell` -
        `header` -
        `text` -
        `initial` -
      Returns:

    - #### actionShowMultiSelectionDialog

          public java.util.List<java.lang.String> actionShowMultiSelectionDialog(org.eclipse.swt.widgets.Shell shell,
                                                                        java.lang.String title,
                                                                        java.lang.String text,
                                                                        java.util.List<java.lang.String> elements,
                                                                        java.util.List<java.lang.String> selected)

      Shows a dialog for selecting multiple elements
      Parameters:
        `shell` -
        `title` -
        `text` -
        `elements` -
        `selected` -
      Returns:

    - #### actionShowOpenFileDialog

          public java.lang.String actionShowOpenFileDialog(org.eclipse.swt.widgets.Shell shell,
                                                  java.lang.String filter)

      Shows a "open file" dialog.
      Parameters:
        `shell` -
        `filter` -
      Returns:

    - #### actionShowOrderValuesDialog

          public java.lang.String[] actionShowOrderValuesDialog(org.eclipse.swt.widgets.Shell shell,
                                                       java.lang.String title,
                                                       java.lang.String text,
                                                       DataType<?> type,
                                                       java.util.Locale locale,
                                                       java.lang.String[] values)

      Shows an input dialog for ordering data items.
      Parameters:
        `shell` -
        `title` - The dialog's title
        `text` - The dialog's text
        `type` - The data type
        `locale` -
        `values` - The values
      Returns:

    - #### actionShowProgressDialog

          public void actionShowProgressDialog(java.lang.String text,
                                      Worker<?> worker)

      Shows a progress dialog.
      Parameters:
        `text` -
        `worker` -

    - #### actionShowQuestionDialog

          public boolean actionShowQuestionDialog(org.eclipse.swt.widgets.Shell shell,
                                         java.lang.String header,
                                         java.lang.String text)

      Shows a question dialog.
      Parameters:
        `shell` -
        `header` -
        `text` -
      Returns:

    - #### actionShowQuestionDialog

          public boolean actionShowQuestionDialog(java.lang.String header,
                                         java.lang.String text)

      Shows a question dialog.
      Parameters:
        `header` -
        `text` -
      Returns:

    - #### actionShowSaveFileDialog

          public java.lang.String actionShowSaveFileDialog(org.eclipse.swt.widgets.Shell shell,
                                                  java.lang.String filter)

      Internal method for showing a "save file" dialog.
      Parameters:
        `shell` -
        `filter` -
      Returns:

    - #### actionSubsetAll

          public void actionSubsetAll()

      Includes all tuples in the research subset.

    - #### actionSubsetFile

          public void actionSubsetFile()

      Creates a research subset from a file.

    - #### actionSubsetNone

          public void actionSubsetNone()

      Excludes all tuples from the subset.

    - #### actionSubsetQuery

          public void actionSubsetQuery()

      Creates a subset by executing a query.

    - #### actionSubsetRandom

          public void actionSubsetRandom()

      Creates a subset via random sampling

    - #### addListener

          public void addListener(ModelEvent.ModelPart target,
                         IView listener)

      Registers a listener at the controller.
      Parameters:
        `target` -
        `listener` -

    - #### dispose

          public void dispose()

      Description copied from interface: `IView`
      Disposes the view.
      Specified by:
        `dispose` in interface `IView`

    - #### getDebugData

          public java.lang.String getDebugData()

      Returns debug data.
      Returns:

    - #### getModel

          public Model getModel()

      Returns the current model
      Returns:

    - #### getResources

          public Resources getResources()

      Returns the resources.
      Returns:

    - #### removeListener

          public void removeListener(IView listener)

      Unregisters a listener.
      Parameters:
        `listener` -

    - #### reset

          public void reset()

      Description copied from interface: `IView`
      Resets the view.
      Specified by:
        `reset` in interface `IView`

    - #### update

          public void update(ModelEvent event)

      Description copied from interface: `IView`
      Updates the view.
      Specified by:
        `update` in interface `IView`