01: package test.check.command;
02:
03: import java.awt.Component;
04:
05: import javax.swing.JComponent;
06:
07: /**
08: * A configure command that sets the specified client property to the
09: * specified value.
10: *
11: * @author Kirill Grouchnikov
12: */
13: public class ClientPropertyCommand implements
14: ConfigurationCommand<Component> {
15: /**
16: * Client property name.
17: */
18: private String propName;
19:
20: /**
21: * Client property value.
22: */
23: private Object propValue;
24:
25: /**
26: * Creates an client property configuration command.
27: *
28: * @param propName
29: * Client property name.
30: * @param propValue
31: * Client property value.
32: */
33: public ClientPropertyCommand(String propName, Object propValue) {
34: this .propName = propName;
35: this .propValue = propValue;
36: }
37:
38: /*
39: * (non-Javadoc)
40: *
41: * @see test.check.ConfigurationCommand#invoke(java.lang.Object)
42: */
43: public void configure(Component ab) {
44: if (ab instanceof JComponent)
45: ((JComponent) ab).putClientProperty(this.propName,
46: this.propValue);
47: }
48: }
|