List of usage examples for com.google.gwt.user.client.ui DialogBox DialogBox
public DialogBox()
From source file:com.cognitivemedicine.metricsdashboard.client.widgets.Alerts.java
License:Apache License
public static void notify(Panel parent, String title, String message) { final DialogBox d = new DialogBox(); d.setText(title);//w w w . ja v a2s . co m d.setModal(false); // d.center(); Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { d.hide(); } }); // d.add(closeButton); d.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { d.hide(); } }); VerticalPanel v = new VerticalPanel(); // v.add(new Label(message)); HTML html = new HTML(); html.setHTML(message); html.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { d.hide(); } }); v.add(html); v.add(closeButton); d.setWidget(v); // d.setPopupPosition(Window.getClientWidth()-d.getOffsetWidth(), // Window.getClientHeight()-d.getOffsetWidth()); Timer t = new Timer() { @Override public void run() { d.hide(); } }; t.schedule(3000); d.setWidth("300px"); d.setHeight("200px"); d.center(); // d.setPopupPosition(Window.getClientWidth()-d.getOffsetWidth(), // Window.getClientHeight()-d.getOffsetWidth()); // d.show(); }
From source file:com.connoisseur.menuapp.client.Authenticate.java
/** This is essentially the main method for the menu app. */ public static void go() { storage.clear(); // uncomment to completely reset app final DialogBox startupBox = new DialogBox(); // movable box that contains widgets startupBox.setAnimationEnabled(true); final VerticalPanel startupPanel = new VerticalPanel(); // can contain other widgets startupPanel.addStyleName("marginPanel"); // interacts with Menuapp.css startupPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); // check to see if storage is supported if (storage != null) { // load viewer if license key and restID have been submitted before if (storage.getLength() > 0) { Viewer.loadViewer();//from w w w . j a va 2 s .c o m } // otherwise load authentication UI in order to receive input else { final Button submitButton = new Button("Submit"); // "Submit" appears on button submitButton.addStyleName("myButton"); // interacts with Menuapp.css final HorizontalPanel buttonPanel = new HorizontalPanel(); // used to center button buttonPanel.addStyleName("marginlessPanel"); // license widgets final Label licenseErrorLabel = new Label(); // dynamic text licenseErrorLabel.addStyleName("errorLabel"); // interacts with Menuapp.css final TextBox submitLicense = new TextBox(); // user can input text using this submitLicense.setText("license key..."); // default text to be seen on load // restaurant ID widgets final Label restErrorLabel = new Label(); restErrorLabel.addStyleName("errorLabel"); final TextBox submitRestID = new TextBox(); submitRestID.setText("restaurant ID..."); // organize UI startupPanel.add(new HTML("Please enter your license key:")); startupPanel.add(submitLicense); startupPanel.add(licenseErrorLabel); startupPanel.add(new HTML("<br>Please enter your restaurant ID:")); startupPanel.add(submitRestID); startupPanel.add(restErrorLabel); startupPanel.add(new HTML("<br>")); buttonPanel.add(submitButton); startupPanel.add(buttonPanel); // setup startupBox, which is what will be seen by the user startupBox.setWidget(startupPanel); // connects the two widgets startupBox.center(); // also shows the box // focus the cursor on submitLicense when startupBox appears submitLicense.setFocus(true); submitLicense.selectAll(); // create a handler for submitButton, submitLicense and submitRestID class MyHandler implements ClickHandler, KeyUpHandler { /** Fired when the user clicks submit. */ public void onClick(ClickEvent event) { submit(); } /** Fired when the user presses Enter in a submit field. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) submit(); } /** Checks the submitted license key and restaurant ID for validity. Loads Viewer if valid. */ private void submit() { String license = submitLicense.getText(); // unused for now String restID = submitRestID.getText(); // not sure how to validate yet int returnFlag = 0; // so that both tests can be done licenseErrorLabel.setText(""); restErrorLabel.setText(""); // validate license String result = FieldVerifier.isValidLicenseKey(license); // from FieldVerifier.java if (!result.equals("")) { // error licenseErrorLabel.setText("You submitted an invalid license key."); submitLicense.selectAll(); returnFlag = 1; } // validate restID result = FieldVerifier.isValidRestaurantID(restID); if (!result.equals("")) { // error restErrorLabel.setText("You submitted an invalid restaurant ID."); submitRestID.selectAll(); returnFlag = 1; } // don't do anything until the errors are resolved if (returnFlag == 1) return; // clean up submitButton.setEnabled(false); submitLicense.setEnabled(false); submitRestID.setEnabled(false); startupBox.hide(); // set up storage storage.setItem("license", license); // secret key for security storage.setItem("restID", restID); // used for almost every call to the backend // show menu Viewer.loadViewer(); } } // MyHandler // attach the handler final MyHandler handler = new MyHandler(); submitButton.addClickHandler(handler); submitLicense.addKeyUpHandler(handler); submitRestID.addKeyUpHandler(handler); } // else load authentication UI } // if storage supported // storage is not supported, so report error else { startupPanel.add(new HTML("<font color=red>The app will not function because local<br>" + "storage is not supported on this platform.</font>")); startupBox.setWidget(startupPanel); startupBox.center(); } }
From source file:com.dawg6.gwt.client.DefaultWidgetFactory.java
License:Open Source License
@Override public DialogBox createDialogBox() { return new DialogBox(); }
From source file:com.dominichenko.pet.gwt.phys2d.client.utils.Messenger.java
License:Apache License
/** * Default constructor of message box.//from w w w. j av a 2 s . co m */ public Messenger() { dialogBox = new DialogBox(); dialogBox.setAnimationEnabled(true); dialogBox.setGlassEnabled(true); dialogBox.setModal(true); messengerPane = new MessengerPane(dialogBox); dialogBox.add(messengerPane); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.BatchClassManagementPresenter.java
License:Open Source License
/** * To show Add New Module View.//w ww.j ava2 s.co m */ public void showAddNewModuleView() { final DialogBox dialogBox = new DialogBox(); AddNewModuleView addNewModuleView = new AddNewModuleView(); AddNewModulePresenter addNewModulePresenter = new AddNewModulePresenter(controller, addNewModuleView); addNewModuleView.setDialogBox(dialogBox); addNewModulePresenter.bind(); addNewModulePresenter.showAddNewModuleView(); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.BatchClassManagementPresenter.java
License:Open Source License
/** * To do processing on export button click. * /*from w ww.ja va 2 s. c o m*/ * @param batchClassIdentifier String */ public void onExportButtonClicked(final String batchClassIdentifier) { controller.getRpcService().getBatchFolderList(new EphesoftAsyncCallback<BatchFolderListDTO>() { @Override public void customFailure(Throwable arg0) { /* * On Failure */ } @Override public void onSuccess(BatchFolderListDTO batchFolderList) { final DialogBox dialogBox = new DialogBox(); final ExportBatchClassView exportBatchClassView = new ExportBatchClassView(); ExportBatchClassPresenter exportBatchClassPresenter = new ExportBatchClassPresenter(controller, exportBatchClassView); exportBatchClassPresenter.setBatchFolderListDTO(batchFolderList); exportBatchClassView.setDialogBox(dialogBox); // exportBatchClassView.getDialogBox().show(); exportBatchClassView.setExportBatchClassIdentifier(batchClassIdentifier); exportBatchClassPresenter.bind(); exportBatchClassPresenter.showBatchClassExportView(); exportBatchClassView.getSaveButton().setFocus(true); exportBatchClassPresenter.setFolderList(); } }); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.BatchClassManagementPresenter.java
License:Open Source License
/** * To do processing on import button click. *//*from www. j a va 2s .c om*/ public void onImportButtonClicked() { controller.getRpcService().getBatchFolderList(new EphesoftAsyncCallback<BatchFolderListDTO>() { @Override public void customFailure(Throwable arg0) { /* * On Failure */ } @Override public void onSuccess(BatchFolderListDTO batchFolderList) { final DialogBox dialogBox = new DialogBox(); final ImportBatchClassView importBatchClassView = new ImportBatchClassView(); ImportBatchClassPresenter importBatchClassPresenter = new ImportBatchClassPresenter(getController(), importBatchClassView); importBatchClassPresenter.setBatchFolderListDTO(batchFolderList); importBatchClassView.setDialogBox(dialogBox); importBatchClassPresenter.bind(); importBatchClassPresenter.showBatchClassImportView(); importBatchClassView.getSaveButton().setFocus(true); } }); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.BatchClassManagementPresenter.java
License:Open Source License
/** * To get Sample Patterns./* ww w . jav a 2 s.c om*/ */ public void getSamplePatterns() { ScreenMaskUtility.maskScreen(); controller.getRpcService().getSamplePatterns(new EphesoftAsyncCallback<SamplePatternDTO>() { @Override public void customFailure(Throwable arg0) { ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get() .getMessageValue(BatchClassManagementMessages.UNABLE_TO_READ_SAMPLE_PATTERN_FILE)); ScreenMaskUtility.unmaskScreen(); } @Override public void onSuccess(SamplePatternDTO samplePatterns) { ScreenMaskUtility.unmaskScreen(); final DialogBox dialogBox = new DialogBox(); final SamplePatternView samplePatternView = new SamplePatternView(); SamplePatternPresenter samplePatternPresenter = new SamplePatternPresenter(controller, samplePatternView); samplePatternView.createSamplePatternList(samplePatterns); samplePatternView.setDialogBox(dialogBox); samplePatternPresenter.bind(); samplePatternPresenter.showSamplePatternView(samplePatterns); } }); }
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. * /* w ww . j a va 2 s . 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. * // w ww .j a v a 2 s. c om * @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(); } }); }