Two classes are built with UIBinder, DialogPanel and WhateverPanel.
WhateverPanel extends DialogPanel.

The problem is that GWT compiler complains that it cannot find
DialogPanel's uibinder fields in WhateverPanel's ui.xml, but the
fields are not used or exposed to WhateverPanel. That is,  uibinder
wants the extension class to define the uifields found in the parent
class.

Is there a UIBinder directive/annotation to tell uibinder not to do
that?
What should I do to eliminate the crosstalk during compilation (short
of advising me not to use uibinder)?

The tiring details:
============
I have a DialogPanel whose code I gleefully stole from DialogBox.java,
because I needed my own caption with a close X button.

As with DialogBox, DialogPanel extends DecoratedPanel.
The caption is defined using UIBinder:

[code file="DialogPanel-Caption.ui.xml"]
....
  <g:HTMLPanel ui:field="captionPanel" height="1.4em">
    <g:Label ui:field='closer' addStyleNames='{style.closer}'>X</
g:Label>
    <g:HTML ui:field="captionTitle"
addStyleNames='{style.caption}'>Login</g:HTML>
  </g:HTMLPanel>
....
[/code]

Now, the interesting part of the problem.
I extended DialogPanel into WhateverPanel, to define a confirmation
button as its widget using UIBinder:

[code file="WhateverPanel-Confirm.ui.xml"]
  <g:LazyPanel ui:field="confirmPanel">
    <g:HTMLPanel>
      <g:Label ui:field="confirmMsg"/>
      <br/>
      <br/>
      <g:Button ui:field="confirmButton">Proceed</g:Button>
    </g:HTMLPanel>
  </g:LazyPanel>
....
[/code]

The problem:
=========
GWT compilation complains that WhateverPanel#captionPanel is not found
as a field attribute in WhateverPanel-Confirm.ui.xml. But captionPanel
is not exposed or used outside of DialogPanel.


[code file="DialogPanel.java"]
public class DialogPanel
        extends DecoratedPopupPanel
        implements MouseListener
{
  @UiTemplate("DialogPanel-Caption.ui.xml")
  interface UIDialogBoxUiBinder
    extends UiBinder<Widget, DialogPanel>{}
  private static UIDialogBoxUiBinder captionUiBinder =
    GWT.create(UIDialogBoxUiBinder.class);
  @UiField HTMLPanel captionPanel;
  @UiField HTML captionTitle;
  @UiField Label closer;

  public DialogPanel(boolean autoHide, boolean modal) {
    super(autoHide, modal);
    captionUiBinder.createAndBindUi(this);
    Element td01 = getCellElement(0, 1);
    DOM.appendChild(td01, this.captionPanel.getElement());
    adopt(this.captionPanel);
    .....
  }
....
[/code]


[code file="WhateverPanel.java"]
....
@UiTemplate("WhateverPanel-Confirm.ui.xml")
interface ConfirmUiBinder
  extends UiBinder<Widget, WhateverPanel> {}
private static ConfirmUiBinder confirmUiBinder =
  GWT.create(ConfirmUiBinder.class);
@UiField LazyPanel confirmPanel;
@UiField Label confirmMsg;
@UiField Button confirmButton;
....
public void confirm(String title, String text){
  this.confirmPanel.setVisible(true);
  this.confirmMsg.setText(text);
  this.setWidget(this.confirmPanel);
....
[/code]

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to