01: package org.conform.modifier;
02:
03: import org.conform.*;
04:
05: import java.beans.PropertyChangeListener;
06:
07: public abstract class InlineModifier implements Modifier {
08: BeanMeta beanMeta;
09:
10: public InlineModifier() {
11: }
12:
13: public void modify(BeanMeta beanMeta) {
14: this .beanMeta = beanMeta;
15: configure();
16: }
17:
18: protected abstract void configure();
19:
20: public PropertyMeta property(String name) {
21: PropertyMeta property = beanMeta.getProperty(name);
22: if (property == null)
23: throw new IllegalArgumentException("No property with name "
24: + name);
25: return property;
26: }
27:
28: public BeanMeta bean() {
29: return beanMeta;
30: }
31:
32: protected void addChangeListener(PropertyChangeListener listener,
33: String... propertyNames) {
34: for (String propertyName : propertyNames) {
35: property(propertyName).setAttribute(
36: PropertyMeta.ATTRIBUTE_CHANGE_LISTENER, listener);
37: }
38: }
39: }
|