1 30 package com.genimen.djeneric.tools.scriptengine.core.nodes; 31 32 import com.genimen.djeneric.language.Messages; 33 import com.genimen.djeneric.tools.scriptengine.core.DjScriptParserEngine; 34 import com.genimen.djeneric.tools.scriptengine.core.ParseException; 35 import com.genimen.djeneric.tools.scriptengine.core.SimpleNode; 36 37 public class EventDefinitionNode extends SimpleNode 38 { 39 String _eventName; 40 String _eventTitle; 41 String _option = "accept"; 42 43 public EventDefinitionNode(int i) 44 { 45 super(i); 46 } 47 48 public EventDefinitionNode(DjScriptParserEngine p, int i) 49 { 50 super(p, i); 51 } 52 53 public String getEventName() 54 { 55 return _eventName; 56 } 57 58 public void setEventName(String eventName) 59 { 60 _eventName = eventName; 61 } 62 63 public String getEventTitle() 64 { 65 return _eventTitle; 66 } 67 68 public void setEventTitle(String eventTitle) 69 { 70 _eventTitle = eventTitle.substring(1, eventTitle.length() - 1); 71 } 72 73 public String getOption() 74 { 75 return _option; 76 } 77 78 public void setOption(String option) throws ParseException 79 { 80 if (!"accept".equals(option) && !"cancel".equals(option) && !"none".equals(option)) 81 { 82 throw new ParseException(Messages.getString("EventDefinitionNode.Encountered", option, String.valueOf(getLine()), 83 String.valueOf(getColumn())), getLine(), getColumn()); 84 } 85 _option = option; 86 } 87 88 public String getName() 89 { 90 return "event definition"; 91 } 92 93 public String toString() 94 { 95 return getEventName() + " " + getEventTitle() + " " + getOption(); 96 } 97 98 public Object getEventNameIncludingAction() 99 { 100 ActionNode action = (ActionNode) getParent(ActionNode.class); 101 if (action == null) return getEventName(); 102 103 return action.getActionName() + "." + getEventName(); 104 } 105 106 } | Popular Tags |