@Override
  public Point getLocationOnScreen(final Window frame) {
    try {
      final LocationStorage cfg = createConfig(frame);
      if (cfg.isValid()) {
        if ("absolute".equalsIgnoreCase(cfg.getType())) {
          return AbstractLocator.validate(new Point(cfg.getX(), cfg.getY()), frame);
        }
        // Do a "is on screen check" here
        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) {
          return getFallbackLocator().getLocationOnScreen(frame);
        }
        return AbstractLocator.validate(new Point(cfg.getX() + pLoc.x, cfg.getY() + pLoc.y), frame);
      }
    } catch (final Throwable e) {

      // frame.getParent() might be null or invisble
      // e.printStackTrace();
    }
    return getFallbackLocator().getLocationOnScreen(frame);
  }
  /*
   * (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
    }
  }