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);
}
}
});
}
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());
}
}
});
}
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%"));
}
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;
}
Aggregations