Example usage for com.google.gwt.dom.builder.shared TableCellBuilder startDiv

List of usage examples for com.google.gwt.dom.builder.shared TableCellBuilder startDiv

Introduction

In this page you can find the example usage for com.google.gwt.dom.builder.shared TableCellBuilder startDiv.

Prototype

DivBuilder startDiv();

Source Link

Document

Append a div element.

Usage

From source file:com.geocento.webapps.eobroker.common.client.widgets.table.celltable.MyDefaultCellTableBuilder.java

License:Apache License

protected void buildDefaultRow(T rowValue, int absRowIndex) {
    // Calculate the row styles.
    SelectionModel<? super T> selectionModel = cellTable.getSelectionModel();
    boolean isSelected = (selectionModel == null || rowValue == null) ? false
            : selectionModel.isSelected(rowValue);
    boolean isEven = absRowIndex % 2 == 0;
    StringBuilder trClasses = new StringBuilder(isEven ? evenRowStyle : oddRowStyle);
    if (isSelected) {
        trClasses.append(selectedRowStyle);
    }// w  ww .  jav  a 2 s .  c o m

    // Add custom row styles.
    RowStyles<T> rowStyles = cellTable.getRowStyles();
    if (rowStyles != null) {
        String extraRowStyles = rowStyles.getStyleNames(rowValue, absRowIndex);
        if (extraRowStyles != null) {
            trClasses.append(" ").append(extraRowStyles);
        }
    }

    // Build the row.
    TableRowBuilder tr = startRow();
    tr.className(trClasses.toString());

    // Build the columns.
    int columnCount = cellTable.getColumnCount();
    for (int curColumn = 0; curColumn < columnCount; curColumn++) {
        Column<T, ?> column = cellTable.getColumn(curColumn);
        // Create the cell styles.
        StringBuilder tdClasses = new StringBuilder(cellStyle);
        tdClasses.append(isEven ? evenCellStyle : oddCellStyle);
        if (curColumn == 0) {
            tdClasses.append(firstColumnStyle);
        }
        if (isSelected) {
            tdClasses.append(selectedCellStyle);
        }
        // The first and last column could be the same column.
        if (curColumn == columnCount - 1) {
            tdClasses.append(lastColumnStyle);
        }

        // Add class names specific to the cell.
        Context context = new Context(absRowIndex, curColumn, cellTable.getValueKey(rowValue));
        String cellStyles = column.getCellStyleNames(context, rowValue);
        if (cellStyles != null) {
            tdClasses.append(" " + cellStyles);
        }

        // Build the cell.
        HorizontalAlignmentConstant hAlign = column.getHorizontalAlignment();
        VerticalAlignmentConstant vAlign = column.getVerticalAlignment();
        TableCellBuilder td = tr.startTD();
        td.className(tdClasses.toString());
        if (hAlign != null) {
            td.align(hAlign.getTextAlignString());
        }
        if (vAlign != null) {
            td.vAlign(vAlign.getVerticalAlignString());
        }

        // Add the inner div.
        DivBuilder div = td.startDiv();
        div.style().outlineStyle(OutlineStyle.NONE).endStyle();

        // Render the cell into the div.
        renderCell(div, context, column, rowValue);

        // End the cell.
        div.endDiv();
        td.endTD();
    }

    // End the row.
    tr.endTR();
}

From source file:com.gwtmodel.table.view.table.SpanCellBuilder.java

License:Apache License

@Override
public void buildRowImpl(T rowValue, int absRowIndex) {

    // Calculate the row styles.
    SelectionModel<? super T> selectionModel = cellTable.getSelectionModel();
    boolean isSelected = (selectionModel == null || rowValue == null) ? false
            : selectionModel.isSelected(rowValue);
    boolean isEven = absRowIndex % 2 == 0;
    StringBuilder trClasses = new StringBuilder(isEven ? evenRowStyle : oddRowStyle);
    if (isSelected) {
        trClasses.append(selectedRowStyle);
    }//w  w  w. j  ava 2s  .  c  o  m

    // Add custom row styles.
    RowStyles<T> rowStyles = cellTable.getRowStyles();
    if (rowStyles != null) {
        String extraRowStyles = rowStyles.getStyleNames(rowValue, absRowIndex);
        if (extraRowStyles != null) {
            trClasses.append(" ").append(extraRowStyles);
        }
    }

    // Build the row.
    TableRowBuilder tr = startRow();
    tr.className(trClasses.toString());

    // Build the columns.
    int columnCount = cellTable.getColumnCount();
    // added: SPAN
    int lastSpanCounter = 0;
    for (int curColumn = 0; curColumn < columnCount; curColumn++) {

        // SPAN: omit generating cell
        if (lastSpanCounter > 0) {
            lastSpanCounter--;
            continue;
        }

        Column<T, ?> column = cellTable.getColumn(curColumn);
        // Create the cell styles.
        StringBuilder tdClasses = new StringBuilder(cellStyle);
        tdClasses.append(isEven ? evenCellStyle : oddCellStyle);
        if (curColumn == 0) {
            tdClasses.append(firstColumnStyle);
        }
        if (isSelected) {
            tdClasses.append(selectedCellStyle);
        }
        // The first and last column could be the same column.
        if (curColumn == columnCount - 1) {
            tdClasses.append(lastColumnStyle);
        }

        // Add class names specific to the cell.
        Context context = new Context(absRowIndex, curColumn, cellTable.getValueKey(rowValue));
        String cellStyles = column.getCellStyleNames(context, rowValue);
        if (cellStyles != null) {
            tdClasses.append(" " + cellStyles);
        }

        // Build the cell.
        HorizontalAlignmentConstant hAlign = column.getHorizontalAlignment();
        VerticalAlignmentConstant vAlign = column.getVerticalAlignment();
        TableCellBuilder td = tr.startTD();

        // SPAN
        lastSpanCounter = iSpan.get(rowValue, curColumn);
        if (lastSpanCounter > 1) {
            td.attribute("colspan", Integer.toString(lastSpanCounter));
            lastSpanCounter--;
        }

        td.className(tdClasses.toString());
        if (hAlign != null) {
            td.align(hAlign.getTextAlignString());
        }
        if (vAlign != null) {
            td.vAlign(vAlign.getVerticalAlignString());
        }

        // Add the inner div.
        DivBuilder div = td.startDiv();
        div.style().outlineStyle(OutlineStyle.NONE).endStyle();

        // Render the cell into the div.
        renderCell(div, context, column, rowValue);

        // End the cell.
        div.endDiv();
        td.endTD();
    }

    // End the row.
    tr.endTR();
}

From source file:com.jitlogic.zico.client.views.traces.TraceCallTableBuilder.java

License:Open Source License

private void buildDetailRow(TraceRecordInfo value, int absRowIndex, boolean isSelected, String trClasses) {
    TableRowBuilder tr = startRow();//from   www .  ja v  a 2  s.co m
    tr.className(trClasses);
    tr.startTD().endTD();
    TableCellBuilder td = tr.startTD().colSpan(cellTable.getColumnCount() - 1);
    DivBuilder div = td.startDiv().className(extenderCellStyle);
    //div.style().outlineStyle(Style.OutlineStyle.NONE).endStyle();
    this.renderCell(div, createContext(1), colDetails, value);
    div.endDiv();
    td.endTD();
    tr.endTR();
}

From source file:com.jitlogic.zico.client.views.traces.TraceCallTableBuilder.java

License:Open Source License

private void buildStandardRow(TraceRecordInfo rowValue, int absRowIndex, boolean isSelected, String trClasses) {
    //boolean isEven = absRowIndex % 2 == 0;

    // Build the row.
    TableRowBuilder tr = startRow();/*  www  .j a v  a  2 s . co  m*/
    tr.className(trClasses);

    // Build the columns.
    int columnCount = cellTable.getColumnCount();
    for (int curColumn = 0; curColumn < columnCount; curColumn++) {
        Column<TraceRecordInfo, ?> column = cellTable.getColumn(curColumn);
        // Create the cell styles.
        StringBuilder tdClasses = new StringBuilder(cellStyle);
        tdClasses.append(evenCellStyle);
        if (curColumn == 0) {
            tdClasses.append(firstColumnStyle);
        }
        if (isSelected) {
            tdClasses.append(selectedCellStyle);
        }
        // The first and last column could be the same column.
        if (curColumn == columnCount - 1) {
            tdClasses.append(lastColumnStyle);
        }

        // Add class names specific to the cell.
        Cell.Context context = new Cell.Context(absRowIndex, curColumn, cellTable.getValueKey(rowValue));
        String cellStyles = column.getCellStyleNames(context, rowValue);
        if (cellStyles != null) {
            tdClasses.append(" " + cellStyles);
        }

        // Build the cell.
        HasHorizontalAlignment.HorizontalAlignmentConstant hAlign = column.getHorizontalAlignment();
        HasVerticalAlignment.VerticalAlignmentConstant vAlign = column.getVerticalAlignment();
        TableCellBuilder td = tr.startTD();
        td.className(tdClasses.toString());
        if (hAlign != null) {
            td.align(hAlign.getTextAlignString());
        }
        if (vAlign != null) {
            td.vAlign(vAlign.getVerticalAlignString());
        }

        // Add the inner div.
        DivBuilder div = td.startDiv();
        div.style().outlineStyle(Style.OutlineStyle.NONE).height(14, Style.Unit.PX).endStyle();

        // Render the cell into the div.
        renderCell(div, context, column, rowValue);

        // End the cell.
        div.endDiv();
        td.endTD();
    }

    // End the row.
    tr.endTR();
}

From source file:com.jitlogic.zico.client.views.traces.TraceSearchTableBuilder.java

License:Open Source License

private void buildDetailRow(TraceInfo value, int absRowIndex, boolean isSelected, String trClasses) {
    TableRowBuilder tr = startRow();//from   w w w  . ja  v a 2s.c  o m
    tr.className(trClasses);
    tr.startTD().endTD();
    TableCellBuilder td = tr.startTD().colSpan(cellTable.getColumnCount() - 1);
    DivBuilder div = td.startDiv().className(extenderCellStyle);
    //div.style().outlineStyle(Style.OutlineStyle.NONE).endStyle();
    this.renderCell(div, createContext(1), colDetails, value);
    div.endDiv();
    td.endTD();
    tr.endTR();
}

From source file:com.jitlogic.zico.client.views.traces.TraceSearchTableBuilder.java

License:Open Source License

private void buildStandardRow(TraceInfo rowValue, int absRowIndex, boolean isSelected, String trClasses) {
    //boolean isEven = absRowIndex % 2 == 0;

    // Build the row.
    TableRowBuilder tr = startRow();/*from w  w  w .  jav  a2s .c  o  m*/
    tr.className(trClasses);

    // Build the columns.
    int columnCount = cellTable.getColumnCount();
    for (int curColumn = 0; curColumn < columnCount; curColumn++) {
        Column<TraceInfo, ?> column = cellTable.getColumn(curColumn);
        // Create the cell styles.
        StringBuilder tdClasses = new StringBuilder(cellStyle);
        tdClasses.append(evenCellStyle);
        if (curColumn == 0) {
            tdClasses.append(firstColumnStyle);
        }
        if (isSelected) {
            tdClasses.append(selectedCellStyle);
        }
        // The first and last column could be the same column.
        if (curColumn == columnCount - 1) {
            tdClasses.append(lastColumnStyle);
        }

        // Add class names specific to the cell.
        Cell.Context context = new Cell.Context(absRowIndex, curColumn, cellTable.getValueKey(rowValue));
        String cellStyles = column.getCellStyleNames(context, rowValue);
        if (cellStyles != null) {
            tdClasses.append(" " + cellStyles);
        }

        // Build the cell.
        HasHorizontalAlignment.HorizontalAlignmentConstant hAlign = column.getHorizontalAlignment();
        HasVerticalAlignment.VerticalAlignmentConstant vAlign = column.getVerticalAlignment();
        TableCellBuilder td = tr.startTD();
        td.className(tdClasses.toString());
        if (hAlign != null) {
            td.align(hAlign.getTextAlignString());
        }
        if (vAlign != null) {
            td.vAlign(vAlign.getVerticalAlignString());
        }

        // Add the inner div.
        DivBuilder div = td.startDiv();
        div.style().outlineStyle(Style.OutlineStyle.NONE).height(14, Style.Unit.PX).endStyle();

        // Render the cell into the div.
        renderCell(div, context, column, rowValue);

        // End the cell.
        div.endDiv();
        td.endTD();
    }

    // End the row.
    tr.endTR();
}