Exemple #1
0
 /**
  * Sets the display property of the Label.
  *
  * @param display the display property. this should be one of the following:
  *     DesignChoiceConstants.DISPLAY_BLOCK | DesignChoiceConstants.DISPLAY_INLINE |
  *     DesignChoiceConstants.DISPLAY_NONE
  */
 public void setDisplay(String display) {
   // if the display equals none, as the block
   if (DesignChoiceConstants.DISPLAY_NONE.equals(display)) {
     setDisplay(DesignChoiceConstants.DISPLAY_BLOCK);
   }
   this.display = display;
 }
Exemple #2
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.draw2d.Figure#getMinimumSize(int, int)
   */
  private Dimension getMinimumSize(
      int wHint, int hHint, boolean isFix, boolean forceWidth, boolean forceHeight) {
    if (DesignChoiceConstants.DISPLAY_NONE.equals(display)) {
      return ZERO_DIMENSION;
    }

    int rx = recommendSize != null ? recommendSize.width : 0;
    int ry = recommendSize != null ? recommendSize.height : 0;

    rx = getRealRecommendSizeX(rx, wHint);

    if (wHint == -1 && hHint == -1) {
      int maxWidth = calcMaxSegment();

      // use recommend size if specified, otherwise use max segment size
      Dimension dim = super.getMinimumSize(rx == 0 ? maxWidth : rx, -1);

      dim.height = Math.max(dim.height, Math.max(getInsets().getHeight(), ry));

      return dim;
    }
    Dimension dim;
    // return the true minimum size with minimum width;
    if (isFix) {
      int tempHint = wHint;
      int maxWidth = calcMaxSegment();
      if (wHint < maxWidth && !forceWidth) {
        tempHint = maxWidth;
      }
      dim = super.getMinimumSize(tempHint <= 0 ? -1 : tempHint, hHint);

      return new Dimension(Math.max(dim.width, rx), Math.max(dim.height, ry));
    } else {
      dim = super.getMinimumSize(rx == 0 ? -1 : rx, hHint);
    }

    if (dim.width < wHint) {
      return new Dimension(Math.max(dim.width, rx), Math.max(dim.height, ry));
    }

    dim = super.getMinimumSize(wHint, hHint);

    return new Dimension(Math.max(dim.width, rx), Math.max(dim.height, ry));
  }