Saturday, January 11, 2014

Re: Click handler for widgets in content panel for a DisclosurePanel does not work


I instantiate the DisclosurePanel as follows.

<g:DisclosurePanel ui:field="dp" width="180px">
    <g:customHeader width="100%">
      <g:HorizontalPanel width="100%" horizontalAlignment="align_right"
                         verticalAlignment="align_middle"
                         styleName='{style.session_header}'>
          <g:HTML ui:field='sessionName'></g:HTML>
          <g:Image url='images/user-profile.png' ></g:Image>
      </g:HorizontalPanel>
    </g:customHeader>
    <g:FlowPanel styleName='{style.body}'>
      <g:HTMLPanel>
        <g:Anchor ui:field="link1" styleName='{style.link_item}'>Link 1</g:Anchor>
        <g:Anchor href="#userprofile" ui:field="link2" styleName='{style.link_item}'>User Profile</g:Anchor>
        <g:Anchor ui:field="logout_link" styleName='{style.link_item}'>Logout</g:Anchor>
      </g:HTMLPanel>
    </g:FlowPanel>
  </g:DisclosurePanel>



public class ActiveSessionPanel extends Composite
{
  private static ActiveSessionUiBinder uiBinder = GWT.create(ActiveSessionUiBinder.class);

  interface ActiveSessionUiBinder extends UiBinder<Widget, ActiveSessionPanel>
  {
  }

  @UiField
  HTML sessionName;
  @UiField
  Label logout_link;
  @UiField
  Anchor link1;
  @UiField
  Anchor link2;
  
  public ActiveSessionPanel()
  {
    initWidget(uiBinder.createAndBindUi(this));
    
    sessionName.setHTML("Active session");
    
    logout_link.addClickHandler(new ClickHandler()
    {
      @Override
      public void onClick(ClickEvent event)
      {
        Window.alert("logout link clicked");
      }
    });
    
  }

}


However I see the panel and it opens ok, but the links do not produce any response, although they present themselves with underlines, thus I think they are being recognized as links.

Can't figure what I'm doing wrong.


On Sat, Jan 11, 2014 at 4:25 PM, Jens <jens.nehlmeier@gmail.com> wrote:
Works for me. I have DisclosurePanels that contain content widgets with lots of Buttons / Anchors having ClickHandler attached.

-- J.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/zx9JOwQVd20/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate