Ejemplo n.º 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;
  }
Ejemplo n.º 2
0
  private RemoteAccessInfo getRemoteAccessInfo() {
    String host = connectionForm.getValueAsString("host");
    String port = connectionForm.getValueAsString("port");
    String username = connectionForm.getValueAsString("username");
    String password = connectionForm.getValueAsString("password");

    int portInt;
    try {
      portInt = Integer.parseInt(port);
    } catch (NumberFormatException e) {
      portInt = 22;
    }
    connectionForm.setValue("port", portInt);

    RemoteAccessInfo info = new RemoteAccessInfo(host, portInt, username, password);

    if (this.initialAgentInstall != null) {
      info.setAgentName(this.initialAgentInstall.getAgentName());
    }

    boolean rememberme = Boolean.parseBoolean(connectionForm.getValueAsString("rememberme"));
    info.setRememberMe(rememberme);

    info.setHostAuthorized(hostAuthorized);

    return info;
  }
Ejemplo n.º 3
0
  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  private void userConnect() {
    //		Window.alert("Authorization.userConnect : login = "******", " +
    //                                                              (String)
    // accountForm.getValue(CONTROL_PASSWORD));
    //		System.out.println ("Authorization.userConnect - " + (String)
    // accountForm.getValue(CONTROL_LOGIN   ) + ", " +
    //                                                             (String)
    // accountForm.getValue(CONTROL_PASSWORD));
    GWTViewer.MapServiceInfoServlet.userConnect(
        (String) accountForm.getValue(CONTROL_LOGIN),
        (String) accountForm.getValue(CONTROL_PASSWORD),
        new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String content) {
            //				System.out.println ("Authorization.userConnect - AsyncCallback.onSuccess : content
            // = " + content);
            //				Window.alert("Authorization.userConnect - AsyncCallback.onSuccess : content = " +
            // content + " => EastLine");
            if (content == null) labelException.setContents(ERROR_USER_NOT_FOUND);
            else
              //				{
              callback.onSuccess(content);
            //					closeForm();
            //				}
          }
        });
  }
  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());
                  }
                });
          }
        });
  }
Ejemplo n.º 5
0
  @Inject
  public LoginPageView() {

    window = new Window();
    window.setHeaderIcon(AppImages.SAVARA_ICON);
    window.setTitle("console");
    window.setWidth(300);
    window.setHeight(150);
    window.setIsModal(true);
    window.setShowMinimizeButton(false);
    window.setShowCloseButton(false);
    window.centerInPage();

    DynamicForm form = new DynamicForm();
    form.setWidth(250);

    usernameItem = new TextItem();
    usernameItem.setTitle("username");

    passwordItem = new PasswordItem();
    passwordItem.setTitle("password");

    HLayout buttonLayout = new HLayout();
    IButton loginBtn = new IButton("Login");
    loginBtn.setWidth(60);
    loginBtn.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent clickEvent) {
            String name = usernameItem.getValueAsString();
            String password = passwordItem.getValueAsString();
            presenter.login(name, password);
          }
        });
    buttonLayout.addMember(loginBtn);
    buttonLayout.setAlign(Alignment.CENTER);

    form.setFields(new FormItem[] {usernameItem, passwordItem});
    form.setPadding(10);

    window.addItem(form);
    window.addItem(buttonLayout);

    HLayout versionLayout = new HLayout();
    Label versionNo = new Label(Build.VERSION);

    versionLayout.addMember(versionNo);
    versionLayout.setAlign(Alignment.RIGHT);

    window.addItem(versionLayout);
  }
Ejemplo n.º 6
0
 @SuppressWarnings("unchecked")
 boolean validate() {
   Map<String, Object> values = (Map<String, Object>) form.getValues();
   form.validate();
   if (!form.hasErrors()) {
     account.setIncludes((String) values.get("include"));
     account.setExcludes((String) values.get("exclude"));
     account.setDeleteFromMailbox(new Boolean(values.get("delete").toString()));
     account.setMailFolder((String) values.get("mailfolder"));
     account.setFormat(Integer.parseInt((String) values.get("format")));
     account.setStartDate((Date) values.get("startdate"));
   }
   return !form.hasErrors();
 }
Ejemplo n.º 7
0
  /**
   * This is a static utility method that is package protected so the message center view and the
   * message bar can pop up a dialog showing a message's details.
   *
   * @param message the message whose details are to be shown
   */
  static void showDetails(Message message) {
    if (message == null) {
      return;
    }

    DynamicForm form = new LocatableDynamicForm("MessageCenterDetailsForm");
    form.setWrapItemTitles(false);
    form.setAlign(Alignment.LEFT);

    StaticTextItem title = new StaticTextItem("theMessage", MSG.common_title_message());
    title.setValue(message.conciseMessage);

    StaticTextItem severity =
        new StaticTextItem("severity", MSG.view_messageCenter_messageSeverity());
    FormItemIcon severityIcon = new FormItemIcon();
    severityIcon.setSrc(getSeverityIcon(message.severity));
    severity.setIcons(severityIcon);
    severity.setValue(message.severity.name());

    StaticTextItem date = new StaticTextItem("time", MSG.view_messageCenter_messageTime());
    date.setValue(
        TimestampCellFormatter.format(message.fired, TimestampCellFormatter.DATE_TIME_FORMAT_FULL));

    StaticTextItem detail = new StaticTextItem("detail", MSG.view_messageCenter_messageDetail());
    detail.setTitleVAlign(VerticalAlignment.TOP);
    detail.setValue(message.detailedMessage);

    form.setItems(title, severity, date, detail);

    final Window dialogWin = new LocatableWindow("MessageCenterDetailsWindow");
    dialogWin.setTitle(MSG.common_title_message());
    dialogWin.setWidth(600);
    dialogWin.setHeight(400);
    dialogWin.setIsModal(true);
    dialogWin.setShowModalMask(true);
    dialogWin.setCanDragResize(true);
    dialogWin.setShowMaximizeButton(true);
    dialogWin.setShowMinimizeButton(false);
    dialogWin.centerInPage();
    dialogWin.addItem(form);
    dialogWin.show();
    dialogWin.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClientEvent event) {
            dialogWin.destroy();
          }
        });
  }
Ejemplo n.º 8
0
 @Override
 protected void updateLayerEnabled(boolean enabled) {
   super.updateLayerEnabled(enabled);
   form.setDisabled(!enabled);
   dateForm1.setDisabled(!enabled);
   dateForm2.setDisabled(!enabled);
 }
Ejemplo n.º 9
0
  private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) {
    result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result;
    addrComp = new AddressComponent(true, true, result.get("" + ClSelection.T_REGION));
    setSelectItems(siCustomerType, result.get("" + ClSelection.T_CUST_TYPE));

    addrComp.getSiRegion().setTitle("Region");
    addrComp.getSiSubregion().setTitle("Sub Region");
    addrComp.getSiCity().setTitle("City");
    addrComp.getSiStreet().setTitle("Street");
    biSaveData.setStartRow(false);
    biSaveData.setEndRow(false);
    FormItem[] items =
        new FormItem[] {
          addrComp.getSiRegion(),
          addrComp.getSiSubregion(),
          addrComp.getSiCity(),
          addrComp.getSiStreet(),
          siZones,
          siCustomerType,
          tiNewZone,
          biSaveData
        };
    dmCriteria.setFields(items);

    ChangedHandler addressChange =
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {

            if (event.getItem().equals(addrComp.getSiRegion())
                || event.getItem().equals(addrComp.getSiSubregion())) {
              setZoneValue();
            }

            creteriaChanged();
          }
        };

    addrComp.getSiRegion().addChangedHandler(addressChange);
    addrComp.getSiSubregion().addChangedHandler(addressChange);
    addrComp.getSiCity().addChangedHandler(addressChange);
    addrComp.getSiStreet().addChangedHandler(addressChange);

    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    setZoneValue();

    biSaveData.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {

          @Override
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            saveData();
          }
        });
  }
Ejemplo n.º 10
0
  /** Prepares the language form */
  private Tab setupLanguage(final ValuesManager vm) {
    Tab languageTab = new Tab();
    languageTab.setTitle(I18N.message(LANGUAGE));

    SelectItem languageItem = ItemFactory.newLanguageSelector(LANGUAGE, false, true);
    languageItem.setTitle(I18N.message("defaultlang"));
    languageItem.setRequired(true);
    languageItem.setValue(I18N.getLocale());

    final DynamicForm languageForm = new DynamicForm();
    languageForm.setID("languageForm");
    languageForm.setValuesManager(vm);
    languageForm.setFields(languageItem);
    languageForm.setDisabled(true);
    languageTab.setPane(languageForm);
    return languageTab;
  }
 public void reset() {
   geometries.clear();
   frmBuffer.reset();
   btnUndo.setDisabled(true);
   btnRedo.setDisabled(true);
   if (isDrawing()) {
     removeFreeDrawingController();
   }
 }
Ejemplo n.º 12
0
  /** 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;
  }
Ejemplo n.º 13
0
  /** Prepares the SMTP form */
  private Tab setupSmtp(final ValuesManager vm) {
    // Prepare the SMTP connection tab
    Tab smtpTab = new Tab();
    smtpTab.setTitle(I18N.message("smtpserver"));
    final DynamicForm smtpForm = new DynamicForm();
    smtpForm.setDisabled(true);
    smtpForm.setID("smtpForm");
    smtpForm.setTitleOrientation(TitleOrientation.TOP);
    smtpForm.setValuesManager(vm);
    smtpTab.setPane(smtpForm);

    TextItem smtpHost = ItemFactory.newTextItem(SMTP_HOST, "host", null);
    smtpHost.setValue("localhost");
    smtpHost.setWrapTitle(false);

    IntegerItem smtpPort = ItemFactory.newIntegerItem(SMTP_PORT, "port", null);
    smtpPort.setValue(25);
    smtpPort.setWrapTitle(false);

    TextItem smtpUsername = ItemFactory.newTextItem(SMTP_USERNAME, "username", null);
    smtpUsername.setWrapTitle(false);

    PasswordItem smtpPassword = new PasswordItem();
    smtpPassword.setTitle(I18N.message("password"));
    smtpPassword.setName(SMTP_PASSWORD);
    smtpPassword.setWrapTitle(false);

    BooleanItem smtpSecureAuth = new BooleanItem();
    smtpSecureAuth.setTitle(I18N.message("secureauth"));
    smtpSecureAuth.setName(SMTP_SECURE_AUTH);
    smtpSecureAuth.setWrapTitle(false);
    smtpSecureAuth.setDefaultValue(false);

    SelectItem smtpConnectionSecurity = new SelectItem();
    smtpConnectionSecurity.setTitle(I18N.message("connectionsecurity"));
    smtpConnectionSecurity.setName("smtpConnectionSecurity");
    smtpConnectionSecurity.setDefaultValue(Constants.SMTP_SECURITY_NONE);
    smtpConnectionSecurity.setWrapTitle(false);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put(Constants.SMTP_SECURITY_NONE, I18N.message("none"));
    valueMap.put(Constants.SMTP_SECURITY_SSL, I18N.message("ssl"));
    valueMap.put(Constants.SMTP_SECURITY_TLS, I18N.message("tls"));
    valueMap.put(Constants.SMTP_SECURITY_TLS_IF_AVAILABLE, I18N.message("tlsavailable"));
    smtpConnectionSecurity.setValueMap(valueMap);

    TextItem smtpSender = ItemFactory.newEmailItem(SMTP_SENDER, "sender", false);
    smtpSender.setWrapTitle(false);
    smtpSender.setValue("*****@*****.**");

    smtpForm.setFields(
        smtpHost,
        smtpPort,
        smtpUsername,
        smtpPassword,
        smtpSender,
        smtpConnectionSecurity,
        smtpSecureAuth);
    return smtpTab;
  }
Ejemplo n.º 14
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;
  }
  public Canvas getViewPanel() {
    final DynamicForm form = new DynamicForm();
    form.setDataSource(DataSource.get("validationDMI_orderForm"));

    HeaderItem header = new HeaderItem("header");
    header.setDefaultValue("Add an item to your Order");

    ComboBoxItem item = new ComboBoxItem("itemId", "Item");
    item.setOptionDataSource(DataSource.get("StockItem"));
    item.setValueField("id");
    item.setDisplayField("description");

    IntegerItem quantity = new IntegerItem("quantity");
    quantity.setValidateOnExit(true);

    TextAreaItem instructions = new TextAreaItem("instructions");

    ButtonItem submit = new ButtonItem("submit", "Submit Order");

    form.setFields(header, item, quantity, instructions, submit);

    return form;
  }
Ejemplo n.º 16
0
  public EventViewerWindow() {
    super();

    setTitle(AppMessages.EVENT_VIEWER_LABEL);
    setShortcutIcon(AppImages.EVENT_DETAIL_SHORTCUT);
    setHeaderIcon(AppImages.EVENT_DETAIL_ICON);

    stack = new SectionStack();
    stack.setVisibilityMode(VisibilityMode.MULTIPLE);

    SectionStackSection findSection = new SectionStackSection("Find");
    findSection.setExpanded(true);

    final DynamicForm form = new SearchForm();
    form.setNumCols(7);
    form.setHeight(35);
    form.setTop(15);
    form.setCellPadding(10);

    TextItem actIdItem = new TextItem();
    actIdItem.setTitle("Activity ID");
    TextItem contextItem = new TextItem();
    contextItem.setTitle("Context");
    ButtonItem findBtn = new ButtonItem("Search");
    findBtn.setStartRow(false);
    findBtn.setIcon(AppImages.SEARCH_ICON);
    findBtn.setWidth("125px");

    form.setFields(actIdItem, contextItem, findBtn);
    findSection.addItem(form);

    SectionStackSection resultSection = new SectionStackSection("Activities");
    resultSection.setExpanded(true);

    grid = new ListGrid();
    grid.setShowAllRecords(true);
    grid.setHeight(300);

    ListGridField actId = new ListGridField("activityId", "ID", 40);
    ListGridField actDate = new ListGridField("activityDate", "Date", 150);
    ListGridField actCtx = new ListGridField("activityContext", "Context", 220);
    ListGridField actDesc = new ListGridField("activityDescription", "Description");

    grid.setFields(actId, actCtx, actDesc, actDate);
    grid.setData(getData());

    resultSection.addItem(grid);

    SectionStackSection detailSection = new SectionStackSection("Activity Detail");
    detailSection.setExpanded(true);

    stack.addSection(findSection);
    stack.addSection(resultSection);
    stack.addSection(detailSection);

    this.addItem(stack);
  }
Ejemplo n.º 17
0
  /** Prepares the registration form */
  private Tab setupRegistration(final ValuesManager vm) {
    Tab registrationTab = new Tab();
    registrationTab.setTitle(I18N.message("registration"));

    TextItem regName = ItemFactory.newTextItem(REG_NAME, "name", null);
    regName.setWrapTitle(false);

    TextItem regOrganization = ItemFactory.newTextItem(REG_ORGANIZATION, "organization", null);
    regOrganization.setWrapTitle(false);

    TextItem regWebsite = ItemFactory.newTextItem(REG_WEBSITE, "website", null);
    regWebsite.setWrapTitle(false);

    TextItem regEmail = ItemFactory.newEmailItem(REG_EMAIL, "email", false);
    regEmail.setWrapTitle(false);

    final DynamicForm regForm = new DynamicForm();
    regForm.setID("regForm");
    regForm.setValuesManager(vm);
    regForm.setFields(regName, regEmail, regOrganization, regWebsite);

    registrationTab.setPane(regForm);
    return registrationTab;
  }
Ejemplo n.º 18
0
  private void onSavePressed(DuengungRecord record, DynamicForm form, boolean addNewRecord) {
    // update the internal DTO values with the values stored in the form
    record.updateDTO(form.getValues());

    if (addNewRecord) {
      // save data and add to table
      this.dataManager.save(record, this.grid);
    } else {
      // save data and update table
      this.dataManager.update(record, this.grid);
    }

    // redraw the grid
    this.grid.redraw();
  }
Ejemplo n.º 19
0
  // 从豆瓣获取图书信息
  protected void fetchDataFromDouban() {

    theBook.setBookISBN(bookForm1.getValueAsString("bookISBN"));
    if (!FieldVerifier.isNotEmptyValid(theBook.getBookISBN())) {
      SC.say("请先输入书籍ISBN!");
      return;
    }

    new RPCCall<SLBook>() {
      @Override
      public void onFailure(Throwable caught) {
        SC.say("通信失败,请检查您的网络连接!");
      }

      @Override
      public void onSuccess(SLBook result) {
        if (result == null) {
          SC.say("无此ISBN编号的书籍信息,请检查输入是否正确!");
          return;
        }
        theBook = result;

        bookForm1.setValue("bookName", theBook.getBookName());
        bookForm1.setValue("bookAuthor", theBook.getBookAuthor());
        bookForm1.setValue("bookISBN", theBook.getBookISBN());
        bookForm1.setValue("bookPublisher", theBook.getBookPublisher());

        bookForm1.setValue("bookPublishDate", theBook.getBookPublishDate());
        bookForm1.setValue("bookClass", theBook.getBookClass());
        bookForm1.setValue("bookLanguage", theBook.getBookLanguage());
        bookForm1.setValue("bookPrice", theBook.getBookPrice());
        bookForm1.setValue("bookContributor", theBook.getBookContributor());

        bookForm2.setValue("bookTotalQuantity", "1");
        bookForm2.setValue("bookInStoreQuantity", "1");
        bookForm2.setValue("bookAvailableQuantity", "1");

        bookForm3.setValue("bookIntro", SLBook.toWords(theBook.getBookIntro()));

        doAfterFinishUpload(theBook.getBookPicUrl());
      }

      @Override
      protected void callService(AsyncCallback<SLBook> cb) {
        bookService.getBookByDoubanAPI(theBook.getBookISBN(), cb);
      }
    }.retry(3);
  }
  public void updateDetails() {
    Record selectedRecord = userListGrid.getSelectedRecord();

    if (selectedRecord == null) {
      return;
    }

    int selectedTab = getSelectedTabNumber();
    if (selectedTab == 0) {
      // view tab : show empty message
      userViewer.setData(new Record[] {selectedRecord});
    } else if (selectedTab == 1) {
      // edit tab : show record editor
      editorForm.editRecord(selectedRecord);
    } else {
      // insertForm.clearValues();
    }
  }
Ejemplo n.º 21
0
 /**
  * Collect the changed fields on the form for sending to the backend for storage.
  *
  * @param fields
  * @return
  */
 @SuppressWarnings("unchecked")
 private LinkedHashMap<String, UIFormFieldValue> getChanges(
     DynamicForm form, LinkedList<String> fields) {
   LinkedHashMap<String, UIFormFieldValue> res = new LinkedHashMap<String, UIFormFieldValue>();
   LinkedHashMap<String, Object> formValues = (LinkedHashMap<String, Object>) form.getValues();
   for (String field : fields) {
     UIFormFieldValue oldFormField = dataMap.get(field);
     Object oldValue = oldFormField.getValue();
     Object newValue = formValues.get(field);
     if (newValue == null) {
       if (oldValue != null) res.put(field, null);
     } else if (!newValue.equals(oldValue)) {
       UIFormFieldValue newTO = new UIFormFieldValue();
       newTO.setValue(newValue); // , oldFormField.getType());
       res.put(field, newTO);
     }
   }
   return res;
 }
  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;
  }
Ejemplo n.º 23
0
  public Canvas getViewPanel() {

    final TabSet tabSet = new TabSet();
    tabSet.setTabBarPosition(Side.TOP);

    // required so that the select item doesnt touch the tab pane
    tabSet.setTabBarThickness(25);
    tabSet.setTabBarAlign(Side.LEFT);
    tabSet.setWidth(400);
    tabSet.setHeight(200);

    final Tab statusTab = new Tab("Status");

    final Canvas statusPane = new Canvas();
    statusTab.setPane(statusPane);
    tabSet.addTab(statusTab);

    SelectItem selectItem = new SelectItem();
    selectItem.setValueMap("Development", "Staging", "Production");
    selectItem.setShowTitle(false);

    selectItem.setDefaultValue("Development");
    selectItem.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            statusPane.setContents(
                event.getValue()
                    + ": <span style='color:green;font-weight:bold'>Normal</span><br>");
          }
        });

    DynamicForm form = new DynamicForm();
    // form.setHeight(1);
    form.setPadding(0);
    form.setMargin(0);
    form.setCellPadding(1);
    form.setNumCols(1);
    form.setFields(selectItem);

    tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form);
    return tabSet;
  }
  private Tab xpathSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchXpathTab = new Tab();
    searchXpathTab.setTitle("Xpath Search");
    final DynamicForm searchXpathForm = new DynamicForm();
    searchXpathForm.setID("searchXpathForm");
    searchXpathForm.setNumCols(3);
    searchXpathTxt.setName("searchXpathTxt");
    searchXpathTxt.setTitle("Xpath Search");
    searchXpathTxt.setWidth(250);
    searchXpathTxt.setRequired(true);
    SubmitItem searchXpathSubmitItem = new SubmitItem("searchXpathSubmitItem");
    searchXpathSubmitItem.setTitle("Search");
    searchXpathSubmitItem.setWidth(100);
    class SearchXpathSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

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

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchXpathForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.xpathSearch(
              searchXpathTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchXpathForm.addSubmitValuesHandler(new SearchXpathSubmitValuesHandler(jackrabbitExplorer));
    searchXpathForm.setSaveOnEnter(true);
    searchXpathTxt.setStartRow(true);
    searchXpathTxt.setEndRow(false);
    searchXpathSubmitItem.setStartRow(false);
    searchXpathSubmitItem.setEndRow(true);
    searchXpathForm.setItems(searchXpathTxt, searchXpathSubmitItem);
    searchXpathTab.setPane(searchXpathForm);
    return searchXpathTab;
  }
  public Canvas getSearchCanvas() {
    final VLayout mainLayout = new VLayout(20);
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.setPadding(5);

    Label titleBar = new Label(MESSAGES.geometricSearchWidgetFreeDrawingSearchTitle());
    titleBar.setBackgroundColor("#E0E9FF");
    titleBar.setWidth100();
    titleBar.setHeight(20);
    titleBar.setPadding(5);

    HLayout geomsButtonBar = new HLayout();
    geomsButtonBar.setWidth100();
    geomsButtonBar.setAutoHeight();
    geomsButtonBar.setMembersMargin(10);
    HLayout actionsButtonBar = new HLayout();
    actionsButtonBar.setWidth100();
    actionsButtonBar.setAutoHeight();
    actionsButtonBar.setMembersMargin(10);

    btnPoint = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPoint());
    btnPoint.setIcon(WidgetLayout.iconPointCreate);
    btnPoint.setWidth(
        btnPoint.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPoint.setActionType(SelectionType.RADIO);
    btnPoint.setRadioGroup("drawType");
    btnPoint.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPoint();
          }
        });

    btnLine = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingLine());
    btnLine.setIcon(WidgetLayout.iconLineCreate);
    btnLine.setWidth(
        btnLine.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnLine.setActionType(SelectionType.RADIO);
    btnLine.setRadioGroup("drawType");
    btnLine.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawLine();
          }
        });

    btnPolygon = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPolygon());
    btnPolygon.setIcon(WidgetLayout.iconPolygonCreate);
    btnPolygon.setWidth(
        btnPolygon.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPolygon.setActionType(SelectionType.RADIO);
    btnPolygon.setRadioGroup("drawType");
    btnPolygon.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPolygon();
          }
        });

    btnUndo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingUndo());
    btnUndo.setIcon(WidgetLayout.iconUndo);
    btnUndo.setWidth(
        btnUndo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnUndo.setDisabled(true);
    btnUndo.setShowDisabledIcon(false);
    btnUndo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onUndo();
          }
        });

    btnRedo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingRedo());
    btnRedo.setIcon(WidgetLayout.iconRedo);
    btnRedo.setWidth(
        btnRedo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnRedo.setDisabled(true);
    btnRedo.setShowDisabledIcon(false);
    btnRedo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onRedo();
          }
        });

    frmBuffer = new DynamicForm();
    frmBuffer.setWidth100();
    spiBuffer = new SpinnerItem();
    spiBuffer.setTitle(MESSAGES.geometricSearchWidgetBufferLabel());
    spiBuffer.setDefaultValue(5);
    spiBuffer.setMin(0);
    spiBuffer.setWidth(60);
    spiBuffer.addChangedHandler(
        new ChangedHandler() {
          public void onChanged(ChangedEvent event) {
            updateView();
          }
        });
    frmBuffer.setFields(spiBuffer);

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

    geomsButtonBar.addMember(btnPoint);
    geomsButtonBar.addMember(btnLine);
    geomsButtonBar.addMember(btnPolygon);

    actionsButtonBar.addMember(btnUndo);
    actionsButtonBar.addMember(btnRedo);

    mainLayout.addMember(titleBar);
    mainLayout.addMember(geomsButtonBar);
    mainLayout.addMember(actionsButtonBar);
    mainLayout.addMember(frmBuffer);

    return mainLayout;
  }
  /** Instantiates a new digital object menu view. */
  @Inject
  public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    this.eventBus = eventBus;

    layout = new VLayout();

    layout.setHeight100();
    layout.setWidth100();
    layout.setOverflow(Overflow.AUTO);

    relatedGrid = new ListGrid();
    relatedGrid.setWidth100();
    relatedGrid.setHeight100();
    relatedGrid.setShowSortArrow(SortArrow.CORNER);
    relatedGrid.setShowAllRecords(true);
    relatedGrid.setAutoFetchData(false);
    relatedGrid.setCanHover(true);
    relatedGrid.setCanSort(false);
    ListGridField field1 = new ListGridField("relation", lang.relation());
    field1.setWidth("40%");
    ListGridField field2 = new ListGridField("uuid", "PID");
    field2.setWidth("*");
    relatedGrid.setFields(field1, field2);
    sectionRelated = new SectionStackSection();
    sectionRelated.setID(SECTION_RELATED_ID);
    sectionRelated.setTitle(lang.referencedBy());
    sectionRelated.setResizeable(true);
    sectionRelated.setItems(relatedGrid);
    sectionRelated.setExpanded(false);

    sideNavGrid =
        new ListGrid() {

          @Override
          protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
            final ListGridRecord rollOverRecord = this.getRecord(rowNum);
            if (rollOverCanvas == null) {
              rollOverCanvas = new HLayout();
              rollOverCanvas.setSnapTo("TR");
              rollOverCanvas.setWidth(50);
              rollOverCanvas.setHeight(22);
            }

            if (rollOverCanvas.getChildren().length > 0) {
              rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]);
            }
            final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER);
            if (lockOwner != null) {
              ImgButton lockImg = new ImgButton();
              lockImg.setShowDown(false);
              lockImg.setShowRollOver(false);
              lockImg.setLayoutAlign(Alignment.CENTER);

              if ("".equals(lockOwner)) {
                lockImg.setSrc("icons/16/lock_lock_all.png");
              } else if (lockOwner.length() > 0) {
                lockImg.setSrc("icons/16/lock_lock_all_red.png");
              }

              lockImg.setPrompt(lang.lockInfoButton());
              lockImg.setHeight(16);
              lockImg.setWidth(16);
              lockImg.addClickHandler(
                  new com.smartgwt.client.widgets.events.ClickHandler() {

                    @Override
                    public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                      EditorSC.objectIsLock(
                          lang,
                          new LockInfo(
                              lockOwner,
                              rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION),
                              rollOverRecord.getAttributeAsStringArray(
                                  Constants.ATTR_TIME_TO_EXP_LOCK)));
                    }
                  });
              rollOverCanvas.addChild(lockImg);
            }
            return rollOverCanvas;
          }
        };
    sideNavGrid.setShowSelectionCanvas(false);

    sideNavGrid.setWidth100();
    sideNavGrid.setHeight100();
    sideNavGrid.setShowSortArrow(SortArrow.CORNER);
    sideNavGrid.setShowAllRecords(true);
    sideNavGrid.setAutoFetchData(true);
    sideNavGrid.setCanHover(true);
    sideNavGrid.setHoverOpacity(75);
    sideNavGrid.setHoverStyle("interactImageHover");
    sideNavGrid.setShowRollOverCanvas(true);

    final DynamicForm form = new DynamicForm();
    form.setHeight(1);
    form.setWidth(60);
    form.setNumCols(1);

    selectItem.setWidth(60);
    selectItem.setShowTitle(false);
    selectItem.setValueMap(lang.me(), lang.all());
    selectItem.setDefaultValue(lang.me());
    selectItem.setHoverOpacity(75);
    selectItem.setHoverStyle("interactImageHover");
    selectItem.addItemHoverHandler(
        new ItemHoverHandler() {

          @Override
          public void onItemHover(ItemHoverEvent event) {
            selectItem.setPrompt(
                DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue());
          }
        });
    selectItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            getUiHandlers().refreshRecentlyModified();
          }
        });

    form.setFields(selectItem);
    form.setTitle("by:");

    sectionRecentlyModified = new SectionStackSection();
    sectionRecentlyModified.setTitle(lang.recentlyModified());
    sectionRecentlyModified.setResizeable(true);
    sectionRecentlyModified.setItems(sideNavGrid);
    sectionRecentlyModified.setControls(form);
    sectionRecentlyModified.setExpanded(true);

    sectionStack = new SectionStack();
    sectionStack.addSection(sectionRelated);
    sectionStack.addSection(sectionRecentlyModified);
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setAnimateSections(true);
    sectionStack.setWidth100();
    sectionStack.setHeight100();
    sectionStack.setOverflow(Overflow.HIDDEN);
    layout.addMember(sectionStack);
  }
  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();
          }
        });
  }
Ejemplo n.º 28
0
 @Override
 protected DynamicForm getSkinControlComponent() {
   DynamicForm toReturn = super.getSkinControlComponent();
   toReturn.setVisible(true);
   return toReturn;
 }
Ejemplo n.º 29
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;
  }
Ejemplo n.º 30
0
    public FieldsDialog() {

      super();
      setIsModal(true);
      setShowHeader(false);
      setShowEdges(true);
      setEdgeSize(2);
      setWidth(DIALOG_WIDTH);
      setHeight(DIALOG_HEIGHT);
      setAlign(Alignment.LEFT);

      Map<String, Integer> bodyDefaults = new HashMap<String, Integer>();
      bodyDefaults.put("layoutLeftMargin", 2);
      bodyDefaults.put("layoutTopMargin", 20);
      bodyDefaults.put("layoutButtonMargin", 2);
      setBodyDefaults(bodyDefaults);

      VLayout layout = new VLayout();
      layout.setOverflow(Overflow.HIDDEN);
      layout.setHeight100();
      layout.setWidth100();

      DynamicForm fieldForm = new DynamicForm();
      fieldForm.setTitleWidth(5);
      fieldForm.setAutoHeight();

      this.checkBoxFrom =
          new CheckboxItem(
              MessageListFields.FROM.name(), TextProvider.get().extended_search_panel_from());
      this.checkBoxTo =
          new CheckboxItem(
              MessageListFields.TO.name(), TextProvider.get().extended_search_panel_to());
      this.checkBoxCc =
          new CheckboxItem(
              MessageListFields.CC.name(), TextProvider.get().extended_search_panel_cc());
      this.checkBoxSubject =
          new CheckboxItem(
              MessageListFields.SUBJECT.name(), TextProvider.get().extended_search_panel_subject());
      this.checkBoxContent =
          new CheckboxItem(
              MessageListFields.CONTENT.name(), TextProvider.get().extended_search_panel_body());

      final IButton searchButton = new IButton(TextProvider.get().extended_search_panel_search());
      searchButton.setAutoFit(true);
      searchButton.setAlign(Alignment.CENTER);
      searchButton.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {

              searchFields = getFields();
              hide();
              fireSearchEvent();
            }
          });

      fieldForm.setItems(
          this.checkBoxFrom,
          this.checkBoxTo,
          this.checkBoxCc,
          this.checkBoxSubject,
          this.checkBoxContent);

      layout.setMembers(fieldForm, searchButton);
      setMembers(layout);

      addMouseOutHandler(
          new MouseOutHandler() {

            public void onMouseOut(MouseOutEvent event) {

              FieldsDialog dialog = (FieldsDialog) event.getSource();

              // Workaround because the mouse out handler doesn't work
              // correctly
              if ((event.getX() < dialog.getAbsoluteLeft()
                      || event.getX() > (dialog.getAbsoluteLeft() + dialog.getWidth() - 5))
                  || (event.getY() < dialog.getAbsoluteTop()
                      || event.getY() > (dialog.getAbsoluteTop() + dialog.getHeight() - 10))) {
                hide();
              }
            }
          });
    }