Java Code Examples for com.google.gwt.event.logical.shared.SelectionEvent#fire()

The following examples show how to use com.google.gwt.event.logical.shared.SelectionEvent#fire() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaterialTreeItem.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
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);
            }
        }
        // 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;
        }
    }
}
 
Example 2
Source File: DefaultTabLayoutPanel.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void selectTab(final int index) {
    if (index < PAGE_LIMIT) {
        // visible pages
        flagSelected(prevSelectedIndex, false);
        super.selectTab(index);
        flagSelected(index, true);
        prevSelectedIndex = index;

        if (index == PAGE_LIMIT - 1 && offPageContainer.getSelectedDeck() == -1) {
            offPageContainer.selectDeck(0);
        }

    } else {
        // off page
        offPageContainer.selectDeck(offPageIndex(index));
        if (getSelectedIndex() == PAGE_LIMIT - 1) {
            SelectionEvent.fire(this, PAGE_LIMIT - 1);
        }
        tabs.lastTab().setText(offPageContainer.getTexts().get(offPageIndex(index)).getText());
        selectTab(PAGE_LIMIT - 1);
    }
}
 
Example 3
Source File: MaterialStep.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
@Override
protected void onLoad() {
    super.onLoad();

    ClickHandler handler = event -> {
        if (isEnabled() && isVisible()) {
            SelectionEvent.fire(MaterialStep.this, MaterialStep.this);
        }
    };
    registerHandler(header.addClickHandler(handler));
    registerHandler(divTitle.addClickHandler(handler));
    registerHandler(divDescription.addClickHandler(handler));
}
 
Example 4
Source File: GroupToggleButtonTest.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void testSelectionHandler() {
    Integer SELECTED_ITEM = 1;
    GroupToggleButton<Integer> button = getWidget();

    final boolean[] selectionFired = {false};
    button.addSelectionHandler((SelectionEvent<Integer> selectionEvent) -> {
        assertEquals(SELECTED_ITEM, selectionEvent.getSelectedItem());
        selectionFired[0] = true;
    });

    SelectionEvent.fire(button, SELECTED_ITEM);
    assertTrue(selectionFired[0]);
}
 
Example 5
Source File: DebugPanelFilterWidget.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void selectItem(Item item, int idx) {
  if (item != selected) {
    if (selected != null) {
      selected.setSelected(false);
    }
    selected = item;
    if (selected != null) {
      selected.setSelected(true);
    }
    SelectionEvent.fire(this, idx);
  }
}
 
Example 6
Source File: DefaultTabLayoutPanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Selects the tab with the specified text. If there's no tab with the specified text, the selected tab remains
 * unchanged. If there's more than one tab with the specified text, the first one will be selected.
 *
 * @param text
 */
@Override
public void selectTab(final String text) {
    for (int i = 0; i < tabs.size(); i++) {
        if (text.equals(tabs.get(i).getText())) {
            selectTab(i);
            return;
        }
    }

    // not found in visible tabs, should be in off-page
    for (OffPageText opt : offPageContainer.getTexts()) {
        if (text.equals(opt.getText())) {
            if (opt.getIndex() == 0) {
                // the first off-page needs special treatment
                offPageContainer.selectDeck(opt.getIndex());
                if (getSelectedIndex() == PAGE_LIMIT - 1) {
                    SelectionEvent.fire(this, PAGE_LIMIT - 1);
                }
                tabs.lastTab().setText(opt.getText());
                selectTab(PAGE_LIMIT - 1);
            } else {
                selectTab(PAGE_LIMIT - 1 + opt.getIndex());
            }
        }
    }
}
 
Example 7
Source File: ExtendedTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * fire a change event
 */
private void fireSelection(TreeItem treeItem) {
	// SelectElement nativeEvent = Document.get().createSelectElement();
	SelectionEvent.fire(this, treeItem);
	// setSelectedItem(treeItem); // Now is not necessary select treeItem here is done by capturing events
}
 
Example 8
Source File: GroupToggleButton.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
public void fireSelectionEvent(ToggleButton toggleButton) {
    SelectionEvent.fire(this, values.get(items.indexOf(toggleButton)));
}
 
Example 9
Source File: AriaSuggestBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
private void fireSuggestionEvent(Suggestion selectedSuggestion) {
	SelectionEvent.fire(this, selectedSuggestion);
}
 
Example 10
Source File: TimeSelector.java    From unitime with Apache License 2.0 4 votes vote down vote up
private void fireSuggestionEvent(Integer selectedTimeSlot) {
	SelectionEvent.fire(this, selectedTimeSlot);
}
 
Example 11
Source File: FilterBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
private void fireSelectionEvent(Suggestion suggestion) {
	SelectionEvent.fire(this, suggestion);
}