List of usage examples for com.google.gwt.user.client.ui Grid resizeColumns
public void resizeColumns(int columns)
From source file:co.fxl.gui.gwt.GWTGridPanel.java
License:Open Source License
private void resize() { Grid grid = (Grid) container.widget; if (gridCell.column >= grid.getColumnCount()) { grid.resizeColumns(gridCell.column + 1); }//from w ww . j a v a 2 s . co m if (gridCell.row >= grid.getRowCount()) { grid.resizeRows(gridCell.row + 1); } }
From source file:com.mecatran.otp.gwt.client.view.ItineraryTimeLineWidget.java
License:Open Source License
public ItineraryTimeLineWidget(ItineraryBean anItinerary) { itinerary = anItinerary;//from w w w.java2 s. c o m long totalTravelTimeSec = anItinerary.getDurationSeconds(); SimplePanel rootPanel = new SimplePanel(); rootPanel.addStyleName("itinerary-timeline"); rootPanel.addStyleName("timeline-clock-icon"); Grid timesPanel = new Grid(1, 0); rootPanel.add(timesPanel); int timesPanelColumns = 0; for (ItineraryLegBean leg : itinerary.getLegs()) { if (leg.getTravelType() == TravelType.ROAD) { ItineraryRoadLegBean roadLeg = leg.getAsRoadLeg(); // Road time scale long legTravelTimeSec = roadLeg.getDurationSeconds(); timesPanelColumns++; timesPanel.resizeColumns(timesPanelColumns); HTML roadTimeLabel = new HTML(secToString(legTravelTimeSec)); timesPanel.setWidget(0, timesPanelColumns - 1, roadTimeLabel); String styleName = "timeline-" + FormatUtils.getCssClassNameFromTransportMode(roadLeg.getMode()) + "-icon"; timesPanel.getCellFormatter().addStyleName(0, timesPanelColumns - 1, styleName); timesPanel.getCellFormatter().getElement(0, timesPanelColumns - 1).getStyle() .setWidth(legTravelTimeSec * 100 / totalTravelTimeSec, Style.Unit.PCT); } else if (leg.getTravelType() == TravelType.TRANSIT) { ItineraryTransitLegBean transitLeg = leg.getAsTransitLeg(); // Wait time scale long legWaitTimeSec = transitLeg.getWaitDurationSeconds(); if (legWaitTimeSec > 60) { timesPanelColumns++; timesPanel.resizeColumns(timesPanelColumns); HTML waitTimeLabel = new HTML(secToString(legWaitTimeSec)); timesPanel.setWidget(0, timesPanelColumns - 1, waitTimeLabel); timesPanel.getCellFormatter().addStyleName(0, timesPanelColumns - 1, "timeline-wait-icon"); timesPanel.getCellFormatter().getElement(0, timesPanelColumns - 1).getStyle() .setWidth(legWaitTimeSec * 100 / totalTravelTimeSec, Style.Unit.PCT); } // Transit time scale long legTravelTimeSec = transitLeg.getDurationSeconds(); timesPanelColumns++; timesPanel.resizeColumns(timesPanelColumns); HTML transitTimeLabel = new HTML(secToString(legTravelTimeSec)); timesPanel.setWidget(0, timesPanelColumns - 1, transitTimeLabel); timesPanel.getCellFormatter().addStyleName(0, timesPanelColumns - 1, "timeline-transit-icon"); String styleName = "timeline-" + FormatUtils.getCssClassNameFromTransportMode(transitLeg.getMode()) + "-icon"; timesPanel.getCellFormatter().addStyleName(0, timesPanelColumns - 1, styleName); timesPanel.getCellFormatter().getElement(0, timesPanelColumns - 1).getStyle() .setWidth(legTravelTimeSec * 100 / totalTravelTimeSec, Style.Unit.PCT); } } initWidget(rootPanel); }
From source file:org.jbpm.form.builder.ng.model.client.form.items.TableLayoutFormItem.java
License:Apache License
private void populate(Grid grid) { if (this.borderWidth != null && this.borderWidth > 0) { grid.setBorderWidth(this.borderWidth); }/*from ww w . j a v a 2 s.c om*/ if (this.cellpadding != null && this.cellpadding >= 0) { grid.setCellPadding(this.cellpadding); } if (this.cellspacing != null && this.cellspacing >= 0) { grid.setCellSpacing(this.cellspacing); } if (getHeight() != null) { grid.setHeight(getHeight()); } if (getWidth() != null) { grid.setWidth(getWidth()); } if (this.title != null) { grid.setTitle(this.title); } if (this.columns != null && this.columns > 0) { grid.resizeColumns(this.columns); } if (this.rows != null && this.rows > 0) { grid.resizeRows(this.rows); } }