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

at.spardat.xma.mdl.table.ITableWMClient 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: ITableWMClient.java 9890 2012-09-04 13:30:14Z hoenninger $
package at.spardat.xma.mdl.table;

import at.spardat.enterprise.fmt.IFmt;
import at.spardat.xma.mdl.IWModelClient;
import at.spardat.xma.mdl.table.TableUIDelegateClient.RowComparator;

/**
 * Programmers interface to an direct table widget model at the client.
 *
 * @author YSD, 20.06.2003 20:41:24
 */
public interface ITableWMClient extends ITableWM, IWModelClient {
    
    /**
     * Indicates that non of the table rows may be sorted. The default is
     * that all rows may be sorted.
     */
    public static final int         S_NON_SORTABLE = ITableWM.S_LAST * 2;
    
    
    /**
     * Returns the associated Formatter for the table itself (number of selections).
     * 
     * @return the attached formatter
     */
    IFmt getFmt();

    /**
     * Sets a new Formatter for the table itself (number of selections). 
     * 
     * @param formatter to be set.  
     */
    public void setFmt (IFmt formatter);


    /**
     * Sets the formatter to use for column at index columnIndex.
     *
     * @param columnIndex the zero based index of the column
     * @param formatter the IFmt object determining the string layout of a column cell.
     * @exception ArrayIndexOutOfBoundsException if columnIndex not valid.
     */
    public void setFormatter (int columnIndex, IFmt formatter);

    /**
     * Sets the property if the column at index columnIndex may be sorted
     * by the user or not. If this method is not called for a particular column,
     * the value defaults to true.
     *
     * @param columnIndex the zero based index of the column
     * @param what false if sorting of the column should be supressed, true otherwise.
     */
    public void setSortable (int columnIndex, boolean what);

    /**
     * Returns true if the column at index columnIndex may be sorted.
     */
    public boolean isSortable (int columnIndex);

    /**
     * Sorts the table contents on the UI using a particular column as sort order column. Note
     * that this method does not sort the widget model. The model stays completely unchanged.
     * It merely changes the permutation of rows on the UI. If you are working with zero based
     * indexes on the table model, this indexes may no longer correspond with the rows rank you
     * see in the UI table. Still the getSelection method of the widget model will
     * return the rows as selected in the UI table.

* * The table won't be sorted if any of the following is true: *

    *
  • The UI is not created yet. *
  • The provided column is not sortable. *
  • The cells in the provided column are not all of the same type. *
      * * The sort algorithm is stable. Therefore sorting along columns c1 and c2 * in succession result in a sort order where rows are primarely sorted along c2. * Within rows with the same c2 value, sort order is defined by c1. * * @param columnIndex the index of the column to be sorted. */ public void sort (int columnIndex); /** * Displays the rows in their natural order, i.e., as inserted in the table model. * This method does not change the order in the model, just on the UI. It makes sure * that the UI displays the rows in the same order as given by the model.

      * * This method may be used to undo an earlier call to sort. Besides that, * the user might have changed the sort order by klicking on the table headers. */ public void sortNatural (); /** * Returns the formatter set for the column at index columnIndex or null * if none has been set. */ public IFmt getFormatter (int columnIndex); /** * Returns the visibility state of a particular column. * * @param columnIndex zero based index of the column * @return true if visible, false otherwise */ public boolean isVisible (int columnIndex); /** * Returns the column at the provided zero based index. * * @param i zero based index indentifying a column * @return a TableColumn object describing the column * @exception ArrayIndexOutOfBounds if i greater equal getColumnCount or * less than zero. */ public XMATableColumn getColumn (int i); /** * Selects the row at a provided index in the UI-control (SWT-table) associated * with this widget-model. If index is less than zero or greater or equal to * size(), this method does nothing.

      * * Note that the UI must be constructed in order for this method to work. */ public void selectByUIIndex (int index); /** * Returns the index of the column sorting the table * or -1 if the table is not sorted by any column. * @return The index of the column starting with 0 or -1 if no sort was done. * @since version_number * @author S3460 */ public int getSortingColumn(); /** * Shows if the sorted column sorts ascending (1 click) or descening(2 clicks). * If the sorted column index is -1, then a call to this method makes no sense. * @return true - ascending / false - descending * @since version_number * @author S3460 */ public boolean isSortingColumnAscending(); /** * Shows if this table shows a sort indicator at the sorting column's header. */ public boolean hasSortIndicator(); /** * If this method is set to true than a sort indicator (a small up or down arrow) * is shown at the column's header, which sorts the table. * @param showSortIndicator true - show a sort indicator at the sorting column's header / false - no sort indicator is shown */ public void setSortIndicator(boolean showSortIndicator); /** * Registers an external sorter which will be used for sorting columns instead of the internal * sorting implementation of the table. * @since 2.3.0 * @author gub */ public void setExternalSorter(TableExternalSorterClient externalSorter); /** * Registers a RowComparator which is used internally for sorting columns. * @param rowComparator */ public void setRowComparator(RowComparator rowComparator); /** * Sets a TableWM2UIListenerClient. * If a TableWM2UIListenerClient is registered then its method {@link TableWM2UIListenerClient#model2UIEvent(TableRow, org.eclipse.swt.widgets.TableItem, int, int)} * is is always called after a TableWM cell is written to the SWT TableItem index. * Only one instance of a TableWM2UIListenerClient can be set. * * @param listener * @see TableWM2UIListenerClient * @since 2.0.4 * @author s3460 */ public void setTableWM2UIListener(TableWM2UIListenerClient listener); /** * Converts a model column index to its corresponding UI index. * @since 2.1.1 */ public int modelColumnIndexToUIColumnIndex(int index); /** * Converts a UI column index to its corresponding model column index. * @since 2.2.0 */ public int uiColumnIndexToModelColumnIndex(int uiIndex); /** * Converts a model row index to its corresponding UI index. * @since 2.2.0 */ public int modelIndexToUIIndex(int modelIndex); /** * Converts a UI row index to its corresponding model row index. * @since 2.2.0 */ public int uiIndex2ModelIndex(int uiIndex) ; /** * Sets the widget mandatory in the GUI */ public boolean isMandatory(); /** * Sets the widget mandatory in the GUI */ public void setMandatory(boolean mandatory); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy