List of usage examples for com.google.gwt.dom.client BrowserEvents CHANGE
String CHANGE
To view the source code for com.google.gwt.dom.client BrowserEvents CHANGE.
Click Source Link
From source file:com.gafactory.core.client.ui.grids.TextInputCell.java
License:Apache License
/** * Constructs a TextInputCell that renders its text without HTML markup. */// w ww. ja va 2 s . c o m public TextInputCell() { super(BrowserEvents.CHANGE, BrowserEvents.KEYUP); if (template == null) { template = GWT.create(Template.class); } }
From source file:com.gafactory.core.client.ui.grids.TextInputCell.java
License:Apache License
@Override public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); // Ignore events that don't target the input. InputElement input = getInputElement(parent); Element target = event.getEventTarget().cast(); if (!input.isOrHasChild(target)) { return;/*from www . j a v a2 s .c o m*/ } String eventType = event.getType(); Object key = context.getKey(); if (BrowserEvents.CHANGE.equals(eventType)) { finishEditing(parent, value, key, valueUpdater); } else if (BrowserEvents.KEYUP.equals(eventType)) { // Record keys as they are typed. ViewData vd = getViewData(key); if (vd == null) { vd = new ViewData(value); setViewData(key, vd); } vd.setCurrentValue(input.getValue()); } }
From source file:com.geocento.webapps.eobroker.customer.client.widgets.MaterialCheckBoxCell.java
License:Apache License
public MaterialCheckBoxCell(boolean dependsOnSelection, boolean handlesSelection) { super(BrowserEvents.CHANGE, BrowserEvents.KEYDOWN, BrowserEvents.CLICK); this.dependsOnSelection = dependsOnSelection; this.handlesSelection = handlesSelection; }
From source file:com.geocento.webapps.eobroker.customer.client.widgets.MaterialCheckBoxCell.java
License:Apache License
@Override public void onBrowserEvent(Context context, Element parent, Boolean value, NativeEvent event, ValueUpdater<Boolean> valueUpdater) { String type = event.getType(); boolean enterPressed = (BrowserEvents.KEYDOWN.equals(type) && event.getKeyCode() == KeyCodes.KEY_ENTER); if (BrowserEvents.CHANGE.equals(type) || enterPressed) { InputElement input = parent.getFirstChild().getFirstChild().cast(); Boolean isChecked = input.isChecked(); /*/*from www. j a v a 2s. co m*/ * Toggle the value if the enter key was pressed and the cell handles selection or doesn't depend on selection. If the cell depends on selection but doesn't handle selection, then ignore * the enter key and let the SelectionEventManager determine which keys will trigger a change. */ if (enterPressed && (handlesSelection() || !dependsOnSelection())) { isChecked = !isChecked; input.setChecked(isChecked); } /* * Save the new value. However, if the cell depends on the selection, then do not save the value because we can get into an inconsistent state. */ if (value != isChecked && !dependsOnSelection()) { setViewData(context.getKey(), isChecked); } else { clearViewData(context.getKey()); } if (valueUpdater != null) { valueUpdater.update(isChecked); } } }
From source file:com.gwtmodel.table.view.table.edit.CustomizedGwtSelectionCell.java
License:Apache License
/** * Construct a new {@link SelectionCell} with the specified options. * // www . j ava 2 s .com * @param options * the options in the cell */ CustomizedGwtSelectionCell(List<String> options) { super(BrowserEvents.CHANGE); if (template == null) { template = GWT.create(Template.class); } this.options = new ArrayList<String>(options); int index = 0; for (String option : options) { indexForOption.put(option, index++); } }
From source file:com.gwtmodel.table.view.table.edit.CustomizedGwtSelectionCell.java
License:Apache License
@Override public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); String type = event.getType(); if (BrowserEvents.CHANGE.equals(type)) { Object key = context.getKey(); SelectElement select = parent.getFirstChild().cast(); String newValue = options.get(select.getSelectedIndex()); setViewData(key, newValue);/*from w w w . j a v a2 s .co m*/ finishEditing(parent, newValue, key, valueUpdater); if (valueUpdater != null) { valueUpdater.update(newValue); } } }
From source file:com.gwtmodel.table.view.table.edit.PresentationEditCellHelper.java
License:Apache License
protected void afterChange(String eventType, Context context, IVField v, WSize w) { if (eventType.equals(BrowserEvents.CHANGE)) { modifUpdate(false, context.getKey(), v, w); }/*from w w w.jav a 2 s .c o m*/ if (eventType.equals(BrowserEvents.FOCUS)) { modifUpdate(true, context.getKey(), v, w); } }
From source file:com.jitlogic.zico.widgets.client.SelectCell.java
License:Open Source License
public SelectCell(Map<T, V> opts, Template template) { super(BrowserEvents.CHANGE); this.template = template; setOptions(opts); }
From source file:com.jitlogic.zico.widgets.client.SelectCell.java
License:Open Source License
@Override public void onBrowserEvent(Context context, Element parent, V value, NativeEvent event, ValueUpdater<V> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); String type = event.getType(); if (BrowserEvents.CHANGE.equals(type)) { Object key = context.getKey(); SelectElement select = parent.getFirstChild().cast(); int idx = select.getSelectedIndex(); if (idx != -1) { V v = values.get(idx);/*from www . j ava 2 s . c o m*/ if (v != null) { setViewData(key, v); finishEditing(parent, v, key, valueUpdater); if (valueUpdater != null) { valueUpdater.update(v); } } } } }
From source file:gwt.material.design.client.base.MaterialCheckBoxCell.java
License:Apache License
@Override public void onBrowserEvent(Context context, Element parent, Boolean value, NativeEvent event, ValueUpdater<Boolean> valueUpdater) { String type = event.getType(); boolean enterPressed = (BrowserEvents.KEYDOWN.equals(type) && event.getKeyCode() == KeyCodes.KEY_ENTER) || event.getType().equals(BrowserEvents.CLICK); if (BrowserEvents.CHANGE.equals(type) || enterPressed) { InputElement input = parent.getFirstChild().cast(); Boolean isChecked = input.isChecked(); /*/*from w w w . j a v a2 s .c o m*/ * Toggle the value if the enter key was pressed and the cell handles selection or doesn't depend on selection. If the cell depends on selection but doesn't handle selection, then ignore * the enter key and let the SelectionEventManager determine which keys will trigger a change. */ if (enterPressed && (handlesSelection() || !dependsOnSelection())) { isChecked = !isChecked; input.setChecked(isChecked); } /* * Save the new value. However, if the cell depends on the selection, then do not save the value because we can get into an inconsistent state. */ if (value != isChecked && !dependsOnSelection()) { setViewData(context.getKey(), isChecked); } else { clearViewData(context.getKey()); } if (valueUpdater != null) { valueUpdater.update(isChecked); } } }