public void onCellOver(CellOverEvent event) {
      ListGridField gridField = AttributeListGrid.this.getField(event.getColNum());
      if (gridField.getName().equals(attributeInfo.getName())) {
        ListGridRecord record = event.getRecord();
        String value = record.getAttribute(attributeInfo.getName());
        if (event.getRowNum() != row) {
          if (img != null) {
            cleanup();
          }
          img = new Img(value);
          img.setMaxWidth(300);
          img.setMaxHeight(300);
          img.setKeepInParentRect(true);
          img.setShowEdges(true);
          img.setLeft(AttributeListGrid.this.getAbsoluteLeft() + 10);
          img.setTop(AttributeListGrid.this.getAbsoluteTop() + 10);
          img.draw();
          killTimer =
              new Timer() {

                public void run() {
                  img.destroy();
                }
              };
          killTimer.schedule(Math.round(3000));
          row = event.getRowNum();
        }
      }
    }
示例#2
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout();
    layout.setMembersMargin(10);

    final Img image = new Img("other/magnifier.png", 48, 48);
    image.setTop(125);
    image.setLeft(100);
    image.setAnimateTime(500); // milliseconds

    IButton zoomButton = new IButton();
    zoomButton.setTitle("Zoom");
    zoomButton.setLeft(40);
    zoomButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(0, 50, 248, 248);
          }
        });

    IButton shrinkButton = new IButton();
    shrinkButton.setTitle("Shrink");
    shrinkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(100, 125, 48, 48);
          }
        });

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(zoomButton);
    hLayout.addMember(shrinkButton);
    layout.addMember(hLayout);

    layout.addChild(image);
    return layout;
  }