Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
IAutocompleteModel |
|
| 1.0;1 |
1 | // Copyright Jul 30, 2006 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // Unless required by applicable law or agreed to in writing, software |
|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 | // See the License for the specific language governing permissions and |
|
13 | // limitations under the License. |
|
14 | package org.apache.tapestry.dojo.form; |
|
15 | ||
16 | import java.util.List; |
|
17 | ||
18 | import org.apache.tapestry.components.IPrimaryKeyConverter; |
|
19 | import org.apache.tapestry.form.IPropertySelectionModel; |
|
20 | ||
21 | ||
22 | /** |
|
23 | * Defines the interface used by the {@link Autocompleter} component to filter |
|
24 | * and match values from a potentially large data set. |
|
25 | * |
|
26 | * <p> |
|
27 | * The roots of this model come from the {@link IPropertySelectionModel} interface, adding |
|
28 | * additional logic for filtering where the normal semantics of {@link IPropertySelectionModel} |
|
29 | * would be prohibitively expensive. |
|
30 | * </p> |
|
31 | * |
|
32 | * @author jkuhnert |
|
33 | */ |
|
34 | public interface IAutocompleteModel extends IPrimaryKeyConverter |
|
35 | { |
|
36 | ||
37 | /** |
|
38 | * For the given value, provide a user friendly label that will |
|
39 | * be presented in a drop down selection list in the browser ui. |
|
40 | * |
|
41 | * @param value |
|
42 | * The object to retrieve a label for. |
|
43 | * @return |
|
44 | * The label to use for the given value. |
|
45 | */ |
|
46 | String getLabelFor(Object value); |
|
47 | ||
48 | /** |
|
49 | * Expected to return a list of all possible values, filtering out values that |
|
50 | * match the specified String in the <strong>label</strong> representation of the value. |
|
51 | * |
|
52 | * @param filter |
|
53 | * The string to use to filter the values based on the label representation of objects. |
|
54 | * |
|
55 | * @return A filtered list of values. Expected to be in the full object form such that |
|
56 | * {@link IPrimaryKeyConverter#getPrimaryKey(Object)} can be called on each returned value. |
|
57 | */ |
|
58 | List getValues(String filter); |
|
59 | } |