public String getDefaultView() {
   if (defaultPageName == null) {
     if (workunit.getWorkunit().getPages().size() > 0) {
       defaultPageName = workunit.getCurrentPage().getName();
     }
   }
   return defaultPageName;
 }
 public UIController.View[] getViews() {
   List<UIController.View> list = new ArrayList();
   for (Object o : workunit.getWorkunit().getPages().values()) {
     Page p = (Page) o;
     list.add(new UIController.View(p.getName(), p.getTemplate()));
   }
   return (UIController.View[]) list.toArray(new UIController.View[] {});
 }
  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);
      }
    }
  }
 public Object getCodeBean() {
   return workunit.getController();
 }
 public WorkUnitUIController(WorkUnitInstance wu) {
   this.workunit = wu;
   this.id = wu.getId();
   this.name = wu.getId();
   this.title = wu.getTitle();
 }
예제 #6
0
 public boolean equals(Object object) {
   if (object == null) return false;
   if (!(object instanceof WorkUnitInstance)) return false;
   WorkUnitInstance wi = (WorkUnitInstance) object;
   return hashCode() == wi.hashCode();
 }