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

124 views
Skip to first unread message

byhisdeeds

unread,
Jan 11, 2014, 4:18:11 PM1/11/14
to google-we...@googlegroups.com
Can anyone say if it is posible for me to receive click events for widgets in the content panel of a disclosure panel. When I try it I receive no notifications within the click handlers attached to the widgets. 

Jens

unread,
Jan 11, 2014, 4:25:31 PM1/11/14
to google-we...@googlegroups.com
Works for me. I have DisclosurePanels that contain content widgets with lots of Buttons / Anchors having ClickHandler attached.

-- J.

John Preston

unread,
Jan 11, 2014, 5:49:13 PM1/11/14
to google-we...@googlegroups.com

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.ne...@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-tool...@googlegroups.com.
To post to this group, send email to google-we...@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.

Reply all
Reply to author
Forward
0 new messages