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

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

Introduction

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

Prototype

public T getSelectedItem() 

Source Link

Document

Gets the selected item.

Usage

From source file:org.drools.guvnor.client.asseteditor.drools.serviceconfig.ServiceConfigEditor.java

License:Apache License

public ServiceConfigEditor(final Asset asset, final ClientFactory clientFactory) {
    this.asset = asset;
    this.assetUUID = asset.getUuid();
    this.assetName = asset.getName();
    this.config = (ServiceConfig) asset.getContent();

    this.initWidget(uiBinder.createAndBindUi(this));

    for (final ServiceKBaseConfig activeKbase : config.getKbases()) {
        addKBasePainel(activeKbase, clientFactory);
    }//w ww  .j  av a 2  s . c  om

    final HorizontalPanel panel = new HorizontalPanel();
    final Anchor linkNewKBase = new Anchor("[+]");
    linkNewKBase.setStyleName("serviceTab");

    panel.add(linkNewKBase);

    tabPanel.add(new HTML(""), panel);

    tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> integerSelectionEvent) {
            if (integerSelectionEvent.getSelectedItem() == tabPanel.getWidgetCount() - 1) {
                final ServiceKBaseConfig newKbase = new ServiceKBaseConfig(config.getNextKBaseName());
                newKbase.addKsession(new ServiceKSessionConfig(newKbase.getNextKSessionName()));
                config.addKBase(newKbase);
                addKBasePainel(newKbase, clientFactory);
                tabPanel.remove(tabPanel.getWidgetCount() - 2);
                tabPanel.add(new HTML(""), panel);
                tabPanel.selectTab(tabPanel.getWidgetCount() - 2);
            }
        }
    });

    tabPanel.selectTab(0);

    this.loadContent();
}

From source file:org.drools.guvnor.client.asseteditor.drools.springcontext.SpringContextElementsBrowser.java

License:Apache License

private void doLayout() {

    mainPanel.add(new HTML("<b>Palette</b>"));

    for (Map.Entry<String, String> entry : springContextElements.entrySet()) {
        mainPanel.add(new PanelButton(entry.getKey(), entry.getValue()));
    }/*from   w  ww. j a  v  a2 s. c  om*/

    final Tree resourcesTree = new Tree();
    mainPanel.add(resourcesTree);

    final TreeItem rootItem = new TreeItem(Constants.INSTANCE.Packages());

    //Global Area Data
    ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
    moduleService.loadGlobalModule(new AsyncCallback<Module>() {

        public void onFailure(Throwable caught) {
            ErrorPopup.showMessage("Error listing Global Area information!");
        }

        public void onSuccess(Module result) {
            populatePackageTree(result, rootItem);
        }
    });

    //Packages Data
    moduleService.listModules(new AsyncCallback<Module[]>() {

        public void onFailure(Throwable caught) {
            ErrorPopup.showMessage("Error listing package information!");
        }

        public void onSuccess(Module[] result) {
            for (int i = 0; i < result.length; i++) {
                final Module packageConfigData = result[i];
                populatePackageTree(packageConfigData, rootItem);
            }
        }
    });

    resourcesTree.addItem(rootItem);
    resourcesTree.setStyleName("category-explorer-Tree"); //NON-NLS
    resourcesTree.addSelectionHandler(new SelectionHandler<TreeItem>() {

        public void onSelection(SelectionEvent<TreeItem> event) {
            Object o = event.getSelectedItem().getUserObject();
            if (o instanceof String) {
            }
        }
    });

    ScrollPanel scrollPanel = new ScrollPanel(resourcesTree);

    scrollPanel.setHeight("150px");
    scrollPanel.setWidth("130px");

    mainPanel.add(scrollPanel);

    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setSpacing(10);

}

From source file:org.drools.guvnor.client.explorer.AdministrationTree.java

License:Apache License

public void onSelection(SelectionEvent<TreeItem> event) {
    TabOpener tabOpener = TabOpener.getInstance();
    TreeItem item = event.getSelectedItem();
    String widgetID = itemWidgets.get(item);

    int id = Integer.parseInt(widgetID);
    tabOpener.openAdministrationSelection(id);
}

From source file:org.drools.guvnor.client.explorer.DeploymentTree.java

License:Apache License

public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();

    if (item.getUserObject() instanceof Object[]) {
        Object[] o = (Object[]) item.getUserObject();
        final String snapName = ((SnapshotInfo) o[0]).name;
        PackageConfigData conf = (PackageConfigData) o[1];
        RepositoryServiceFactory.getService().listSnapshots(conf.name, new GenericCallback<SnapshotInfo[]>() {
            public void onSuccess(SnapshotInfo[] a) {
                for (SnapshotInfo snap : a) {
                    if (snap.name.equals(snapName)) {
                        TabOpener opener = TabOpener.getInstance();
                        opener.openSnapshot(snap);
                        return;
                    }//  www  .  j a  v  a 2s  . com
                }
            }
        });
    }
}

From source file:org.drools.guvnor.client.explorer.navigation.admin.AdministrationTree.java

License:Apache License

public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();
    String widgetID = itemWidgets.get(item);

    int id = Integer.parseInt(widgetID);
    placeController.goTo(new ManagerPlace(id));
}

From source file:org.drools.guvnor.client.explorer.navigation.browse.BrowseTreeViewImpl.java

License:Apache License

private void addSelectionHandler() {
    tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        public void onSelection(SelectionEvent<TreeItem> treeItemSelectionEvent) {
            TreeItem selectedItem = treeItemSelectionEvent.getSelectedItem();
            presenter.onTreeItemSelection(selectedItem, selectedItem.getText());
        }//w  w w  .ja  v  a 2  s. c  o  m
    });
}

From source file:org.drools.guvnor.client.explorer.navigation.deployment.DeploymentTree.java

License:Apache License

public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();

    if (item.getUserObject() instanceof SnapshotPlace) {
        placeController.goTo((SnapshotPlace) item.getUserObject());
    }/* w  w  w  .j  a  v a  2 s .  c  o  m*/
}

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

License:Apache License

public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();

    if (item.getUserObject() instanceof Module) {
        Module pc = (Module) item.getUserObject();
        String id = itemWidgets.get(item);

        if (ExplorerNodeConfig.TEST_SCENARIOS_ID.equals(id)) {

            placeController.goTo(new TestScenarioListPlace(pc.getUuid()));

        } else if (ExplorerNodeConfig.ANALYSIS_ID.equals(id)) {
            placeController.goTo(new VerifierPlace(pc.getUuid()));
        }/* ww w  .j a v  a  2  s.  c  o  m*/
    }
}

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

License:Apache License

@Override
public void onSelection(SelectionEvent<String> stringSelectionEvent) {
    fact.getFieldData().add(new FieldPlaceHolder(stringSelectionEvent.getSelectedItem()));
    parent.renderEditor();//from w  w  w .ja va 2  s. c  om
}

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

License:Apache License

private Field createField(SelectionEvent<Integer> selectionEvent) {
    if (selectionEvent.getSelectedItem() == FieldData.TYPE_FACT) {
        return new FactAssignmentField(field.getName(), helper.getFieldType());
    } else {//from  w w  w  . j a  v  a  2 s.  c o  m
        if (selectionEvent.getSelectedItem() == FieldData.TYPE_COLLECTION) {
            CollectionFieldData collectionFieldData = new CollectionFieldData();
            collectionFieldData.setName(field.getName());
            return collectionFieldData;
        } else {
            FieldData fieldData = new FieldData(field.getName(), "");
            fieldData.setNature(selectionEvent.getSelectedItem());
            return fieldData;
        }
    }
}