Force JPopup to be always heavyweight (original) (raw)
Mario Torre neugens.limasoftware at gmail.com
Thu Apr 19 14:46:30 UTC 2012
- Previous message: Force JPopup to be always heavyweight
- Next message: Force JPopup to be always heavyweight
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Pavel,
Did you had any chance to review this?
Thanks, Mario
2012/4/17 Mario Torre <neugens.limasoftware at gmail.com>:
2012/4/16 Pavel Porvatov <pavel.porvatov at oracle.com>:
Hello Pavel,
About the test, I'm not sure if you need something more specific, but I was thinking to simply test if when isLightWeightPopupEnabled is set we create an heavy or lightweight popup, any other ideas? That's a good way I think Here is the webrev: http://cr.openjdk.java.net/~neugens/6800513/ Note that MEDIUMWEIGHT is still used in some cases (PopupFactory.getPopup): if (owner == null || invokerInHeavyWeightPopup(owner)) { popupType = HEAVYWEIGHTPOPUP; } else if (popupType == LIGHTWEIGHTPOPUP && !(contents instanceof JToolTip) && !(contents instanceof JPopupMenu)) { popupType = MEDIUMWEIGHTPOPUP; } I'm not sure if we want to replace this as well with full HW (I would do it, in fact). Also I was thinking to have a very small optimization, if we are using an HW popups, there's no need to do this check: // Check if the parent component is an option pane. If so we need to // force a heavy weight popup in order to have event dispatching work // correctly. Component c = owner; while (c != null) { if (c instanceof JComponent) { if (((JComponent)c).getClientProperty( PopupFactoryFORCEHEAVYWEIGHTPOPUP) == Boolean.TRUE) { popupType = HEAVYWEIGHTPOPUP; break; } } else if (c instanceof Window) { Window w = (Window) c; if (!w.isOpaque() || w.getOpacity() < 1 || w.getShape() != null) { popupType = HEAVYWEIGHTPOPUP; break; } } c = c.getParent(); } We can save a loop and a couple of instanceof checks (although I remember we proved with Jim and Phil that instanceof don't really introduce any speed penalization). What do you think? Cheers, Mario -- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF IcedRobot: www.icedrobot.org Proud GNU Classpath developer: http://www.classpath.org/ Read About us at: http://planet.classpath.org OpenJDK: http://openjdk.java.net/projects/caciocavallo/ Please, support open standards: http://endsoftpatents.org/
-- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF
IcedRobot: www.icedrobot.org Proud GNU Classpath developer: http://www.classpath.org/ Read About us at: http://planet.classpath.org OpenJDK: http://openjdk.java.net/projects/caciocavallo/
Please, support open standards: http://endsoftpatents.org/
- Previous message: Force JPopup to be always heavyweight
- Next message: Force JPopup to be always heavyweight
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]