1 /*
2 * Copyright 2004-2008 the Seasar Foundation and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.uruma.component.base;
17
18 import java.io.Writer;
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.seasar.uruma.annotation.ConfigurationAttribute;
23 import org.seasar.uruma.component.jface.CompositeComponent;
24 import org.seasar.uruma.rcp.configuration.ConfigurationElement;
25 import org.seasar.uruma.rcp.configuration.ConfigurationWriter;
26
27 /**
28 * 子要素を持たない {@link ConfigurationElement} の基底クラスです。<br />
29 * 主に <code>viewPart</code> や <code>editorPart</code> を定義するためのクラスです。<br />
30 *
31 * @author y-komori
32 */
33 public abstract class PartConfigurationElement extends CompositeComponent
34 implements ConfigurationElement {
35 private static final List<ConfigurationElement> nullList = new ArrayList<ConfigurationElement>(
36 0);
37
38 protected ConfigurationWriter configurationWriter;
39
40 @ConfigurationAttribute(name = "id")
41 private String rcpId;
42
43 /*
44 * @see org.seasar.uruma.rcp.configuration.ConfigurationElement#getElements()
45 */
46 public List<ConfigurationElement> getElements() {
47 return nullList;
48 }
49
50 /*
51 * @see org.seasar.uruma.rcp.configuration.ConfigurationElement#setConfigurationWriter(org.seasar.uruma.rcp.configuration.ConfigurationWriter)
52 */
53 public void setConfigurationWriter(final ConfigurationWriter writer) {
54 this.configurationWriter = writer;
55 }
56
57 /*
58 * @see org.seasar.uruma.rcp.configuration.ConfigurationElement#writeConfiguration(java.io.Writer)
59 */
60 public void writeConfiguration(final Writer writer) {
61 if (configurationWriter != null) {
62 configurationWriter.writeStartTag(this, writer);
63 configurationWriter.writeEndTag(this, writer);
64 }
65 }
66
67 /*
68 * @see org.seasar.uruma.rcp.configuration.ConfigurationElement#getRcpId()
69 */
70 public String getRcpId() {
71 return this.rcpId;
72 }
73
74 /*
75 * @see org.seasar.uruma.rcp.configuration.ConfigurationElement#setRcpId(java.lang.String)
76 */
77 public void setRcpId(final String rcpId) {
78 this.rcpId = rcpId;
79 }
80
81 }