Class MarkdownTextAreaWithPreview

  • All Implemented Interfaces:
    adams.gui.core.TextAreaComponent, ImageObserver, MenuContainer, Serializable, Accessible

    public class MarkdownTextAreaWithPreview
    extends adams.gui.core.BasePanel
    implements adams.gui.core.TextAreaComponent
    Text area for handling Markdown with code and preview tabs.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_TabbedPane

        protected adams.gui.core.BaseTabbedPane m_TabbedPane
        the tabbed pane.
      • m_TextCode

        protected adams.gui.core.BaseTextArea m_TextCode
        the text area for writing markdown code.
      • m_PanePreview

        protected adams.gui.core.BaseHtmlEditorPane m_PanePreview
        the preview.
      • m_Processor

        protected org.markdownj.MarkdownProcessor m_Processor
        the markdown processor.
    • Constructor Detail

      • MarkdownTextAreaWithPreview

        public MarkdownTextAreaWithPreview()
    • Method Detail

      • initialize

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

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class adams.gui.core.BasePanel
      • setText

        public void setText​(String value)
        Sets the markdown code to display.
        Specified by:
        setText in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - the markdown code
      • getText

        public String getText()
        Returns the markdown code to display.
        Specified by:
        getText in interface adams.gui.core.TextAreaComponent
        Returns:
        the markdown code
      • getDocument

        public Document getDocument()
        Returns the underlying document.
        Specified by:
        getDocument in interface adams.gui.core.TextAreaComponent
        Returns:
        the document
      • getSelectedText

        public String getSelectedText()
        Returns the underlying text.
        Specified by:
        getSelectedText in interface adams.gui.core.TextAreaComponent
        Returns:
        the underlying text
      • setRows

        public void setRows​(int value)
        Sets the rows.
        Specified by:
        setRows in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - the rows
      • getRows

        public int getRows()
        Returns the rows.
        Specified by:
        getRows in interface adams.gui.core.TextAreaComponent
        Returns:
        the rows
      • setColumns

        public void setColumns​(int value)
        Sets the columns.
        Specified by:
        setColumns in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - the columns
      • getColumns

        public int getColumns()
        Returns the columns.
        Specified by:
        getColumns in interface adams.gui.core.TextAreaComponent
        Returns:
        the columns
      • setEditable

        public void setEditable​(boolean value)
        Sets whether the text area is editable or not.
        Specified by:
        setEditable in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - if true the text area is editable
      • isEditable

        public boolean isEditable()
        Returns whether the text area is editable or not.
        Specified by:
        isEditable in interface adams.gui.core.TextAreaComponent
        Returns:
        true if the text area is editable
      • setLineWrap

        public void setLineWrap​(boolean value)
        Sets whether to line wrap or not.
        Specified by:
        setLineWrap in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - if true line wrap is enabled
      • getLineWrap

        public boolean getLineWrap()
        Returns whether line wrap is enabled.
        Specified by:
        getLineWrap in interface adams.gui.core.TextAreaComponent
        Returns:
        true if line wrap wrap is enabled
      • setWrapStyleWord

        public void setWrapStyleWord​(boolean value)
        Sets whether to word wrap or not.
        Specified by:
        setWrapStyleWord in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - if true word wrap is enabled
      • getWrapStyleWord

        public boolean getWrapStyleWord()
        Returns whether word wrap is enabled.
        Specified by:
        getWrapStyleWord in interface adams.gui.core.TextAreaComponent
        Returns:
        true if word wrap wrap is enabled
      • setTextFont

        public void setTextFont​(Font value)
        Sets the text font.
        Specified by:
        setTextFont in interface adams.gui.core.TextAreaComponent
        Parameters:
        value - the font
      • getTextFont

        public Font getTextFont()
        Returns the text font in use.
        Specified by:
        getTextFont in interface adams.gui.core.TextAreaComponent
        Returns:
        the font
      • setCaretPosition

        public void setCaretPosition​(int pos)
        Sets the caret position.
        Specified by:
        setCaretPosition in interface adams.gui.core.TextAreaComponent
        Parameters:
        pos - the position (0-based)
      • getCaretPosition

        public int getCaretPosition()
        Returns the current caret position.
        Specified by:
        getCaretPosition in interface adams.gui.core.TextAreaComponent
        Returns:
        the position (0-based)
      • setCaretPositionLast

        public void setCaretPositionLast()
        Sets the position of the cursor at the end.
        Specified by:
        setCaretPositionLast in interface adams.gui.core.TextAreaComponent
      • update

        protected void update()
        Updates the markdown display.
      • main

        public static void main​(String[] args)
        For testing only.
        Parameters:
        args - ignored