Java Code Examples for com.google.gwt.user.client.ui.Grid#addStyleName()
The following examples show how to use
com.google.gwt.user.client.ui.Grid#addStyleName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WordCloudLatestApp.java From swcv with MIT License | 6 votes |
private Grid createStatTable(DBStatistics result) { Grid table = new Grid(3, 2); table.addStyleName("stat"); table.setHTML(0, 0, "the number of clouds <b>in total</b>"); table.setHTML(1, 0, "the number of clouds constructed <b>last month</b>"); table.setHTML(2, 0, "the number of clouds constructed <b>last week</b>"); table.setHTML(0, 1, "" + result.getTotal()); table.setHTML(1, 1, "" + result.getLastMonth()); table.setHTML(2, 1, "" + result.getLastWeek()); CellFormatter cf = table.getCellFormatter(); cf.setWidth(0, 0, "65%"); cf.setWidth(0, 1, "35%"); return table; }
Example 2
Source File: CopyYoungAndroidProjectCommand.java From appinventor-extensions with Apache License 2.0 | 5 votes |
private Widget createPreviousCheckpointsTable(List<Project> checkpointProjects) { Grid table = new Grid(1 + checkpointProjects.size(), 3); table.addStyleName("ode-ProjectTable"); // Set the widgets for the header row. table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow"); table.setWidget(0, 0, new Label(MESSAGES.projectNameHeader())); table.setWidget(0, 1, new Label(MESSAGES.projectDateCreatedHeader())); table.setWidget(0, 2, new Label(MESSAGES.projectDateModifiedHeader())); // Set the widgets for the rows representing previous checkpoints DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat(); int row = 1; for (Project checkpointProject : checkpointProjects) { table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted"); Label nameLabel = new Label(checkpointProject.getProjectName()); table.setWidget(row, 0, nameLabel); Date dateCreated = new Date(checkpointProject.getDateCreated()); table.setWidget(row, 1, new Label(dateTimeFormat.format(dateCreated))); Date dateModified = new Date(checkpointProject.getDateModified()); table.setWidget(row, 2, new Label(dateTimeFormat.format(dateModified))); row++; } return table; }
Example 3
Source File: ProjectList.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Creates a new ProjectList */ public ProjectList() { projects = new ArrayList<Project>(); selectedProjects = new ArrayList<Project>(); projectWidgets = new HashMap<Project, ProjectWidgets>(); sortField = SortField.DATE_MODIFIED; sortOrder = SortOrder.DESCENDING; // Initialize UI table = new Grid(1, 5); // The table initially contains just the header row. table.addStyleName("ode-ProjectTable"); table.setWidth("100%"); table.setCellSpacing(0); nameSortIndicator = new Label(""); dateCreatedSortIndicator = new Label(""); dateModifiedSortIndicator = new Label(""); publishedSortIndicator = new Label(""); refreshSortIndicators(); setHeaderRow(); VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.add(table); initWidget(panel); // It is important to listen to project manager events as soon as possible. Ode.getInstance().getProjectManager().addProjectManagerEventListener(this); gallery = GalleryClient.getInstance(); }
Example 4
Source File: TrashProjectList.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Creates a new TrashProjectList */ public TrashProjectList() { projects = new ArrayList<Project>(); selectedProjects = new ArrayList<Project>(); projectWidgets = new HashMap<Project, ProjectWidgets>(); sortField = SortField.DATE_MODIFIED; sortOrder = SortOrder.DESCENDING; // Initialize UI table = new Grid(1, 5); // The table initially contains just the header row. table.addStyleName("ode-ProjectTable"); table.setWidth("100%"); table.setCellSpacing(0); nameSortIndicator = new Label(""); dateCreatedSortIndicator = new Label(""); dateModifiedSortIndicator = new Label(""); publishedSortIndicator = new Label(""); refreshSortIndicators(); setHeaderRow(); VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.add(table); initWidget(panel); // It is important to listen to project manager events as soon as possible. Ode.getInstance().getProjectManager().addProjectManagerEventListener(this); gallery = GalleryClient.getInstance(); }
Example 5
Source File: SimpleColorPicker.java From swellrt with Apache License 2.0 | 5 votes |
/** * Instantiates a new simple color picker. * * @param colopicker the colopicker */ public SimpleColorPicker(ComplexColorPicker colopicker) { super(colopicker); style.ensureInjected(); final Grid grid = new Grid(ROWS, COLS); grid.setCellSpacing(0); grid.getRowFormatter().getElement(0).addClassName(style.firstRow()); grid.getRowFormatter().getElement(1).addClassName(style.firstRow()); int row; int col; int num = 0; for (final String c : COLORS) { row = num / COLS; col = num % COLS; grid.setWidget(row, col, createCell(c)); num++; } grid.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { Cell cell = grid.getCellForEvent(event); if (cell != null) { String color = COLORS[cell.getRowIndex() * COLS + cell.getCellIndex()]; onColorChoose(color); } } }); grid.addStyleName(style.grid()); initWidget(grid); }
Example 6
Source File: SimpleColorPicker.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Instantiates a new simple color picker. * * @param colopicker the colopicker */ public SimpleColorPicker(ComplexColorPicker colopicker) { super(colopicker); style.ensureInjected(); final Grid grid = new Grid(ROWS, COLS); grid.setCellSpacing(0); grid.getRowFormatter().getElement(0).addClassName(style.firstRow()); grid.getRowFormatter().getElement(1).addClassName(style.firstRow()); int row; int col; int num = 0; for (final String c : COLORS) { row = num / COLS; col = num % COLS; grid.setWidget(row, col, createCell(c)); num++; } grid.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { Cell cell = grid.getCellForEvent(event); if (cell != null) { String color = COLORS[cell.getRowIndex() * COLS + cell.getCellIndex()]; onColorChoose(color); } } }); grid.addStyleName(style.grid()); initWidget(grid); }
Example 7
Source File: GeneralView.java From core with GNU Lesser General Public License v2.1 | 5 votes |
public Widget asWidget() { columns = new Column[]{ new TextColumn("Status", "OFF"), new NumberColumn("average-commit-time", "Average Commit Time"), new NumberColumn("number-of-inflight-transactions", "Inflight Transactions"), new NumberColumn("number-of-nested-transactions", "Nested Transactions") }; grid = new Grid(columns.length, 2); grid.addStyleName("metric-grid"); for (int row = 0; row < columns.length; ++row) { grid.getCellFormatter().addStyleName(row, 0, "nominal"); grid.getCellFormatter().addStyleName(row, 1, "numerical"); } grid.setText(0, 0, "Status"); HorizontalPanel header = new HorizontalPanel(); header.addStyleName("fill-layout-width"); header.add(new HTML("<h3 class='metric-label'>General Statistics</h3>")); final HelpSystem.AddressCallback addressCallback = () -> { ModelNode address = new ModelNode(); address.get(ModelDescriptionConstants.ADDRESS).set(RuntimeBaseAddress.get()); address.get(ModelDescriptionConstants.ADDRESS).add("subsystem", "transactions"); return address; }; MetricHelpPanel helpPanel = new MetricHelpPanel(addressCallback, this.columns); VerticalPanel metricsPanel = new VerticalPanel(); metricsPanel.addStyleName("metric-container"); metricsPanel.add(header); metricsPanel.add(helpPanel.asWidget()); metricsPanel.add(grid); return metricsPanel.asWidget(); }
Example 8
Source File: WordCloudLatestApp.java From swcv with MIT License | 4 votes |
private Grid createTable(List<WordCloud> clouds, boolean debug) { Grid table = new Grid(clouds.size() + 1, debug ? 4 : 3); table.addStyleName("latest"); CellFormatter cf = table.getCellFormatter(); table.setHTML(0, 0, "<b>id</b>"); table.setHTML(0, 1, "<b>creation date</b>"); table.setHTML(0, 2, "<b>source</b>"); cf.setWidth(0, 0, "10%"); cf.setWidth(0, 1, "25%"); cf.setWidth(0, 2, "65%"); cf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); cf.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); cf.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); if (debug) { table.setHTML(0, 3, "<b>ip</b>"); cf.setWidth(0, 1, "20%"); cf.setWidth(0, 2, "60%"); cf.setWidth(0, 3, "10%"); cf.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_CENTER); } for (int i = 0; i < clouds.size(); i++) { WordCloud cloud = clouds.get(i); table.setHTML(i + 1, 0, "<a href='/cloud.html?id=" + cloud.getId() + "'>" + cloud.getId() + "</a>"); Date dt = cloud.getCreationDateAsDate(); table.setHTML(i + 1, 1, DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dt)); table.setWidget(i + 1, 2, createSourceField(cloud, debug)); cf.setHorizontalAlignment(i + 1, 2, HasHorizontalAlignment.ALIGN_LEFT); if (debug) { table.setHTML(i + 1, 3, cloud.getCreatorIP()); } } return table; }
Example 9
Source File: BulletGraphView.java From core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public Widget asWidget() { VerticalPanel desc = new VerticalPanel(); desc.addStyleName("metric-container"); if(embeddedUse) desc.add(new HTML("<h3 class='metric-label-embedded'>" + title + "</h3>")); else desc.add(new HTML("<h3 class='metric-label'>" + title + "</h3>")); container = new HorizontalPanel(); container.setStyleName("fill-layout-width"); container.addStyleName("metric-panel"); grid = new Grid(columns.length, 2); grid.addStyleName("metric-grid"); // format for (int row = 0; row < columns.length; ++row) { grid.getCellFormatter().addStyleName(row, 0, "nominal"); grid.getCellFormatter().addStyleName(row, 1, "numerical"); } int baselineIndex = getBaseLineIndex(); if(baselineIndex>=0) grid.getRowFormatter().addStyleName(baselineIndex, "baseline"); // init for(int i=0; i<columns.length;i++) { grid.setText(i, 0, columns[i].label); grid.setText(i, 1, "0"); } container.add(grid); ProtovisWidget graphWidget = new ProtovisWidget(); graphWidget.initPVPanel(); vis = createVisualization(graphWidget); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { renderDefault(); // the 'empty' display } }); if (address != null) { MetricHelpPanel helpPanel = new MetricHelpPanel(address, this.columns); desc.add(helpPanel.asWidget()); } container.add(graphWidget); graphWidget.getElement().getParentElement().setAttribute("align", "center"); graphWidget.getElement().getParentElement().setAttribute("width", "80%"); desc.add(container); return desc; }