|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ephox.editlive.custom.CustomTagController
public class CustomTagController
This class provides methods for registering additional views and view rendering to be used in conjunction with the ELJBean. Changing values via this class must be done before loading content into the editor, which means an early loading plugin (or before init() for Swing SDK users).
Instance available via ELJBean.getCustomTagController()
.
Constructor Summary | |
---|---|
CustomTagController()
|
Method Summary | |
---|---|
void |
addCustomView(String tagName,
int type,
Class<?> viewClass,
Object extraData)
Registers a new custom tag with a specific view. |
void |
clear()
Clears all custom tags, custom views, and view annotations |
CustomTagBehaviour |
getCustomTagBehaviour(String tagName)
Returns the behaviour object for a previously defined tag. |
Map<String,String> |
getCustomTags()
Returns the map of custom tag ids to custom tags. |
Map<HTML.Tag,com.ephox.editlive.common.CustomTagData> |
getCustomViews()
Returns the map of tag names to CustomTagData objects for all currently registered custom tags. |
HTML.Tag |
getDeclaredCustomTag(String tagName)
Finds an object reference to a previously declared custom tag. |
Object |
getUnregisteredCustomTagExtraData()
Returns the Unregistered Custom Tag Extra Data previously set by setUnregisteredCustomTagView(Class, Object) |
Class<?> |
getUnregisteredCustomTagView()
Returns the Unregistered Custom Tag View previously set by setUnregisteredCustomTagView(Class, Object) |
List<com.ephox.editlive.common.CustomTagData> |
getViewAnnotationsForTag(String tagName)
Retrieves the list of ViewAnnotation registered against the specified tag. |
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 |
registerCustomCollapsedView(String tagName,
Class<?> viewName,
Object extraData)
Registers a custom view for the specified inline tag. |
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 |
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 |
registerViewAnnotation(String tagName,
Class<?> clazz,
Object extraData)
Registers a class implementing ViewAnnotation to create additional rendering
for a specified HTML tag. |
void |
setUnregisteredCustomTagView(Class<?> viewClass,
Object extraData)
Sets the view to use for unregistered custom tags. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomTagController()
Method Detail |
---|
public HTML.Tag getDeclaredCustomTag(String tagName)
tagName
- name of a custom tag
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, Class<?> viewClass, Object extraData)
tagName
- the name of the tag to use the view for.viewClass
- the fully qualify class name for the View
for
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, Class<?> viewClass, Object extraData)
tagName
- the name of the tag to use the view for.viewClass
- the fully qualify class name for the View
for
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, Class<?> viewClass, Object extraData)
tagName
- the name of the tag to use the view for.viewClass
- the fully qualify class name for the View
for
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 registerCustomCollapsedView(String tagName, Class<?> viewName, Object extraData)
registerCustomInlineView(String, Class, Object)
, the contents of the tag will not be loaded and the
element loaded into the document will appear as an empty tag. When the document is retrieved the original
contents of the tag will be reinserted.
The contents of the tag is available as an URL encoded string in the eljcontent attribute of the parsed tag.
tagName
- the name of the tag.viewName
- the fully qualified class name for the View
for 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 setUnregisteredCustomTagView(Class<?> viewClass, Object extraData)
ELJBean.getCustomTagContent(String)
method. The ID for the custom tag can be retrieved from the
HTML.Attribute.ID
attribute.
viewClass
- the class to use for unregistered custom tag views. This class must have a constructor that takes
either just a Element
or an Element
and an Object
.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 Class<?> getUnregisteredCustomTagView()
setUnregisteredCustomTagView(Class, Object)
public Object getUnregisteredCustomTagExtraData()
setUnregisteredCustomTagView(Class, Object)
public void registerViewAnnotation(String tagName, Class<?> clazz, Object extraData)
ViewAnnotation
to create additional rendering
for a specified HTML tag.
tagName
- HTML tag for which additional rendering will be generatedclazz
- fully qualified class name for the ViewAnnotation
public List<com.ephox.editlive.common.CustomTagData> getViewAnnotationsForTag(String tagName)
ViewAnnotation
registered against the specified tag.
ViewAnnotation
public Map<HTML.Tag,com.ephox.editlive.common.CustomTagData> getCustomViews()
public Map<String,String> getCustomTags()
public CustomTagBehaviour getCustomTagBehaviour(String tagName)
tagName
- A valid tag (either in HTML.Tag
or a custom tag previously
registered)
public void addCustomView(String tagName, int type, Class<?> viewClass, Object extraData)
The type must be one of:
CustomTagData.BLOCK
CustomTagData.INLINE
CustomTagData.EMPTY
CustomTagData.COLLAPSABLE
tagName
- the name of the custom tag.type
- the type of the custom tag.viewClass
- the full class name of the view to use for this custom tag.extraData
- the extra data to provide to the views for this tag type.public void clear()
|
Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |