/** * 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(); } }
@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; }