コード例 #1
0
  public LayerSettingsForm() {

    // 		setWidth100();
    setColWidths("125", "*");

    name = new TextItem();
    name.setTitle(MESSAGES.layerSettingsLayerName());
    name.setWidth(250);
    name.setRequired(true);

    publicLayer = new CheckboxItem();
    publicLayer.setTitle(MESSAGES.layerSettingsPublic());
    publicLayer.setTooltip(MESSAGES.layerSettingsPublicTooltip());

    active = new CheckboxItem();
    active.setTitle(MESSAGES.layerSettingsActive());
    active.setTooltip(MESSAGES.layerSettingsActiveTooltip());

    visible = new CheckboxItem();
    visible.setTitle(MESSAGES.layerSettingsVisibleByDefault());
    visible.setTooltip(MESSAGES.layerSettingsVisibleByDefaultTooltip());

    // -------------------------------------------------

    setFields(name, publicLayer, active, visible);
  }
コード例 #2
0
  public FormAddFolderFromButton(IHMcodeMirror IHM) {
    super();
    this.IHMcodeMirror = IHM;

    WindowFactory.setParameters(this, "Create New Folder", 350, 280);

    this.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClientEvent closeClientEvent) {
            hide();
          }
        });

    DynamicForm form = new DynamicForm();
    form.setPadding(5);
    form.setLayoutAlign(VerticalAlignment.BOTTOM);

    textItem = new TextItem();
    textItem.setTitle("Name");
    textItem.setRequired(true);

    IButton ok = new IButton("Ok");
    form.setFields(textItem);
    this.addItem(form);
    this.addItem(ok);

    treeGrid = Singleton.getInstance().loadFileSystemLight(IHMcodeMirror.getAbstractItemRoot());
    this.addItem(treeGrid);

    ok.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            AbstractItem item =
                (AbstractItem) treeGrid.getSelectedRecord().getAttributeAsObject("abstractItem");
            item.setPath(item.getPath() + textItem.getEnteredValue());

            repositoryToolsServices.createFolderIntoLocalRepository(
                item,
                new AsyncCallback<Boolean>() {
                  @Override
                  public void onFailure(Throwable throwable) {}

                  @Override
                  public void onSuccess(Boolean bool) {
                    hide();
                    Singleton.getInstance()
                        .loadFileSystem(
                            IHMcodeMirror.getAbstractItemRoot(), IHMcodeMirror.getSystemFileRoot());
                  }
                });
          }
        });
  }
コード例 #3
0
  private Tab fullTextSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchFullTextTab = new Tab();
    searchFullTextTab.setTitle("Full Text Search");
    final DynamicForm searchFullTextForm = new DynamicForm();
    searchFullTextForm.setID("searchFullTextForm");
    searchFullTextForm.setNumCols(3);
    searchFullTxt.setName("searchFullTxt");
    searchFullTxt.setTitle("Full Text Search");
    searchFullTxt.setWidth(250);
    searchFullTxt.setRequired(true);
    //		RegExpValidator regExpValidator = new RegExpValidator();
    //		regExpValidator.setExpression("^[\\w\\d\\_\\.]{1,}$");
    //		searchFullTxt.setValidateOnChange(true);
    //		searchFullTxt.setValidators(regExpValidator);
    SubmitItem searchFullTextSubmitItem = new SubmitItem("searchFullTextSubmitItem");
    searchFullTextSubmitItem.setTitle("Search");
    searchFullTextSubmitItem.setWidth(100);
    class SearchFullTextSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchFullTextSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchFullTextForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.fullTextSearch(
              searchFullTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchFullTextForm.addSubmitValuesHandler(
        new SearchFullTextSubmitValuesHandler(jackrabbitExplorer));
    searchFullTextForm.setSaveOnEnter(true);
    searchFullTxt.setStartRow(true);
    searchFullTxt.setEndRow(false);
    searchFullTextSubmitItem.setStartRow(false);
    searchFullTextSubmitItem.setEndRow(true);
    searchFullTextForm.setItems(searchFullTxt, searchFullTextSubmitItem);
    searchFullTextTab.setPane(searchFullTextForm);
    return searchFullTextTab;
  }
コード例 #4
0
ファイル: Setup.java プロジェクト: genievn/LD
  /** Prepares the repository form */
  private Tab setupRepository(final ValuesManager vm) {
    // Prepare the tab used to configure the repository where documents and
    // other data will be stored
    Tab repositoryTab = new Tab();
    repositoryTab.setTitle(I18N.message("repository"));

    final DynamicForm repositoryForm = new DynamicForm();
    repositoryForm.setID("repositoryForm");
    repositoryForm.setValuesManager(vm);
    TextItem repositoryItem = ItemFactory.newTextItem(REPOSITORY_FOLDER, "repofolder", null);
    repositoryItem.setWidth(200);
    repositoryItem.setRequired(true);
    repositoryItem.setWrapTitle(false);
    repositoryItem.setDefaultValue(getDefaultFolder());
    repositoryForm.setFields(repositoryItem);
    repositoryForm.setDisabled(true);

    repositoryTab.setPane(repositoryForm);
    return repositoryTab;
  }
コード例 #5
0
  public UserDetailTabPane(DataSource userDS, final ItemListGrid userListGrid) {

    this.userListGrid = userListGrid;
    setStyleName("defaultBorder");

    userViewer = new DetailViewer();
    userViewer.setDataSource(userDS);
    userViewer.setWidth100();
    userViewer.setMargin(25);
    userViewer.setEmptyMessage("Select an user to view its details");

    editorLabel = new Label();
    editorLabel.setWidth100();
    editorLabel.setHeight100();
    editorLabel.setAlign(Alignment.CENTER);
    editorLabel.setContents("Select an user to edit, or insert a new user into");

    insertLabel = new Label();
    insertLabel.setWidth100();
    insertLabel.setHeight100();
    insertLabel.setAlign(Alignment.CENTER);
    insertLabel.setContents("Insert a new user into");

    // update form
    editorForm = new DynamicForm();
    editorForm.setWidth(650);
    editorForm.setMargin(25);
    editorForm.setNumCols(4);
    editorForm.setCellPadding(5);
    editorForm.setAutoFocus(false);
    editorForm.setDataSource(userDS);
    editorForm.setUseAllDataSourceFields(true);

    userId = new StaticTextItem("userId", "User ID");
    userName = new TextItem("userName", "User Name");
    password = new PasswordItem("password", "Password");
    enabled = new CheckboxItem("enabled", "Enabled");

    userName.setRequired(true);
    password.setRequired(true);

    ButtonItem saveButton = new ButtonItem("saveUser", "Update user info.");
    saveButton.setAlign(Alignment.CENTER);
    saveButton.setWidth(100);
    saveButton.setColSpan(4);
    saveButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            // editorForm.saveData();

            if (userId.getValue() == null) {
              return;
            }

            if (!editorForm.validate(false)) {
              return;
            }
            User user = new User();

            user.setUserId((String) userId.getValue());
            user.setUserName(userName.getValueAsString());
            user.setPassword(password.getValueAsString());
            user.setEnabled(enabled.getValueAsBoolean());

            userService.updateUser(
                user,
                new AsyncCallback<Void>() {
                  public void onFailure(Throwable caught) {
                    SC.say("Error", "Server side error occured. Contact your administrator.");
                  }

                  public void onSuccess(Void noAnswer) {
                    SC.say("Updated", "User info. is updated.");

                    userListGrid.invalidateCache();
                  }
                });
          }
        });

    editorForm.setFields(userId, userName, password, enabled, saveButton);
    editorForm.setColWidths(100, 200, 100, 200);

    // insert form
    insertForm = new DynamicForm();
    insertForm.setWidth(650);
    insertForm.setMargin(25);
    insertForm.setNumCols(4);
    insertForm.setCellPadding(5);
    insertForm.setAutoFocus(false);
    insertForm.setDataSource(userDS);
    insertForm.setUseAllDataSourceFields(true);

    userId4add = new TextItem("userId", "User ID");
    userName4add = new TextItem("userName", "User Name");
    password4add = new PasswordItem("password", "Password");
    enabled4add = new CheckboxItem("enabled", "Enabled");

    enabled4add.setValue(true);
    userId4add.setRequired(true);
    userName4add.setRequired(true);
    password4add.setRequired(true);

    ButtonItem addButton = new ButtonItem("addUser", "Add user info.");
    addButton.setAlign(Alignment.CENTER);
    addButton.setWidth(100);
    addButton.setColSpan(4);
    addButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {

            if (!insertForm.validate(false)) {
              return;
            }

            User user = new User();

            user.setUserId(userId4add.getValueAsString());
            user.setUserName(userName4add.getValueAsString());
            user.setPassword(password4add.getValueAsString());
            user.setEnabled(enabled4add.getValueAsBoolean());

            userService.addUser(
                user,
                new AsyncCallback<Void>() {
                  public void onFailure(Throwable caught) {
                    SC.say("Error", "Server side error occured. Contact your administrator.");
                  }

                  public void onSuccess(Void noAnswer) {
                    SC.say("Added", "User info. is added.");

                    userListGrid.invalidateCache();
                    insertForm.clearValues();
                  }
                });
          }
        });

    insertForm.setFields(userId4add, userName4add, password4add, enabled4add, addButton);
    insertForm.setColWidths(100, 200, 100, 200);

    // tab
    Tab viewTab = new Tab("View");
    viewTab.setIcon("silk/application_form.png");
    viewTab.setWidth(70);
    viewTab.setPane(userViewer);

    Tab editTab = new Tab("Edit");
    editTab.setIcon("demoApp/icon_edit.png");
    editTab.setWidth(70);
    editTab.setPane(editorForm);

    Tab insertTab = new Tab("Add");
    insertTab.setIcon("demoApp/icon_add.png");
    insertTab.setWidth(70);
    insertTab.setPane(insertForm);

    setTabs(viewTab, editTab, insertTab);

    addTabSelectedHandler(
        new TabSelectedHandler() {
          public void onTabSelected(TabSelectedEvent event) {
            updateDetails();
          }
        });
  }
コード例 #6
0
  public Layout getWindowLayout() {
    setWidth(500);
    setHeight(500);
    setTitle("Register");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setAutoCenter(true);
    setDismissOnOutsideClick(true);
    setShowShadow(true);
    setShadowOffset(0);
    setShadowSoftness(10);

    addCloseClickHandler(
        new CloseClickHandler() {
          public void onCloseClick(CloseClientEvent event) {
            destroy();
          }
        });

    Img profileImg =
        new Img(
            member.getProfilePic(),
            100,
            ImageUtil.getScaledImageHeight(member.getProfilePic(), 100));
    profileImg.setImageType(ImageStyle.STRETCH);

    HeaderItem header = new HeaderItem();
    header.setDefaultValue("Registration");
    emailItem.setValue(member.getEmail());
    emailItem.setRequired(true);
    firstNameItem.setValue(member.getFirstname());
    firstNameItem.setRequired(true);
    lastNameItem.setValue(member.getLastname());
    lastNameItem.setRequired(true);
    AWSSecretItem.setValue(member.getAWSSecretKey());
    AWSAccessItem.setValue(member.getAWSAccessKey());

    form.setFields(header, emailItem, firstNameItem, lastNameItem, AWSSecretItem, AWSAccessItem);
    form.setAutoFocus(true);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);
    buttons.setAlign(Alignment.CENTER);

    IButton cancelButton = new IButton("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            destroy();
            // com.google.gwt.user.client.Window.Location.assign(GWT.getHostPageBaseURL());
          }
        });
    saveButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            final LoginServiceAsync loginService = GWT.create(LoginService.class);
            loginService.memberExists(
                emailItem.getValueAsString(),
                new AsyncCallback<Boolean>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    SC.say("Could not check if member already exists.");
                  }

                  @Override
                  public void onSuccess(Boolean result) {
                    emailItem.setValidators(new MemberExistsValidator(result));
                    if (form.validate()) {
                      member.setEmail(emailItem.getValueAsString());
                      member.setFirstname(firstNameItem.getValueAsString());
                      member.setLastname(lastNameItem.getValueAsString());
                      member.setAWSSecretKey(AWSSecretItem.getValueAsString());
                      member.setAWSAccessKey(AWSAccessItem.getValueAsString());

                      loginService.registerMember(
                          member,
                          new AsyncCallback<Member>() {

                            @Override
                            public void onSuccess(Member result) {
                              if (member != null) {
                                destroy();
                                com.google.gwt.user.client.Window.Location.assign(
                                    GWT.getHostPageBaseURL());
                              } else SC.warn("Email address already in use!");
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                              if (caught instanceof MemberExistsException)
                                SC.warn("Email address already in use!");
                              else SC.warn("Something went wrong!");
                            }
                          });
                    }
                  }
                });
          }
        });

    buttons.addMember(saveButton);
    buttons.addMember(cancelButton);

    VLayout windowLayout = new VLayout();
    windowLayout.setMargin(10);
    windowLayout.setMembersMargin(15);
    windowLayout.addMember(profileImg);
    windowLayout.addMember(form);
    windowLayout.addMember(buttons);

    return windowLayout;
  }
コード例 #7
0
  private DynamicForm getConnectionForm() {
    connectionForm = new DynamicForm();
    connectionForm.setNumCols(4);
    connectionForm.setWrapItemTitles(false);
    connectionForm.setColWidths("130", "450", "110");
    connectionForm.setExtraSpace(15);
    connectionForm.setWidth(790);
    connectionForm.setPadding(5);
    connectionForm.setIsGroup(true);
    connectionForm.setGroupTitle(MSG.view_remoteAgentInstall_connInfo());
    final int textFieldWidth = 440;

    TextItem host = new TextItem("host", MSG.common_title_host());
    host.setRequired(true);
    host.setWidth(textFieldWidth);
    host.setPrompt(MSG.view_remoteAgentInstall_promptHost());
    host.setHoverWidth(300);
    host.setEndRow(true);
    host.addChangedHandler(
        new ChangedHandler() {
          @Override
          public void onChanged(ChangedEvent event) {
            hostAuthorized =
                false; // if the host changes, we need to make sure the user authorizes it if needed
          }
        });

    TextItem port = new TextItem("port", MSG.common_title_port());
    port.setRequired(false);
    port.setWidth(textFieldWidth);
    port.setPrompt(MSG.view_remoteAgentInstall_promptPort());
    port.setHoverWidth(300);
    port.setEndRow(true);
    IntegerRangeValidator portValidator = new IntegerRangeValidator();
    portValidator.setMin(1);
    portValidator.setMax(65535);
    port.setValidators(new IsIntegerValidator(), portValidator);

    TextItem username = new TextItem("username", MSG.common_title_user());
    username.setRequired(
        false); // if not specified, the server will attempt to use the default ssh user defined in
                // system settings
    username.setWidth(textFieldWidth);
    username.setPrompt(MSG.view_remoteAgentInstall_promptUser());
    username.setHoverWidth(300);
    username.setEndRow(true);

    PasswordItem password = new PasswordItem("password", MSG.common_title_password());
    password.setRequired(
        false); // if not specified, the server will attempt to use the default ssh pw defined in
                // system settings
    password.setWidth(textFieldWidth);
    password.setPrompt(MSG.view_remoteAgentInstall_promptPassword());
    password.setHoverWidth(300);
    password.setEndRow(true);
    password.setAttribute("autocomplete", "off");

    rememberMeCheckbox = new CheckboxItem("rememberme", MSG.view_remoteAgentInstall_rememberMe());
    rememberMeCheckbox.setRequired(false);
    rememberMeCheckbox.setPrompt(MSG.view_remoteAgentInstall_promptRememberMe());
    rememberMeCheckbox.setHoverWidth(300);
    rememberMeCheckbox.setColSpan(2);
    rememberMeCheckbox.setEndRow(true);

    agentInstallPath = new TextItem("agentInstallPath", MSG.view_remoteAgentInstall_installPath());
    agentInstallPath.setWidth(textFieldWidth);
    agentInstallPath.setPrompt(MSG.view_remoteAgentInstall_promptInstallPath());
    agentInstallPath.setHoverWidth(300);
    agentInstallPath.setStartRow(true);
    agentInstallPath.setEndRow(false);
    agentInstallPath.setValidators(
        absPathValidator); // we will "turn this on" when needed - this is to ensure we create paths
                           // properly and it doesn't go in places user isn't expecting

    findAgentInstallPathButton =
        new ButtonItem("findAgentInstallPathButton", MSG.view_remoteAgentInstall_buttonFindAgent());
    findAgentInstallPathButton.setStartRow(false);
    findAgentInstallPathButton.setEndRow(true);
    if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title
      findAgentInstallPathButton.setWidth(100);
    }
    findAgentInstallPathButton.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(
              com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
            // we only want to validate host
            if (connectionForm.getValueAsString("host") == null
                || connectionForm.getValueAsString("host").trim().isEmpty()) {
              final HashMap<String, String> errors = new HashMap<String, String>(1);
              errors.put("host", CoreGUI.getSmartGwtMessages().validator_requiredField());
              connectionForm.setErrors(errors, true);
              return;
            }

            new CheckSSHConnectionCallback() {
              @Override
              protected void doActualWork() {
                findAgentInstallPath();
              }
            }.execute();
          }
        });

    createAgentStatusTextItem();

    statusCheckButton = new ButtonItem("updateStatus", MSG.common_title_updateStatus());
    statusCheckButton.setStartRow(false);
    statusCheckButton.setEndRow(true);
    if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title
      statusCheckButton.setWidth(100);
    }
    statusCheckButton.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(
              com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
            if (connectionForm.validate()) {
              new CheckSSHConnectionCallback() {
                @Override
                protected void doActualWork() {
                  agentStatusCheck();
                }
              }.execute();
            }
          }
        });

    if (initialAgentInstall != null) {
      host.setValue(initialAgentInstall.getSshHost());
      if (initialAgentInstall.getSshPort() != null) {
        port.setValue(String.valueOf(initialAgentInstall.getSshPort()));
      }
      username.setValue(initialAgentInstall.getSshUsername());
      password.setValue(initialAgentInstall.getSshPassword());
      agentInstallPath.setValue(initialAgentInstall.getInstallLocation());
      // if it was already saved, assume they want it to stay remembered
      // however, because the uninstall page is getting rid of the agent, we don't need or want to
      // remember the credentials anymore
      if (!this.showUninstallButton) {
        rememberMeCheckbox.setValue(initialAgentInstall.getSshPassword() != null);
      }
    }

    // disable some form elements if we don't want the user changing them - they should have been
    // filled in by who ever created this view
    if (this.showUninstallButton || this.showStartButton || this.showStopButton) {
      host.setDisabled(true);
      port.setDisabled(true);
      agentInstallPath.setDisabled(true);
      findAgentInstallPathButton.setDisabled(true);
    }

    if (this.showUninstallButton) {
      // don't show rememberMe checkbox - we're getting rid of this agent so there won't be a record
      // to store the creds
      connectionForm.setFields(
          host,
          port,
          username,
          password,
          agentInstallPath,
          findAgentInstallPathButton,
          agentStatusText,
          statusCheckButton);
    } else {
      connectionForm.setFields(
          host,
          port,
          username,
          password,
          rememberMeCheckbox,
          agentInstallPath,
          findAgentInstallPathButton,
          agentStatusText,
          statusCheckButton);
    }

    return connectionForm;
  }
コード例 #8
0
ファイル: ProxyPanel.java プロジェクト: genievn/LD
  public ProxyPanel(GUIParameter[] parameters) {
    setWidth100();
    setMembersMargin(10);
    setMargin(30);
    setHeight(400);

    TabSet tabs = new TabSet();
    tabs.setWidth(380);
    tabs.setHeight(250);
    Tab tab = new Tab();
    tab.setTitle(I18N.message("proxy"));
    tabs.setTabs(tab);

    DynamicForm proxySettingsForm = new DynamicForm();
    proxySettingsForm.setWidth(300);
    proxySettingsForm.setColWidths(1, "*");
    proxySettingsForm.setValuesManager(vm);
    proxySettingsForm.setTitleOrientation(TitleOrientation.LEFT);

    List<FormItem> items = new ArrayList<FormItem>();

    for (GUIParameter f : parameters) {
      if (f.getName().equals("password")) {
        PasswordItem item = ItemFactory.newPasswordItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else if (f.getName().equals("port")) {
        IntegerItem item =
            ItemFactory.newValidateIntegerItem(
                f.getName(), f.getName(), Integer.parseInt(f.getValue()), 1, null);
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else {
        TextItem item = ItemFactory.newTextItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      }
    }

    proxySettingsForm.setItems(items.toArray(new FormItem[0]));

    IButton save = new IButton();
    save.setTitle(I18N.message("save"));
    save.addClickHandler(
        new ClickHandler() {
          @SuppressWarnings("unchecked")
          public void onClick(ClickEvent event) {
            Map<String, Object> values = (Map<String, Object>) vm.getValues();

            if (vm.validate()) {
              List<GUIParameter> proxySettings = new ArrayList<GUIParameter>();
              for (String name : values.keySet()) {
                GUIParameter proxyParam = new GUIParameter(name, values.get(name).toString());
                proxySettings.add(proxyParam);
              }

              service.saveProxySettings(
                  Session.get().getSid(),
                  proxySettings.toArray(new GUIParameter[0]),
                  new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                      Log.serverError(caught);
                    }

                    @Override
                    public void onSuccess(Void result) {
                      Log.info(I18N.message("settingssaved"), null);
                    }
                  });
            }
          }
        });

    tab.setPane(proxySettingsForm);
    setMembers(tabs, save);
  }