View Javadoc
1 package org.argosfields.action; 2 3 import java.util.HashMap; 4 import java.util.Map; 5 6 import org.eclipse.swt.SWT; 7 8 /*** 9 * ActionMap.java 10 * @author Xavier Cho 11 * @version $Revision: 1.1 $ $Date: 2003/10/15 16:29:56 $ 12 */ 13 public class ActionMap { 14 private Map actions; 15 private ActionMap parent; 16 17 public ActionMap() { 18 this(null); 19 } 20 21 public ActionMap(final ActionMap parent) { 22 this.actions = new HashMap(20); 23 this.parent = parent; 24 } 25 26 public BaseAction get(final String name) { 27 if (name == null) { 28 SWT.error(SWT.ERROR_NULL_ARGUMENT); 29 } 30 31 BaseAction action = (BaseAction) actions.get(name); 32 33 if (action == null && parent != null) { 34 action = parent.get(name); 35 } 36 37 return action; 38 } 39 40 public void put(final BaseAction action) { 41 if (action == null) { 42 SWT.error(SWT.ERROR_NULL_ARGUMENT); 43 } 44 45 actions.put(action.getId(), action); 46 } 47 48 public int getSize() { 49 return actions.size(); 50 } 51 52 public ActionMap getParent() { 53 return parent; 54 } 55 56 public void setParent(final ActionMap parent) { 57 this.parent = parent; 58 } 59 }

This page was automatically generated by Maven