mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow wizard lists to be more than 600px height (3/4 current screen height max)
This commit is contained in:
@@ -286,12 +286,23 @@ public abstract class WizardPopup extends AbstractPopup implements ActionListene
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
return computeNotBiggerDimension(super.getPreferredSize());
|
||||
final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
Point p = null;
|
||||
if (focusOwner != null && focusOwner.isVisible()) {
|
||||
p = focusOwner.getLocationOnScreen();
|
||||
}
|
||||
|
||||
return computeNotBiggerDimension(super.getPreferredSize().getSize(), p);
|
||||
}
|
||||
|
||||
private static Dimension computeNotBiggerDimension(Dimension ofContent) {
|
||||
int resultWidth = ofContent.width > MAX_SIZE.width ? MAX_SIZE.width : ofContent.width;
|
||||
private static Dimension computeNotBiggerDimension(Dimension ofContent, final Point locationOnScreen) {
|
||||
int resultHeight = ofContent.height > MAX_SIZE.height + 50 ? MAX_SIZE.height : ofContent.height;
|
||||
if (locationOnScreen != null) {
|
||||
final Rectangle r = ScreenUtil.getScreenRectangle(locationOnScreen);
|
||||
resultHeight = ofContent.height > r.height - (r.height / 4) ? r.height - (r.height / 4) : ofContent.height;
|
||||
}
|
||||
|
||||
int resultWidth = ofContent.width > MAX_SIZE.width ? MAX_SIZE.width : ofContent.width;
|
||||
|
||||
if (ofContent.height > MAX_SIZE.height) {
|
||||
resultWidth += ScrollPaneFactory.createScrollPane().getVerticalScrollBar().getPreferredSize().getWidth();
|
||||
|
||||
Reference in New Issue
Block a user