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.
        initialize in class BasePanel
      • initGUI

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public int getCaretPosition()
        Returns the current position of the cursor.
        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
        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.
        file - the file to load
        See Also:
      • open

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

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

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

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

        public void printText()
        Pops up a print dialog.