Example usage for com.google.gwt.event.logical.shared SelectionEvent fire

List of usage examples for com.google.gwt.event.logical.shared SelectionEvent fire

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared SelectionEvent fire.

Prototype

public static <T> void fire(HasSelectionHandlers<T> source, T selectedItem) 

Source Link

Document

Fires a selection event on all registered handlers in the handler manager.If no such handlers exist, this method will do nothing.

Usage

From source file:com.ikon.frontend.client.widget.foldertree.ExtendedTree.java

License:Open Source License

/**
 * fire a change event/*from  w ww . ja  v  a 2 s . c om*/
 */
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
}

From source file:com.novartis.pcs.ontology.webapp.client.view.ApproveRejectPopup.java

License:Apache License

@Override
public void show() {
    dialogBox.show();/*from w w w.jav a2s  . c  om*/
    SelectionEvent.fire(tabPanel, currentTabIndex);
    /*
    dialogBox.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
       @Override
       public void setPosition(int offsetWidth, int offsetHeight) {
    dialogBox.setPopupPosition(
          Window.getClientWidth() - offsetWidth, 0);
       }
    });
    */
}

From source file:com.seanchenxi.gwt.serenity.client.widget.NavigationBar.java

License:Apache License

void fireSelectionEvent(NavigationItem item) {
    if (select(item)) {
        SelectionEvent.fire(NavigationBar.this, selectedItem);
    }
}

From source file:com.seanchenxi.gwt.serenity.client.widget.PopupLabelBox.java

License:Apache License

private void fireSelectionEvent(final Label label) {
    if (select(label)) {
        SelectionEvent.fire(PopupLabelBox.this, label);
    }// w w w . j a v  a 2s .c om
}

From source file:com.sencha.gxt.widget.core.client.menu.Item.java

License:sencha.com license

@SuppressWarnings({ "unchecked", "rawtypes" })
protected void onClick(NativeEvent be) {
    be.<XEvent>cast().stopEvent();

    BeforeSelectionEvent<Item> itemEvent = BeforeSelectionEvent.fire(this, this);

    BeforeSelectionEvent<Item> menuEvent = null;

    if (getParent() instanceof HasBeforeSelectionHandlers<?>) {
        menuEvent = BeforeSelectionEvent.fire((HasBeforeSelectionHandlers) getParent(), this);
    }//from   w ww  . ja  v  a  2s .c  o  m

    if (!disabled && (itemEvent == null || !itemEvent.isCanceled())
            && (menuEvent == null || !menuEvent.isCanceled())) {
        if (getParent() instanceof HasSelectionHandlers<?>) {
            SelectionEvent.fire((HasSelectionHandlers) getParent(), this);
        }

        SelectionEvent.fire(this, this);
        handleClick(be);
    }
}

From source file:com.sencha.gxt.widget.core.client.selection.AbstractStoreSelectionModel.java

License:sencha.com license

protected void doMultiSelect(List<M> models, boolean keepExisting, boolean suppressEvent) {
    if (locked)/*ww  w. ja v  a2  s  .  com*/
        return;
    boolean change = false;
    if (!keepExisting && selected.size() > 0) {
        change = true;
        doDeselect(new ArrayList<M>(selected), true);
    }
    for (M m : models) {
        boolean isSelected = isSelected(m);
        if (!suppressEvent && !isSelected) {
            BeforeSelectionEvent<M> evt = BeforeSelectionEvent.fire(this, m);
            if (evt != null && evt.isCanceled()) {
                continue;
            }
        }

        change = true;
        lastSelected = m;

        selected.add(m);
        setLastFocused(lastSelected);

        if (!isSelected) {
            onSelectChange(m, true);
            if (!suppressEvent) {
                SelectionEvent.fire(this, m);
            }
        }
    }

    if (change && !suppressEvent) {
        fireSelectionChange();
    }
}

From source file:com.sencha.gxt.widget.core.client.selection.AbstractStoreSelectionModel.java

License:sencha.com license

protected void doSingleSelect(M model, boolean suppressEvent) {
    if (locked)//  w w  w.  j av  a  2  s  .c  o  m
        return;

    int index = -1;
    if (store instanceof ListStore) {
        ListStore<M> ls = (ListStore<M>) store;
        index = ls.indexOf(model);
    }
    if (store instanceof TreeStore) {
        TreeStore<M> ls = (TreeStore<M>) store;
        index = ls.indexOf(model);
    }
    if (index == -1 || isSelected(model)) {
        return;
    } else {
        if (!suppressEvent) {
            BeforeSelectionEvent<M> evt = BeforeSelectionEvent.fire(this, model);
            if (evt != null && evt.isCanceled()) {
                return;
            }
        }
    }

    boolean change = false;
    if (selected.size() > 0 && !isSelected(model)) {
        doDeselect(Collections.singletonList(lastSelected), true);
        change = true;
    }
    if (selected.size() == 0) {
        change = true;
    }
    selected.add(model);
    lastSelected = model;
    onSelectChange(model, true);
    setLastFocused(lastSelected);

    if (!suppressEvent) {
        SelectionEvent.fire(this, model);
    }

    if (change && !suppressEvent) {
        fireSelectionChange();
    }
}

From source file:com.sencha.gxt.widget.core.client.TabPanel.java

License:sencha.com license

/**
 * Sets the active widget./*  w w  w .j a va  2  s.  c  o  m*/
 * 
 * @param item the widget
 * @param fireEvents {@code true} to fire events
 */
public void setActiveWidget(Widget item, boolean fireEvents) {
    if (item == null || item.getParent() != container) {
        return;
    }

    if (getActiveWidget() != item) {
        if (fireEvents) {
            BeforeSelectionEvent<Widget> event = BeforeSelectionEvent.fire(this, item);
            // event can be null if no handlers
            if (event != null && event.isCanceled()) {
                return;
            }
        }

        if (getActiveWidget() != null) {
            appearance.onDeselect(findItem(getWidgetIndex(getActiveWidget())));
        }
        appearance.onSelect(findItem(getWidgetIndex(item)));
        container.setActiveWidget(item);

        if (stack == null) {
            stack = new AccessStack<Widget>();
        }
        stack.add(item);

        focusTab(item, false);
        if (fireEvents) {
            SelectionEvent.fire(this, item);
        }
        delegateUpdates();
    }
}

From source file:com.square.client.gwt.client.composant.onglet.scroll.DoubleTabPanelScroll.java

License:Open Source License

private void fireSelectionEvent(Integer selectedItem) {
    SelectionEvent.fire(this, selectedItem);
}

From source file:com.ui.gwt.mobile.client.components.ContactListPanel.java

License:Apache License

@Override
public void onBrowserEvent(Event event) {
    PerfTimer timer = PerfTimer.get(this, "onBrowserEvent");
    Element target = Element.as(event.getEventTarget());
    int index = getTargetItemIndex(target);
    if (index != -1) {
        //Don't need to support de-select since there is no gesture modifier
        Element.as(getElement().getChildNodes().getItem(selected))
                .removeClassName(AppResources.INSTANCE.css().selected());
        Element.as(getElement().getChildNodes().getItem(index))
                .addClassName(AppResources.INSTANCE.css().selected());
        SelectionEvent.fire(this, data.get(index));
        this.selected = index;
    }/*from   w  w  w. j a  va2s  .  c  o  m*/
    timer.end();
}