1 42 43 package org.jfree.ui.action; 44 45 import java.util.ArrayList ; 46 47 import javax.swing.Action ; 48 49 55 public class ActionConcentrator { 56 57 58 private final ArrayList actions; 59 60 63 public ActionConcentrator() { 64 this.actions = new ArrayList (); 65 } 66 67 72 public void addAction(final Action a) { 73 if (a == null) { 74 throw new NullPointerException (); 75 } 76 this.actions.add(a); 77 } 78 79 84 public void removeAction(final Action a) { 85 if (a == null) { 86 throw new NullPointerException (); 87 } 88 this.actions.remove(a); 89 } 90 91 96 public void setEnabled(final boolean b) { 97 for (int i = 0; i < this.actions.size(); i++) { 98 final Action a = (Action ) this.actions.get(i); 99 a.setEnabled(b); 100 } 101 } 102 103 111 public boolean isEnabled() { 112 for (int i = 0; i < this.actions.size(); i++) { 113 final Action a = (Action ) this.actions.get(i); 114 if (a.isEnabled()) { 115 return true; 116 } 117 } 118 return false; 119 } 120 121 } 122 | Popular Tags |