001: /*
002: ItsNat Java Web Application Framework
003: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
004: Author: Jose Maria Arranz Santamaria
005:
006: This program is free software: you can redistribute it and/or modify
007: it under the terms of the GNU Affero General Public License as published by
008: the Free Software Foundation, either version 3 of the License, or
009: (at your option) any later version. See the GNU Affero General Public
010: License for more details. See the copy of the GNU Affero General Public License
011: included in this program. If not, see <http://www.gnu.org/licenses/>.
012: */
013:
014: package org.itsnat.comp.ui;
015:
016: import org.itsnat.comp.ItsNatTableHeader;
017: import org.w3c.dom.Element;
018: import org.w3c.dom.Node;
019:
020: /**
021: * Is the base interface of the User Interface of a table header.
022: *
023: * <p>A table header is managed as a DOM element list, using the current table structure
024: * and renderer.</p>
025: *
026: * <p>Current implementation does not use the data model and relays heavily on
027: * {@link org.itsnat.core.domutil.ElementList}.</p>
028: *
029: * @author Jose Maria Arranz Santamaria
030: * @see ItsNatTableHeader#getItsNatTableHeaderUI()
031: * @see ItsNatTableHeader#getItsNatTableHeaderCellRenderer()
032: * @see org.itsnat.comp.ItsNatTable#getItsNatTableStructure()
033: * @see org.itsnat.core.domutil.ElementList
034: */
035: public interface ItsNatTableHeaderUI extends ItsNatElementComponentUI {
036: /**
037: * Returns the associated component object.
038: *
039: * @return the component object.
040: */
041: public ItsNatTableHeader getItsNatTableHeader();
042:
043: /**
044: * Returns the number of header columns.
045: *
046: * @return the number of header columns.
047: * @see org.itsnat.core.domutil.ElementList#getLength()
048: */
049: public int getLength();
050:
051: /**
052: * Sets the number of header columns.
053: *
054: * @param len the new number of header columns.
055: * @see org.itsnat.core.domutil.ElementList#setLength(int)
056: */
057: public void setLength(int len);
058:
059: /**
060: * Informs whether the table header is empty (no columns).
061: *
062: * @return true if the table header is empty.
063: * @see org.itsnat.core.domutil.ElementListBase#isEmpty()
064: */
065: public boolean isEmpty();
066:
067: /**
068: * Inserts a new header column element at the specified position rendering
069: * the specified column value.
070: *
071: * @param index index of the new header column.
072: * @param value the column value to render as markup.
073: * @return the new element.
074: * @see org.itsnat.core.domutil.ElementList#insertElementAt(int,Object)
075: */
076: public Element insertElementAt(int index, Object value);
077:
078: /**
079: * Removes the specified header column.
080: *
081: * @param index index of the header column to remove.
082: * @return the removed element or null if index is out of bounds.
083: * @see org.itsnat.core.domutil.ElementListBase#removeElementAt(int)
084: */
085: public Element removeElementAt(int index);
086:
087: /**
088: * Removes the header column elements between the specified indexes.
089: *
090: * @param fromIndex low index (inclusive).
091: * @param toIndex high index (inclusive).
092: * @see org.itsnat.core.domutil.ElementListBase#removeElementRange(int,int)
093: */
094: public void removeElementRange(int fromIndex, int toIndex);
095:
096: /**
097: * Removes all header columns. The header is now empty.
098: * @see org.itsnat.core.domutil.ElementListBase#removeAllElements()
099: */
100: public void removeAllElements();
101:
102: /**
103: * Renders the specified value into the header column element with the given position.
104: *
105: * @param index index of the element.
106: * @param value the value to render.
107: * @param isSelected if this header column is selected.
108: * @param hasFocus if this header has the focus. Current ItsNat implementation ever passes false.
109: * @see org.itsnat.core.domutil.ElementList#setElementValueAt(int,Object)
110: */
111: public void setElementValueAt(int index, Object value,
112: boolean isSelected, boolean hasFocus);
113:
114: /**
115: * Returns the header column element at the specified index.
116: *
117: * @param index index of the header column to search.
118: * @return the element in this position or null if index is out of range.
119: * @see org.itsnat.core.domutil.ElementListBase#getElementAt(int)
120: */
121: public Element getElementAt(int index);
122:
123: /**
124: * Returns the "content" element, this element is used to render below
125: * the associated value of the header column element. This element is obtained
126: * using the current structure.
127: *
128: * @param index index of the element.
129: * @return the content element.
130: * @see org.itsnat.comp.ItsNatTableStructure#getHeaderColumnContentElement(org.itsnat.comp.ItsNatTableHeader,int,Element)
131: * @see org.itsnat.core.domutil.ElementList#getContentElementAt(int)
132: */
133: public Element getContentElementAt(int index);
134:
135: /**
136: * Returns an object info of the header column element at the specified position.
137: *
138: * @param index index of the element to search for.
139: * @return the object info of the matched column element. Null if index is out of range.
140: * @see #getItsNatTableHeaderCellUIFromNode(Node)
141: * @see org.itsnat.core.domutil.ElementListBase#getListElementInfoAt(int)
142: */
143: public ItsNatTableHeaderCellUI getItsNatTableHeaderCellUIAt(
144: int index);
145:
146: /**
147: * Returns an object info of the header column element containing the specified node (or the node
148: * is itself an element of the list).
149: *
150: * @param node the node to search for.
151: * @return the object info of the matched column element. Null if this node is not contained by the list.
152: * @see #getItsNatTableHeaderCellUIAt(int)
153: * @see org.itsnat.core.domutil.ElementListBase#getListElementInfoFromNode(Node)
154: */
155: public ItsNatTableHeaderCellUI getItsNatTableHeaderCellUIFromNode(
156: Node node);
157:
158: /**
159: * Informs whether the original (saved as pattern) markup is used to render.
160: *
161: * <p>The default value is defined by {@link org.itsnat.core.ItsNatDocument#isUsePatternMarkupToRender()}</p>
162: *
163: * @return true if the original markup is used.
164: * @see #setUsePatternMarkupToRender(boolean)
165: */
166: public boolean isUsePatternMarkupToRender();
167:
168: /**
169: * Sets whether the original (saved as pattern) markup is used to render.
170: *
171: * @param value true to enable the use of original markup to render.
172: * @see #isUsePatternMarkupToRender()
173: */
174: public void setUsePatternMarkupToRender(boolean value);
175: }
|