001: /*
002: #IFNDEF ALT_LICENSE
003: ThinWire(R) RIA Ajax Framework
004: Copyright (C) 2003-2007 Custom Credit Systems
005:
006: This library is free software; you can redistribute it and/or modify it under
007: the terms of the GNU Lesser General Public License as published by the Free
008: Software Foundation; either version 2.1 of the License, or (at your option) any
009: later version.
010:
011: This library is distributed in the hope that it will be useful, but WITHOUT ANY
012: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
013: PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
014:
015: You should have received a copy of the GNU Lesser General Public License along
016: with this library; if not, write to the Free Software Foundation, Inc., 59
017: Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:
019: Users who would rather have a commercial license, warranty or support should
020: contact the following company who invented, built and supports the technology:
021:
022: Custom Credit Systems, Richardson, TX 75081, USA.
023: email: info@thinwire.com ph: +1 (888) 644-6405
024: http://www.thinwire.com
025: #ENDIF
026: [ v1.2_RC2 ]
027: */
028: package thinwire.util;
029:
030: import java.util.List;
031:
032: /**
033: * An interface used to create a local data source. A Grid is a 2 dimensional table of values.
034: * @author Joshua J. Gertzen
035: */
036: public interface Grid<R extends Grid.Row, C extends Grid.Column> {
037: /**
038: * A Column is a list of values. The 1st Column of a Grid is the list of values in the Grid's 1st column (i.e. the Column at
039: * index 0). Element j of Column k in a Grid is element k of Row j.
040: */
041: public interface Column extends List<Object> {
042: /**
043: * Get the name of this Column
044: * @return the name of this Column
045: */
046: public String getName();
047:
048: /**
049: * Sets the name of this Column.
050: * @param name the name of this Column
051: */
052: public void setName(String name);
053:
054: /**
055: * Get the Grid that this Column is part of.
056: * @return the Grid that this column is part of.
057: */
058: public Grid getParent();
059:
060: /**
061: * Get the index of this Column.
062: * @return the index for this Column
063: */
064: public int getIndex();
065: }
066:
067: /**
068: * A Row is a list of values. The 1st Row of a Grid is the list of values in the Grid's 1st Row (i.e. the Row at index 0).
069: * Element j of Row k in a Grid is element k of Column j.
070: */
071: public interface Row extends List<Object> {
072:
073: /**
074: * Get the field in the specified Column at this Row.
075: * @param columnName the specified Column
076: * @return the field specified by the current row and the column name passed.
077: */
078: public Object get(String columnName);
079:
080: /**
081: * Set the field in the specified Column at this Row.
082: * @param columnName the specified Column
083: * @param o the new value to set for the cell.
084: * @return the field specified by the current row and the column name passed.
085: */
086: public Object set(String columnName, Object o);
087:
088: /**
089: * Get the Grid this Row is part of.
090: * @return the Grid this Row is part of
091: */
092: public Grid getParent();
093:
094: /**
095: * Get the index for this Row.
096: * @return the index for this Row
097: */
098: public int getIndex();
099: }
100:
101: /**
102: * Get the Columns belonging to this Grid.
103: * @return a list of all the columns in the Grid.
104: */
105: public List<C> getColumns();
106:
107: /**
108: * Get the Rows belonging to this Grid.
109: * @return a list of all the rows in the Grid.
110: */
111: public List<R> getRows();
112: }
|