List of usage examples for com.google.gwt.user.client.ui DialogBox setText
public void setText(String text)
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/*w ww. j a v 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// www . j a va2s . co m 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 . j a va2s. com*/ 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/* w w w. ja v a 2s .co 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(); }
From source file:nz.org.winters.appspot.acrareporter.client.ui.UserEdit.java
License:Apache License
public static void doAddDialog(final AppUser adminAppUser, final RemoteDataServiceAsync remoteService) { final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Add New User"); // Create a table to layout the content UserEdit pet = new UserEdit(new UserEdit.DialogCallback() { @Override/*www . j a v a2 s .com*/ public void result(boolean ok, AppUser appUser) { if (ok) { appUser.adminAppUserId = adminAppUser.id; remoteService.addAppUser(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(); }
From source file:org.apache.oozie.tools.workflowgenerator.client.OozieWorkflowGenerator.java
License:Apache License
/** * Initialize menu panel on top//from ww w.j a v a 2 s.c om * * @return */ public MenuBar initMenu() { // Menu bar Command cmd = new Command() { public void execute() { Window.alert("To be implemented soon"); } }; Command mr_cmd = new Command() { public void execute() { initWidget(); MapReduceActionWidget mr = new MapReduceActionWidget(OozieWorkflowGenerator.this); mr.setName("MR_0"); addWidget(mr, 300, 100); ((OozieDiagramController) controller).addConnection(start, mr); ((OozieDiagramController) controller).addConnection(mr, end); mr.updateOnSelection(); } }; Command pig_cmd = new Command() { public void execute() { clear(); initWidget(); PigActionWidget pig = new PigActionWidget(OozieWorkflowGenerator.this); pig.setName("Pig_0"); addWidget(pig, 300, 100); ((OozieDiagramController) controller).addConnection(start, pig); ((OozieDiagramController) controller).addConnection(pig, end); pig.updateOnSelection(); } }; Command java_cmd = new Command() { public void execute() { clear(); initWidget(); JavaActionWidget java = new JavaActionWidget(OozieWorkflowGenerator.this); java.setName("Java_0"); addWidget(java, 300, 100); ((OozieDiagramController) controller).addConnection(start, java); ((OozieDiagramController) controller).addConnection(java, end); java.updateOnSelection(); } }; Command forkjoin_cmd = new Command() { public void execute() { clear(); initWidget(); ForkNodeWidget fork = new ForkNodeWidget(OozieWorkflowGenerator.this); fork.setName("Fork_0"); addWidget(fork, 150, 100); ((OozieDiagramController) controller).addConnection(start, fork); MapReduceActionWidget mr = new MapReduceActionWidget(OozieWorkflowGenerator.this); mr.setName("MR_0"); addWidget(mr, 300, 30); ((OozieDiagramController) controller).addMultiConnection(fork, mr); PigActionWidget pig = new PigActionWidget(OozieWorkflowGenerator.this); pig.setName("Pig_0"); addWidget(pig, 300, 200); ((OozieDiagramController) controller).addMultiConnection(fork, pig); JoinNodeWidget join = new JoinNodeWidget(OozieWorkflowGenerator.this); join.setName("Join_0"); addWidget(join, 450, 100); ((OozieDiagramController) controller).addConnection(mr, join); ((OozieDiagramController) controller).addConnection(pig, join); ((OozieDiagramController) controller).addConnection(join, end); fork.updateOnSelection(); join.updateOnSelection(); mr.updateOnSelection(); pig.updateOnSelection(); } }; Command clear_cmd = new Command() { public void execute() { clear(); } }; MenuBar fileMenu = new MenuBar(true); fileMenu.setAutoOpen(true); fileMenu.setAnimationEnabled(true); fileMenu.addItem("New", cmd); fileMenu.addItem("Open", cmd); fileMenu.addItem("Load XML", cmd); fileMenu.addItem("Save", cmd); fileMenu.addItem("Save As..", cmd); fileMenu.addItem("Generate XML", cmd); fileMenu.addItem("Print", cmd); fileMenu.addItem("Quit", cmd); MenuBar editMenu = new MenuBar(true); editMenu.setAutoOpen(true); editMenu.setAnimationEnabled(true); editMenu.addItem("Undo", cmd); editMenu.addItem("Redo", cmd); editMenu.addItem("Copy", cmd); editMenu.addItem("Cut", cmd); editMenu.addItem("Paste", cmd); editMenu.addItem("Duplicate", cmd); editMenu.addItem("Delete", cmd); editMenu.addItem("Clear Diagram", clear_cmd); MenuBar examples = new MenuBar(true); examples.setAutoOpen(true); examples.setAnimationEnabled(true); examples.addItem("wrkflow with MR action", mr_cmd); examples.addItem("wrkflow with Pig action", pig_cmd); examples.addItem("wrkflow with Java action", java_cmd); examples.addItem("wrkflow with Fork/Join ", forkjoin_cmd); MenuBar helpMenu = new MenuBar(true); helpMenu.setAutoOpen(true); helpMenu.setAnimationEnabled(true); // TODO this should point to a workflowgenerator's maven site, however there is no maven site available. (Not even in // Workspace of the jenkins job at https://builds.apache.org/job/oozie-trunk-precommit-build/ws/workflowgenerator/target/) // where client, for example, has target/site/apidocs // The ideal place is somewhere under http://oozie.apache.org/docs/ once it is generated. Command openOozieTopPageComman = new Command() { @Override public void execute() { Window.open("http://oozie.apache.org/", "_blank", ""); } }; helpMenu.addItem("Documentation", openOozieTopPageComman); helpMenu.addItem("Online Help", openOozieTopPageComman); Command aboutCommand = new Command() { @Override public void execute() { // Dialogbox final DialogBox d = new DialogBox(false, true); d.setGlassEnabled(true); d.setText("About Oozie Workflow Generator"); d.center(); // Set this to workaround the grid z-index issue https://issues.apache.org/jira/browse/OOZIE-1081 d.getElement().getStyle().setZIndex(ZINDEX_FRONT_OF_GRID); // About text VerticalPanel vpanel = new VerticalPanel(); vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); vpanel.setSpacing(10); vpanel.setWidth("150"); vpanel.add(new Label("Oozie Workflow Generator")); vpanel.add(new Label("Version 3.4.0-SNAPSHOT")); // TODO how to get a version number from pom? // OK button to close Button ok = new Button("OK"); ok.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { d.hide(); } }); vpanel.add(ok); d.setWidget(vpanel); d.show(); } }; helpMenu.addItem("About", aboutCommand); MenuBar menu = new MenuBar(); menu.addItem("File", fileMenu); menu.addItem("Edit", editMenu); menu.addItem("Example", examples); menu.addItem("Help", helpMenu); return menu; }
From source file:org.apache.solr.explorer.client.core.manager.ui.BasicUIManager.java
License:Apache License
protected void showMessgeDialog(String title, Image icon, Widget widget, final AsyncCallback<Void> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title); VerticalPanel content = new VerticalPanel(); content.setStyleName("MessageDialogContent"); icon.setStyleName("Icon"); HorizontalPanel messageRow = new HorizontalPanel(); messageRow.add(icon);//w w w.ja va2s. co m messageRow.add(widget); messageRow.setCellVerticalAlignment(widget, HorizontalPanel.ALIGN_MIDDLE); content.add(messageRow); Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); if (callback != null) { callback.onSuccess(null); } } }); LayoutUtils.addGap(content, "5px"); content.add(closeButton); content.setCellHorizontalAlignment(closeButton, VerticalPanel.ALIGN_RIGHT); dialogBox.setWidget(content); dialogBox.center(); dialogBox.show(); }
From source file:org.berlin.network.client.ParseLogCriticalErrors.java
License:Open Source License
/** * This is the entry point method./* w w w . j av a 2s .co m*/ */ public void onModuleLoad() { final Button sendButton = new Button("Execute Command"); final TextBox nameField = new TextBox(); final TextBox sessionLookupField = new TextBox(); final TextBox expressionField = new TextBox(); nameField.setText("help"); sessionLookupField.setText(""); expressionField.setText(""); final Label errorLabel = new Label(); final Label statusMessageLabel = new Label(); statusMessageLabel.setText("Status command area - waiting for command..."); // We can add style names to widgets sendButton.addStyleName("sendButton"); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sessionFieldContainer").add(sessionLookupField); RootPanel.get("expressionFieldContainer").add(expressionField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(errorLabel); RootPanel.get("statusLabelContainer").add(statusMessageLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create the popup dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); final Button closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); final Label textToServerLabel = new Label(); final HTML serverResponseLabel = new HTML(); final VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending command to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }); final CellTable<SessionUIInfo> tableSessionInfo = new CellTable<SessionUIInfo>(); // Create a handler for the sendButton and nameField final class MyHandler implements ClickHandler, KeyUpHandler { /** * Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { sendCommandToServer(); } /** * Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendCommandToServer(); } } /** * Send the name from the nameField to the server and wait for a response. */ private void sendCommandToServer() { final String cmdToServer = nameField.getText(); final String sessionIdData = sessionLookupField.getText(); // First, we validate the input. errorLabel.setText(""); statusMessageLabel.setText("Running command [" + cmdToServer + "]..."); tableSessionInfo.setVisible(true); if (!FieldVerifier.isValidName(cmdToServer)) { errorLabel.setText("Please enter a command (Example = help)"); return; } // Then, we send the input to the server. sendButton.setEnabled(false); textToServerLabel.setText(cmdToServer); serverResponseLabel.setText(""); /********************************** * Basic Greet Service Action **********************************/ greetingService.greetServer(cmdToServer, sessionIdData, new AsyncCallback<String>() { public void onFailure(final Throwable caught) { // Show the RPC error message to the user dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR); statusMessageLabel.setText("Error at command"); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(final String result) { dialogBox.setText("Remote Procedure Call"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(result); dialogBox.center(); closeButton.setFocus(true); statusMessageLabel.setText("Message command run - [" + cmdToServer + "]"); System.out.println("On success of command from server "); } }); final String expr = expressionField.getText(); System.out.println("on command, sending request to server"); sessionService.sessionServer(cmdToServer, sessionIdData, expr, sessionCallbackFromCommand(tableSessionInfo)); } } // End of class // // Add a handler to send the name to the server final MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); /**************************************************************** * Add property data table ****************************************************************/ { // Create a CellTable. final CellTable<PropertyEntry> tableProperty = new CellTable<PropertyEntry>(); // Create name column. final TextColumn<PropertyEntry> nameColumn = new TextColumn<PropertyEntry>() { @Override public String getValue(final PropertyEntry contact) { return contact.name; } }; // Make the name column sortable. nameColumn.setSortable(true); // Create address column. final TextColumn<PropertyEntry> addressColumn = new TextColumn<PropertyEntry>() { @Override public String getValue(final PropertyEntry contact) { return contact.value; } }; // Add the columns. tableProperty.addColumn(nameColumn, "Name"); tableProperty.addColumn(addressColumn, "Value"); // Set the total row count. You might send an RPC request to determine the // total row count. tableProperty.setRowCount(34, false); // Set the range to display. In this case, our visible range is smaller than // the data set. tableProperty.setVisibleRange(0, 34); final AsyncDataProvider<PropertyEntry> dataProviderForPropertyList = new AsyncDataProvider<PropertyEntry>() { @Override protected void onRangeChanged(final HasData<PropertyEntry> display) { final Range range = display.getVisibleRange(); // Get the ColumnSortInfo from the table. final ColumnSortList sortList = tableProperty.getColumnSortList(); new Timer() { @Override public void run() { final AsyncCallback<List<PropertyEntry>> callbackPropertyChange = new AsyncCallback<List<PropertyEntry>>() { @Override public void onFailure(final Throwable caught) { System.out.println("Error - " + caught); dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR); dialogBox.center(); closeButton.setFocus(true); } @Override public void onSuccess(final List<PropertyEntry> result) { if (result == null) { System.out.println("Invalid result set"); return; } System.out.println("onSuccess of Timer Callback Table Property Set"); final int start = range.getStart(); final int end = start + range.getLength(); final List<PropertyEntry> statsList = result; Collections.sort(statsList, new Comparator<PropertyEntry>() { public int compare(final PropertyEntry o1, final PropertyEntry o2) { if (o1 == o2) { return 0; } int diff = -1; if (o1 != null) { diff = (o2 != null) ? o1.name.compareTo(o2.name) : 1; } return sortList.get(0).isAscending() ? diff : -diff; } }); final List<PropertyEntry> dataInRange = statsList.subList(start, end); tableProperty.setRowData(start, dataInRange); } }; // End of Callback // /********************************** * Stats Service Action **********************************/ statsService.statsServer("invalid", "invalid", callbackPropertyChange); } // End of Run method // }.schedule(100); } // onRange Changed // }; // Connect the list to the data provider. dataProviderForPropertyList.addDataDisplay(tableProperty); final AsyncHandler columnSortHandler = new AsyncHandler(tableProperty); tableProperty.addColumnSortHandler(columnSortHandler); // We know that the data is sorted alphabetically by default. tableProperty.getColumnSortList().push(nameColumn); // Add it to the root panel. RootPanel.get("listViewContainer").add(tableProperty); /********************************** * End of adding property table data ***********************************/ } // End - property table // /**************************************************************** * Add session lookup data table ****************************************************************/ { final TextColumn<SessionUIInfo> sessionColumn = new TextColumn<SessionUIInfo>() { @Override public String getValue(final SessionUIInfo info) { return info.sessionId; } }; sessionColumn.setSortable(true); final TextColumn<SessionUIInfo> dateColumn = new TextColumn<SessionUIInfo>() { @Override public String getValue(final SessionUIInfo info) { return info.getJavaDate(); } }; final TextColumn<SessionUIInfo> filenameColumn = new TextColumn<SessionUIInfo>() { @Override public String getValue(final SessionUIInfo info) { return info.filename; } }; // Add the columns. tableSessionInfo.addColumn(sessionColumn, "Session"); tableSessionInfo.addColumn(dateColumn, "Date"); tableSessionInfo.addColumn(filenameColumn, "LogFilename"); tableSessionInfo.setRowCount(24, false); tableSessionInfo.setVisibleRange(0, 24); final AsyncDataProvider<SessionUIInfo> dataProviderForSessionList = new AsyncDataProvider<SessionUIInfo>() { @Override protected void onRangeChanged(final HasData<SessionUIInfo> display) { new Timer() { @Override public void run() { /********************************** * Session Service Action **********************************/ final String cmd = nameField.getText(); final String sessionIdData = sessionLookupField.getText(); final String expr = expressionField.getText(); System.out.println("on Range changed, sending request to server"); sessionService.sessionServer(cmd, sessionIdData, expr, sessionCallback(tableSessionInfo, display)); } // End of Run method // }.schedule(100); } // onRange Changed // }; dataProviderForSessionList.addDataDisplay(tableSessionInfo); final AsyncHandler columnSortHandler = new AsyncHandler(tableSessionInfo); tableSessionInfo.addColumnSortHandler(columnSortHandler); tableSessionInfo.getColumnSortList().push(sessionColumn); // Add it to the root panel. RootPanel.get("sessionViewContainer").add(tableSessionInfo); tableSessionInfo.setVisible(false); } // End of add results table }
From source file:org.bonitasoft.console.client.view.labels.LabelStyleSelectorWidget.java
License:Open Source License
private DialogBox createDialogBox() { // Create a dialog box and set the caption text final DialogBox theDialogBox = new DialogBox(); theDialogBox.setText(constants.renameLabelWindowTitle()); // Create a table to layout the content VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4);//from ww w.j a v a 2 s . c o m theDialogBox.setWidget(dialogContents); myNewLabelName.setMaxLength(20); myNewLabelName.addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent anEvent) { char theChar = anEvent.getCharCode(); if (KeyCodes.KEY_ENTER == theChar) { renameLabel(); } } }); HorizontalPanel theButtonPanel = new HorizontalPanel(); Button theOkButton = new Button(constants.okButton(), new ClickHandler() { /* * (non-Javadoc) * * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google .gwt.event.dom.client.ClickEvent) */ public void onClick(ClickEvent aArg0) { renameLabel(); } }); Button theCancelButton = new Button(constants.cancelButton(), new ClickHandler() { /* * (non-Javadoc) * * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google .gwt.event.dom.client.ClickEvent) */ public void onClick(ClickEvent aArg0) { // Clean the form. myNewLabelName.setText(""); myCreateDialogBox.hide(); } }); theButtonPanel.add(theOkButton); theButtonPanel.add(theCancelButton); // Layout widgets HorizontalPanel theForm = new HorizontalPanel(); HTML label = new HTML(constants.newLabelWindowInputLabel()); theForm.add(label); theForm.add(myNewLabelName); // theForm.setCellHorizontalAlignment(theNewLabelName, HasHorizontalAlignment.ALIGN_RIGHT); dialogContents.add(theForm); dialogContents.add(myErrorMessage); myErrorMessage.setVisible(false); dialogContents.add(theButtonPanel); dialogContents.setCellHorizontalAlignment(theButtonPanel, HasHorizontalAlignment.ALIGN_RIGHT); // Return the dialog box return theDialogBox; }
From source file:org.C2C.client.TaskManager.java
License:Open Source License
public static void RUN() { DialogBox dialogbox = new DialogBox(false); dialogbox.setStyleName("demo-DialogBox"); dialogbox.setText("RUNX " + ACTIVE_COUNT + ", "); dialogbox.show();//w w w. java2 s . c o m if (ACTIVE_COUNT <= 0 /*|| !CallManager.IS_LOGGEDIN*/) { return; } dialogbox.setText("RUNY"); dialogbox.show(); String toServer = ""; Task prev = null; Map<Integer, Task> tasks = GET_TASKS(); Set<Integer> keySet = tasks.keySet(); for (Integer key : keySet) { final Task tsk = tasks.get(key); if (!tsk.isCompleted()) { if (tsk instanceof TaskEmpty) { if (tsk.isActiveTaskChild()) { if (!toServer.isEmpty()) { prev.addListener(new TaskCompletedListener() { public void completed(Task task) { String s = tsk.run(); } }); } else { tsk.run(); } } } else { String runRes = ""; runRes = tsk.run(); toServer = toServer.concat(runRes); prev = tsk; } } } if (!toServer.isEmpty()) { //WindowManager.getInstance().setStatusBarText(toServer.length()+""); CallManager.SEND_TO_SERVER(toServer); } }