public Object init(Map properties, String action, Object[] actionParams) {
    // set the properties
    ControlSupport.setProperties(getCodeBean(), properties);

    // check first if the workunit has already started.
    // if it has already started, fire the transition.
    // The subprocess normnally calls _close:signalAction.
    if (workunit.getPageFlow() != null && workunit.isStarted()) {
      if (action == null) {
        workunit.signal();
      } else {
        workunit.signal(action);
      }

      // determine which page to display next.
      if (workunit.isPageFlowCompleted()) return "_close";
      else return workunit.getCurrentPage().getName();
    } else {
      if (workunit.getWorkunit().getPages().size() > 0) {
        defaultPageName = workunit.getCurrentPage().getName();
      }

      if (action == null) {
        return null;
      } else if (action.startsWith("_")) {
        return action.substring(1);
      } else {
        if (actionParams == null) actionParams = new Object[] {};

        Object codeBean = getCodeBean();
        if (hasMethod(codeBean, action, actionParams))
          return ControlSupport.invoke(codeBean, action, actionParams);
        else return ControlSupport.invoke(codeBean, action, null);
      }
    }
  }
Example #2
0
 private Icon getOpenerIcon(Opener o) {
   if (o.getProperties().get("icon") != null) {
     return ControlSupport.getImageIcon(o.getProperties().get("icon") + "");
   }
   return null;
 }