View Javadoc

1   /*
2    *  File: IJaretTableModel.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Common Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/cpl-v10.html
10   */
11  package de.jaret.util.ui.table.model;
12  
13  /***
14   * Interface for the table model used by the jaret table. The model should always provide all data. Sorting and
15   * filtering is done by the jaret table displaying the data.
16   * 
17   * @author Peter Kliem
18   * @version $Id: IJaretTableModel.java 385 2007-04-29 20:31:49Z olk $
19   */
20  public interface IJaretTableModel {
21      /***
22       * Return the number of rows in the model.
23       * 
24       * @return number of rows
25       */
26      int getRowCount();
27  
28      /***
29       * Retrieve a specific row.
30       * 
31       * @param idx index of the row
32       * @return the row
33       */
34      IRow getRow(int idx);
35  
36      /***
37       * Retrieve the number of columns.
38       * 
39       * @return the number of columns.
40       */
41      int getColumnCount();
42  
43      /***
44       * Retrieve a column specified by it's index.
45       * 
46       * @param idx index of the column to retrieve
47       * @return column at index idx
48       */
49      IColumn getColumn(int idx);
50  
51      /***
52       * Retrieve a column specified by it's id.
53       * 
54       * @param id id of the column to retrieve
55       * @return column for the given id or <code>null</code> if the column coud not be found
56       */
57      IColumn getColumn(String id);
58  
59      /***
60       * Check whether a cell is editable.
61       * 
62       * @param row row of the cell
63       * @param column column of the cell
64       * @return true for an editable cell
65       */
66      boolean isEditable(IRow row, IColumn column);
67  
68      /***
69       * Set the value of a particular cell.
70       * 
71       * @param row row of the cell
72       * @param column column of the cell
73       * @param value the value to be stored
74       */
75      void setValue(IRow row, IColumn column, Object value);
76      
77      /***
78       * Add a column. 
79       * 
80       * @param column column to add
81       */
82      void addColumn(IColumn column);
83  
84      /***
85       * Add a listener listening for changes on the model.
86       * 
87       * @param jtml listener to add
88       */
89      void addJaretTableModelListener(IJaretTableModelListener jtml);
90  
91      /***
92       * Remove a listener on the model.
93       * 
94       * @param jtml listener to remove
95       */
96      void removeJaretTableModelListener(IJaretTableModelListener jtml);
97  
98  }