Changeset 725
- Timestamp:
- 01/21/14 10:10:57 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r570 r725 75 75 76 76 // Package and class file locations 77 p rivatestatic final String ACTIONS_PACKAGE = ROOT_PACKAGE + "actions.";78 79 p rivatestatic final String AGENTS_PACKAGE = ROOT_PACKAGE + "agents.";80 81 p rivatestatic final String WIDGET_PACKAGE = ROOT_PACKAGE + "items.widgets.";82 83 p rivatestatic final String CHARTS_PACKAGE = ROOT_PACKAGE + "items.widgets.charts.";84 85 p rivatestatic final String NAVIGATIONS_CLASS = ROOT_PACKAGE + "actions.NavigationActions";77 public static final String ACTIONS_PACKAGE = ROOT_PACKAGE + "actions."; 78 79 public static final String AGENTS_PACKAGE = ROOT_PACKAGE + "agents."; 80 81 public static final String WIDGET_PACKAGE = ROOT_PACKAGE + "items.widgets."; 82 83 public static final String CHARTS_PACKAGE = ROOT_PACKAGE + "items.widgets.charts."; 84 85 public static final String NAVIGATIONS_CLASS = ROOT_PACKAGE + "actions.NavigationActions"; 86 86 87 87 // public static Class[] getClasses(String pckgname) -
trunk/src/org/expeditee/items/widgets/InteractiveWidget.java
r720 r725 190 190 String classname = tokens[0]; 191 191 if (classname.charAt(0) == '$'){ 192 String shortClassname = classname.substring(1); 193 classname = Actions.getClassName(shortClassname); 194 195 if (classname == null) // ensure it exists 196 throw new InteractiveWidgetNotAvailableException(shortClassname 197 + " does not exist or is not an InteractiveWidget"); 198 } 192 classname = classname.substring(1); 193 } 194 199 195 // Attempt to locate the class using reflection 200 196 Class<?> iwclass = findIWidgetClass(classname); … … 248 244 if(classname == null) 249 245 return null; 250 246 // try just the classname 251 247 try { 252 248 Class c = Class.forName(classname); // attempt to find the class 249 250 // If one is found, ensure that it is a descendant of an 251 // InteractiveWidget 252 for (Class superclass = c.getSuperclass(); superclass != null 253 && superclass != Item.class; superclass = superclass 254 .getSuperclass()) { 255 if (superclass == InteractiveWidget.class) 256 return c; 257 } 258 259 } catch (ClassNotFoundException e) { 260 } 261 // see if the class is a widget with invalid capitalisation, or missing the widget package prefix 262 if(classname.startsWith(Actions.WIDGET_PACKAGE)) { 263 classname = classname.substring(Actions.WIDGET_PACKAGE.length()); 264 } 265 try { 266 Class c = Class.forName(Actions.getClassName(classname)); // attempt to find the class 253 267 254 268 // If one is found, ensure that it is a descendant of an
Note:
See TracChangeset
for help on using the changeset viewer.