Coverage Report - org.argouml.kernel.ActionList
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionList
0%
0/18
N/A
1
ActionList$DummyAction
0%
0/5
N/A
1
 
 1  
 /* $Id$
 2  
  *******************************************************************************
 3  
  * Copyright (c) 2010 Contributors - see below
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    Bob Tarling
 11  
  *******************************************************************************
 12  
  */
 13  
 
 14  
 package org.argouml.kernel;
 15  
 
 16  
 import java.awt.event.ActionEvent;
 17  
 import java.beans.PropertyChangeListener;
 18  
 import java.util.ArrayList;
 19  
 
 20  
 import javax.swing.AbstractAction;
 21  
 import javax.swing.Action;
 22  
 import javax.swing.Icon;
 23  
 
 24  
 /**
 25  
  * This class is both a List and an Action although it purpose is not to serve
 26  
  * as a true executable Action.
 27  
  * Its purpose is to allow menu items, toolbars and toolbuttons etc to be built
 28  
  * from a model mode up of Actions where each Action is either an executable
 29  
  * action to be shown as a menu item or toolbutton. However should an Action
 30  
  * be of this specific class it provides the name and icon only for building
 31  
  * a submenu node or dropdown toolbutton and contains a list of further
 32  
  * Actions to be contained in that subnode.
 33  
  *
 34  
  * @param <E>
 35  
  * @author Bob Tarling
 36  
  */
 37  
 public class ActionList extends ArrayList<Action> implements Action {
 38  
 
 39  
     private Action dummyAction;
 40  
     
 41  0
     public ActionList(String name) {
 42  0
         dummyAction = new DummyAction(name);
 43  0
     }
 44  
     
 45  0
     public ActionList(String name, Icon icon) {
 46  0
         dummyAction = new DummyAction(name, icon);
 47  0
     }
 48  
     
 49  
     public void addPropertyChangeListener(PropertyChangeListener arg0) {
 50  0
         dummyAction.addPropertyChangeListener(arg0);
 51  0
     }
 52  
 
 53  
     public Object getValue(String arg0) {
 54  0
         return dummyAction.getValue(arg0);
 55  
     }
 56  
 
 57  
     public boolean isEnabled() {
 58  0
         return dummyAction.isEnabled();
 59  
     }
 60  
 
 61  
     public void putValue(String key, Object value) {
 62  0
         dummyAction.putValue(key, value);
 63  0
     }
 64  
 
 65  
     public void removePropertyChangeListener(PropertyChangeListener arg0) {
 66  0
         dummyAction.removePropertyChangeListener(arg0);
 67  0
     }
 68  
 
 69  
     public void setEnabled(boolean b) {
 70  0
         dummyAction.setEnabled(b);
 71  0
     }
 72  
 
 73  
     public void actionPerformed(ActionEvent e) {
 74  0
         dummyAction.actionPerformed(e);
 75  0
     }
 76  
 
 77  
     private static class DummyAction extends AbstractAction {
 78  
         DummyAction(String name) {
 79  0
             super(name);
 80  0
         }
 81  
         DummyAction(String name, Icon icon) {
 82  0
             super(name, icon);
 83  0
         }
 84  
         public void actionPerformed(ActionEvent e) {
 85  
             // Do nothing
 86  0
         }
 87  
     }
 88  
 }