Example usage for com.google.gwt.event.logical.shared ValueChangeEvent fire

List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent fire

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared ValueChangeEvent fire.

Prototype

public static <T> void fire(HasValueChangeHandlers<T> source, T value) 

Source Link

Document

Fires a value change event on all registered handlers in the handler manager.

Usage

From source file:com.github.gwtbootstrap.client.ui.CheckBox.java

License:Apache License

/**
 * Checks or unchecks the check box, firing {@link ValueChangeEvent} if
 * appropriate./*from w w  w .j a v  a 2  s  . co m*/
 * <p>
 * Note that this <em>does not</em> set the value property of the checkbox
 * input element wrapped by this widget. For access to that property, see
 * {@link #setFormValue(String)}
 * 
 * @param value
 *            true to check, false to uncheck; null value implies false
 * @param fireEvents
 *            If true, and value has changed, fire a
 *            {@link ValueChangeEvent}
 */
public void setValue(Boolean value, boolean fireEvents) {
    if (value == null) {
        value = Boolean.FALSE;
    }

    Boolean oldValue = getValue();
    inputElem.setChecked(value);
    inputElem.setDefaultChecked(value);
    if (value.equals(oldValue)) {
        return;
    }
    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }
}

From source file:com.github.gwtbootstrap.client.ui.CheckBox.java

License:Apache License

protected void ensureDomEventHandlers() {
    addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            // Checkboxes always toggle their value, no need to compare
            // with old value. Radio buttons are not so lucky, see
            // overrides in RadioButton
            ValueChangeEvent.fire(CheckBox.this, getValue());
        }//w ww  . j a v  a2 s .co  m
    });
}

From source file:com.github.gwtbootstrap.client.ui.SubmitButton.java

License:Apache License

/**
 * @see com.google.gwt.event.logical.shared.HasValueChangeHandlers#addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
 *//*from w ww  .  j a  v a 2 s.  co  m*/
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler) {
    if (!valueChangeHandlerInitialized) {
        valueChangeHandlerInitialized = true;
        addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                ValueChangeEvent.fire(SubmitButton.this, getValue());
            }
        });
    }
    return addHandler(handler, ValueChangeEvent.getType());
}

From source file:com.github.gwtbootstrap.datepicker.client.ui.base.DateBoxBase.java

License:Apache License

/**
 * {@inheritDoc}/*from   ww w  .  ja v  a2s . c  o m*/
 */
@Override
public void setValue(Date value, boolean fireEvents) {
    box.setValue(value != null ? dtf.format(value) : null);

    updateValue(box.getElement());

    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }
}

From source file:com.github.gwtbootstrap.datepicker.client.ui.base.DateBoxBase.java

License:Apache License

/**
 * dateChange event handler.
 */
public void onChange() {
    ValueChangeEvent.fire(this, getValue());
}

From source file:com.github.gwtbootstrap.datetimepicker.client.ui.base.DateTimeBoxBase.java

License:Apache License

/**
 * {@inheritDoc}// ww  w.  j av a 2s .c  om
 */
@Override
public void setValue(Date value, boolean fireEvents) {
    box.setValue(value != null ? dtf.format(value) : null);

    updateValue(decoratedElement);

    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }
}

From source file:com.github.nmorel.gwtjackson.benchmark.client.ui.InputCheckbox.java

License:Apache License

@Override
public void setValue(Boolean value, boolean fireEvents) {
    if (value == null) {
        value = Boolean.FALSE;//from   ww w . j  av  a2s.c  om
    }

    Boolean oldValue = getValue();
    inputElem.setChecked(value);
    inputElem.setDefaultChecked(value);
    if (value.equals(oldValue)) {
        return;
    }
    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }
}

From source file:com.github.nmorel.gwtjackson.benchmark.client.ui.InputCheckbox.java

License:Apache License

protected void ensureDomEventHandlers() {
    addClickHandler(new ClickHandler() {
        @Override/*from  w ww.j av a 2 s  . co m*/
        public void onClick(ClickEvent event) {
            // Checkboxes always toggle their value, no need to compare
            // with old value. Radio buttons are not so lucky, see
            // overrides in RadioButton
            ValueChangeEvent.fire(InputCheckbox.this, getValue());
        }
    });
}

From source file:com.google.gerrit.client.admin.AccessRightEditor.java

License:Apache License

protected void doAddNewRight() {
    final ApprovalType at = getApprovalType();
    ApprovalCategoryValue min = getMin(at);
    ApprovalCategoryValue max = getMax(at);

    if (at == null || min == null || max == null) {
        return;/*from  w  ww  .  j  a  v  a  2 s.  co m*/
    }

    final String groupName = nameSug.getText();
    if ("".equals(groupName) || Util.C.defaultAccountGroupName().equals(groupName)) {
        return;
    }

    final String refPattern = referenceTxt.getText();

    addBut.setEnabled(false);
    Util.PROJECT_SVC.addRight(projectKey, at.getCategory().getId(), groupName, refPattern, min.getValue(),
            max.getValue(), new GerritCallback<ProjectDetail>() {
                public void onSuccess(final ProjectDetail result) {
                    addBut.setEnabled(true);
                    nameSug.setText("");
                    referenceTxt.setText("");
                    ValueChangeEvent.fire(AccessRightEditor.this, result);
                }

                @Override
                public void onFailure(final Throwable caught) {
                    addBut.setEnabled(true);
                    super.onFailure(caught);
                }
            });
}

From source file:com.google.gwt.sample.showcase.client.ContentWidget.java

License:Apache License

/**
 * Fire a {@link ValueChangeEvent} indicating that the user wishes to see the
 * specified source file.//w w w .  j  a v  a 2s.com
 * 
 * @param filename the filename that the user wishes to see
 */
protected void fireRawSourceRequest(String filename) {
    if (!rawSourceFilenames.contains(filename)) {
        throw new IllegalArgumentException("Filename is not registered with this example: " + filename);
    }
    ValueChangeEvent.fire(this, filename);
}