com.ephox.editlive
Class ELJBean

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.ephox.editlive.ELJBean
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class ELJBean
extends JPanel

A JavaBean interface to EditLive!. This class provides methods to setup, initialize and work with EditLive! from within a Java application.

It is strongly recommended that you create an instance of ELJBean using the ELJBean(boolean) constructor, setting the parameter to false. Then use the set methods to configure the instance as required and finally call init() to initialize the bean so it is ready to be added to the GUI layout.

By deferring the initialization of the ELJBean until after all the configuration is complete, the start up time will be significantly reduced as the ELJBean will not need to reinitialize to accomodate changes.

Some features such as custom views will not work correctly unless they are configured prior to the ELJBean being initialized.

Since the ELJBean extends from and operates on Swing classes, all method calls should be performed on the Swing thread once the bean has been initialized. The call to init() should be made on the Swing thread.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ELJBean()
          Creates a standard EditLive!
ELJBean(boolean init)
          Creates a standard EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, Document dXML, boolean init)
          Creates a standard EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, File fXML)
          Creates a standard EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, File fXML, boolean init)
          Creates a standard EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, String sXML)
          Creates a standard EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, String sXML, boolean init)
          Creates a standard EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, URL xmlURL)
          Creates a EditLive!
ELJBean(String sHTML, String sStyles, int iWidth, int iHeight, URL xmlURL, boolean init)
          Creates a standard EditLive!
 
Method Summary
 void addEditorEventListener(EventListener oListener)
          Adds an editor listener for notification of any changes.
 void addHyperlinkDialogComponent(Class clazz, Object[] params)
          Adds a HyperlinkDialogComponent to the bean for use in the insert hyperlink dialog.
 void addHyperlinkDialogComponent(String className, Object[] params)
          Deprecated. This method does not work in the presence of multiple class loaders. Use addHyperlinkDialogComponent(Class, Object[]) instead.
 void addImageDialogComponent(Class clazz, Object[] params)
          Adds an ImageDialogComponent to the bean for use in the insert image dialog.
 void addImageDialogComponent(String className, Object[] params)
          Deprecated. This method does not work in the presence of multiple class loaders. Use addImageDialogComponent(Class, Object[]) instead.
 void clearUndos()
          Clears the current list of undos and redos for the bean.
static void enableDebugLogging()
          Turns on debug logging to assist with identifying problems.
 EphoxAction getAction(Map map)
           
 EphoxAction getAction(String name)
          Get the action with the specified name.
 String getBaseURL()
          Returns the Base URL used for loading resources (e.g. images, stylesheets) referenced with a relative URL.
 String getBody()
          Returns the body of HTML document currently in the Editor.
 int getCharacterCount()
          Retrieves the number of characters within the document.
 Document getConfigurationDOM()
          Returns the DOM being used for the configuration of this bean.
 File getConfigurationFile()
           Returns the Configuration File.
 String getConfigurationText()
           Returns the String version of the Configuration Text.
 String getConfigurationURL()
           Returns the String version of the Configuration URL.
 String getCookie()
          Returns the cookie that will be sent with HTTP requests.
 File getCurrentFile()
          Returns the file currently being edited.
 String getCurrentURL()
          Retrieves the last saved or opened URL.
 String getCustomTagContent(String id)
          Returns the value associated with a specified custom tag.
 String getDocument()
           Returns the content of the HTML document.
 DocumentModifier getDocumentModifier()
          Retrieves the document modifier.
 SourceFilter getFilter()
          Get the filter that will be applied to content on the way in and out of the editor.
 JTextPane getHTMLPane()
          Method used return the underlying JTextPane.
 HTTPUrlCallback getHttpUrlCallback()
          Gets the HTTPUrlCallback object to call into before making an http request to allow for user controlled redirects.
 String getHyperlinkAtCursor()
          Returns the currently selected hyperlink object or the selected text if there is not a hyperlink at the cursor.
 String getLoadTimeErrorMessage()
          Checks for a load-time error message that may have displayed to the user.
 JMenuBar getMenuBar()
          Returns the menubar for this bean.
 OperationManager getOperationManager()
          Gets the track changes operation manager.
 String getOutputCharacterSet()
          Retrieves the character set that content should be output in.
 PasteFilter getPasteFilter()
          Get the current paste filter.
 boolean getReadOnly()
          Get the read-only state of the bean
 JScrollPane getScrollPane()
          Returns the visible area of the editor
 String getSelectedText()
          Returns the currently selected text, including the html tags surrounding the text.
 String getStyles()
          Gets additional CSS styles being used by EditLive!.
 JTextComponent getTextPane()
          Get the JTextComponent used for the code view.
 JComponent getToolBar()
          Returns the toolbar for this bean.
static String getVersion()
          Returns the version number of EditLive!.
 String getWordAtCursor()
          Returns the current word that the cursor is in.
 int getWordCount()
          Retrieves the number of words within the document.
 void init()
          Initializes the bean.
 void insertHTMLAtCursor(String html)
          Inserts the specified html at the current caret position.
 boolean isCrippled()
          Determines whether or not functionality has been restricted.
 boolean isDirty()
          Returns true if the content in the editor has been changed.
 boolean isInitFinished()
          Checks if the bean init state has been updated after the LOADING_COMPLETE event has fired
 boolean isMenuEmbedded()
          Determines whether or not the menubar is currently embedded in the bean.
 boolean isToolBarEmbedded()
          Determines whether or not the toolbar is currently embedded in the bean.
 void raiseEvent(TextEvent e)
          Raises the given event which is broadcast across the application to any registered listeners.
 void registerCustomBlockTag(String tagName, Icon startIcon, String startLabel, Icon endIcon, String endLabel, ViewClickListener listener)
          Registers a custom block tag.
 void registerCustomBlockView(String tagName, Class viewClass, Object extraData)
          Registers a custom view for the specified block tag.
 void registerCustomBlockView(String tagName, String viewClass, Object extraData)
          Deprecated. This method does not work correctly when multiple class loaders are present. Use registerCustomBlockView(String,Class,Object) instead
 void registerCustomCollapsedView(String tagName, Class viewName, Object extraData)
          Registers a custom view for the specified inline tag.
 void registerCustomCollapsedView(String tagName, String viewName, Object extraData)
          Deprecated. This method does not work correctly when multiple class loaders are present. Use registerCustomCollapsedView(String,Class,Object) instead
 void registerCustomEmptyTag(String tagName, Icon icon, String label, ViewClickListener listener)
          Registers a custom empty tag.
 void registerCustomEmptyView(String tagName, Class viewClass, Object extraData)
          Registers a custom view for the specified empty tag.
 void registerCustomEmptyView(String tagName, String viewClass, Object extraData)
          Deprecated. This method does not work correctly when multiple class loaders are present. Use registerCustomEmptyView(String,Class,Object) instead
 void registerCustomInlineTag(String tagName, Icon startIcon, String startLabel, Icon endIcon, String endLabel, ViewClickListener listener)
          Registers a custom inline tag.
 void registerCustomInlineView(String tagName, Class viewClass, Object extraData)
          Registers a custom view for the specified inline tag.
 void registerCustomInlineView(String tagName, String viewClass, Object extraData)
          Deprecated. This method does not work correctly when multiple class loaders are present. Use registerCustomInlineView(String,Class,Object) instead
 void removeEditorEventListener(EventListener oListener)
          Removes an editor listener.
 void setBaseURL(String url)
          Sets the Base URL used for loading resources (e.g. images, stylesheets) when referenced with a relative URL.
 void setBody(String sBody)
           Sets the body of HTML document currently in the Editor.
 void setBrowserCallback(Object object)
          Provides the data required for custom actions which call back to functions in the browser to work.
 void setConfigurationDOM(Document doc)
          Sets the DOM to use as the configuration for this bean.
 void setConfigurationFile(File confFile)
           Sets the Configuration File.
 void setConfigurationText(String confT)
           Sets the Configuration Text.
 void setConfigurationURL(String conf)
           Sets the Configuration URL.
 void setCookie(String cookie)
          Sets the cookie to send with HTTP requests.
 void setCookie(String cookie, URL url)
          Sets the cookie to send with HTTP requests.
 void setCurrentFile(File file)
          Sets the path to the currently edited file.
 void setCustomResourceBundle(ResourceBundle b)
          Sets a custom resource bundle to be used for the user interface.
 void setCustomTagContent(String id, String value)
          Specifies a custom tag value and it's matching key identifier.
 void setDirty(boolean dirty)
          Sets whether or not the content in the editor has been changed.
 void setDocument(String doc)
          Sets the contents of the HTML document.
 void setFilter(SourceFilter filter)
          Set the filter to apply to content on the way in and out of the editor.
 void setHeight(int height)
          Sets the height in pixels.
 void setHttpLayerManager(String layerId)
          Sets the Http Layer manager that will be used when performing any http protocol requests.
 void setHTTPUrlCallback(HTTPUrlCallback req)
          Sets a HTTPUrlCallback object to call into before making an http request to allow for user controlled redirects.
 void setImageUploadHTTPRequestCallback(HTTPRequestCallback req)
          Sets a HTTPRequestCallback object to call into before each image is uploaded.
 void setMenuEmbedded(boolean embed)
          Sets whether or not the menubar is embedded in the bean.
 void setOutputCharacterSet(String charset)
          Sets the character set that content should be output in.
 void setPasteFilter(PasteFilter filter)
          Set the paste filter.
 void setReadOnly(boolean readOnly)
          Set the read-only state of the bean.
static void setSettingsDirectory(File settingsDirectory)
          Sets the directory that EditLive!
 void setStyles(String sStyles)
          Sets additional CSS styles to be used by EditLive!.
 void setToolBarEmbedded(boolean embed)
          Sets whether or not the toolbar is embedded in the bean.
 void setUnregisteredCustomTagView(Class viewClass, Object extraData)
          Sets the view to use for unregistered custom tags.
 void setUsername(String name)
          Set the username for track changes
 void setWidth(int width)
          Sets the width in pixels.
 void uploadLocalImages()
           Uploads all local images stored within the document and also adjusts their src attribute.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds,