Search in sources :

Example 11 with KeyListener

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

the class LoadKmlFromUrlWidget method addListenerToUrlText.

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

        @Override
        public void handleEvent(BaseEvent be) {
            if (checkUrl()) {
            // verifyUrl(false); // TODO Decomment
            } else {
                buttonAdd.disable();
                setStatus(EnumKmlUrlStatus.STATUS_NO_CHECKED.getValue(), EnumKmlUrlStatus.STATUS_MESSAGE_NOT_CHECKED.getValue());
            // 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()) {
                // verifyUrl(false); // TODO Decomment
                } else {
                    setStatus(EnumKmlUrlStatus.STATUS_NO_CHECKED.getValue(), EnumKmlUrlStatus.STATUS_MESSAGE_NOT_CHECKED.getValue());
                // 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)

Example 12 with KeyListener

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

the class KvpUrlTextField method setWidgetProperties.

protected final void setWidgetProperties() {
    setFieldLabel(LayerModuleConstants.INSTANCE.urlLabelText());
    sinkEvents(Event.ONPASTE);
    addKeyListener(new KeyListener() {

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if ((getValue() == null) && (event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) {
                resetField();
            }
        }

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

Example 13 with KeyListener

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

the class SimpleUrlTextFields method setWidgetProperties.

protected final void setWidgetProperties() {
    super.setLayout(new FormLayout());
    super.setWidth(240);
    urlTextField.setFieldLabel(LayerModuleConstants.INSTANCE.urlLabelText());
    layerTextField.setFieldLabel(LayerModuleConstants.INSTANCE.SimpleUrlTextFields_layerNameText());
    urlTextField.sinkEvents(Event.ONPASTE);
    layerTextField.sinkEvents(Event.ONPASTE);
    KeyListener keyListener = new KeyListener() {

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if ((urlTextField.getValue() == null) && (event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) {
                resetFields();
            }
        }

        @Override
        public void componentKeyPress(ComponentEvent event) {
            if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && checkUrl().isEmpty()) {
                wmsGetMapDispatcher.verifyUrl(true, buildGetMapURL());
            } else {
                fireDelayed();
            }
        }
    };
    urlTextField.addKeyListener(keyListener);
    layerTextField.addKeyListener(keyListener);
    super.add(urlTextField, new FormData("100%"));
    super.add(layerTextField, new FormData("100%"));
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FormData(com.extjs.gxt.ui.client.widget.layout.FormData) KeyListener(com.extjs.gxt.ui.client.event.KeyListener) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent)

Example 14 with KeyListener

use of com.extjs.gxt.ui.client.event.KeyListener in project jahia by Jahia.

the class ResourceBundleEditor method createSearchField.

private TextField<String> createSearchField() {
    TextField<String> searchField = new TextField<String>();
    searchField.setName("bundleKeySearch");
    searchField.addListener(Events.KeyUp, new KeyListener() {

        public void componentKeyUp(ComponentEvent event) {
            @SuppressWarnings("unchecked") String search = ((TextField<String>) event.getComponent()).getValue();
            if (search != null && search.length() > 0) {
                GWTResourceBundleEntry match = bundleView.getStore().findModel("key", search);
                addButton.setEnabled(match == null && writable);
                if (match == null) {
                    for (GWTResourceBundleEntry e : bundleView.getStore().getModels()) {
                        if (e.getKey().startsWith(search)) {
                            match = e;
                            break;
                        }
                    }
                }
                if (match != null) {
                    bundleView.getSelectionModel().setSelection(Arrays.asList(match));
                }
            } else {
                addButton.disable();
            }
        }
    });
    return searchField;
}
Also used : TextField(com.extjs.gxt.ui.client.widget.form.TextField) GWTResourceBundleEntry(org.jahia.ajax.gwt.client.data.GWTResourceBundleEntry) 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