01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.compiler.model;
20:
21: import org.w3c.dom.Element;
22:
23: public class MessageResourcesModel extends StrutsElementSupport {
24: private String _parameter; // the target resources
25: private String _key; // the ServletContext attribute in which to store the resources
26: private Boolean _returnNull; // if false, will return '???keyname???' instead of null for missing resources
27: private String _factory; // configuration bean class -- org.apache.struts.config.MessageResourcesConfig
28:
29: public MessageResourcesModel(StrutsApp parent) {
30: super (parent);
31: }
32:
33: public String getParameter() {
34: return _parameter;
35: }
36:
37: public void setParameter(String parameter) {
38: _parameter = parameter;
39: }
40:
41: public String getKey() {
42: return _key;
43: }
44:
45: public void setKey(String key) {
46: _key = key;
47: }
48:
49: public boolean doesReturnNull() {
50: return _returnNull == null || _returnNull.booleanValue();
51: }
52:
53: public void setReturnNull(boolean aNull) {
54: _returnNull = new Boolean(aNull);
55: }
56:
57: public String getFactory() {
58: return _factory;
59: }
60:
61: public void setFactory(String factory) {
62: _factory = factory;
63: }
64:
65: public Boolean getReturnNull() {
66: return _returnNull;
67: }
68:
69: public void setReturnNull(Boolean returnNull) {
70: _returnNull = returnNull;
71: }
72:
73: protected void writeToElement(XmlModelWriter xw, Element element) {
74: setElementAttribute(element, "key", _key);
75: setElementAttribute(element, "parameter", _parameter);
76: setElementAttribute(element, "null", _returnNull);
77: setElementAttribute(element, "factory", _factory);
78: }
79:
80: protected void addSetProperty(XmlModelWriter xw, Element element,
81: String propertyName, String propertyValue) {
82: throw new UnsupportedOperationException("not implemented for "
83: + getClass().getName());
84: }
85: }
|