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:gwt.material.design.addins.client.autocomplete.MaterialAutoComplete.java
License:Apache License
/** * Generate and build the List Items to be set on Auto Complete box. *//* w w w . j a v a2 s.co m*/ protected void setup(SuggestOracle suggestions) { if (itemBoxKeyDownHandler != null) { itemBoxKeyDownHandler.removeHandler(); } list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST); this.suggestions = suggestions; final ListItem item = new ListItem(); item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN); suggestBox = new SuggestBox(suggestions, itemBox); suggestBox.addSelectionHandler(selectionEvent -> { Suggestion selectedItem = selectionEvent.getSelectedItem(); itemBox.setValue(""); if (addItem(selectedItem)) { ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); } itemBox.setFocus(true); }); loadHandlers(); setLimit(this.limit); String autocompleteId = DOM.createUniqueId(); itemBox.getElement().setId(autocompleteId); item.add(suggestBox); item.add(label); list.add(item); panel.add(list); panel.getElement().setAttribute("onclick", "document.getElementById('" + autocompleteId + "').focus()"); panel.add(errorLabel); suggestBox.setFocus(true); }
From source file:gwt.material.design.addins.client.autocomplete.MaterialAutoComplete.java
License:Apache License
/** * Adding the item value using Material Chips added on auto complete box */// w w w. ja va 2s . c o m protected boolean addItem(final Suggestion suggestion) { SelectionEvent.fire(MaterialAutoComplete.this, suggestion); if (getLimit() > 0) { if (suggestionMap.size() >= getLimit()) { return false; } } if (suggestionMap.containsKey(suggestion)) { return false; } final ListItem displayItem = new ListItem(); displayItem.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_TOKEN); if (getType() == AutocompleteType.TEXT) { suggestionMap.clear(); itemBox.setText(suggestion.getReplacementString()); } else { final MaterialChip chip = chipProvider.getChip(suggestion); if (chip == null) { return false; } registerHandler(chip.addClickHandler(event -> { if (chipProvider.isChipSelectable(suggestion)) { if (itemsHighlighted.contains(displayItem)) { chip.removeStyleName(selectedChipStyle); itemsHighlighted.remove(displayItem); } else { chip.addStyleName(selectedChipStyle); itemsHighlighted.add(displayItem); } } })); if (chip.getIcon() != null) { registerHandler(chip.getIcon().addClickHandler(event -> { if (chipProvider.isChipRemovable(suggestion)) { suggestionMap.remove(suggestion); list.remove(displayItem); itemsHighlighted.remove(displayItem); ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); suggestBox.showSuggestionList(); } })); } suggestionMap.put(suggestion, chip); displayItem.add(chip); list.insert(displayItem, list.getWidgetCount() - 1); } return true; }
From source file:gwt.material.design.addins.client.camera.Html5Camera.java
License:Apache License
protected void captureToDataURL() { File file = toFile(imageFileInput.getElement()); FileReader reader = new FileReader(); $(reader).on("load", e -> { imageUrl = reader.result;/* w w w .j av a 2 s. com*/ ValueChangeEvent.fire(this, imageUrl); return true; }); if (file != null) { reader.readAsDataURL(file); } else { GWT.log("Please provide a file before reading the file.", new NullPointerException()); } }
From source file:gwt.material.design.addins.client.carousel.MaterialCarousel.java
License:Apache License
@Override public void setValue(List<String> values, boolean fireEvent) { this.values = values; container.clear();//from ww w . j av a2 s . c om for (String value : values) { MaterialImage image = new MaterialImage(value); container.add(image); if (isAttached()) { reload(); } } if (fireEvent) { ValueChangeEvent.fire(this, values); } }
From source file:gwt.material.design.addins.client.combobox.MaterialComboBox.java
License:Apache License
@Override public void load() { JsComboBox jsComboBox = $(listbox.getElement()); jsComboBox.select2(options);/*from w w w . ja v a 2 s. c om*/ jsComboBox.on(ComboBoxEvents.CHANGE, event -> { if (!suppressChangeEvent) { ValueChangeEvent.fire(this, getValue()); } return true; }); jsComboBox.on(ComboBoxEvents.SELECT, event -> { SelectItemEvent.fire(this, getValue()); displayArrowForAllowClearOption(false); return true; }); jsComboBox.on(ComboBoxEvents.UNSELECT, event -> { UnselectItemEvent.fire(this, getValue()); displayArrowForAllowClearOption(true); return true; }); jsComboBox.on(ComboBoxEvents.OPEN, (event1, o) -> { OpenEvent.fire(this, null); return true; }); jsComboBox.on(ComboBoxEvents.CLOSE, (event1, o) -> { CloseEvent.fire(this, null); return true; }); displayArrowForAllowClearOption(false); if (getTextColor() != null) { $(getElement()).find(".select2-selection__rendered").css("color", getTextColor().getCssName()); } }
From source file:gwt.material.design.addins.client.datetimepicker.MaterialDateTimePicker.java
License:Apache License
private void fireValueChangeEvent() { ValueChangeEvent.fire(this, this.time); }
From source file:gwt.material.design.addins.client.rating.MaterialRating.java
License:Apache License
@Override public void setValue(Integer value, boolean fireEvents) { currentRating = value;/*from www . j a v a2 s . c om*/ revalidateSelection(currentRating); if (fireEvents) { ValueChangeEvent.fire(this, value); } }
From source file:gwt.material.design.addins.client.richeditor.MaterialRichEditor.java
License:Apache License
@Override public void load() { JsRichEditor jsRichEditor = $(getElement()); options.toolbar = manager.getToolbars(); options.placeholder = getPlaceholder(); options.height = getHeight();/* w w w .j ava 2 s .co m*/ jsRichEditor.materialnote(options); // Events jsRichEditor.on(RichEditorEvents.MATERIALNOTE_BLUR, event -> { fireEvent(new BlurEvent() { }); return true; }); jsRichEditor.on(RichEditorEvents.MATERIALNOTE_FOCUS, event -> { fireEvent(new FocusEvent() { }); return true; }); jsRichEditor.on(RichEditorEvents.MATERIALNOTE_KEYUP, event -> { fireEvent(new KeyUpEvent() { }); return true; }); jsRichEditor.on(RichEditorEvents.MATERIALNOTE_KEYDOWN, event -> { fireEvent(new KeyDownEvent() { }); return true; }); jsRichEditor.on(RichEditorEvents.MATERIALNOTE_PASTE, event -> { fireEvent(new PasteEvent() { }); return true; }); jsRichEditor.on(RichEditorEvents.MATERIALNOTE_CHANGE, event -> { ValueChangeEvent.fire(MaterialRichEditor.this, getHTMLCode(getElement())); return true; }); checkContainer(); }
From source file:gwt.material.design.addins.client.signature.MaterialSignaturePad.java
License:Apache License
public SignaturePad getSignaturePad() { if (signaturePad == null) { options.onBegin = () -> SignatureStartEvent.fire(this); options.onEnd = () -> {//from w w w . ja v a 2 s . c o m SignatureEndEvent.fire(this); ValueChangeEvent.fire(this, getSignaturePad().toDataURL()); }; signaturePad = new SignaturePad(getElement(), options); } return signaturePad; }
From source file:gwt.material.design.addins.client.ui.MaterialAutoComplete.java
License:Apache License
@Override public void setValue(List<? extends SuggestOracle.Suggestion> value, boolean fireEvents) { clear();// www .j a v a 2 s .c o m if (value != null) { for (SuggestOracle.Suggestion suggestion : value) { //addItem(suggestion); } } if (fireEvents) { ValueChangeEvent.fire(this, getValue()); } }