List of usage examples for com.google.gwt.user.client.ui DialogBox DialogBox
public DialogBox(boolean autoHide, boolean modal)
From source file:ca.upei.ic.timetable.client.CourseDetailModelView.java
License:Apache License
public CourseDetailModelView(CourseDetailController controller) { this.controller_ = controller; dialogBox_ = new DialogBox(true, false); dialogBox_.setText("Course Details"); }
From source file:ca.upei.ic.timetable.client.FindCourseView.java
License:Apache License
public FindCourseView(FindCourseViewController controller) { controller_ = controller;/* w ww.j a v a 2 s . c om*/ // set up the dialog box dialogBox_ = new DialogBox(false, true); // autohide = false, modal = true dialogBox_.setAnimationEnabled(true); dialogBox_.setText("Find Courses..."); // i have a horizontal panel HorizontalPanel filterPanel = new HorizontalPanel(); // i have a level flex table levelTable_ = controller_.getLevelModel().getWidget(); departmentTable_ = controller_.getDepartmentModel().getWidget(); semesterTable_ = controller_.getSemesterModel().getWidget(); startTimeWidget_ = controller_.getStartTimeModel().getWidget(); // button panel HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT); // i have an OK button final Button okButton = new Button("Search"); okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { // search and close the dialog controller_.search(); hide(); } }); okButton.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { } public void onKeyUp(Widget sender, char keyCode, int modifiers) { if (keyCode == KeyboardListener.KEY_ENTER) { okButton.click(); } } }); final Button cancelButton = new Button("Cancel"); cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { hide(); } }); cancelButton.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { } public void onKeyUp(Widget sender, char keyCode, int modifiers) { if (keyCode == KeyboardListener.KEY_ESCAPE) cancelButton.click(); } }); SimplePanel empty = new SimplePanel(); empty.setWidth("230px"); buttonPanel.add(empty); buttonPanel.add(cancelButton); buttonPanel.add(okButton); buttonPanel.setSpacing(5); buttonPanel.setWidth("485px"); // add the panel to the dialog box dialogBox_.add(PanelUtils.verticalPanel(PanelUtils.horizontalPanel( PanelUtils.verticalPanel(PanelUtils.scrollPanel(levelTable_, 250, 180), PanelUtils.scrollPanel(semesterTable_, 250, 120), PanelUtils.scrollPanel(startTimeWidget_, 250, 30)), PanelUtils.scrollPanel(departmentTable_, 250, 320)), buttonPanel)); dialogBox_.setPopupPosition(240, 0); }
From source file:ca.upei.ic.timetable.client.MessageView.java
License:Apache License
public MessageView(MessageViewController controller) { controller_ = controller;/*from w w w. ja v a 2s .c om*/ dialogBox_ = new DialogBox(true, true); dialogBox_.setText("Messages"); dialogBox_.setAnimationEnabled(true); dialogBox_.hide(); // XXX a hack to make sure the dialog display top most dialogBox_.getElement().getStyle().setProperty("z-index", "100"); ScrollPanel scrolled = new ScrollPanel(); scrolled.setPixelSize(350, 250); panel_ = new VerticalPanel(); panel_.setWidth("232px"); scrolled.add(panel_); Button closeButton = new Button("Close"); closeButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox_.hide(); } }); closeButton.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == KeyboardListener.KEY_ESCAPE) dialogBox_.hide(); } public void onKeyUp(Widget sender, char keyCode, int modifiers) { } }); Button clearButton = new Button("Clear"); clearButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { clearMessage(); } }); dialogBox_.setWidget( PanelUtils.verticalPanel(scrolled, PanelUtils.horizontalPanel(closeButton, clearButton))); }
From source file:cl.uai.client.MarkingInterface.java
License:Open Source License
/** /**//from w w w .j a v a 2 s .co m * */ public MarkingInterface() { // The timer will check if no other resize events have been called in the last 200 ms resizeTimer = new Timer() { @Override public void run() { Date now = new Date(); long diff = now.getTime() - resizeTime.getTime(); // The last resize was in less than 200 ms if (diff < 200) { resizeTimer.schedule(200); } else { // More than 200 ms, we accept no more resize is being done resizeTimeout = false; Date oneyear = new Date(); CalendarUtil.addMonthsToDate(oneyear, 12); Cookies.setCookie("emarking_width", Integer.toString(Window.getClientWidth()), oneyear); EMarkingWeb.markingInterface.loadSubmissionData(); } } }; // Focus panel to catch key events focusPanel = new FocusPanel(); // Main panel has two rows: Toolbar and Marking panel mainPanel = new VerticalPanel(); mainPanel.addStyleName(Resources.INSTANCE.css().interfaceMainPanel()); focusPanel.setWidget(mainPanel); // Toolbar goes up toolbar = new MarkingToolBar(); mainPanel.add(toolbar); focusPanel.addKeyDownHandler(new MarkingInterfaceKeyDownHandler(toolbar)); // Marking panel containing the marking interface interfacePanel = new SplitLayoutPanel() { @Override public void onResize() { super.onResize(); markingPagesInterface.resizePage(this.getCenterWidth()); }; }; interfacePanel.animate(180); interfacePanel.addStyleName(Resources.INSTANCE.css().interfacepanel()); loadingMessage = new HTML(messages.Loading() + " " + EMarkingConfiguration.getMoodleUrl()); bubbleButtons = new ArrayList<BubbleButton>(); bubbleButtons.add(new ShowRubricButton(Window.getClientWidth() - 40, 0, 0)); bubbleButtons.add(new ShowChatButton(Window.getClientWidth() - 40, 45, NodeChat.SOURCE_CHAT)); bubbleButtons.add(new ShowWallButton(Window.getClientWidth() - 40, 90, NodeChat.SOURCE_WALL)); bubbleButtons.add(new ShowHelpButton(Window.getClientWidth() - 40, 135, NodeChat.SOURCE_SOS)); interfacePanel.add(loadingMessage); // interfacePanel.setCellHorizontalAlignment(loadingMessage, HasAlignment.ALIGN_CENTER); markingPanel = new AbsolutePanel(); markingPanel.add(interfacePanel); for (BubbleButton b : bubbleButtons) { markingPanel.add(b); } mainPanel.add(markingPanel); // Timer for pinging system timer = new Timer() { @Override public void run() { // If there are ticks to wait before trying again, update message and update ticks if (ticksUntilTrying > 0) { loadingMessage.setHTML(messages.CantReachServerRetrying(ticksUntilTrying)); ticksUntilTrying--; } else { // Updating next trial for one more second and trying onLoad again timerWaitingTurns++; ticksUntilTrying = Math.min(timerWaitingTurns, 60); loadingMessage.setHTML(messages.Loading() + " " + EMarkingConfiguration.getMoodleUrl()); onLoad(); } } }; heartBeatTimer = new Timer() { @Override public void run() { String extradata = ""; if (submissionData != null) extradata = "&marker=" + submissionData.getMarkerid() + "&draft=" + submissionData.getId(); final String requestUrl = extradata; AjaxRequest.ajaxRequest("action=heartbeat" + extradata, new AsyncCallback<AjaxData>() { @Override public void onSuccess(AjaxData result) { logger.info("Heartbeat! " + requestUrl); } @Override public void onFailure(Throwable caught) { logger.warning("Failure on heartbeat"); } }); } }; // Drag and Drop controller attached to marking panel dragController = new PickupDragController(markingPanel, false); waitDialog = new DialogBox(false, true); waitDialog.setGlassEnabled(true); waitDialog.addStyleName(Resources.INSTANCE.css().commentdialog()); waitDialog.setHTML(MarkingInterface.messages.Loading()); ProgressBar pbar = new ProgressBar(ProgressBarBase.Style.STRIPED); pbar.setActive(true); pbar.setPercent(100); waitDialog.setWidget(pbar); this.initWidget(focusPanel); }
From source file:com.allen_sauer.gwt.dnd.demo.client.DragDropDemo.java
License:Apache License
@Override public void onModuleLoad() { // set uncaught exception handler GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { @Override// www. ja v a2 s. c o m public void onUncaughtException(Throwable throwable) { String text = "Uncaught exception: "; while (throwable != null) { StackTraceElement[] stackTraceElements = throwable.getStackTrace(); text += throwable.toString() + "\n"; for (StackTraceElement element : stackTraceElements) { text += " at " + element + "\n"; } throwable = throwable.getCause(); if (throwable != null) { text += "Caused by: "; } } Logger.getLogger(DragDropDemo.class.getName()).severe(text); DialogBox dialogBox = new DialogBox(true, false); dialogBox.getElement().getStyle().setProperty("backgroundColor", "#ABCDEF"); System.err.print(text); text = text.replaceAll(" ", " "); dialogBox.setHTML("<pre>" + text + "</pre>"); dialogBox.center(); } }); // use a deferred command so that the handler catches onModuleLoad2() exceptions Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { onModuleLoad2(); } }); }
From source file:com.allen_sauer.gwt.voices.demo.client.VoicesDemo.java
License:Apache License
@Override public void onModuleLoad() { // set uncaught exception handler GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { @Override//from w ww. j av a 2 s. c o m public void onUncaughtException(Throwable throwable) { String text = "Uncaught exception: "; while (throwable != null) { StackTraceElement[] stackTraceElements = throwable.getStackTrace(); text += new String(throwable.toString() + "\n"); for (StackTraceElement element : stackTraceElements) { text += " at " + element + "\n"; } throwable = throwable.getCause(); if (throwable != null) { text += "Caused by: "; } } DialogBox dialogBox = new DialogBox(true, false); DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF"); System.err.print(text); text = text.replaceAll(" ", " "); dialogBox.setHTML("<pre>" + text + "</pre>"); dialogBox.center(); } }); // use deferred command to catch initialization exceptions Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { onModuleLoad2(); } }); }
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);/*from w w w . java 2 s . c o 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. ja va 2 s . com @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 ww w .jav a2 s . c o 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 w w w. j av a 2 s. c o 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(); }