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.ItsNatTable;
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 body component.
022: *
023: * <p>Table cells are managed as a DOM element table, 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.ElementTable}.</p>
028: *
029: * <p>Rows and column indexes are 0 based.</p>
030: *
031: * @author Jose Maria Arranz Santamaria
032: * @see ItsNatTable#getItsNatTableUI()
033: * @see ItsNatTable#getItsNatTableCellRenderer()
034: * @see ItsNatTable#getItsNatTableStructure()
035: * @see ItsNatTableHeaderUI
036: */
037: public interface ItsNatTableUI extends ItsNatElementComponentUI {
038: /**
039: * Returns the associated component object.
040: *
041: * @return the component object.
042: */
043: public ItsNatTable getItsNatTable();
044:
045: /**
046: * Returns the header user interface manager of this component.
047: *
048: * @return the header user interface manager. Null if this table has not a header.
049: */
050: public ItsNatTableHeaderUI getItsNatTableHeaderUI();
051:
052: /**
053: * Returns the number of rows.
054: *
055: * @return the number of rows.
056: * @see org.itsnat.core.domutil.ElementTableBase#getRowCount()
057: */
058: public int getRowCount();
059:
060: /**
061: * Increases or shrinks the number of rows to fit the new size.
062: *
063: * <p>If the new size is bigger new row elements are added at the end, if the size
064: * is lower tail row elements are removed.</p>
065: *
066: * @param rows the new number of rows.
067: * @see org.itsnat.core.domutil.ElementTable#setRowCount(int)
068: */
069: public void setRowCount(int rows);
070:
071: /**
072: * Returns the number of columns.
073: *
074: * @return the number of columns.
075: * @see org.itsnat.core.domutil.ElementTable#getColumnCount()
076: */
077: public int getColumnCount();
078:
079: /**
080: * Increases or shrinks the number of columns to fit the new size.
081: *
082: * <p>If the new size is bigger new columns are added at the end, if the size
083: * is lower tail columns are removed.</p>
084: *
085: * @param columns the new number of columns.
086: * @see org.itsnat.core.domutil.ElementTable#setColumnCount(int)
087: */
088: public void setColumnCount(int columns);
089:
090: /**
091: * Removes all row elements. The table body is now empty.
092: *
093: * @see org.itsnat.core.domutil.ElementTableBase#removeAllRows()
094: */
095: public void removeAllRows();
096:
097: /**
098: * Removes all columns. The table body remains as a row list with no cells.
099: *
100: * @see org.itsnat.core.domutil.ElementTableBase#removeAllColumns()
101: */
102: public void removeAllColumns();
103:
104: /**
105: * Inserts a new row element at the specified position rendering
106: * the specified cell values.
107: *
108: * @param row row index of the new row element.
109: * @param values the cell values to render as markup.
110: * @see org.itsnat.core.domutil.ElementTable#insertRowAt(int,Object[])
111: */
112: public void insertRowAt(int row, Object[] values);
113:
114: /**
115: * Inserts a new column at the specified position,
116: * and renders the specified values.
117: *
118: * @param column index of the new column.
119: * @param values the column values to render.
120: * @see org.itsnat.core.domutil.ElementTable#insertColumnAt(int,Object[])
121: */
122: public void insertColumnAt(int column, Object[] values);
123:
124: /**
125: * Renders the specified values into the row element with the given position.
126: *
127: * @param row index of the row element.
128: * @param values the row values to render.
129: * @param isSelected array with the current selection state of the row cells.
130: * @param hasFocus array with the current focus state of the row cells. Current ItsNat implementation ever passes false values.
131: * @see org.itsnat.core.domutil.ElementTable#setRowValuesAt(int,Object[])
132: */
133: public void setRowValuesAt(int row, Object[] values,
134: boolean[] isSelected, boolean[] hasFocus);
135:
136: /**
137: * Renders the specified values into the column with the given position.
138: *
139: * @param column index of the column.
140: * @param values the column values to render.
141: * @param isSelected array with the current selection state of the column cells.
142: * @param hasFocus array with the current focus state of the column cells. Current ItsNat implementation ever passes false values.
143: * @see org.itsnat.core.domutil.ElementTable#setColumnValuesAt(int,Object[])
144: */
145: public void setColumnValuesAt(int column, Object[] values,
146: boolean[] isSelected, boolean[] hasFocus);
147:
148: /**
149: * Renders the specified value into the cell element with the given row and column position.
150: *
151: * @param row row of the cell.
152: * @param column column of the cell.
153: * @param value the value to render.
154: * @see org.itsnat.core.domutil.ElementTable#setCellValueAt(int,int,Object)
155: */
156: public void setCellValueAt(int row, int column, Object value,
157: boolean isSelected, boolean hasFocus);
158:
159: /**
160: * Removes the specified row element.
161: *
162: * @param row index of the row element to remove.
163: * @see org.itsnat.core.domutil.ElementTableBase#removeRowAt(int)
164: */
165: public void removeRowAt(int row);
166:
167: /**
168: * Removes the specified column.
169: *
170: * @param column index of the column to remove.
171: * @see org.itsnat.core.domutil.ElementTableBase#removeColumnAt(int)
172: */
173: public void removeColumnAt(int column);
174:
175: /**
176: * Returns an object info of the cell element at the specified row and column.
177: *
178: * @param row row index of the cell element.
179: * @param column column index of the cell element.
180: * @return the object info of the matched table cell element. Null if row or column is out of range.
181: * This object is ever the same per cell and may be used to save any context data.
182: * @see #getItsNatTableCellUIFromNode(Node)
183: * @see org.itsnat.core.domutil.ElementTableBase#getTableCellElementInfoAt(int,int)
184: */
185: public ItsNatTableCellUI getItsNatTableCellUIAt(int row, int column);
186:
187: /**
188: * Returns an object info of the cell element containing the specified node (or the node
189: * is itself an element of the table body).
190: *
191: * @param node the node to search for.
192: * @return the object info of the matched child element. Null if this node is not contained by the table.
193: * This object is ever the same per cell and may be used to save any context data.
194: * @see #getItsNatTableCellUIAt(int,int)
195: * @see org.itsnat.core.domutil.ElementTableBase#getTableCellElementInfoFromNode(Node)
196: */
197: public ItsNatTableCellUI getItsNatTableCellUIFromNode(Node node);
198:
199: /**
200: * Returns the element used as parent of the table body.
201: * In an HTML <table> returns the <tbody>
202: *
203: * @return the body parent element.
204: */
205: public Element getBodyElement();
206:
207: /**
208: * Returns the row element at the specified index.
209: *
210: * @param row index of the row element to search.
211: * @return the row element in this position or null if index is out of range.
212: * @see org.itsnat.core.domutil.ElementTableBase#getRowElementAt(int)
213: */
214: public Element getRowElementAt(int row);
215:
216: /**
217: * Returns the content row element. This element is obtained
218: * using the current structure.
219: *
220: * @param row index of the row element.
221: * @return the content element.
222: * @see org.itsnat.comp.ItsNatTableStructure#getRowContentElement(org.itsnat.comp.ItsNatTable,int,Element)
223: * @see org.itsnat.core.domutil.ElementTable#getRowContentElementAt(int)
224: */
225: public Element getRowContentElementAt(int row);
226:
227: /**
228: * Returns the cell elements of the specified row as an array.
229: *
230: * @param row the row index.
231: * @return the cell element array or null if index is out of range.
232: * @see org.itsnat.core.domutil.ElementTableBase#getCellElementsOfRow(int)
233: */
234: public Element[] getCellElementsOfRow(int row);
235:
236: /**
237: * Returns the cell elements of the specified column as an array.
238: *
239: * @param column the column index.
240: * @return the cell element array or null if index is out of range.
241: * @see org.itsnat.core.domutil.ElementTableBase#getCellElementsOfColumn(int)
242: */
243: public Element[] getCellElementsOfColumn(int column);
244:
245: /**
246: * Returns the cell element at the specified row and column.
247: *
248: * @param row the row index of the cell element to search.
249: * @param column the column index of the cell element to search.
250: * @return the element in this position or null if some index is out of range.
251: * @see org.itsnat.core.domutil.ElementTableBase#getCellElementAt(int,int)
252: */
253: public Element getCellElementAt(int row, int column);
254:
255: /**
256: * Returns the content element of the cell. This element is obtained
257: * using the current structure.
258: *
259: * @param row index of the row.
260: * @return the content element of the row.
261: * @see org.itsnat.core.domutil.ElementTable#getCellContentElementAt(int,int)
262: */
263: public Element getCellContentElementAt(int row, int column);
264:
265: /**
266: * Informs whether the original (saved as pattern) markup is used to render.
267: *
268: * <p>The default value is defined by {@link org.itsnat.core.ItsNatDocument#isUsePatternMarkupToRender()}</p>
269: *
270: * @return true if the original markup is used.
271: * @see #setUsePatternMarkupToRender(boolean)
272: */
273: public boolean isUsePatternMarkupToRender();
274:
275: /**
276: * Sets whether the original (saved as pattern) markup is used to render.
277: *
278: * @param value true to enable the use of original markup to render.
279: * @see #isUsePatternMarkupToRender()
280: */
281: public void setUsePatternMarkupToRender(boolean value);
282: }
|