01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.repository.schema;
17:
18: import org.outerx.daisy.x10.SelectionListDocument;
19:
20: import java.util.Locale;
21: import java.util.List;
22:
23: /**
24: * A list of values from which one can be selected by the end-user.
25: *
26: * <p>This SelectionList consists of ListItems.
27: *
28: * <p><b>Important for implementations:</b> the equals method should be implemented.
29: * Two selection lists are considered equal if their defining data is equals (e.g.
30: * in case of a query-based selection list, this means e.g. the queries are the same,
31: * not the actual list-items generated from them).
32: */
33: public interface SelectionList {
34: /**
35: * Gets the selection list items.
36: *
37: * <p>By preference, you should use the method {@link #getItems(long, long, java.util.Locale)}.
38: * This method will fail if the selection list implementation requires a branch
39: * and language.
40: *
41: */
42: List<? extends ListItem> getItems();
43:
44: /**
45: * Gets the selection list items.
46: *
47: * <p>Some selection list implementations might want to filter the items
48: * based on the branch and language of the context in which this selection
49: * list is used (= typically the document that is being edited). Therefore,
50: * it is important that the branch and language or specified.
51: *
52: * @param branchId the branch of the document that is being edited
53: * @param languageId the language of the document that is being edited
54: */
55: List<? extends ListItem> getItems(long branchId, long languageId,
56: Locale locale);
57:
58: /**
59: * @deprecated use {@link #getItemLabel} instead.
60: */
61: String getLabel(Object value, Locale locale);
62:
63: /**
64: * Returns the label defined in the selection list for the given value,
65: * or null if not available.
66: */
67: String getItemLabel(Object value, Locale locale);
68:
69: void addToFieldTypeXml(
70: SelectionListDocument.SelectionList selectionListXml);
71: }
|