Example usage for com.google.gwt.event.logical.shared ValueChangeEvent getValue

List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent getValue

Introduction

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

Prototype

public T getValue() 

Source Link

Document

Gets the value.

Usage

From source file:org.bonitasoft.console.client.view.ReportingConfigurationEditionPanel.java

License:Open Source License

private void updateMyGeneralPanel() {

    // Reporting configuration.
    myReportingDataSource.getReportingConfiguration(new AsyncHandler<ReportingConfiguration>() {

        public void handleFailure(Throwable caught) {
            myMessageDataSource.addErrorMessage(messages.unableToReadConfiguration());
        };//from  w  ww  .j a  va 2 s .com

        public void handleSuccess(ReportingConfiguration aResult) {
            myReportingConfiguration = aResult;
            if (myReportingConfiguration != null) {
                myUserReportingActivationStateSelector.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                    public void onValueChange(ValueChangeEvent<Boolean> anEvent) {
                        if (anEvent.getValue()) {
                            myInnerPanel.setHTML(0, 0, constants.userReportingDeActivateDescription());
                        } else {
                            myInnerPanel.setHTML(0, 0, constants.userReportingActivateDescription());
                        }
                    }
                });

                myGlobalReportingActivationStateSelector
                        .addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                            public void onValueChange(ValueChangeEvent<Boolean> anEvent) {
                                if (anEvent.getValue()) {
                                    myInnerPanel.setHTML(1, 0,
                                            constants.globalReportingDeActivateDescription());
                                } else {
                                    myInnerPanel.setHTML(1, 0, constants.globalReportingActivateDescription());
                                }
                            }
                        });

                // Set the initial values.
                myUserReportingActivationStateSelector
                        .setValue(myReportingConfiguration.isUserReportingEnabled(), false);
                if (myReportingConfiguration.isUserReportingEnabled()) {
                    myInnerPanel.setHTML(0, 0, constants.userReportingDeActivateDescription());
                } else {
                    myInnerPanel.setHTML(0, 0, constants.userReportingActivateDescription());
                }
                myGlobalReportingActivationStateSelector
                        .setValue(myReportingConfiguration.isGlobalReportingEnabled(), false);
                //                    if (myReportingConfiguration.isGlobalReportingEnabled()) {
                //                        myInnerPanel.setHTML(1, 0, constants.globalReportingDeActivateDescription());
                //                    } else {
                //                        myInnerPanel.setHTML(1, 0, constants.globalReportingActivateDescription());
                //                    }
                // Translate the value from ms to minutes.
                myDashboardRefreshFrequency.setValue(
                        String.valueOf(myReportingConfiguration.getDashBoardRefreshFrequency() / (60 * 1000)));
                myInnerPanel.setHTML(2, 0, constants.dashboardRefreshFrequency());

                myStepAtRiskNbOfDays
                        .setValue(String.valueOf(myReportingConfiguration.getRemainingDaysForAtRiskSteps()));
                myInnerPanel.setHTML(3, 0, constants.stepAtRiskThreshold());

                // layout.
                myInnerPanel.setWidget(0, 1, myUserReportingActivationStateSelector);
                //                    myInnerPanel.setWidget(1, 1, myGlobalReportingActivationStateSelector);
                myInnerPanel.setWidget(2, 1, myDashboardRefreshFrequency);
                myInnerPanel.setWidget(3, 1, myStepAtRiskNbOfDays);

            }

        };
    });

}

From source file:org.bonitasoft.console.client.view.UserEditionPanel.java

License:Open Source License

protected void buildContent() {
    // Create the sync button.
    mySaveButton.addItem(constants.save(), new Command() {
        public void execute() {
            saveSettings();/*from w  w  w .jav a  2 s  .co  m*/
        }
    });
    myOuterPanel.setHTML(0, 0, constants.identityTabDescription());
    myOuterPanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    myOuterPanel.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    myUserNameCompletionStateSelector.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> anEvent) {
            if (anEvent.getValue()) {
                myOuterPanel.setHTML(1, 0, constants.deactivateUserNameCompletion());
            } else {
                myOuterPanel.setHTML(1, 0, constants.activateUserNameCompletion());
            }
        }
    });
}

From source file:org.bonitasoft.forms.client.BonitaApplication.java

License:Open Source License

/**
 * Performs the post-login operations//from   w w  w  .ja v a  2  s  .co  m
 * @param user
 */
private void handleLogin(final User user) {
    if (user != null) {
        // the user is already logged in
        if (temporaryToken != null) {
            final List<String> hashParamsToRemove = new ArrayList<String>();
            hashParamsToRemove.add(URLUtils.USER_CREDENTIALS_PARAM);
            urlContext.remove(URLUtils.USER_CREDENTIALS_PARAM);
            final String newHash = urlUtils.rebuildHash(hashParamsToRemove, null);
            if (newHash == null || newHash.length() == 0) {
                // for IE that does not support an empty history token
                History.newItem(URLUtils.VIEW_MODE_PARAM + "=" + URLUtils.FULL_FORM_APPLICATION_MODE);
            } else {
                History.newItem(newHash);
            }
        }
        History.addValueChangeHandler(new ValueChangeHandler<String>() {
            public void onValueChange(final ValueChangeEvent<String> event) {
                final String newHistoryToken = event.getValue();
                parseHashParameters(urlUtils.getHashParameters(newHistoryToken));
                createApplicationView(user);
            }
        });
        boolean isTodolist = Boolean.valueOf((String) urlContext.get(URLUtils.TODOLIST_PARAM));
        if (isTodolist) {
            final String themeName = Window.Location.getParameter(URLUtils.THEME);
            if (themeName != null) {
                urlContext.put(URLUtils.THEME, themeName);
            }
            final GetAnyTodolistFormHandler getAnyTodolistFormHandler = new GetAnyTodolistFormHandler();
            RpcFormsServices.getFormsService().getAnyTodoListForm(urlContext, getAnyTodolistFormHandler);
        } else {
            createApplicationView(user);
        }
    } else {
        // the user is not logged in
        if (formID == null) {
            formsServiceAsync.getWelcomePage(urlContext, welcomePageHandler);
        } else {
            urlUtils.showLoginView();
        }
    }
}

From source file:org.broadleafcommerce.openadmin.client.setup.AppController.java

License:Apache License

@Override
public void onValueChange(ValueChangeEvent<String> event) {
    String token = event.getValue();

    if (token != null) {
        String page = BLCLaunch.getSelectedPage(token);
        String moduleName = BLCLaunch.getSelectedModule(token);
        String itemId = BLCLaunch.getDefaultItem(token);

        if (page != null && moduleName != null) {
            if (!uiFactory.equalsCurrentView(page) || itemId != null) {
                Module module = BLCMain.getModule(moduleName);
                String[] vals = module.getPages().get(page);
                if (vals != null) {
                    showView(vals[0], vals[1], itemId);
                }//ww w.  ja  v a 2 s  . c o m
            }
        }
    }
}

From source file:org.broadleafcommerce.openadmin.client.view.MasterView.java

License:Apache License

public void onValueChange(ValueChangeEvent<String> event) {
    String token = event.getValue();
    if (token != null) {
        String page = BLCLaunch.getSelectedPage(token);
        String moduleName = BLCLaunch.getSelectedModule(token);
        if (moduleName != null) {
            LinkedHashMap<String, String[]> pages = modules.get(moduleName).getPages();
            if (SecurityManager.getInstance().isUserAuthorizedToViewModule(moduleName)
                    && SecurityManager.getInstance().isUserAuthorizedToViewSection(pages.get(page)[0])) {
                if (!moduleName.equals(BLCMain.currentModuleKey)) {
                    BLCMain.setCurrentModuleKey(moduleName);
                    AppController.getInstance().clearCurrentView();
                } else {
                    AppController.getInstance().clearCurrentView();
                }/*w  w w  .  java  2  s  .  com*/
            }
        }
    }
}

From source file:org.calontir.marshallate.falcon.client.ui.fighterform.AuthorizationsField.java

public AuthorizationsField(final Fighter fighter, final boolean edit) {
    Panel dataBody = new FlowPanel();
    dataBody.setStyleName("dataBody");
    if (edit) {//from   ww  w.jav a2  s.  co  m
        for (AuthType at : lookupController.getAuthType()) {
            final CheckBox cb = new CheckBox(at.getCode());
            cb.setFormValue(at.getCode());
            cb.setName("authorization");
            if (fighter.getAuthorization() != null) {
                for (Authorization a : fighter.getAuthorization()) {
                    if (a.getCode().equals(at.getCode())) {
                        cb.setValue(true);
                        break;
                    }
                }
            }
            cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                @Override
                public void onValueChange(ValueChangeEvent<Boolean> event) {
                    List<Authorization> auths = fighter.getAuthorization();
                    if (auths == null) {
                        auths = new ArrayList<Authorization>();
                        fighter.setAuthorization(auths);
                    }
                    Authorization a = new Authorization();
                    a.setCode(cb.getFormValue());
                    if (auths.contains(a)) {
                        if (event.getValue()) {
                            auths.add(a);
                        } else {
                            auths.remove(a);
                        }
                    } else {
                        if (event.getValue()) {
                            auths.add(a);
                        }
                    }
                }
            });
            dataBody.add(cb);
        }
    } else {
        Label auths = new Label();
        auths.setText(getAuthsAsString(fighter.getAuthorization()));
        dataBody.add(auths);
    }
    initWidget(dataBody);
}

From source file:org.cimav.client.ui.empleados.JefeChosen.java

public JefeChosen() {
    initWidget(uiBinder.createAndBindUi(this));

    chosen = new ValueListBox<>(new Renderer<Empleado>() {
        @Override/*  ww w .  j  a v  a  2s .  co  m*/
        public String render(Empleado object) {
            if (object == null) {
                return "None";
            }
            return object.getName();
        }

        @Override
        public void render(Empleado object, Appendable appendable) throws IOException {
            if (object != null) {
                String s = render(object);
                appendable.append(s);
            }
        }
    });

    chosen.addValueChangeHandler(new ValueChangeHandler<Empleado>() {
        @Override
        public void onValueChange(ValueChangeEvent<Empleado> event) {

            String htmlStr = "&nbsp;";

            if (event != null && event.getValue() != null) {
                Empleado emp = event.getValue();
                fotoImg.setUrl(emp.getUrlPhoto());
                //                    htmlStr = 
                //                        " <code class='label-cyt-grp-niv'><span >" + emp.getCode() + "</span></code> " + 
                //                        " <code class='label-cyt-grp-niv'><span >" + emp.getGrupo()+ "</span></code> " +
                //                        " <code class='label-cyt-grp-niv'><span >" + emp.getNivel() + "</span></code> " +
                //                        " <code class='label-cyt-grp-niv'><span >" + emp.getDepartamento() + "</span></code> " +
                //                        " <code class='label-cyt-grp-niv'><span >" + emp.getId() + "</span></code> ";
            } else {
                fotoImg.setUrl("http://cimav.edu.mx/foto/default");
            }

            htmlDatos.setHTML(htmlStr);
        }
    });

    comboWrap.add(chosen);

    rest = new EmpleadoREST();
    rest.addRESTExecutedListener(new BaseREST.RESTExecutedListener() {
        @Override
        public void onRESTExecuted(RESTEvent restEvent) {
            if (restEvent.getDbMethod().equals(ProviderMethod.FIND_ALL_BASE)) {
                if (restEvent.getDbTypeResult().equals(TypeResult.SUCCESS)) {

                    List<Empleado> jefes = (List<Empleado>) restEvent.getResult();
                    chosen.setAcceptableValues(jefes);

                } else {
                    Growl.growl("Fall la carga de Jefes");
                }
            }
        }
    });
    rest.findAllBase();

}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.CartographicLimitRectangle.java

License:Apache License

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    viewerOptions.terrainProvider = Cesium.createWorldTerrain();
    csVPanel = new ViewerPanel(viewerOptions);

    // Tropics of Cancer and Capricorn
    final Rectangle coffeeBeltRectangle = Rectangle.fromDegrees(-180.0, -23.43687, 180.0, 23.43687);

    csVPanel.getViewer().scene().globe.cartographicLimitRectangle = coffeeBeltRectangle;
    csVPanel.getViewer().scene().skyAtmosphere.show = false;

    // Add rectangles to show bounds
    final List<Entity> rectangles = new ArrayList<>();

    for (int i = 0; i < 10; i++) {
        RectangleGraphicsOptions rectangleGraphicsOptions = new RectangleGraphicsOptions();
        rectangleGraphicsOptions.coordinates = new ConstantProperty<>(coffeeBeltRectangle);
        rectangleGraphicsOptions.material = new ColorMaterialProperty(Color.WHITE().withAlpha(0.0f));
        rectangleGraphicsOptions.height = new ConstantProperty<>(i * 5000.0);
        rectangleGraphicsOptions.outline = new ConstantProperty<>(true);
        rectangleGraphicsOptions.outlineWidth = new ConstantProperty<>(4.0);
        rectangleGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());

        EntityOptions entityOptions = new EntityOptions();
        entityOptions.rectangle = new RectangleGraphics(rectangleGraphicsOptions);

        rectangles.add(csVPanel.getViewer().entities().add(entityOptions));
    }//from   w ww  .ja  va 2s .  c  om

    CheckBox enableLimitCBox = new CheckBox();
    enableLimitCBox.setWidth("100px");
    enableLimitCBox.setValue(true);
    enableLimitCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            csVPanel.getViewer().scene().globe.cartographicLimitRectangle = event.getValue()
                    ? coffeeBeltRectangle
                    : Rectangle.MAX_VALUE();
        }
    });

    CheckBox showBoundsBox = new CheckBox();
    showBoundsBox.setWidth("100px");
    showBoundsBox.setValue(true);
    showBoundsBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            for (Entity rectangle : rectangles) {
                rectangle.show = event.getValue();
            }
        }
    });

    FlexTable flexTable = new FlexTable();
    flexTable.setHTML(1, 0, "<font color=\"white\">Limit Enabled</font>");
    flexTable.setWidget(1, 1, enableLimitCBox);
    flexTable.setHTML(2, 0, "<font color=\"white\">Show Bounds</font>");
    flexTable.setWidget(2, 1, showBoundsBox);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(new HTML("<p>Limit terrain and imagery to a cartographic Rectangle area.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Clustering.java

License:Apache License

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();
    KmlDataSourceLoadStaticOptions kmlDataSourceOptions = KmlDataSourceLoadStaticOptions
            .create(csVPanel.getViewer().camera, csVPanel.getViewer().canvas());
    Promise<KmlDataSource, Void> dataSourcePromise = csVPanel.getViewer().dataSources().add(KmlDataSource
            .load(GWT.getModuleBaseURL() + "SampleData/kml/facilities/facilities.kml", kmlDataSourceOptions));
    dataSourcePromise.then(new Fulfill<KmlDataSource>() {
        @Override/* www.ja v  a2s  . com*/
        public void onFulfilled(KmlDataSource dataSource) {
            int pixelRange = 25;
            int minimumClusterSize = 3;
            boolean enabled = true;

            dataSource.clustering.enabled = enabled;
            dataSource.clustering.pixelRange = pixelRange;
            dataSource.clustering.minimumClusterSize = minimumClusterSize;

            PinBuilder pinBuilder = new PinBuilder();
            pin50 = pinBuilder.fromText("50+", Color.RED(), 48).toDataUrl();
            pin40 = pinBuilder.fromText("40+", Color.ORANGE(), 48).toDataUrl();
            pin30 = pinBuilder.fromText("30+", Color.YELLOW(), 48).toDataUrl();
            pin20 = pinBuilder.fromText("20+", Color.GREEN(), 48).toDataUrl();
            pin10 = pinBuilder.fromText("10+", Color.BLUE(), 48).toDataUrl();

            singleDigitPins = new String[8];
            for (int i = 0; i < singleDigitPins.length; ++i) {
                singleDigitPins[i] = pinBuilder.fromText("" + (i + 2), Color.VIOLET(), 48).toDataUrl();
            }
            // start with custom style
            customStyle(dataSource);

            _dataSource = dataSource;
        }
    });

    pixelRangeSlider = new Slider("pixelRange", 1, 200, 15);
    pixelRangeSlider.setStep(1);
    pixelRangeSlider.setWidth("150px");
    pixelRangeSlider.addListener(new MSliderListener());
    pixelRangeTBox = new TextBox();
    pixelRangeTBox.addChangeHandler(new MChangeHandler());
    pixelRangeTBox.setText("" + 15);
    pixelRangeTBox.setSize("30px", "12px");

    HorizontalPanel pixelRangeHPanel = new HorizontalPanel();
    pixelRangeHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    pixelRangeHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pixelRangeHPanel.setSpacing(10);
    pixelRangeHPanel.add(pixelRangeSlider);
    pixelRangeHPanel.add(pixelRangeTBox);

    minimumClusterSizeSlider = new Slider("minimumClusterSize", 1, 20, 3);
    minimumClusterSizeSlider.setStep(1);
    minimumClusterSizeSlider.setWidth("150px");
    minimumClusterSizeSlider.addListener(new MSliderListener());
    minimumClusterSizeTBox = new TextBox();
    pixelRangeTBox.addChangeHandler(new MChangeHandler());
    minimumClusterSizeTBox.setText("" + 3);
    minimumClusterSizeTBox.setSize("30px", "12px");

    HorizontalPanel minimumClusterSizeHPanel = new HorizontalPanel();
    minimumClusterSizeHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    minimumClusterSizeHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    minimumClusterSizeHPanel.setSpacing(10);
    minimumClusterSizeHPanel.add(minimumClusterSizeSlider);
    minimumClusterSizeHPanel.add(minimumClusterSizeTBox);

    CheckBox enabledCBox = new CheckBox();
    enabledCBox.setValue(true);
    enabledCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            _dataSource.clustering.enabled = valueChangeEvent.getValue();
        }
    });

    CheckBox customStyleCBox = new CheckBox();
    customStyleCBox.setValue(true);
    customStyleCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            customStyle(_dataSource);
        }
    });

    FlexTable flexTable = new FlexTable();
    flexTable.setHTML(1, 0, "<font color=\"white\">Pixel Range</font>");
    flexTable.setWidget(1, 1, pixelRangeHPanel);
    flexTable.setHTML(2, 0, "<font color=\"white\">Minimum Cluster Size</font>");
    flexTable.setWidget(2, 1, minimumClusterSizeHPanel);
    flexTable.setHTML(3, 0, "<font color=\"white\">Enabled</font>");
    flexTable.setWidget(3, 1, enabledCBox);
    flexTable.setHTML(4, 0, "<font color=\"white\">Custom Style</font>");
    flexTable.setWidget(4, 1, customStyleCBox);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(new HTML("<p>Cluster labels, billboards and points.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}