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

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

Introduction

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

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:com.square.composant.tarificateur.square.client.view.popup.doublon.PopupCreationAssureSocialDoublonViewImpl.java

License:Open Source License

/**
 * Construit le tableau de recherche.//from   w  ww  .  j  a v  a 2 s  . c om
 * @param listeDoublons la liste des doublons.
 */
private void construireTableauRecherche(List<PersonneDoublonModel> newListeDoublons) {
    final List<CheckBox> listeCBSelection = new ArrayList<CheckBox>();
    final HeaderFlexTable<PersonneDoublonModel> ftDoublons = new HeaderFlexTable<PersonneDoublonModel>() {
        @Override
        public Widget[] setHeader() {
            return new Widget[] { new Label(viewConstants.enTeteColonneNom()),
                    new Label(viewConstants.enTeteColonnePrenom()),
                    new Label(viewConstants.enTeteColonneDateNaissance()),
                    new Label(viewConstants.enTeteColonneAdresse()),
                    new Label(viewConstants.enTeteColonneCodePostal()),
                    new Label(viewConstants.enTeteColonneVille()),
                    new Label(viewConstants.enTeteColonneCompoFamiliale()),
                    new Label(viewConstants.enTeteSelection()) };
        }

        @Override
        public void setRow(final PersonneDoublonModel doublon) {
            setWidget(0, new Label(doublon.getNom()));
            setWidget(1, new Label(doublon.getPrenom()));
            setWidget(2, new Label(doublon.getDateNaissance()));
            setWidget(3, new Label(doublon.getAdresse()));
            setWidget(4, new Label(doublon.getCodePostal()));
            setWidget(5, new Label(doublon.getCommune()));
            setWidget(6, new Label(doublon.getCompoFamiliale()));
            final CheckBox cb = new CheckBox();
            cb.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    if (cb.getValue()) {
                        for (CheckBox checkBox : listeCBSelection) {
                            if (!cb.equals(checkBox)) {
                                checkBox.setEnabled(false);
                            }
                        }
                        idPersonneSelectionnee = doublon.getId();
                        btnRattacher.setEnabled(true);
                    } else {
                        for (CheckBox checkBox : listeCBSelection) {
                            checkBox.setEnabled(true);
                        }
                        idPersonneSelectionnee = null;
                        btnRattacher.setEnabled(false);
                    }
                }
            });
            listeCBSelection.add(cb);
            setWidget(7, cb);
            setCellHorizontalAlignment(7, HasAlignment.ALIGN_CENTER);
        }
    };
    ftDoublons.setWidth(ComposantTarificateurConstants.POURCENT_100);
    ftDoublons.setListeObjets(newListeDoublons);

    final ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setHeight("250px");
    scrollPanel.add(ftDoublons);
    pContenu.add(scrollPanel);
}

From source file:com.tasktop.c2c.server.profile.web.ui.client.presenter.components.TeamMemberPresenter.java

License:Open Source License

@Override
public void onClick(ClickEvent event) {
    Object source = event.getSource();
    if (source == view.rolesAnchor) {
        PopupPanel panel = WidgetUtil.createPopupPanel(view.rolesAnchor);
        panel.addAutoHidePartner(view.rolesAnchor.getElement());
        VerticalPanel content = new VerticalPanel();
        for (final ProjectRole role : ProjectRole.values()) {
            CheckBox checkbox = new CheckBox(
                    projectRoleMessageSelector.getInternationalizedMessage(role, commonProfileMessages));
            checkbox.setValue(member.getRoles().contains(role));
            boolean enableChanges = true;
            if (role.equals(ProjectRole.MEMBER) || (role.equals(ProjectRole.OWNER) && self)) {
                enableChanges = false;//from  w  ww  .  ja  v  a  2  s. c  o m
            }

            checkbox.setEnabled(enableChanges);
            if (enableChanges) {
                checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<Boolean> event) {
                        if (event.getValue()) {
                            member.getRoles().add(role);
                        } else {
                            member.getRoles().remove(role);
                        }
                        updateRoles();
                    }
                });
            }
            content.add(checkbox);
        }
        panel.add(content);
        if (panel.isShowing()) {
            panel.showRelativeTo(view.rolesAnchor);
        } else {
            panel.hide();
        }
    } else if (source == view.removeButton) {
        removeMember();
    }
}

From source file:com.vaadin.client.ui.VOptionGroup.java

License:Apache License

@Override
public void buildOptions(UIDL uidl) {
    /*/*  w  ww.  j av  a 2s  . c om*/
     * In order to retain focus, we need to update values rather than
     * recreate panel from scratch (#10451). However, the panel will be
     * rebuilt (losing focus) if number of elements or their order is
     * changed.
     */
    HashMap<String, CheckBox> keysToOptions = new HashMap<String, CheckBox>();
    for (Map.Entry<CheckBox, String> entry : optionsToKeys.entrySet()) {
        keysToOptions.put(entry.getValue(), entry.getKey());
    }
    ArrayList<Widget> existingwidgets = new ArrayList<Widget>();
    ArrayList<Widget> newwidgets = new ArrayList<Widget>();

    // Get current order of elements
    for (Widget wid : panel) {
        existingwidgets.add(wid);
    }

    optionsEnabled.clear();

    if (isMultiselect()) {
        Roles.getGroupRole().set(getElement());
    } else {
        Roles.getRadiogroupRole().set(getElement());
    }

    for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
        final UIDL opUidl = (UIDL) it.next();

        String itemHtml = opUidl.getStringAttribute("caption");
        if (!htmlContentAllowed) {
            itemHtml = WidgetUtil.escapeHTML(itemHtml);
        }

        String iconUrl = opUidl.getStringAttribute("icon");
        if (iconUrl != null && iconUrl.length() != 0) {
            Icon icon = client.getIcon(iconUrl);
            itemHtml = icon.getElement().getString() + itemHtml;
        }

        String key = opUidl.getStringAttribute("key");
        CheckBox op = keysToOptions.get(key);

        // Need to recreate object if isMultiselect is changed (#10451)
        // OR if htmlContentAllowed changed due to Safari 5 issue
        if ((op == null) || (htmlContentAllowed != wasHtmlContentAllowed)
                || (isMultiselect() != wasMultiselect)) {
            // Create a new element
            if (isMultiselect()) {
                op = new VCheckBox();
            } else {
                op = new RadioButton(paintableId);
                op.setStyleName("v-radiobutton");
            }
            if (iconUrl != null && iconUrl.length() != 0) {
                WidgetUtil.sinkOnloadForImages(op.getElement());
                op.addHandler(iconLoadHandler, LoadEvent.getType());
            }

            op.addStyleName(CLASSNAME_OPTION);
            op.addClickHandler(this);

            optionsToKeys.put(op, key);
        }

        op.setHTML(itemHtml);
        op.setValue(opUidl.getBooleanAttribute("selected"));
        boolean optionEnabled = !opUidl.getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED);
        boolean enabled = optionEnabled && !isReadonly() && isEnabled();
        op.setEnabled(enabled);
        optionsEnabled.put(op, optionEnabled);

        setStyleName(op.getElement(), StyleConstants.DISABLED, !(optionEnabled && isEnabled()));

        newwidgets.add(op);
    }

    if (!newwidgets.equals(existingwidgets)) {
        // Rebuild the panel, losing focus
        panel.clear();
        for (Widget wid : newwidgets) {
            panel.add(wid);
        }
    }

    wasHtmlContentAllowed = htmlContentAllowed;
    wasMultiselect = isMultiselect();
}

From source file:com.vaadin.client.widget.grid.selection.MultiSelectionRenderer.java

License:Apache License

@Override
public void render(final RendererCellReference cell, final Boolean data, CheckBox checkBox) {
    checkBox.setValue(data, false);//w w  w  .j av a 2 s.c o m
    checkBox.setEnabled(!grid.isEditorActive());
    checkBox.getElement().setPropertyInt(LOGICAL_ROW_PROPERTY_INT, cell.getRowIndex());
}

From source file:com.vaadin.terminal.gwt.client.ui.VOptionGroup.java

License:Open Source License

@Override
protected void buildOptions(UIDL uidl) {
    panel.clear();//from   w w  w.j  av a 2s .c  o m
    for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
        final UIDL opUidl = (UIDL) it.next();
        CheckBox op;

        String itemHtml = opUidl.getStringAttribute("caption");
        if (!htmlContentAllowed) {
            itemHtml = Util.escapeHTML(itemHtml);
        }

        String icon = opUidl.getStringAttribute("icon");
        if (icon != null && icon.length() != 0) {
            String iconUrl = client.translateVaadinUri(icon);
            itemHtml = "<img src=\"" + iconUrl + "\" class=\"" + Icon.CLASSNAME + "\" alt=\"\" />" + itemHtml;
        }

        if (isMultiselect()) {
            op = new VCheckBox();
            op.setHTML(itemHtml);
        } else {
            op = new RadioButton(id, itemHtml, true);
            op.setStyleName("v-radiobutton");
        }

        if (icon != null && icon.length() != 0) {
            Util.sinkOnloadForImages(op.getElement());
            op.addHandler(iconLoadHandler, LoadEvent.getType());
        }

        op.addStyleName(CLASSNAME_OPTION);
        op.setValue(opUidl.getBooleanAttribute("selected"));
        boolean enabled = !opUidl.getBooleanAttribute("disabled") && !isReadonly() && !isDisabled();
        op.setEnabled(enabled);
        setStyleName(op.getElement(), ApplicationConnection.DISABLED_CLASSNAME, !enabled);
        op.addClickHandler(this);
        optionsToKeys.put(op, opUidl.getStringAttribute("key"));
        panel.add(op);
    }
}

From source file:com.vaadin.v7.client.ui.VOptionGroup.java

License:Apache License

@Override
public void buildOptions(UIDL uidl) {
    /*/*from w  w  w  .  j ava2  s.  c  om*/
     * In order to retain focus, we need to update values rather than
     * recreate panel from scratch (#10451). However, the panel will be
     * rebuilt (losing focus) if number of elements or their order is
     * changed.
     */
    HashMap<String, CheckBox> keysToOptions = new HashMap<>();
    for (Map.Entry<CheckBox, String> entry : optionsToKeys.entrySet()) {
        keysToOptions.put(entry.getValue(), entry.getKey());
    }
    ArrayList<Widget> existingwidgets = new ArrayList<>();
    ArrayList<Widget> newwidgets = new ArrayList<>();

    // Get current order of elements
    for (Widget wid : panel) {
        existingwidgets.add(wid);
    }

    optionsEnabled.clear();

    if (isMultiselect()) {
        Roles.getGroupRole().set(getElement());
    } else {
        Roles.getRadiogroupRole().set(getElement());
    }

    for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
        final UIDL opUidl = (UIDL) it.next();

        String itemHtml = opUidl.getStringAttribute("caption");
        if (!isHtmlContentAllowed()) {
            itemHtml = WidgetUtil.escapeHTML(itemHtml);
        }

        String iconUrl = opUidl.getStringAttribute("icon");
        if (iconUrl != null && iconUrl.length() != 0) {
            Icon icon = client.getIcon(iconUrl);
            itemHtml = icon.getElement().getString() + itemHtml;
        }

        String key = opUidl.getStringAttribute("key");
        CheckBox op = keysToOptions.get(key);

        // Need to recreate object if isMultiselect is changed (#10451)
        // OR if htmlContentAllowed changed due to Safari 5 issue
        if ((op == null) || (isHtmlContentAllowed() != wasHtmlContentAllowed)
                || (isMultiselect() != wasMultiselect)) {
            // Create a new element
            if (isMultiselect()) {
                op = new VCheckBox();
            } else {
                op = new RadioButton(paintableId);
                op.setStyleName("v-radiobutton");
            }
            if (iconUrl != null && iconUrl.length() != 0) {
                WidgetUtil.sinkOnloadForImages(op.getElement());
                op.addHandler(iconLoadHandler, LoadEvent.getType());
            }

            op.addStyleName(CLASSNAME_OPTION);
            op.addClickHandler(this);

            optionsToKeys.put(op, key);
        }

        op.setHTML(itemHtml);
        op.setValue(opUidl.getBooleanAttribute("selected"));
        boolean optionEnabled = !opUidl.getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED);
        boolean enabled = optionEnabled && !isReadonly() && isEnabled();
        op.setEnabled(enabled);
        optionsEnabled.put(op, optionEnabled);

        setStyleName(op.getElement(), StyleConstants.DISABLED, !(optionEnabled && isEnabled()));

        newwidgets.add(op);
    }

    if (!newwidgets.equals(existingwidgets)) {
        // Rebuild the panel, losing focus
        panel.clear();
        for (Widget wid : newwidgets) {
            panel.add(wid);
        }
    }

    wasHtmlContentAllowed = isHtmlContentAllowed();
    wasMultiselect = isMultiselect();
}

From source file:com.vaadin.v7.client.widget.grid.selection.MultiSelectionRenderer.java

License:Apache License

@Override
public CheckBox createWidget() {
    final CheckBox checkBox = GWT.create(CheckBox.class);
    checkBox.setStylePrimaryName(grid.getStylePrimaryName() + SELECTION_CHECKBOX_CLASSNAME);

    CheckBoxEventHandler handler = new CheckBoxEventHandler(checkBox);

    // Sink events
    checkBox.sinkBitlessEvent(BrowserEvents.MOUSEDOWN);
    checkBox.sinkBitlessEvent(BrowserEvents.TOUCHSTART);
    checkBox.sinkBitlessEvent(BrowserEvents.CLICK);

    // Add handlers
    checkBox.addMouseDownHandler(handler);
    checkBox.addTouchStartHandler(handler);
    checkBox.addClickHandler(handler);//from   w  w  w.  jav a2s .c om
    grid.addHandler(handler, GridEnabledEvent.TYPE);

    checkBox.setEnabled(grid.isEnabled());

    return checkBox;
}

From source file:com.vaadin.v7.client.widget.grid.selection.MultiSelectionRenderer.java

License:Apache License

@Override
public void render(final RendererCellReference cell, final Boolean data, CheckBox checkBox) {
    checkBox.setValue(data, false);/*from   w  w w .  j a v  a  2  s  .c o m*/
    checkBox.setEnabled(grid.isEnabled() && !grid.isEditorActive());
}

From source file:cz.fi.muni.xkremser.editor.client.view.window.AddAltoOcrWindow.java

License:Open Source License

public AddAltoOcrWindow(final ListGridRecord listGridRecord, final LangConstants lang,
        final DispatchAsync dispatcher, EventBus eventBus) {
    super(630, 600, "ALTO", eventBus, 50);
    this.lang = lang;

    HLayout mainLayout = new HLayout(2);
    final VLayout altoLayout = new VLayout(3);
    VLayout ocrLayout = new VLayout(3);

    final Label altoLabel = new Label();
    altoLabel.setContents(HtmlCode.title(lang.choose() + " ALTO", 3));
    altoLabel.setAutoHeight();//  w w w  . j  a  va2 s .co m
    altoLabel.setExtraSpace(8);

    final Label ocrLabel = new Label();
    ocrLabel.setContents(HtmlCode.title(lang.choose() + " OCR", 3));
    ocrLabel.setAutoHeight();
    ocrLabel.setExtraSpace(8);

    foundAltoFilesGrid = new ListGrid();
    foundAltoFilesGrid.setWidth(270);
    foundAltoFilesGrid.setHeight(400);
    foundAltoFilesGrid.setShowSortArrow(SortArrow.CORNER);
    foundAltoFilesGrid.setShowAllRecords(true);
    foundAltoFilesGrid.setExtraSpace(10);
    foundAltoFilesGrid.setSelectionType(SelectionStyle.SINGLE);

    foundOcrFilesGrid = new ListGrid();
    foundOcrFilesGrid.setWidth(270);
    foundOcrFilesGrid.setHeight(400);
    foundOcrFilesGrid.setShowSortArrow(SortArrow.CORNER);
    foundOcrFilesGrid.setShowAllRecords(true);
    foundOcrFilesGrid.setExtraSpace(10);
    foundOcrFilesGrid.setSelectionType(SelectionStyle.SINGLE);

    ModalWindow mw = new ModalWindow(mainLayout);
    mw.setLoadingIcon("loadingAnimation.gif");
    mw.show(true);

    final CheckBox noAnyALTO = new CheckBox(lang.noAny() + " ALTO");
    noAnyALTO.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() {

        @Override
        public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
            if (noAnyALTO.getValue()) {
                foundAltoFilesGrid.disable();
                foundAltoFilesGrid.setOpacity(60);
                altoLabel.setOpacity(60);
            } else {
                foundAltoFilesGrid.enable();
                foundAltoFilesGrid.setOpacity(100);
                altoLabel.setOpacity(100);
            }
        }
    });

    final CheckBox noAnyOCR = new CheckBox(lang.noAny() + " OCR");
    noAnyOCR.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() {

        @Override
        public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
            if (noAnyOCR.getValue()) {
                foundAltoFilesGrid.disable();
                foundOcrFilesGrid.disable();
                foundOcrFilesGrid.setOpacity(60);
                noAnyALTO.setEnabled(false);
                altoLayout.setOpacity(60);
                ocrLabel.setOpacity(60);
            } else {
                foundAltoFilesGrid.enable();
                foundOcrFilesGrid.enable();
                foundOcrFilesGrid.setOpacity(100);
                noAnyALTO.setEnabled(true);
                altoLayout.setOpacity(100);
                ocrLabel.setOpacity(100);
            }
        }
    });

    HLayout buttonsLayout = new HLayout(2);
    buttonsLayout.setAlign(Alignment.RIGHT);

    buttonsLayout.setWidth100();
    Button okButton = new Button("Ok");

    okButton.setExtraSpace(8);
    buttonsLayout.addMember(okButton);
    okButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (!noAnyOCR.getValue()) {
                if (!noAnyALTO.getValue()) {
                    doSaveAction(listGridRecord, foundAltoFilesGrid.getSelectedRecord(),
                            foundOcrFilesGrid.getSelectedRecord());
                } else {
                    doSaveAction(listGridRecord, null, foundOcrFilesGrid.getSelectedRecord());
                }
            } else {
                doSaveAction(listGridRecord, null, null);
            }
        }
    });

    Button closeButton = new Button(lang.close());
    closeButton.setExtraSpace(10);
    closeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    buttonsLayout.addMember(closeButton);

    altoLayout.addMember(altoLabel);
    altoLayout.addMember(foundAltoFilesGrid);
    altoLayout.addMember(noAnyALTO);

    ocrLayout.addMember(ocrLabel);
    ocrLayout.addMember(foundOcrFilesGrid);
    ocrLayout.addMember(noAnyOCR);

    mainLayout.addMember(altoLayout);
    mainLayout.addMember(ocrLayout);
    addItem(mainLayout);

    addItem(buttonsLayout);

    setEdgeOffset(20);
    findFiles(listGridRecord, dispatcher);
    centerInPage();
    show();
    focus();
    mw.destroy();
}

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

License:Open Source License

/**
 * Load data into the page// w  ww  .java 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);
                }
            }
        }
    });
}