GWT-使可移动单元格使用HTML?

GWT-使可移动单元格使用HTML?,html,gwt,cell,Html,Gwt,Cell,我有一个单元格表,我想把HTML代码放在单元格中。 下面的代码不起作用,空白空间从输出中删除。 TextColumn<MyCell> column1 = new TextColumn<MyCell>() { @Override public String getValue(MyCell myCell) { String result = " " +myCell.getValue

我有一个单元格表,我想把HTML代码放在单元格中。 下面的代码不起作用,空白空间从输出中删除。
    TextColumn<MyCell> column1 = new TextColumn<MyCell>()
    {
        @Override
        public String getValue(MyCell myCell)
        {
            String result = "     " +myCell.getValue();
            return result;
        }
    };
    table.addColumn(column1 , "Header1");
TextColumn column1=newtextcolumn()
{
@凌驾
公共字符串getValue(MyCell-MyCell)
{
字符串结果=”“+myCell.getValue();
返回结果;
}
};
表.添加栏(第1栏,“标题1”);

我知道这可以通过css实现,但我只想知道如何将HTML代码放入单元格中。感谢您的帮助

AFAIK在HTML中忽略了额外的空白-您应该使用pre标记来维护格式。无论如何,请在下面找到我的专栏示例。它从数据提供程序支持的对象中包含的值生成漂亮的进度条

final SafeHtmlCell progressCell = new SafeHtmlCell();

    Column<UiScheduledTask, SafeHtml> progressCol = new Column<UiScheduledTask, SafeHtml>(
            progressCell) {

        @Override
        public SafeHtml getValue(UiScheduledTask value) {
            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            float percent = new Float(value.getCompleted())
                    / new Float(value.getAll());
            int rounded = Math.round(percent * 100);
            sb.appendHtmlConstant("<div style='width: 100px; height: 20px; position: relative;'>");
            sb.appendHtmlConstant("<div style='z-index: 2; display: inline; width: 100px; position: absolute; left: 0px, top: 0px; text-align: center;'>"
                    + value.getCompleted()
                    + "/"
                    + value.getAll()
                    + "</div>");
            sb.appendHtmlConstant("<div style='position: absolute; left: 0; top: 0; width: 100px; z-index: 1'><div style='display: inline; float: left; width: "
                    + rounded
                    + "%; height: 20px; background-color: #82cd80;'></div>");
            sb.appendHtmlConstant("<div style='display: inline; float: right; width: "
                    + (100 - rounded)
                    + "%; height: 20px; background-color: #c54c4d;'></div></div>");
            sb.appendHtmlConstant("</div>");
            return sb.toSafeHtml();
        }
    };
final SafeHtmlCell progressCell=new SafeHtmlCell();
Column progressCol=新列(
(细胞){
@凌驾
公共安全HTML getValue(UiScheduledTask值){
SafeHtmlBuilder sb=新的SafeHtmlBuilder();
浮动百分比=新浮动(value.getCompleted())
/新浮点(value.getAll());
整数四舍五入=数学四舍五入(百分比*100);
某人以““””号结尾;
某人附议
+value.getCompleted()
+ "/"
+value.getAll()
+ "");
某人以““””号结尾;
某人以““””号结尾;
某人以““””号结尾;
让某人回到安全地带();
}
};

谢谢jgrabowski!这工作完美!是的,除非使用pre标记,否则html中会忽略额外的空格。谢谢,这就是我要找的。