Class SHTMLPanelImpl

  • All Implemented Interfaces:
    SHTMLPrefsChangeListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CaretListener

    public class SHTMLPanelImpl
    extends SHTMLPanel
    implements javax.swing.event.CaretListener
    Main component of application SimplyHTML.

    This class constructs the main panel and all of its GUI elements such as menus, etc.

    It defines a set of inner classes creating actions which can be connected to menus, buttons or instantiated individually.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAction​(java.lang.String text, javax.swing.Action action)  
      void adjustDividers()
      adjust the divider sizes of SimplyHTML's SplitPanel according to visibility
      void caretUpdate​(javax.swing.event.CaretEvent e)
      caret listener implementation to track format changes
      void clearDockPanels()  
      static void configureActionProperties​(javax.swing.Action action, java.lang.String cmd)
      get action properties from the associated resource bundle
      javax.swing.JMenuItem createActionMenuItem​(java.lang.String actionName)
      Returns a new menu item for a named action of SimplyHTML.
      protected void createToolbarItem​(javax.swing.JToolBar toolBar, java.lang.String itemKey)  
      protected void customizeFrame()
      customize the frame to our needs
      javax.swing.Action getAction​(java.lang.String actionName)  
      int getCaretPosition()  
      javax.swing.text.html.HTMLDocument getDocument()  
      com.lightdev.app.shtm.DocumentPane getDocumentPane()  
      java.lang.String getDocumentText()
      Convenience method for obtaining the document text
      javax.swing.JEditorPane getEditorPane()  
      javax.swing.text.AttributeSet getMaxAttributes​(int caretPosition)  
      javax.swing.JMenuBar getMenuBar()  
      javax.swing.JEditorPane getMostRecentFocusOwner()  
      static SHTMLPanelImpl getOwnerSHTMLPanel​(java.awt.Component c)  
      SHTMLEditorPane getSHTMLEditorPane()  
      javax.swing.JEditorPane getSourceEditorPane()  
      static UIResources getUiResources()  
      protected void initActions()
      instantiate Actions and put them into the commands Hashtable for later use along with their action commands.
      protected void initDocumentPane()  
      boolean isHtmlEditorActive()  
      boolean isWYSIWYGEditorActive()  
      boolean needsSaving()
      indicates whether or not the document needs to be saved.
      void openHyperlink​(java.lang.String linkURL)  
      protected boolean processKeyBinding​(javax.swing.KeyStroke ks, java.awt.event.KeyEvent e, int condition, boolean pressed)  
      void refreshPluginDisplay​(SHTMLPlugin pi)
      refresh the display for a given plug-in
      protected void registerDocument()
      register FrmMain as an object which has interest in events from a given document pane
      static void setActionBuilder​(ActionBuilder ab)  
      void setContentPanePreferredSize​(java.awt.Dimension prefSize)  
      void setCurrentDocumentContent​(java.lang.String sText)
      Convenience method for setting the document text
      protected void setEditorPane​(SHTMLEditorPane editorPane)  
      static void setInternalUiResources()  
      void setOpenHyperlinkHandler​(java.awt.event.ActionListener openHyperlinkHandler)
      Sets the handler for the Open Hyperlink action.
      static void setUiResources​(UIResources uiResources)  
      void switchViews()
      Switches between the rich text view and the source view, given tabbed panes are not used.
      protected void unregisterDocument()
      remove FrmMain as a registered object from a given document pane and its components remove all plug-ins owned by this FrmMain from SimplyHTML objects too
      void updateActions()
      update all actions
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ACTION_SELECTED_KEY

        public static final java.lang.String ACTION_SELECTED_KEY
        See Also:
        Constant Field Values
      • ACTION_UNSELECTED

        public static final java.lang.String ACTION_UNSELECTED
        See Also:
        Constant Field Values
      • dynRes

        public com.lightdev.app.shtm.DynamicResource dynRes
        single instance of a dynamic resource for use by all
      • pluginManager

        public static com.lightdev.app.shtm.PluginManager pluginManager
        the plug-in manager of SimplyHTML
      • openHyperlinkHandler

        protected java.awt.event.ActionListener openHyperlinkHandler
      • doc

        protected SHTMLDocument doc
        currently active SHTMLDocument
      • pluginMenuId

        public final java.lang.String pluginMenuId
        plugin menu ID
        See Also:
        Constant Field Values
      • exitAction

        public static final java.lang.String exitAction
        action names these have to correspond with the keys in the resource bundle to allow for dynamic menu creation and control
        See Also:
        Constant Field Values
      • pasteOtherAction

        public static final java.lang.String pasteOtherAction
        See Also:
        Constant Field Values
      • clearFormatAction

        public static final java.lang.String clearFormatAction
        See Also:
        Constant Field Values
      • fontFamilyAction

        public static final java.lang.String fontFamilyAction
        See Also:
        Constant Field Values
      • increaseFontSizeAction

        public static final java.lang.String increaseFontSizeAction
        See Also:
        Constant Field Values
      • decreaseFontSizeAction

        public static final java.lang.String decreaseFontSizeAction
        See Also:
        Constant Field Values
      • fontStrikethroughAction

        public static final java.lang.String fontStrikethroughAction
        See Also:
        Constant Field Values
      • fontItalicAction

        public static final java.lang.String fontItalicAction
        See Also:
        Constant Field Values
      • fontUnderlineAction

        public static final java.lang.String fontUnderlineAction
        See Also:
        Constant Field Values
      • removeFontColorAction

        public static final java.lang.String removeFontColorAction
        See Also:
        Constant Field Values
      • selectedFontColorAction

        public static final java.lang.String selectedFontColorAction
        See Also:
        Constant Field Values
      • redFontColorAction

        public static final java.lang.String redFontColorAction
        See Also:
        Constant Field Values
      • blueFontColorAction

        public static final java.lang.String blueFontColorAction
        See Also:
        Constant Field Values
      • blackFontColorAction

        public static final java.lang.String blackFontColorAction
        See Also:
        Constant Field Values
      • greenFontColorAction

        public static final java.lang.String greenFontColorAction
        See Also:
        Constant Field Values
      • helpTopicsAction

        public static final java.lang.String helpTopicsAction
        See Also:
        Constant Field Values
      • insertTableAction

        public static final java.lang.String insertTableAction
        See Also:
        Constant Field Values
      • formatTableAction

        public static final java.lang.String formatTableAction
        See Also:
        Constant Field Values
      • toggleTableHeaderCellAction

        public static final java.lang.String toggleTableHeaderCellAction
        See Also:
        Constant Field Values
      • insertTableColAction

        public static final java.lang.String insertTableColAction
        See Also:
        Constant Field Values
      • insertTableRowAction

        public static final java.lang.String insertTableRowAction
        See Also:
        Constant Field Values
      • insertTableRowHeaderAction

        public static final java.lang.String insertTableRowHeaderAction
        See Also:
        Constant Field Values
      • appendTableRowAction

        public static final java.lang.String appendTableRowAction
        See Also:
        Constant Field Values
      • appendTableColAction

        public static final java.lang.String appendTableColAction
        See Also:
        Constant Field Values
      • deleteTableRowAction

        public static final java.lang.String deleteTableRowAction
        See Also:
        Constant Field Values
      • deleteTableColAction

        public static final java.lang.String deleteTableColAction
        See Also:
        Constant Field Values
      • nextTableCellAction

        public static final java.lang.String nextTableCellAction
        See Also:
        Constant Field Values
      • prevTableCellAction

        public static final java.lang.String prevTableCellAction
        See Also:
        Constant Field Values
      • moveTableRowUpAction

        public static final java.lang.String moveTableRowUpAction
        See Also:
        Constant Field Values
      • moveTableColumnLeftAction

        public static final java.lang.String moveTableColumnLeftAction
        See Also:
        Constant Field Values
      • moveTableColumnRightAction

        public static final java.lang.String moveTableColumnRightAction
        See Also:
        Constant Field Values
      • moveTableRowDownAction

        public static final java.lang.String moveTableRowDownAction
        See Also:
        Constant Field Values
      • toggleBulletsAction

        public static final java.lang.String toggleBulletsAction
        See Also:
        Constant Field Values
      • toggleNumbersAction

        public static final java.lang.String toggleNumbersAction
        See Also:
        Constant Field Values
      • formatListAction

        public static final java.lang.String formatListAction
        See Also:
        Constant Field Values
      • insertImageAction

        public static final java.lang.String insertImageAction
        See Also:
        Constant Field Values
      • formatImageAction

        public static final java.lang.String formatImageAction
        See Also:
        Constant Field Values
      • formatParaAction

        public static final java.lang.String formatParaAction
        See Also:
        Constant Field Values
      • editNamedStyleAction

        public static final java.lang.String editNamedStyleAction
        See Also:
        Constant Field Values
      • paraAlignLeftAction

        public static final java.lang.String paraAlignLeftAction
        See Also:
        Constant Field Values
      • paraAlignCenterAction

        public static final java.lang.String paraAlignCenterAction
        See Also:
        Constant Field Values
      • paraAlignRightAction

        public static final java.lang.String paraAlignRightAction
        See Also:
        Constant Field Values
      • insertLinkAction

        public static final java.lang.String insertLinkAction
        See Also:
        Constant Field Values
      • editAnchorsAction

        public static final java.lang.String editAnchorsAction
        See Also:
        Constant Field Values
      • documentTitleAction

        public static final java.lang.String documentTitleAction
        See Also:
        Constant Field Values
      • setDefaultStyleRefAction

        public static final java.lang.String setDefaultStyleRefAction
        See Also:
        Constant Field Values
      • findReplaceAction

        public static final java.lang.String findReplaceAction
        See Also:
        Constant Field Values
      • formatAsCodeAction

        public static final java.lang.String formatAsCodeAction
        See Also:
        Constant Field Values
    • Method Detail

      • getUiResources

        public static UIResources getUiResources()
      • setUiResources

        public static void setUiResources​(UIResources uiResources)
      • setInternalUiResources

        public static void setInternalUiResources()
      • getOwnerSHTMLPanel

        public static SHTMLPanelImpl getOwnerSHTMLPanel​(java.awt.Component c)
      • processKeyBinding

        protected boolean processKeyBinding​(javax.swing.KeyStroke ks,
                                            java.awt.event.KeyEvent e,
                                            int condition,
                                            boolean pressed)
        Overrides:
        processKeyBinding in class javax.swing.JComponent
      • createActionMenuItem

        public javax.swing.JMenuItem createActionMenuItem​(java.lang.String actionName)
        Description copied from class: SHTMLPanel
        Returns a new menu item for a named action of SimplyHTML. (Can be used for building custom popup menu, or for invoking the action externally in another way.)
        Specified by:
        createActionMenuItem in class SHTMLPanel
      • getAction

        public javax.swing.Action getAction​(java.lang.String actionName)
        Specified by:
        getAction in class SHTMLPanel
      • getDocumentText

        public java.lang.String getDocumentText()
        Convenience method for obtaining the document text
        Specified by:
        getDocumentText in class SHTMLPanel
        Returns:
        returns the document text as string.
      • needsSaving

        public boolean needsSaving()
        indicates whether or not the document needs to be saved.
        Specified by:
        needsSaving in class SHTMLPanel
        Returns:
        true, if changes need to be saved
      • setCurrentDocumentContent

        public void setCurrentDocumentContent​(java.lang.String sText)
        Convenience method for setting the document text
        Specified by:
        setCurrentDocumentContent in class SHTMLPanel
      • getDocument

        public javax.swing.text.html.HTMLDocument getDocument()
        Specified by:
        getDocument in class SHTMLPanel
        Returns:
        returns the currently used ExtendedHTMLDocument Object
      • adjustDividers

        public void adjustDividers()
        adjust the divider sizes of SimplyHTML's SplitPanel according to visibility
      • clearDockPanels

        public void clearDockPanels()
      • refreshPluginDisplay

        public void refreshPluginDisplay​(SHTMLPlugin pi)
        refresh the display for a given plug-in
        Parameters:
        pi - the plug-in to refresh
      • initDocumentPane

        protected void initDocumentPane()
      • initActions

        protected void initActions()
        instantiate Actions and put them into the commands Hashtable for later use along with their action commands. This is hard coded as Actions need to be instantiated hard coded anyway, so we do the storage in commands right away.
      • setActionBuilder

        public static void setActionBuilder​(ActionBuilder ab)
      • addAction

        public void addAction​(java.lang.String text,
                              javax.swing.Action action)
        Specified by:
        addAction in class SHTMLPanel
      • updateActions

        public void updateActions()
        update all actions
      • customizeFrame

        protected void customizeFrame()
        customize the frame to our needs
      • createToolbarItem

        protected void createToolbarItem​(javax.swing.JToolBar toolBar,
                                         java.lang.String itemKey)
      • registerDocument

        protected void registerDocument()
        register FrmMain as an object which has interest in events from a given document pane
      • unregisterDocument

        protected void unregisterDocument()
        remove FrmMain as a registered object from a given document pane and its components remove all plug-ins owned by this FrmMain from SimplyHTML objects too
      • isWYSIWYGEditorActive

        public boolean isWYSIWYGEditorActive()
      • isHtmlEditorActive

        public boolean isHtmlEditorActive()
      • configureActionProperties

        public static void configureActionProperties​(javax.swing.Action action,
                                                     java.lang.String cmd)
        get action properties from the associated resource bundle
        Parameters:
        action - the action to apply properties to
        cmd - the name of the action to get properties for
      • caretUpdate

        public void caretUpdate​(javax.swing.event.CaretEvent e)
        caret listener implementation to track format changes
        Specified by:
        caretUpdate in interface javax.swing.event.CaretListener
      • getMaxAttributes

        public javax.swing.text.AttributeSet getMaxAttributes​(int caretPosition)
      • getDocumentPane

        public com.lightdev.app.shtm.DocumentPane getDocumentPane()
        Returns:
        Returns the documentPane.
      • setEditorPane

        protected void setEditorPane​(SHTMLEditorPane editorPane)
      • getSHTMLEditorPane

        public SHTMLEditorPane getSHTMLEditorPane()
        Returns:
        Returns the editorPane.
      • getMenuBar

        public javax.swing.JMenuBar getMenuBar()
        Specified by:
        getMenuBar in class SHTMLPanel
      • switchViews

        public void switchViews()
        Description copied from class: SHTMLPanel
        Switches between the rich text view and the source view, given tabbed panes are not used. Has no corresponding action; calling this method is up to the caller application of SimplyHTML.
        Specified by:
        switchViews in class SHTMLPanel
      • setOpenHyperlinkHandler

        public void setOpenHyperlinkHandler​(java.awt.event.ActionListener openHyperlinkHandler)
        Description copied from class: SHTMLPanel
        Sets the handler for the Open Hyperlink action. SimplyHTML itself has no ability to open hyperlinks, so it forwards the action to the caller application.
        Specified by:
        setOpenHyperlinkHandler in class SHTMLPanel
      • openHyperlink

        public void openHyperlink​(java.lang.String linkURL)