Interface StrangeEonsEditor

    • Method Detail

      • setTitle

        void setTitle​(java.lang.String title)
        Sets the title of this document. As it shown in the document's tab, the title text should be kept short. The title value may be null, which is equivalent to an empty title.
        Parameters:
        title - the text of the title to display
      • getTitle

        java.lang.String getTitle()
        Returns the title used to describe this editor. The returned value is never null; if a null title is set with setTitle(java.lang.String) then this method returns an empty string.
        Returns:
        the current title, which is guaranteed not to be null
      • setFrameIcon

        void setFrameIcon​(javax.swing.Icon icon)
        Sets the preferred icon to use for this editor window. This icon may be used to represent the window in various parts of the application interface. Possible example uses include the following: the document tab, the editor's item in the Window menu, and the frame icon of the editor's detached window. Note, however, that there is no guarantee that the icon will be used, or how.
        Parameters:
        icon - the preferred icon for the editor window
        See Also:
        getFrameIcon()
      • getFrameIcon

        javax.swing.Icon getFrameIcon()
        Returns the editor window icon.
        Returns:
        the icon for the editor, or null if no icon is set
        See Also:
        #setFrameIcon()
      • setToolTipText

        void setToolTipText​(java.lang.String toolTipText)
        Sets the tool tip text to display for the editor's tab.
        Parameters:
        toolTipText - the text to display, or null to clear the tool tip
      • getToolTipText

        java.lang.String getToolTipText()
        Returns the tool tip text displayed for the editor's tab. If no tool tip has been explicitly set and getFile() returns a non-null value, then a default tool tip will be returned.
        Returns:
        the tool tip text to display, or null to clear the tool tip
      • close

        boolean close()
        Closes the editor window. If there are unsaved changes, the user will be prompted first and may cancel the close attempt.
        Returns:
        returns true if the editor was actually closed, or false if the user cancelled the attempt or closing was otherwise prevented
      • setAttached

        void setAttached​(boolean attach)
        Attaches or detaches an editor from the tab strip. A detached editor is shown in its own window, independent of the main application window.
        Parameters:
        attach - if true, attach a detached editor; otherwise detach the editor from the tab strip
      • isAttached

        boolean isAttached()
        Returns true if the editor is attached to the tab strip.
        Returns:
        true if the editor is attached to the main application window
      • getTabStripPopupMenu

        javax.swing.JPopupMenu getTabStripPopupMenu()
        Returns a popup menu for this editor when the editor's tab is right clicked in the document tab strip. Because a new menu instance is created each time it is called, subclasses may call a super implementation to obtain a default menu and then modify it.
        Returns:
        the popup menu that will be displayed when the user right clicks on the document's tab
      • getGameComponent

        GameComponent getGameComponent()
        Returns the edited game component, or null if this editor is not editing a game component.
        Returns:
        the game component currently being edited by this editor, or null
      • getFileNameExtension

        java.lang.String getFileNameExtension()
        Returns the standard file extension for the type of content displayed in this editor.
        Returns:
        a file extension, such as "txt"
        See Also:
        getFileTypeDescription()
      • getFileTypeDescription

        java.lang.String getFileTypeDescription()
        Returns a description of the content displayed in this editor. For English descriptions, this should be plural as it is used to describe the file type in save dialogs.
        Returns:
        a human-friendly description of the content associated with the editor, such as "Text Files"
        See Also:
        getFileNameExtension()
      • setFile

        void setFile​(java.io.File newFile)
        Sets the preferred file to use when saving the edited component.
        Parameters:
        newFile - the file to use for Save operations
        See Also:
        getFile()
      • getFile

        java.io.File getFile()
        Returns the file used to save this component, or null if it is a new, unsaved file or the editor is not associated with any particular file.
        Returns:
        the save file
        Since:
        2.1a5
        See Also:
        setFile(java.io.File)
      • hasUnsavedChanges

        boolean hasUnsavedChanges()
        Returns true if this editor is editing a file that has unsaved changes. If the content cannot be saved or does not use files, then this method should return false.
        Returns:
        true if the editor's content may be different from the saved version
      • canPerformCommand

        boolean canPerformCommand​(AbstractCommand command)
        Returns true if the commandable wishes to handle the given command. This method defines the set of commands that the commandable responds to. The commandable might not be able to act on the command at the current moment. For example, a commandable that responds to "Cut" could return true from handlesCommand, but false from Commandable.isCommandApplicable(ca.cgjennings.apps.arkham.commands.AbstractCommand) if there is currently no selection to cut.
        Specified by:
        canPerformCommand in interface Commandable
        Parameters:
        command - the command to be performed
        Returns:
        true if this commandable wishes to handle the command (even if it cannot execute the command currently)
      • save

        void save()
        Saves this editor's content to its current save location. If it has not been saved previously, and the command is supported, the user will be prompted to select a file (see saveAs()).

        Note that an editor can support the SAVE_AS command without supporting the SAVE command, but not vice-versa.

        Throws:
        java.lang.UnsupportedOperationException - if the SAVE command is not supported
        See Also:
        canPerformCommand(ca.cgjennings.apps.arkham.commands.AbstractCommand)
      • saveAs

        void saveAs()
        Saves this editor's content to a file selected by the user. The user may cancel the operation. If the save is performed, then the selected file will become the new save path for the component.
        Throws:
        java.lang.UnsupportedOperationException - if the SAVE_AS command is not supported
        See Also:
        canPerformCommand(ca.cgjennings.apps.arkham.commands.AbstractCommand)
      • print

        void print()
        Open the print dialog for this editor, allowing the user to print the edited component. If this operation is not supported by this editor, an UnsupportedOperationException is thrown.
        Throws:
        java.lang.UnsupportedOperationException - if the PRINT command is not supported
        See Also:
        canPerformCommand(ca.cgjennings.apps.arkham.commands.AbstractCommand)
      • spinOff

        StrangeEonsEditor spinOff()
        Creates a duplicate of this editor. A new editor containing a copy of this editor's content will be created and added to the application. The new component is a deep copy, not a reference (changes to the new component do not affect the original, and vice-versa).
        Returns:
        the new, duplicate editor
        Throws:
        java.lang.UnsupportedOperationException - if the SPIN_OFF command is not supported
        See Also:
        canPerformCommand(ca.cgjennings.apps.arkham.commands.AbstractCommand)