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 DataTreeDialog
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>
  • Method Details

    • setOpenObjectChoices

      public void setOpenObjectChoices(List<T> openDomainObjects)
      Set an optional list of already open domain objects of type <T> which may be selected instead of a project domain file. The getDomainObject(Object, boolean) method should be used when this optional list has been set. If this dialog is reused the list should be set null if previously set. This method must be invoked prior to showing the dialog.
      Parameters:
      openDomainObjects - list of open domain objects from which a selection may be made.
    • 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: DataTreeDialog
      Get the selected domain file.
      Overrides:
      getDomainFile in class DataTreeDialog
      Returns:
      null if there was no domain file selected
    • getDomainFolder

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

      protected JPanel buildMainPanel()
      Overrides:
      buildMainPanel in class DataTreeDialog
    • close

      public void close()
      Overrides:
      close in class DataTreeDialog
    • 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 DataTreeDialog
    • 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 DataTreeDialog
    • 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 DataTreeDialog
      Parameters:
      event - The mouse event used (may be null) to generate a popup menu