Пример #1
0
  private Tab createRecipeTab() {
    Tab tab = new Tab(MSG.view_bundle_recipe());
    DynamicForm form = new DynamicForm();

    TextAreaItem recipeCanvas = new TextAreaItem("recipe", MSG.view_bundle_recipe());
    recipeCanvas.setShowTitle(false);
    recipeCanvas.setColSpan(2);
    recipeCanvas.setWidth("100%");
    recipeCanvas.setHeight("100%");
    recipeCanvas.setValue(version.getRecipe());
    recipeCanvas.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            // makes this read-only; however, since its not disabled, user can still select/copy the
            // text
            event.cancel();
          }
        });

    form.setHeight100();
    form.setWidth100();
    form.setItems(recipeCanvas);
    tab.setPane(form);
    return tab;
  }
Пример #2
0
  /**
   * Get content for bookmark popup
   *
   * @return
   */
  private HLayout getPopupContent() {
    HLayout hlayout = new HLayout();
    hlayout.setWidth100();
    hlayout.setHeight100();
    DynamicForm form = new DynamicForm();
    form.setHeight100();
    form.setWidth(260);
    form.setTitleWidth(100);
    bookmarkTitle = new TextItem();
    bookmarkTitle.setTitle("Title");
    if (!view.getSettings().inSingleEndpointMode()) {
      includeEndpoint = new CheckboxItem();
      includeEndpoint.setTitle("Include endpoint");
      includeEndpoint.setLabelAsTitle(true);
      form.setItems(bookmarkTitle, includeEndpoint);
    } else {
      form.setItems(bookmarkTitle);
    }

    Button bookmarkButton = new Button("Bookmark");
    bookmarkButton.setHeight100();
    bookmarkButton.setWidth(60);
    bookmarkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Bookmark bookmark = new Bookmark();
            if (includeEndpoint != null && includeEndpoint.getValueAsBoolean()) {
              bookmark.setEndpoint(view.getSelectedTabSettings().getEndpoint());
            }
            bookmark.setQuery(view.getSelectedTabSettings().getQueryString());
            bookmark.setTitle(bookmarkTitle.getValueAsString());

            window.clear();
            setSrc(Imgs.get(Imgs.LOADING));
            view.getRemoteService()
                .addBookmark(
                    bookmark,
                    new AsyncCallback<Void>() {
                      public void onFailure(Throwable caught) {
                        setSrc(Imgs.get(Imgs.BOOKMARK_QUERY));
                        if (caught instanceof OpenIdException) {
                          view.getElements().onError(caught.getMessage() + ". Logging out");
                          view.getOpenId().logOut();
                        } else {
                          view.getElements().onError(caught);
                        }
                      }

                      @Override
                      public void onSuccess(Void result) {
                        setSrc(Imgs.get(Imgs.BOOKMARK_QUERY));
                      }
                    });
          }
        });
    hlayout.addMembers(form, Helper.getHSpacer(), bookmarkButton);
    return hlayout;
  }
  private void initComponents() {
    HLayout formsHLayout = new HLayout();
    formsHLayout.setWidth100();
    formsHLayout.setHeight("*");
    formsHLayout.setMembersMargin(5);

    DynamicForm jobNamesForm = new DynamicForm();
    jobNamesForm.setWidth100();
    jobNamesForm.setHeight100();
    jobNamesForm.setGroupTitle("Filter Jobs");
    jobNamesForm.setIsGroup(true);
    jobNamesForm.setTitleOrientation(TitleOrientation.TOP);
    jobNamesForm.setNumCols(2);
    jobNamesForm.setValuesManager(valuesManager);

    jobNamesForm.setDataFetchMode(FetchMode.BASIC);

    CheckboxItem selectAllJobNamesChkItem = new CheckboxItem();
    selectAllJobNamesChkItem.setValue(true);
    selectAllJobNamesChkItem.setTitle("Select All Jobs");
    selectAllJobNamesChkItem.setWidth("*");
    selectAllJobNamesChkItem.setName("selectAllJobNames");
    selectAllJobNamesChkItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            if ((Boolean) event.getValue()) {
              selectJobNameGrid.setDisabled(true);
              selectJobNameGrid.setCriterion(null);
            } else {
              selectJobNameGrid.setDisabled(false);
              // selectJobNameGrid.setCriterion(new Criterion().seta);
            }
          }
        });

    selectJobNameGrid.setTitle("Select Jobs");
    selectJobNameGrid.setWidth(280);
    selectJobNameGrid.setMultiple(true);
    selectJobNameGrid.setMultipleAppearance(MultipleAppearance.GRID);
    selectJobNameGrid.setValueMap("job", "job1", "job2", "Goat", "Marmoset", "Mouse");
    selectJobNameGrid.setName("selectedJobNames");
    selectJobNameGrid.setCriteriaField("selectedJobNames");
    /*selectJobNameGrid.addClickHandler(new ClickHandler() {
    	@Override
    	public void onClick(ClickEvent event) {
    		if(event.getSource().equals(selectJobNameGrid)){
    			String[] values = selectJobNameGrid.getValues();
    			valuesManager.setAttribute("selectedJobNames", values, true);
    		}
    	}
    });*/

    executionStartDate.setName("executionStartDate");
    executionStartDate.setTitle("Exceution Start Date");
    executionStartDate.setRequired(true);

    executionEndDate.setName("executionEndDate");
    executionEndDate.setTitle("Exceution End Date");
    executionEndDate.setRequired(true);

    executionStartTime.setName("executionStartTime");
    executionStartTime.setTitle("Exceution Start Time");
    executionStartTime.setRequired(true);

    executionEndTime.setName("executionEndTime");
    executionEndTime.setTitle("Exceution End Time");
    executionEndTime.setRequired(true);

    FormItem[] formItems =
        new FormItem[] {
          selectAllJobNamesChkItem,
          selectJobNameGrid,
          executionStartDate,
          executionStartTime,
          executionEndDate,
          executionEndTime
        };
    jobNamesForm.setDataSource(HistoricalJobMonitorDataSource.getInstance(), formItems);
    jobNamesForm.setFields(formItems);
    formsHLayout.addMember(jobNamesForm);

    addMember(formsHLayout);

    addMember(searchButton);
  }
Пример #4
0
  private HLayout createSearchLayout() {
    HLayout searchLayout = new HLayout();

    searchLayout.setWidth100();
    searchLayout.setHeight(20);
    searchLayout.setMembersMargin(15);

    i_searchForm = new DynamicForm();
    i_searchForm.setWidth(250);
    i_searchForm.setHeight100();
    i_searchForm.setAlign(Alignment.LEFT);
    i_searchForm.setAutoFocus(true);

    i_searchTextItem = new TextItem();
    i_searchTextItem.setTitle("Search");
    i_searchTextItem.setWidth(200);
    i_searchTextItem.setHint(SEARCH_HINT);
    i_searchTextItem.setShowHintInField(true);
    i_searchTextItem.setCanFocus(true);
    i_searchTextItem.setSelectOnFocus(true);

    i_searchTextItem.addKeyUpHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            event.getKeyName();

            // ignore the arrow keys
            if (isValidSearchText()) {
              i_searchListGrid.getData(i_searchTextItem.getValueAsString());
              i_addButton.setDisabled(true);
            }
          }
        });

    i_searchForm.setFields(i_searchTextItem);

    // add button to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout buttonVlayout = new VLayout();
    buttonVlayout.setWidth(40);
    buttonVlayout.setAlign(VerticalAlignment.CENTER);
    buttonVlayout.setMargin(2);

    i_clearButton = new IButton(CLEAR_BUTTON_TITLE);
    i_clearButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            i_searchTextItem.setValue("");
            i_rowsRetrievedLabel.setContents("");
            i_searchListGrid.clearData();
            i_addButton.setDisabled(true);
          }
        });
    buttonVlayout.addMember(i_clearButton);

    // add Label to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout labelVlayout = new VLayout();
    labelVlayout.setWidth(100);
    labelVlayout.setAlign(VerticalAlignment.BOTTOM);
    labelVlayout.setMargin(2);

    i_rowsRetrievedLabel = new Label();
    i_rowsRetrievedLabel.setWrap(false);
    i_rowsRetrievedLabel.setWidth100();
    i_rowsRetrievedLabel.setHeight(23);

    labelVlayout.addMember(i_rowsRetrievedLabel);

    searchLayout.addMember(i_searchForm);
    searchLayout.addMember(buttonVlayout);
    searchLayout.addMember(labelVlayout);

    return searchLayout;
  }
Пример #5
0
  private void buildInstallInfoCanvas(AgentInstallInfo info) {
    DynamicForm infoForm = new DynamicForm();
    infoForm.setMargin(20);
    infoForm.setWidth100();
    infoForm.setHeight100();

    HeaderItem infoHeader = new HeaderItem();
    infoHeader.setValue(MSG.view_remoteAgentInstall_installInfo());

    StaticTextItem version = new StaticTextItem("version", MSG.common_title_version());
    version.setValue(info.getVersion());

    StaticTextItem path = new StaticTextItem("path", MSG.common_title_path());
    path.setValue(info.getPath());

    StaticTextItem owner = new StaticTextItem("owner", MSG.common_title_owner());
    owner.setValue(info.getOwner());

    StaticTextItem config = new StaticTextItem("config", MSG.common_title_configuration());
    config.setValue(info.getConfigurationStartString());

    CanvasItem listCanvas = new CanvasItem();
    listCanvas.setShowTitle(false);
    listCanvas.setColSpan(2);

    VLayout listLayout = new VLayout(0);
    listLayout.setWidth100();
    listLayout.setHeight100();

    ListGrid listGrid =
        new ListGrid() {
          @Override
          protected Canvas getExpansionComponent(ListGridRecord record) {
            Canvas canvas = super.getExpansionComponent(record);
            canvas.setPadding(5);
            return canvas;
          }
        };
    listGrid.setWidth100();
    listGrid.setHeight100();
    listGrid.setCanExpandRecords(true);
    listGrid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
    listGrid.setDetailField("result");
    ListGridField step = new ListGridField("description", MSG.view_remoteAgentInstall_step());
    ListGridField result = new ListGridField("result", MSG.view_remoteAgentInstall_result());
    ListGridField resultCode =
        new ListGridField("resultCode", MSG.view_remoteAgentInstall_resultCode(), 90);
    ListGridField duration = new ListGridField("duration", MSG.common_title_duration(), 90);
    listGrid.setFields(step, result, resultCode, duration);
    listGrid.setData(getStepRecords(info));

    listLayout.addMember(listGrid);
    listCanvas.setCanvas(listLayout);

    // Replace the current info with just the install steps
    for (Canvas canvas : this.getChildren()) {
      canvas.markForDestroy();
    }

    createAgentStatusTextItem();
    infoForm.setFields(infoHeader, version, path, owner, config, agentStatusText, listCanvas);

    addMember(infoForm);

    this.setMembersMargin(1);
    this.markForRedraw();
  }