| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner <florian.pirchner@gmail.com> - Initial implementation |
| */ |
| package org.eclipse.osbp.vaadin.addons.designer.overlay.client; |
| |
| import java.util.logging.Logger; |
| |
| import com.google.gwt.dom.client.Element; |
| import com.google.gwt.user.client.DOM; |
| import com.vaadin.client.ui.VOverlay; |
| |
| /** |
| * The Class OAbstractOverlay. |
| */ |
| @SuppressWarnings("deprecation") |
| public class OAbstractOverlay extends VOverlay { |
| |
| /** The Constant CSS_DESIGNER_OVERLAYED. */ |
| private static final String CSS_DESIGNER_OVERLAYED = "o-designer-overlayed"; |
| |
| private final Logger logger = Logger.getLogger("DesignerOverlay"); |
| |
| /** |
| * Instantiates a new o abstract overlay. |
| */ |
| public OAbstractOverlay() { |
| super(true, false); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see com.vaadin.client.ui.VOverlay#show() |
| */ |
| @Override |
| public void show() { |
| super.show(); |
| |
| getOwner().addStyleName(CSS_DESIGNER_OVERLAYED); |
| |
| logger.info("Showing overlay for " + getOwner().getElement().getId()); |
| logger.info("Added marker css style for " + getOwner().getElement().getId()); |
| } |
| |
| public void hide(final boolean autoClosed, final boolean animateIn, final boolean animateOut) { |
| super.hide(autoClosed, animateIn, animateOut); |
| |
| logger.info("Hiding overlay for " + getOwner().getElement().getId()); |
| |
| getOwner().removeStyleName(CSS_DESIGNER_OVERLAYED); |
| logger.info("Removed marker css style for " + getOwner().getElement().getId()); |
| } |
| |
| /** |
| * Checks if is mouse on target. |
| * |
| * @param target |
| * the target |
| * @return true, if is mouse on target |
| */ |
| protected boolean isMouseOnTarget(Element target) { |
| // is owner the target? |
| boolean eventTargetsThis = DOM.isOrHasChild(getOwner().getElement(), target); |
| if (!eventTargetsThis) { |
| eventTargetsThis = DOM.isOrHasChild(getElement(), target); |
| } |
| return eventTargetsThis; |
| } |
| |
| } |