Example usage for com.google.gwt.visualization.client.visualizations OrgChart getSelections

List of usage examples for com.google.gwt.visualization.client.visualizations OrgChart getSelections

Introduction

In this page you can find the example usage for com.google.gwt.visualization.client.visualizations OrgChart getSelections.

Prototype

public final JsArray<Selection> getSelections() 

Source Link

Usage

From source file:com.square.client.gwt.client.presenter.personne.PersonneRelationsVisualizationPresenter.java

License:Open Source License

/**
 * Evenement sur le clic./* ww w .ja v a 2  s.  c  o  m*/
 * @param chart
 * @param datas
 * @return SelectHandler
 */
private SelectHandler createSelectHandler(final OrgChart chart, final DataTable data) {
    return new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
            // May be multiple selections.
            final JsArray<Selection> selections = chart.getSelections();
            final Selection celluleSelectionnee = selections.get(0);
            final int rowCell = celluleSelectionnee.getRow();
            if (rowCell != 0) {
                final Long idPersCible = Long.parseLong(data.getValueString(rowCell, 0));
                personneRpcService.rechercherPersonneParId(idPersCible, new AsyncCallback<PersonneBaseModel>() {
                    @Override
                    public void onSuccess(PersonneBaseModel result) {
                        final PersonneModel personneCible = (PersonneModel) result;
                        fireEventGlobalBus(new OpenPersonEvent(idPersCible, personneCible.getNumClient(),
                                personneCible.getNom() != null ? personneCible.getNom() : "",
                                personneCible.getPrenom() != null ? personneCible.getPrenom() : "",
                                (personneCible.getNaturePersonne() != null)
                                        ? personneCible.getNaturePersonne().getIdentifiant()
                                        : null));
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                        view.onRpcServiceFailure(new ErrorPopupConfiguration(caught));
                    }
                });
            }
        }
    };
}