|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectivehtml.oms.OMSObject | +--objectivehtml.htmlwidget.HtmlElement | +--objectivehtml.htmlwidget.HtmlWidget | +--objectivehtml.htmlwidget.HtmlContainerWidget
This is the base class of all container widgets. Container widgets are widgets that contain other children widgets inside them. Only container widgets can have children widgets.
All container widget can run in text-mode. Text-mode occurs automatically when a container widget has no children and the text component has been set. When the html for the widget is written out, it will contain the text inside its start and end tag. If auto-escape is turned on (default) then the text data will be escaped before being written by the printHtml(output) methods. Special html characters are escaped using the HtmlUtils.htmlSpecialChars(String) method. If the container becomes a parent then text-mode is off.
The destroy() method of a HtmlContainerWidget object will also destroy all its children objects as well.
HtmlUtils.htmlSpecialChars(String)
,
setAutoEscape(boolean)
,
HtmlElement.printHtml(JspWriter)
,
HtmlElement.printHtml(PrintWriter)
Field Summary | |
protected java.util.ArrayList |
m_alChildrenWidgets
Internal list of children objects |
protected boolean |
m_bAutoEscape
Indicates whether auto-escape is enabled or not |
protected java.lang.String |
m_sText
The text for this container in text-mode |
Fields inherited from class objectivehtml.htmlwidget.HtmlWidget |
m_bDestroyed, m_bVisible, m_objHtmlForm, m_objParentWidget |
Fields inherited from class objectivehtml.htmlwidget.HtmlElement |
m_hmAttributes, m_sEndTag, m_sQuoteType, m_sStartTag |
Constructor Summary | |
HtmlContainerWidget()
Constructs an instance of the HtmlContainerWidget object with no parent. |
|
HtmlContainerWidget(HtmlContainerWidget objParent)
Constructs an instance of HtmlContainerWidget object with objParent as its parent. |
Method Summary | |
protected void |
addHtmlWidget(HtmlWidget objHtmlWidget)
Adds a child widget to the internal list of this container. |
protected void |
appendChild(HtmlWidget objHtmlWidget)
Adds a child widget to this container. |
protected void |
destroy()
Deletes itself and calls destroy() and all children widgets. |
protected void |
generateUpdateOrder(java.util.TreeMap objUpdateOrderTree)
Generates the update order for this form. |
int |
getChildrenCount()
Returns the number of first-level children widgets in this container widget. |
java.util.ArrayList |
getChildrenWidgets()
Returns a shallow copy of the list of children widgets in this container. |
HtmlWidget |
getChildWidget(int nIndex)
This will return the child widget at the specified index. |
java.lang.String |
getText()
Returns the text of this container. |
int |
indexOfChildWidget(HtmlWidget objHtmlWidget)
This will find the index of a child widget. |
protected void |
insertChild(HtmlWidget objHtmlWidget,
int nPosition)
Inserts a child widget into this container. |
protected void |
insertHtmlWidget(HtmlWidget objHtmlWidget,
int nPosition)
Inserts a child widget into the internal list of this container. |
boolean |
isAutoEscape()
Returns whether the auto-escape feature is on or not. |
boolean |
isChildWidget(HtmlWidget objHtmlWidget)
Indicates whether the specified HtmlWidget object is a child of this widget |
protected void |
isValidChildWidget(HtmlWidget objHtmlWidget)
Indicates whether the specified child widget is allowed in this container. |
void |
printHtml(javax.servlet.jsp.JspWriter objWriter,
int nOutputType)
Prints the html that represents this object to the output stream. |
void |
printHtml(java.io.PrintWriter objWriter,
int nOutputType)
Prints the html that represents this object to the output stream. |
protected void |
removeHtmlWidget(HtmlWidget objHtmlWidget)
Removes a child widget from the internal list of this container. |
void |
setAttribute(java.lang.String sName,
java.lang.String sValue,
boolean bApplyToChildren)
Sets an attribute of this object and also the same attribute for all of its children. |
void |
setAutoEscape(boolean bAutoEscape)
Sets the auto-escape feature to be either on (default) or off. |
void |
setBooleanAttribute(java.lang.String sName,
boolean bIsOn,
boolean bApplyToChildren)
Sets a boolean-attribute of this object and also the same attribute for all of its children. |
void |
setText(java.lang.String sText)
Sets the text of this container. |
protected void |
setVisible(boolean bVisible)
Sets the visibility of this object and all its children. |
void |
swapHtmlWidgets(int nFirstPosition,
int nSecondPosition)
Swaps the position of 2 children widgets. |
Methods inherited from class objectivehtml.htmlwidget.HtmlWidget |
changeParent, changeParent, getClassAttribute, getHtmlForm, getID, getOnClick, getOnDblClick, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getParent, getStyle, isDestroyed, isVisible, setClassAttribute, setID, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStyle |
Methods inherited from class objectivehtml.htmlwidget.HtmlElement |
genEndTag, genStartTag, genStartTag, getAttribute, getAttributes, getBooleanAttribute, getQuoteType, printHtml, printHtml, printHtml, printHtml, printHtml, printHtml, setAttribute, setBooleanAttribute, setQuoteType, toString, toString |
Methods inherited from class objectivehtml.oms.OMSObject |
compareClasses, connect, disconnect, emit, isAlive, setAlive, signal, slot, slot |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.ArrayList m_alChildrenWidgets
protected boolean m_bAutoEscape
protected java.lang.String m_sText
Constructor Detail |
public HtmlContainerWidget(HtmlContainerWidget objParent) throws InvalidParentWidgetException, InvalidChildWidgetException
objParent
- the parent of this widgetInvalidParentWidgetException
- if the specified parent widget is not validInvalidChildWidgetException
- if the parent widget does not accept this widget as a childpublic HtmlContainerWidget()
HtmlForm
Method Detail |
public void setAutoEscape(boolean bAutoEscape)
bAutoEscape
- true if you want auto-escape on (default), false otherwiseHtmlUtils.htmlSpecialChars(String)
,
isAutoEscape()
public boolean isAutoEscape()
setAutoEscape(boolean)
public java.lang.String getText()
setText(String)
public void setText(java.lang.String sText)
sText
- the textgetText()
protected void setVisible(boolean bVisible)
Sets the visibility of this object and all its children. This version overrides the version provided by HtmlWidget so that the method updates not only the visibility of itself but also the visibility of all its children.
By default this method should only be accessed by other classes of this library. If users are allowed to explicity show/hide this html widget then it needs to be made public.
setVisible
in class HtmlWidget
bVisible
- true indicates the object and all of its children should be visible,
false indicates that the object and all of its children should not visibleHtmlWidget.setVisible(boolean)
public void setAttribute(java.lang.String sName, java.lang.String sValue, boolean bApplyToChildren) throws InvalidAttributeException
Sets an attribute of this object and also the same attribute for all of its children.
This overloaded version takes in an extra parameter bApplyToChildren. If this is true then this attribute is also set on all children widgets. Be careful to only set attributes that all html widgets have. e.g. class, style.
sName
- the name of the attribute (case-insensitive)sValue
- the value of the attribute, if null is specified
then the attribute will be clearedbApplyToChildren
- true if you want to apply this attribute to all of its childrenpublic void setBooleanAttribute(java.lang.String sName, boolean bIsOn, boolean bApplyToChildren) throws InvalidAttributeException
Sets a boolean-attribute of this object and also the same attribute for all of its children.
This overloaded version takes in an extra parameter bApplyToChildren. If this is true then this attribute is also set on all children widgets. Be careful to only set attributes that all html widgets have. e.g. class, style.
sName
- the name of the attribute (case-insensitive)bIsOn
- true if the attribute should exist, false otherwisebApplyToChildren
- true if you want to apply this boolean-attribute to all of its childrenpublic int getChildrenCount()
public java.util.ArrayList getChildrenWidgets()
public int indexOfChildWidget(HtmlWidget objHtmlWidget)
public HtmlWidget getChildWidget(int nIndex)
public void swapHtmlWidgets(int nFirstPosition, int nSecondPosition)
nFirstPosition
- the position of the first child widgetnSecondPosition
- the position of the second child widgetpublic boolean isChildWidget(HtmlWidget objHtmlWidget)
protected void appendChild(HtmlWidget objHtmlWidget) throws NotEqualsHtmlFormException, InvalidChildWidgetException
Adds a child widget to this container. If the widget is already a child of this container then the operation will move the widget to end of the child list for this container. If the widget is not a child of this container then the widget will be reparented resulting in this container being its new parent and will be appended to the end of the child list for this container.
By default this method should only be accessed by other classes of this library. If users are allowed to explicity add html widgets then it needs to be made public.
objHtmlWidget
- the widget that is to be appendedNotEqualsHtmlFormException
- if the widget is not in the same formInvalidChildWidgetException
- if this widget does not accept objHtmlWidget as a childinsertChild(HtmlWidget, int)
,
HtmlWidget.changeParent(HtmlContainerWidget)
protected void insertChild(HtmlWidget objHtmlWidget, int nPosition) throws NotEqualsHtmlFormException, InvalidChildWidgetException
Inserts a child widget into this container. If the widget is already a child of this container then the operation will move the widget to the new nPosition position, which is calculated after the child is removed from its parent container. If the widget is not a child of this container then the widget will be reparented resulting in this container being its new parent and will be inserted into the the child list for this container.
By default this method should only be accessed by other classes of this library. If users are allowed to explicity insert html widgets then it needs to be made public.
objHtmlWidget
- the widget that is to be appendednPosition
- the position the new child is to inserted (starts from 0)NotEqualsHtmlFormException
- if the widget is not in the same formInvalidChildWidgetException
- if this widget does not accept objHtmlWidget as a childappendChild(HtmlWidget)
,
HtmlWidget.changeParent(HtmlContainerWidget)
protected void addHtmlWidget(HtmlWidget objHtmlWidget) throws InvalidChildWidgetException
objHtmlWidget
- the child widget to addInvalidChildWidgetException
- if this widget does not accept objHtmlWidget as a childprotected void insertHtmlWidget(HtmlWidget objHtmlWidget, int nPosition) throws InvalidChildWidgetException
Inserts a child widget into the internal list of this container.
The method is for internal use only, it should never need to be called by normal users.
objHtmlWidget
- the child widget to insertnPosition
- the position that the widget should be inserted intoInvalidChildWidgetException
- if this widget does not accept objHtmlWidget as a childprotected void isValidChildWidget(HtmlWidget objHtmlWidget) throws InvalidChildWidgetException
Indicates whether the specified child widget is allowed in this container. The default implementation allows any HtmlWidget to be a child widget.
All subclasses of this class should override this method if they have restrictions on suitable child widgets. If a child is not accepted then the InvalidChildWidgetException should be thrown.
InvalidChildWidgetException
- if objHtmlWidget is not accepted by this widget as a childprotected void removeHtmlWidget(HtmlWidget objHtmlWidget)
Removes a child widget from the internal list of this container.
The method is for internal use only, it should never need to be called by normal users.
objHtmlWidget
- the child widget to removeprotected void generateUpdateOrder(java.util.TreeMap objUpdateOrderTree)
objUpdateOrderTree
- the list of control widgets to updateHtmlForm.updateData(HttpServletRequest)
protected void destroy()
destroy
in class HtmlWidget
objectivehtml.htmlwidget.HtmlWidget
HtmlWidget.isDestroyed()
public void printHtml(java.io.PrintWriter objWriter, int nOutputType) throws java.io.IOException
printHtml
in class HtmlElement
objWriter
- the output stream for a Servlet objectnOutputType
- the output typejava.io.IOException
- if it cannot write the outputHtmlElement.printHtml(PrintWriter)
public void printHtml(javax.servlet.jsp.JspWriter objWriter, int nOutputType) throws java.io.IOException
printHtml
in class HtmlElement
objWriter
- the output stream for a Jsp pagenOutputType
- the output typejava.io.IOException
- if it cannot write the outputHtmlElement.printHtml(JspWriter)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |