Package com.smartgwt.client.widgets.form.fields

Examples of com.smartgwt.client.widgets.form.fields.TextItem


      group.setIsGroup(true);
      group.setWidth100();
      group.setGroupTitle(messages.favouritesControllerAddGroupTitle());

      final DynamicForm form = new DynamicForm();
      final TextItem nameItem = new TextItem();
      nameItem.setWidth(190);
      nameItem.setTitle(messages.favouritesControllerAddName());
      nameItem.setTooltip(messages.favouritesControllerAddNameTooltip());
      nameItem.setRequired(true);
      final CheckboxItem sharedItem = new CheckboxItem();
      sharedItem.setTitle(messages.favouritesControllerAddShared());
      sharedItem.setTooltip(messages.favouritesControllerAddSharedTooltip());
      final TextItem lastEditItem = new TextItem();
      lastEditItem.setWidth(190);
      lastEditItem.setDisabled(true);
      lastEditItem.setTitle(messages.searchFavouritesListWidgetLastChangeBy());
      final DateItem lastEditDateItem = new DateItem();
      lastEditDateItem.setDisabled(true);
      lastEditDateItem.setUseTextField(true);
      lastEditDateItem.setTitle(messages.searchFavouritesListWidgetLastChange());
      form.setFields(nameItem, sharedItem, lastEditItem, lastEditDateItem);

      HLayout buttonlayout = new HLayout(10);
      buttonlayout.setHeight(20);
      buttonlayout.setWidth100();
      HLayout frmButtonlayout = new HLayout(10);
      frmButtonlayout.setHeight(20);
      frmButtonlayout.setWidth100();

      final IButton saveButton = new IButton(messages.searchFavouritesListWidgetSave());
      saveButton.setIcon(BTN_SAVE_IMG);
      saveButton.setAutoFit(true);
      saveButton.setShowDisabledIcon(false);
      saveButton.setDisabled(true);
      saveButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          SearchFavourite oldFav = flr.getFavourite();
          SearchFavourite newFav = (SearchFavourite) oldFav.clone();
          newFav.setName(nameItem.getValueAsString());
          newFav.setShared(sharedItem.getValueAsBoolean());
          flr.setFavourite(newFav);
          SearchWidgetRegistry.getFavouritesController().onChangeRequested(
              new FavouriteEvent(oldFav, newFav, SearchFavouritesListPanel.this));
        }
      });

      final IButton cancelButton = new IButton(messages.searchFavouritesListWidgetCancel());
      cancelButton.setIcon(BTN_CANCEL_IMG);
      cancelButton.setAutoFit(true);
      cancelButton.setDisabled(true);
      cancelButton.setShowDisabledIcon(false);
      cancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          FavouritesListGrid.this.collapseRecord(record);
          FavouritesListGrid.this.expandRecord(record);
        }
      });

      form.addItemChangedHandler(new ItemChangedHandler() {
        public void onItemChanged(ItemChangedEvent event) {
          if (saveButton.isDisabled()) {
            saveButton.setDisabled(false);
            cancelButton.setDisabled(false);
          }
        }
      });

      IButton editCritButton = new IButton(messages.searchFavouritesListWidgetEditFilter());
      editCritButton.setIcon(BTN_EDIT_IMG);
      editCritButton.setAutoFit(true);
      editCritButton.setShowDisabledIcon(false);
      editCritButton.setTooltip(messages.searchFavouritesListWidgetEditFilterTooltip());
      editCritButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          SearchWidget sw = null;
          if (AttributeSearchPanel.canHandle(fav.getCriterion())) {
            sw = SearchWidgetRegistry.getSearchWidgetInstance(AttributeSearchCreator.IDENTIFIER);
          }
          if (sw == null && CombinedSearchPanel.canHandle(fav.getCriterion())) {
            sw = SearchWidgetRegistry.getSearchWidgetInstance(CombinedSearchCreator.IDENTIFIER);
          }
          if (sw == null) {
            SC.say(messages.searchFavouritesListWidgetSearchWindowNotFound());
            return;
          }

          sw.showForSave(new SaveRequestHandler() {
            public void onSaveRequested(SaveRequestEvent event) {
              SearchFavourite oldFav = flr.getFavourite();
              SearchFavourite newFav = (SearchFavourite) oldFav.clone();
              newFav.setCriterion(event.getCriterion());
              flr.setFavourite(newFav);
              SearchWidgetRegistry.getFavouritesController().onChangeRequested(
                  new FavouriteEvent(oldFav, newFav, SearchFavouritesListPanel.this));
            }
          });
          sw.initialize(fav.getCriterion());
        }
      });

      IButton deleteButton = new IButton(messages.searchFavouritesListWidgetDelete());
      deleteButton.setIcon(BTN_DELETE_IMG);
      deleteButton.setAutoFit(true);
      deleteButton.setShowDisabledIcon(false);
      deleteButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          SC.ask(messages.searchFavouritesListWidgetDelete(),
              messages.searchFavouritesListWidgetDeleteMessage(), new BooleanCallback() {
                public void execute(Boolean value) {
                  if (value) {
                    favouriteItems.collapseRecord(record);
                    SearchWidgetRegistry.getFavouritesController().onDeleteRequested(
                        new FavouriteEvent(flr.getFavourite(), null,
                            SearchFavouritesListPanel.this));
                  }
                }
              });
        }
      });

      LayoutSpacer lsrFrm = new LayoutSpacer();
      lsrFrm.setWidth("*");

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

      frmButtonlayout.addMember(lsrFrm);
      frmButtonlayout.addMember(saveButton);
      frmButtonlayout.addMember(cancelButton);
      group.addMember(form);
      group.addMember(frmButtonlayout);

      buttonlayout.addMember(editCritButton);
      buttonlayout.addMember(deleteButton);

      layout.addMember(group);
      layout.addMember(buttonlayout);

      // ----------------------------------------------------------
      // -- set record values --
      // ----------------------------------------------------------

      nameItem.setValue(fav.getName());
      sharedItem.setValue(fav.isShared());
      lastEditItem.setValue(fav.getLastChangeBy());
      lastEditDateItem.setValue(fav.getLastChange());
      editCritButton.setDisabled(!AttributeSearchPanel.canHandle(fav.getCriterion())
          && !CombinedSearchPanel.canHandle(fav.getCriterion()));

      return layout;
View Full Code Here


      titleLabel.setAlign(Alignment.CENTER);
      layout.addMember(titleLabel);
    }

    // User name:
    TextItem userNameItem = new TextItem(FIELD_USER_NAME);
    userNameItem.setWidth(logoWidth - 60);
    userNameItem.setTitle(i18n.loginUserName());
    userNameItem.setSelectOnFocus(true);
    userNameItem.setWrapTitle(false);

    // Password:
    PasswordItem passwordItem = new PasswordItem(FIELD_PASSWORD);
    passwordItem.setWidth(logoWidth - 60);
    passwordItem.setTitle(i18n.loginPassword());
View Full Code Here

    mainPrefs.setTitle(messages.printPrefsChoose());

    // create the form
    DynamicForm form = new DynamicForm();
    // title
    titleItem = new TextItem();
    titleItem.setName("title");
    titleItem.setTitle(messages.printPrefsTitleText());
    // size
    sizeItem = new SelectItem();
    sizeItem.setName("size");
    sizeItem.setTitle(messages.printPrefsSize());
    sizeItem.setValueMap(PageSize.getAllNames());
    sizeItem.setValue(PageSize.A4.getName());
    // orientation
    orientationGroup = new RadioGroupItem();
    orientationGroup.setName("orientation");
    orientationGroup.setTitle(messages.printPrefsOrientation());
    LinkedHashMap<String, String> orientations = new LinkedHashMap<String, String>();
    orientations.put("landscape", messages.printPrefsLandscape());
    orientations.put("portrait", messages.printPrefsPortrait());
    orientationGroup.setValueMap(orientations);
    orientationGroup.setVertical(false);
    orientationGroup.setValue("landscape");
    // raster dpi slider
    rasterDpiSlider = new SliderItem();
    rasterDpiSlider.setTitle(messages.printPrefsRasterDPI());
    rasterDpiSlider.setWidth(250);
    rasterDpiSlider.setHeight(30);
    rasterDpiSlider.setMinValue(72);
    rasterDpiSlider.setMaxValue(500);
    rasterDpiSlider.setNumValues(5);
    // north arrow
    arrowCheckbox = new CheckboxItem();
    arrowCheckbox.setValue(true);
    arrowCheckbox.setTitle(messages.printPrefsWithArrow());
    // scale bar
    scaleBarCheckbox = new CheckboxItem();
    scaleBarCheckbox.setValue(true);
    scaleBarCheckbox.setTitle(messages.printPrefsWithScaleBar());
    // filename
    fileNameItem = new TextItem();
    fileNameItem.setName("filename");
    fileNameItem.setTitle(messages.printPrefsFileName());
    fileNameItem.setValue(mapWidget.getMapModel().getMapInfo().getId() + ".pdf");

    // progress indicator
View Full Code Here

  public GeocoderWidget(MapWidget map, String name, String title) {
    super();
    presenter = new GeocoderPresenter(map, this);
    this.map = map;

    textItem = new TextItem(name, title);

    textItem.addKeyPressHandler(new KeyPressHandler() {
      public void onKeyPress(KeyPressEvent keyPressEvent) {
        if ("enter".equalsIgnoreCase(keyPressEvent.getKeyName())) {
          presenter.goToLocation((String) textItem.getValue());
View Full Code Here

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

    final DynamicForm form = new DynamicForm();
    form.setGroupTitle(messages.favouritesControllerAddGroupTitle());
    form.setIsGroup(true);
    final TextItem nameItem = new TextItem();
    nameItem.setWidth(190);
    nameItem.setTitle(messages.favouritesControllerAddName());
    nameItem.setTooltip(messages.favouritesControllerAddNameTooltip());
    nameItem.setRequired(true);
    final CheckboxItem sharedItem = new CheckboxItem();
    sharedItem.setTitle(messages.favouritesControllerAddShared());
    sharedItem.setTooltip(messages.favouritesControllerAddSharedTooltip());
    form.setFields(nameItem, sharedItem);

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

    HLayout buttonLayout = new HLayout(10);
    buttonLayout.setHeight(20);
    buttonLayout.setWidth100();
    IButton addBtn = new IButton(messages.favouritesControllerAddAdd());
    addBtn.setIcon(BTN_ADD_IMG);
    addBtn.setAutoFit(true);
    addBtn.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (form.validate()) {
          addWindow.hide();
          fav.setName(nameItem.getValueAsString());
          fav.setShared(sharedItem.getValueAsBoolean());
          FavouritesCommService.saveSearchFavourite(fav, new DataCallback<SearchFavourite>() {
            public void execute(SearchFavourite result) {
              fireAddEvent(new FavouriteEvent(null, result, FavouritesController.this));
              addWindow.destroy();
View Full Code Here

    DynamicForm form = new DynamicForm();
    form.setWidth100();
    form.setNumCols(11);
    form.setColWidths(120,30,100,"*",60,80,80,10,160,10,120);
   
    depth = new TextItem("depth","Initial Depth");
    depth.setWidth("*");
    depth.setValue(String.valueOf(Home.VIEW - 1));
   
    URL = new TextItem("location","Online XML");
    URL.setWidth("*");
    URL.setValue(url);
    URL.addKeyPressHandler(new KeyPressHandler(){
      /* (non-Javadoc)
       * @see com.smartgwt.client.widgets.form.fields.events.KeyPressHandler#onKeyPress(com.smartgwt.client.widgets.form.fields.events.KeyPressEvent)
View Full Code Here

    DynamicForm form = new DynamicForm();
    form.setWidth100();
    form.setNumCols(11);
    form.setColWidths(120,30,100,"*",60,80,80,10,160,10,120);
   
    DEPTH = new TextItem("depth","Initial Depth");
    DEPTH.setWidth("*");
    DEPTH.setValue(String.valueOf(Home.VIEW - 1));
   
    URL = new TextItem("location","Online XML");
    URL.setWidth("*");
    URL.setValue(url);
    URL.addKeyPressHandler(new KeyPressHandler(){
      /* (non-Javadoc)
       * @see com.smartgwt.client.widgets.form.fields.events.KeyPressHandler#onKeyPress(com.smartgwt.client.widgets.form.fields.events.KeyPressEvent)
View Full Code Here

            logo.setCanvas(logoImg);

            HeaderItem header = new HeaderItem();
            header.setValue(MSG.view_login_prompt());

            TextItem user = new TextItem("user", MSG.common_title_user());
            user.setRequired(true);
            user.setAttribute("autoComplete", "native");

            final PasswordItem password = new PasswordItem("password", MSG.common_title_password());
            password.setRequired(true);
            password.setAttribute("autoComplete", "native");

            loginButton = new SubmitItem("login", MSG.view_login_login());
            loginButton.setAlign(Alignment.CENTER);
            loginButton.setColSpan(2);

            user.addKeyPressHandler(new KeyPressHandler() {
                public void onKeyPress(KeyPressEvent event) {
                    if ((event.getCharacterValue() != null)
                        && (((event.getCharacterValue() == KeyCodes.KEY_ENTER)) || (event.getCharacterValue() == KeyCodes.KEY_TAB))) {
                        password.focusInItem(); // Work around the form not getting auto-fill values until the field is focused
                    }
View Full Code Here

        } else {//if not available, let registration continue. Errors already logged and no functionality lost.
            header.setValue(MSG.view_login_welcomeMsg(""));
        }
        header.setWidth("100%");
        //build ui elements for registration screen
        first = new TextItem(FIRST, MSG.dataSource_users_field_firstName());
        first.setRequired(true);
        first.setWrapTitle(false);
        first.setWidth(fieldWidth);
        last = new TextItem(LAST, MSG.dataSource_users_field_lastName());
        last.setWrapTitle(false);
        last.setWidth(fieldWidth);
        last.setRequired(true);
        final TextItem username = new TextItem(USERNAME, MSG.common_title_username());
        username.setValue(user);
        username.setDisabled(true);
        username.setWidth(fieldWidth);
        email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress());
        email.setRequired(true);
        email.setWidth(fieldWidth);
        email.setWrapTitle(false);
        phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber());
        phone.setWidth(fieldWidth);
        phone.setWrapTitle(false);
        department = new TextItem(DEPARTMENT, MSG.dataSource_users_field_department());
        department.setWidth(fieldWidth);
        SpacerItem space = new SpacerItem();
        space.setColSpan(1);

        inputForm = new DynamicForm();
        inputForm.setAutoFocus(true);
        inputForm.setErrorOrientation(FormErrorOrientation.LEFT);
        inputForm.setNumCols(4);
        //moving header to it's own container for proper display. Didn't display right in production mode
        inputForm.setFields(username, first, last, email, phone, department);
        loadValidators(inputForm);
        inputForm.setValidateOnExit(true);
        DynamicForm headerWrapper = new DynamicForm();
        headerWrapper.setFields(header);
        column.addMember(headerWrapper);
        column.addMember(inputForm);

        HTMLFlow hr = new HTMLFlow("<br/><hr/><br/><br/>");
        hr.setWidth(620);
        hr.setAlign(Alignment.CENTER);
        column.addMember(hr);

        HStack row = new HStack();
        row.setMembersMargin(5);
        row.setAlign(VerticalAlignment.CENTER);
        IButton okButton = new EnhancedIButton(MSG.common_button_ok());
        okButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {

                //F5 refresh check? If they've reloaded the form for some reason then bail.
                boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password
                    .trim().isEmpty()));
                //check for session timeout
                if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) {
                    resetLogin();
                    return;
                }

                //validation
                if (inputForm.validate()) {
                    Log.trace("Successfully validated all data for user registration.");
                    //populate form
                    if (first.getValue() != null)
                        inputForm.setValue(FIRST, String.valueOf(first.getValue()));
                    if (last.getValue() != null)
                        inputForm.setValue(LAST, String.valueOf(last.getValue()));
                    inputForm.setValue(USERNAME, String.valueOf(username.getValue()));
                    if (email.getValue() != null)
                        inputForm.setValue(EMAIL, String.valueOf(email.getValue()));
                    if (phone.getValue() != null)
                        inputForm.setValue(PHONE, String.valueOf(phone.getValue()));
                    if (department.getValue() != null)
View Full Code Here

        categoryIcons.put(DriftCategory.FILE_REMOVED.name(),
            ImageManager.getDriftCategoryIcon(DriftCategory.FILE_REMOVED));
        categoryFilter = new EnumSelectItem(DriftDataSource.FILTER_CATEGORIES, MSG.common_title_category(),
            DriftCategory.class, categories, categoryIcons);

        definitionFilter = new TextItem(DriftDataSource.FILTER_DEFINITION, MSG.common_title_definition());
        changeSetFilter = new TextItem(DriftDataSource.FILTER_SNAPSHOT, MSG.view_drift_table_snapshot());
        pathFilter = new TextItem(DriftDataSource.FILTER_PATH, MSG.common_title_path());

        startDateFilter = new DateFilterItem(DateFilterItem.START_DATE_FILTER, MSG.filter_from_date());
        endDateFilter = new DateFilterItem(DateFilterItem.END_DATE_FILTER, MSG.filter_to_date());

        if (isShowFilterForm()) {
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.form.fields.TextItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.