Package ca.phon.ui

Class CommonModuleFrame

All Implemented Interfaces:
IExtendable, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
BufferWindow, IpaMapFrame, LogViewer, OpgraphEditor, ProjectFrame, ProjectParticpantsWindow, ProjectWindow, ReportTableExportDialog, ReportTreeToHTMLDialog, SimpleEditor, WelcomeWindow, WizardFrame

public class CommonModuleFrame extends JFrame implements IExtendable
The common class for a gui window
See Also:
  • Field Details

    • MACOS_ENABLE_FULLSCREEN

      public static final String MACOS_ENABLE_FULLSCREEN
      Property to enable fullscreen on macos
      See Also:
    • DEFAULT_MACOS_ENABLE_FULLSCREEN

      public static final boolean DEFAULT_MACOS_ENABLE_FULLSCREEN
      See Also:
    • title

      protected String title
  • Constructor Details

    • CommonModuleFrame

      public CommonModuleFrame()
      Creates a new CommonModuleFrame
    • CommonModuleFrame

      public CommonModuleFrame(String title)
      Creates a new CommonModuleFrame
      Parameters:
      title - the title string for the frame
  • Method Details

    • addNewWindowListener

      public static void addNewWindowListener(Object weakKey, CommonModuleFrameCreatedListener listener)
      Add a new window create listener to the list of static listeners. The weak key is used to determine when the listener should be removed from the listener queue.
      Parameters:
      weakKey -
      listener -
    • getOpenWindows

      public static List<CommonModuleFrame> getOpenWindows()
    • getProjectWindows

      public static Map<Project,List<CommonModuleFrame>> getProjectWindows()
      Return a map of projects and open windows for each project.
      Returns:
      project window map
    • getCurrentFrame

      public static CommonModuleFrame getCurrentFrame()
    • getUnsavedChangesTitle

      public String getUnsavedChangesTitle()
    • setUnsavedChangesTitle

      public void setUnsavedChangesTitle(String title)
    • getUnsavedChangesMessage

      public String getUnsavedChangesMessage()
    • setUnsavedChangesMessage

      public void setUnsavedChangesMessage(String message)
    • close

      public void close()
    • getTitle

      public String getTitle()
      Overridden to provide consistent naming in all windows. Use setWindowName() to setup the custom name for the window.
      Overrides:
      getTitle in class Frame
    • setWindowName

      public void setWindowName(String name)
      Set window name
    • getWindowName

      public String getWindowName()
      Get window name
    • display

      public void display()
    • getParentFrame

      public CommonModuleFrame getParentFrame()
    • setParentFrame

      public void setParentFrame(CommonModuleFrame frame)
    • isShowInWindowMenu

      public boolean isShowInWindowMenu()
    • setShowInWindowMenu

      public void setShowInWindowMenu(boolean showInWindowMenu)
    • centerWindow

      public void centerWindow()
      Center the window in the middle of the display. If size is not defined preferred size is used. If the window has already been realized, it will not be resized.
    • cascadeWindow

      public void cascadeWindow(JFrame frame)
    • placeTopRight

      public void placeTopRight()
      Places window in top-right corner of screen.
    • showOkDialog

      public void showOkDialog(String title, String message)
    • showOkCancelDialog

      public int showOkCancelDialog(String title, String message)
    • showYesNoDialog

      public int showYesNoDialog(String title, String message)
    • showYesNoCancelDialog

      public int showYesNoCancelDialog(String title, String message)
    • showMessageDialog

      public int showMessageDialog(String title, String message, String[] options)
      Display a message dialog to the user positioned for this window.
      Parameters:
      title -
      message -
      options - list of options displayed to the user
      Returns:
      the selected option
    • showStatusMessage

      public void showStatusMessage(String message)
    • showErrorMessage

      public void showErrorMessage(String message)
    • hideStatusComponent

      public void hideStatusComponent()
    • resetStatusComponent

      public void resetStatusComponent()
    • hasUnsavedChanges

      public boolean hasUnsavedChanges()
      Does this window have un-saved changes?
      Returns:
      true if this window has un-saved changes
    • setModified

      public void setModified(boolean modified)
    • saveAndClose

      public void saveAndClose()
      Save data and close window if save was successful.
    • saveData

      public boolean saveData() throws IOException
      Save window changes
      Throws:
      IOException
    • positionRelativeTo

      public void positionRelativeTo(int boxSide, int position, CommonModuleFrame component)
      Position the window relative to another window using the boxSize and position parameters.
      Parameters:
      boxSide - one of SwingConstants.TOP,BOTTOM,RIGHT,LEFT. The window will be positioned on this side of the given window.
      position - one of SwingConstants.LEADING,CENTER,TRAILING. The window will be positioned using standard left-to-right, top-to-bottom positioning based on this parameter.
      parentFrame - . The frame to use as the anchor.
      Throws:
      IllegalArgumentException - if boxSize or position are not one of the accept values.
    • getExtensions

      public Set<Class<?>> getExtensions()
      Description copied from interface: IExtendable
      Return all extension types supported
      Specified by:
      getExtensions in interface IExtendable
    • getExtension

      public <T> T getExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Get the requested extension if available.
      Specified by:
      getExtension in interface IExtendable
      Returns:
      the capability object or null if the cability is not available
    • putExtension

      public <T> T putExtension(Class<T> cap, T impl)
      Description copied from interface: IExtendable
      Add a new extension.
      Specified by:
      putExtension in interface IExtendable
      Parameters:
      cap - the extension to add
      Returns:
      the added extension implementation
    • removeExtension

      public <T> T removeExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Remove a capability.
      Specified by:
      removeExtension in interface IExtendable
      Parameters:
      cap - the capability to remove