|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.ephox.editlive.ELXBean
This class provides a simple JavaBean style interface to EditLive! for XML.
The general usage pattern of this class is that you create a new instance, set the appropriate
properties and then call init(). init() should only be called once.
Most methods should only be called before init() is called, methods which do work after
init() has been called are explicitely marked with the text:
This method may be called after init() has been called.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Field Summary |
| Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, 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 | |
ELXBean()
Creates a new ELXBean with the default settings. |
|
| Method Summary | |
void |
addEditorEventListener(EventListener oListener)
Adds an editor listener for notification of any changes. |
void |
addHyperlinkDialogComponent(String className,
Object[] params)
Adds a HyperlinkDialogComponent to the bean for use in the insert hyperlink dialog. |
void |
addImageDialogComponent(String className,
Object[] params)
Adds an ImageDialogComponent to the bean for use in the insert image dialog. |
void |
addSchema(String xsd)
Adds the specified schema to the bean. |
void |
addView(String name,
String xslt)
Adds a view to the component. |
void |
addView(String name,
URL url)
Adds a view to the component. |
String |
getBaseURL()
Returns the Base URL used for loading resources (e.g. |
Document |
getConfigurationDocument()
Get the DOM the XML configuration will be loaded from. |
File |
getConfigurationFile()
Get the file the XML configuration will be loaded from. |
String |
getConfigurationText()
Get the String the XML configuration will be loaded from. |
URL |
getConfigurationURL()
Get the URL the XML configuration will be loaded from. |
String |
getCookie()
Returns the cookie that will be sent with HTTP requests. |
File |
getCurrentFile()
Returns the file currently being edited. |
String |
getDocument()
Returns the XML document being edited. |
Document |
getDOM()
Get the DOM for the document being edited. |
String |
getEphoxIdFor(Node node)
Returns the EphoxID for the specified node. |
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. |
JMenuBar |
getMenuBar()
Returns the menubar for this bean. |
Node |
getNode(String ephoxID)
Retrieves a node from the DOM being edited. |
String |
getOutputCharset()
Returns the character set to be used when outputting the document. |
String |
getSchemaLocation()
Returns the list of URLs to download XML schema from. |
void |
init()
Initializes the component so that it is ready for display. |
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 |
isInited()
Get the inited |
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 |
loadSolution(URL solution)
Load the schema and views from the specified solution. |
void |
raiseEvent(TextEvent e)
Method used to raise an event within EditLive! for XML. |
void |
refreshDisplay()
Updates the display to reflect any changes to the structure of the XML DOM. |
void |
registerCustomBlockTag(String tagName,
Icon startIcon,
String startLabel,
Icon endIcon,
String endLabel,
ViewClickListener listener)
Registers a custom block tag. |
void |
registerCustomBlockView(String tagName,
String viewClass,
Object extraData)
Registers a custom view for the specified block tag. |
void |
registerCustomEmptyTag(String tagName,
Icon icon,
String label,
ViewClickListener listener)
Registers a custom empty tag. |
void |
registerCustomEmptyView(String tagName,
String viewClass,
Object extraData)
Registers a custom view for the specified empty tag. |
void |
registerCustomInlineTag(String tagName,
Icon startIcon,
String startLabel,
Icon endIcon,
String endLabel,
ViewClickListener listener)
Registers a custom inline tag. |
void |
registerCustomInlineView(String tagName,
String viewClass,
Object extraData)
Registers a custom view for the specified inline tag. |
void |
removeEditorEventListener(EventListener oListener)
Removes an editor listener. |
void |
setBaseURL(String url)
Sets the Base URL used for loading resources (e.g. |
void |
setBrowserCallback(Object object)
Provides the data required for custom actions which call back to functions in the browser to work. |
void |
setConfigurationDocument(Document configuration)
Set the DOM to load the configuration from. |
void |
setConfigurationFile(File configuration)
Set the file to load the configuration from. |
void |
setConfigurationText(String configuration)
Set the configuration. |
void |
setConfigurationURL(URL configuration)
Set the URL to load the configuration from. |
void |
setCookie(String cookie)
Adds a cookie to send with HTTP requests. |
void |
setCurrentFile(File file)
Sets the path to the currently edited file. |
void |
setDirty(boolean dirty)
Sets whether or not the content in the editor has been changed. |
void |
setDocument(String xml)
Sets the XML document to edit. |
void |
setFilter(SourceFilter filter)
Set the filter to apply to content on the way in and out of the editor. |
void |
setMenuEmbedded(boolean embed)
Sets whether or not the menubar is embedded in the bean. |
void |
setOutputCharset(String encoding)
Sets the character set to use when outputting the document. |
void |
setPreviewXSLT(String xslt)
Set the preview XSLT to use as a text string. |
void |
setPreviewXSLT(URL url)
Set the URL to download the preview XSLT from. |
void |
setSchemaLocation(String locations)
Sets the list of URLs to download XML schemas from. |
void |
setToolBarEmbedded(boolean embed)
Sets whether or not the toolbar is embedded in the bean. |
void |
uploadLocalFiles()
Uploads all local images and embedded objects stored within the document and also adjusts their src attribute. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ELXBean()
| Method Detail |
public void addView(String name,
URL url)
name - the name of the view.url - the URL to download the XSLT from.addView(String, String)
public void addView(String name,
String xslt)
name - the name of the view.xslt - the XSLT for the view.addView(String, URL)public void setPreviewXSLT(String xslt)
xslt - the XSLT to use for the preview.public void setPreviewXSLT(URL url)
url - the URL to download the preview XSLT from.public void addSchema(String xsd)
xsd - the schema to add as a String.
public void loadSolution(URL solution)
throws IOException
solution - the URL to the solution. This may be a http, file or jar URL.
IOException - if an error occurs while accessing the solution.public Node getNode(String ephoxID)
will raise and event with the extra string containing the ephoxid of the context element. For attributes, the EphoxID is defined as the EphoxID of the owner node with "@" and the name of the attribute appended to it. If the attribute in question is the current context node, the following XPath expression would create the correct EphoxID:
concat(../@ephoxid, '@', local-name())
For Text nodes, the EphoxID is defined as the EphoxID of the parent node with # and the position of the text node appended to it. If the text node in question is the current context node, the following XPath expression would create the correct EphoxID:
concat(../@ephoxid, '#', position())
It is important that structural changes (adding or removing nodes) must not be performed on the DOM as the changes will not be correctly identified by EditLive! for XML. Future versions will add support for these changes.
All access to the node must be done within a synchronized block synchronizing on the owner document for the node. For example:
Node n = bean.getNode(ephoxid);
synchronized (n.getOwnerDocument()) {
n.setNodeValue("Test Value");
}
ephoxID - the EphoxID of the node to retrieve.
public String getEphoxIdFor(Node node)
node - the node to retrieve the id for.
public Document getDOM()
public void refreshDisplay()
public void setSchemaLocation(String locations)
#addXSD(String).
locations - a whitespace separated list of URLs to download schemas from.public String getSchemaLocation()
#addXSD(String).
public void setDocument(String xml)
This method may be called after init() has been called.
xml - the XML to edit as a String.public String getDocument()
This method may be called after init() has been called.
public void setCurrentFile(File file)
TextEvent.SAVE_ACTION
will save to this file without prompting the user. If set to null, the user will be prompted as in the
TextEvent.SAVE_AS_ACTION. The default behaviour of the TextEvent.OPEN_ACTION and
TextEvent.SAVE_AS_ACTION will set the current file to the users selection.
file - the file to save to by default.getCurrentFile()public File getCurrentFile()
setCurrentFile(File)public boolean isDirty()
This method may be called after init() has been called.
public void setDirty(boolean dirty)
This method may be called after init() has been called.
dirty - true if the content in the editor has been changed,
otherwise false.public void addEditorEventListener(EventListener oListener)
This method may be called after init() has been called.
oListener - Object to add to listener list.public void removeEditorEventListener(EventListener oListener)
This method may be called after init() has been called.
oListener - Object to remove from listener list.public void raiseEvent(TextEvent e)
See the documentation for TextEvent for information about what the events can be fired.
This method may be called after init() has been called.
e - TextEvent to be parsed.public void setCookie(String cookie)
cookie - the cookie to include with any HTTP requests generated.getCookie()public String getCookie()
setCookie(String)public JTextPane getHTMLPane()
#isLoadingComplete()returns true.
public void registerCustomBlockTag(String tagName,
Icon startIcon,
String startLabel,
Icon endIcon,
String endLabel,
ViewClickListener listener)
tagName - the name of the custom block tag.startIcon - the icon to display at the start of the block, or null
for no icon.startLabel - the label to display at the start of the block, or null
for no label.endIcon - the icon to display at the end of the block, or null for
no icon.endLabel - the label to display at the end of the block, or null for
no label.listener - the listener to notify of mouse click events, or null if
no notification is required.
public void registerCustomInlineTag(String tagName,
Icon startIcon,
String startLabel,
Icon endIcon,
String endLabel,
ViewClickListener listener)
tagName - the name of the custom inline tag.startIcon - the icon to display at the start of the tag, or null for
no icon.startLabel - the label to display at the start of the tag, or null
for no label.endIcon - the icon to display at the end of the tag, or null for no
icon.endLabel - the label to display at the end of the tag, or null for
no label.listener - the listener to notify of mouse click events, or null if
no notification is required.
public void registerCustomEmptyTag(String tagName,
Icon icon,
String label,
ViewClickListener listener)
tagName - the name of the custom inline tag.icon - the icon to display for the tag, or null for no icon.label - the label to display for the tag, or null for no label.listener - the listener to notify of mouse click events, or null if
no notification is required.
public void registerCustomBlockView(String tagName,
String viewClass,
Object extraData)
tagName - the name of the tag to use the view for.viewClass - the fully qualify class name for the Viewfor
the tag.extraData - this can be any object (or null) and is passed into the
constructor for viewClass if it has a constructor that takes
both an element and an object.
public void registerCustomInlineView(String tagName,
String viewClass,
Object extraData)
tagName - the name of the tag to use the view for.viewClass - the fully qualify class name for the Viewfor
the tag.extraData - this can be any object (or null) and is passed into the
constructor for viewClass if it has a constructor that takes
both an element and an object.
public void registerCustomEmptyView(String tagName,
String viewClass,
Object extraData)
tagName - the name of the tag to use the view for.viewClass - the fully qualify class name for the Viewfor
the tag.extraData - this can be any object (or null) and is passed into the
constructor for viewClass if it has a constructor that takes
both an element and an object.public boolean isMenuEmbedded()
public void setMenuEmbedded(boolean embed)
If set to false, the menubar will not be displayed in the bean and the application must ensure that it adds the menubar to the frame.
embed - true if the menubar should be embedded, otherwise false.getMenuBar()public JMenuBar getMenuBar()
setMenuEmbedded(boolean),
isMenuEmbedded()public boolean isToolBarEmbedded()
public void setToolBarEmbedded(boolean embed)
If set to false, the toolbar will not be displayed in the bean and the application must ensure that it adds the toolbar to the frame.
embed - true if the toolbar should be embedded, otherwise false.#getToolBar()public void insertHTMLAtCursor(String html)
html - the html to insert.public void uploadLocalFiles()
public boolean isCrippled()
public void setBrowserCallback(Object object)
object - the callback. On Windows, Solaris and Linux this should be
an instance of netscape.javascript.JSObject.
On OS X it should be a String representing the JavaScript path
to the frame the applet is in eg:
window.mainFrame.contentFrame
public void addImageDialogComponent(String className,