Results 1 to 9 of 9

Thread: Strange visibility behavior adding GWT label to ContentPanel header

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    28

    Default Strange visibility behavior adding GWT label to ContentPanel header

    Hi,

    I'm trying to add a GWT label to ContentPanel's header as follows:

    Label label = new Label("Click");
    ContentPanel panel = new ContentPanel();
    panel.addTool(label)

    When the content panel is displayed, however, I don't see a label. When I do the following:

    ....
    panel.addTool(new Label("Click"));

    it works....

    Can anybody explain to me why content panel behaves this way?
    I would highly appreciate it.

    Ralph

  2. #2
    Ext GWT Premium Member
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20

    Default

    Have you tried running this in dev-mode?

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    28

    Default

    Uhm, do you mean GWT development mode? I run my app using Maven (mvn gwt:run). But now that you mention it I could try running it outside dev mode, using mvn gae:run..., and see if that works but even so it's weird.

    Thanks for your reaction b.t.w.

    Rlp

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    28

    Default

    I'm running into some Chrome troubles right now so I need some time to continue on this visibility problem. Apparently Chrome updated itself without asking and now it won't load the GWT development plugin...

  5. #5
    Ext GWT Premium Member
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20

    Default

    Yes, gwt dev-mode, and I'm unable to reproduce this.

    Also, the examples show adding a ToolButton whereas adding a Label as a tool item doesn't really look like a button that can be clicked - rather it just looks like more header text, but it's right-justified.

    Are you sure the behavior you want is to add a Label to the header bar?

  6. #6
    Sencha User
    Join Date
    Jul 2011
    Posts
    28

    Default

    Hey,

    Ok well, as I said, I'm having some trouble getting the GWT dev mode plugin running in Chrome but just to explain, the reason I'm using a Label in the ContentPanel's header is that I want to put a logout link there. I restyled the Label to look like a hyperlink and attached a ClickHandler to it. A button takes up too much vertical space. Since the ContentPanel.addTool() method takes a Widget, a Label should work right?

    Grtz

  7. #7
    Ext GWT Premium Member
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20

    Default

    RE getting dev-mode working, can you try in Firefox?

    RE the button taking up too much space, try calling addTool(ToolButton). Look at the example here: http://dev.sencha.com/deploy/gxt-3.0...tentPanel.html, but, I don't know what a logout button would look like...an open door?

    And yes, a label should work. I'd add a mouseover/mouseout event handler as well to change the cursor to a pointer and back.

  8. #8
    Sencha User
    Join Date
    Jul 2011
    Posts
    28

    Default

    Hey, thanks for all your tips.

    For now I want the logout label just to say 'Logout', nothing fancy. I'm not too fond of using just icons. Unless people are really used to a given icon they are always wondering what it does which is bad in my opinion... But anway, the dev mode works in Firefox so at least I can continue working. Quite stupid of Google to mess up the GWT plugin in their own browser. As for the Label, of course it's styled as a link. No need for a mouse over event handler. You can just use a stylesheet or program it directly like

    label.getElement().getStyle().setTextDecoration(TextDecoration.UNDERLINE);
    label.getElement().getStyle().setCursor(Cursor.POINTER);
    label.getElement().getStyle().setColor("blue");

    Grtz

  9. #9
    Ext GWT Premium Member
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20

    Default

    To be clear, dev mode works in chrome (just because something doesn't work on one computer doesn't mean it's broken for everyone, hence the Works For Me or Cannot Reproduct category in nearly every defect tracking system) - you may want to try reinstalling chrome and/or the GWT plugin if you've not done so already (are you using a dev build of chrome?).

    RE the icon, understood.

    RE the styling, if you're doing all that, it might be cleaner to just create and use a CSS class.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •