01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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:
15: package org.apache.tapestry;
16:
17: import java.util.List;
18:
19: import org.apache.tapestry.corelib.components.Select;
20:
21: /**
22: * Defines the possible options and option groups for a <select> [X]HTML element.
23: * <p>
24: * Primarily used by the {@link Select} component, but potentially used by anything similar, that
25: * needs to present a list of options to the user. Generally paired with a {@link ValueEncoder} to
26: * create client-side representations of server-side values.
27: */
28: public interface SelectModel {
29: /**
30: * The list of groups, each containing some number of individual options.
31: *
32: * @return the groups, or null
33: */
34: List<OptionGroupModel> getOptionGroups();
35:
36: /**
37: * The list of ungrouped options, which appear after any grouped options. Generally, a model
38: * will either provide option groups or ungroup options, but not both.
39: *
40: * @return the ungrouped options, or null
41: */
42: List<OptionModel> getOptions();
43:
44: /**
45: * Allows access to all the {@link OptionGroupModel}s and {@link OptionModel}s within the
46: * SelectModel.
47: */
48: void visit(SelectModelVisitor visitor);
49: }
|