/* * (non-Javadoc) * * @see org.appwork.utils.swing.frame.Locator#onClose(org.appwork.utils.swing .frame.frame) */ @Override public void onClose(final Window frame) { try { if (frame.isShowing()) { final Point loc = frame.getLocationOnScreen(); Window parent = getParent(); Container actualParent = frame.getParent(); Point pLoc = null; if (parent != null) { pLoc = parent.getLocationOnScreen(); } if (pLoc == null && actualParent != null) { pLoc = actualParent.getLocationOnScreen(); } if (pLoc == null) { // no parent. save absolute final LocationStorage cfg = createConfig(frame); cfg.setValid(true); cfg.setType("absolute"); cfg.setX(loc.x); cfg.setY(loc.y); cfg._getStorageHandler().write(); } else { final LocationStorage cfg = createConfig(frame); cfg.setValid(true); cfg.setX(loc.x - pLoc.x); cfg.setY(loc.y - pLoc.y); cfg._getStorageHandler().write(); } } } catch (final Throwable e) { e.printStackTrace(); // nothing.... frame.getParent or parent might be invisible } }