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

Examples of com.smartgwt.client.widgets.form.fields.events.KeyUpHandler


            public void onFormItemClick(FormItemIconClickEvent event) {
                hideBaselineEditingFields();
            }
        });
        newBaselineMeanText.setIcons(cancelPicker);
        newBaselineMeanText.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {
                if (keyUpEvent.getKeyName().equals("Enter")) {
                    hideBaselineEditingFields();
                    if (null != newBaselineMeanText.getValueAsString()) {
                        double newBaselineMean = Double.parseDouble(newBaselineMeanText.getValueAsString());
                        saveCustomBaselineMean(newBaselineMean);
                    }
                }

            }
        });

        // High Baseline
        expectedRangeHighText.setTitle(BASELINE_HIGH);
        LinkItem baselineHighLink = AbstractActivityView.newLinkItem(CHANGE_VALUE, null);
        baselineHighLink.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent clickEvent) {
                // High cannot be below the low
                newBaselineMeanText.hide();
                newExpectedRangeHighText.show();
                newExpectedRangeHighText.setSelectOnFocus(true);
                newExpectedRangeLowText.hide();

            }
        });
        newExpectedRangeHighText.setTitle(NEW_BASELINE_HIGH);
        newExpectedRangeHighText.addBlurHandler(new BlurHandler() {
            @Override
            public void onBlur(BlurEvent blurEvent) {
                hideBaselineEditingFields();
            }
        });
        newExpectedRangeHighText.setIcons(cancelPicker);
        newExpectedRangeHighText.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {
                if (keyUpEvent.getKeyName().equals("Enter")) {
                    hideBaselineEditingFields();
                    if (null != newExpectedRangeHighText.getValueAsString()) {
                        double newBaselineHigh = Double.parseDouble(newExpectedRangeHighText.getValueAsString());
                        saveCustomBaselineHigh(newBaselineHigh);
                    }
                }

            }
        });

        // Low Baseline
        expectedRangeLowText.setTitle(BASELINE_LOW);
        LinkItem baselineLowLink = AbstractActivityView.newLinkItem(CHANGE_VALUE, null);
        baselineLowLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                newBaselineMeanText.hide();
                newExpectedRangeHighText.hide();
                newExpectedRangeLowText.show();
                newExpectedRangeLowText.setSelectOnFocus(true);

            }
        });
        newExpectedRangeLowText.setTitle(NEW_BASELINE_LOW);
        newExpectedRangeLowText.addBlurHandler(new BlurHandler() {
            @Override
            public void onBlur(BlurEvent blurEvent) {
                hideBaselineEditingFields();
            }
        });
        newExpectedRangeLowText.setIcons(cancelPicker);
        newExpectedRangeLowText.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {
                if (keyUpEvent.getKeyName().equals("Enter")) {
                    hideBaselineEditingFields();
                    if (null != newExpectedRangeLowText.getValueAsString()) {
View Full Code Here


        searchTextItem = new TextItem("search", MSG.common_button_search());
        searchTextItem.setShowTitle(false);
        searchTextItem.setWidth(SEARCH_WIDTH);
        searchTextItem.setBrowserSpellCheck(false);

        searchTextItem.addKeyUpHandler(new KeyUpHandler() {

            public void onKeyUp(final KeyUpEvent keyUpEvent) {
                Log.debug("onKeyUp search Mode: " + searchMode + " key: " + keyUpEvent.getKeyName());
                keyUpEvent.cancel();

                if (IGNORED_KEYS.contains(keyUpEvent.getKeyName())) {
                    return;
                }

                if (keyUpEvent.getKeyName().equals("Enter")) {
                    if (getSearchMode().equals(SearchMode.SAVED_SEARCH_MODE)) {
                        return;
                    }

                    String currentSearchTerm = (String) keyUpEvent.getItem().getValue();
                    currentSearchTerm = (null == currentSearchTerm) ? "" : currentSearchTerm; // avoid NPEs
                    Log.debug("onKeyUp search Mode Enter key pressed");

                    // stop any duplicate searches
                    if (!currentSearchTerm.equalsIgnoreCase(lastSearchTerm)) {
                        getSearchStrategy().searchReturnKeyHandler(keyUpEvent);
                        searchTextItem.focusInItem();
                        lastSearchTerm = currentSearchTerm;
                    } else {
                      hideList();
                    }
                } else if (keyUpEvent.getKeyName().equals("Escape")) {
                    searchTextItem.setValue(lastSearchTerm);
                    hideList();
                } else {
                    if (null == searchDelayTimer) {
                        searchDelayTimer = new Timer() {

                            public void run() {
                                getSearchStrategy().searchKeyUpHandler(keyUpEvent);
                                pickListGrid.show();
                            }
                        };
                    } else {
                        searchDelayTimer.cancel();
                    }

                    // wait for some typing quiet time before performing a search
                    searchDelayTimer.schedule(SEARCH_KEYUP_DELAY);
                }
            }
        });

        pickListGrid.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
          @Override
          public void onClick( com.smartgwt.client.widgets.events.ClickEvent clickEvent) {
              pickListGrid.focus();
          }
        });

        searchTextItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
            @Override
            public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
                if (pickListGrid.isVisible()) {
                  hideList();
                } else {
                  showList();
                }
            }
        });

        searchTextItem.addFocusHandler( new FocusHandler() {
            @Override
            public void onFocus(FocusEvent event) {
              showList();
            }
        });


        searchTextItem.addBlurHandler( new BlurHandler() {
          @Override
          public void onBlur(BlurEvent event) {
            Timer t = new Timer() {
              public void run() {
                if (!pickListGrid.containsFocus()) {
                  hideList();
                }
              }
            };
            t.schedule(500);
          }
        });


        searchTextForm.setFields(searchTextItem);
        addMember(searchTextForm);
        searchTextItem.setTooltip(MSG.view_searchBar_buttonTooltip());
        searchTextItem.setHint("Search");

        searchTextItem.setShowHintInField(true);

        saveSearchButton = new ToolStripButton();
        saveSearchButton.setIcon(IconEnum.STAR_OFF.getIcon16x16Path());
        saveSearchButton.setTooltip(MSG.view_searchBar_savedSearch_buttonTooltip());
        saveSearchButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                toggleFavoriteSearch();
            }
        });
        addButton(saveSearchButton);

        DynamicForm saveSearchTextForm = new DynamicForm();
        saveSearchTextForm.setAutoWidth();

        saveSearchTextItem = new TextItem("savedSearchName");
        saveSearchTextItem.setShowTitle(false);
        saveSearchTextItem.setWidth(SAVED_SEARCH_WIDTH);

        saveSearchTextForm.setFields(saveSearchTextItem);

        addMember(saveSearchTextForm);
        saveSearchTextItem.hide();

        saveSearchTextItem.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {
                if (keyUpEvent.getKeyName().equals("Enter")) {
                    saveFavoriteSearch();
                }
View Full Code Here

        name.setRequired(true);
        LengthRangeValidator nameLengthValidator = new LengthRangeValidator();
        nameLengthValidator.setMin(3);
        nameLengthValidator.setMax(100);
        name.setValidators(nameLengthValidator);
        name.addKeyUpHandler(new KeyUpHandler() {
            public void onKeyUp(KeyUpEvent event) {
                if ("Enter".equals(event.getKeyName())) {
                    createNewGroup(modalWindow, form);
                }
            }
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.form.fields.events.KeyUpHandler

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.