UiBinder as Cell widget

1,026 views
Skip to first unread message

Deepak Singh

unread,
Jun 12, 2012, 1:01:59 PM6/12/12
to google-we...@googlegroups.com
Hi All,

I have an UIBinder widget.
I created a custom cell by extending AbstractCell as follows

public class ActivityCell extends AbstractCell<EachActivity> {

@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
EachActivity value, SafeHtmlBuilder sb) {
if (value == null) {
return;
}
sb.appendHtmlConstant(value.getElement().getInnerHTML());
}
}

where <EachActivity> is a uibinder widget.

There are buttons and anchors inside this uibinder.

When added to celltable as a column, this gets rendered perfectly. But the event does not get fired when clicking on the buttons and Anchors of UIBinder.

Is there any solution ?

Help appreciated.



Thanks 
Deepak Singh

Rodrigo Chandia

unread,
Jun 12, 2012, 3:29:54 PM6/12/12
to google-we...@googlegroups.com
UiBinder does not handle Cell widget events. You probably want to use the upcoming Uibinder for Cells functionality (a.k.a. UiRenderer). It will be part of 2.5, but it is available in trunk, for the time being.

No documentation yet, but there is a design document here:

Cristian Rinaldi

unread,
Jun 13, 2012, 8:53:50 AM6/13/12
to google-we...@googlegroups.com
I'm using UiRenderer for cells, but I'm getting this error at compile time. (I'm using the trunk)

com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:109)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)
at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:65)
at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        ....
        ....
Caused by: java.lang.NoSuchMethodError: com.google.gwt.uibinder.rebind.UiBinderWriter.getBundleAttributeParser(Lcom/google/gwt/uibinder/rebind/XMLAttribute;)Lcom/google/gwt/uibinder/attributeparsers/AttributeParser;
at com.google.gwt.uibinder.elementparsers.ComputedAttributeInterpreter.interpretElement(ComputedAttributeInterpreter.java:67)
at com.google.gwt.uibinder.elementparsers.UiTextInterpreter.interpretElement(UiTextInterpreter.java:61)
at com.google.gwt.uibinder.elementparsers.UiTextInterpreter.interpretElement(UiTextInterpreter.java:29)
at com.google.gwt.uibinder.elementparsers.InterpreterPipe.interpretElement(InterpreterPipe.java:58)
at com.google.gwt.uibinder.elementparsers.HtmlInterpreter.interpretElement(HtmlInterpreter.java:97)
at com.google.gwt.uibinder.elementparsers.HtmlInterpreter.interpretElement(HtmlInterpreter.java:37)
at com.google.gwt.uibinder.rebind.GetInnerHtmlVisitor.visitElement(GetInnerHtmlVisitor.java:45)
at com.google.gwt.uibinder.rebind.ChildWalker.accept(ChildWalker.java:48)
at com.google.gwt.uibinder.rebind.GetInnerHtmlVisitor.getEscapedInnerHtml(GetInnerHtmlVisitor.java:33)
at com.google.gwt.uibinder.rebind.XMLElement.consumeInnerHtml(XMLElement.java:391)
at com.google.gwt.uibinder.elementparsers.DomElementParser.parse(DomElementP



The code is very simple:

EntityBaseCell.ui.xml:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder">

<ui:with field="username" type="java.lang.String" />

<div>
<ui:text from="{username}" />
</div>

</ui:UiBinder>

EntityBaseCell.java
public class EntityBaseCell extends AbstractCell<EntityBaseProxy> {

 interface Renderer extends UiRenderer {
   void render(SafeHtmlBuilder sb, String username);
  }
 
 private final Renderer renderer;
  public EntityBaseCell() {
   renderer = GWT.create(Renderer.class);
  }
 

@Override
public void render(com.google.gwt.cell.client.Cell.Context arg0,
EntityBaseProxy arg1, SafeHtmlBuilder sb) {
   renderer.render(sb, arg1.getName());
}
}

Any Idea?


A.U.S Cristian Rinaldi
Logikas - Conectando Ideas
www.logikas.com


2012/6/12 Rodrigo Chandia <rcha...@google.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RRQwlufNri0J.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Thomas Broyer

unread,
Jun 13, 2012, 9:02:32 AM6/13/12
to google-we...@googlegroups.com


On Wednesday, June 13, 2012 2:53:50 PM UTC+2, Cristian Rinaldi wrote:
I'm using UiRenderer for cells, but I'm getting this error at compile time. (I'm using the trunk)

com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:109)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)
at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:65)
at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        ....
        ....
Caused by: java.lang.NoSuchMethodError: com.google.gwt.uibinder.rebind.UiBinderWriter.getBundleAttributeParser(Lcom/google/gwt/uibinder/rebind/XMLAttribute;)Lcom/google/gwt/uibinder/attributeparsers/AttributeParser;
at com.google.gwt.uibinder.elementparsers.ComputedAttributeInterpreter.interpretElement(ComputedAttributeInterpreter.java:67)

Which revision are you using? There's no call to getBundleAttributeParser from ComputedAttributeInterpreter:

Cristian Rinaldi

unread,
Jun 13, 2012, 10:48:42 AM6/13/12
to google-we...@googlegroups.com
I updated my local copy, I compiled and it worked! 
It's weird because I had done, something must have been wrong.


A.U.S Cristian Rinaldi
Logikas - Conectando Ideas
www.logikas.com


2012/6/13 Thomas Broyer <t.br...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Deepak Singh

unread,
Jun 13, 2012, 11:47:05 PM6/13/12
to google-we...@googlegroups.com
Then i will wait for 2.5.
--
Deepak Singh

Thomas Broyer

unread,
Jun 14, 2012, 5:25:26 AM6/14/12
to google-we...@googlegroups.com

On Thursday, June 14, 2012 5:47:05 AM UTC+2, Deepak Singh wrote:
Then i will wait for 2.5.

FYI, RC1 should be out within a week. 

Deepak Singh

unread,
Jun 14, 2012, 12:37:22 PM6/14/12
to google-we...@googlegroups.com
Great news !!!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

Deepak Singh

unread,
Jun 30, 2012, 2:27:38 AM6/30/12
to google-we...@googlegroups.com
Now 2.5rc1 is out. 

Any document / example how to render uibinder (created by 2.4) to be used as column in celltable. And of course it should handle event from uibinder also.

Thanks in advance
Deepak
--
Deepak Singh

Thomas Broyer

unread,
Jun 30, 2012, 5:07:02 AM6/30/12
to google-we...@googlegroups.com


On Saturday, June 30, 2012 8:27:38 AM UTC+2, Deepak Singh wrote:
Now 2.5rc1 is out. 

Any document / example how to render uibinder (created by 2.4) to be used as column in celltable. And of course it should handle event from uibinder also.

Reply all
Reply to author
Forward
0 new messages