Example usage for com.google.gwt.user.client.ui CheckBox getValue

List of usage examples for com.google.gwt.user.client.ui CheckBox getValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui CheckBox getValue.

Prototype

@Override
public Boolean getValue() 

Source Link

Document

Determines whether this check box is currently checked.

Usage

From source file:edu.ucdenver.bios.glimmpseweb.client.shared.OptionsPowerMethodsPanel.java

License:Open Source License

/**
 * Constructor/*from  w w  w  . j ava  2  s.co m*/
 * @param mode mode identifier (needed for unique widget identifiers)
 */
public OptionsPowerMethodsPanel(WizardContext context, String mode) {
    super(context, GlimmpseWeb.constants.navItemPowerMethod(), WizardStepPanelState.SKIPPED);
    studyDesignContext = (StudyDesignContext) context;
    VerticalPanel panel = new VerticalPanel();

    // create header, description
    HTML header = new HTML(GlimmpseWeb.constants.powerMethodTitle());
    HTML description = new HTML(GlimmpseWeb.constants.powerMethodDescription());

    // list of power methods
    Grid grid = new Grid(3, 2);
    grid.setWidget(0, 0, unconditionalPowerCheckBox);
    grid.setWidget(0, 1, new HTML(GlimmpseWeb.constants.powerMethodUnconditionalLabel()));
    grid.setWidget(1, 0, quantilePowerCheckBox);
    grid.setWidget(1, 1, new HTML(GlimmpseWeb.constants.powerMethodQuantileLabel()));
    grid.setWidget(2, 1, quantileListPanel);

    // only show quantile list when quantile power is selected
    quantileListPanel.setVisible(false);

    // add callback to check if screen is complete
    unconditionalPowerCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addPowerMethod(PowerMethodEnum.UNCONDITIONAL);
            } else {
                deletePowerMethod(PowerMethodEnum.UNCONDITIONAL);
            }
            checkComplete();
        }
    });
    quantilePowerCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addPowerMethod(PowerMethodEnum.QUANTILE);
            } else {
                deletePowerMethod(PowerMethodEnum.QUANTILE);
            }
            quantileListPanel.setVisible(cb.getValue());
            checkComplete();
        }
    });

    // layout the overall panel
    panel.add(header);
    panel.add(description);
    panel.add(grid);

    // set defaults
    reset();

    // set style
    panel.setStyleName(GlimmpseConstants.STYLE_WIZARD_STEP_PANEL);
    header.setStyleName(GlimmpseConstants.STYLE_WIZARD_STEP_HEADER);
    description.setStyleName(GlimmpseConstants.STYLE_WIZARD_STEP_DESCRIPTION);

    // initialize
    initWidget(panel);
}

From source file:edu.ucdenver.bios.glimmpseweb.client.shared.OptionsTestsPanel.java

License:Open Source License

/**
 * Constructor//from  w  w  w . j a va  2  s  .c om
 * @param mode mode identifier (needed for unique widget identifiers)
 */
public OptionsTestsPanel(WizardContext context, String mode) {
    super(context, GlimmpseWeb.constants.navItemStatisticalTest(), WizardStepPanelState.INCOMPLETE);
    studyDesignContext = (StudyDesignContext) context;
    VerticalPanel panel = new VerticalPanel();

    // create header, description
    HTML header = new HTML(GlimmpseWeb.constants.testTitle());
    HTML description = new HTML(GlimmpseWeb.constants.testDescription());

    // list of available tests
    Grid grid = new Grid(7, 2);
    grid.setWidget(0, 0, hotellingLawleyCheckBox);
    grid.setWidget(0, 1, new HTML(GlimmpseWeb.constants.testHotellingLawleyTraceLabel()));
    grid.setWidget(1, 0, pillaiBartlettCheckBox);
    grid.setWidget(1, 1, new HTML(GlimmpseWeb.constants.testPillaiBartlettTraceLabel()));
    grid.setWidget(2, 0, wilksCheckBox);
    grid.setWidget(2, 1, new HTML(GlimmpseWeb.constants.testWilksLambdaLabel()));
    grid.setWidget(3, 0, unirepBoxCheckBox);
    grid.setWidget(3, 1, new HTML(GlimmpseWeb.constants.testUnirepBoxLabel()));
    grid.setWidget(4, 0, unirepGGCheckBox);
    grid.setWidget(4, 1, new HTML(GlimmpseWeb.constants.testUnirepGeisserGreenhouseLabel()));
    grid.setWidget(5, 0, unirepHFCheckBox);
    grid.setWidget(5, 1, new HTML(GlimmpseWeb.constants.testUnirepHuynhFeldtLabel()));
    grid.setWidget(6, 0, unirepCheckBox);
    grid.setWidget(6, 1, new HTML(GlimmpseWeb.constants.testUnirepLabel()));

    // add callback to check if screen is complete
    unirepCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.UNIREP);
            } else {
                deleteTest(StatisticalTestTypeEnum.UNIREP);
            }
        }
    });
    unirepGGCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.UNIREPGG);
            } else {
                deleteTest(StatisticalTestTypeEnum.UNIREPGG);
            }
        }
    });
    unirepHFCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.UNIREPHF);
            } else {
                deleteTest(StatisticalTestTypeEnum.UNIREPHF);
            }
        }
    });
    unirepBoxCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.UNIREPBOX);
            } else {
                deleteTest(StatisticalTestTypeEnum.UNIREPBOX);
            }
        }
    });
    hotellingLawleyCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.HLT);
            } else {
                deleteTest(StatisticalTestTypeEnum.HLT);
            }
        }
    });
    pillaiBartlettCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.PBT);
            } else {
                deleteTest(StatisticalTestTypeEnum.PBT);
            }
        }
    });
    wilksCheckBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            if (cb.getValue()) {
                addTest(StatisticalTestTypeEnum.WL);
            } else {
                deleteTest(StatisticalTestTypeEnum.WL);
            }
        }
    });
    // set defaults
    reset();

    // layout the overall panel
    panel.add(header);
    panel.add(description);
    panel.add(grid);
    // set style
    panel.setStyleName(GlimmpseConstants.STYLE_WIZARD_STEP_PANEL);
    header.setStyleName(GlimmpseConstants.STYLE_WIZARD_STEP_HEADER);
    description.setStyleName(GlimmpseConstants.STYLE_WIZARD_STEP_DESCRIPTION);

    // initialize
    initWidget(panel);
}

From source file:edu.ycp.cs.dh.acegwt.client.ace.AceGWT.java

License:Open Source License

/**
 * This method builds the UI.//  w  w w.j  av  a 2  s .  c  o  m
 * It creates UI widgets that exercise most/all of the AceEditor methods,
 * so it's a bit of a kitchen sink.
 */
private void buildUI() {
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setWidth("100%");

    mainPanel.add(new Label("Label above!"));

    mainPanel.add(editor1);

    // Label to display current row/column
    rowColLabel = new InlineLabel("");
    mainPanel.add(rowColLabel);

    // Create some buttons for testing various editor APIs
    HorizontalPanel buttonPanel = new HorizontalPanel();

    // Add button to insert text at current cursor position
    Button insertTextButton = new Button("Insert");
    insertTextButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Window.alert("Cursor at: " + editor1.getCursorPosition());
            editor1.insertAtCursor("inserted text!");
        }
    });
    buttonPanel.add(insertTextButton);

    // Add check box to enable/disable soft tabs
    final CheckBox softTabsBox = new CheckBox("Soft tabs");
    softTabsBox.setValue(true); // I think soft tabs is the default
    softTabsBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.setUseSoftTabs(softTabsBox.getValue());
        }
    });
    buttonPanel.add(softTabsBox);

    // add text box and button to set tab size
    final TextBox tabSizeTextBox = new TextBox();
    tabSizeTextBox.setWidth("4em");
    Button setTabSizeButton = new Button("Set tab size");
    setTabSizeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.setTabSize(Integer.parseInt(tabSizeTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Tab size: "));
    buttonPanel.add(tabSizeTextBox);
    buttonPanel.add(setTabSizeButton);

    // add text box and button to go to a given line
    final TextBox gotoLineTextBox = new TextBox();
    gotoLineTextBox.setWidth("4em");
    Button gotoLineButton = new Button("Go to line");
    gotoLineButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.gotoLine(Integer.parseInt(gotoLineTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Go to line: "));
    buttonPanel.add(gotoLineTextBox);
    buttonPanel.add(gotoLineButton);

    // checkbox to set whether or not horizontal scrollbar is always visible
    final CheckBox hScrollBarAlwaysVisibleBox = new CheckBox("H scrollbar: ");
    hScrollBarAlwaysVisibleBox.setValue(true);
    hScrollBarAlwaysVisibleBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisibleBox.getValue());
        }
    });
    buttonPanel.add(hScrollBarAlwaysVisibleBox);

    // checkbox to show/hide gutter
    final CheckBox showGutterBox = new CheckBox("Show gutter: ");
    showGutterBox.setValue(true);
    showGutterBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.setShowGutter(showGutterBox.getValue());
        }
    });
    buttonPanel.add(showGutterBox);

    // checkbox to set/unset readonly mode
    final CheckBox readOnlyBox = new CheckBox("Read only: ");
    readOnlyBox.setValue(false);
    readOnlyBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.setReadOnly(readOnlyBox.getValue());
        }
    });
    buttonPanel.add(readOnlyBox);

    // checkbox to show/hide print margin
    final CheckBox showPrintMarginBox = new CheckBox("Show print margin: ");
    showPrintMarginBox.setValue(true);
    showPrintMarginBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            editor1.setShowPrintMargin(showPrintMarginBox.getValue());
        }
    });
    buttonPanel.add(showPrintMarginBox);

    mainPanel.add(buttonPanel);

    //    mainPanel.add(editor2);
    mainPanel.add(new Label("Label below!"));

    RootPanel.get().add(mainPanel);
}

From source file:eml.studio.client.mvp.presenter.AccountLoader.java

License:Open Source License

/**
 * Load data into the page/* w  w  w . j  a  v  a  2  s.  co  m*/
 */
private void load() {
    resultStart = (currentPage - 1) * 13;
    if (currentPage == lastPage) {
        everyPageSize = resultSize - resultStart;
    } else {
        everyPageSize = 13;
    }

    adminView.getUserGrid().resize(everyPageSize + 1, 7);
    adminView.getUserGrid().setText(0, 0, "Email");
    adminView.getUserGrid().setText(0, 1, "Username");
    adminView.getUserGrid().setText(0, 2, "Company");
    adminView.getUserGrid().setText(0, 3, "Position");
    adminView.getUserGrid().setText(0, 4, "Join Date");
    adminView.getUserGrid().setText(0, 5, "Power");
    adminView.getUserGrid().setText(0, 6, "Operation");

    Account currentAccount = new Account();
    currentAccount.setEmail(Cookies.getCookie("bdaemail"));
    accountService.findValid(currentAccount, resultStart, everyPageSize, new AsyncCallback<List<Account>>() {

        @Override
        public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub
            alertPanel.setContent(caught.getMessage());
            alertPanel.show();
        }

        @Override
        public void onSuccess(List<Account> result) {
            // TODO Auto-generated method stub
            for (int i = 0; i < everyPageSize; i++) {
                adminView.getUserGrid().setText(i + 1, 0, result.get(i).getEmail());
                adminView.getUserGrid().setText(i + 1, 1, result.get(i).getUsername());
                adminView.getUserGrid().setText(i + 1, 2, result.get(i).getCompany());
                adminView.getUserGrid().setText(i + 1, 3, result.get(i).getPosition());
                adminView.getUserGrid().setText(i + 1, 4, formatter.format(result.get(i).getCreatetime()));
                final HorizontalPanel powerField = new HorizontalPanel();
                final CheckBox cb1 = new CheckBox();
                final CheckBox cb2 = new CheckBox();
                final CheckBox cb3 = new CheckBox();
                Label lb1 = new Label(Constants.adminUIMsg.power1());
                Label lb2 = new Label(Constants.adminUIMsg.power2());
                Label lb3 = new Label(Constants.adminUIMsg.power3());
                lb1.getElement().getStyle().setMarginTop(1, Unit.PX);
                lb2.getElement().getStyle().setMarginTop(1, Unit.PX);
                lb3.getElement().getStyle().setMarginTop(1, Unit.PX);
                cb1.getElement().getStyle().setMarginLeft(5, Unit.PX);
                cb2.getElement().getStyle().setMarginLeft(5, Unit.PX);
                cb3.getElement().getStyle().setMarginLeft(5, Unit.PX);
                powerField.add(cb1);
                powerField.add(lb1);
                powerField.add(cb2);
                powerField.add(lb2);
                powerField.add(cb3);
                powerField.add(lb3);
                String arr[] = result.get(i).getPower().split("");
                if (arr[1].equals("1")) {
                    cb1.setValue(true);
                }
                if (arr[2].equals("1")) {
                    cb2.setValue(true);
                }
                if (arr[3].equals("1")) {
                    cb3.setValue(true);
                }
                cb1.setEnabled(false);
                cb2.setEnabled(false);
                cb3.setEnabled(false);
                adminView.getUserGrid().setWidget(i + 1, 5, powerField);
                final String userEmail = result.get(i).getEmail();
                final Label editUser = new Label();
                editUser.setTitle(Constants.adminUIMsg.editPower());
                editUser.addStyleName("admin-user-edit");
                editUser.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        // TODO Auto-generated method stub
                        cb1.setEnabled(true);
                        cb2.setEnabled(true);
                        cb3.setEnabled(true);
                        editUser.addClickHandler(new ClickHandler() {

                            @Override
                            public void onClick(ClickEvent event) {
                                // TODO Auto-generated method stub
                                String newPower = "";
                                if (cb1.getValue()) {
                                    newPower = newPower + "1";
                                } else {
                                    newPower = newPower + "0";
                                }
                                if (cb2.getValue()) {
                                    newPower = newPower + "1";
                                } else {
                                    newPower = newPower + "0";
                                }
                                if (cb3.getValue()) {
                                    newPower = newPower + "1";
                                } else {
                                    newPower = newPower + "0";
                                }
                                Account account = new Account();
                                account.setEmail(userEmail);
                                account.setPower(newPower);
                                accountService.updatePower(account, new AsyncCallback<Account>() {

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        // TODO Auto-generated method stub
                                        alertPanel.setContent(caught.getMessage());
                                        alertPanel.show();
                                    }

                                    @Override
                                    public void onSuccess(Account result) {
                                        // TODO Auto-generated method stub
                                        if (result != null) {
                                            alertPanel.setContent(Constants.adminUIMsg.powerSuccess());
                                            alertPanel.show();
                                        }
                                    }

                                });
                            }

                        });
                    }

                });
                Label deleteUser = new Label();
                deleteUser.setTitle(Constants.adminUIMsg.deleteUser());
                deleteUser.addStyleName("admin-user-delete");
                deleteUser.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        // TODO Auto-generated method stub
                        deletePanel.setContent(Constants.adminUIMsg.userDelete1() + userEmail
                                + Constants.adminUIMsg.userDelete2());
                        deletePanel.show();
                        deletePanel.getConfirmBtn().addClickHandler(new ClickHandler() {

                            @Override
                            public void onClick(ClickEvent event) {
                                // TODO Auto-generated method stub
                                Account account = new Account();
                                account.setEmail(userEmail);
                                accountService.deleteAccount(account, new AsyncCallback<String>() {

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        // TODO Auto-generated method stub
                                        deletePanel.hide();
                                        alertPanel.setContent(caught.getMessage());
                                        alertPanel.show();
                                    }

                                    @Override
                                    public void onSuccess(String result) {
                                        // TODO Auto-generated method stub
                                        if (result.equals("success")) {
                                            deletePanel.hide();
                                            alertPanel.setContent(Constants.adminUIMsg.userSuccess());
                                            alertPanel.show();
                                        } else {
                                            deletePanel.hide();
                                            alertPanel.setContent(result);
                                            alertPanel.show();
                                        }
                                    }
                                });
                            }

                        });
                    }

                });
                HorizontalPanel operate = new HorizontalPanel();
                operate.addStyleName("admin-user");
                operate.add(editUser);
                operate.add(deleteUser);
                if (!userEmail.equals(AppController.email)) {
                    adminView.getUserGrid().setWidget(i + 1, 6, operate);
                }
            }
        }
    });
}

From source file:eml.studio.client.mvp.presenter.AccountLoader.java

License:Open Source License

/**
 * Reload search result/*www .  j  a v  a 2s . c om*/
 */
private void reload() {
    resultStart = (currentPage - 1) * 13;
    if (currentPage == lastPage) {
        everyPageSize = resultSize - resultStart;
    } else {
        everyPageSize = 13;
    }

    adminView.getUserGrid().resize(everyPageSize + 1, 7);
    adminView.getUserGrid().setText(0, 0, "Email");
    adminView.getUserGrid().setText(0, 1, "Username");
    adminView.getUserGrid().setText(0, 2, "Company");
    adminView.getUserGrid().setText(0, 3, "Position");
    adminView.getUserGrid().setText(0, 4, "Join Date");
    adminView.getUserGrid().setText(0, 5, "Power");
    adminView.getUserGrid().setText(0, 6, "Operation");

    Account currentAccount = new Account();
    currentAccount.setEmail(Cookies.getCookie("bdaemail"));

    accountService.search(currentAccount, searchAccount, resultStart, everyPageSize,
            new AsyncCallback<List<Account>>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub
                    alertPanel.setContent(caught.getMessage());
                    alertPanel.show();
                }

                @Override
                public void onSuccess(List<Account> result) {
                    // TODO Auto-generated method stub
                    for (int i = 0; i < everyPageSize; i++) {
                        adminView.getUserGrid().setText(i + 1, 0, result.get(i).getEmail());
                        adminView.getUserGrid().setText(i + 1, 1, result.get(i).getUsername());
                        adminView.getUserGrid().setText(i + 1, 2, result.get(i).getCompany());
                        adminView.getUserGrid().setText(i + 1, 3, result.get(i).getPosition());
                        adminView.getUserGrid().setText(i + 1, 4,
                                formatter.format(result.get(i).getCreatetime()));
                        final HorizontalPanel powerField = new HorizontalPanel();
                        final CheckBox cb1 = new CheckBox();
                        final CheckBox cb2 = new CheckBox();
                        final CheckBox cb3 = new CheckBox();
                        Label lb1 = new Label(Constants.adminUIMsg.power1());
                        Label lb2 = new Label(Constants.adminUIMsg.power2());
                        Label lb3 = new Label(Constants.adminUIMsg.power3());
                        lb1.getElement().getStyle().setMarginTop(1, Unit.PX);
                        lb2.getElement().getStyle().setMarginTop(1, Unit.PX);
                        lb3.getElement().getStyle().setMarginTop(1, Unit.PX);
                        cb1.getElement().getStyle().setMarginLeft(5, Unit.PX);
                        cb2.getElement().getStyle().setMarginLeft(5, Unit.PX);
                        cb3.getElement().getStyle().setMarginLeft(5, Unit.PX);
                        powerField.add(cb1);
                        powerField.add(lb1);
                        powerField.add(cb2);
                        powerField.add(lb2);
                        powerField.add(cb3);
                        powerField.add(lb3);
                        String arr[] = result.get(i).getPower().split("");
                        if (arr[1].equals("1")) {
                            cb1.setValue(true);
                        }
                        if (arr[2].equals("1")) {
                            cb2.setValue(true);
                        }
                        if (arr[3].equals("1")) {
                            cb3.setValue(true);
                        }
                        cb1.setEnabled(false);
                        cb2.setEnabled(false);
                        cb3.setEnabled(false);
                        adminView.getUserGrid().setWidget(i + 1, 5, powerField);
                        final String userEmail = result.get(i).getEmail();
                        final Label editUser = new Label();
                        editUser.setTitle(Constants.adminUIMsg.editPower());
                        editUser.addStyleName("admin-user-edit");
                        editUser.addClickHandler(new ClickHandler() {

                            @Override
                            public void onClick(ClickEvent event) {
                                // TODO Auto-generated method stub
                                cb1.setEnabled(true);
                                cb2.setEnabled(true);
                                cb3.setEnabled(true);
                                editUser.addClickHandler(new ClickHandler() {

                                    @Override
                                    public void onClick(ClickEvent event) {
                                        // TODO Auto-generated method stub
                                        String newPower = "";
                                        if (cb1.getValue()) {
                                            newPower = newPower + "1";
                                        } else {
                                            newPower = newPower + "0";
                                        }
                                        if (cb2.getValue()) {
                                            newPower = newPower + "1";
                                        } else {
                                            newPower = newPower + "0";
                                        }
                                        if (cb3.getValue()) {
                                            newPower = newPower + "1";
                                        } else {
                                            newPower = newPower + "0";
                                        }
                                        Account account = new Account();
                                        account.setEmail(userEmail);
                                        account.setPower(newPower);
                                        accountService.updatePower(account, new AsyncCallback<Account>() {

                                            @Override
                                            public void onFailure(Throwable caught) {
                                                // TODO Auto-generated method stub
                                                alertPanel.setContent(caught.getMessage());
                                                alertPanel.show();
                                            }

                                            @Override
                                            public void onSuccess(Account result) {
                                                // TODO Auto-generated method stub
                                                if (result != null) {
                                                    alertPanel.setContent(Constants.adminUIMsg.powerSuccess());
                                                    alertPanel.show();
                                                }
                                            }

                                        });
                                    }

                                });
                            }

                        });
                        Label deleteUser = new Label();
                        deleteUser.setTitle(Constants.adminUIMsg.deleteUser());
                        deleteUser.addStyleName("admin-user-delete");
                        deleteUser.addClickHandler(new ClickHandler() {

                            @Override
                            public void onClick(ClickEvent event) {
                                // TODO Auto-generated method stub
                                deletePanel.setContent(Constants.adminUIMsg.userDelete1() + userEmail
                                        + Constants.adminUIMsg.userDelete2());
                                deletePanel.show();
                                deletePanel.getConfirmBtn().addClickHandler(new ClickHandler() {

                                    @Override
                                    public void onClick(ClickEvent event) {
                                        // TODO Auto-generated method stub
                                        Account account = new Account();
                                        account.setEmail(userEmail);
                                        accountService.deleteAccount(account, new AsyncCallback<String>() {

                                            @Override
                                            public void onFailure(Throwable caught) {
                                                // TODO Auto-generated method stub
                                                deletePanel.hide();
                                                alertPanel.setContent(caught.getMessage());
                                                alertPanel.show();
                                            }

                                            @Override
                                            public void onSuccess(String result) {
                                                // TODO Auto-generated method stub
                                                if (result.equals("success")) {
                                                    deletePanel.hide();
                                                    alertPanel.setContent(Constants.adminUIMsg.userSuccess());
                                                    alertPanel.show();
                                                } else {
                                                    deletePanel.hide();
                                                    alertPanel.setContent(result);
                                                    alertPanel.show();
                                                }
                                            }
                                        });
                                    }

                                });
                            }

                        });
                        HorizontalPanel operate = new HorizontalPanel();
                        operate.addStyleName("admin-user");
                        operate.add(editUser);
                        operate.add(deleteUser);
                        if (!userEmail.equals(AppController.email)) {
                            adminView.getUserGrid().setWidget(i + 1, 6, operate);
                        }
                    }
                }
            });
}

From source file:eu.riscoss.client.riskconfs.ModelSelectionDialog.java

License:Apache License

public void show(Callback<List<String>> cb) {

    this.callback = cb;

    RiscossJsonClient.listModels(new JsonCallback() {
        @Override//  w  w  w .j  ava 2  s. co m
        public void onFailure(Method method, Throwable exception) {
            Window.alert(exception.getMessage());
        }

        @Override
        public void onSuccess(Method method, JSONValue response) {
            JsonModelList list = new JsonModelList(response);
            dialog = new DialogBox(true, true); //, new HtmlCaption( "Add model" ) );
            dialog.setText("Model Selection");
            Grid grid = new Grid();
            grid.resize(list.getModelCount(), 1);
            for (int i = 0; i < list.getModelCount(); i++) {
                ModelInfo info = list.getModelInfo(i);
                CheckBox chk = new CheckBox(info.getName());
                chk.setName(info.getName());
                chk.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        CheckBox chk = (CheckBox) event.getSource();
                        boolean value = chk.getValue();
                        if (value == true) {
                            selection.add(chk.getName());
                        } else {
                            selection.remove(chk.getName());
                        }
                    }
                });
                grid.setWidget(i, 0, chk);
            }
            DockPanel dock = new DockPanel();
            dock.add(grid, DockPanel.CENTER);
            Button ok = new Button("Ok", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    dialog.hide();
                    if (callback != null) {
                        callback.onDone(new ArrayList<String>(selection));
                    }
                }
            });
            Button cancel = new Button("Cancel", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    dialog.hide();
                }
            });
            ok.setStyleName("deleteButton");
            cancel.setStyleName("deleteButton");
            HorizontalPanel buttons = new HorizontalPanel();
            buttons.add(ok);
            buttons.add(cancel);
            dock.add(buttons, DockPanel.SOUTH);
            dialog.add(dock);
            dialog.getElement().getStyle().setZIndex(Integer.MAX_VALUE);
            dialog.show();
        }
    });
}

From source file:eu.riscoss.client.riskconfs.ModelSelectionDialog.java

License:Apache License

public void show(String l, SimpleRiskCconf rconf, Callback<List<String>> cb) {

    this.callback = cb;
    this.rc = rconf;
    this.layer = l;

    RiscossJsonClient.listModels(new JsonCallback() {
        @Override//ww w .  jav a  2  s  .  c o m
        public void onFailure(Method method, Throwable exception) {
            Window.alert(exception.getMessage());
        }

        @Override
        public void onSuccess(Method method, JSONValue response) {
            JsonModelList list = new JsonModelList(response);
            List<String> l = rc.getModelList(layer);
            dialog = new DialogBox(true, true); //, new HtmlCaption( "Add model" ) );
            dialog.setText("Model Selection");
            Grid grid = new Grid();
            grid.resize(list.getModelCount(), 1);
            for (int i = 0; i < list.getModelCount(); i++) {
                ModelInfo info = list.getModelInfo(i);
                CheckBox chk = new CheckBox(info.getName());
                chk.setName(info.getName());
                chk.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        CheckBox chk = (CheckBox) event.getSource();
                        boolean value = chk.getValue();
                        if (value == true) {
                            selection.add(chk.getName());
                        } else {
                            selection.remove(chk.getName());
                        }
                    }
                });
                if (l.contains(info.getName())) {
                    chk.setChecked(true);
                    selection.add(chk.getName());
                }
                grid.setWidget(i, 0, chk);
            }
            DockPanel dock = new DockPanel();
            dock.add(grid, DockPanel.CENTER);
            Button ok = new Button("Ok", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    dialog.hide();
                    if (callback != null) {
                        callback.onDone(new ArrayList<String>(selection));
                    }
                }
            });
            Button cancel = new Button("Cancel", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    dialog.hide();
                }
            });
            ok.setStyleName("deleteButton");
            cancel.setStyleName("deleteButton");
            HorizontalPanel buttons = new HorizontalPanel();
            buttons.add(ok);
            buttons.add(cancel);
            dock.add(buttons, DockPanel.SOUTH);
            dialog.add(dock);
            dialog.getElement().getStyle().setZIndex(Integer.MAX_VALUE);
            dialog.show();
        }
    });
}

From source file:eu.riscoss.client.riskconfs.NewModelDialog.java

License:Apache License

public void show(String rcName) {

    //         this.callback = cb;
    this.selectedRC = rcName;

    RiscossJsonClient.listModels(new JsonCallback() {
        @Override/*  w ww.j  a  v a2s  . com*/
        public void onFailure(Method method, Throwable exception) {
            Window.alert(exception.getMessage());
        }

        @Override
        public void onSuccess(Method method, JSONValue response) {
            JsonModelList list = new JsonModelList(response);
            dialog = new DialogBox(true, true); //, new HtmlCaption( "Add model" ) );
            Grid grid = new Grid();
            grid.resize(list.getModelCount(), 1);
            for (int i = 0; i < list.getModelCount(); i++) {
                ModelInfo info = list.getModelInfo(i);
                CheckBox chk = new CheckBox(info.getName());
                chk.setName(info.getName());
                chk.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        CheckBox chk = (CheckBox) event.getSource();
                        boolean value = chk.getValue();
                        if (value == true) {
                            selection.add(chk.getName());
                        } else {
                            selection.remove(chk.getName());
                        }
                    }
                });
                grid.setWidget(i, 0, chk);
            }
            DockPanel dock = new DockPanel();
            dock.add(grid, DockPanel.CENTER);
            dock.add(new Button("Ok", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    //                     SimpleRiskCconf rc = new SimpleRiskCconf( selection );
                    //                     RiscossJsonClient.setRCContent( selectedRC, rc, new JsonCallback() {
                    //                        
                    //                        @Override
                    //                        public void onSuccess(Method method, JSONValue response) {
                    //                           dialog.hide();
                    ////                           if( callback != null ) {
                    ////                              callback.onDone( null );
                    ////                           }
                    //                        }
                    //                        
                    //                        @Override
                    //                        public void onFailure(Method method, Throwable exception) {
                    //                           Window.alert( exception.getMessage() );
                    //                        }
                    //                     });
                }
            }), DockPanel.SOUTH);
            dialog.add(dock);
            dialog.show();
        }
    });
}

From source file:fr.aliasource.webmail.client.addressbook.ContactList.java

License:GNU General Public License

private ClickHandler createLabelClickListener(final CheckBox c, final UiContact co, final int row) {
    return new ClickHandler() {
        public void onClick(ClickEvent sender) {

            webmail.getAddressBook().getContactDisplay().reset();
            selectNone();/*from w ww .  j av a  2s  . com*/

            if (!c.getValue()) {
                getRowFormatter().addStyleName(row, "selectedContactGroup");
                notifyListeners(co, true);
                c.setValue(true);
                checkedItems.put(c, row);
            } else {
                getRowFormatter().removeStyleName(row, "selectedContactGroup");
                notifyListeners(co, false);
                c.setValue(false);
                checkedItems.remove(c);
            }
        }
    };
}

From source file:fr.aliasource.webmail.client.addressbook.ContactList.java

License:GNU General Public License

private ClickHandler createCbClickListener(final CheckBox c, final int row, final UiContact co) {
    return new ClickHandler() {
        public void onClick(ClickEvent sender) {
            if (!c.getValue()) {
                getRowFormatter().removeStyleName(row, "selectedContactGroup");
                notifyListeners(co, false);
                checkedItems.remove(c);/*from  w ww  .  java 2 s . c om*/
            } else {
                getRowFormatter().addStyleName(row, "selectedContactGroup");
                notifyListeners(co, true);
                checkedItems.put(c, row);
            }
        }
    };
}