View Javadoc

1   /*
2   Wotonomy: OpenStep design patterns for pure Java applications.
3   Copyright (C) 2000 Michael Powers
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, see http://www.gnu.org
17  */
18  
19  package net.wotonomy.ui;
20  
21  import java.util.List;
22  import java.util.Map;
23  
24  import net.wotonomy.control.EODataSource;
25  import net.wotonomy.control.EOQualifier;
26  
27  /***
28  * DisplayGroup provides an abstraction of a user interface,
29  * comprising of an ordered collection of data objects, some
30  * of which are displayed, and of those some are selected.
31  * This class extends EODisplayGroup to provide java-friendly
32  * convenience methods.
33  *
34  * @author michael@mpowers.net
35  * @author $Author: cgruber $
36  * @version $Revision: 904 $
37  */
38  public class DisplayGroup extends EODisplayGroup
39  {
40      /***
41      * Returns the current data source backing this display group,
42      * or null if no dataSource is currently used.
43      */
44      public EODataSource getDataSource()
45      {
46          return super.dataSource();
47      }
48  
49     /***
50      * Returns the current delegate for this display group,
51      * or null if no delegate is currently set.
52      */
53      public Object getDelegate()
54      {
55          return delegate();
56      }
57  
58      /***
59      * Returns the current string matching format.
60      * If not set, defaults to "%@*".
61      */
62      public String getDefaultStringMatchFormat()
63      {
64          return defaultStringMatchFormat();
65      }
66  
67      /***
68      * Returns the current string matching operator.
69      * If not set, defaults to "caseInsensitiveLike".
70      */
71      public String getdefaultStringMatchOperator()
72      {
73          return defaultStringMatchOperator();
74      }
75  
76      /***
77      * Returns a Map of default values that are applied
78      * to new objects that are inserted into the list.
79      */
80      public Map getInsertedObjectDefaultValues()
81      {
82          return insertedObjectDefaultValues();
83      }
84  
85      /***
86      * Returns the keys that were declared when read from
87      * an external resource file.
88      */
89      public List getLocalKeys()
90      {
91          return localKeys();
92      }
93  
94      /***
95      * Returns the List of sort orderings for this display group.
96      */
97      public List getSortOrderings ()
98      {
99          return sortOrderings();
100     }
101 
102     /***
103     * Returns a qualifier that will be applied all the objects
104     * in this display group to determine which objects will
105     * be displayed.
106     */
107     public EOQualifier getQualifier ()
108     {
109         return qualifier();
110     }
111 
112     /***
113     * Returns a new qualifier built from the three query
114     * value maps: greater than, equal to, and less than.
115     */
116     public EOQualifier getQualifierFromQueryValues ()
117     {
118         return qualifierFromQueryValues();
119     }
120 
121     /***
122     * Returns a Map containing the mappings of keys
123     * to binding query values.
124     */
125     public Map getQueryBindingValues()
126     {
127         return queryBindingValues();
128     }
129 
130     /***
131     * Returns a Map containing the mappings of keys
132     * to operator values.
133     */
134     public Map getQueryOperatorValues()
135     {
136         return queryOperatorValues();
137     }
138 
139     /***
140     * Returns a Map containing the mappings of keys
141     * to query values that will be used to test for equality.
142     */
143     public Map getEqualToQueryValues()
144     {
145         return equalToQueryValues();
146     }
147 
148     /***
149     * Returns a Map containing the mappings of keys
150     * to query values that will be used to test for greater value.
151     */
152     public Map getGreaterThanQueryValues()
153     {
154         return greaterThanQueryValues();
155     }
156 
157     /***
158     * Returns a Map containing the mappings of keys
159     * to query values that will be used to test for lesser value.
160     */
161     public Map getLessThanQueryValues()
162     {
163         return lessThanQueryValues();
164     }
165 
166     /***
167     * Returns the association that is currently being edited,
168     * or null if no editing is taking place.
169     */
170     public EOAssociation getEditingAssociation ()
171     {
172         return editingAssociation();
173     }
174 
175     /***
176     * Returns a List of associations that are observing
177     * this display group.
178     */
179     public List getObservingAssociations()
180     {
181         return observingAssociations();
182     }
183 
184     /***
185     * Returns a List containing all objects managed by the display group.
186     * This includes those objects not visible due to disqualification.
187     */
188     public List getAllObjects()
189     {
190         return allObjects();
191     }
192 
193     /***
194     * Returns a List of all objects in the display group
195     * that are currently displayed by the associations.
196     * The list is a copy of the internal displayed object list.
197     */
198     public List getDisplayedObjects()
199     {
200         return displayedObjects();
201     }
202 
203     /***
204     * Returns the currently selected object, or null if
205     * there is no selection.
206     */
207     public Object getSelectedObject()
208     {
209         return selectedObject();
210     }
211 
212     /***
213     * Returns a List containing all selected objects, if any.
214     * Returns an empty list if no objects are selected.
215     */
216     public List getSelectedObjects()
217     {
218         return selectedObjects();
219     }
220 
221     /***
222     * Returns a List containing the indexes of all selected
223     * objects, if any.  The list contains instances of
224     * java.lang.Number; call intValue() retrieve the index.
225     */
226     public List getSelectionIndexes()
227     {
228         return selectionIndexes();
229     }
230 
231     /***
232     * Returns the index of the changed object.  If more than
233     * one object has changed, -1 is returned.
234     */
235     public int getUpdatedObjectIndex()
236     {
237         return updatedObjectIndex();
238     }
239 
240     /***
241     * Returns a value on the selected object for the specified key.
242     */
243     public Object getSelectedObjectValueForKey ( String aKey )
244     {
245         return selectedObjectValueForKey( aKey );
246     }
247 
248     /***
249     * Returns the value for the specified key on the specified object.
250     */
251     public Object getValueForObject ( Object anObject, String aKey )
252     {
253         return valueForObject( anObject, aKey );
254     }
255 
256     /***
257     * Calls valueForObject() for the object at the specified index.
258     */
259     public Object getValueForObjectAtIndex ( int anIndex, String aKey )
260     {
261         return valueForObjectAtIndex( anIndex, aKey );
262     }
263 
264     /***
265     * Specifies the default string matching format for all
266     * display groups.
267     */
268     public static String getGlobalDefaultStringMatchFormat ()
269     {
270         return globalDefaultStringMatchFormat();
271     }
272 
273     /***
274     * Specifies the default string matching operator for all
275     * display groups.
276     */
277     public static String getGlobalDefaultStringMatchOperator ()
278     {
279         return globalDefaultStringMatchOperator();
280     }
281 }    
282 
283 /*
284  * $Log$
285  * Revision 1.2  2006/02/18 23:14:35  cgruber
286  * Update imports and maven dependencies.
287  *
288  * Revision 1.1  2006/02/16 13:22:22  cgruber
289  * Check in all sources in eclipse-friendly maven-enabled packages.
290  *
291  * Revision 1.2  2002/05/17 15:01:49  mpowers
292  * Implemented dynamic lookup of delegate methods so delegates no longer
293  * need to implement the DisplayGroup.Delegate interface.
294  *
295  * Revision 1.1  2002/03/26 21:24:43  mpowers
296  * Contributing DisplayGroup as convenience for people coming from java.
297  *
298  *
299  */
300