コード例 #1
0
  @Override
  public void onElementResize(ElementResizeEvent event) {
    int width = event.getLayoutManager().getOuterWidth(event.getElement());
    int height = event.getLayoutManager().getOuterHeight(event.getElement());

    com.google.gwt.user.client.Element element = target.getWidget().getElement();
    boolean forceRedraw = false;

    // Loop through breakpoints and see which one applies to this width
    currentWidthRanges = resolveBreakpoint("width", width, event.getElement());

    if (!"".equals(currentWidthRanges)) {
      target.getWidget().getElement().setAttribute("width-range", currentWidthRanges);
      forceRedraw = true;
    } else {
      element.removeAttribute("width-range");
    }

    // Loop through breakpoints and see which one applies to this height
    currentHeightRanges = resolveBreakpoint("height", height, event.getElement());

    if (!"".equals(currentHeightRanges)) {
      target.getWidget().getElement().setAttribute("height-range", currentHeightRanges);
      forceRedraw = true;
    } else {
      element.removeAttribute("height-range");
    }

    if (forceRedraw) {
      forceRedrawIfIE8(element);
    }
  }
コード例 #2
0
 @Override
 public void onElementResize(ElementResizeEvent e) {
   int buttonWidth = getLayoutManager().getOuterWidth(e.getElement());
   buttonWidth -= getLayoutManager().getMarginRight(e.getElement());
   getWidget().adjustButtonSpace(buttonWidth);
 }