@Override
 public void onResize(final ResizeEvent event) {
   if (!widget.isAttached()) {
     return;
   }
   widget.setHeight(getHeight() + "px");
 }
  private int getMarginSize() {
    if (marginSize != -101) {
      return marginSize;
    }

    if (widget.getParent().getOffsetHeight() != 0) {
      int previousSize = widget.getOffsetHeight();
      widget.setHeight(previousSize + "px");
      marginSize = widget.getOffsetHeight() - previousSize;
      GWT.log("set to " + marginSize);
      return marginSize;
    } else {
      return 0;
    }
  }
 /**
  * We control size by setting our child widget's size. However, if we don't currently have a
  * child, we record the size the user wanted so that when we do get a child, we can set it
  * correctly. Until size is explicitly cleared, any child put into the popup will be given that
  * size.
  */
 void maybeUpdateSize() {
   // For subclasses of PopupPanel, we want the default behavior of setWidth
   // and setHeight to change the dimensions of PopupPanel's child widget.
   // We do this because PopupPanel's child widget is the first widget in
   // the hierarchy which provides structure to the panel. DialogBox is
   // an example of this. We want to set the dimensions on DialogBox's
   // FlexTable, which is PopupPanel's child widget. However, it is not
   // DialogBox's child widget. To make sure that we are actually getting
   // PopupPanel's child widget, we have to use super.getWidget().
   Widget w = super.getWidget();
   if (w != null) {
     if (desiredHeight != null) {
       w.setHeight(desiredHeight);
     }
     if (desiredWidth != null) {
       w.setWidth(desiredWidth);
     }
   }
 }
  public void dragMove() {

    Widget appointment = context.draggable.getParent();

    // calculates difference between elements position on screen
    // and how many pixels the user is trying to drag it
    int delta = context.draggable.getAbsoluteTop() - context.desiredDraggableY;

    // get the height of the widget
    int contentHeight = appointment.getOffsetHeight();

    // make sure the height of the widget is not < the minimum size
    int newHeight = Math.max(contentHeight - delta, snapSize);

    // get the 'snapped' height. basically it gets the rounded
    // intervals spanned, then multiples it by the snapSize
    int snapHeight = Math.round((float) newHeight / snapSize) * snapSize;

    appointment.setHeight(snapHeight + "px");
  }