本文整理汇总了Java中com.google.gwt.user.client.ui.HTMLTable类的典型用法代码示例。如果您正苦于以下问题:Java HTMLTable类的具体用法?Java HTMLTable怎么用?Java HTMLTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HTMLTable类属于com.google.gwt.user.client.ui包,在下文中一共展示了HTMLTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PackageReadyWidget
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
PackageReadyWidget(MonitorItem monItem, int idx, boolean markAlreadyActivated) {
_monItem= monItem;
_idx= idx;
BackgroundStatus bgStat= monItem.getStatus();
PackageProgress bundle= bgStat.getPartProgress(idx);
FlexTable fp= new FlexTable();
HTMLTable.CellFormatter formatter= fp.getCellFormatter();
String desc= bgStat.getPackageCount()==1 ? "" : ZIP_ROOT_TXT + (idx+1);
fp.setWidget(0,0,makeDownloadNowButton(bundle.getURL(),desc,idx));
formatter.setWidth(0,0,"100px");
fp.setWidget(0,4,_icon);
setShowRetrivedIcon(markAlreadyActivated ? FileDownloadStatus.DONE : FileDownloadStatus.NONE);
formatter.setWidth(0,4,"20px");
formatter.setHorizontalAlignment(0,4, HasHorizontalAlignment.ALIGN_RIGHT);
Label dSize= new Label(StringUtils.getSizeAsString(bundle.getFinalCompressedBytes(),true));
fp.setWidget(0,2,dSize);
formatter.setWidth(0,2,"65px");
formatter.setHorizontalAlignment(0,2, HasHorizontalAlignment.ALIGN_RIGHT);
initWidget(fp);
}
示例2: createTopGrid
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
public void createTopGrid(HashMap<Metrics,Metric> metric){
//build top grid
this.setWidth("410px");
this.setStyleName("statistics-panel-top");
//this.setStyleName("table-row-highlight");
//NumberFormat numFormat = NumberFormat.getDecimalFormat();
//NumberFormat sciNotFormat = NumberFormat.getScientificFormat();
HTMLTable.ColumnFormatter colF = this.getColumnFormatter();
colF.setWidth(0, "110px");
colF.setWidth(2,"135px");
//Grid Row 1 Cell 0,0 Mean
Metric mean = metric.get(Metrics.MEAN);
this.setHTML(0,0,"<b>"+_prop.getName("mean-flux")+"</b><br>" + WebDefaultMouseReadoutHandler.formatFlux(mean.getValue()) + " " + mean.getUnits());
//Grid Row 1 Cell 0,1 Std Dev
Metric stdDev = metric.get(Metrics.STDEV);
this.setHTML(0,1,"<b>" + _prop.getName("std-dev") + "</b><br>" + WebDefaultMouseReadoutHandler.formatFlux(stdDev.getValue()) + " " + stdDev.getUnits());
//Grid Row 1 Cell 0,2 Integrated Flux
Metric integrated = metric.get(Metrics.INTEGRATED_FLUX);
this.setHTML(0,2,"<b>" + _prop.getName("int-flux") + "</b><br>" + WebDefaultMouseReadoutHandler.formatFlux(integrated.getValue()) + " " + integrated.getUnits());
}
示例3: cellClicked
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
/**
* Executes on clicking a cell.
*
* @param cell the cell clicked on.
*/
private void cellClicked(HTMLTable.Cell cell) {
if (cell != null) {
int row = cell.getRowIndex();
int column = cell.getCellIndex();
// Ignore headers.
if (row > 0 && column > 0) {
// Unhighlight currently selected cell.
if (selectedCell != null) {
baseGrid.getCellFormatter().removeStyleName(selectedCell.getFirst(),
selectedCell.getSecond(), "tty-RiskCellSelected");
}
baseGrid.getCellFormatter().addStyleName(row, column, "tty-RiskCellSelected");
selectedCell = new Pair<Integer, Integer>(row, column);
ValueChangeEvent.fire(this, selectedCell);
}
}
}
示例4: applyHeaderStyles
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
/**
* Applies the CSS header styles to a GWT table.
*
* @param table
* The GWT table.
* @param applyToRows
* If the first column contains also headers (double entry array).
*/
public static void applyHeaderStyles(HTMLTable table, boolean applyToRows) {
// Rows.
if (applyToRows) {
for (int row = 0; row < table.getRowCount(); row++) {
applyRowStyles(table, row);
applyRowHeaderStyles(table, row, 0);
// for (int column = 0; column < table.getCellCount(row); column++) {
//
// }
}
}
// Columns.
for (int column = 0; column < table.getCellCount(0); column++) {
applyColumnHeaderStyles(table, 0, column);
}
}
示例5: applyCellStyles
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
/**
* Applies the CSS content style to a cell.
*
* @param table
* The GWT table.
* @param row
* The row index.
* @param column
* The column index.
* @param first
* If the cell is the first of its row.
* @param last
* If the cell is the last of its row.
*/
public static void applyCellStyles(HTMLTable table, int row, int column, boolean first, boolean last) {
table.getCellFormatter().addStyleName(row, column, "x-grid3-col");
table.getCellFormatter().addStyleName(row, column, "x-grid3-cell");
table.getCellFormatter().addStyleName(row, column, "html-table-cell");
if (first) {
table.getCellFormatter().addStyleName(row, column, "x-grid3-cell-first");
}
if (last) {
table.getCellFormatter().addStyleName(row, column, "x-grid3-cell-last");
table.getCellFormatter().addStyleName(row, column, "html-table-cell-last");
}
final Widget w = table.getWidget(row, column);
if (w != null) {
w.addStyleName("x-grid3-cell-inner");
}
}
示例6: buildBannerTable
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public HTMLTable buildBannerTable(final int rows, final int cols) {
final Grid gridLayout = new Grid(rows, cols);
gridLayout.addStyleName(ProjectView.STYLE_HEADER_BANNER_FLEX);
gridLayout.setCellPadding(0);
gridLayout.setCellSpacing(0);
gridLayout.setWidth("100%");
gridLayout.setHeight("100%");
for (int i = 0; i < gridLayout.getColumnCount() - 1; i++) {
gridLayout.getColumnFormatter().setWidth(i, "325px");
}
return gridLayout;
}
示例7: testAddBottomAndRightPaddingToTableCells
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
@Test
public void testAddBottomAndRightPaddingToTableCells() throws Exception {
final Element cellOne = mock(Element.class);
final Element cellTwo = mock(Element.class);
final HTMLTable.CellFormatter cellFormatter = mock(HTMLTable.CellFormatter.class);
final FlexTable testedTable = mock(FlexTable.class);
doReturn(1).when(testedTable).getRowCount();
doReturn(2).when(testedTable).getCellCount(0);
doReturn(cellFormatter).when(testedTable).getCellFormatter();
doReturn(cellOne).when(cellFormatter).getElement(0, 0);
doReturn(cellTwo).when(cellFormatter).getElement(0, 1);
ScenarioUtils.addBottomAndRightPaddingToTableCells(testedTable);
verify(cellOne).setAttribute("style", ScenarioUtils.BOTTOM_RIGHT_PADDING);
verify(cellTwo).setAttribute("style", ScenarioUtils.BOTTOM_RIGHT_PADDING);
}
示例8: SubmissionAdminTable
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
public SubmissionAdminTable(SubmissionUISummary summary) {
ArrayList<Column> tableHeaders = summary.getHeaders();
ArrayList<SubmissionUI> tableSubmissions = summary.getSubmissions();
addStyleName("dataTable");
getElement().setId("submission_table");
// setup header
int headerIndex = 0;
setHTML(0, headerIndex++, BLANK_VALUE); // delete button
setHTML(0, headerIndex++, BLANK_VALUE); // mark submission as complete
for (Column column : tableHeaders) {
setText(0, headerIndex++, column.getDisplayHeader().replace(":", "\n"));
}
setHTML(0, headerIndex, BLANK_VALUE);
setColumnFormatter(new HTMLTable.ColumnFormatter());
getColumnFormatter().addStyleName(headerIndex, "blank-submission-column");
getRowFormatter().addStyleName(0, "titleBar");
// create rows
int rowPosition = 1;
for (SubmissionUI row : tableSubmissions) {
int valueIndex = 0; // index matches to column headers
int columnPosition = 0; // position matches to position in table
// add delete button
DeleteSubmissionButton deleteButton = new DeleteSubmissionButton(row.getSubmissionKeyAsString());
setWidget(rowPosition, columnPosition, deleteButton);
columnPosition++;
// add mark complete button
MarkSubmissionCompleteButton markCompleteButton = new MarkSubmissionCompleteButton(row.getSubmissionKeyAsString());
setWidget(rowPosition, columnPosition, markCompleteButton);
columnPosition++;
// generate row
for (final String value : row.getValues()) {
switch (tableHeaders.get(valueIndex++).getUiDisplayType()) {
case BINARY:
if (value == null) {
setText(rowPosition, columnPosition, BasicConsts.EMPTY_STRING);
} else {
Image image = new Image(value + UIConsts.PREVIEW_SET);
image.addClickHandler(new BinaryPopupClickHandler(value, false));
setWidget(rowPosition, columnPosition, image);
}
break;
case REPEAT:
if (value == null) {
setText(rowPosition, columnPosition, BasicConsts.EMPTY_STRING);
} else {
RepeatViewButton repeat = new RepeatViewButton(value);
setWidget(rowPosition, columnPosition, repeat);
}
break;
default:
setText(rowPosition, columnPosition, value);
}
columnPosition++;
}
setHTML(rowPosition, columnPosition, BLANK_VALUE);
if (rowPosition % 2 == 0) {
getRowFormatter().setStyleName(rowPosition, "evenTableRow");
}
rowPosition++;
}
}
示例9: alignTableCells
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
/**
* Sets the horizontal alignment of all cells of the specified table.
* @param table table whose cells to be aligned
* @param hAlignment horizontal alignment to be set
*/
public static void alignTableCells( final HTMLTable table, final HorizontalAlignmentConstant hAlignment ) {
final CellFormatter cellFormatter = table.getCellFormatter();
for ( int i = table.getRowCount() - 1; i >= 0; i-- )
for ( int j = table.getCellCount( i ) - 1; j >= 0; j-- )
cellFormatter.setHorizontalAlignment( i, j, hAlignment );
}
示例10: loadTableIntoPanel
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
private void loadTableIntoPanel(DataSet ds, double pixScale, long fileSize){
//set column widths
List<BaseTableData.RowData> rows = ds.getModel().getRows();
int rowLength = 170;
int dataLength;
String rowValue;
for(BaseTableData.RowData row : rows){
rowValue = row.getValue(3);
dataLength = rowValue.length()*6;
//set column width to size of text
if(dataLength > rowLength){
rowLength = dataLength;
}
}
TableDataView.Column c = ds.getColumn(0);
c.setWidth(25);
c = ds.getColumn(1);
c.setWidth(100);
c = ds.getColumn(2);
c.setWidth(100);
c = ds.getColumn(3);
c.setWidth(rowLength);
BasicTable table = new BasicTable(ds);
table.setSize("470px", "375px");
// String[] str = values.split(";");
Grid grid = new Grid (1,2);
HTMLTable.ColumnFormatter colF = grid.getColumnFormatter();
colF.setWidth(0, "200px");
grid.setHTML(0,0,"<b>Pixel Size:</b> " + _nfPix.format(pixScale)+ "''");
grid.setHTML(0,1,"<b>File Size:</b> " + StringUtils.getSizeAsString(fileSize));
_panel.add(grid);
_panel.add(table);
}
示例11: loadTable
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
private VerticalPanel loadTable(DataSet ds, double pixScale, long fileSize){
VerticalPanel vp = new FitsHeaderPanel();
//set column widths
List<BaseTableData.RowData> rows = ds.getModel().getRows();
int rowLength = 170;
int dataLength;
String rowValue;
for(BaseTableData.RowData row : rows){
rowValue = row.getValue(3);
dataLength = rowValue.length()*6;
//set column width to size of text
if(dataLength > rowLength){
rowLength = dataLength;
}
}
TableDataView.Column c = ds.getColumn(0);
c.setWidth(25);
c = ds.getColumn(1);
c.setWidth(75);
c = ds.getColumn(2);
c.setWidth(100);
c = ds.getColumn(3);
c.setWidth(rowLength);
BasicTable table = new BasicTable(ds);
table.setSize("400px", "375px");
Grid grid = new Grid (1,2);
HTMLTable.ColumnFormatter colF = grid.getColumnFormatter();
colF.setWidth(0, "200px");
grid.setHTML(0,0,"<b>Pixel Size:</b> " + _nfPix.format(pixScale)+ "''");
grid.setHTML(0,1,"<b>File Size:</b> " + StringUtils.getSizeAsString(fileSize));
vp.add(grid);
vp.add(table);
return vp;
}
示例12: onClick
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
public void onClick(ClickEvent ev) {
HTMLTable.Cell cell= grid.getCellForEvent(ev);
if (cell!=null) {
int row= cell.getRowIndex();
int col= cell.getCellIndex();
float sat= (float)col / 15.0f;
float val= 1.0f - (float)row / 15.0f;
setSaturationAndValue(sat, val);
ValueChangeEvent.fire(this, sat + " " + val);
}
}
示例13: onClick
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
public void onClick(ClickEvent ev) {
HTMLTable.Cell cell= grid.getCellForEvent(ev);
if (cell!=null) {
int row= cell.getRowIndex();
// int col= cell.getCellIndex();
if (row>0) {
float hue= (float)(row-1) / 18.0f * 360.0f;
setHue(hue);
ValueChangeEvent.fire(this,hue+"");
}
}
}
示例14: applyColumnHeaderStyles
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
/**
* Applies the CSS column-header styles to a cell.
*
* @param table
* The GWT table.
* @param row
* The row index.
* @param column
* The column index.
*/
public static void applyColumnHeaderStyles(HTMLTable table, int row, int column) {
table.getCellFormatter().addStyleName(row, column, "x-grid3-header");
table.getCellFormatter().addStyleName(row, column, "x-grid3-hd");
table.getCellFormatter().addStyleName(row, column, "x-grid3-hd-row");
table.getCellFormatter().addStyleName(row, column, "x-grid3-td-favorite");
table.getCellFormatter().addStyleName(row, column, "x-grid3-cell");
final Widget w = table.getWidget(row, column);
if (w != null) {
w.addStyleName("x-grid3-hd-inner");
w.addStyleName("x-grid3-hd-favorite ");
w.addStyleName("x-component");
}
}
示例15: buildActivationUI
import com.google.gwt.user.client.ui.HTMLTable; //导入依赖的package包/类
public static Widget buildActivationUI(String text,
String tip,
final MonitorItem monItem,
final int idx,
final BackgroundActivation bActivate,
boolean markAlreadyActivated) {
final Image icon= new Image(RETRIEVED_ICON);
icon.setVisible(markAlreadyActivated);
Widget button= GwtUtil.makeLinkButton(text, tip,
new ClickHandler() {
public void onClick(ClickEvent event) {
bActivate.activate(monItem,idx, false);
icon.setVisible(true);
}
});
WebEventListener autoActListener= new WebEventListener() {
public void eventNotify(WebEvent ev) {
if (ev.getSource()==monItem && ev.getName()==Name.MONITOR_ITEM_UPDATE) {
if (monItem.isDone() && monItem.isActivated(idx)) {
icon.setVisible(true);
WebEventManager.getAppEvManager().removeListener(Name.MONITOR_ITEM_UPDATE,
monItem,this);
}
}
}
};
WebEventManager.getAppEvManager().addListener(Name.MONITOR_ITEM_UPDATE,monItem,autoActListener);
FlexTable fp= new FlexTable();
HTMLTable.CellFormatter formatter= fp.getCellFormatter();
fp.setWidget(0,0,button);
formatter.setWidth(0,0,"100px");
fp.setWidget(0,4,icon);
formatter.setWidth(0,4,"20px");
formatter.setHorizontalAlignment(0,4, HasHorizontalAlignment.ALIGN_RIGHT);
return fp;
}