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:
18: package javax.swing;
19:
20: import java.awt.event.ActionEvent;
21: import java.awt.event.ActionListener;
22: import java.beans.PropertyChangeListener;
23: import java.io.Serializable;
24:
25: @SuppressWarnings("serial")
26: final class ActionProxy implements Action, Serializable {
27: private final String command;
28:
29: private final ActionListener listener;
30:
31: public ActionProxy(final String command,
32: final ActionListener listener) {
33: super ();
34: this .command = command;
35: this .listener = listener;
36: }
37:
38: public boolean isEnabled() {
39: return true;
40: }
41:
42: public void setEnabled(final boolean enabled) {
43: }
44:
45: public void addPropertyChangeListener(
46: final PropertyChangeListener listener) {
47: }
48:
49: public void removePropertyChangeListener(
50: final PropertyChangeListener listener) {
51: }
52:
53: public Object getValue(final String valueName) {
54: if (Action.NAME.equals(valueName)) {
55: return listener;
56: }
57: if (Action.ACTION_COMMAND_KEY.equals(valueName)) {
58: return command;
59: }
60: return null;
61: }
62:
63: public void putValue(final String valueName, final Object value) {
64: }
65:
66: public void actionPerformed(final ActionEvent event) {
67: listener.actionPerformed(event);
68: }
69: }
|