本文整理汇总了Java中com.google.gwt.user.client.ui.HTMLTable.CellFormatter类的典型用法代码示例。如果您正苦于以下问题:Java CellFormatter类的具体用法?Java CellFormatter怎么用?Java CellFormatter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CellFormatter类属于com.google.gwt.user.client.ui.HTMLTable包,在下文中一共展示了CellFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: columns
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private void columns() {
CellFormatter cellFormatter = datatable.getCellFormatter();
// The first thing is not a header, so you have to go one more.
for (int i = 0; i < headers.length + 1; i++) {
int hwidth = headertable.getWidget(0, i).getOffsetWidth();
int dwidth = datatable.getWidget(0, i).getOffsetWidth();
int fwidth = Math.max(hwidth, dwidth);
headertable.getWidget(0, i).setWidth(fwidth+"px");
for (int j = 0; j < datatable.getRowCount(); j++) {
cellFormatter.setWidth(j, i, fwidth+"px");
//datatable.getWidget(j, i).setWidth(fwidth+"px");
}
}
resize();
}
示例2: turnOffRow
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private void turnOffRow(int row) {
CellFormatter formatter = datatable.getCellFormatter();
int dataRow = row - headerRows;
String[] oldnew = dirtyrows.get(row);
HTML html = new HTML(oldnew[0]);
html.setTitle(oldnew[0]);
int width = headertable.getWidget(0, 1).getOffsetWidth();
html.setWidth(width+"px");
// Put the old value back in the data structure used to make the JSON payload.
List<String[]> affectedrow = allrows.get(ids.getValue());
String[] parts = affectedrow.get(dataRow);
for (int i = 0; i < parts.length; i++) {
if ( headers[i].contains("WOCE") ) {
parts[i] = oldnew[0];
}
}
formatter.removeStyleName(row, 1, "dirty");
datatable.setWidget(row, 1, html);
}
示例3: onResponseReceived
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
@Override
public void onResponseReceived(Request request, Response response) {
String text = response.getText();
PopupPanel popup = new PopupPanel(true);
popup.add(new HTML("<strong>Saved edits for:<p></p></strong>"+text+"<p></p>Click outside box to dismiss."));
popup.setPopupPosition(200, Window.getClientHeight()/3);
popup.show();
CellFormatter formatter = datatable.getCellFormatter();
for (Iterator dirtyIt = dirtyrows.keySet().iterator(); dirtyIt.hasNext();) {
Integer widgetrow = (Integer) dirtyIt.next();
for (int i = 0; i < headers.length; i++) {
formatter.removeStyleName(widgetrow, i, "dirty");
}
CheckBox box = (CheckBox) datatable.getWidget(widgetrow, 0);
box.setValue(false);
}
dirtyrows.clear();
}
示例4: setHeaders
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
/**
* Set the column headers.
*
*/
private void setHeaders() {
CellFormatter cellFormatter = headertable.getCellFormatter();
headertable.setWidget(0, 0, new HTML(""));
int column = 0;
for (int p = 0; p < headers.length; p++) {
if ( headers[p].startsWith("\"")) headers[p] = headers[p].substring(1, headers[p].length());
if ( headers[p].endsWith("\"")) headers[p] = headers[p].substring(0,headers[p].length()-1);
if ( headers[p].endsWith("_")) headers[p] = headers[p].substring(0, headers[p].length()-1);
if ( headers[p].toLowerCase().equals(wocevar.toLowerCase()) ) {
headertable.setWidget(0, 1, new HTML(headers[p]));
cellFormatter.addStyleName(0, 1, "nowrap");
} else if (headers[p].toLowerCase().equals(datavar.toLowerCase()) ) {
headertable.setWidget(0, 2, new HTML(headers[p]));
cellFormatter.addStyleName(0, 2, "nowrap");
} else {
headertable.setWidget(0, column + columnOffset, new HTML(headers[p]));
cellFormatter.addStyleName(0, column + columnOffset, "nowrap");
column++;
}
}
headertable.setWidget(0, 0, allNone);
RowFormatter formatter = headertable.getRowFormatter();
formatter.addStyleName(0, "nowrap");
}
示例5: CancelButton
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
public CancelButton(String panel_id) {
final String id = panel_id;
cancel.setWidth("75px");
cancel.addStyleDependentName("SMALLER");
cancel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent click) {
eventBus.fireEvent(new CancelEvent(id));
}
});
CellFormatter f = interior.getCellFormatter();
f.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
f.setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
f.setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
interior.setWidget(0, 0, batch);
interior.setWidget(1, 0, message);
interior.setWidget(2, 0, cancel);
sizePanel.add(interior);
initWidget(sizePanel);
}
示例6: TermDetailsView
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
public TermDetailsView(EventBus eventBus, OntoBrowserServiceAsync service) {
super(eventBus, service);
for(int i = 0; i < LABELS.length; i++) {
grid.setText(i, 0, LABELS[i] + ":");
}
CellFormatter cellFormatter = grid.getCellFormatter();
for(int row = 0; row < grid.getRowCount(); row++) {
cellFormatter.addStyleName(row, 0, "label");
}
panel.add(grid);
initWidget(panel);
addStyleName("padded-border vert-scroll fixed-height");
eventBus.addHandler(ViewTermEvent.TYPE, this);
eventBus.addHandler(TermUpdatedEvent.TYPE, this);
eventBus.addHandler(TermDeletedEvent.TYPE, this);
}
示例7: createPanel
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private Panel createPanel() {
Label label = new Label("Search Options");
label.addStyleName("search-header");
label.getElement().getStyle().setDisplay(Display.BLOCK);
Grid grid = new Grid(2,2);
grid.setText(0, 0, "Ontology/Codelist:");
grid.setWidget(0, 1, ontologiesDropBox);
grid.setText(1, 0, "Include Synonyms:");
grid.setWidget(1, 1, includeSynonyms);
grid.addStyleName("search-options");
CellFormatter cellFormatter = grid.getCellFormatter();
for(int i = 0; i < grid.getRowCount(); i++) {
cellFormatter.addStyleName(i, 0, "search-option");
}
Panel panel = new FlowPanel();
panel.add(label);
panel.add(grid);
return panel;
}
示例8: setHue
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
public void setHue(float hue)
{
this.hue = hue;
float [] hsv = new float[]{hue, 0.0f, 0.0f};
int [] irgb = new int[3];
float [] rgb = new float[3];
CellFormatter formatter = grid.getCellFormatter();
for (int row=0; row<16; row++)
{
hsv[2] = 1.0f - (float)row / 15.0f;
for (int col=0; col<16; col++)
{
hsv[1] = (float)col / 15.0f;
Color.HSVToRGB(hsv, rgb);
Color.toInt(rgb, irgb);
// formatter.setWidth(row, col, "6.25%");
// formatter.setHeight(row, col, "6.25%");
formatter.setWidth(row, col, "10px");
formatter.setHeight(row, col, "10px");
formatter.getElement(row, col).setAttribute("bgcolor", "#"+Color.toHex(irgb));
grid.setText(row, col, "");
}
}
}
示例9: setSaturationAndValue
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
public void setSaturationAndValue(float saturation, float value)
{
// deselect old selected cell
int col = Math.round(this.saturation * 15.0f);
int row = Math.round((1.0f - this.value) * 15.0f);
CellFormatter formatter = grid.getCellFormatter();
formatter.removeStyleName(row, col, "agilar-colorpicker-popup-palette-selected");
this.saturation = saturation;
this.value = value;
col = Math.round(this.saturation * 15.0f);
row = Math.round((1.0f - this.value) * 15.0f);
formatter.addStyleName(row, col, "agilar-colorpicker-popup-palette-selected");
// select new cell
}
示例10: buildUI
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private void buildUI()
{
float [] hsv = new float[]{0.0f, 1.0f, 1.0f};
float [] rgb = new float[3];
int [] irgb = new int[3];
CellFormatter formatter = grid.getCellFormatter();
formatter.setHeight(0, 0, "0px");
formatter.setWidth(0, 0, "100%");
for (int row=1; row<18; row++)
{
Color.HSVToRGB(hsv, rgb);
Color.toInt(rgb, irgb);
formatter.getElement(row, 0).setAttribute("bgcolor", "#"+Color.toHex(irgb));
formatter.setHeight(row, 0, "8px");
formatter.setWidth(row, 0, "100%");
grid.setText(row, 0, "");
hsv[0] = (float)row / 18.0f * 360.0f;
}
}
示例11: renderCheckBox
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private void renderCheckBox(int row, LabelAndValues lv) {
ApprovalInfo self =
Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount().getId().get()) : null;
final String id = lv.info.name();
final CheckBox b = new CheckBox();
b.setText(id);
b.setEnabled(lv.permitted.contains((short) 1));
if (self != null && self.value() == 1) {
b.setValue(true);
}
b.addValueChangeHandler(
new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
in.label(id, event.getValue() ? (short) 1 : (short) 0);
}
});
b.setStyleName(style.label_name());
labelsTable.setWidget(row, 0, b);
CellFormatter fmt = labelsTable.getCellFormatter();
fmt.setStyleName(row, labelHelpColumn, style.label_help());
labelsTable.setText(row, labelHelpColumn, lv.info.valueText("+1"));
}
示例12: mouseOut
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
/**
* Handles a mouse out event by removing the formatting on cells that were once highlighted due
* to a mouse over event.
*
* @param row the row that lost mouse over.
* @param column the column that lost mouse over.
*/
private void mouseOut(int row, int column) {
CellFormatter formatter = grid.getCellFormatter();
// Remove highlighting from cell.
formatter.removeStyleName(row, column, "tty-GridCellHighlighted");
// Remove column highlighting.
for (int i = 1; i < grid.getRowCount(); i++) {
formatter.removeStyleName(i, column, "tty-GridColumnHighlighted");
}
// Remove row highlighting.
for (int j = 1; j < grid.getColumnCount(); j++) {
formatter.removeStyleName(row, j, "tty-GridRowHighlighted");
}
}
示例13: mouseOver
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
/**
* Handles a mouse over event by highlighting the moused over cell and adding style to the
* row and column that is also to be highlighted.
*
* @param row the row that gained mouse over.
* @param column the column that gained mouse over.
*/
private void mouseOver(int row, int column) {
CellFormatter formatter = grid.getCellFormatter();
// Add highlighting to cell.
formatter.addStyleName(row, column, "tty-GridCellHighlighted");
// Add column highlighting.
for (int i = 1; i < grid.getRowCount(); i++) {
if (i != row) {
formatter.addStyleName(i, column, "tty-GridColumnHighlighted");
}
}
// Add row highlighting.
for (int j = 1; j < grid.getColumnCount(); j++) {
if (j != column) {
formatter.addStyleName(row, j, "tty-GridRowHighlighted");
}
}
}
示例14: createStatTable
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private Grid createStatTable(DBStatistics result)
{
Grid table = new Grid(3, 2);
table.addStyleName("stat");
table.setHTML(0, 0, "the number of clouds <b>in total</b>");
table.setHTML(1, 0, "the number of clouds constructed <b>last month</b>");
table.setHTML(2, 0, "the number of clouds constructed <b>last week</b>");
table.setHTML(0, 1, "" + result.getTotal());
table.setHTML(1, 1, "" + result.getLastMonth());
table.setHTML(2, 1, "" + result.getLastWeek());
CellFormatter cf = table.getCellFormatter();
cf.setWidth(0, 0, "65%");
cf.setWidth(0, 1, "35%");
return table;
}
示例15: addParseOptions
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; //导入依赖的package包/类
private void addParseOptions(FlexTable layout, CellFormatter cf)
{
cf.setStyleName(0, 4, "adv-cell-label");
layout.setWidget(0, 4, createLabel("Remove Stop Words:"));
layout.setWidget(0, 5, createCheckboxStopwords());
cf.setStyleName(1, 4, "adv-cell-label");
layout.setWidget(1, 4, createLabel("Remove Numbers:"));
layout.setWidget(1, 5, createCheckboxRemoveNumbers());
cf.setStyleName(2, 4, "adv-cell-label");
layout.setWidget(2, 4, createLabel("Group Similar Words:"));
layout.setWidget(2, 5, createCheckboxStem());
cf.setStyleName(3, 4, "adv-cell-label");
layout.setWidget(3, 4, createLabel("Shortest Word:"));
layout.setWidget(3, 5, createMinLengthField());
}