本文整理汇总了Java中com.google.gwt.user.client.ui.FlexTable.setHTML方法的典型用法代码示例。如果您正苦于以下问题:Java FlexTable.setHTML方法的具体用法?Java FlexTable.setHTML怎么用?Java FlexTable.setHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.FlexTable
的用法示例。
在下文中一共展示了FlexTable.setHTML方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCell
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
public void setCell(int col, Cell cell) {
iCells[col] = cell;
if (iTable != null) {
FlexTable t = iTable.iTable;
cell.setColIdx(col);
cell.setRow(this);
if (cell.getWidget() == null)
t.setHTML(getRowIdx() + iTable.getHeaderRowsCount(), col, (cell.getValue() == null || cell.getValue().isEmpty() ? " " : cell.getValue()));
else
t.setWidget(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getWidget());
t.getFlexCellFormatter().setWordWrap(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getWordWrap());
t.getFlexCellFormatter().setColSpan(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getColSpan());
t.getFlexCellFormatter().setStyleName(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getStyleName());
t.getFlexCellFormatter().setWidth(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getWidth());
t.getFlexCellFormatter().setVerticalAlignment(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getVerticalAlignment());
t.getFlexCellFormatter().setHorizontalAlignment(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getHorizontalAlignment());
t.getFlexCellFormatter().getElement(getRowIdx() + iTable.getHeaderRowsCount(), col).setTitle(cell.getTitle());
}
}
示例2: OdkTablesManageAppLevelFilesSubTab
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
/**
* Sets up the View Table subtab.
*/
public OdkTablesManageAppLevelFilesSubTab(OdkTablesTabUI parent) {
this.parent = parent;
addFileButton = new ServletPopupButton(ADD_FILE_BUTTON_TXT, ADD_FILE_TXT,
UIConsts.APP_LEVEL_FILE_UPLOAD_SERVLET_ADDR, this, ADD_FILE_TOOLTIP_TXT, ADD_FILE_BALLOON_TXT);
setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
tableFileData = new OdkTablesViewAppLevelFileInfo(this);
selectTablePanel = new FlexTable();
selectTablePanel.getElement().setId("app_level_panel");
selectTablePanel.setHTML(0, 0, "<h2> Application Level Files </h2>");
if ( AggregateUI.getUI().getUserInfo().getGrantedAuthorities().contains(GrantedAuthorityName.ROLE_ADMINISTER_TABLES)) {
selectTablePanel.setWidget(1, 0, addFileButton);
}
topPanel = new HorizontalPanel();
topPanel.add(selectTablePanel);
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
add(topPanel);
add(tableFileData);
}
示例3: FilterNavigationTable
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
public FilterNavigationTable(FilterSubTab filterSubTab) {
this.filterSubTab = filterSubTab;
// invert this because we have not yet initialized the actionTable...
showEnketoIntegration = !Preferences.showEnketoIntegration();
formsBox = new FormListBox(new FormChangeDropDownHandler());
filtersBox = new FilterListBox(new FilterChangeDropDownHandler());
FlexTable formNFilterTable = new FlexTable();
formNFilterTable.getElement().setId("form_and_goal_selection");
formNFilterTable.setHTML(0, 0, "<h2 id=\"form_name\"> Form </h2>");
formNFilterTable.setWidget(0, 1, formsBox);
formNFilterTable.setHTML(0, 2, "<h2 id=\"filter_name\"> Filter </h2>");
formNFilterTable.setWidget(0, 3, filtersBox);
setWidget(0, 0, formNFilterTable);
}
示例4: FiltersDataPanel
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
public FiltersDataPanel(FilterSubTab parentPanel) {
this.parentSubTab = parentPanel;
getElement().setId("filters_container");
FlowPanel panel = new FlowPanel();
// panel.add( new HTML("<h2 id=\"filter_header\">" + HtmlConsts.SPACE + "Filters</h2>"));
FlexTable filterGroupButtons = new FlexTable();
filterGroupButtons.setWidget(0, 0, new SaveFilterGroupButton(parentSubTab));
copyButton = new SaveAsFilterGroupButton(parentSubTab);
filterGroupButtons.setWidget(0, 1, copyButton);
removeButton = new RemoveFilterGroupButton(parentSubTab);
filterGroupButtons.setWidget(0, 2, removeButton);
panel.add(filterGroupButtons);
HTML filterText = new HTML("<h2 id=\"filter_header\">Filters Applied</h2>");
filterText.getElement().setId("filter_desc_title");
VerticalPanel filterGlobal = new VerticalPanel();
FlexTable paginationTable = new FlexTable();
paginationTable.setHTML(0, 0, "<p id=\"filter_header\">Submissions per page</p>");
paginationTable.setWidget(0, 1, new PaginationNumTextBox(parentSubTab));
filterGlobal.add(paginationTable);
filterGlobal.add(filterText);
panel.add(filterGlobal);
// Filters applied header
filterHeader = new FlowPanel();
panel.add(filterHeader);
// create tree
filtersTree = new Tree();
panel.add(filtersTree);
// create the root as the new filter button
addFilter = new AddFilterButton(parentPanel);
add(panel);
}
示例5: addDocument
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
/**
* addDocument
*/
public static void addDocument(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
int row = table.getRowCount();
final GWTDocument doc = staple.getDoc();
if (doc.isCheckedOut()) {
table.setHTML(row, 0, Util.imageItemHTML("img/icon/edit.png"));
} else if (doc.isLocked()) {
table.setHTML(row, 0, Util.imageItemHTML("img/icon/lock.gif"));
} else {
table.setHTML(row, 0, " ");
}
// Subscribed is a special case, must add icon with others
if (doc.isSubscribed()) {
table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/subscribed.gif"));
}
if (doc.isHasNotes()) {
table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/note.gif"));
}
table.setHTML(row, 1, Util.mimeImageHTML(doc.getMimeType()));
Anchor anchor = new Anchor();
anchor.setHTML(doc.getName());
anchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
String docPath = doc.getPath();
String path = docPath.substring(0, docPath.lastIndexOf("/"));
GeneralComunicator.openPath(path, doc.getPath());
}
});
anchor.setStyleName("okm-KeyMap-ImageHover");
table.setWidget(row, 2, anchor);
table.setHTML(row, 3, Util.formatSize(doc.getActualVersion().getSize()));
if (enableDelete) {
Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
delete.setStyleName("okm-KeyMap-ImageHover");
delete.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
@Override
public void onSuccess(Object result) {
if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
Stapling.get().refreshFolder(uuid);
} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
Stapling.get().refreshDocument(uuid);
} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
Stapling.get().refreshMail(uuid);
}
}
@Override
public void onFailure(Throwable caught) {
GeneralComunicator.showError("remove", caught);
}
});
}
});
table.setWidget(row, 4, delete);
} else {
table.setHTML(row, 4, "");
}
table.getCellFormatter().setWidth(row, 0, "60px");
table.getCellFormatter().setWidth(row, 1, "25px");
table.getCellFormatter().setWidth(row, 4, "25px");
table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
示例6: addMail
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
/**
* addMail
*/
public static void addMail(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
int row = table.getRowCount();
final GWTMail mail = staple.getMail();
// Mail is never checkout or subscribed ( because can not be changed )
table.setHTML(row, 0, " ");
if (mail.getAttachments().size() > 0) {
table.setHTML(row, 1, Util.imageItemHTML("img/email_attach.gif"));
} else {
table.setHTML(row, 1, Util.imageItemHTML("img/email.gif"));
}
Anchor anchor = new Anchor();
anchor.setHTML(mail.getSubject());
anchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
String docPath = mail.getPath();
String path = docPath.substring(0, docPath.lastIndexOf("/"));
GeneralComunicator.openPath(path, docPath);
}
});
anchor.setStyleName("okm-KeyMap-ImageHover");
table.setWidget(row, 2, anchor);
table.setHTML(row, 3, Util.formatSize(mail.getSize()));
if (enableDelete) {
Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
delete.setStyleName("okm-KeyMap-ImageHover");
delete.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
@Override
public void onSuccess(Object result) {
if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
Stapling.get().refreshFolder(uuid);
} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
Stapling.get().refreshDocument(uuid);
} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
Stapling.get().refreshMail(uuid);
}
}
@Override
public void onFailure(Throwable caught) {
GeneralComunicator.showError("remove", caught);
}
});
}
});
table.setWidget(row, 4, delete);
} else {
table.setHTML(row, 4, "");
}
table.getCellFormatter().setWidth(row, 0, "60px");
table.getCellFormatter().setWidth(row, 1, "25px");
table.getCellFormatter().setWidth(row, 4, "25px");
table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
示例7: buildPanel
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
createPrimitives(csVPanel.getViewer().scene());
applyColorMaterial(rectangle);
commonMaterialLBox = new ListBox();
commonMaterialLBox.addChangeHandler(new MChangeHandler());
commonMaterialLBox.addItem("Select", "0");
commonMaterialLBox.addItem("Color", "1");
commonMaterialLBox.addItem("Image", "2");
proceduralTexturesLBox = new ListBox();
proceduralTexturesLBox.addChangeHandler(new MChangeHandler());
proceduralTexturesLBox.addItem("Select", "0");
proceduralTexturesLBox.addItem("Checkerboard", "1");
proceduralTexturesLBox.addItem("Dot", "2");
proceduralTexturesLBox.addItem("Grid", "3");
proceduralTexturesLBox.addItem("Stripe", "4");
baseMaterialsLBox = new ListBox();
baseMaterialsLBox.addChangeHandler(new MChangeHandler());
baseMaterialsLBox.addItem("Select", "0");
baseMaterialsLBox.addItem("Alpha Map", "1");
baseMaterialsLBox.addItem("Bump Map", "2");
baseMaterialsLBox.addItem("Diffuse", "3");
baseMaterialsLBox.addItem("Emission Map", "4");
baseMaterialsLBox.addItem("Normal Map", "5");
baseMaterialsLBox.addItem("Specular Map", "6");
miscMaterialsLBox = new ListBox();
miscMaterialsLBox.addChangeHandler(new MChangeHandler());
miscMaterialsLBox.addItem("Select", "0");
miscMaterialsLBox.addItem("Rim Lighting", "1");
miscMaterialsLBox.addItem("Water", "2");
exampleCompositeMaterialsLBox = new ListBox();
exampleCompositeMaterialsLBox.addChangeHandler(new MChangeHandler());
exampleCompositeMaterialsLBox.addItem("Select", "0");
exampleCompositeMaterialsLBox.addItem("Composite Example", "1");
polylineMaterialsLBox = new ListBox();
polylineMaterialsLBox.addChangeHandler(new MChangeHandler());
polylineMaterialsLBox.addItem("Select", "0");
polylineMaterialsLBox.addItem("Polyline Arrow", "1");
polylineMaterialsLBox.addItem("Polyline Glow", "2");
polylineMaterialsLBox.addItem("Polyline Outline", "3");
FlexTable flexTable = new FlexTable();
flexTable.setCellSpacing(1);
flexTable.setCellPadding(1);
flexTable.setHTML(1, 0, "<font color=\"white\">Common materials</font>");
flexTable.setWidget(1, 1, commonMaterialLBox);
flexTable.setHTML(2, 0, "<font color=\"white\">Procedural textures</font>");
flexTable.setWidget(2, 1, proceduralTexturesLBox);
flexTable.setHTML(3, 0, "<font color=\"white\">Base materials</font>");
flexTable.setWidget(3, 1, baseMaterialsLBox);
flexTable.setHTML(4, 0, "<font color=\"white\">Misc materials</font>");
flexTable.setWidget(4, 1, miscMaterialsLBox);
flexTable.setHTML(5, 0, "<font color=\"white\">Example composite materials</font>");
flexTable.setWidget(5, 1, exampleCompositeMaterialsLBox);
flexTable.setHTML(6, 0, "<font color=\"white\">Polyline materials</font>");
flexTable.setWidget(6, 1, polylineMaterialsLBox);
//
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(flexTable, 20, 20);
contentPanel.add(new HTML("<p>Browse Cesium's built in materials and define new ones using the Fabric schema.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例8: OdkTablesManageInstanceFilesSubTab
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
/**
* Sets up the View Table subtab.
*/
public OdkTablesManageInstanceFilesSubTab(OdkTablesTabUI parent) {
this.parent = parent;
setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
// displayDeleted = false;
currentTable = null;
// first construct a copy so you can build the list box before you
// update it. This seems like bad style.
currentTables = new ArrayList<TableEntryClient>();
// set up the box so you can only select one and you provide both the
// table name and ID.
tableBox = new ListBox();
// new TableEntryClientListBox(currentTables, false, false,
// "Select a table to view.");
tableBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int selectedIndex = tableBox.getSelectedIndex();
// Call this to clear the contents while you are waiting on
// the response from the server.
tableFileData.updateDisplay(null);
currentTable = null;
selectedValue = selectedIndex;
updateContentsForSelectedTable();
}
});
tableFileData = new OdkTablesViewInstanceFileInfo(this);
selectTablePanel = new FlexTable();
selectTablePanel.getElement().setId("select_table_panel");
selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
selectTablePanel.setWidget(0, 1, tableBox);
topPanel = new HorizontalPanel();
topPanel.add(selectTablePanel);
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
add(topPanel);
add(tableFileData);
}
示例9: OdkTablesManageTableFilesSubTab
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
/**
* Sets up the View Table subtab.
*/
public OdkTablesManageTableFilesSubTab(OdkTablesTabUI parent) {
this.parent = parent;
addFileButton = new OdkTablesTableIdServletPopupButton(ADD_FILE_BUTTON_TXT, ADD_FILE_TXT,
UIConsts.TABLE_FILE_UPLOAD_SERVLET_ADDR, ADD_FILE_TOOLTIP_TXT, ADD_FILE_BALLOON_TXT, this,
this);
setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
// displayDeleted = false;
currentTable = null;
// first construct a copy so you can build the list box before you
// update it. This seems like bad style.
currentTables = new ArrayList<TableEntryClient>();
// set up the box so you can only select one and you provide both the
// table name and ID.
tableBox = new ListBox();
// new TableEntryClientListBox(currentTables, false, false,
// "Select a table to view.");
tableBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int selectedIndex = tableBox.getSelectedIndex();
// Call this to clear the contents while you are waiting on
// the response from the server.
tableFileData.updateDisplay(null);
currentTable = null;
selectedValue = selectedIndex;
updateContentsForSelectedTable();
}
});
tableFileData = new OdkTablesViewTableFileInfo(this);
selectTablePanel = new FlexTable();
selectTablePanel.getElement().setId("select_table_panel");
selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
selectTablePanel.setWidget(0, 1, tableBox);
if (AggregateUI.getUI().getUserInfo().getGrantedAuthorities()
.contains(GrantedAuthorityName.ROLE_ADMINISTER_TABLES)) {
selectTablePanel.setWidget(1, 0, addFileButton);
}
// deletedRowsCheckBox = new OdkTablesDisplayDeletedRowsCheckBox(this,
// displayDeleted);
// selectTablePanel.setWidget(0, 2, deletedRowsCheckBox);
topPanel = new HorizontalPanel();
topPanel.add(selectTablePanel);
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
add(topPanel);
add(tableFileData);
}
示例10: OdkTablesViewTableSubTab
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
/**
* Sets up the View Table subtab.
*/
public OdkTablesViewTableSubTab(OdkTablesTabUI parent) {
this.parent = parent;
setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
// displayDeleted = false;
currentTable = null;
// first construct a copy so you can build the list box before you
// update it. This seems like bad style.
currentTables = new ArrayList<TableEntryClient>();
// set up the box so you can only select one and you provide both the
// table name and ID.
tableBox = new ListBox();
// new TableEntryClientListBox(currentTables, false, false,
// "Select a table to view.");
tableBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int selectedIndex = tableBox.getSelectedIndex();
// Call this to clear contents while you are waiting on the
// response from the server.
tableData.updateDisplay(null);
currentTable = null;
selectedValue = selectedIndex;
updateContentsForSelectedTable();
}
});
tableData = new OdkTablesViewTable(this);
tableAdvanceButton = new OdkTablesAdvanceRowsButton(tableData);
tableData.setAdvanceButton(tableAdvanceButton);
selectTablePanel = new FlexTable();
selectTablePanel.getElement().setId("select_table_panel");
selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
selectTablePanel.setWidget(0, 1, tableBox);
// deletedRowsCheckBox = new OdkTablesDisplayDeletedRowsCheckBox(this,
// displayDeleted);
// selectTablePanel.setWidget(0, 2, deletedRowsCheckBox);
topPanel = new HorizontalPanel();
topPanel.add(selectTablePanel);
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
add(topPanel);
add(tableData);
}
示例11: asWidget
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
@Override
public Widget asWidget() {
VerticalPanel layout = new VerticalPanel();
layout.setStyleName("fill-layout-width"); //$NON-NLS-1$
layout.add(new HTML("<div class='metric-table-title'>" + _title + "</div>")); //$NON-NLS-1$ //$NON-NLS-2$
_grid = new FlexTable();
_grid.getElement().setAttribute("width", _width + _unit.getType() + ""); //$NON-NLS-1$ //$NON-NLS-2$
// header columns
_grid.setHTML(0, 0, Singleton.MESSAGES.label_metric());
_grid.setHTML(0, 1, Singleton.MESSAGES.label_actual());
_grid.setHTML(0, 2, " "); //$NON-NLS-1$
_grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
// actual values
int row = _rowOffset;
for (Column c : _columns) {
_grid.setHTML(row, 0, "<div class='metric-table-label'>" + c.getLabel() + ":</div>"); //$NON-NLS-1$ //$NON-NLS-2$
_grid.setHTML(row, 1, ""); //$NON-NLS-1$
_stacks.add(new StackedBar());
if (c.getComparisonColumn() != null) {
StackedBar stack = _stacks.get(row - _rowOffset);
_grid.setWidget(row, 2, stack.asWidget());
stack.setRatio(0, 0);
} else {
_grid.setText(row, 2, ""); //$NON-NLS-1$
}
_grid.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_RIGHT);
if (!c.isVisible()) {
_grid.getRowFormatter().setVisible(row, false);
}
if (c.isBaseline()) {
_grid.getRowFormatter().addStyleName(row, "metric-table-baseline"); //$NON-NLS-1$
}
_columnIndexes.put(c, row - _rowOffset);
row++;
}
_grid.getCellFormatter().setStyleName(0, 0, "metric-table-header"); //$NON-NLS-1$
_grid.getCellFormatter().setStyleName(0, 1, "metric-table-header"); //$NON-NLS-1$
_grid.getCellFormatter().setStyleName(0, 2, "metric-table-header"); //$NON-NLS-1$
_grid.getCellFormatter().setWidth(0, 2, "50%"); //$NON-NLS-1$
if (null == _staticHelp && _address != null) {
MetricHelpPanel helpPanel = new MetricHelpPanel(_address, this._columns);
// helpPanel.setAligned(true);
layout.add(helpPanel.asWidget());
} else if (_staticHelp != null) {
layout.add(_staticHelp.asWidget());
}
layout.add(_grid);
return layout;
}
示例12: asWidget
import com.google.gwt.user.client.ui.FlexTable; //导入方法依赖的package包/类
@Override
public Widget asWidget() {
VerticalPanel layout = new VerticalPanel();
layout.setStyleName("fill-layout-width");
layout.add(new HTML("<div class='metric-table-title'>"+title+"</div>"));
grid = new FlexTable();
grid.getElement().setAttribute("width", width+unit.getType()+"");
// header columns
grid.setHTML(0, 0, "Metric");
grid.setHTML(0, 1, "Actual");
grid.setHTML(0, 2, " ");
grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
// actual values
int row = ROW_OFFSET;
for(Column c : columns)
{
grid.setHTML(row, 0, "<div class='metric-table-label'>"+c.getLabel() + ":</div>");
grid.setHTML(row, 1, "");
stacks.add(new StackedBar());
if(c.getComparisonColumn()!=null)
{
StackedBar stack = stacks.get(row - ROW_OFFSET);
grid.setWidget(row, 2, stack.asWidget());
stack.setRatio(0,0);
}
else
grid.setText(row, 2, "");
grid.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_RIGHT);
if(!c.isVisible())
grid.getRowFormatter().setVisible(row, false);
if(c.isBaseline())
grid.getRowFormatter().addStyleName(row, "metric-table-baseline");
columnIndexes.put(c, row - ROW_OFFSET);
row++;
}
grid.getCellFormatter().setStyleName(0,0,"metric-table-header");
grid.getCellFormatter().setStyleName(0,1,"metric-table-header");
grid.getCellFormatter().setStyleName(0,2,"metric-table-header");
grid.getCellFormatter().setWidth(0, 2, "50%");
if(null==staticHelp && address!=null)
{
MetricHelpPanel helpPanel = new MetricHelpPanel(address, this.columns);
//helpPanel.setAligned(true);
layout.add(helpPanel.asWidget());
}
else if(staticHelp!=null)
{
layout.add(staticHelp.asWidget());
}
layout.add(grid);
return layout;
}