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.artificer.ui.client.local.pages.artifacts.ClassifierFilterSelectionDialog.java

License:Apache License

/**
 * Called when the user clicks the OK button.
 * @param event/*from   w  w w  .j  ava  2s  .  c om*/
 */
@EventHandler("classifier-dialog-btn-ok")
public void onOkClick(ClickEvent event) {
    // Gather up everything that was checked in the UI
    this.value = selector.getSelection();
    ValueChangeEvent.fire(this, this.value);
    hide();
}

From source file:org.artificer.ui.client.local.pages.artifacts.CommentsPanel.java

License:Apache License

public void addComment(ArtifactCommentBean commentBean) {
    value.add(commentBean);
    createComment(commentBean);
    ValueChangeEvent.fire(this, value);
}

From source file:org.artificer.ui.client.local.pages.artifacts.CommentsPanel.java

License:Apache License

@Override
public void setValue(List<ArtifactCommentBean> value, boolean fireEvents) {
    this.value = value;

    for (ArtifactCommentBean commentBean : value) {
        createComment(commentBean);//from  w  ww .ja v  a 2s.  c  om
    }

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

From source file:org.artificer.ui.client.local.pages.artifacts.CustomPropertyFilter.java

License:Apache License

/**
 * Post construct./*from  ww  w . j  av a  2  s . c o m*/
 */
@PostConstruct
protected void onPostConstruct() {
    label.setSupportsEdit(false);
    label.setSupportsRemove(true);
    label.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() == null) {
                GWT.log("Firing null value change event!");
                ValueChangeEvent.fire(CustomPropertyFilter.this, null);
            }
        }
    });
    input.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            ValueChangeEvent.fire(CustomPropertyFilter.this, event.getValue());
        }
    });
}

From source file:org.artificer.ui.client.local.pages.artifacts.CustomPropertyFilters.java

License:Apache License

/**
 * Called to add another custom property filter.
 * @param propertyName/*  w  w w.  j ava2  s  .c  o m*/
 */
public void addPropertyFilter(String propertyName) {
    CustomPropertyFilter filter = this.customPropertyFilterFactory.get();
    filter.setPropertyName(propertyName);
    filter.addValueChangeHandler(this);
    this.add(filter);
    this.filters.add(filter);
    ValueChangeEvent.fire(this, getValue());
}

From source file:org.artificer.ui.client.local.pages.artifacts.CustomPropertyFilters.java

License:Apache License

/**
 * @see com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)
 *//*  ww  w.ja va 2 s  .c  o  m*/
@Override
public void onValueChange(ValueChangeEvent<String> event) {
    // One of the filters was removed
    if (event.getValue() == null) {
        CustomPropertyFilter filter = (CustomPropertyFilter) event.getSource();
        remove(filter);
        filters.remove(filter);
    }
    ValueChangeEvent.fire(this, getValue());
}

From source file:org.artificer.ui.client.local.pages.details.AddCustomPropertyDialog.java

License:Apache License

/**
 * Called when the user clicks the submit button.
 * @param event// www .  j a  v a2 s .  co m
 */
@EventHandler("add-property-submit-button")
protected void onSubmit(ClickEvent event) {
    final String key = name.getValue();
    final String val = value.getValue();
    ValueChangeEvent.fire(this, new Map.Entry<String, String>() {
        @Override
        public String setValue(String value) {
            return null;
        }

        @Override
        public String getValue() {
            return val;
        }

        @Override
        public String getKey() {
            return key;
        }
    });
    hide();
}

From source file:org.artificer.ui.client.local.pages.details.AddRelationshipDialog.java

License:Apache License

/**
 * Called when the user clicks the next button.
 * @param event/*  w w w. ja v  a  2s.  c  o m*/
 */
@EventHandler("add-relationship-next-button")
protected void onNext(ClickEvent event) {
    ValueChangeEvent.fire(this, relationshipType.getValue());
    hide();
}

From source file:org.artificer.ui.client.local.pages.details.ClassifiersPanel.java

License:Apache License

/**
 * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean)
 *///from   www .j  a  v a 2 s . co  m
@Override
public void setValue(List<String> value, boolean fireEvents) {
    clear();
    if (value == null || value.isEmpty()) {
        this.value = null;
    } else {
        this.value = new ArrayList<String>(value);
        Set<String> classifiers = new TreeSet<String>(value);
        for (final String classifier : classifiers) {
            EditableInlineLabel classifierLabel = editableLabelFactory.get();
            classifierLabel.setValue(classifier);
            classifierLabel.setSupportsEdit(false);
            classifierLabel.setSupportsRemove(true);
            classifierLabel.setStyleName("sramp-meta-data-section-label");
            classifierLabel.addValueChangeHandler(new ValueChangeHandler<String>() {
                @Override
                public void onValueChange(ValueChangeEvent<String> event) {
                    if (event.getValue() == null) {
                        List<String> newValue = new ArrayList<String>(ClassifiersPanel.this.value);
                        newValue.remove(classifier);
                        setValue(newValue, true);
                    }
                    // Editing an existing classifier is not currently supported - instead users
                    // must remove and then add.
                }
            });
            InlineLabel clearFix = new InlineLabel();
            clearFix.setStyleName("clearfix");
            add(classifierLabel);
            add(clearFix);
        }
    }
    if (fireEvents) {
        ValueChangeEvent.fire(this, this.value);
    }
}

From source file:org.artificer.ui.client.local.pages.details.CustomPropertiesPanel.java

License:Apache License

/**
 * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean)
 *//*from www . j  a v  a 2s.co  m*/
@Override
public void setValue(Map<String, String> value, boolean fireEvents) {
    this.value = new HashMap<String, String>(value);
    clear();
    if (value == null || value.isEmpty()) {
        // Put something here?  "No Properties found..." ?
    } else {
        Set<String> keys = new TreeSet<String>(value.keySet());
        for (final String propName : keys) {
            String propValue = value.get(propName);
            Label propLabel = new Label(propName + ":");
            propLabel.setStyleName("sramp-meta-data-section-label");
            CustomPropertyEditableInlineLabel propValueWidget = propValueLabelFactory.get();
            propValueWidget.addValueChangeHandler(new ValueChangeHandler<String>() {
                @Override
                public void onValueChange(ValueChangeEvent<String> event) {
                    Map<String, String> newValue = new HashMap<String, String>(
                            CustomPropertiesPanel.this.value);
                    String val = event.getValue();
                    if (val == null) {
                        newValue.remove(propName);
                    } else {
                        newValue.put(propName, val);
                    }
                    setValue(newValue, true);
                }
            });
            propValueWidget.setValue(propValue);
            propValueWidget.setStyleName("sramp-meta-data-section-value");
            Label clearFix = new Label();
            clearFix.setStyleName("clearfix");
            add(propLabel);
            add(propValueWidget);
            add(clearFix);
        }
    }
    if (fireEvents) {
        ValueChangeEvent.fire(this, this.value);
    }
}