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:org.cruxframework.crux.smartfaces.client.storyboard.StoryboardPanel.java

License:Apache License

protected Widget createClickablePanelForCell(Widget widget) {
    final SelectablePanel panel = new SelectablePanel();
    panel.add(widget);/*from w  w  w . j a  v a2s. c om*/
    panel.setStyleName(STORYBOARD_ITEM_STYLE_NAME);
    configHeightWidth(panel);

    panel.addSelectHandler(new SelectHandler() {
        @Override
        public void onSelect(SelectEvent event) {
            int index = mainPanel.getWidgetIndex(panel);
            SelectionEvent.fire(storyboard, index);
            setSelected(!isSelected(index), index);
        }
    });

    panel.getElement().getStyle().setProperty("display", "inline-table");

    return panel;
}

From source file:org.cruxframework.crux.smartfaces.client.tab.TabBar.java

License:Apache License

/**
 * Programmatically selects the specified tab. Use index -1 to specify that no tab should be selected.
 * /*from w  ww . ja v  a  2 s  . co  m*/
 * @param index the index of the tab to be selected
 * @return <code>true</code> if successful, <code>false</code> if the change is denied by the {@link BeforeSelectionHandler}.
 */
public boolean selectTab(int index) {
    checkTabIndex(index);
    BeforeSelectionEvent<?> event = BeforeSelectionEvent.fire(this, index);

    if (event != null && event.isCanceled()) {
        return false;
    }

    // Check for -1.
    setSelectionStyle(selectedTab, false);
    if (index == -1) {
        selectedTab = null;
        return true;
    }

    selectedTab = panel.getWidget(index);
    setSelectionStyle(selectedTab, true);
    panel.scrollToWidget(selectedTab);
    SelectionEvent.fire(this, index);
    return true;
}

From source file:org.cruxframework.crux.widgets.client.rollingtabs.RollingTabBar.java

License:Apache License

/**
 * Programmatically selects the specified tab. Use index -1 to specify that
 * no tab should be selected.//from  w  w w  .ja v a2 s .c  o m
 * 
 * @param index
 *            the index of the tab to be selected
 * @return <code>true</code> if successful, <code>false</code> if the change
 *         is denied by the {@link BeforeSelectionHandler}.
 */
public boolean selectTab(int index) {
    checkTabIndex(index);
    BeforeSelectionEvent<?> event = BeforeSelectionEvent.fire(this, index);

    if (event != null && event.isCanceled()) {
        return false;
    }

    // Check for -1.
    setSelectionStyle(selectedTab, false);
    if (index == -1) {
        selectedTab = null;
        return true;
    }

    selectedTab = panel.getWidget(index + 1);
    setSelectionStyle(selectedTab, true);
    panel.scrollToWidget(selectedTab);
    SelectionEvent.fire(this, index);
    return true;
}

From source file:org.cruxframework.crux.widgets.client.stackmenu.StackMenuItem.java

License:Apache License

/**
 * If the item has children, shows or hides them. Else, fires a selection event.
 *//* ww w  . ja  v a  2  s  . c om*/
void select() {
    if (this.subItems.size() > 0) {
        setOpen(!this.open);
    } else {
        SelectionEvent.fire(this.getParentMenu(), this);
    }
}

From source file:org.cruxframework.crux.widgets.client.storyboard.StoryboardLargeMouseController.java

License:Apache License

@Override
protected Widget createClickablePanelForCell(Widget widget) {
    final FocusPanel panel = new FocusPanel();
    panel.add(widget);/*from   w w  w.ja  va2s.c  o  m*/
    panel.setStyleName("item");
    configHeightWidth(panel);

    panel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            int index = storyboard.getWidgetIndex(panel);
            SelectionEvent.fire(StoryboardLargeMouseController.this, index);
        }
    });
    panel.getElement().getStyle().setProperty("display", "inline-table");
    panel.getElement().getStyle().setProperty("verticalAlign", "bottom");
    panel.addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                int index = storyboard.getWidgetIndex(panel);
                SelectionEvent.fire(StoryboardLargeMouseController.this, index);
            }
        }
    });

    return panel;
}

From source file:org.cruxframework.crux.widgets.client.storyboard.StoryboardSmallController.java

License:Apache License

protected Widget createClickablePanelForCell(Widget widget) {
    final SelectablePanel panel = new SelectablePanel();
    panel.add(widget);//  w  w  w  .  java  2  s  .c  o m
    panel.setStyleName("item");
    configHeightWidth(panel);

    panel.addSelectHandler(new SelectHandler() {
        @Override
        public void onSelect(SelectEvent event) {
            int index = storyboard.getWidgetIndex(panel);
            SelectionEvent.fire(StoryboardSmallController.this, index);
        }
    });
    return panel;
}

From source file:org.drools.guvnor.client.explorer.navigation.qa.testscenarios.TypeChoiceFormPopup.java

License:Apache License

private void fireSelection(int type) {
    SelectionEvent.fire(this, type);
    hide();
}

From source file:org.drools.guvnor.client.util.LazyStackPanel.java

License:Apache License

private void selectRow(LazyStackPanelRow row) {
    SelectionEvent.fire(this, row);
}

From source file:org.drools.workbench.screens.testscenario.client.AddFieldClickHandler.java

License:Apache License

@Override
public void onClick(final ClickEvent event) {
    final FormStylePopup pop = new FormStylePopup(TestScenarioConstants.INSTANCE.ChooseAFieldToAdd());
    final FactFieldSelector selector = createAddNewField(pop);
    pop.addAttribute(TestScenarioConstants.INSTANCE.ChooseAFieldToAdd(), selector);
    pop.add(new ModalFooterOKCancelButtons(new Command() {
        @Override//from ww w.  j  a  v a2  s.  co  m
        public void execute() {
            SelectionEvent.fire(selector, selector.getSelectedText());
        }
    }, new Command() {
        @Override
        public void execute() {
            pop.hide();
        }
    }));

    pop.show();
}

From source file:org.drools.workbench.screens.testscenario.client.TypeChoiceFormPopup.java

License:Apache License

private void fireSelection(final int type) {
    SelectionEvent.fire(this, type);
    hide();
}