@Override protected void finishEditing(Element parent, String value, Object key, ValueUpdater<String> valueUpdater) { String newValue = getInputElement(parent).getValue(); // Get the view data. ViewData vd = getViewData(key); if (vd == null) { vd = new ViewData(value); setViewData(key, vd); } vd.setCurrentValue(newValue); // Fire the value updater if the value has changed. if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) { vd.setLastValue(newValue); valueUpdater.update(newValue); } // Blur the element. super.finishEditing(parent, newValue, key, valueUpdater); }
if ( viewData != null && viewData.getCurrentValue().equals( value ) ) { clearViewData( key ); viewData = null; String s = ( viewData != null ) ? viewData.getCurrentValue() : value; if ( s != null && s.trim().length() > 0 ) {
if ( viewData != null && viewData.getCurrentValue().equals( value ) ) { clearViewData( key ); viewData = null; String s = ( viewData != null ) ? viewData.getCurrentValue() : value; if ( s != null && s.trim().length() > 0 ) {
@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; } 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()); } }
@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; } 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()); } }
@Override protected void finishEditing(Element parent, String value, Object key, ValueUpdater<String> valueUpdater) { String newValue = getInputElement(parent).getValue(); // Get the view data. ViewData vd = getViewData(key); if (vd == null) { vd = new ViewData(value); setViewData(key, vd); } vd.setCurrentValue(newValue); // Fire the value updater if the value has changed. if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) { vd.setLastValue(newValue); valueUpdater.update(newValue); } // Blur the element. super.finishEditing(parent, newValue, key, valueUpdater); }
@Override protected void finishEditing(Element parent, String value, Object key, ValueUpdater<String> valueUpdater) { String newValue = getInputElement(parent).getValue(); // Get the view data. ViewData vd = getViewData(key); if (vd == null) { vd = new ViewData(value); setViewData(key, vd); } vd.setCurrentValue(newValue); // Fire the value updater if the value has changed. if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) { vd.setLastValue(newValue); valueUpdater.update(newValue); } // Blur the element. super.finishEditing(parent, newValue, key, valueUpdater); }
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); ViewData viewData = getViewData(key); if (viewData != null && viewData.getCurrentValue().equals(value)) { clearViewData(key); viewData = null; } String s = (viewData != null) ? viewData.getCurrentValue() : value; if (s != null) { sb.append(template.input(s)); } else { sb.appendHtmlConstant("<input type=\"text\" tabindex=\"-1\"></input>"); } }
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); ViewData viewData = getViewData(key); if (viewData != null && viewData.getCurrentValue().equals(value)) { clearViewData(key); viewData = null; } String s = (viewData != null) ? viewData.getCurrentValue() : value; if (s != null) { sb.append(template.input(s)); } else { sb.appendHtmlConstant("<input type=\"text\" tabindex=\"-1\"></input>"); } }
@Override public void render(Context context, String value, SafeHtmlBuilder sb, String id) { // Get the view data. Object key = context.getKey(); ViewData viewData = getViewData(key); if (viewData != null && viewData.getCurrentValue().equals(value)) { clearViewData(key); viewData = null; } String s = (viewData != null) ? viewData.getCurrentValue() : value; if (s != null) { sb.append(template.inputWithValue(id, s)); } else { sb.append(template.input(id)); } }
/** * Return true if the last and current values of this ViewData object * are equal to those of the other object. */ @Override public boolean equals(Object other) { if (!(other instanceof ViewData)) { return false; } ViewData vd = (ViewData) other; return equalsOrNull(lastValue, vd.lastValue) && equalsOrNull(curValue, vd.curValue); }
/** * Return true if the last and current values of this ViewData object * are equal to those of the other object. */ @Override public boolean equals(Object other) { if (!(other instanceof ViewData)) { return false; } ViewData vd = (ViewData) other; return equalsOrNull(lastValue, vd.lastValue) && equalsOrNull(curValue, vd.curValue); }
@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; } 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()); } }
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); ViewData viewData = getViewData(key); if (viewData != null && viewData.getCurrentValue().equals(value)) { clearViewData(key); viewData = null; } String s = (viewData != null) ? viewData.getCurrentValue() : value; if (s != null) { sb.append(template.input(s)); } else { sb.appendHtmlConstant("<input type=\"text\" tabindex=\"-1\"></input>"); } }
/** * Return true if the last and current values of this ViewData object * are equal to those of the other object. */ @Override public boolean equals(Object other) { if (!(other instanceof ViewData)) { return false; } ViewData vd = (ViewData) other; return equalsOrNull(lastValue, vd.lastValue) && equalsOrNull(curValue, vd.curValue); }