@Override
 public void dispose() {
   mainPanel.clear();
   mainPanel.removeFromParent();
   mainPanel = null;
   composantPropertiesWidget = null;
   viewListWidget = null;
   save = null;
 }
Exemplo n.º 2
0
 @Override
 public void callback(Object object) {
   if ((Boolean) object) {
     Image imgLogo = new Image("/branding.png");
     logoPanel.addStyleName("imgSapResearch");
     logoPanel.add(new HTML("powered by"));
     logoPanel.add(imgLogo);
   } else {
     logoPanel.removeFromParent();
   }
 }
Exemplo n.º 3
0
  public void testGWTQueryCoreWidgets() {
    final FlowPanel p = new FlowPanel();
    Button b = new Button("test");
    RootPanel.get().add(b);
    RootPanel.get().add(p);

    int nitems = 4;
    final String label1 = "I'm the label ";
    final String label2 = "Finally I'm just a simple label";

    for (int i = 0; i < nitems; i++) {
      Label l = new Label(label1 + i);
      p.add(l);
    }
    $("<div>whatever</div").appendTo($(p));

    b.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            $(".gwt-Label", p)
                .each(
                    new Function() {
                      @Override
                      public void f(Widget w) {
                        Label l = (Label) w;
                        l.setText(label2);
                      }
                    });
          }
        });

    $(".gwt-Label", p)
        .each(
            new Function() {
              @Override
              public Object f(Widget w, int i) {
                assertEquals(label1 + i, ((Label) w).getText());
                return null;
              }
            });

    $(b).click();

    $(".gwt-Label", p)
        .each(
            new Function() {
              public void f(Element e) {
                assertEquals(label2, $(e).text());
              }
            });

    $("div", p)
        .each(
            new Function() {
              public void f(Element e) {
                // Just to avoid the exception when non-widget elements match
              }

              public void f(Widget w) {
                if (w instanceof Label) {
                  assertEquals(label2, $(w).text());
                }
              }
            });

    p.removeFromParent();
    b.removeFromParent();
  }