List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
From source file:com.google.gwt.sample.showcase.client.content.i18n.CwPluralFormsExample.java
License:Apache License
/** * Initialize this example.//from ww w . j ava2s .c om */ @ShowcaseSource @Override public Widget onInitialize() { // Create the internationalized error messages pluralMessages = GWT.create(PluralMessages.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface final String rawFile = getSimpleName(PluralMessages.class); Anchor link = new Anchor(rawFile); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { fireRawSourceRequest(rawFile + ".java"); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwPluralFormsExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Add argument 0 arg0Box = new TextBox(); arg0Box.setText("13"); layout.setHTML(2, 0, constants.cwPluralFormsExampleArg0Label()); layout.setWidget(2, 1, arg0Box); // Add the formatted message formattedMessage = new Label(); layout.setHTML(5, 0, constants.cwPluralFormsExampleFormattedLabel()); layout.setWidget(5, 1, formattedMessage); formatter.setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP); // Add handlers to all of the argument boxes KeyUpHandler keyUpHandler = new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { updateMessage(); } }; arg0Box.addKeyUpHandler(keyUpHandler); // Return the layout Widget updateMessage(); return layout; }
From source file:com.google.gwt.sample.showcase.client.content.panels.CwDecoratorPanel.java
License:Apache License
/** * Initialize this example./* www . j av a 2 s. co m*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, constants.cwDecoratorPanelFormTitle()); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, constants.cwDecoratorPanelFormName()); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, constants.cwDecoratorPanelFormDescription()); layout.setWidget(2, 1, new TextBox()); // Wrap the content in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
From source file:com.google.gwt.sample.showcase.client.content.panels.CwDisclosurePanel.java
License:Apache License
/** * Create a form that contains undisclosed advanced options. *//*from w ww .j ava 2s . c o m*/ @ShowcaseSource private Widget createAdvancedForm() { // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); layout.setWidth("300px"); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, constants.cwDisclosurePanelFormTitle()); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, constants.cwDisclosurePanelFormName()); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, constants.cwDisclosurePanelFormDescription()); layout.setWidget(2, 1, new TextBox()); // Create some advanced options HorizontalPanel genderPanel = new HorizontalPanel(); String[] genderOptions = constants.cwDisclosurePanelFormGenderOptions(); for (int i = 0; i < genderOptions.length; i++) { genderPanel.add(new RadioButton("gender", genderOptions[i])); } Grid advancedOptions = new Grid(2, 2); advancedOptions.setCellSpacing(6); advancedOptions.setHTML(0, 0, constants.cwDisclosurePanelFormLocation()); advancedOptions.setWidget(0, 1, new TextBox()); advancedOptions.setHTML(1, 0, constants.cwDisclosurePanelFormGender()); advancedOptions.setWidget(1, 1, genderPanel); // Add advanced options to form in a disclosure panel DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.cwDisclosurePanelFormAdvancedCriteria()); advancedDisclosure.setAnimationEnabled(true); advancedDisclosure.ensureDebugId("cwDisclosurePanel"); advancedDisclosure.setContent(advancedOptions); layout.setWidget(3, 0, advancedDisclosure); cellFormatter.setColSpan(3, 0, 2); // Wrap the contents in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
From source file:com.google.gwt.sample.showcase.client.content.tables.CwFlexTable.java
License:Apache License
/** * Initialize this example./* ww w . ja va 2s. co m*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create a Flex Table final FlexTable flexTable = new FlexTable(); FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter(); flexTable.addStyleName("cw-FlexTable"); flexTable.setWidth("32em"); flexTable.setCellSpacing(5); flexTable.setCellPadding(3); // Add some text cellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); flexTable.setHTML(0, 0, constants.cwFlexTableDetails()); cellFormatter.setColSpan(0, 0, 2); // Add a button that will add more rows to the table Button addRowButton = new Button(constants.cwFlexTableAddRow(), new ClickHandler() { public void onClick(ClickEvent event) { addRow(flexTable); } }); addRowButton.addStyleName("sc-FixedWidthButton"); Button removeRowButton = new Button(constants.cwFlexTableRemoveRow(), new ClickHandler() { public void onClick(ClickEvent event) { removeRow(flexTable); } }); removeRowButton.addStyleName("sc-FixedWidthButton"); VerticalPanel buttonPanel = new VerticalPanel(); buttonPanel.setStyleName("cw-FlexTable-buttonPanel"); buttonPanel.add(addRowButton); buttonPanel.add(removeRowButton); flexTable.setWidget(0, 1, buttonPanel); cellFormatter.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); // Add two rows to start addRow(flexTable); addRow(flexTable); // Return the panel flexTable.ensureDebugId("cwFlexTable"); return flexTable; }
From source file:com.google.gwt.sample.showcase.client.content.tables.CwFlexTable.java
License:Apache License
/** * Add a row to the flex table.// w ww .j av a 2 s .c o m */ @ShowcaseSource private void addRow(FlexTable flexTable) { int numRows = flexTable.getRowCount(); flexTable.setWidget(numRows, 0, new Image(Showcase.images.gwtLogo())); flexTable.setWidget(numRows, 1, new Image(Showcase.images.gwtLogo())); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); }
From source file:com.google.gwt.sample.showcase.client.content.tables.CwFlexTable.java
License:Apache License
/** * Remove a row from the flex table.//w w w. j a v a 2 s. co m */ @ShowcaseSource private void removeRow(FlexTable flexTable) { int numRows = flexTable.getRowCount(); if (numRows > 1) { flexTable.removeRow(numRows - 1); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows - 1); } }
From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.blog.client.blog.blogentry.comment.BlogEntryCommentController.java
License:Apache License
private void addComment() { getView().getTreeBlogEntryComment().remove(getView().getButtonAddComment()); Label labelCommentAuthorName = new Label("Author Name"); TextBox textBoxCommentAuthorName = new TextBox(); getView().setTextBoxCommentAuthorName(textBoxCommentAuthorName); Label labelTextAreaComment = new Label("Your Blog-Comment"); TextArea textAreaComment = new TextArea(); getView().setTextAreaComment(textAreaComment); Button buttonCommitComment = new Button(I18N.constants.buttonAddBlogEntryComment()); buttonCommitComment.addClickListener(new ClickListener() { public void onClick(Widget sender) { commitComment();/* www . j av a 2s .c o m*/ } }); Button buttonCancel = new Button(I18N.constants.buttonCancel()); buttonCancel.addClickListener(new ClickListener() { public void onClick(Widget sender) { getView().getTreeBlogEntryComment().removeItem(getView().getTreeItemComment()); getView().getTreeBlogEntryComment().add(getView().getButtonAddComment()); } }); FlexTable flexTable = new FlexTable(); flexTable.setWidget(0, 0, labelCommentAuthorName); flexTable.setWidget(0, 1, textBoxCommentAuthorName); flexTable.setWidget(1, 0, labelTextAreaComment); flexTable.setWidget(1, 1, textAreaComment); flexTable.setWidget(2, 0, buttonCommitComment); FlexCellFormatter flexCellFormatter = flexTable.getFlexCellFormatter(); flexCellFormatter.setColSpan(2, 0, 2); flexCellFormatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); TreeItem treeItem = new TreeItem(); getView().setTreeItemComment(treeItem); treeItem.setWidget(flexTable); getView().getTreeBlogEntryComment().addItem(treeItem); }
From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.bloglist.client.bloglist.BloglistController.java
License:Open Source License
private void refreshBloglist(Set<BlogPreviewDTO> setBlogPreviewDTO) { VerticalPanel panel = getView().getVerticalPanelBloglist(); panel.clear();//from ww w.ja v a 2s . c o m if ((setBlogPreviewDTO == null) || (setBlogPreviewDTO.size() == 0)) { getView().getLabelHostedBlogs().setText(I18N.constants.labelNoBlogsFound()); } else { getView().getLabelHostedBlogs().setText(I18N.constants.labelHostedBlogs()); for (BlogPreviewDTO blogPreviewDTO : setBlogPreviewDTO) { Hyperlink hyperlink = new Hyperlink(blogPreviewDTO.getTitle(), HistoryToken.blog + "=" + blogPreviewDTO.getId()); Label labelAuthor = new Label( I18N.constants.labelAuthorName() + " " + blogPreviewDTO.getUsername()); Label labelBlogDescription = new Label(blogPreviewDTO.getDescription()); FlexTable flexTable = new FlexTable(); flexTable.setStylePrimaryName("blogPreview"); flexTable.setWidget(0, 0, hyperlink); flexTable.setWidget(0, 1, labelAuthor); flexTable.setWidget(1, 0, labelBlogDescription); FlexCellFormatter flexCellFormatter = flexTable.getFlexCellFormatter(); flexCellFormatter.setColSpan(1, 0, 2); panel.add(flexTable); } } }
From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.dashboard.client.edit.blog.EditBlogController.java
License:Apache License
/** * @param blogEntryDTO/*from w w w .j av a 2 s . com*/ */ private void createTreeItemBlogEntry(BlogEntryDTO blogEntryDTO, List<BlogEntryCommentDTO> listBlogEntryCommentDTO, Tree treeBlogEntries) { Label labelTitle = new Label(blogEntryDTO.getTitle()); Hyperlink hyperlinkEdit = new Hyperlink(I18N.constants.linkEdit(), HistoryToken.editBlogEntry + "=" + blogEntryDTO.getId()); Hyperlink hyperlinkRemove = new Hyperlink(I18N.constants.linkRemove(), ""); hyperlinkRemove.addClickListener(getClickListenerRemoveBlogEntry()); FlexTable tableBlogEntryTreeItem = new FlexTable(); tableBlogEntryTreeItem.setWidget(0, 0, labelTitle); tableBlogEntryTreeItem.setWidget(0, 1, hyperlinkRemove); tableBlogEntryTreeItem.setWidget(0, 2, hyperlinkEdit); FlexCellFormatter cellFormatter = tableBlogEntryTreeItem.getFlexCellFormatter(); cellFormatter.setColSpan(1, 0, 3); tableBlogEntryTreeItem.setWidget(1, 0, new Label(blogEntryDTO.getText())); TreeItem treeItemBlogEntry = treeBlogEntries.addItem(tableBlogEntryTreeItem); getModel().getMapTreeItemBlogEntryDTO().put(treeItemBlogEntry, blogEntryDTO); for (BlogEntryCommentDTO blogEntryCommentDTO : listBlogEntryCommentDTO) { createTreeItemBlogEntryComment(blogEntryCommentDTO, treeItemBlogEntry); } }
From source file:com.googlesource.gerrit.plugins.verifystatus.client.JobsScreen.java
License:Apache License
private void display(NativeMap<VerificationInfo> jobs) { int columns = 7; FlexTable t = new FlexTable(); t.setStyleName("verifystatus-jobsTable"); FlexCellFormatter fmt = t.getFlexCellFormatter(); for (int c = 0; c < columns; c++) { fmt.addStyleName(0, c, "dataHeader"); fmt.addStyleName(0, c, "topMostCell"); }//from w w w .j a va 2s .co m fmt.addStyleName(0, 0, "leftMostCell"); t.setText(0, 0, "Result"); t.setText(0, 1, "Name"); t.setText(0, 2, "Duration"); t.setText(0, 3, "Voting"); t.setText(0, 4, "Rerun"); t.setText(0, 5, "Category"); t.setText(0, 6, "Reporter"); t.setText(0, 7, "Date"); int row = 1; for (String key : jobs.keySet()) { VerificationInfo vi = jobs.get(key); for (int c = 0; c < columns; c++) { fmt.addStyleName(row, c, "dataCell"); fmt.addStyleName(row, 0, "leftMostCell"); } short vote = vi.value(); if (vote > 0) { t.setWidget(row, 0, new Image(VerifyStatusPlugin.RESOURCES.greenCheck())); } else if (vote < 0) { t.setWidget(row, 0, new Image(VerifyStatusPlugin.RESOURCES.redNot())); } else if (vote == 0) { t.setWidget(row, 0, new Image(VerifyStatusPlugin.RESOURCES.warning())); } Anchor anchor = new Anchor(vi.name(), vi.url()); t.setWidget(row, 1, anchor); t.setText(row, 2, vi.duration()); if (vi.abstain()) { t.setText(row, 3, "non-voting"); } else { t.setText(row, 3, "voting"); } if (vi.rerun()) { t.setText(row, 4, "Y"); } else { t.setText(row, 4, "N"); } t.setText(row, 5, vi.category()); t.setText(row, 6, vi.reporter()); t.setText(row, 7, FormatUtil.shortFormat(vi.granted())); row++; } add(t); }