Example #1
0
  /** Build the static part of the UI. */
  protected void initContent() {

    // Case initiator will not change.
    final String theCaseInitiator = constants.caseStartedBy() + myCase.getStartedBy().getValue();
    final String theProcessDescription = myProcess.getProcessDescription();
    final String theShortDesc;
    if (theProcessDescription.length() > 50) {
      theShortDesc = theProcessDescription.substring(0, 47) + "...";
    } else {
      theShortDesc = theProcessDescription;
    }

    final Grid theWrapper = new Grid(1, 3);
    theWrapper.setHTML(0, 0, theCaseInitiator);
    theWrapper.setHTML(
        0,
        1,
        DateTimeFormat.getFormat(constants.dateShortFormat()).format(myCase.getLastUpdateDate()));
    theWrapper.setHTML(0, 2, theShortDesc);
    myFirstRowPanel.add(theWrapper);
    theWrapper.addStyleName("bos_step_descriptor");

    // Create click handler for user interaction.
    theWrapper.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent anEvent) {
            final Cell theCell = theWrapper.getCellForEvent(anEvent);
            if (theCell != null) {
              toggleOverviewVisibility();
            }
          }
        });
  }
Example #2
0
  protected String buildProcessFormIFrame(String anApplicationURL, String aCredentialsParam) {
    final Map<String, List<String>> parametersMap = urlUtils.getURLParametersMap(anApplicationURL);
    final String url = urlUtils.removeURLparameters(anApplicationURL);

    StringBuilder processFormIFrame = new StringBuilder();
    processFormIFrame.append(url);
    processFormIFrame.append("?");
    processFormIFrame.append(URLUtils.LOCALE_PARAM);
    processFormIFrame.append("=");
    if (parametersMap.containsKey(URLUtils.LOCALE_PARAM)) {
      processFormIFrame.append(parametersMap.get(URLUtils.LOCALE_PARAM).get(0));
      parametersMap.remove(URLUtils.LOCALE_PARAM);
    } else {
      processFormIFrame.append(LocaleInfo.getCurrentLocale().getLocaleName());
    }
    if (BonitaConsole.userProfile.getDomain() != null) {
      processFormIFrame.append("&");
      processFormIFrame.append(URLUtils.DOMAIN_PARAM);
      processFormIFrame.append("=");
      if (parametersMap.containsKey(URLUtils.DOMAIN_PARAM)) {
        processFormIFrame.append(parametersMap.get(URLUtils.DOMAIN_PARAM).get(0));
        parametersMap.remove(URLUtils.DOMAIN_PARAM);
      } else {
        processFormIFrame.append(BonitaConsole.userProfile.getDomain());
      }
    }
    for (Entry<String, List<String>> parametersEntry : parametersMap.entrySet()) {
      processFormIFrame.append("&");
      processFormIFrame.append(parametersEntry.getKey());
      processFormIFrame.append("=");
      List<String> entryValues = parametersEntry.getValue();
      for (String value : entryValues) {
        processFormIFrame.append(value);
        processFormIFrame.append(",");
      }
      processFormIFrame.deleteCharAt(processFormIFrame.length() - 1);
    }

    processFormIFrame.append("#");
    processFormIFrame.append(URLUtils.FORM_ID);
    processFormIFrame.append("=");
    processFormIFrame.append(formId);
    processFormIFrame.append("&");
    processFormIFrame.append(URLUtils.VIEW_MODE_PARAM);
    processFormIFrame.append("=");
    processFormIFrame.append(URLUtils.FORM_ONLY_APPLICATION_MODE);
    processFormIFrame.append("&");
    processFormIFrame.append(URLUtils.INSTANCE_ID_PARAM);
    processFormIFrame.append("=");
    processFormIFrame.append(myCase.getUUID());
    processFormIFrame.append("&");
    processFormIFrame.append(URLUtils.RECAP_PARAM);
    processFormIFrame.append("=");
    processFormIFrame.append("true");
    processFormIFrame.append(aCredentialsParam);

    return processFormIFrame.toString();
  }
Example #3
0
  /**
   * Default constructor.
   *
   * @param aDataSource
   * @param aStep
   * @param mustBeVisible
   */
  public CaseRecapViewerWidget(
      StepItemDataSource aDataSource,
      CaseItem aCase,
      CaseDataSource aCaseDataSource,
      ProcessDataSource aProcessDataSource) {
    super();
    myStepDataSource = aDataSource;
    myCaseDataSource = aCaseDataSource;
    myProcessDataSource = aProcessDataSource;
    myCase = aCase;
    formId = myCase.getProcessUUID().getValue() + "$recap";
    myInnerPanel.add(myFirstRowPanel);
    myInnerPanel.add(mySecondRowPanel);
    myInnerPanel.add(myThirdRowPanel);
    myOuterPanel.add(myInnerPanel);

    myFirstRowPanel.setStylePrimaryName("bos_first_row");
    mySecondRowPanel.setStylePrimaryName("bos_second_row");
    myThirdRowPanel.setStylePrimaryName("bos_third_row");
    myInnerPanel.setStylePrimaryName("bos_case_recap_viewer_inner");
    myOuterPanel.setStylePrimaryName("bos_case_recap_viewer");
    myOuterPanel.addStyleName(CSSClassManager.ROUNDED_PANEL);
    this.initWidget(myOuterPanel);

    myProcessDataSource.getItem(
        myCase.getProcessUUID(),
        new AsyncHandler<BonitaProcess>() {
          public void handleFailure(Throwable aT) {
            // Do nothing.
            GWT.log("Unable to get the process definition:", aT);
          }

          public void handleSuccess(BonitaProcess aResult) {
            myProcess = aResult;
            initContent();
            update();
          }
        });
  }