Class TextPanel

    • Field Detail

      • m_MenuBar

        protected JMenuBar m_MenuBar
        the menu bar.
      • m_TextPanel

        protected TextEditorPanel m_TextPanel
        for displaying the text.
      • m_PanelInfo

        protected JPanel m_PanelInfo
        the panel with optional info text.
      • m_LabelInfo

        protected JLabel m_LabelInfo
        the label with the option info text.
      • m_MenuItemFileNew

        protected JMenuItem m_MenuItemFileNew
        the new menu item.
      • m_MenuItemFileOpen

        protected JMenuItem m_MenuItemFileOpen
        the open menu item.
      • m_MenuFileLoadRecent

        protected JMenu m_MenuFileLoadRecent
        the "load recent" submenu.
      • m_MenuItemFileSave

        protected JMenuItem m_MenuItemFileSave
        the save menu item.
      • m_MenuItemFileSaveAs

        protected JMenuItem m_MenuItemFileSaveAs
        the save as menu item.
      • m_MenuItemEditUndo

        protected JMenuItem m_MenuItemEditUndo
        the undo menu item.
      • m_MenuItemEditRedo

        protected JMenuItem m_MenuItemEditRedo
        the redo menu item.
      • m_MenuItemEditCut

        protected JMenuItem m_MenuItemEditCut
        the cut menu item.
      • m_MenuItemEditCopy

        protected JMenuItem m_MenuItemEditCopy
        the copy menu item.
      • m_MenuItemEditPaste

        protected JMenuItem m_MenuItemEditPaste
        the paste menu item.
      • m_MenuItemEditSelectAll

        protected JMenuItem m_MenuItemEditSelectAll
        the select all menu item.
      • m_MenuItemEditFind

        protected JMenuItem m_MenuItemEditFind
        the find menu item.
      • m_MenuItemEditFindNext

        protected JMenuItem m_MenuItemEditFindNext
        the find next menu item.
      • m_MenuItemViewTabSize

        protected JMenuItem m_MenuItemViewTabSize
        the tab size menu item.
      • m_MenuItemViewFont

        protected JMenuItem m_MenuItemViewFont
        the select font menu item.
      • m_MenuItemViewLineWrap

        protected JCheckBoxMenuItem m_MenuItemViewLineWrap
        the line wrap menu item.
      • m_CanOpenFiles

        protected boolean m_CanOpenFiles
        whether the editor is allowed to open files as well.
      • m_TitleGenerator

        protected TitleGenerator m_TitleGenerator
        for generating the title.
    • Constructor Detail

      • TextPanel

        public TextPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        For initializing the GUI.
        Overrides:
        initGUI in class BasePanel
      • setCanOpenFiles

        public void setCanOpenFiles​(boolean value)
        Sets whether the editor can open files.
        Parameters:
        value - if true then the editor can open files as well
      • getCanOpenFiles

        public boolean getCanOpenFiles()
        Returns whether the editor can open files.
        Returns:
        true if the editor can open files
      • setTitle

        public void setTitle​(String value)
        Sets the base title to use for the title generator.
        Parameters:
        value - the title to use
        See Also:
        m_TitleGenerator
      • getTitle

        public String getTitle()
        Returns the base title in use by the title generator.
        Returns:
        the title in use
        See Also:
        m_TitleGenerator
      • getTitleGenerator

        public TitleGenerator getTitleGenerator()
        Returns the title generator in use.
        Returns:
        the generator
      • setPopupMenuCustomizer

        public void setPopupMenuCustomizer​(PopupMenuCustomizer<TextEditorPanel> value)
        Sets the customizer to use.
        Parameters:
        value - the customizer, null to unset
      • setModified

        public void setModified​(boolean value)
        Sets the modified state.
        Parameters:
        value - if true then the content is flagged as modified
      • isModified

        public boolean isModified()
        Returns whether the content has been modified.
        Returns:
        true if the content was modified
      • setContent

        public void setContent​(String value)
        Sets the content to display. Resets the modified state.
        Parameters:
        value - the text
      • getContent

        public String getContent()
        Returns the content to display.
        Returns:
        the text
      • setInfoText

        public void setInfoText​(String value)
        Sets the info text to display.
        Parameters:
        value - the text, null or empty string to hide
      • getInfoText

        public String getInfoText()
        Returns the current info text.
        Returns:
        the text
      • setEditable

        public void setEditable​(boolean value)
        Sets whether the text area is editable or not.
        Parameters:
        value - if true then the text will be editable
      • isEditable

        public boolean isEditable()
        Returns whether the text area is editable or not.
        Returns:
        true if the text is editable
      • setTextFont

        public void setTextFont​(Font value)
        Sets the font of the text area.
        Parameters:
        value - the font to use
      • getTextFont

        public Font getTextFont()
        Returns the font currently in use by the text area.
        Returns:
        the font in use
      • setTabSize

        public void setTabSize​(int value)
        Sets the tab size, i.e., the number of maximum width characters.
        Parameters:
        value - the number of maximum width chars
      • getTabSize

        public int getTabSize()
        Returns the tab size, i.e., the number of maximum width characters.
        Returns:
        the number of maximum width chars
      • setLineWrap

        public void setLineWrap​(boolean value)
        Enables/disables line wrap.
        Parameters:
        value - if true line wrap gets enabled
      • getLineWrap

        public boolean getLineWrap()
        Returns whether line wrap is enabled.
        Returns:
        true if line wrap enabled
      • setCaretPosition

        public void setCaretPosition​(int value)
        Sets the position of the cursor.
        Parameters:
        value - the position
      • getCaretPosition

        public int getCaretPosition()
        Returns the current position of the cursor.
        Returns:
        the cursor position
      • addRecentItem

        protected void addRecentItem()
        Adds the current file/encoding as recent item.
      • getMenuBar

        public JMenuBar getMenuBar()
        Creates a menu bar (singleton per panel object). Can be used in frames.
        Specified by:
        getMenuBar in interface MenuBarProvider
        Returns:
        the menu bar
      • update

        protected void update()
        Updates title and menu items.
      • updateTitle

        protected void updateTitle()
        Updates the title of the dialog.
      • updateMenu

        protected void updateMenu()
        Updates the state of the menu items.
      • close

        protected void close()
        Closes the dialog, if possible.
      • open

        public void open​(File file)
        Opens the specified file using UTF-8 and loads/displays the content.
        Parameters:
        file - the file to load
        See Also:
        getCanOpenFiles()
      • open

        public void open​(File file,
                         String encoding)
        Opens the specified file and loads/displays the content.
        Parameters:
        file - the file to load
        encoding - the encoding to use, null for default UTF-8
        See Also:
        getCanOpenFiles()
      • hasSendToItem

        public boolean hasSendToItem​(Class[] cls)
        Checks whether something to send is available.
        Specified by:
        hasSendToItem in interface SendToActionSupporter
        Parameters:
        cls - the requested classes
        Returns:
        true if an object is available for sending
      • setUpdateParentTitle

        public void setUpdateParentTitle​(boolean value)
        Sets whether to update the parent's title.
        Parameters:
        value - if true the parent's title will get updated
      • getUpdateParentTitle

        public boolean getUpdateParentTitle()
        Returns whether to update the parent's title.
        Returns:
        true if to update the parent's title
      • printText

        public void printText()
        Pops up a print dialog.