Example #1
0
 public InfiniteList() {
   res.style().ensureInjected();
   flowPanel = new FlowPanel();
   scrollPanel = new ScrollPanel();
   initWidget(scrollPanel);
   scrollPanel.add(flowPanel);
   flowPanel.setStylePrimaryName("infiniteList");
   clear();
 }
Example #2
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();
          }
        });
  }
Example #3
0
  /** Default constructor. */
  public TextBoxEditor(String aLabel, String aValue, boolean allowHtml) {
    myOuterPanel = new FlowPanel();
    myFieldLabel = new Label();
    if (aLabel != null) {
      myFieldLabel.setText(aLabel);
    }
    myOuterPanel.setStylePrimaryName("bos_textbox_editor");
    myFieldLabel.setStylePrimaryName("field_label");

    this.allowHtml = allowHtml;
    isEditable = false;

    myOuterPanel.add(myFieldLabel);
    initContent(aValue);

    initWidget(myOuterPanel);
  }
Example #4
0
  /**
   * This constructor uses the SearchHandler of the new SearchPageUnified. This will be the default
   * constructor after development of the new feature is finished.
   *
   * @param isUnified
   */
  public ResultsView(boolean isUnified) {
    super();
    this.setStylePrimaryName(STYLE.resultsView());
    contentPanel = getContentPanel();
    bookViewMap = new HashMap<Book, ResultsBookView>();
    unPickables = new HashSet<Book>();

    com.bookspicker.client.view.SearchPageUnified.SearchHandler searchHandler =
        new com.bookspicker.client.view.SearchPageUnified.SearchHandler();

    searchTextBox = new SuggestionTextBox(classSuggestionString);
    searchTextBox.setVisibleLength(40);

    autoCompleteBox = new BpSuggestBox(BpOracle.getInstance(), searchTextBox);
    autoCompleteBox.addSelectionHandler(
        new SelectionHandler<Suggestion>() {

          @Override
          public void onSelection(SelectionEvent<Suggestion> event) {
            if (event.getSelectedItem() instanceof BpOracleSuggestion) {
              BpOracleSuggestion bpSuggestion = (BpOracleSuggestion) event.getSelectedItem();
              autoCompleteBox.setSavedQuery(bpSuggestion.getQueryString());
            }
          }
        });

    autoCompleteBox.addValueChangeHandler(
        new ValueChangeHandler<String>() {

          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            autoCompleteBox.cleanSavedQuery();
          }
        });

    searchTextBox.reset();
    autoCompleteBox.setLimit(8);
    autoCompleteBox.setWidth("25em");
    autoCompleteBox.setAutoSelectEnabled(true);

    if (SearchPage.AUTO_COMPLETE) {
      searchTextBox.addKeyPressHandler(searchHandler);
      searchTextBox.addKeyDownHandler(searchHandler);
      autoCompleteBox.addSelectionHandler(searchHandler);
      searchBox.setWidget(0, 0, autoCompleteBox);
    } else {
      searchTextBox.addKeyPressHandler(searchHandler);
      searchBox.setWidget(0, 0, searchTextBox);
    }
    searchBox.setStylePrimaryName(STYLE.searchBox());

    InlineLabel searchButton = new InlineLabel("Search");
    searchButton.setStylePrimaryName(STYLE.bpYellowButton());
    searchButton.addStyleName(STYLE.searchButton());
    searchButton.addStyleDependentName(STYLE.bpYellowButton());
    searchButton.addClickHandler(searchHandler);
    searchBox.setWidget(0, 1, searchButton);

    loadingIcon = new Image(Resources.INSTANCE.loadingIconSmall());
    loadingIcon.setStylePrimaryName(STYLE.loadingIcon());
    loadingIcon.addStyleName(STYLE.loadingIconHidden());
    searchBox.setWidget(0, 2, loadingIcon);

    SimplePanel searchWrapper = new SimplePanel();
    searchWrapper.setStylePrimaryName(STYLE.searchBoxWrapper());
    searchWrapper.setWidget(searchBox);
    contentPanel.add(searchWrapper);

    results.setStylePrimaryName(STYLE.resultsList());

    contentPanel.add(results);
  }
Example #5
0
  /**
   * Build the widget
   *
   * @param user the logged in user
   * @return the {@link Widget}
   */
  protected Widget buildUserIdentityCard() {

    final FlowPanel theIDWidget = new FlowPanel();
    theIDWidget.setStylePrimaryName("bonita_identification");

    final FlowPanel theLeftAlignedBox = new FlowPanel();
    theLeftAlignedBox.setStylePrimaryName("bonita_identified-left");

    theIDWidget.add(theLeftAlignedBox);

    final Image theAvatar = new Image("images/avatar-default.gif");
    theAvatar.setStyleName("bonita_avatar");

    theLeftAlignedBox.add(theAvatar);

    final FlowPanel theRightAlignedBox = new FlowPanel();
    theRightAlignedBox.setStylePrimaryName("bonita_identified-right");

    theLeftAlignedBox.add(theRightAlignedBox);

    HTML theUserIdentity = null;
    if (user.isAnonymous()) {
      theUserIdentity = new HTML(FormsResourceBundle.getMessages().anonymousLabel());
    } else {
      theUserIdentity = new HTML(user.getUsername());
    }
    theUserIdentity.setStylePrimaryName("bonita_identif-1");

    theRightAlignedBox.add(theUserIdentity);

    Anchor theLogoutLink = null;
    if (user.isAnonymous()) {
      theLogoutLink = new Anchor(FormsResourceBundle.getMessages().loginButtonLabel());
    } else {
      theLogoutLink = new Anchor(FormsResourceBundle.getMessages().logoutButtonLabel());
    }
    theLogoutLink.setStylePrimaryName("bonita_identif-2");

    final URLUtils urlUtils = URLUtilsFactory.getInstance();
    final List<String> paramsToRemove = new ArrayList<String>();
    paramsToRemove.add(URLUtils.LOCALE_PARAM);
    final List<String> hashParamsToRemove = new ArrayList<String>();
    if (user.isAutoLogin()) {
      hashParamsToRemove.add(URLUtils.AUTO_LOGIN_PARAM);
    } else {
      hashParamsToRemove.add(URLUtils.USER_CREDENTIALS_PARAM);
    }
    if (!user.isAnonymous()) {
      for (final Entry<String, Object> hashParamEntry : context.entrySet()) {
        hashParamsToRemove.add(hashParamEntry.getKey());
      }
    }
    Map<String, String> hashParamsToAdd = new HashMap<String, String>();
    hashParamsToAdd.put(URLUtils.TODOLIST_PARAM, "true");
    hashParamsToAdd.put(URLUtils.VIEW_MODE_PARAM, "app");
    final String theRedirectURL =
        urlUtils.rebuildUrl(paramsToRemove, null, hashParamsToRemove, hashParamsToAdd);
    String theURL = "?" + URLUtils.REDIRECT_URL_PARAM + "=";
    try {
      theURL += URL.encodeQueryString(theRedirectURL);
    } catch (final Exception e) {
      Window.alert("Unable to redirect to login page: Invalid URL");
      theURL += GWT.getModuleBaseURL();
    }
    theLogoutLink.setHref(theURL);

    theRightAlignedBox.add(theLogoutLink);

    return theIDWidget;
  }