1 16 package org.apache.cocoon.woody.formmodel; 17 18 import org.apache.cocoon.woody.event.ActionEvent; 19 import org.apache.cocoon.woody.event.ActionListener; 20 import org.apache.cocoon.woody.event.WidgetEventMulticaster; 21 22 27 public class ActionDefinition extends AbstractWidgetDefinition { 28 private String actionCommand; 29 private ActionListener listener; 30 31 public void setActionCommand(String actionCommand) { 32 this.actionCommand = actionCommand; 33 } 34 35 public String getActionCommand() { 36 return actionCommand; 37 } 38 39 public Widget createInstance() { 40 return new Action(this); 41 } 42 43 public void addActionListener(ActionListener listener) { 44 this.listener = WidgetEventMulticaster.add(this.listener, listener); 45 } 46 47 public void fireActionEvent(ActionEvent event) { 48 if (this.listener != null) { 49 this.listener.actionPerformed(event); 50 } 51 } 52 53 public boolean hasActionListeners() { 54 return this.listener != null; 55 } 56 } 57 | Popular Tags |