GWT Flex表问题
我正在使用以下代码动态创建flex表。
for (int CurrentRow=1;CurrentRow<2;CurrentRow++)
{
Label lblGettingName = new Label("Getting Name...");
View.getMainFlex().setWidget(CurrentRow, 0, lblGettingName);
Button btnViewDetails = new Button("View Details");
View.getMainFlex().setWidget(CurrentRow, 1, btnViewDetails);
Label lblGettingBid = new Label("Getting Bid...");
View.getMainFlex().setWidget(CurrentRow, 2, lblGettingBid);
View.getMainFlex().getFlexCellFormatter().setStyleName(CurrentRow, 2, "BackNormalNotBold");
Label lblGettingBidDesription = new Label("Getting Bid Desription...");
lblGettingBidDesription.setStyleName("BidDesc");
View.getMainFlex().setWidget(CurrentRow, 3, lblGettingBidDesription);
View.getMainFlex().getCellFormatter().setWidth(CurrentRow, 3, "40");
View.getMainFlex().getFlexCellFormatter().setStylePrimaryName(CurrentRow, 3, ".BidDesc");
Label lblCalculating = new Label("Calculating..");
Label lblCalculatingTime = new Label("Calculating Time...");
View.getMainFlex().setWidget(CurrentRow, 4, lblCalculatingTime);
View.getMainFlex().getFlexCellFormatter().setStyleName(1,4, "BackNormalNotBold");
TextBox textBox = new TextBox();
View.getMainFlex().setWidget(CurrentRow+1, 3, textBox);
View.getMainFlex().getCellFormatter().setWidth(CurrentRow+1, 3, "40");
View.getMainFlex().getFlexCellFormatter().setStyleName(CurrentRow, 0, "BackNormalNotBold");
View.getMainFlex().getFlexCellFormatter().setStyleName(CurrentRow, 1, "BackNormalNotBold");
View.getMainFlex().getFlexCellFormatter().setStyleName(CurrentRow, 2, "BackNormalNotBold");
View.getMainFlex().getFlexCellFormatter().setStyleName(CurrentRow+1, 3, "BackNormalNotBold");
View.getMainFlex().getFlexCellFormatter().setRowSpan(CurrentRow, 4, 3);
View.getMainFlex().getFlexCellFormatter().setRowSpan(CurrentRow, 2, 3);
View.getMainFlex().getFlexCellFormatter().setRowSpan(CurrentRow, 1, 3);
View.getMainFlex().getFlexCellFormatter().setRowSpan(CurrentRow, 0, 3);
View.getMainFlex().getFlexCellFormatter().setColSpan(CurrentRow+1, 3, 2);
View.getMainFlex().getFlexCellFormatter().setColSpan(CurrentRow, 3, 2);
View.getMainFlex().getFlexCellFormatter().setColSpan(CurrentRow-1, 3, 2);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow, 1, HasHorizontalAlignment.ALIGN_CENTER);
View.getMainFlex().getCellFormatter().setVerticalAlignment(CurrentRow, 1, HasVerticalAlignment.ALIGN_MIDDLE);
View.getMainFlex().getCellFormatter().setVerticalAlignment(CurrentRow, 0, HasVerticalAlignment.ALIGN_MIDDLE);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow, 0, HasHorizontalAlignment.ALIGN_CENTER);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow, 2, HasHorizontalAlignment.ALIGN_CENTER);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow+1, 3, HasHorizontalAlignment.ALIGN_CENTER);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow, 3, HasHorizontalAlignment.ALIGN_CENTER);
Button btnPlaceBid = new Button("Bid!");
View.getMainFlex().setWidget(CurrentRow+2, 3, btnPlaceBid);
View.getMainFlex().getCellFormatter().setWidth(CurrentRow+2, 3, "20");
btnPlaceBid.setSize("66px", "26px");
ToggleButton tglbtnAutomate = new ToggleButton("Automate");
View.getMainFlex().setWidget(3, 4, tglbtnAutomate);
View.getMainFlex().getCellFormatter().setWidth(3, 4, "20");
tglbtnAutomate.getDownHoveringFace().setText("TurnOFF");
tglbtnAutomate.getUpHoveringFace().setText("TurnON");
tglbtnAutomate.getDownDisabledFace().setText("Enable");
tglbtnAutomate.setHTML("Auto:OFF");
tglbtnAutomate.getUpFace().setHTML("Auto:OFF");
tglbtnAutomate.getDownFace().setHTML("Auto:ON");
tglbtnAutomate.setSize("54px", "18px");
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow+2, 3, HasHorizontalAlignment.ALIGN_RIGHT);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow-1, 4, HasHorizontalAlignment.ALIGN_CENTER);
View.getMainFlex().getCellFormatter().setHorizontalAlignment(CurrentRow, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
FlexTableHelper.fixRowSpan(View.getMainFlex());
当循环只执行一次时,会生成正确的布局,但是当我尝试创建多于一行时,布局会逐渐消失
没有找到相关结果
已邀请:
2 个回复
梦话快家腹
/
方法引起的,这些方法很容易在布局中造成严重破坏。您可以创建复合窗口小部件/ Html并将其放置在单元格中,而不是使用这些方法,因此Flextable将具有较少的行/列。
辩谷变充