Search in sources :

Example 6 with KeyListener

use of com.extjs.gxt.ui.client.event.KeyListener in project activityinfo by bedatadriven.

the class LocationForm method addNameField.

private void addNameField() {
    nameField = new TextField<String>();
    nameField.setFieldLabel(locationType.getName());
    nameField.setMaxLength(50);
    add(nameField);
    nameField.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyDown(ComponentEvent event) {
            nameTypeAheadTimer.schedule(200);
        }
    });
}
Also used : KeyListener(com.extjs.gxt.ui.client.event.KeyListener) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent)

Example 7 with KeyListener

use of com.extjs.gxt.ui.client.event.KeyListener in project geo-platform by geosdi.

the class GPSecurityWidget method createBasicComponents.

private void createBasicComponents() {
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(90);
    layout.setDefaultWidth(180);
    setLayout(layout);
    setButtonAlign(HorizontalAlignment.LEFT);
    setButtons("");
    setIcon(AbstractImagePrototype.create(BasicWidgetResources.ICONS.search()));
    setHeadingText(BasicWidgetConstants.INSTANCE.GPSecurityWidget_headingText());
    setModal(true);
    setBodyBorder(true);
    setBodyStyle("padding: 8px;background: none");
    setWidth(330);
    setResizable(false);
    setClosable(false);
    KeyListener keyListener = new KeyListener() {

        @Override
        public void componentKeyPress(ComponentEvent event) {
            if (event.getKeyCode() == KeyCodes.KEY_ENTER && login.isEnabled()) {
                onSubmit();
            }
        }

        @Override
        public void componentKeyUp(ComponentEvent event) {
            validate();
        }
    };
    userName = new GPSecureStringTextField();
    userName.setFieldLabel(BasicWidgetConstants.INSTANCE.GPSecurityWidget_usernameText());
    // userName.setValue("admin");
    userName.addKeyListener(keyListener);
    add(userName);
    password = new GPSecureStringTextField();
    password.setPassword(true);
    password.setFieldLabel(BasicWidgetConstants.INSTANCE.GPSecurityWidget_passwordText());
    // password.setValue("admin");
    password.addKeyListener(keyListener);
    add(password);
    setFocusWidget(userName);
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) GPSecureStringTextField(org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField) KeyListener(com.extjs.gxt.ui.client.event.KeyListener) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent)

Example 8 with KeyListener

use of com.extjs.gxt.ui.client.event.KeyListener in project geo-platform by geosdi.

the class GeocodingTextFieldProvider method get.

@Override
public GPSecureStringTextField get() {
    final GPSecureStringTextField geocoding = new GPSecureStringTextField();
    geocoding.setFieldLabel("Find");
    geocoding.setEmptyText(this.wfstWidgetConstants.searchAddressLabel());
    geocoding.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if (((event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) && (geocoding.getValue() == null)) {
                GeocodingHandlerManager.fireEvent(REMOVE_MARKER_EVENT);
                GeocodingHandlerManager.fireEvent(CLEAR_GEOCODING_GRID_EVENT);
                eventBus.fireEvent(WFS_ZOOM_EVENT);
            }
        }

        @Override
        public void componentKeyPress(ComponentEvent event) {
            if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && (!geocoding.getValue().equals(""))) {
                GeocodingHandlerManager.fireEvent(MASK_GEOCODING_GRID_EVENT);
                geocodingDelegate.searchAddress(new GPGeocodingAddressRequestDTO(LocaleInfo.getCurrentLocale().getLocaleName(), geocoding.getValue()));
            }
        }
    });
    return geocoding;
}
Also used : GPSecureStringTextField(org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField) GPGeocodingAddressRequestDTO(org.geosdi.geoplatform.gui.client.service.request.GPGeocodingAddressRequestDTO) KeyListener(com.extjs.gxt.ui.client.event.KeyListener) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent)

Example 9 with KeyListener

use of com.extjs.gxt.ui.client.event.KeyListener in project geo-platform by geosdi.

the class GenericRoutingSearchPoint method setWidgetProperties.

/**
 * (non-Javadoc)
 *
 * @see
 * org.geosdi.geoplatform.gui.client.widget.search.ComboSearchWidget#setWidgetProperties()
 */
@Override
public void setWidgetProperties() {
    this.combo.setDisplayField(GeocodingKeyValue.DESCRIPTION.getValue());
    this.combo.setHideTrigger(true);
    this.combo.setUseQueryCache(false);
    this.combo.setWidth(200);
    this.combo.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyPress(ComponentEvent event) {
            if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && (combo.getRawValue().length() >= 4) && (combo.getSelection().isEmpty())) {
                dispatchRequest();
            }
        }
    });
}
Also used : KeyListener(com.extjs.gxt.ui.client.event.KeyListener) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent)

Example 10 with KeyListener

use of com.extjs.gxt.ui.client.event.KeyListener in project geo-platform by geosdi.

the class GPKmlWidget method addListenerToUrlText.

private void addListenerToUrlText() {
    urlText.addListener(Events.OnPaste, new Listener() {

        @Override
        public void handleEvent(BaseEvent be) {
            if (checkUrl()) {
                urlText.clearInvalid();
                verifyUrl(false);
            } else {
                buttonPreview.disable();
                urlText.forceInvalid(suggestion);
            }
        }
    });
    urlText.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if (urlText.getValue() == null) {
                if ((event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) {
                    reset();
                }
            } else {
                if (checkUrl()) {
                    urlText.clearInvalid();
                    verifyUrl(false);
                } else {
                    buttonPreview.disable();
                    urlText.forceInvalid(suggestion);
                }
            }
        }

        @Override
        public void componentKeyPress(ComponentEvent event) {
            if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && checkUrl()) {
                verifyUrl(true);
            }
        }
    });
}
Also used : Listener(com.extjs.gxt.ui.client.event.Listener) KeyListener(com.extjs.gxt.ui.client.event.KeyListener) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) KeyListener(com.extjs.gxt.ui.client.event.KeyListener) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent)

Aggregations

ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)14 KeyListener (com.extjs.gxt.ui.client.event.KeyListener)14 GPSecureStringTextField (org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField)6 FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)5 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)4 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)3 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)3 Button (com.extjs.gxt.ui.client.widget.button.Button)3 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)3 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)3 Listener (com.extjs.gxt.ui.client.event.Listener)2 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)2 El (com.extjs.gxt.ui.client.core.El)1 ListLoadResult (com.extjs.gxt.ui.client.data.ListLoadResult)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 GroupingStore (com.extjs.gxt.ui.client.store.GroupingStore)1 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)1 Label (com.extjs.gxt.ui.client.widget.Label)1 Slider (com.extjs.gxt.ui.client.widget.Slider)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1