Example usage for com.google.gwt.user.client.ui DialogBox show

List of usage examples for com.google.gwt.user.client.ui DialogBox show

Introduction

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

Prototype

@Override
    public void show() 

Source Link

Usage

From source file:net.sf.mmm.client.ui.gwt.widgets.richtext.RichTextToolbar.java

License:Apache License

/**
 * @param feature is the {@link RichTextFeature} to invoke (e.g. if according button has been clicked).
 *///from  w ww  .  ja  v  a2s . c o  m
protected void invokeFeature(RichTextFeature feature) {

    switch (feature) {
    case BOLD:
        RichTextToolbar.this.formatter.toggleBold();
        break;
    case ITALIC:
        RichTextToolbar.this.formatter.toggleItalic();
        break;
    case UNDERLINE:
        RichTextToolbar.this.formatter.toggleUnderline();
        break;
    case SUBSCRIPT:
        RichTextToolbar.this.formatter.toggleSubscript();
        break;
    case SUPERSCRIPT:
        RichTextToolbar.this.formatter.toggleSuperscript();
        break;
    case STRIKETHROUGH:
        RichTextToolbar.this.formatter.toggleStrikethrough();
        break;
    case ALIGN_LEFT:
        RichTextToolbar.this.formatter.setJustification(Justification.LEFT);
        break;
    case ALIGN_CENTER:
        RichTextToolbar.this.formatter.setJustification(Justification.CENTER);
        break;
    case ALIGN_RIGHT:
        RichTextToolbar.this.formatter.setJustification(Justification.RIGHT);
        break;
    case UNORDERED_LIST:
        RichTextToolbar.this.formatter.insertUnorderedList();
        break;
    case ORDERED_LIST:
        RichTextToolbar.this.formatter.insertOrderedList();
        break;
    case HORIZONTAL_LINE:
        RichTextToolbar.this.formatter.insertHorizontalRule();
        break;
    case INSERT_IMAGE:
        String url = Window.prompt(this.bundle.labelEnterImageUrl().getLocalizedMessage(), "http://");
        if (url != null) {
            RichTextToolbar.this.formatter.insertImage(url);
        }
        break;
    case INSERT_LINK:
        url = Window.prompt(this.bundle.labelEnterLinkUrl().getLocalizedMessage(), "http://");
        if (url != null) {
            RichTextToolbar.this.formatter.createLink(url);
            // this.linkMode = true;
        }
        break;
    case REMOVE_FORMAT:
        this.formatter.removeFormat();
        this.formatter.removeLink();
        break;
    case FONT_FAMILY:
        final DialogBox popup = new DialogBox();
        popup.setStylePrimaryName("Popup");
        popup.setText("Please choose font");
        Grid content = new Grid(3, 2);
        content.setWidget(0, 0, new Label("Font-Family"));
        final ListBox dropdownFontFamily = new ListBox(false);
        for (String font : JavaScriptUtil.getInstance().getAvailableFonts()) {
            dropdownFontFamily.addItem(font);
        }
        content.setWidget(0, 1, dropdownFontFamily);
        content.setWidget(1, 0, new Label("Font-Size"));
        final ListBox dropdownFontSize = new ListBox(false);
        for (FontSize size : FONT_SIZES) {
            dropdownFontSize.addItem(Integer.toString(size.getNumber()));
        }
        content.setWidget(1, 1, dropdownFontSize);
        Button widget = new Button("OK");
        ClickHandler handler = new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {

                popup.hide();
                String fontFamily = dropdownFontFamily.getValue(dropdownFontFamily.getSelectedIndex());
                RichTextToolbar.this.formatter.setFontName(fontFamily);
                String fontSize = dropdownFontSize.getValue(dropdownFontSize.getSelectedIndex());
                for (FontSize size : FONT_SIZES) {
                    if (Integer.toString(size.getNumber()).equals(fontSize)) {
                        RichTextToolbar.this.formatter.setFontSize(size);
                    }
                }
            }
        };
        widget.addClickHandler(handler);
        content.setWidget(2, 0, widget);
        popup.setGlassEnabled(true);
        popup.setWidget(content);
        popup.center();
        popup.show();
        break;
    case FONT_SIZE:
        JsSelection selection = JavaScriptUtil.getInstance()
                .getSelection(RichTextToolbar.this.richTextArea.getElement());
        Window.alert(selection.getText() + "\n" + selection.getHtml());
        // RichTextToolbar.this.formatter.setFontSize(fontSize);
        break;
    case INDENT:
        RichTextToolbar.this.formatter.rightIndent();
        break;
    case OUTDENT:
        RichTextToolbar.this.formatter.leftIndent();
        break;
    case UNDO:
        RichTextToolbar.this.formatter.undo();
        break;
    case REDO:
        RichTextToolbar.this.formatter.redo();
        break;
    default:
        break;
    }
}

From source file:net.urlgrey.mythpodcaster.client.UnsubscribeHandler.java

License:Open Source License

@Override
public void onClick(ClickEvent event) {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    dialogBox.ensureDebugId("cwDialogBox");
    dialogBox.setText("Unsubscribe?");

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);/*from   ww w.j  ava 2  s  . co  m*/
    dialogBox.setWidget(dialogContents);

    // Add some text to the top of the dialog
    HTML details = new HTML("Are you sure you want to unsubscribe?");
    dialogContents.add(details);
    dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER);

    // Add a cancel button at the bottom of the dialog
    final Button cancelButton = new Button("Cancel", new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });

    // Add a cancel button at the bottom of the dialog
    final Button okButton = new Button("OK", new ClickHandler() {
        public void onClick(ClickEvent event) {
            UIControllerServiceAsync service = (UIControllerServiceAsync) GWT.create(UIControllerService.class);
            try {
                service.removeSubscription(seriesId, transcodingProfile, new AsyncCallback<Boolean>() {

                    @Override
                    public void onFailure(Throwable arg0) {
                        parent.refreshData();
                    }

                    @Override
                    public void onSuccess(Boolean arg0) {
                        parent.refreshData();
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
            }

            dialogBox.hide();
        }
    });

    final SimplePanel buttonTopSpacer = new SimplePanel();
    buttonTopSpacer.setHeight("20px");

    final SimplePanel buttonSpacer = new SimplePanel();
    buttonSpacer.setWidth("30px");

    HorizontalPanel buttonRow = new HorizontalPanel();
    buttonRow.add(cancelButton);
    buttonRow.add(buttonSpacer);
    buttonRow.add(okButton);
    dialogContents.add(buttonTopSpacer);
    dialogContents.add(buttonRow);
    dialogContents.setCellHorizontalAlignment(buttonRow, HasHorizontalAlignment.ALIGN_CENTER);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        dialogContents.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_LEFT);

    } else {
        dialogContents.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    dialogBox.center();
    dialogBox.show();
}

From source file:no.eirikb.bomberman.client.ui.game.GamePanelContainer.java

License:BEER-WARE LICENSE

private void killCheck() {
    game.addGameListener(new GameListener() {

        @Override/*ww  w .  j  a va2 s.c om*/
        public void addSprite(Sprite sprite) {
        }

        @Override
        public void removeSprite(Sprite sprite) {
        }

        @Override
        public void bump(Player player, Sprite sprite) {
        }

        @Override
        public void playerDie(final Player player) {
            if (player == gamePanel.getPlayer()) {
                gameService.died(new AsyncCallback() {

                    @Override
                    public void onFailure(Throwable caught) {
                    }

                    @Override
                    public void onSuccess(Object result) {
                    }
                });
                gamePanel.remove(player.getImage());
                final DialogBox dialogBox = new DialogBox();
                dialogBox.setText("Oh noes!");
                VerticalPanel v = new VerticalPanel();
                v.add(new Image("img/ohnoes.jpg"));
                v.add(new Label("Congratulations! You just died"));
                Button resurectButton = new Button("Resurect!", new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        gameService.resurect(new AsyncCallback() {

                            @Override
                            public void onFailure(Throwable caught) {
                            }

                            @Override
                            public void onSuccess(Object result) {
                            }
                        });
                        player.setX(player.getStartX());
                        player.setY(player.getStartY());
                        game.playerLive(player);
                        dialogBox.setVisible(false);
                        dialogBox.hide();
                        focusPanel.setFocus(true);
                    }
                });
                v.add(resurectButton);
                dialogBox.setWidget(v);
                dialogBox.setAnimationEnabled(true);
                dialogBox.setPopupPosition(
                        gamePanel.getAbsoluteLeft() + (Settings.getInstance().getMapWidth() / 4),
                        gamePanel.getAbsoluteTop() + (Settings.getInstance().getMapHeight() / 4));
                dialogBox.show();
                resurectButton.setFocus(true);
            }
        }

        @Override
        public void playerLive(Player player) {
        }
    });

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.EMailTemplateSend.java

License:Apache License

public static void doDialog(LoginInfo loginInfo, AppPackage appPackage, List<String> reportIds,
        final RemoteDataServiceAsync remoteService, final DialogCallback callback) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.emailLabelSend(appPackage.AppName));

    // Create a table to layout the content
    EMailTemplateSend pet = new EMailTemplateSend(loginInfo, appPackage, reportIds, remoteService,
            new EMailTemplateSend.DialogCallback() {

                @Override//from ww w  .  ja va  2s .c o m
                public void result(boolean ok) {
                    if (ok) {
                        dialogBox.hide();
                    } else {
                        dialogBox.hide();
                    }

                }
            });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.EMailTemplateSend.java

License:Apache License

public static void doDialog(LoginInfo loginInfo, AppPackage appPackage, ACRALog acraLog,
        final RemoteDataServiceAsync remoteService, final DialogCallback callback) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.emailLabelSend(appPackage.AppName));

    // Create a table to layout the content
    EMailTemplateSend pet = new EMailTemplateSend(loginInfo, appPackage, acraLog, remoteService,
            new EMailTemplateSend.DialogCallback() {

                @Override/*w ww . j ava 2  s  .  c  o m*/
                public void result(boolean ok) {
                    if (ok) {
                        dialogBox.hide();
                    } else {
                        dialogBox.hide();
                    }

                }
            });

    pet.setWidth("680px");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.MappingList.java

License:Apache License

public static void doDialog(final LoginInfo loginInfo, final String packageName,
        final DialogCallback callback) {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.mappingListLabelTitle(packageName));

    MappingList mappinglist = new MappingList(loginInfo, packageName, new DialogCallback() {

        @Override/* w  ww .j  ava  2s  .c o m*/
        public void closed() {
            dialogBox.hide();
            callback.closed();
        }
    });

    mappinglist.setHeight(Window.getClientHeight() - 50 + "px");

    mappinglist.setWidth("500px");
    dialogBox.setWidget(mappinglist);
    dialogBox.center();
    dialogBox.show();
}

From source file:nz.org.winters.appspot.acrareporter.client.ui.MappingUpload.java

License:Apache License

public static void doEditDialog(LoginInfo loginInfo, String packageName, final DialogCallback callback) {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.mappingUploadLabelTitle(packageName));

    // Create a table to layout the content
    MappingUpload pet = new MappingUpload(loginInfo, packageName, new MappingUpload.DialogCallback() {

        @Override//from   w ww  .  jav  a2  s .  c  om
        public void result(boolean ok) {
            dialogBox.hide();
            callback.result(ok);
        }
    });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.PackageEdit.java

License:Apache License

public static void doEditDialog(AppPackage appPackage, final RemoteDataServiceAsync remoteService,
        final DialogCallback callback) {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.packageEditLabelEdit(appPackage.PACKAGE_NAME));

    // Create a table to layout the content
    PackageEdit pet = new PackageEdit(appPackage, new PackageEdit.DialogCallback() {

        @Override//from  ww w  .  ja  v  a  2  s.  c  om
        public void result(boolean ok, final AppPackage appPackage) {
            if (ok) {
                remoteService.writeAppPackage(appPackage, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {

                    }

                    @Override
                    public void onSuccess(Void result) {
                        dialogBox.hide();
                        callback.result(true, appPackage);

                    }

                });
            } else {
                dialogBox.hide();
            }

        }
    });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.PackageEdit.java

License:Apache License

public static void doAddDialog(final LoginInfo loginInfo, final RemoteDataServiceAsync remoteService,
        final DialogCallback callback) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.packageEditLabelAdd());

    // Create a table to layout the content
    PackageEdit pet = new PackageEdit(new PackageEdit.DialogCallback() {

        @Override//from www.ja v  a2 s  .  c  om
        public void result(boolean ok, final AppPackage appPackage) {
            if (ok) {
                remoteService.addAppPackage(loginInfo, appPackage, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {

                    }

                    @Override
                    public void onSuccess(Void result) {
                        dialogBox.hide();
                        callback.result(true, appPackage);

                    }

                });
            } else {
                dialogBox.hide();
            }

        }
    });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.UserEdit.java

License:Apache License

public static void doEditDialog(AppUser appUser, final RemoteDataServiceAsync remoteService) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Edit User Information");

    // Create a table to layout the content
    UserEdit pet = new UserEdit(appUser, new UserEdit.DialogCallback() {

        @Override/*from ww  w  . j a  v a2s  . c  o m*/
        public void result(boolean ok, AppUser appUser) {
            if (ok) {
                remoteService.writeAppUser(appUser, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {

                    }

                    @Override
                    public void onSuccess(Void result) {
                        dialogBox.hide();

                    }

                });
            } else {
                dialogBox.hide();
            }

        }
    });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

}