本文整理汇总了Java中com.google.gwt.user.client.ui.FlexTable.getRowFormatter方法的典型用法代码示例。如果您正苦于以下问题:Java FlexTable.getRowFormatter方法的具体用法?Java FlexTable.getRowFormatter怎么用?Java FlexTable.getRowFormatter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.FlexTable
的用法示例。
在下文中一共展示了FlexTable.getRowFormatter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyDataRowStyles
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
private void applyDataRowStyles(FlexTable grid) {
RowFormatter rf = grid.getRowFormatter();
for (int row = 0; row < grid.getRowCount(); ++row) {
if ((row % 2) != 0) {
rf.addStyleName(row, "FlexTable-OddRow");
}
else {
rf.addStyleName(row, "FlexTable-EvenRow");
}
}
}
示例2: renderInfoRow
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
private void renderInfoRow( final FileStatInfo info, final FlexTable table, final ClickHandler googleAccountClickHandler ) {
final CellFormatter cellFormatter = table.getCellFormatter();
final RowFormatter rowFormatter = table.getRowFormatter();
int column = 0;
table.setWidget( row, column++, new Label( userCounter + "." ) );
cellFormatter.setHorizontalAlignment( row, column-1, HasHorizontalAlignment.ALIGN_RIGHT );
final VerticalPanel userPanel = new VerticalPanel();
if ( info.getAddressedBy() != null )
userPanel.add( ClientUtils.styledWidget( new Label( info.getAddressedBy() + ", "
+ ( info.getCountry() == null ? "-" : info.getCountry() ) ), "explanation" ) );
if ( googleAccountClickHandler == null || userCounter == 0 )
userPanel.add( new Label( info.getGoogleAccount() ) );
else {
final Anchor googleAccountAnchor = new Anchor( info.getGoogleAccount() );
googleAccountAnchor.setTitle( googleAccountClickHandler.toString() );
googleAccountAnchor.addClickHandler( googleAccountClickHandler );
userPanel.add( googleAccountAnchor );
}
userPanel.add( ClientUtils.styledWidget( ClientUtils.createTimestampWidget( "Updated: ", info.getUpdated() ), "explanation" ) );
userPanel.add( ClientUtils.styledWidget( new Label(
( info.getAccountCreated() == null ? "" : "Created: " + ClientUtils.DATE_FORMAT.format( info.getAccountCreated() ) + ", " )
+ "Pkg: " + info.getDbPackageName() + ";" ), "explanation" ) );
if ( info.getComment() != null ) {
final Label commentLabel = new Label();
if ( info.getComment().length() <= 40 )
commentLabel.setText( info.getComment() );
else {
commentLabel.setText( info.getComment().substring( 0, 40 ) + "..." );
commentLabel.setTitle( info.getComment() );
}
userPanel.add( ClientUtils.styledWidget( commentLabel, "explanation" ) );
}
table.setWidget( row, column++, userPanel );
final Widget dbPackageWidget = info.getDbPackageIcon() == null ? new Label( info.getDbPackageName() ) : new Image( info.getDbPackageIcon() );
dbPackageWidget.setTitle( "Available storage: " + NUMBER_FORMAT.format( info.getPaidStorage() ) + " bytes" );
table.setWidget( row, column++, dbPackageWidget );
int rowSpan = 1;
if ( info.getRepCount () > 0 ) rowSpan++;
if ( info.getSmpdCount () > 0 ) rowSpan++;
if ( info.getOtherCount() > 0 ) rowSpan++;
if ( rowSpan > 1 )
for ( int i = column - 1; i >= 0; i-- )
table.getFlexCellFormatter().setRowSpan( row, i, rowSpan );
userCounter++;
for ( int type = 0; type < 4; type++ ) {
String fileType = null;
int count = 0;
long storage = 0;
switch ( type ) {
case 0 : count = info.getAllCount(); storage = info.getAllStorage(); fileType = "<all>"; break;
case 1 : if ( ( count = info.getRepCount () ) == 0 ) continue; storage = info.getRepStorage (); fileType = "rep" ; column = 0; break;
case 2 : if ( ( count = info.getSmpdCount () ) == 0 ) continue; storage = info.getSmpdStorage (); fileType = "smpd" ; column = 0; break;
case 3 : if ( ( count = info.getOtherCount() ) == 0 ) continue; storage = info.getOtherStorage(); fileType = "other"; column = 0; break;
}
table.setWidget( row, column++, new Label( fileType ) );
final int firstNumberColumn = column;
table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( count ) ) );
table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( storage ) + " bytes" ) );
table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( count == 0 ? 0 : storage / count ) + " bytes" ) );
final int usedPercent = info.getPaidStorage() == 0 ? 0 : (int) ( storage * 100 / info.getPaidStorage() );
table.setWidget( row, column++, new Label( usedPercent + "%" ) );
for ( int i = column - 1; i >= firstNumberColumn; i-- )
cellFormatter.setHorizontalAlignment( row, i, HasHorizontalAlignment.ALIGN_RIGHT );
rowFormatter.addStyleName( row, userCounter == 1 ? "gold" : ( userCounter & 0x01 ) == 0 ? "row0" : "row1" );
row++;
}
}