2

I am trying to create a tooltip / popover over a button that has pull-right class set(pull-right basically sets the flow to right). The tooltip/popover crashes when trying to do a placement left. Any suggestions/ help?

 /* The widget updateStatusDate is a button that floats right*/     
Tooltip tooltip = new Tooltip("Date : " + timeOfOperation + " Comment : " + comment); 
setUpdateStatusDate("Last Updated by : " + userName);    
tooltip.setWidget(updateStatusDate); tooltip.setPlacement(Placement.LEFT);     
tooltip.reconfigure();
Ajinkya
  • 22,324
  • 33
  • 110
  • 161
Onkar
  • 652
  • 3
  • 15
  • Could you show your code? – fascynacja Sep 25 '13 at 11:33
  • @fascynacja /* The widget updateStatusDate is a button that floats right*/ `Tooltip tooltip = new Tooltip("Date : " + timeOfOperation + " Comment : " + comment); setUpdateStatusDate("Last Updated by : " + userName); tooltip.setWidget(updateStatusDate); tooltip.setPlacement(Placement.LEFT); tooltip.reconfigure();` – Onkar Nov 02 '13 at 14:55
  • It would be the best if you post the whole involved code into your original question. Please add also the lines in which you create the updateStatusDate Button (is it gwt button or bootstrap button). Also if the call to setUpdateStatusDate() method doesn't change anything for your problem - remove it, otherwise also add its code. Could you also write what do you mean by "tooltip crashes" ? – fascynacja Nov 02 '13 at 20:01
  • fyi, I have tried oyt your code as it is, using regular GWT Button and it worked correctly, that is why I need more info from you – fascynacja Nov 02 '13 at 20:07
  • @fascynacja Mine is a bootstrap button. For the time being we can ignore `setUpdateStatusDate` as it just sets text for the button. By **tooltip crashing** i mean it flickers and its placement is way too far to the left(where it would have been had i not applied `pull-right` on the button) and not attached to the button. In your code you can just add the following line `updateStatusDate.addStyleName("pull-right")` and it will be analogous to my code. Please remove the center allign from your root panel. – Onkar Nov 04 '13 at 04:13

1 Answers1

0

Given your code, I have put its simplified version into my project and it works without problems. You can copy it to your project and check if it works:

@Override
public void onModuleLoad() {

    // essentials from questioned code
    Tooltip tooltip = new Tooltip("text");
    Button updateStatusDate = new Button("test button");

    tooltip.setWidget(updateStatusDate);
    tooltip.setPlacement(Placement.LEFT);
    tooltip.reconfigure();

    // change style for the rootPanel, so the button flows to the center
    // it is just for fast and short code example, do not do this in your regular project
    com.google.gwt.dom.client.Style.TextAlign center = TextAlign.CENTER;
    RootPanel.get().getElement().getStyle().setTextAlign(center);

    //add button
    RootPanel.get().add(updateStatusDate);
}

My Bootstrap version is: 2.3.2.0-SNAPSHOT, and my GWT version is 2.5.1.

fascynacja
  • 1,625
  • 4
  • 17
  • 35