List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent fire
public static <T> void fire(HasValueChangeHandlers<T> source, T value)
From source file:org.overlord.sramp.ui.client.local.pages.details.ClassifiersPanel.java
License:Apache License
/** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) *///from ww w. jav a 2 s . c o 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"); //$NON-NLS-1$ 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"); //$NON-NLS-1$ add(classifierLabel); add(clearFix); } } if (fireEvents) { ValueChangeEvent.fire(this, this.value); } }
From source file:org.overlord.sramp.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 av a 2s. c om*/ @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 + ":"); //$NON-NLS-1$ propLabel.setStyleName("sramp-meta-data-section-label"); //$NON-NLS-1$ 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"); //$NON-NLS-1$ Label clearFix = new Label(); clearFix.setStyleName("clearfix"); //$NON-NLS-1$ add(propLabel); add(propValueWidget); add(clearFix); } } if (fireEvents) { ValueChangeEvent.fire(this, this.value); } }
From source file:org.overlord.sramp.ui.client.local.pages.details.ModifyClassifiersDialog.java
License:Apache License
/** * Called when the user clicks the submit button. * @param event/*w w w .j a v a2 s .c o m*/ */ @EventHandler("modify-classifiers-dialog-btn-ok") protected void onSubmit(ClickEvent event) { Set<String> newValue = new HashSet<String>(); Set<Entry<String, OntologySelectorWithToolbar>> entrySet = selectors.entrySet(); for (Entry<String, OntologySelectorWithToolbar> entry : entrySet) { String base = entry.getKey(); OntologySelectorWithToolbar selector = entry.getValue(); Set<String> selection = selector.getSelection(); for (String id : selection) { String uri = base + "#" + id; //$NON-NLS-1$ newValue.add(uri); } } this.value = new ArrayList<String>(newValue); if (!newValue.equals(this.originalValue)) { ValueChangeEvent.fire(this, this.value); } hide(); }
From source file:org.overlord.sramp.ui.client.local.pages.ontologies.EditOntologyNodeDialog.java
License:Apache License
/** * Called when the user clicks the submit button. * @param event//from w ww.j ava 2 s . co m */ @EventHandler("edit-ontology-node-submit-button") protected void onSubmit(ClickEvent event) { OntologyClassBean bean = new OntologyClassBean(); bean.setComment(comment.getValue()); bean.setLabel(label.getValue()); ValueChangeEvent.fire(this, bean); hide(); }
From source file:org.overlord.sramp.ui.client.local.pages.ontologies.OntologiesTable.java
License:Apache License
@Override public void setValue(TreeMap<String, OntologySummaryBean> value, boolean fireEvents) { this.value = value; if (fireEvents) { ValueChangeEvent.fire(this, value); }//from w w w .ja v a 2 s . c om this.clear(); for (OntologySummaryBean ontologyClass : value.values()) { this.addRow(ontologyClass); } }
From source file:org.overlord.sramp.ui.client.local.pages.ontologies.OntologyEditorTierItem.java
License:Apache License
/** * Called when the user clicks the Remove action. */ protected void onRemove() { ValueChangeEvent.fire(this, null); }
From source file:org.overlord.sramp.ui.client.local.pages.ontologies.OntologyEditorTierItem.java
License:Apache License
/** * Called when the user clicks the Edit action. *//*from w w w .ja v a2s. c o m*/ protected void onEdit() { EditOntologyNodeDialog dialog = dialogFactory.get(); dialog.init(getValue()); dialog.addValueChangeHandler(new ValueChangeHandler<OntologyClassBean>() { @Override public void onValueChange(ValueChangeEvent<OntologyClassBean> event) { OntologyClassBean updatedValue = event.getValue(); OntologyClassBean currentValue = getValue(); currentValue.setLabel(updatedValue.getLabel()); currentValue.setComment(updatedValue.getComment()); label.setText(createLabel(currentValue)); ValueChangeEvent.fire(OntologyEditorTierItem.this, currentValue); } }); dialog.show(); }
From source file:org.overlord.sramp.ui.client.local.pages.ontologies.OntologySummaryPanelItem.java
License:Apache License
/** * Called when the user clicks the Delete action. *//*from w ww . j av a2s . co m*/ protected void onDelete() { final NotificationBean notificationBean = notificationService.startProgressNotification( i18n.format("ontology-deleting.title"), //$NON-NLS-1$ i18n.format("ontology-deleting.message")); //$NON-NLS-1$ ontologyService.delete(getValue().getUuid(), new IServiceInvocationHandler<Void>() { @Override public void onReturn(Void data) { notificationService.completeProgressNotification(notificationBean.getUuid(), i18n.format("ontology-deleted.title"), //$NON-NLS-1$ i18n.format("ontology-deleted.message", getValue().getId())); //$NON-NLS-1$ ValueChangeEvent.fire(OntologySummaryPanelItem.this, null); } @Override public void onError(Throwable error) { notificationService.completeProgressNotification(notificationBean.getUuid(), i18n.format("ontology-deleted-error.title"), error); //$NON-NLS-1$ } }); }
From source file:org.ovirt.engine.ui.common.widget.SliderBar.java
License:Apache License
/** * Set the current value and optionally fire the onValueChange event. * * @param curValue//from w w w . ja v a 2s . c om * the current value * @param fireEvent * fire the onValue change event if true */ public void setCurrentValue(double curValue, boolean fireEvent) { // Confine the value to the range this.curValue = Math.max(minValue, Math.min(maxValue, curValue)); double remainder = (this.curValue - minValue) % stepSize; this.curValue -= remainder; // Go to next step if more than halfway there if ((remainder > (stepSize / 2)) && ((this.curValue + stepSize) <= maxValue)) { this.curValue += stepSize; } // Redraw the knob drawKnob(); // Fire the ValueChangeEvent if (fireEvent) { ValueChangeEvent.fire(this, this.curValue.intValue()); } }
From source file:org.rest.client.ui.html5.HTML5Progress.java
License:Apache License
@Override public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Integer> handler) { if (!valueChangeHandlerInitialized) { valueChangeHandlerInitialized = true; addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { ValueChangeEvent.fire(HTML5Progress.this, getValue()); }/*w w w. ja va 2 s .c o m*/ }); } return addHandler(handler, ValueChangeEvent.getType()); }