List of usage examples for com.google.gwt.event.logical.shared SelectionEvent fire
public static <T> void fire(HasSelectionHandlers<T> source, T selectedItem)
From source file:es.upm.fi.dia.oeg.map4rdf.client.maplet.stats.StatisticsSelectionDialog.java
License:Open Source License
private void createUi() { getContentPanel().add(new HTML("<h2>" + messages.statistics() + ":</h2>")); getContentPanel().add(datasetList);//ww w . j a v a 2 s . co m getContentPanel().add(new HTML("<br />")); selectButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { StatisticDefinition statistic = new StatisticDefinition(getSelectedDataset()); SelectionEvent.fire(StatisticsSelectionDialog.this, statistic); hide(); } }); selectButton.setText(messages.select()); getContentPanel().add(selectButton); }
From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.StatisticsSelectionDialog.java
License:Open Source License
private void createUi() { getContentPanel().add(new HTML("<h2>" + messages.statistics() + ":</h2>")); getContentPanel().add(datasetList);/*ww w. j a va2s . co m*/ getContentPanel().add(new HTML("<br />")); selectButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { StatisticDefinition statistic = new StatisticDefinition(getSelectedDataset()); SelectionEvent.fire(StatisticsSelectionDialog.this, statistic); hide(); } }); selectButton.setText(messages.select()); getContentPanel().add(selectButton); }
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 ww .ja v a 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.base.mixin.TreeItemMixin.java
License:Apache License
@Override public void initTreeItem() { MaterialTreeItem item = (MaterialTreeItem) uiObject; // Fire selection event SelectionEvent.fire(getTree(), item); if (!getTreeItems().isEmpty()) { for (MaterialTreeItem treeItem : getTreeItems()) { if (hide) { treeItem.setVisible(false); } else { treeItem.setVisible(true); }/*from w ww . ja va2 s. co m*/ } // Firing of events based on the status of the tree item if (hide) { CloseEvent.fire(getTree(), item); hide = false; } else { OpenEvent.fire(getTree(), item); hide = true; } } }
From source file:gwt.material.design.addins.client.popupmenu.MaterialPopupMenu.java
License:Apache License
private void initializeSelectionEvent() { // Initialization of Selection event $(".popup-menu li").on("click", e -> { e.stopPropagation();/*from w ww . j ava 2 s . c om*/ SelectionEvent.fire(MaterialPopupMenu.this, $(e.getCurrentTarget()).asElement()); $(this).hide(); return true; }); // Check if the dropdown is not visible anymore into it's container either left / bottom side $(".popup-menu li").on("mouseover", (e, param1) -> { JQueryElement item = $(e.getCurrentTarget()).find("a"); if (item.attr("data-activates") != null) { JQueryElement dp = $("#" + item.attr("data-activates")); double dpWidth = dp.width(); double dpLeft = dp.offset().left; double conWidth = body().width(); double dpHeight = 200; double dpTop = dp.offset().top; double conHeight = body().height(); if (dpWidth + dpLeft > conWidth) { dp.addClass(AddinsCssName.EDGE_LEFT); } if (dpHeight + dpTop > conHeight) { dp.addClass(AddinsCssName.EDGE_BOTTOM); } } return true; }); $(".popup-menu li").on("mouseleave", (e, param) -> { JQueryElement item = $(e.getCurrentTarget()).find("a"); if (item.attr("data-activates") != null) { JQueryElement dp = $("#" + item.attr("data-activates")); dp.removeClass(AddinsCssName.EDGE_LEFT); dp.removeClass(AddinsCssName.EDGE_BOTTOM); } return true; }); }
From source file:gwt.material.design.addins.client.stepper.MaterialStep.java
License:Apache License
@Override protected void onLoad() { super.onLoad(); ClickHandler handler = event -> { if (isEnabled() && isVisible()) { SelectionEvent.fire(MaterialStep.this, MaterialStep.this); }/*w w w . j a v a 2 s . c om*/ }; registerHandler(conCircle.addClickHandler(handler)); registerHandler(divTitle.addClickHandler(handler)); registerHandler(divDescription.addClickHandler(handler)); }
From source file:gwt.material.design.addins.client.tree.MaterialTree.java
License:Apache License
/** * Deselect selected tree item//from w w w .ja v a 2s . c o m */ public void deselectSelectedItem() { // Check whether tree has selected item if (selectedItem != null) { clearSelectedStyles(selectedItem); setSelectedItem(null); SelectionEvent.fire(this, null); } }
From source file:gwt.material.design.addins.client.tree.MaterialTreeItem.java
License:Apache License
public void select() { // Fire selection event SelectionEvent.fire(getTree(), this); List<MaterialTreeItem> treeItems = getTreeItems(); if (!treeItems.isEmpty()) { for (MaterialTreeItem treeItem : treeItems) { if (hide) { treeItem.setVisible(false); } else { treeItem.setVisible(true); }//from w w w . j av a2s. c o m } // Firing of events based on the status of the tree item if (hide) { CloseEvent.fire(getTree(), this); hide = false; } else { OpenEvent.fire(getTree(), this); hide = true; } } }
From source file:gwt.material.design.client.MaterialWidgetTestCase.java
License:Apache License
public <H extends MaterialWidget & HasSelectionHandlers> void fireSelectionHandler(H widget, Object index) { assertNotNull(widget);//from w ww . jav a2s .c o m assertNotNull(index); SelectionEvent.fire(widget, index); }
From source file:gwt.material.design.incubator.client.jsontable.JsonTable.java
License:Apache License
@Override public void load() { if (value != null) { setId(DOM.createUniqueId());/*from w w w. j av a2 s .c o m*/ options.id = "#" + getId(); JsTable.jsontotable(value, options); $("tr").mousedown((e, handler) -> { SelectionEvent.fire(JsonTable.this, $(e.target).parent().asElement()); return true; }); } }