@Override
 public void setTabs(CourseFinderTab... tabs) {
   iTabs = tabs;
   if (iTabs.length == 1) {
     if (iTabs[0].asWidget() instanceof VerticalPanel) {
       VerticalPanel vp = (VerticalPanel) iTabs[0].asWidget();
       while (vp.getWidgetCount() > 0) {
         Widget w = vp.getWidget(0);
         vp.remove(w);
         iDialogPanel.add(w);
       }
     } else {
       iDialogPanel.add(iTabs[0].asWidget());
     }
   } else {
     iTabPanel = new UniTimeTabPanel();
     int tabIndex = 0;
     for (CourseFinderTab tab : iTabs) {
       iTabPanel.add(tab.asWidget(), tab.getName(), true);
       Character ch = UniTimeHeaderPanel.guessAccessKey(tab.getName());
       if (ch != null) iTabAccessKeys.put(ch, tabIndex);
       tabIndex++;
     }
     iTabPanel.selectTab(0);
     iDialogPanel.add(iTabPanel);
   }
   for (final CourseFinderTab tab : iTabs) {
     tab.addValueChangeHandler(
         new ValueChangeHandler<String>() {
           @Override
           public void onValueChange(ValueChangeEvent<String> event) {
             if (event.getSource().equals(tab)) selectTab(tab);
             else tab.setValue(event.getValue());
             iFilter.setValue(event.getValue());
           }
         });
     tab.addSelectionHandler(
         new SelectionHandler<String>() {
           @Override
           public void onSelection(SelectionEvent<String> event) {
             iFilter.setValue(event.getSelectedItem());
             hide();
             SelectionEvent.fire(CourseFinderDialog.this, getValue());
           }
         });
     tab.addResponseHandler(
         new ResponseHandler() {
           @Override
           public void onResponse(ResponseEvent event) {
             if (event.isValid()) {
               CourseFinderTab selected = getSelectedTab();
               if (selected != null && selected.isCourseSelection() && selected.getValue() != null)
                 return;
               selectTab(tab);
             }
           }
         });
   }
 }
  private List<Parameter> getCurrentParameters() {
    List<Parameter> parameters = new ArrayList<Parameter>();

    for (int i = 0; i < parametersPanel.getWidgetCount(); i++) {
      HorizontalPanel entry = (HorizontalPanel) parametersPanel.getWidget(i);
      parameters.add(new Parameter(getParameterKey(entry), getParameterValue(entry)));
    }
    return parameters;
  }
  private void refreshParameters() {
    getSelectedConfiguration().clearParameters();

    for (int i = parametersPanel.getWidgetCount() - 1; i >= 0; i--) {
      HorizontalPanel entry = (HorizontalPanel) parametersPanel.getWidget(i);
      String key = getParameterKey(entry);

      if (mustDiscardParameter(key)) removeParameter(entry);
      else getSelectedConfiguration().addParameter(new Parameter(key, getParameterValue(entry)));
    }
  }
  public List<SortField> getSortFields() {

    List<SortField> sortFields = new ArrayList<SortField>();

    int count = sortPanel.getWidgetCount();
    for (int i = 1; i < count; i++) {
      DisplayColumnWidget displayColumnWidget = dispColMap.get(sortPanel.getWidget(i));
      sortFields.add(
          new SortField(displayColumnWidget.getName(), displayColumnWidget.getSortOrder()));
    }

    return sortFields;
  }
  public List<DisplayField> getDisplayFields() {

    List<DisplayField> displayFields = new ArrayList<DisplayField>();

    int count = columnPanel.getWidgetCount();
    for (int i = 1; i < count; i++) {
      Widget widget = columnPanel.getWidget(i);
      if (widget instanceof DisplayColumnWidget) {
        DisplayColumnWidget displayColumnWidget = (DisplayColumnWidget) widget;
        displayFields.add(
            new DisplayField(
                displayColumnWidget.getName(),
                displayColumnWidget.getText(),
                displayColumnWidget.getAggregateFunction(),
                displayColumnWidget.getDataType()));
      }
    }

    return displayFields;
  }
  /** Main class */
  public void onModuleLoad() {

    // basic settings
    session.setUiElements(new UiElements(null));

    // Get web page's BODY
    RootLayoutPanel body = RootLayoutPanel.get();

    // check RPC url
    if (session.getRpcUrl().isEmpty()) {
      VerticalPanel bodyContents = new VerticalPanel();
      bodyContents.setSize("100%", "300px");
      bodyContents.add(
          new HTML(new Image(LargeIcons.INSTANCE.errorIcon()) + "<h2>RPC SERVER NOT FOUND!</h2>"));
      bodyContents.setCellHorizontalAlignment(
          bodyContents.getWidget(0), HasHorizontalAlignment.ALIGN_CENTER);
      bodyContents.setCellVerticalAlignment(
          bodyContents.getWidget(0), HasVerticalAlignment.ALIGN_BOTTOM);
      body.add(bodyContents);
      return;
    }

    // WEB PAGE SPLITTER
    body.add(bodySplitter);

    // left menu
    leftMenu = new ApplicationFormLeftMenu();

    // show loading box
    loadingBox = session.getUiElements().perunLoadingBox();
    loadingBox.show();

    // switch menu event
    JsonCallbackEvents events =
        new JsonCallbackEvents() {
          @Override
          public void onFinished(JavaScriptObject jso) {

            bodySplitter.clear();
            bodySplitter.addSouth(getFooter(), 23);
            ArrayList<Application> apps = JsonUtils.jsoAsList(jso);
            if (apps != null && !apps.isEmpty()) {
              // show menu
              bodySplitter.addWest(leftMenu, 280);
            }
            // else don't show menu
            // MAIN CONTENT
            contentPanel.setSize("100%", "100%");
            contentPanel.add(leftMenu.getContent());
            bodySplitter.add(contentPanel);

            // Append more GUI elements from UiElements class which are not part of splitted design
            // WE DON'T WANT TO CONFUSE USER WITH STATUS MESSAGES
            // bodySplitter.getElement().appendChild(session.getUiElements().getStatus().getElement()); // status

            // starts loading
            isUserMemberOfVo();

            // hides the loading box
            loadingBox.hide();
          }

          @Override
          public void onError(PerunError error) {
            // MAIN CONTENT

            bodySplitter.clear();
            bodySplitter.addSouth(getFooter(), 23);
            contentPanel.clear();
            contentPanel.setSize("100%", "100%");
            contentPanel.add(leftMenu.getContent());
            bodySplitter.add(contentPanel);

            // Append more GUI elements from UiElements class which are not part of splitted design
            // bodySplitter.getElement().appendChild(session.getUiElements().getStatus().getElement()); // status

            // starts loading
            isUserMemberOfVo();

            // hides the loading box
            loadingBox.hide();
          }
        };

    // load VO to check if exists
    loadVo(events);
  }
Exemple #7
0
 private boolean checkVarNameFieldIsFilledAndHighlight() {
   boolean isFilled = !(input.getName() == null) && !input.getName().isEmpty();
   setFieldHighlight(varNamePanel.getWidget(1), isFilled);
   return isFilled;
 }
Exemple #8
0
 private boolean checkTextPromptFieldIsFilledAndHighlight() {
   boolean isFilled = !(input.getText() == null) && !input.getText().isEmpty();
   setFieldHighlight(inputPromptTextPanel.getWidget(1), isFilled);
   return isFilled;
 }
Exemple #9
0
 public boolean checkVarNameFilledWithoutSpacesAndHighlight() {
   boolean filledAndHasNoSpaces =
       !(input.getName() == null) && !input.getName().isEmpty() && !input.getName().contains(" ");
   setFieldHighlight(varNamePanel.getWidget(1), filledAndHasNoSpaces);
   return filledAndHasNoSpaces;
 }
  private void clearConditions() {
    while (columnPanel.getWidgetCount() > 1) columnPanel.remove(columnPanel.getWidget(1));

    while (sortPanel.getWidgetCount() > 1) sortPanel.remove(sortPanel.getWidget(1));
  }