All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.mdl.table.ITableWM Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

// @(#) $Id: ITableWM.java 6379 2010-08-23 15:11:50Z gub $
package at.spardat.xma.mdl.table;

import at.spardat.xma.mdl.ISelectable;

/**
 * A table widget model where the programmer is in full control on what rows the
 * table has, both at the client and at the server side. Rows may be added,
 * replaced or removed. Every row may have
 * an additional image displayed with the row. Rows are stored in an ordered
 * collection and may be accessed either by a unique String key or by
 * a zero based row index. 

* * Besides managing the rows, a single or multiple selection state is * controlled (interface ISelectable). The selected rows are * identified by their String keys. * * @author YSD, 20.06.2003 20:33:53 */ public interface ITableWM extends ISelectable { /** * Specify this style constant in the constructor if you want the table to * allow multi selection. The default is single selection. */ public static final int S_MULTI_SELECT = 1; /** * A one way table has the property that its rows are never transmitted * from client to server. It supports the usual case of filling tables * at the server side, transmitting them to the client but not the other * way.

* * You should mark a table as one way, if u know that the contents of the * table is only produced at the server and only consumed (read) at the * client side of XMA. This saves memory at the server and eliminates * the neccessity to transfer the rows back to the server in stateless * pages.

* * The row set of a one way table may be changed at the server side. Then * the row information is transmitted to the client. If it is not changed * at the server side, the row information at the client is not changed * after a server side event but remaines unchanged.

* * The one way property applies only to the row information in this, not * to the selection information.

* * With one way tables, the selection need not to be necessarely strict. * The server may view an empty row set in the course of * executing a server side event (because rows are not transmitted to the * server), although there are rows at the client side. Therefore the * only action that makes sense at the server side is to fill the table * with rows. */ public static final int S_ONE_WAY = 2; /** * The numeric highest style constant used in this class */ public static final int S_LAST = S_ONE_WAY; /** * Returns if this table is one way. * @see #S_ONE_WAY */ public abstract boolean isOneWay(); /** * Returns the number of rows in this table. */ public abstract int size(); /** * Returns true if this table contains a row with the provided key. */ public abstract boolean containsKey(String key); /** * Returns the index at which the row with the provided key is located * or -1 if no row with key is here. This is a time consuming operation * of O(n). * * @param key the key of the row that is looked up. * @return zero based index of the key or -1 if this table does not contain * a row with the provided key. */ public abstract int indexOf(String key); /** * Returns the table row for a provided key.

* * The returned TableRow may be used to query and modify the row. It * must not be cached outside for later reuse because the returned row * becomes invalid if the table is modified in other ways. * * @param key the key whose row is wanted * @return the TableRow or null, if there is no row with the provided key. */ public abstract TableRow getRow(String key); /** * Returns the table row at a provided zero based row index.

* * The returned TableRow may be used to query and modify the row. It * must not be cached outside for later reuse because the returned row * becomes invalid if the table is modified in other ways. * * @param rowIndex the index of the row * @return a TableRow, never null * @exception ArrayIndexOutOfBoundsException if rowIndex invalid */ public abstract TableRow getRow(int rowIndex); /** * Removes a row from this table at a provided index. * * @param rowIndex the zero based row index. * @exception IndexOutOfBoundsException if rowIndex invalid. */ public abstract void removeRow(int rowIndex); /** * Removes a row with a particular key.

* * Note that this method is of runtime order O(n). If performance matters, * please use removeRow(int) instead. * * @param key the key whose row is to be removed. * @return true if removed, false if this table does not contain a row for the * provided key. */ public abstract boolean removeRow(String key); /** * Removes all rows from the table and deselects all rows. */ public abstract void clear(); /** * Returns the number of columns in this table. */ public int getColumnCount (); /** * Selects the row at the provided zero-based index. If index is less than zero * or greater equal size(), this method does nothing.

* * Note that this method selects using an index of the table-model. At the XMA client, if * the table has been sorted, this need not necessarely correspond to be the index you see * in the SWT-table. * * @param index zero based index of the row to select. */ public void selectByModelIndex (int index); /** * Sets the type for column. If no type is set, the type of each cell will be derived from * the type of the object it is filled from. * @param column index of the column * @param type one of at.spardat.enterprise.util.Types * @since 2.2.0 */ public void setColumnType(int column,byte type); /** * Returns the type of the whole column. * @param column index of the column * @since 2.2.0 */ public byte getColumnType(int column); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy