01: package nl.hippo.cms.wizard.widgets;
02:
03: import nl.hippo.cms.wizard.Constants;
04: import nl.hippo.cms.wizard.components.AbstractComponent;
05: import nl.hippo.cms.wizard.components.Configuration;
06: import nl.hippo.util.NameUtil;
07:
08: public abstract class AbstractWidget extends AbstractComponent
09: implements Widget {
10:
11: private Object value;
12:
13: //@Override
14: public void configure(Configuration config) throws Exception {
15: super .configure(config);
16: boolean skip = (config.get(Constants.SKIP_ATTRIBUTE_NAME) != null) ? config
17: .get(Constants.SKIP_ATTRIBUTE_NAME).equals("true")
18: : false;
19: if (skip)
20: skipPath();
21: boolean lowercase = (config
22: .get(Constants.LOWERCASE_ATTRIBUTE_NAME) != null) ? config
23: .get(Constants.LOWERCASE_ATTRIBUTE_NAME).equals("true")
24: : false;
25: if (lowercase)
26: lowerCasePath();
27: }
28:
29: //@Override
30: public String getPath() {
31: return getURIValue();
32: }
33:
34: public Object getValue() {
35: return value;
36: }
37:
38: public String getURIValue() {
39: return new NameUtil().convertToValidName(value.toString());
40: }
41:
42: public void setValue(Object object) {
43: value = object;
44: }
45:
46: //@Override
47: public void reset() {
48: setValue("");
49: }
50: }
|