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:org.jbpm.designer.client.popup.AssignmentListItemWidgetViewImpl.java

License:Apache License

@PostConstruct
public void init() {
    // Configure dataType and customDataType controls
    dataTypeComboBox.init(this, dataType, customDataType, false, AssignmentListItemWidgetView.CUSTOM_PROMPT,
            AssignmentListItemWidgetView.ENTER_TYPE_PROMPT);

    // Configure processVar and constant controls
    processVarComboBox.init(this, processVar, constant, true, AssignmentListItemWidgetView.CONSTANT_PROMPT,
            AssignmentListItemWidgetView.ENTER_CONSTANT_PROMPT);

    name.setRegExp("^[a-zA-Z0-9\\s\\.\\_]*$",
            DesignerEditorConstants.INSTANCE.Removed_invalid_characters_from_name(),
            DesignerEditorConstants.INSTANCE.Invalid_character_in_name());

    customDataType.addKeyDownHandler(new KeyDownHandler() {
        @Override//from w w  w  .  j  ava  2  s  . c om
        public void onKeyDown(KeyDownEvent event) {
            int iChar = event.getNativeKeyCode();
            if (iChar == ' ') {
                event.preventDefault();
            }
        }
    });

    name.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            if (!allowDuplicateNames) {
                String value = name.getText();
                if (isDuplicateName(value)) {
                    notification.fire(new NotificationEvent(duplicateNameErrorMessage,
                            NotificationEvent.NotificationType.ERROR));
                    name.setValue("");
                    ValueChangeEvent.fire(name, "");
                }
            }
        }
    });
}

From source file:org.jbpm.designer.client.util.AbstractValidatingTextBox.java

License:Apache License

protected void setup() {
    final TextBox me = this;

    //Validate value as it is entered
    this.addKeyPressHandler(new KeyPressHandler() {

        public void onKeyPress(KeyPressEvent event) {

            // Permit navigation
            int keyCode = getKeyCodeFromKeyPressEvent(event);
            if (event.isControlKeyDown()) {
                return;
            }//from  w ww .  jav a 2 s. c o  m
            if (!event.isShiftKeyDown()) {
                if (keyCode == KeyCodes.KEY_BACKSPACE || keyCode == KeyCodes.KEY_DELETE
                        || keyCode == KeyCodes.KEY_LEFT || keyCode == KeyCodes.KEY_RIGHT
                        || keyCode == KeyCodes.KEY_TAB || keyCode == KeyCodes.KEY_HOME
                        || keyCode == KeyCodes.KEY_END) {
                    return;
                }
            }

            // Get new value and validate
            int charCode = event.getCharCode();
            String oldValue = me.getValue();
            String newValue = oldValue.substring(0, me.getCursorPos());
            newValue = newValue + ((char) charCode);
            newValue = newValue + oldValue.substring(me.getCursorPos() + me.getSelectionLength());
            String validationError = isValidValue(newValue, false);
            if (validationError != null) {
                event.preventDefault();
                fireValidationError(validationError);
            }
        }
    });

    //Add validation when loses focus (for when values are pasted in by user)
    this.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            String value = me.getText();
            String validationError = isValidValue(value, true);
            if (validationError != null) {
                fireValidationError(validationError);
                String validValue = makeValidValue(value);
                me.setValue(validValue);
                ValueChangeEvent.fire(AbstractValidatingTextBox.this, validValue);
            }
        }
    });
}

From source file:org.jrydberg.bindings.client.AbstractBinding.java

License:Apache License

private void onSourceChange(boolean fireEvents) {
    S oldCachedSource = cachedSource;//from  w w  w.  j  a  v  a  2 s .c om
    cachedSource = sourceBox.getValue();

    if (oldCachedSource != cachedSource) {
        if (getPropertyName() != null) {
            if (oldCachedSource instanceof HasProperties) {
                ((HasProperties) oldCachedSource).removePropertyChangeListener(getPropertyName(), this);
            }
            if (cachedSource instanceof HasProperties) {
                ((HasProperties) cachedSource).addPropertyChangeListener(getPropertyName(), this);
            }
        }
    }

    T oldCachedValue = cachedValue;
    cachedValue = this.getValue();
    if (cachedValue != oldCachedValue && fireEvents) {
        ValueChangeEvent.fire(this, cachedValue);
    }
}

From source file:org.jrydberg.bindings.client.AbstractBinding.java

License:Apache License

@Override
public void setValue(T value, boolean fireEvents) {
    this.setValue(value);
    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }//w  w  w . jav a  2 s .c  om
}

From source file:org.jrydberg.ui.client.ToggleButton.java

License:Apache License

@Override
public void setValue(Boolean value, boolean fireEvents) {
    if (value.booleanValue()) {
        addStyleName(resources.buttonCss().active());
    } else {/*from  w w w . j a  va2  s . co  m*/
        removeStyleName(resources.buttonCss().active());
    }
    this.value = value;
    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.AbstractFieldWidget.java

License:Apache License

protected void fireChanged() {
    ValueChangeEvent.fire(this, value);
}

From source file:org.kie.guvnor.decoratedgrid.client.widget.DynamicColumn.java

License:Apache License

public void setSortable(final boolean isSortable) {
    this.sortConfig.setSortable(isSortable);
    ValueChangeEvent.fire(this, sortConfig);
}

From source file:org.kie.guvnor.decoratedgrid.client.widget.DynamicColumn.java

License:Apache License

public void setSortDirection(final SortDirection sortDirection) {
    this.sortConfig.setSortDirection(sortDirection);
    if (sortDirection == SortDirection.NONE) {
        this.sortConfig.setSortIndex(-1);
    }//from w w  w  .ja  v  a2  s .c  om
    ValueChangeEvent.fire(this, sortConfig);
}

From source file:org.kie.guvnor.decoratedgrid.client.widget.DynamicColumn.java

License:Apache License

public void setSortIndex(final int sortIndex) {
    if (sortIndex < 0) {
        throw new IllegalArgumentException("sortIndex cannot be less than zero");
    }// w w w. ja  v a2s. c o  m
    this.sortConfig.setSortIndex(sortIndex);
    ValueChangeEvent.fire(this, sortConfig);
}

From source file:org.kie.uberfire.client.common.AbstractRestrictedEntryTextBox.java

License:Apache License

protected void setup() {
    final TextBox me = this;

    //Validate value as it is entered
    this.addKeyPressHandler(new KeyPressHandler() {

        public void onKeyPress(KeyPressEvent event) {

            // Permit navigation
            int keyCode = event.getNativeEvent().getKeyCode();
            if (event.isControlKeyDown() || keyCode == KeyCodes.KEY_BACKSPACE || keyCode == KeyCodes.KEY_DELETE
                    || keyCode == KeyCodes.KEY_LEFT || keyCode == KeyCodes.KEY_RIGHT
                    || keyCode == KeyCodes.KEY_TAB || keyCode == KeyCodes.KEY_HOME
                    || keyCode == KeyCodes.KEY_END) {
                return;
            }/*from   w  ww  . j a  v a 2  s .c o  m*/

            // Get new value and validate
            int charCode = event.getCharCode();
            String oldValue = me.getValue();
            String newValue = oldValue.substring(0, me.getCursorPos());
            newValue = newValue + ((char) charCode);
            newValue = newValue + oldValue.substring(me.getCursorPos() + me.getSelectionLength());
            if (!isValidValue(newValue, false)) {
                event.preventDefault();
            }

        }

    });

    //Add validation when looses focus (for when values are pasted in by users')
    this.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            final String value = me.getText();
            if (!isValidValue(value, true)) {
                final String validValue = makeValidValue(value);
                me.setText(validValue);
                ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this, validValue);
            }
        }

    });

}