Beispiel #1
0
    /**
     * Returns the preferred dimensions for this layout given the components in the specified target
     * container.
     *
     * @param parent the component which needs to be laid out
     * @return a <code>Dimension</code> object containing the preferred dimensions
     * @see #minimumLayoutSize
     */
    @Override
    public Dimension preferredLayoutSize(Container parent) {
      Component view = ((JViewport) parent).getView();

      if (view == null) {
        return new Dimension(0, 0);
      } else if (view instanceof iView) {
        UIDimension size = new UIDimension();

        ((iView) view).getPreferredSize(size, 0);

        return new Dimension(size.intWidth(), size.intHeight());
      } else if (view instanceof Scrollable) {
        return ((Scrollable) view).getPreferredScrollableViewportSize();
      } else {
        return view.getPreferredSize();
      }
    }
Beispiel #2
0
  @Override
  public Dimension getViewSize() {
    Component view = getView();

    if (view == null) {
      return new Dimension(0, 0);
    }

    Dimension d;

    if (isViewSizeSet) {
      d = view.getSize();
    } else {
      iPlatformComponent pc = com.appnativa.rare.ui.Component.fromView((JComponent) view);
      UIDimension size = pc.getPreferredSize(null, getWidth());

      d = new Dimension(size.intWidth(), size.intHeight());
    }

    return d;
  }
Beispiel #3
0
 @Override
 protected void getPreferredSizeEx(UIDimension size, float maxWidth) {
   super.getPreferredSizeEx(size, maxWidth);
   size.width += ScreenUtils.PLATFORM_PIXELS_4;
 }