List of usage examples for com.google.gwt.user.client.ui DialogBox show
@Override public void show()
From source file:client.Tetris.java
License:Apache License
public static void gameOverEx() { // Create the dialog box final DialogBox dialogBox = new DialogBox(); final String gameOverText = "You just lost <a href='http://www.google.com/" + "search?q=lost+the+game'>The Game</a>"; dialogBox.setHTML(gameOverText);//from www .j a v a2s.c o m dialogBox.setAnimationEnabled(true); HTML html = new HTML("<u>Controls</u><br/>" + "<b>Right Left Down</b>: move around<br/>" + "<b>Up</b>: rotate clockwise<br/>" + "<b>Space</b>: drop"); Button button = new Button("New Game"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setWidth("100%"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialogVPanel.add(html); dialogVPanel.add(button); button.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); newGame(); } }); // Set the contents of the Widget dialogBox.setWidget(dialogVPanel); dialogBox.center(); dialogBox.show(); }
From source file:com.akjava.gwt.subplayer.client.SubPlayer.java
License:Apache License
private void loadSrt(final int selectIndex) { final String text = loadPanel.getText(); final DialogBox dialog = new DialogBox(); //dialog.setSize("200px", "200px"); dialog.setText("Subtitle Parsing"); //GWT.log(loadImg.getUrl()); //loadImg.setVisible(true); VerticalPanel vpanel = new VerticalPanel(); //Image img=new Image("../img/loadanime.gif"); //GWT.log(img.getUrl()); //loadImg.setVisible(true); vpanel.add(loadImg);/*from ww w .j a v a2 s . c o m*/ dialog.setWidget(vpanel); dialog.setModal(true); dialog.setGlassEnabled(true); dialog.show(); dialog.center(); Timer timer = new Timer() { @Override public void run() { SRTParser parser = new SRTParser(); SRTList list = parser.parse(text.split("\n")); dialog.hide(); playerWidget.setSubLength(list.size()); if (list.size() > 0) { preference.setSrtText(text); preference.setSrtSelectIndex(0); playerWidget.setSubIndex(0); } itemPanel.clear(); for (int i = 0; i < list.size(); i++) { SRTObject srt = list.getSRTObjectAt(i); SRTItemPanel panel = new SRTItemPanel(srt); panel.addClickHandler(selectWidgetHandler); itemPanel.add(panel); } initPlayerSettings(); tab.selectTab(0);//switch to view //label mode updateNoSubtitleWarning(); selectWidget(selectIndex); } }; timer.schedule(100); }
From source file:com.controlj.addon.gwttree.client.Dialog.java
License:Open Source License
private static void showErrorDialog(String title, String html, String text) { // Create a dialog box and set the caption text final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);/* w ww. j av a2 s. co m*/ // Create a table to layout the content VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); dialogBox.setWidget(dialogContents); // Add either HTML or Text Widget details = html != null ? new HTML(html) : new Label(text); dialogContents.add(details); dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER); // Add a close button at the bottom of the dialog Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogContents.add(closeButton); dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); // final configuration and show the dialog box dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); dialogBox.show(); }
From source file:com.controlj.addon.gwttree.client.Dialog.java
License:Open Source License
/**<!====== showInputDialog ===============================================> Displays a dialog box allowing input from the user. The dialog contains both "OK" and "Cancel" buttons. Before it is displayed, the {@link Handler#setupButtons} method is called (to allow "hotkeys" to be associated with the buttons). When the dialog is closed by the user the {@link Handler#dialogClosed} method is called so that appropriate action can be taken. This method immediately returns to the caller. <! Name Description> @param titleBar The dialog title./*from w ww.j a va 2s.c o m*/ @param content The content (can be a panel with lots of controls). @param handler The handler for when the dialog is closed. <!=======================================================================>*/ public static void showInputDialog(String titleBar, Widget content, Handler handler) { // Create a dialog box and set the caption text final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(titleBar); // Create a table to layout the content VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); dialogContents.add(content); // Add Ok and Cancel buttons at the bottom of the dialog Widget buttonPanel = createButtonPanel(dialogBox, handler); dialogContents.add(buttonPanel); dialogContents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER); // final configuration and show the dialog box dialogBox.setWidget(dialogContents); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); dialogBox.show(); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static void showConfirmDialog(String title, String message, String cancelButtonText, String confirmButtonText, final AsyncCallback<Boolean> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);/*from w w w. java 2s . co m*/ FlowPanel layout = new FlowPanel(); Label messageLabel = new Label(message); Button cancelButton = new Button(cancelButtonText); Button confirmButton = new Button(confirmButtonText); FlowPanel footer = new FlowPanel(); layout.add(messageLabel); layout.add(footer); footer.add(cancelButton); footer.add(confirmButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(false); } }); confirmButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(true); } }); dialogBox.addStyleName("wui-dialog-confirm"); layout.addStyleName("wui-dialog-layout"); footer.addStyleName("wui-dialog-layout-footer"); messageLabel.addStyleName("wui-dialog-message"); cancelButton.addStyleName("btn btn-link"); confirmButton.addStyleName("btn btn-play"); dialogBox.center(); dialogBox.show(); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static void showInformationDialog(String title, String message, String continueButtonText, final AsyncCallback<Void> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);/*from ww w . j av a2 s. co m*/ FlowPanel layout = new FlowPanel(); Label messageLabel = new Label(message); Button continueButton = new Button(continueButtonText); layout.add(messageLabel); layout.add(continueButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); continueButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(null); } }); dialogBox.addStyleName("wui-dialog-information"); layout.addStyleName("wui-dialog-layout"); messageLabel.addStyleName("wui-dialog-message"); continueButton.addStyleName("btn btn-play"); dialogBox.center(); dialogBox.show(); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static void showPromptDialog(String title, String message, String placeHolder, final RegExp validator, String cancelButtonText, String confirmButtonText, final AsyncCallback<String> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);//from www .j a v a 2 s .c om final FlowPanel layout = new FlowPanel(); if (message != null) { final Label messageLabel = new Label(message); layout.add(messageLabel); messageLabel.addStyleName("wui-dialog-message"); } final TextBox inputBox = new TextBox(); if (placeHolder != null) { inputBox.getElement().setPropertyString("placeholder", placeHolder); } final Button cancelButton = new Button(cancelButtonText); final Button confirmButton = new Button(confirmButtonText); layout.add(inputBox); layout.add(cancelButton); layout.add(confirmButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onFailure(null); } }); confirmButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(inputBox.getText()); } }); inputBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { boolean isValid = validator.test(inputBox.getText()); if (isValid) { inputBox.addStyleName("error"); } else { inputBox.removeStyleName("error"); } } }); inputBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { boolean isValid = validator.test(inputBox.getText()); confirmButton.setEnabled(isValid); } }); inputBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { boolean isValid = validator.test(inputBox.getText()); if (isValid) { dialogBox.hide(); callback.onSuccess(inputBox.getText()); } } } }); confirmButton.setEnabled(validator.test(inputBox.getText())); dialogBox.addStyleName("wui-dialog-prompt"); layout.addStyleName("wui-dialog-layout"); inputBox.addStyleName("form-textbox wui-dialog-message"); cancelButton.addStyleName("btn btn-link"); confirmButton.addStyleName("pull-right btn btn-play"); dialogBox.center(); dialogBox.show(); inputBox.setFocus(true); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static DialogBox showLoadingModel() { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText("Loading..."); FlowPanel layout = new FlowPanel(); Label messageLabel = new Label(messages.executingTaskMessage()); layout.add(messageLabel);//ww w . j a va 2 s .co m dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); dialogBox.addStyleName("wui-dialog-information"); layout.addStyleName("wui-dialog-layout"); messageLabel.addStyleName("wui-dialog-message"); dialogBox.center(); dialogBox.show(); return dialogBox; }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.documenttype.DocumentTypeViewPresenter.java
License:Open Source License
/** * To perform operations in case of test table button clicked. * //from w ww .j a va 2s . c o m * @param identifier String */ public void onTestTableButtonClicked(String identifier) { ScreenMaskUtility.maskScreen(); controller.setTableInfoSelectedField(controller.getSelectedDocument().getTableInfoByIdentifier(identifier)); controller.getRpcService().testTablePattern(controller.getBatchClass(), controller.getSelectedTableInfoField(), new EphesoftAsyncCallback<List<TestTableResultDTO>>() { @Override public void customFailure(Throwable throwable) { ScreenMaskUtility.unmaskScreen(); final ConfirmationDialog dialog = ConfirmationDialogUtil.showConfirmationDialog( throwable.getMessage(), MessageConstants.TITLE_TEST_FAILURE, Boolean.TRUE, Boolean.TRUE); dialog.addDialogListener(new DialogListener() { @Override public void onOkClick() { dialog.hide(true); } @Override public void onCancelClick() { // TODO Auto-generated method stub } }); dialog.okButton.setStyleName(AdminConstants.BUTTON_STYLE); } @Override public void onSuccess(List<TestTableResultDTO> outputDtos) { ScreenMaskUtility.unmaskScreen(); DialogBox dialogBox = new DialogBox(); dialogBox.addStyleName("width500px"); dialogBox.setHeight("200px"); tableTestResultView.createTestTableList(outputDtos); tableTestResultView.setDialogBox(dialogBox); dialogBox.setText(MessageConstants.TEST_TABLE_RESULT_HEADER); dialogBox.setWidget(tableTestResultView); dialogBox.center(); tableTestResultView.getBackButton().setFocus(true); dialogBox.show(); } }); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.fieldtype.FieldTypeViewPresenter.java
License:Open Source License
/** * To perform operations when test KV button is clicked. * /* ww w . j a v a 2 s. c o m*/ * @param identifier String */ public void onTestKVButtonClicked(String identifier) { ScreenMaskUtility.maskScreen(); controller.setSelectedKVExtraction( controller.getSelectedDocumentLevelField().getKVExtractionDTOByIdentifier(identifier)); controller.getRpcService().testKVExtraction(controller.getBatchClass(), controller.getSelectedKVExtraction(), null, false, new EphesoftAsyncCallback<List<OutputDataCarrierDTO>>() { @Override public void customFailure(Throwable throwable) { ScreenMaskUtility.unmaskScreen(); final ConfirmationDialog dialog = ConfirmationDialogUtil.showConfirmationDialog( throwable.getMessage(), MessageConstants.TITLE_TEST_FAILURE, Boolean.TRUE); dialog.addDialogListener(new DialogListener() { @Override public void onOkClick() { dialog.hide(true); } @Override public void onCancelClick() { // TODO Auto-generated method stub } }); } @Override public void onSuccess(List<OutputDataCarrierDTO> outputDtos) { ScreenMaskUtility.unmaskScreen(); DialogBox dialogBox = new DialogBox(); dialogBox.addStyleName("width500px"); dialogBox.setHeight("200px"); kvExtractionTestResultView.createKVFieldList(outputDtos); kvExtractionTestResultView.setDialogBox(dialogBox); dialogBox.setText(KV_EXTRACTION_RESULT); dialogBox.setWidget(kvExtractionTestResultView); dialogBox.center(); kvExtractionTestResultView.getBackButton().setFocus(true); dialogBox.show(); } }); }