@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; }
@Override public void setViewSize(Dimension d) { if (forceSizeMatch) { int w = getWidth(); int h = getHeight(); if (w > d.width) { d.width = w; } if (h > d.height) { d.height = h; } } Component view = getView(); if (view != null) { iPlatformComponent pc = com.appnativa.rare.ui.Component.fromView((JComponent) view); Dimension oldSize = view.getSize(); if (!d.equals(oldSize)) { // scrollUnderway will be true if this is invoked as the // result of a validate and setViewPosition was previously // invoked. scrollUnderway = false; if (pc == null) { view.setSize(d); } else { pc.setBounds(view.getX(), view.getY(), d.width, d.height); } isViewSizeSet = true; fireStateChanged(); } } super.setViewSize(d); }
protected UIColor getFocusColor(iPlatformComponent pc, boolean always) { if (focusPaint == null) { focusPaint = Platform.getAppContext().getWidgetFocusPainter(); paintFocus = aUIComponentPainter.paintFocusDefault; if (focusPaint != null) { focusColor = focusPaint.getBackgroundColorAlways(); } } if (paintFocus && (pc != null) && pc.isFocusPainted() && pc.isFocusOwner()) { PaintBucket pb = pc.getFocusPaint(focusPaint); if (pb != null) { if (pb == focusPaint) { return focusColor; } else { return pb.getBackgroundColorAlways(); } } } return null; }