Home » openjdk-7 » javax » swing » [javadoc | source]

    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     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, final ActionListener listener) {
   32           super();
   33           this.command = command;
   34           this.listener = listener;
   35       }
   36   
   37       public boolean isEnabled() {
   38           return true;
   39       }
   40   
   41       public void setEnabled(final boolean enabled) {
   42       }
   43   
   44       public void addPropertyChangeListener(final PropertyChangeListener listener) {
   45       }
   46   
   47       public void removePropertyChangeListener(final PropertyChangeListener listener) {
   48       }
   49   
   50       public Object getValue(final String valueName) {
   51           if (Action.NAME.equals(valueName)) {
   52               return listener;
   53           }
   54           if (Action.ACTION_COMMAND_KEY.equals(valueName)) {
   55               return command;
   56           }
   57           return null;
   58       }
   59   
   60       public void putValue(final String valueName, final Object value) {
   61       }
   62   
   63       public void actionPerformed(final ActionEvent event) {
   64           listener.actionPerformed(event);
   65       }
   66   }

Home » openjdk-7 » javax » swing » [javadoc | source]