Java 类com.google.gwt.user.client.ui.HTMLTable.CellFormatter 实例源码

项目:LAS    文件:ColumnEditorWidget.java   
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();
}
项目:LAS    文件:ColumnEditorWidget.java   
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);



}
项目:LAS    文件:ColumnEditorWidget.java   
@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();
}
项目:LAS    文件:ColumnEditorWidget.java   
/**
 * 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");
}
项目:LAS    文件:CancelButton.java   
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);
}
项目:ontobrowser    文件:TermDetailsView.java   
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);
}
项目:ontobrowser    文件:SearchOptionsView.java   
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;
}
项目:firefly    文件:ColorPalette.java   
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, "");
            }
        }
    }
项目:firefly    文件:ColorPalette.java   
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
}
项目:firefly    文件:HueSelector.java   
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;
    }
}
项目:gerrit    文件:ReplyBox.java   
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"));
}
项目:test-analytics-ng    文件:CapabilitiesGridWidget.java   
/**
 * 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");
  }
}
项目:test-analytics-ng    文件:CapabilitiesGridWidget.java   
/**
 * 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");
    }
  }
}
项目:swcv    文件:WordCloudLatestApp.java   
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;
}
项目:swcv    文件:SettingsPanel.java   
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());

}
项目:rva    文件:SimpleGridWidget.java   
private void setHeader() {
    int i = 0;
    for (String[] def : header) {

        if (def[0] == null || def[0].isEmpty())
            headerTable.setHTML(0, i, "&nbsp;");
        else
            headerTable.setText(0, i, def[0]);

        CellFormatter cellFormatter = headerTable.getCellFormatter();
        cellFormatter.setStyleName(0, i, "rdn-GridHeader");

        if (def.length > 1){
            ColumnFormatter colFormatter = headerTable.getColumnFormatter();
            colFormatter.setWidth(i, def[1]);
            // for firefox
            cellFormatter.setWidth(0, i, def[1]);
        }

        i++;
    }
}
项目:rva    文件:GridWidget.java   
private void formatCell(int row, int column){
    CellFormatter cellFormatter = usersFlexTable.getCellFormatter();
    RowFormatter rowFormatter = usersFlexTable.getRowFormatter();
    cellFormatter.setStyleName(row, column, "rdn-GridItem");

    for (int i = 0; i < usersFlexTable.getCellCount(0); i++){           
        cellFormatter.addStyleName(row, i, "rdn-GridItemFooterBottom");

        if (row > 0) {
            cellFormatter.removeStyleName(row - 1, i, "rdn-GridItemFooterBottom");
        }
    }

    if (row%2 == 0){
        rowFormatter.addStyleName(row, "rdn-GridAlternateRow");
    }
}
项目:document-management-system    文件:SearchNormal.java   
/**
 * Set the WordWarp for all the row cells
 *
 * @param row The row cell
 * @param columns Number of row columns
 * @param warp
 */
private void setRowWordWarp(FlexTable table, int row, int columns, boolean wrap) {
    CellFormatter cellFormatter = table.getCellFormatter();

    for (int i = 0; i < columns; i++) {
        cellFormatter.setWordWrap(row, i, wrap);
    }
}
项目:document-management-system    文件:SearchAdvanced.java   
/**
 * Set the WordWarp for all the row cells
 *
 * @param row The row cell
 * @param columns Number of row columns
 * @param warp
 */
private void setRowWordWarp(FlexTable table, int row, int columns, boolean wrap) {
    CellFormatter cellFormatter = table.getCellFormatter();

    for (int i = 0; i < columns; i++) {
        cellFormatter.setWordWrap(row, i, wrap);
    }
}
项目:document-management-system    文件:UserNews.java   
/**
 * Adds a new row
 *
 * @param search The search value
 */
public void addRow(GWTQueryParams search) {
    int rows = table.getRowCount();

    data.put(dataIndexValue, search);

    if (!search.isShared()) {
        table.setHTML(rows, 0, "&nbsp;");
    } else {
        table.setWidget(rows, 0, new Image(OKMBundleResources.INSTANCE.sharedQuery()));
    }

    table.setHTML(rows, 1, search.getQueryName());
    table.setHTML(rows, 2, "" + dataIndexValue++);
    table.setHTML(rows, 3, "");
    table.getFlexCellFormatter().setVisible(rows, 2, false);

    // The hidden column extends table to 100% width
    CellFormatter cellFormatter = table.getCellFormatter();
    cellFormatter.setWidth(rows, 0, "30px");
    cellFormatter.setHeight(rows, 0, "20px");
    cellFormatter.setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    cellFormatter.setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    cellFormatter.setWidth(rows, 3, "100%");

    table.getRowFormatter().setStyleName(rows, "okm-userNews");
    setRowWordWarp(rows, 4, false);
}
项目:document-management-system    文件:SearchSaved.java   
/**
 * Adds a new row
 *
 * @param search Search parameters to be added.
 */
private void addRow(GWTQueryParams search) {
    int rows = table.getRowCount();

    data.put(new Long(dataIndexValue), search);

    if (!search.isShared()) {
        table.setHTML(rows, 0, "&nbsp;");
    } else {
        table.setWidget(rows, 0, new Image(OKMBundleResources.INSTANCE.sharedQuery()));
    }

    table.setHTML(rows, 1, search.getQueryName());
    table.setHTML(rows, 2, "" + dataIndexValue++);
    table.setHTML(rows, 3, "");
    table.getCellFormatter().setVisible(rows, 2, false);

    // The hidden column extends table to 100% width
    CellFormatter cellFormatter = table.getCellFormatter();
    cellFormatter.setWidth(rows, 0, "30px");
    cellFormatter.setHeight(rows, 0, "20px");
    cellFormatter.setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    cellFormatter.setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    cellFormatter.setWidth(rows, 3, "100%");

    table.getRowFormatter().setStyleName(rows, "okm-SearchSaved");
    setRowWordWarp(rows, 4, false);
}
项目:ontobrowser    文件:EditSynonymPopup.java   
public EditSynonymPopup(OntoBrowserServiceAsync service,
        EventBus eventBus) {
    this.service = service;
    this.eventBus = eventBus;

    for(Synonym.Type type : Synonym.Type.values()) {
        typeDropBox.addItem(type.toString(), type.name());
    }

    dialogBox.setText("Edit Synonym");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    dialogBox.addStyleName("gwt-ModalDialogBox");

    grid.addStyleName("gwt-Grid");
    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, "dialog-label");
    }

    grid.setWidget(grid.getRowCount()-1, 1, typeDropBox);

    typeError.addStyleName("dialog-error");

    addDialogWidgets();

    updateButton.addClickHandler(this);
}
项目:sc2gears    文件:ClientUtils.java   
/**
 * 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 );
}
项目:firefly    文件:HueSelector.java   
public void setHue(float hue)
{
    int row = (int)(this.hue * 18.0f / 360.0f) + 1;
    CellFormatter formatter = grid.getCellFormatter();
    formatter.removeStyleName(row, 0, "agilar-colorpicker-popup-hueselector-selected");
    this.hue = hue;
    row = (int)(this.hue * 18.0f / 360.0f) + 1;
    formatter.addStyleName(row, 0, "agilar-colorpicker-popup-hueselector-selected");
}
项目:gerrit    文件:KeyHelpPopup.java   
public KeyHelpPopup() {
  super(true /* autohide */, true /* modal */);
  setStyleName(KeyResources.I.css().helpPopup());

  final Anchor closer = new Anchor(KeyConstants.I.closeButton());
  closer.addClickHandler(
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          hide();
        }
      });

  final Grid header = new Grid(1, 3);
  header.setStyleName(KeyResources.I.css().helpHeader());
  header.setText(0, 0, KeyConstants.I.keyboardShortcuts());
  header.setWidget(0, 2, closer);

  final CellFormatter fmt = header.getCellFormatter();
  fmt.addStyleName(0, 1, KeyResources.I.css().helpHeaderGlue());
  fmt.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT);

  final Grid lists = new Grid(0, 7);
  lists.setStyleName(KeyResources.I.css().helpTable());
  populate(lists);
  lists.getCellFormatter().addStyleName(0, 3, KeyResources.I.css().helpTableGlue());

  final FlowPanel body = new FlowPanel();
  body.add(header);
  body.getElement().appendChild(DOM.createElement("hr"));
  body.add(lists);

  focus = new FocusPanel(body);
  focus.getElement().getStyle().setProperty("outline", "0px");
  focus.getElement().setAttribute("hideFocus", "true");
  focus.addKeyPressHandler(this);
  focus.addKeyDownHandler(this);
  add(focus);
}
项目:gerrit    文件:DocTable.java   
@Override
protected void applyDataRowStyle(int row) {
  super.applyDataRowStyle(row);
  CellFormatter fmt = table.getCellFormatter();
  fmt.addStyleName(row, C_TITLE, Gerrit.RESOURCES.css().dataCell());
  fmt.addStyleName(row, C_TITLE, Gerrit.RESOURCES.css().cSUBJECT());
}
项目:gerrit    文件:NavigationTable.java   
protected void ensurePointerVisible() {
  final int max = table.getRowCount();
  int row = currentRow;
  final int init = row;
  if (row < 0) {
    row = 0;
  } else if (max <= row) {
    row = max - 1;
  }

  final CellFormatter fmt = table.getCellFormatter();
  final int sTop = Document.get().getScrollTop();
  final int sEnd = sTop + Document.get().getClientHeight();

  while (0 <= row && row < max) {
    final Element cur = fmt.getElement(row, C_ARROW).getParentElement();
    final int cTop = cur.getAbsoluteTop();
    final int cEnd = cTop + cur.getOffsetHeight();

    if (cEnd < sTop) {
      row++;
    } else if (sEnd < cTop) {
      row--;
    } else {
      break;
    }
  }

  if (init != row) {
    movePointerTo(row, false);
  }
}
项目:gerrit    文件:FancyFlexTable.java   
protected void scrollIntoView(int topRow, int endRow) {
  final CellFormatter fmt = table.getCellFormatter();
  final Element top = fmt.getElement(topRow, C_ARROW).getParentElement();
  final Element end = fmt.getElement(endRow, C_ARROW).getParentElement();

  final int rTop = top.getAbsoluteTop();
  final int rEnd = end.getAbsoluteTop() + end.getOffsetHeight();
  final int rHeight = rEnd - rTop;

  final int sTop = Document.get().getScrollTop();
  final int sHeight = Document.get().getClientHeight();
  final int sEnd = sTop + sHeight;

  final int nTop;
  if (sHeight <= rHeight) {
    // The region is larger than the visible area, make the top
    // exactly the top of the region, its the most visible area.
    //
    nTop = rTop;
  } else if (sTop <= rTop && rTop <= sEnd) {
    // At least part of the region is already visible.
    //
    if (rEnd <= sEnd) {
      // ... actually its all visible. Don't scroll.
      //
      return;
    }

    // Move only enough to make the end visible.
    //
    nTop = sTop + (rHeight - (sEnd - rTop));
  } else {
    // None of the region is visible. Make it visible.
    //
    nTop = rTop;
  }
  Document.get().setScrollTop(nTop);
}
项目:gerrit    文件:ReplyBox.java   
private void renderRadio(int row, List<Short> columns, LabelAndValues lv) {
  String id = lv.info.name();
  Short dv = normalizeDefaultValue(lv.info.defaultValue(), lv.permitted);

  labelHelpColumn = 1 + columns.size();
  labelsTable.setText(row, 0, id);

  CellFormatter fmt = labelsTable.getCellFormatter();
  fmt.setStyleName(row, 0, style.label_name());
  fmt.setStyleName(row, labelHelpColumn, style.label_help());

  ApprovalInfo self =
      Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount().getId().get()) : null;

  final LabelRadioGroup group = new LabelRadioGroup(row, id, lv.permitted.size());
  for (int i = 0; i < columns.size(); i++) {
    Short v = columns.get(i);
    if (lv.permitted.contains(v)) {
      String text = lv.info.valueText(LabelValue.formatValue(v));
      LabelRadioButton b = new LabelRadioButton(group, text, v);
      if ((self != null && v == self.value()) || (self == null && v.equals(dv))) {
        b.setValue(true);
        group.select(b);
        in.label(group.label, v);
        labelsTable.setText(row, labelHelpColumn, b.text);
      }
      group.buttons.add(b);
      labelsTable.setWidget(row, 1 + i, b);
    }
  }
}
项目:gerrit    文件:FileTable.java   
private InputElement getReviewed(FileInfo info) {
  CellFormatter fmt = table.getCellFormatter();
  Element e = fmt.getElement(1 + info._row(), 1);
  return InputElement.as(e.getFirstChildElement());
}
项目:gerrit    文件:ChangeTable.java   
@Override
protected void applyDataRowStyle(int row) {
  super.applyDataRowStyle(row);
  final CellFormatter fmt = table.getCellFormatter();
  fmt.addStyleName(row, C_STAR, Gerrit.RESOURCES.css().iconCell());
  for (int i = C_ID; i < columns; i++) {
    fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
  }
  if (!showLegacyId) {
    fmt.addStyleName(row, C_ID, Gerrit.RESOURCES.css().dataCellHidden());
  }
  fmt.addStyleName(row, C_SUBJECT, Gerrit.RESOURCES.css().cSUBJECT());
  fmt.addStyleName(row, C_STATUS, Gerrit.RESOURCES.css().cSTATUS());
  fmt.addStyleName(row, C_OWNER, Gerrit.RESOURCES.css().cOWNER());
  fmt.addStyleName(
      row,
      C_ASSIGNEE,
      showAssignee
          ? Gerrit.RESOURCES.css().cASSIGNEE()
          : Gerrit.RESOURCES.css().dataCellHidden());
  fmt.addStyleName(row, C_LAST_UPDATE, Gerrit.RESOURCES.css().cLastUpdate());
  fmt.addStyleName(row, C_SIZE, Gerrit.RESOURCES.css().cSIZE());

  for (int i = C_SIZE + 1; i < columns; i++) {
    fmt.addStyleName(row, i, Gerrit.RESOURCES.css().cAPPROVAL());
  }
}
项目:rva    文件:PlaceholderItemListWidget.java   
private void formatCell(int row, int column){
    CellFormatter cellFormatter = itemFlexTable.getCellFormatter();

    String def = header[column];
    if (def != null && !def.isEmpty()) {
        cellFormatter.setWidth(row, column, def);
    }
}
项目:rva    文件:SimpleGridWidget.java   
private void formatCell(int row, int column){
    CellFormatter cellFormatter = bodyFlexTable.getCellFormatter();

    String[] def = header[column];
    if (def != null && def.length > 1 && def[1] != null && !def[1].isEmpty()) {
        cellFormatter.setWidth(row, column, def[1]);
    }
}
项目:rva    文件:InstrumentListWidget.java   
private void formatCell(int row, int column){
    CellFormatter cellFormatter = itemFlexTable.getCellFormatter();

    String def = header[column];
    if (def != null && !def.isEmpty()) {
        cellFormatter.setWidth(row, column, def);
    }
}
项目:geomajas-project-client-gwt2    文件:FeatureInfoViewImpl.java   
@Override
public void setFeature(Feature feature) {
    // Clear the current panel:
    contentPanel.clear();

    // Layout the attributes of the feature in a grid:
    Grid grid = new Grid(feature.getLayer().getAttributeDescriptors().size(), 3);
    CellFormatter formatter = grid.getCellFormatter();
    int i = 0;
    for (AttributeDescriptor descriptor : feature.getLayer().getAttributeDescriptors()) {
        // Put the attribute label in the first column:
        grid.setText(i, 0, getAttributeLabel(feature, descriptor));
        formatter.getElement(i, 0).addClassName(resource.css().attributeLabel());

        // Put a delimiter in the second column:
        grid.setText(i, 1, getDelimiter());

        // Create a widget for the attribute value and put it in the last column:
        Widget attributeWidget = ATTRIBUTE_FACTORY.createAttributeWidget(feature, descriptor);
        attributeWidget.getElement().addClassName(resource.css().attributeValue());
        grid.setWidget(i, 2, attributeWidget);

        i++;
    }

    contentPanel.add(grid);
}
项目:LAS    文件:OutputControlPanelImpl.java   
@Override
public CellFormatter getCellFormatter() {
    return flexTable.getCellFormatter();
}
项目:ontobrowser    文件:ChangePasswordPopup.java   
private void addDialogWidgets() {
    VerticalPanel dialogVPanel = new VerticalPanel();
    HorizontalPanel buttonsHPanel = new HorizontalPanel();
    Button cancelButton = new Button("Cancel");

    cancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            newPasswordTextBox1.setText(null);
            newPasswordTextBox2.setText(null);
            passwordError.setText(null);
            dialogBox.hide();
        }
    });

    grid.setWidget(0, 1, oldPasswordTextBox);
    grid.setWidget(1, 1, newPasswordTextBox1);
    grid.setWidget(2, 1, newPasswordTextBox2);
    grid.addStyleName("gwt-Grid");
    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, "dialog-label");
    }

    passwordError.addStyleName("dialog-error");

    buttonsHPanel.add(updateButton);
    buttonsHPanel.add(cancelButton);
    buttonsHPanel.addStyleName("dialog-buttons");   

    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT);
    dialogVPanel.add(grid);     
    dialogVPanel.add(passwordError);
    dialogVPanel.add(buttonsHPanel);
    dialogVPanel.setCellHorizontalAlignment(buttonsHPanel, VerticalPanel.ALIGN_CENTER);


    dialogBox.setWidget(dialogVPanel);
}
项目:shortyz    文件:Renderer.java   
public void render(Word w){
    Word currentWord = this.board.getCurrentWord();
    Position currentHighlightLetter = this.board.getHighlightLetter();
    for(int across = 0; across < this.board.getBoxes().length; across++){
        for(int down=0; down < this.board.getBoxes()[across].length; down++){
           CellFormatter formatter = this.table.getCellFormatter();
           Box box = this.board.getBoxes()[across][down];
           if(!currentWord.checkInWord(across, down) && w != null &&  !w.checkInWord(across, down)){
                continue;
            }

            if(box == null){
                continue;
            }

            BoxView view = (BoxView) table.getWidget(down, across);
            view.setValue(box);

            if(box.isCheated()){
                formatter.addStyleName(down, across, resources.css().cheated());
            }



            if(currentHighlightLetter.across == across && currentHighlightLetter.down == down){
                formatter.addStyleName(down, across, resources.css().currentLetterHighlight());
            } else {
                formatter.removeStyleName(down, across, resources.css().currentLetterHighlight());
            }
            if(board.isShowErrors() && box.getResponse() != ' ' && box.getResponse() != box.getSolution() ){
                formatter.addStyleName(down, across, resources.css().error());
            } else {
                formatter.removeStyleName(down, across, resources.css().error());
            }

            if(box.getResponder() != null && colorMap.get(box.getResponder()) != null){
                view.getElement().getStyle().setColor(colorMap.get(box.getResponder()));
            }

            if(currentWord.checkInWord(across, down)){
                formatter.addStyleName(down, across, resources.css().currentHighlightWord());
            } else {
                formatter.removeStyleName(down, across, resources.css().currentHighlightWord());
            }
        }
    }
}
项目:sc2gears    文件:HasFileStatInfoTablePage.java   
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++;
    }
}
项目:sc2gears    文件:ClientUtils.java   
/**
 * Displays a Details dialog box.<br>
 * Renders a table with 2 columns: name and value pairs.
 * @param caption title of the dialog
 * @param values  values to be displayed; each element is an array (name-value pair) which defines a row
 */
public static void displayDetailsDialog( final String caption, final Object[][] values ) {
    final DialogBox dialogBox = new DialogBox( true );
    dialogBox.setText( caption );
    dialogBox.setGlassEnabled( true );

    final VerticalPanel content = new VerticalPanel();
    content.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );

    final FlexTable table = new FlexTable();
    table.setBorderWidth( 1 );
    table.setCellSpacing( 0 );
    table.setCellPadding( 3 );


    final CellFormatter cellFormatter = table.getCellFormatter();
    for ( int i = 0; i < values.length; i++ ) {
        // Name
        table.setWidget( i, 0, new Label( values[ i ][ 0 ].toString() ) );
        cellFormatter.addStyleName( i, 0, "headerRow" );

        final Object value = values[ i ] [ 1 ];

        if ( value == null )
            table.setWidget( i, 1, new Label() );
        else if ( value instanceof Widget ) 
            table.setWidget( i, 1, (Widget) value );
        else if ( value instanceof Date )
            table.setWidget( i, 1, createTimestampWidget( (Date) value ) );
        else {
            String stringValue;
            if ( value instanceof String )
                stringValue = (String) value;
            else if ( value instanceof Number )
                stringValue = NUMBER_FORMAT   .format( (Number) value );
            else
                stringValue = value.toString();
            table.setWidget( i, 1, new Label( stringValue ) );
        }
        cellFormatter.addStyleName( i, 1, "row" + ( i & 0x01 ) );
        cellFormatter.setHorizontalAlignment( i, 1, HasHorizontalAlignment.ALIGN_LEFT );
    }

    content.add( table );

    content.add( createVerticalEmptyWidget( 8 ) );
    content.add( ClientUtils.createDialogCloseButton( dialogBox, "Close" ) );
    content.add( createVerticalEmptyWidget( 8 ) );

    dialogBox.setWidget( content );

    dialogBox.center();
}