org.eclipse.jst.pagedesigner.converter
Class AbstractTagConverter
java.lang.Object
org.eclipse.jst.pagedesigner.converter.AbstractTagConverter
-
All Implemented Interfaces:
-
IDOMFactory,
ITagConverter, org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
-
Direct Known Subclasses:
-
DefaultUnknownTagConverter,
DumDeepTagConverter,
DumDescriptionTagConverter,
DumTagConverter,
HiddenTagConverter2,
HTMLStringTagConverter,
TagConverterToDumBlock,
TagConverterToInlineBlock,
TagConverterToSpan
-
public abstract class AbstractTagConverter
- extends java.lang.Object
- implements
ITagConverter, org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo,
IDOMFactory
This is base class for all non-hidden tag converters.
-
Version:
- 1.5
Method Summary
|
void
|
convertRefresh
(java.lang.Object context)
refresh the internal state of this ITagConverter. |
org.w3c.dom.Element
|
createElement
(java.lang.String tagName)
shortcut method. |
org.w3c.dom.Text
|
createText
(java.lang.String text)
shortcut method. |
void
|
dispose
()
API contract needed here |
java.util.List
|
getChildModeList
()
|
ConvertPosition
|
getChildVisualPosition
(org.w3c.dom.Node childModel)
For child nodes that need further convert, return their position in the
converted DOM tree. |
IDOMDocument
|
getDestDocument
()
In the future, the conversion result HTML DOM tree could be in another
document. |
org.w3c.dom.Element
|
getHostElement
()
|
int
|
getMinHeight
()
|
int
|
getMinWidth
()
for some element in design mode we want to them to have a default min
size. |
int
|
getMode
()
|
java.util.List
|
getNonVisualChildren
()
|
org.w3c.dom.Element
|
getResultElement
()
|
Image
|
getVisualImage
()
if isVisualByHTML() return false, then this method should return an image
to be displayed in designer. |
static boolean
|
hasAttribute
(org.w3c.dom.Element element,
java.lang.String attrname)
|
boolean
|
isAdapterForType
(java.lang.Object type)
|
boolean
|
isDesignerMode
()
|
boolean
|
isPreviewMode
()
|
boolean
|
isVisualByHTML
()
for some tags, they don't convert to HTML. |
boolean
|
needBorderDecorator
()
|
boolean
|
needTableDecorator
()
|
void
|
notifyChanged
(INodeNotifier notifier,
int eventType,
java.lang.Object changedFeature,
java.lang.Object oldValue,
java.lang.Object newValue,
int pos)
|
void
|
setDestDocument
(IDOMDocument document)
Set the target document where the converted node should belong to. |
void
|
setMinHeight
(int minHeight)
|
void
|
setMinWidth
(int minWidth)
|
void
|
setMode
(int mode)
|
void
|
setNeedBorderDecorator
(boolean b)
|
Methods inherited from class java.lang.Object
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
Methods inherited from interface org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
|
isWidget
|
AbstractTagConverter
public AbstractTagConverter(org.w3c.dom.Element host)
-
Parameters:
-
host
-
setDestDocument
public void setDestDocument(IDOMDocument document)
-
Description copied from interface:
ITagConverter
- Set the target document where the converted node should belong to.
-
-
Specified by:
-
setDestDocument
in interface
ITagConverter
-
convertRefresh
public final void convertRefresh(java.lang.Object context)
-
Description copied from interface:
ITagConverter
- refresh the internal state of this ITagConverter. This method normally is
called when the host element change.
-
-
Specified by:
-
convertRefresh
in interface
ITagConverter
-
notifyChanged
public void notifyChanged(INodeNotifier notifier,
int eventType,
java.lang.Object changedFeature,
java.lang.Object oldValue,
java.lang.Object newValue,
int pos)
-
-
getHostElement
public final org.w3c.dom.Element getHostElement()
-
-
Specified by:
-
getHostElement
in interface
ITagConverter
-
-
Returns:
- The host element being converted.
getResultElement
public final org.w3c.dom.Element getResultElement()
-
-
Specified by:
-
getResultElement
in interface
ITagConverter
-
-
Returns:
- the result element after conversion
getChildModeList
public final java.util.List getChildModeList()
-
-
Specified by:
-
getChildModeList
in interface
ITagConverter
-
-
Returns:
- the list of children that should be continuely converted.
getNonVisualChildren
public java.util.List getNonVisualChildren()
-
-
Specified by:
-
getNonVisualChildren
in interface
ITagConverter
-
-
Returns:
- a list of Element tags that map to non-visual children
Type should be always be Element.
getChildVisualPosition
public final
ConvertPosition getChildVisualPosition(org.w3c.dom.Node childModel)
-
Description copied from interface:
ITagConverter
- For child nodes that need further convert, return their position in the
converted DOM tree.
-
-
Specified by:
-
getChildVisualPosition
in interface
ITagConverter
-
-
Returns:
- the position of child nodes
isVisualByHTML
public boolean isVisualByHTML()
-
Description copied from interface:
ITagConverter
- for some tags, they don't convert to HTML. In that case, this method
should return false for them. And if this method return false, then
should return an image in
getVisualImage()
for displaying
in the designer.
-
-
Specified by:
-
isVisualByHTML
in interface
ITagConverter
-
-
Returns:
- true if the tag represents something that will be rendered visually at runtime
getVisualImage
public Image getVisualImage()
-
Description copied from interface:
ITagConverter
- if isVisualByHTML() return false, then this method should return an image
to be displayed in designer.
Normally this image will be a shared image for those hidden elements. It
is this class's responsibility to dispose the image if the image is not a
shared one.
-
-
Specified by:
-
getVisualImage
in interface
ITagConverter
-
-
Returns:
- the placeholder image for non-visual tags
dispose
public void dispose()
-
Description copied from interface:
ITagConverter
- API contract needed here
-
-
Specified by:
-
dispose
in interface
ITagConverter
-
getDestDocument
public IDOMDocument getDestDocument()
- In the future, the conversion result HTML DOM tree could be in another
document.
-
-
-
Returns:
- the destination document
createElement
public org.w3c.dom.Element createElement(java.lang.String tagName)
- shortcut method. Child class should always use this method to create a
result element.
-
-
Specified by:
-
createElement
in interface
IDOMFactory
-
-
Parameters:
-
tagName
-
-
Returns:
- a new element named tagName
createText
public org.w3c.dom.Text createText(java.lang.String text)
- shortcut method. Child class should always use this method to create a
text node.
-
-
Specified by:
-
createText
in interface
IDOMFactory
-
-
Parameters:
-
text
-
-
Returns:
- a new text node using text as the value
needBorderDecorator
public boolean needBorderDecorator()
-
-
Specified by:
-
needBorderDecorator
in interface org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
-
-
Returns:
- true if a border decorator is needed
setNeedBorderDecorator
public void setNeedBorderDecorator(boolean b)
-
-
-
Parameters:
-
b
-
needTableDecorator
public boolean needTableDecorator()
-
-
Specified by:
-
needTableDecorator
in interface org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
-
-
Returns:
- true if a table decorator is needed
isAdapterForType
public boolean isAdapterForType(java.lang.Object type)
-
-
setMode
public final void setMode(int mode)
-
-
Specified by:
-
setMode
in interface
ITagConverter
-
-
Parameters:
-
mode
-
isPreviewMode
public final boolean isPreviewMode()
-
-
-
Returns:
- true if the converter mode is preview
isDesignerMode
public final boolean isDesignerMode()
-
-
-
Returns:
- true if the converter mode is designer
getMode
public final int getMode()
-
-
-
Returns:
- the converter mode
getMinWidth
public int getMinWidth()
-
Description copied from interface:
org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
- for some element in design mode we want to them to have a default min
size.
-
-
Specified by:
-
getMinWidth
in interface org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
-
-
Returns:
- positive value means an expected min size.
setMinWidth
public void setMinWidth(int minWidth)
-
-
-
Parameters:
-
minWidth
-
getMinHeight
public int getMinHeight()
-
-
Specified by:
-
getMinHeight
in interface org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo
-
-
Returns:
- the minimum height
setMinHeight
public void setMinHeight(int minHeight)
-
-
-
Parameters:
-
minHeight
-
hasAttribute
public static boolean hasAttribute(org.w3c.dom.Element element,
java.lang.String attrname)
-
-
-
Parameters:
-
element
- -
attrname
-
-
Returns:
- the attribute on element with the name attrname