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.commonimpl.schema;
17:
18: import org.outerj.daisy.repository.schema.ListItem;
19: import org.outerj.daisy.repository.VariantKey;
20:
21: import java.util.Locale;
22: import java.util.List;
23: import java.util.Collections;
24:
25: public class LinkListItem implements ListItem {
26: private final VariantKey variantKey;
27: private final String documentName;
28: private final List<LinkListItem> children;
29:
30: protected LinkListItem(final VariantKey variantKey,
31: final String documentName) {
32: this .variantKey = variantKey;
33: this .documentName = documentName;
34: this .children = null;
35: }
36:
37: protected LinkListItem(final VariantKey variantKey,
38: final String documentName, List<LinkListItem> children) {
39: this .variantKey = variantKey;
40: this .documentName = documentName;
41: this .children = children != null ? Collections
42: .unmodifiableList(children) : null;
43: }
44:
45: public Object getValue() {
46: return variantKey;
47: }
48:
49: public String getLabel(Locale locale) {
50: return documentName;
51: }
52:
53: public List<? extends ListItem> getItems() {
54: if (children == null)
55: return Collections.emptyList();
56: else
57: return children;
58: }
59: }
|