Class OpenVersionedFileDialog<T extends DomainObject>

Type Parameters:
T - domain object class
All Implemented Interfaces:
ActionContextProvider, GTreeSelectionListener, StatusListener, TaskListener, ActionListener, EventListener

public class OpenVersionedFileDialog<T extends DomainObject> extends AbstractDataTreeDialog
Dialog to open a file that is versioned and allow a version to be opened.
  • Constructor Details

    • OpenVersionedFileDialog

      public OpenVersionedFileDialog(PluginTool tool, String title, Class<T> domainObjectClass)
      Constructor
      Parameters:
      tool - tool where the file is being opened.
      title - title to use
      domainObjectClass - allowed domain object class which corresponds to <T>
    • OpenVersionedFileDialog

      public OpenVersionedFileDialog(PluginTool tool, String title, Class<T> domainObjectClass, List<T> openDomainObjects)
      Constructor
      Parameters:
      tool - tool where the file is being opened.
      title - title to use
      domainObjectClass - allowed domain object class which corresponds to <T>
      openDomainObjects - if non-null, will cause an additional tab showing the given list of open domain objects that the user can select from
  • Method Details

    • getDomainObject

      public T getDomainObject(Object consumer, boolean immutable)
      Get the selected domain object for read-only or immutable use. If an existing open object is selected its original mode applies but consumer will be added. The caller/consumer is responsible for releasing the returned domain object when done using it (see DomainObject.release(Object)).
      Parameters:
      consumer - domain object consumer
      immutable - true if the domain object should be opened immutable, else false for read-only. Immutable mode should not be used for content that will be modified. If read-only indicated an upgrade will always be performed if required.
      Returns:
      opened domain object or null if a file was not selected or if open failed to complete.
    • getVersion

      public int getVersion()
      Return the selected version number from the history panel.
      Returns:
      -1 if a version history was not selected
    • getDomainFile

      public DomainFile getDomainFile()
      Description copied from class: AbstractDataTreeDialog
      Get the selected domain file.
      Overrides:
      getDomainFile in class AbstractDataTreeDialog
      Returns:
      null if there was no domain file selected
    • getDomainFolder

      public DomainFolder getDomainFolder()
      Description copied from class: AbstractDataTreeDialog
      Get the selected folder.
      Overrides:
      getDomainFolder in class AbstractDataTreeDialog
      Returns:
      null if there was no domain folder selected
    • buildMainPanel

      protected JPanel buildMainPanel()
    • close

      public void close()
      Overrides:
      close in class AbstractDataTreeDialog
    • dialogShown

      protected void dialogShown()
      Description copied from class: DialogComponentProvider
      Override this method if you want to do something when the dialog is made visible
      Overrides:
      dialogShown in class DialogComponentProvider
    • dialogClosed

      protected void dialogClosed()
      Description copied from class: DialogComponentProvider
      Override this method if you want to do something when the dialog is made invisible
      Overrides:
      dialogClosed in class DialogComponentProvider
    • addTreeListeners

      protected void addTreeListeners()
      Overrides:
      addTreeListeners in class AbstractDataTreeDialog
    • getActionContext

      public ActionContext getActionContext(MouseEvent event)
      Description copied from class: DialogComponentProvider
      An optional extension point for subclasses to provider action context for the actions used by this provider.
      Specified by:
      getActionContext in interface ActionContextProvider
      Overrides:
      getActionContext in class AbstractDataTreeDialog
      Parameters:
      event - The mouse event used (may be null) to generate a popup menu