List of usage examples for com.google.gwt.user.client.ui Grid Grid
public Grid(int rows, int columns)
From source file:asquare.gwt.tests.memoryleak.client.Demo.java
License:Apache License
public void onModuleLoad() { m_button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (m_popupPanel == null) { m_popupPanel = new NonModalPopup(); Grid grid = new Grid(10, 10); for (int row = 0; row < grid.getRowCount(); row++) { for (int col = 0; col < grid.getColumnCount(); col++) { grid.setHTML(row, col, "<img height='20' width='20' src='JohannesElison.jpg'/>"); }//from w w w . ja v a 2s.co m } m_popupPanel.add(grid); m_popupPanel.show(); m_button.setText("Remove Popup"); } else { m_popupPanel.hide(); m_popupPanel = null; m_button.setText("Add Popup"); } } }); RootPanel.get().add(m_button); }
From source file:asquare.gwt.tk.uitest.isvisible.client.Demo.java
License:Apache License
public void onModuleLoad() { RootPanel outer = RootPanel.get();//from w ww .j av a 2 s. com TextBox rowInput = new TextBox(); TextBox colInput = new TextBox(); Grid input = new Grid(2, 2); input.setText(0, 0, "Row: "); input.setWidget(0, 1, rowInput); input.setText(1, 0, "Col: "); input.setWidget(1, 1, colInput); outer.add(input); final int ROWS = 20; final int COLS = 20; Grid grid = new Grid(ROWS, COLS); grid.setCellPadding(0); grid.setCellSpacing(0); for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS; col++) { grid.setWidget(row, col, new Label("(" + row + "," + col + ")")); } } ScrollPanel scrollInner = new ScrollPanel(); scrollInner.setAlwaysShowScrollBars(true); scrollInner.setPixelSize(400, 400); scrollInner.setWidget(grid); ScrollPanel scrollOuter = new ScrollPanel(); scrollOuter.add(scrollInner); scrollOuter.setAlwaysShowScrollBars(true); scrollOuter.setPixelSize(600, 200); outer.add(scrollOuter); scrollInner.setScrollPosition(100); scrollInner.setHorizontalScrollPosition(100); }
From source file:asquare.gwt.tkdemo.client.demos.DialogPanel.java
License:Apache License
private Widget createModalDialogDemo() { BasicPanel panel = new BasicPanel("div", "block"); panel.setStyleName("example division"); DomUtil.setStyleAttribute(panel, "whiteSpace", "nowrap"); panel.add(new HTML("<h4>ModalDialog examples</h4>")); class CloseListener implements ClickHandler { private final ModalDialog m_dialog; public CloseListener(ModalDialog dialog) { m_dialog = dialog;//from w ww .ja v a 2 s. c o m } public void onClick(ClickEvent event) { m_dialog.hide(); } } class CloseButton extends Button { public CloseButton(ModalDialog dialog) { super("Close"); addClickHandler(new CloseListener(dialog)); } public CloseButton(ModalDialog dialog, String text) { super(text); addClickHandler(new CloseListener(dialog)); } } final Button plainDialog = new Button("Plain"); plainDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Caption area", false); dialog.add(new Label("Content area")); dialog.add(new CloseButton(dialog)); dialog.show(plainDialog); } }); panel.add(plainDialog); final Button verboseDialog = new Button("Verbose"); verboseDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Verbose dialog", false); dialog.add(new Label("Twas brillig, and the slithy toves " + " Did gyre and gimble in the wabe: " + "All mimsy were the borogoves, " + " And the mome raths outgrabe " + "Beware the Jabberwock, my son! " + "The jaws that bite, the claws that catch! " + "Beware the Jubjub bird, and shun " + "The frumious Bandersnatch!")); dialog.add(new CloseButton(dialog)); dialog.show(verboseDialog); } }); panel.add(verboseDialog); final Button captionLessDialog = new Button("No caption"); captionLessDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.add(new Label("Captionless dialog")); dialog.add(new CloseButton(dialog)); dialog.show(captionLessDialog); } }); panel.add(captionLessDialog); final Button loadingDialog = new Button("Loading..."); loadingDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); final Label label = new Label("0% loaded"); dialog.add(label); dialog.show(loadingDialog); new Timer() { private int m_count = 0; public void run() { label.setText(++m_count + "% loaded"); if (m_count == 100) { dialog.hide(); cancel(); } } }.scheduleRepeating(1); } }); panel.add(loadingDialog); final Button undraggableDialog = new Button("Drag disabled"); undraggableDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog() { protected List<Controller> createCaptionControllers() { List<Controller> result = new ArrayList<Controller>(); result.add(ControlSurfaceController.getInstance()); return result; } }; dialog.setCaption("Drag disabled", false); dialog.add(new Label( "This dialog uses a custom controller in the header which does not provide drag support.")); dialog.add(new CloseButton(dialog)); dialog.show(undraggableDialog); } }); panel.add(undraggableDialog); final Button styledDragDialog = new Button("Drag style"); styledDragDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); String oldPrimaryName = dialog.getStylePrimaryName(); dialog.setStylePrimaryName("dialog-dragstyle"); dialog.addStyleName(oldPrimaryName); dialog.setCaption("Drag me", false); dialog.add(new Label( "This dialog employs the \"tk-ModalDialog-dragging\" style which is applied while dragging. ")); dialog.add(new CloseButton(dialog)); dialog.show(styledDragDialog); } }); panel.add(styledDragDialog); final Button focusManagementDialog = new Button("Focus management"); focusManagementDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Register", false); FocusModel fModel = dialog.getFocusModel(); final int FIELD_COUNT = 3; Grid table = new Grid(FIELD_COUNT, 2); dialog.add(table); Widget[] labels = new Widget[FIELD_COUNT]; labels[0] = new Label("User name: "); labels[1] = new Label("Password: "); labels[2] = new Label("Retype password: "); FocusWidget[] fields = new FocusWidget[FIELD_COUNT]; fields[0] = new TextBox(); fields[1] = new PasswordTextBox(); fields[2] = new PasswordTextBox(); CellFormatter formatter = table.getCellFormatter(); for (int i = 0; i < labels.length; i++) { table.setWidget(i, 0, labels[i]); formatter.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT); table.setWidget(i, 1, fields[i]); /* * Manually add fields to focus cycle. (The dialog does not * scan the children of panels for focusable widgets.) */ fModel.add(fields[i]); } // this widget will be focused when the dialog is shown fModel.setFocusWidget(fields[0]); ColumnPanel buttonPanel = new ColumnPanel(); buttonPanel.setWidth("100%"); dialog.add(buttonPanel); Button closeButton = new CloseButton(dialog, "Register!"); fModel.add(closeButton); buttonPanel.add(closeButton); Button cancelButton = new CloseButton(dialog, "Cancel"); fModel.add(cancelButton); buttonPanel.addWidget(cancelButton, false); buttonPanel.setCellHorizontalAlignment(ColumnPanel.ALIGN_RIGHT); dialog.show(focusManagementDialog); } }); panel.add(focusManagementDialog); final Button explicitlyPositionedDialog = new Button("Explicitly positioned"); explicitlyPositionedDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.removeController(dialog.getController(ModalDialog.PositionDialogController.class)); int contentWidth = 300; int contentHeight = 100; dialog.setContentWidth(contentWidth + "px"); dialog.setContentHeight(contentHeight + "px"); dialog.setPopupPosition(100, 100); dialog.setCaption("Explicitly positioned dialog", false); dialog.add(new Label( "Automatic positioning is disabled. Dimensions and position are set explicitly. ")); dialog.add(new CloseButton(dialog)); dialog.show(explicitlyPositionedDialog); } }); panel.add(explicitlyPositionedDialog); final Button multipleDialogs = new Button("Multiple dialogs"); multipleDialogs.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ModalDialog dialog = new ModalDialog(); dialog.setCaption("First dialog", false); FocusModel fModel = dialog.getFocusModel(); RowPanel outer = new RowPanel(); dialog.add(new HTML("")); final UrlLocation urlBox = new UrlLocation(); urlBox.setText("http://www.asquare.net"); urlBox.setWidth("350px"); fModel.add(urlBox); outer.add(urlBox); Button goButton = new Button("Go"); fModel.add(goButton); fModel.setFocusWidget(goButton); outer.addWidget(goButton, false); ListBox addressList = new ListBox(); addressList.addItem("Select an address"); addressList.addItem("http://www.asquare.net"); addressList.addItem("http://www.google.com"); addressList.addItem("http://www.sourceforge.net"); addressList.addItem("http://www.apache.org"); fModel.add(addressList); outer.add(addressList); final Frame frame = new Frame(); frame.setSize("400px", "200px"); outer.add(frame); urlBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { frame.setUrl(urlBox.getURL()); } }); goButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { frame.setUrl(urlBox.getURL()); } }); addressList.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { ListBox list = (ListBox) event.getSource(); if (list.getSelectedIndex() > 0) { urlBox.setText(list.getItemText(list.getSelectedIndex())); frame.setUrl(list.getItemText(list.getSelectedIndex())); } } }); final Button secondDialog = new Button("Show second dialog"); secondDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Second dialog", false); dialog.add(new Label("Note that you cannot manipulate the widgets in the first dialog. ")); dialog.add(new CloseButton(dialog)); dialog.show(secondDialog); } }); fModel.add(secondDialog); outer.add(secondDialog); Button closeButton = new CloseButton(dialog); fModel.add(closeButton); outer.add(closeButton); dialog.add(outer); dialog.show(multipleDialogs); } }); panel.add(multipleDialogs); final Button styledDialog = new Button("Styled"); styledDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.addStyleName("dialog-styled"); HorizontalPanel caption = new HorizontalPanel(); caption.setWidth("100%"); Label captionText = new Label("Oopsie!"); caption.add(captionText); caption.setCellWidth(captionText, "100%"); Image close = new Image("close.gif"); close.addClickHandler(new CloseListener(dialog)); caption.add(close); dialog.setCaption(caption); dialog.add(new Label("I've been a bad, bad browser.")); dialog.add(new Button("Deny ice cream", new CloseListener(dialog))); dialog.show(styledDialog); } }); panel.add(styledDialog); return panel; }
From source file:at.ac.fhcampuswien.atom.client.gui.dnd.MouseListBox.java
License:Apache License
/** * Used by {@link ListBoxDragController} to create a draggable listbox * containing the selected items./* www. ja va 2 s . co m*/ */ MouseListBox(int size) { grid = new Grid(size, 1); initWidget(grid); grid.setCellPadding(0); grid.setCellSpacing(0); addStyleName(CSS_DEMO_MOUSELISTBOX); for (int i = 0; i < size; i++) { grid.getCellFormatter().addStyleName(i, 0, CSS_DEMO_DUAL_LIST_EXAMPLE_ITEM); setWidget(i, null); } }
From source file:bingo.client.Bingo.java
License:Open Source License
/** * This is the entry point method./*from w w w . ja va 2 s . com*/ */ public void onModuleLoad() { Label titleLabel = new Label(); titleLabel.setText(strings.title()); RootPanel.get("title").add(titleLabel); // This is the general notification text box RootPanel.get("message").add(message); // Cheking if the user has already an user id final String cookie = Cookies.getCookie(COOKIE_ID); // Validating the cookie bingoService.statusUserId(cookie, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); Cookies.removeCookie(COOKIE_ID); } @Override public void onSuccess(Integer status) { // TODO: Control the logged status (I should not get a user if s/he is already logged) if (status.intValue() == BingoService.NO_LOGGED || status.intValue() == BingoService.LOGGED) { bingoService.getUserId(new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { message.setText(strings.errorUserCreation()); } @Override public void onSuccess(String result) { userId = result; } }); message.setHTML(""); // Showing image to enter ImageResource imageResource = BingoResources.INSTANCE.entry(); Image entryImage = new Image(imageResource.getSafeUri()); RootPanel.get("buttons").add(entryImage); // Selecting behavior (admin / voter) HorizontalPanel entryPoint = new HorizontalPanel(); entryPoint.setStyleName("mainSelectorPanel"); entryPoint.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); entryPoint.setSpacing(50); // // CREATING A BINGO // VerticalPanel leftPanel = new VerticalPanel(); leftPanel.setStyleName("selectorPanel"); Label leftPanelTitle = new Label(); leftPanelTitle.setStyleName("selectorPanelTitle"); leftPanelTitle.setText(strings.leftPanelTitle()); leftPanel.add(leftPanelTitle); leftPanel.setCellHorizontalAlignment(leftPanelTitle, HasHorizontalAlignment.ALIGN_CENTER); Grid leftSubPanel = new Grid(2, 2); leftSubPanel.setWidget(0, 0, new Label(strings.createBingoName())); final TextBox bingoNameBox = new TextBox(); leftSubPanel.setWidget(0, 1, bingoNameBox); leftSubPanel.setWidget(1, 0, new Label(strings.createBingoPassword())); final PasswordTextBox bingoPasswordBox = new PasswordTextBox(); leftSubPanel.setWidget(1, 1, bingoPasswordBox); leftPanel.add(leftSubPanel); final Button createButton = new Button("Create"); createButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { bingoService.createBingo(userId, bingoNameBox.getText(), bingoPasswordBox.getText(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(final String gameId) { final BingoGrid bingoGrid = new BingoGrid(); initAdminGrid(userId, bingoGrid, false); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); message.setText(strings.welcomeMessageCreation()); // Setting the cookie Date expirationDate = new Date(); expirationDate.setHours(expirationDate.getHours() + EXPIRATION_VALUE); Cookies.setCookie(COOKIE_ID, userId, expirationDate); } }); } }); leftPanel.add(createButton); leftPanel.setCellHorizontalAlignment(createButton, HasHorizontalAlignment.ALIGN_CENTER); entryPoint.add(leftPanel); // // JOINING // VerticalPanel rightPanel = new VerticalPanel(); rightPanel.setStyleName("selectorPanel"); Label rightPanelTitle = new Label(); rightPanelTitle.setStyleName("selectorPanelTitle"); rightPanelTitle.setText(strings.rightPanelTitle()); rightPanel.add(rightPanelTitle); rightPanel.setCellHorizontalAlignment(rightPanelTitle, HasHorizontalAlignment.ALIGN_CENTER); Grid rightSubPanel = new Grid(2, 2); rightSubPanel.setWidget(0, 0, new Label(strings.joinToBingoName())); final ListBox joinExistingBingoBox = new ListBox(); bingoService.getBingos(new AsyncCallback<String[][]>() { @Override public void onFailure(Throwable caught) { joinExistingBingoBox.addItem(strings.noBingos()); } @Override public void onSuccess(String[][] result) { if (result == null) { joinExistingBingoBox.addItem(strings.noBingos()); } else { for (int i = 0; i < result.length; i++) { String gameName = result[i][0]; String gameId = result[i][1]; joinExistingBingoBox.addItem(gameName, gameId); } } } }); rightSubPanel.setWidget(0, 1, joinExistingBingoBox); rightSubPanel.setWidget(1, 0, new Label(strings.joinToBingoPassword())); final PasswordTextBox joinBingoPasswordBox = new PasswordTextBox(); rightSubPanel.setWidget(1, 1, joinBingoPasswordBox); rightPanel.add(rightSubPanel); final Button joinButton = new Button("Join"); joinButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int index = joinExistingBingoBox.getSelectedIndex(); if (index < 0) message.setText(strings.noSelectedItem()); else { final String gameId = joinExistingBingoBox.getValue(index); if (gameId == null) message.setText(strings.noSelectedItem()); else { bingoService.joinBingo(userId, gameId, joinBingoPasswordBox.getText(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Void result) { final BingoGrid bingoGrid = new BingoGrid(); initUserGrid(bingoGrid); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); message.setText(strings.welcomeMessageJoin()); // Setting the cookie Date expirationDate = new Date(); expirationDate .setHours(expirationDate.getHours() + EXPIRATION_VALUE); Cookies.setCookie(COOKIE_ID, userId, expirationDate); } }); } } } }); rightPanel.add(joinButton); rightPanel.setCellHorizontalAlignment(joinButton, HasHorizontalAlignment.ALIGN_CENTER); entryPoint.add(rightPanel); RootPanel.get("bingoTable").add(entryPoint); } else if (status.intValue() == BingoService.ADMIN) { message.setText("Detected cookie: " + cookie + " as admin"); userId = cookie; bingoService.statusBingo(userId, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Integer result) { int status = result.intValue(); final BingoGrid bingoGrid = new BingoGrid(); if (status == BingoService.RUNNING) { initAdminGrid(userId, bingoGrid, false); message.setText(strings.welcomeMessageCreation()); } else if (status == BingoService.FINISHED) { initAdminGrid(userId, bingoGrid, true); message.setText(strings.finishMessage()); } RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); } }); } else if (status.intValue() == BingoService.PARTICIPANT) { message.setText("Detected cookie: " + cookie + " as participant"); userId = cookie; final BingoGrid bingoGrid = new BingoGrid(); initUserGrid(bingoGrid); updateUserGrid(bingoGrid, null); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); } } }); }
From source file:burrito.client.widgets.panels.table.Table.java
License:Apache License
/** * Creates a new table. Don't forget to make calls to addHeader(), * addCellRenderer() and render() after creating the object. * //from ww w .ja va2 s. co m * @param numberOfColumns * The number of columns. Only count those that you will specify * (i.e. Don't count the select checkbox as a column) * @param rowsSelectable * true if rows should be selectable. This will work in * combination with addBatchAction() * @param rowsEditable * true if an edit-link should be rendered next to each row * @param rowsOrderable * true if rows should be able to re-order */ public Table(int numberOfColumns, boolean rowsSelectable, boolean rowsEditable, boolean rowsOrderable) { this.rowsSelectable = rowsSelectable; this.rowsEditable = rowsEditable; this.numberOfModelColumns = numberOfColumns; this.numberOfColumns = numberOfModelColumns; this.rowsOrderable = rowsOrderable; if (rowsSelectable) { this.numberOfColumns++; } if (rowsEditable) { this.numberOfColumns++; } if (rowsOrderable) { this.numberOfColumns++; } this.table = new Grid(1, this.numberOfColumns); this.loadingLabel = new Label(messages.loading()); FlowPanel centerWrapper = new FlowPanel(); centerWrapper.add(loadingLabel); centerWrapper.add(table); Button searchButton = new Button(messages.searchButton()); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { load(0); } }); Button resetButton = new Button(messages.resetButton()); resetButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { filterText.setValue(""); load(0); } }); search.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); search.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT); search.add(new Label(messages.search())); search.add(filterText); search.add(searchButton); search.add(resetButton); search.setStyleName("k5-table-searchbox"); search.setVisible(false); centerWrapper.add(search); batchJobsWrapper.addStyleName("batchJobs"); dock.add(pageController, DockPanel.NORTH); dock.add(centerWrapper, DockPanel.CENTER); batchJobsWrapper.add(batchJobs); dock.add(batchJobsWrapper, DockPanel.SOUTH); pageController.addPageControllerHandler(new PageControllerHandler() { @Override public void loadPage(int zeroIndexedPage) { load(zeroIndexedPage); } }); initWidget(dock); this.setStyleName("k5-Table"); }
From source file:bwbv.rlt.client.ui.HeaderPane.java
License:Apache License
private void showNewUserNameRequestPopupPanel() { confirmPopup = new PopupPanel(false, true); VerticalPanel panel = new VerticalPanel(); // panel.add(new Label("What is your login Name?")); // panel.add(textBox); Grid grid = new Grid(2, 2); grid.setText(0, 0, "Benutzer:"); final TextBox textBox = new TextBox(); grid.setWidget(0, 1, textBox);// ww w.j a v a 2 s. c o m grid.setText(1, 0, "Passwort:"); final PasswordTextBox pwdBox = new PasswordTextBox(); grid.setWidget(1, 1, pwdBox); panel.add(grid); Button ok = new Button("OK"); ok.addClickListener(new ClickListener() { public void onClick(Widget w) { confirmPopup.hide(); login(textBox.getText(), pwdBox.getText()); } }); panel.add(ok); confirmPopup.add(panel); confirmPopup.center(); textBox.setFocus(true); confirmPopup.show(); }
From source file:cc.alcina.framework.gwt.client.gwittir.widget.BoundTableExt.java
License:Open Source License
private Widget createNavWidget() { Grid p = new Grid(1, 5); p.setStyleName(BoundTableExt.NAV_STYLE); Button b = new Button("<<", new ClickListener() { public void onClick(Widget sender) { first();//w w w . ja v a2s . co m } }); b.setStyleName(BoundTableExt.NAV_STYLE); if (this.getCurrentChunk() == 0) { b.setEnabled(false); } p.setWidget(0, 0, b); b = new Button("<", new ClickListener() { public void onClick(Widget sender) { previous(); } }); b.setStyleName(BoundTableExt.NAV_STYLE); if (this.getCurrentChunk() == 0) { b.setEnabled(false); } p.setWidget(0, 1, b); b = new Button(">", new ClickListener() { public void onClick(Widget sender) { next(); } }); b.setStyleName(BoundTableExt.NAV_STYLE); if (this.getCurrentChunk() == (this.getNumberOfChunks() - 1)) { b.setEnabled(false); } Label l = new Label((this.getCurrentChunk() + 1) + " / " + this.getNumberOfChunks()); p.setWidget(0, 2, l); p.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); p.setWidget(0, 3, b); b = new Button(">>", new ClickListener() { public void onClick(Widget sender) { last(); } }); b.setStyleName(BoundTableExt.NAV_STYLE); if (this.getCurrentChunk() == (this.getNumberOfChunks() - 1)) { b.setEnabled(false); } p.setWidget(0, 4, b); return p; }
From source file:cc.alcina.framework.gwt.client.ide.widget.ActionProgress.java
License:Apache License
public ActionProgress(final String id, AsyncCallback<JobTracker> completionCallback) { this.id = id; this.completionCallback = completionCallback; this.fp = new FlowPanel(); fp.setStyleName("alcina-ActionProgress"); grid = new Grid(4, 2); jobName = new InlineLabel(); FlowPanel jobNCancel = new FlowPanel(); jobNCancel.add(jobName);// ww w. j a v a 2 s. c om jobName.setStyleName("pad-right-5"); this.cancelLink = new Link("(Cancel)", new ClickHandler() { public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); cancelJob(); } }); jobNCancel.add(cancelLink); cancellingStatusMessage = new InlineLabel(); cancellingStatusMessage.setVisible(false); jobNCancel.add(cancellingStatusMessage); addToGrid("Job", jobNCancel); times = new HTML(); addToGrid("Time", times); message = new Label(); message.setStyleName("message"); addToGrid("Status", message); progress = new FlowPanel(); progress.setStyleName("progress"); bar = new FlowPanel(); bar.setStyleName("bar"); bar.add(progress); addToGrid("Progress", bar); grid.setCellSpacing(2); fp.add(grid); initWidget(fp); updateProgress(); timer = new Timer() { boolean checking = false; @Override public void run() { AsyncCallback<JobTracker> callback = new AsyncCallback<JobTracker>() { public void onFailure(Throwable caught) { checking = false; if (maxConnectionFailure-- <= 0) { stopTimer(); if (ActionProgress.this.completionCallback != null) { ActionProgress.this.completionCallback.onFailure(caught); } throw new WrappedRuntimeException(caught); } } public void onSuccess(JobTracker info) { checking = false; if (info == null) { info = new JobTrackerImpl(); info.setJobName("Unknown job"); info.setComplete(true); info.setProgressMessage("---"); } if (info.isComplete()) { stopTimer(); if (ActionProgress.this.completionCallback != null) { ActionProgress.this.completionCallback.onSuccess(info); } } setJobInfo(info); fireNullPropertyChange("Updated"); } }; if (!checking) { ClientBase.getCommonRemoteServiceAsyncInstance().pollJobStatus(id, false, callback); checking = true; } } }; }
From source file:cc.alcina.framework.gwt.client.widget.complex.EmailPreviewDisplayer.java
License:Apache License
public EmailPreviewDisplayer(EmailPreview model) { FlowPanel fp = new FlowPanel(); Grid g = new Grid(2, 2); g.setWidget(0, 0, UsefulWidgetFactory.boldInline("To:")); g.setWidget(0, 1, new Label(model.getToAddresses())); g.setWidget(1, 0, UsefulWidgetFactory.boldInline("Subject:")); g.setWidget(1, 1, new Label(model.getSubject())); fp.add(g);//from ww w . j a v a2 s . c om fp.add(new HTML("<hr />")); frame = new Frame(); frame.setUrl(model.getBody()); fp.add(frame); initWidget(fp); }