View Javadoc

1   /*
2    *  File: IJaretTableSelectionModel.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   * Selection model for the jaret table. The selection models controls the slection istelf and the possible selection
15   * modes.
16   * 
17   * @author Peter Kliem
18   * @version $Id: IJaretTableSelectionModel.java 180 2007-01-07 18:44:01Z olk $
19   */
20  public interface IJaretTableSelectionModel {
21  
22      /***
23       * Clear the selection.
24       */
25      void clearSelection();
26  
27      /***
28       * Check whether full row selection is allowed.
29       * 
30       * @return true if full row selection is allowed.
31       */
32      boolean isFullRowSelectionAllowed();
33  
34      /***
35       * Set the allowance for full row selection.
36       * 
37       * @param allowed true for allowed
38       */
39      void setFullRowSelectionAllowed(boolean allowed);
40  
41      /***
42       * Check whether full column selection is allowed.
43       * 
44       * @return true if full column selection is allowed.
45       */
46      boolean isFullColumnSelectionAllowed();
47  
48      /***
49       * Set the allowance for full column selection.
50       * 
51       * @param allowed true for allowed
52       */
53      void setFullColumnSelectionAllowed(boolean allowed);
54  
55      /***
56       * 
57       * @return true if selection of single cells is allowed
58       */
59      boolean isCellSelectionAllowed();
60  
61      /***
62       * Set allowance for single cell selections.
63       * 
64       * @param allowed true for allowed 
65       */
66      void setCellSelectionAllowed(boolean allowed);
67  
68      /***
69       * Retrieve allowance for multiple elements selectable.
70       * 
71       * @return true if multiple elemets should be selectable
72       */
73      boolean isMultipleSelectionAllowed();
74  
75      /***
76       * Set the allowance for multiple selection.
77       * 
78       * @param allowed true for allowed
79       */
80      void setMultipleSelectionAllowed(boolean allowed);
81  
82      /***
83       * Check whether only row selection is allowed.
84       * 
85       * @return true if only rows should be selectable
86       */
87      boolean isOnlyRowSelectionAllowed();
88  
89      /***
90       * If set to true only row selection is allowed.
91       * 
92       * @param allowed true for only row selection
93       */
94      void setOnlyRowSelectionAllowed(boolean allowed);
95  
96      /***
97       * Add a row to the selection.
98       * 
99       * @param row element to be added to the selection
100      */
101     void addSelectedRow(IRow row);
102 
103     /***
104      * Remove a row from the selection.
105      * 
106      * @param row element to be removed from the selection
107      */
108     void remSelectedRow(IRow row);
109 
110     /***
111      * Add a column to the selection.
112      * 
113      * @param column element to be added to the selection
114      */
115     void addSelectedColumn(IColumn column);
116 
117     /***
118      * Remove a column from the selection.
119      * 
120      * @param column element to be removed from the selection
121      */
122     void remSelectedColumn(IColumn column);
123 
124     /***
125      * Add a cell to the selection.
126      * 
127      * @param cell element to be added to the selection
128      */
129     void addSelectedCell(IJaretTableCell cell);
130 
131     /***
132      * Remove a cell from the selection.
133      * 
134      * @param cell element to be removed from the selection
135      */
136     void remSelectedCell(IJaretTableCell cell);
137 
138     /***
139      * retrieve the selected elements in the tabel selection structure.
140      * 
141      * @return selected elements
142      */
143     IJaretTableSelection getSelection();
144 
145     /***
146      * Add a listener to listen to changes of the selection.
147      * 
148      * @param jtsm listener
149      */
150     void addTableSelectionModelListener(IJaretTableSelectionModelListener jtsm);
151 
152     /***
153      * Remove a listener.
154      * 
155      * @param jtsm listener to be removed
156      */
157     void removeTableSelectionModelListener(IJaretTableSelectionModelListener jtsm);
158 
159 }