Example usage for com.google.gwt.dom.client BrowserEvents CHANGE

List of usage examples for com.google.gwt.dom.client BrowserEvents CHANGE

Introduction

In this page you can find the example usage for com.google.gwt.dom.client BrowserEvents CHANGE.

Prototype

String CHANGE

To view the source code for com.google.gwt.dom.client BrowserEvents CHANGE.

Click Source Link

Usage

From source file:org.eclipse.che.ide.jseditor.client.preference.editorselection.EditorSelectionCell.java

License:Open Source License

/**
 * Construct a new {@link SelectionCell} with the specified options.
 *
 * @param defaultEditor/*from  ww w  .j ava  2s  . c om*/
 * @param options the options in the cell
 */
public EditorSelectionCell(final List<EditorType> editorTypes, final String stylename,
        final Double selectWidthValue, final Unit selectWidthUnit, final EditorTypeRegistry editorTypeRegistry,
        final EditorType defaultEditor) {
    super(BrowserEvents.CHANGE);

    initTemplate();

    this.stylename = stylename;
    this.selectWidthValue = selectWidthValue;
    this.selectWidthUnit = selectWidthUnit;
    this.editorTypes = editorTypes;
    this.editorTypeRegistry = editorTypeRegistry;
    this.defaultEditor = defaultEditor;
}

From source file:org.eclipse.che.ide.jseditor.client.preference.editorselection.EditorSelectionCell.java

License:Open Source License

@Override
public void onBrowserEvent(final Context context, final Element parent, final EditorType value,
        final NativeEvent event, final ValueUpdater<EditorType> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    final String type = event.getType();
    if (BrowserEvents.CHANGE.equals(type)) {
        final FileType key = (FileType) context.getKey();
        final SelectElement select = parent.getFirstChild().cast();

        final EditorType newValue = this.editorTypes.get(select.getSelectedIndex());
        setViewData(key, newValue.getEditorTypeKey());
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }//  w  ww.  j  ava 2s .c  om
    }
}

From source file:org.eclipse.che.ide.jseditor.client.preference.keymaps.KeymapSelectionCell.java

License:Open Source License

/**
 * Construct a new {@link SelectionCell} with the specified options.
 * //  ww w .j  a  v  a 2 s  . co m
 * @param options the options in the cell
 */
public KeymapSelectionCell(final String stylename, final String widthStylename) {
    super(BrowserEvents.CHANGE);

    initTemplate();

    this.stylename = stylename;
    this.widthStylename = widthStylename;
}

From source file:org.eclipse.che.ide.jseditor.client.preference.keymaps.KeymapSelectionCell.java

License:Open Source License

@Override
public void onBrowserEvent(final Context context, final Element parent, final Keymap value,
        final NativeEvent event, final ValueUpdater<Keymap> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    String type = event.getType();
    if (BrowserEvents.CHANGE.equals(type)) {
        final EditorType key = (EditorType) context.getKey();
        final SelectElement select = parent.getFirstChild().cast();

        final List<Keymap> keymapsForRow = Keymap.getInstances(key);
        final Keymap newValue = keymapsForRow.get(select.getSelectedIndex());
        setViewData(key, newValue.getKey());
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }//from w  ww . java2 s  . c o m
    }
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.AbstractSelectionCell.java

License:Apache License

public AbstractSelectionCell(Renderer<T> renderer) {
    super(BrowserEvents.CHANGE);
    if (template == null) {
        template = GWT.create(Template.class);
    }/*from w w w .j a  va  2  s .c  o  m*/
    this.renderer = renderer;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.AbstractSelectionCell.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//ww w .  j a  v a  2 s  .c o m
public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event,
        ValueUpdater<T> 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();
        T newValue = getValueAtIndex((K) key, select.getSelectedIndex());
        setViewData(key, newValue);
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }
    }
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.FilterTextInputCell.java

License:Apache License

public FilterTextInputCell(double width, Unit widthUnit) {
    super(BrowserEvents.BLUR, BrowserEvents.CHANGE, BrowserEvents.KEYUP, PASTE);
    if (template == null) {
        template = GWT.create(Template.class);
    }//ww w  . j  a  v a 2s. c om
    if (width > 0) {
        inputStyle = SafeStylesUtils.forWidth(width, widthUnit);
    }
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.FilterTextInputCell.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;/*ww  w. ja va  2s  .co m*/
    }

    String eventType = event.getType();
    Object key = context.getKey();
    if (BrowserEvents.BLUR.equals(eventType)) {
        finishEditing(parent, value, key, valueUpdater);
    } else if (BrowserEvents.CHANGE.equals(eventType) || BrowserEvents.KEYUP.equals(eventType)
            || PASTE.equals(eventType)) {
        ViewData vd = getViewData(key);
        if (vd == null) {
            vd = new ViewData(value);
            setViewData(key, vd);
        }

        String newValue = input.getValue();

        vd.setCurrentValue(input.getValue());

        if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) {
            vd.setLastValue(newValue);
            valueUpdater.update(newValue);
        }
    }
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.ValueSelectionCell.java

License:Apache License

/**
 * Construct a new {@link ValueSelectionCell} with the specified options.
 *
 * @param options the options in the cell
 * @param renderer the renderer to render options in the cell
 *//*from  w ww .j  a v a2s  . c  om*/
public ValueSelectionCell(List<T> options, Renderer<T> renderer) {
    super(BrowserEvents.CHANGE);
    if (template == null) {
        template = GWT.create(Template.class);
    }
    this.options = new ArrayList<T>(options);
    this.renderer = renderer;
    int index = 0;
    for (T option : options) {
        indexForOption.put(option, index++);
    }
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.ValueSelectionCell.java

License:Apache License

@Override
public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event,
        ValueUpdater<T> 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();
        T newValue = options.get(select.getSelectedIndex());
        //setViewData(key, newValue);
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }//from  ww  w . j ava2s  . co m
    }
}