add missing sources
and cleanup the .gitignore files
diff --git a/.gitignore b/.gitignore
index 3773b30..7b6a80f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
**/target
**git.properties
-**/VAADIN
+
**/target/
**/.metadata/
diff --git a/org.eclipse.osbp.fork.vaadin.addon.dcharts/.gitignore b/org.eclipse.osbp.fork.vaadin.addon.dcharts/.gitignore
deleted file mode 100644
index 17bb869..0000000
--- a/org.eclipse.osbp.fork.vaadin.addon.dcharts/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/target/
-**/VAADIN/
-**/WEB-INF/
\ No newline at end of file
diff --git a/org.eclipse.osbp.fork.vaadin.addon.filteringtable/.gitignore b/org.eclipse.osbp.fork.vaadin.addon.filteringtable/.gitignore
deleted file mode 100644
index 5076645..0000000
--- a/org.eclipse.osbp.fork.vaadin.addon.filteringtable/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/target/
-**git.properties
-**/VAADIN/
-**/WEB-INF/
\ No newline at end of file
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/.gitignore b/org.eclipse.osbp.fork.vaadin.addon.overlays/.gitignore
deleted file mode 100644
index f0c6909..0000000
--- a/org.eclipse.osbp.fork.vaadin.addon.overlays/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-**/VAADIN/
-**/WEB-INF/
\ No newline at end of file
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/CustomClickableOverlay.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/CustomClickableOverlay.java
new file mode 100644
index 0000000..8e2efb6
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/CustomClickableOverlay.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay;
+
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;
+import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Server-side class for creating image overlays that can be clicked. This class
+ * is used to implement click support to {@link TextOverlay} and
+ * {@link ImageOverlay} but it can be used for other similar Overlays that need
+ * the click support.
+ *
+ * @author Sami Ekblad
+ */
+@SuppressWarnings("serial")
+public class CustomClickableOverlay extends CustomOverlay {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = -354623604620366005L;
+
+ /** The layout. */
+ private CssLayout layout = new CssLayout();
+
+ /** The real overlay. */
+ private Component realOverlay;
+
+ /** The click listener. */
+ private OverlayClickListener clickListener;
+
+ /** Instantiates a new custom clickable overlay.
+ */
+ public CustomClickableOverlay() {
+ layout.addLayoutClickListener(new ClickListener());
+ super.setOverlay(layout);
+ }
+
+ /** Create new overlay for a component.
+ *
+ * @param overlay
+ * the overlay
+ * @param referenceComponent
+ * the reference component
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public CustomClickableOverlay(Component overlay, Component referenceComponent) {
+ this();
+ setComponent(referenceComponent);
+ setOverlay(overlay);
+ }
+
+ /* (non-Javadoc)
+ * @see org.vaadin.overlay.CustomOverlay#getOverlay()
+ */
+ @Override
+ public Component getOverlay() {
+ return realOverlay;
+ }
+
+ /* (non-Javadoc)
+ * @see org.vaadin.overlay.CustomOverlay#setOverlay(com.vaadin.ui.Component)
+ */
+ @Override
+ public void setOverlay(Component overlay) {
+ realOverlay = overlay;
+ layout.removeAllComponents();
+ if (realOverlay != null) {
+ layout.addComponent(realOverlay);
+ }
+ }
+
+ /** Set a click listener for to receive the overlay click events.
+ *
+ * @param clickListener
+ * the new click listener
+ */
+ public void setClickListener(OverlayClickListener clickListener) {
+ this.clickListener = clickListener;
+ }
+
+ /**
+ * Get a click listener for to receive the overlay click events.
+ *
+ * @return clickListener
+ */
+ public OverlayClickListener getClickListener() {
+ return clickListener;
+ }
+
+ /** Implementation of the LayoutClickListener to receive the clicks.
+ *
+ * @see LayoutClickEvent
+ */
+ private class ClickListener implements LayoutClickListener {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = -3844465450135961729L;
+
+ /* (non-Javadoc)
+ * @see com.vaadin.event.LayoutEvents.LayoutClickListener#layoutClick(com.vaadin.event.LayoutEvents.LayoutClickEvent)
+ */
+ public void layoutClick(LayoutClickEvent event) {
+ if (clickListener != null) {
+ clickListener.overlayClicked(CustomClickableOverlay.this);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/CustomOverlay.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/CustomOverlay.java
new file mode 100644
index 0000000..5cf743f
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/CustomOverlay.java
@@ -0,0 +1,367 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay;
+
+import com.vaadin.annotations.JavaScript;
+import com.vaadin.shared.ui.AlignmentInfo;
+import com.vaadin.ui.AbstractComponentContainer;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import org.vaadin.overlay.widgetset.client.CustomOverlayState;
+
+import java.util.Iterator;
+
+/**
+ * CustomOverlay can be used to add overlays to other components. You can use
+ * this to add any component that hovers on top of the component, but it may be
+ * easier to use one of the more specific implementations instead:
+ * {@link ImageOverlay} or {@link TextOverlay}
+ * <p>
+ * This is the server-side part of the component.
+ */
+@JavaScript("public/overlays/overlays.js")
+//@StyleSheet("public/overlays/styles.css") uncomment for sample app
+public class CustomOverlay extends AbstractComponentContainer {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 4484572264185406155L;
+
+ /** The overlay. */
+ private Component overlay = null;
+// private Component component = null;
+
+ /**
+ * Create empty overlay.
+ * <p>
+ * Use {@link #setComponent(Component)} and {@link #setOverlay(Component)}
+ * to bind the overlay to a component.
+ */
+ public CustomOverlay() {
+ }
+
+ /** Create empty overlay for a component.
+ * <p>
+ * Use {@link #setOverlay(Component)} to add overlay content.
+ *
+ * @param overlay
+ * the overlay
+ * @param refenceComponent
+ * the refence component
+ */
+ public CustomOverlay(Component overlay, Component refenceComponent) {
+ super();
+ setComponent(refenceComponent);
+ setOverlay(overlay);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractComponent#getState()
+ */
+ @Override
+ protected CustomOverlayState getState() {
+ return (CustomOverlayState) super.getState();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractComponent#getState(boolean)
+ */
+ @Override
+ protected CustomOverlayState getState(boolean markAsDirty) {
+ return (CustomOverlayState) super.getState(markAsDirty);
+ }
+
+// @Override
+// public void paintContent(PaintTarget target) throws PaintException {
+// super.paintContent(target);
+//
+// if (component != null) {
+// target.addAttribute("comp", component);
+// }
+// target.addAttribute("align", align.getBitMask());
+// target.addAttribute("overlayAlign", overlayAlign.getBitMask());
+// target.addAttribute("x", x);
+// target.addAttribute("y", y);
+//
+// if (overlay != null) {
+// overlay.paint(target);
+// }
+// }
+
+ /**
+ * Set the horizontal offset of the overlay from the alignment point.
+ * <p>
+ * This is screen coordinates and default is 0.
+ *
+ * @param x Positive for right or negative left offset.
+ * @see #setComponentAnchor(Alignment)
+ */
+ public void setXOffset(int x) {
+ getState().x = x;
+ }
+
+ /**
+ * Get the horizontal offset of the overlay from the alignment point.
+ * <p>
+ * This is screen coordinates.
+ *
+ * @return Positive for right or negative left offset.
+ * @see #getComponentAnchor()
+ */
+ public int getXOffset() {
+ return getState(false).x;
+ }
+
+ /**
+ * Set the vertical offset of the overlay from the alignment point.
+ * <p>
+ * This is screen coordinates and default is 0.
+ *
+ * @param y Positive for downward or negative for upward offset.
+ * @see #setComponentAnchor(Alignment)
+ */
+ public void setYOffset(int y) {
+ getState().y = y;
+ }
+
+ /**
+ * Get the vertical offset of the overlay from the alignment point.
+ * <p>
+ * This is screen coordinates.
+ *
+ * @return Positive for downward or negative upward offset.
+ * @see #getComponentAnchor()
+ */
+ public int getYOffset() {
+ return getState(false).y;
+ }
+
+ /** Sets the overlay.
+ *
+ * @param overlay
+ * the new overlay
+ */
+ public void setOverlay(Component overlay) {
+ if (this.overlay != null) {
+ super.removeComponent(this.overlay);
+ }
+ this.overlay = overlay;
+ if (this.overlay != null) {
+ super.addComponent(overlay);
+ }
+ markAsDirty();
+ }
+
+ /** Get the overlay content.
+ *
+ * @return the overlay
+ */
+ public Component getOverlay() {
+ return overlay;
+ }
+
+ /**
+ * Set the reference component.
+ *
+ * @param component The component that this overlay is aligned to.
+ */
+ public void setComponent(Component component) {
+ getState().component = component;
+ }
+
+ /**
+ * Get the reference component.
+ *
+ * @return The component that this overlay is aligned to.
+ */
+ public Component getComponent() {
+ return (Component) getState(false).component;
+ }
+
+ /**
+ * Set the anchor point of the reference component.
+ * <p>
+ * The X and Y offsets are relative to this point and overlayAnchor point.
+ * <p>
+ *
+ * @param anchorPoint One of the {@link Alignment} constants.
+ * @see #setComponent(Component)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ * @see #setOverlayAnchor(Alignment)
+ */
+ public void setComponentAnchor(Alignment anchorPoint) {
+ getState().alignBitMask = anchorPoint.getBitMask();
+ markAsDirty();
+ }
+
+ /**
+ * Get the anchor point of the reference component.
+ * <p>
+ * The X and Y offsets are relative to this point.
+ *
+ * @return align One of the {@link Alignment} constants.
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ * @see #setOverlayAnchor(Alignment)
+ */
+ public Alignment getComponentAnchor() {
+ return new Alignment(getState(false).alignBitMask);
+ }
+
+ /** Set the alignment point of the overlay component.
+ * <p>
+ * The X and Y offsets are relative to this point.
+ *
+ * @param overlayAnchorPoint
+ * the new overlay anchor
+ * @see #setOverlay(Component)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ * @see #setComponentAnchor(Alignment)
+ */
+ public void setOverlayAnchor(Alignment overlayAnchorPoint) {
+ getState().overlayAlignBitMask = overlayAnchorPoint.getBitMask();
+ markAsDirty();
+ }
+
+ /**
+ * Get the alignment point of the overlay component.
+ * <p>
+ * The X and Y offsets are relative to this point.
+ *
+ * @return align One of the {@link Alignment} constants.
+ * @see #setOverlay(Component)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ * @see #setComponentAnchor(Alignment)
+ */
+ public Alignment getOverlayAnchor() {
+ return new Alignment(getState(false).overlayAlignBitMask);
+ }
+
+ /** This class only contains overlay components.
+ *
+ * @return the iterator
+ * @see com.vaadin.ui.ComponentContainer#getComponentIterator()
+ */
+ @Override
+ public Iterator<Component> iterator() {
+ return new Iterator<Component>() {
+ private Component currentOverlay = getOverlay();
+ private boolean first = currentOverlay == null;
+
+ public boolean hasNext() {
+ return !first;
+ }
+
+ public Component next() {
+ if (!first) {
+ first = true;
+ return currentOverlay;
+ } else {
+ return null;
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ /*
+ * Methods inherited from AbstractComponentContainer. These are unnecessary
+ * (but mandatory). Most of them are not supported in this implementation.
+ */
+
+ /** Not supported in this implementation.
+ *
+ * @param c
+ * the c
+ * @throws UnsupportedOperationException
+ * the unsupported operation exception
+ * @see com.vaadin.ui.AbstractComponentContainer#addComponent(com.vaadin.ui.Component)
+ */
+ @Override
+ public void addComponent(Component c) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** Not supported in this implementation.
+ *
+ * @param oldComponent
+ * the old component
+ * @param newComponent
+ * the new component
+ * @throws UnsupportedOperationException
+ * the unsupported operation exception
+ * @see com.vaadin.ui.ComponentContainer#replaceComponent(com.vaadin.ui.Component,
+ * com.vaadin.ui.Component)
+ */
+ @Override
+ public void replaceComponent(Component oldComponent, Component newComponent) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** Not supported in this implementation.
+ *
+ * @param c
+ * the c
+ * @throws UnsupportedOperationException
+ * the unsupported operation exception
+ * @see com.vaadin.ui.AbstractComponentContainer#removeComponent(com.vaadin.ui.Component)
+ */
+ @Override
+ public void removeComponent(Component c) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.ComponentContainer#getComponentCount()
+ */
+ @Override
+ public int getComponentCount() {
+// TODO
+ return 0;
+ }
+
+ /** Alignment to info.
+ *
+ * @param alignment
+ * the alignment
+ * @return the alignment info
+ */
+ protected AlignmentInfo alignmentToInfo(Alignment alignment) {
+ if (alignment == null) {
+ return new AlignmentInfo(Alignment.TOP_LEFT.getBitMask());
+ }
+ return new AlignmentInfo(alignment.getBitMask());
+ }
+
+ /** Info to alignment.
+ *
+ * @param alignment
+ * the alignment
+ * @return the alignment
+ */
+ protected Alignment infoToAlignment(AlignmentInfo alignment) {
+ if (alignment == null) {
+ return new Alignment(AlignmentInfo.TOP_LEFT.getBitMask());
+ }
+ return new Alignment(alignment.getBitMask());
+ }
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/ImageOverlay.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/ImageOverlay.java
new file mode 100644
index 0000000..d58165a
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/ImageOverlay.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay;
+
+import com.vaadin.server.Resource;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Embedded;
+
+/**
+ * Server-side class for creating image overlays for other components.
+ * <p>
+ * The overlays are images rendered on the top of the specified component and
+ * they can be aligned using the {@link #setComponentAnchor(com.vaadin.ui.Alignment)},
+ * {@link #setXOffset(int)} and {@link #setYOffset(int)} functions.
+ *
+ * @author Sami Ekblad
+ */
+public class ImageOverlay extends CustomClickableOverlay {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = -4604714578885982118L;
+
+ /** The image resource. */
+ private Resource imageResource;
+
+ /** Create new overlay for a component using the specified image
+ * resource.
+ *
+ * @param referenceComponent
+ * the reference component
+ * @param imageResource
+ * the image resource
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public ImageOverlay(Component referenceComponent, Resource imageResource) {
+ setComponent(referenceComponent);
+ setImage(imageResource);
+ }
+
+ /** Create new overlay for a component. The image resource must be added
+ * later using {@link #setImage(Resource)}
+ *
+ * @param referenceComponent
+ * the reference component
+ * @see #setImage(Resource)
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public ImageOverlay(Component referenceComponent) {
+ setComponent(referenceComponent);
+ }
+
+ /**
+ * Create new empty overlay.
+ * <p>
+ * The image resource must be added later using {@link #setImage(Resource)}
+ * and reference component using {@link #setComponent(Component)}
+ *
+ * @see #setImage(Resource)
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public ImageOverlay() {
+ }
+
+ /** Sets the overlay image.
+ * <p>
+ * The overlay creates an {@link Embedded} from the resource.
+ *
+ * @param imageResource
+ * the new image
+ */
+ public void setImage(Resource imageResource) {
+ this.imageResource = imageResource;
+ Embedded embedded = new Embedded(null, imageResource);
+ setOverlay(embedded);
+ }
+
+ /** Get the image.
+ *
+ * @return the image
+ */
+ public Resource getImage() {
+ return imageResource;
+ }
+
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/OverlayClickListener.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/OverlayClickListener.java
new file mode 100644
index 0000000..fe010d9
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/OverlayClickListener.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay;
+
+/**
+ * Interface for receiving click events on Overlay.
+ * <p>
+ * Use this together with implementations of the {@link CustomClickableOverlay}
+ * such as {@link ImageOverlay} and {@link TextOverlay}.
+ *
+ * @author Sami Ekblad
+ */
+public interface OverlayClickListener {
+
+ /** Overlay clicked.
+ *
+ * @param overlay
+ * the overlay
+ */
+ public void overlayClicked(CustomClickableOverlay overlay);
+
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/TextOverlay.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/TextOverlay.java
new file mode 100644
index 0000000..8c57def
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/TextOverlay.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay;
+
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Server-side class for creating text overlays for other components.
+ * <p>
+ * The overlays are strings rendered on the top of the specified component and
+ * they can be aligned using the
+ * {@link #setComponentAnchor(com.vaadin.ui.Alignment)},
+ * {@link #setXOffset(int)} and {@link #setYOffset(int)} functions.
+ *
+ * @author Sami Ekblad
+ */
+
+public class TextOverlay extends CustomClickableOverlay {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = -4604714578885982118L;
+
+ /** The Constant CONTENT_DEFAULT. */
+ public static final ContentMode CONTENT_DEFAULT = ContentMode.TEXT;
+
+ /** The Constant CONTENT_PREFORMATTED. */
+ public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED;
+
+ /** The Constant CONTENT_RAW. */
+ public static final ContentMode CONTENT_RAW = ContentMode.RAW;
+
+ /** The Constant CONTENT_TEXT. */
+ public static final ContentMode CONTENT_TEXT = ContentMode.TEXT;
+
+ /** The Constant CONTENT_XHTML. */
+ public static final ContentMode CONTENT_XHTML = ContentMode.HTML;
+
+ /** The Constant CONTENT_XML. */
+ public static final ContentMode CONTENT_XML = ContentMode.XML;
+
+ /** The text. */
+ private String text;
+
+ /** The label. */
+ private Label label;
+
+ /**
+ * Create new text overlay for a component.
+ *
+ * @param referenceComponent Align the overlay to this component.
+ * @param text Text content of the overlay
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public TextOverlay(Component referenceComponent, String text) {
+ setComponent(referenceComponent);
+ setText(text);
+ }
+
+ /**
+ * Create new text empty overlay for a component.
+ * <p>
+ * The text must be added later using the {@link #setText(String)}
+ *
+ * @param referenceComponent Align the overlay to this component.
+ * @see #setText(String)
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public TextOverlay(Component referenceComponent) {
+ setComponent(referenceComponent);
+ }
+
+ /**
+ * Create new text empty overlay.
+ * <p>
+ * The text must be added later using the {@link #setText(String)} and the
+ * reference component using {@link #setComponent(Component)}.
+ *
+ * @see #setText(String)
+ * @see #setComponentAnchor(com.vaadin.ui.Alignment)
+ * @see #setXOffset(int)
+ * @see #setYOffset(int)
+ */
+ public TextOverlay() {
+ }
+
+ /** Set overlay text.
+ * <p>
+ * Creates a {@link Label} for the text.
+ *
+ * @param text
+ * the new text
+ * @see #setContentMode(ContentMode)
+ */
+ public void setText(final String text) {
+ this.text = text;
+ if (label == null) {
+ label = new Label();
+ label.setSizeUndefined();
+ setOverlay(label);
+ }
+ label.setValue(this.text);
+ }
+
+ /**
+ * Set the content mode.
+ * <p>
+ * This is a shortcut for ((Label)getOverlay()).setContentMode(int).
+ *
+ * @param contentMode One of the CONTENT_MODE_* constants. Same as
+ * Label.CONTENT_MODE_* constants.
+ */
+ public void setContentMode(ContentMode contentMode) {
+ label.setContentMode(contentMode);
+ }
+
+ /**
+ * Get the content mode.
+ * <p>
+ * This is a shortcut for ((Label)getOverlay()).getContentMode().
+ *
+ * @return One of the CONTENT_MODE_* constants. Same as Label.CONTENT_MODE_*
+ * constants.
+ */
+ public ContentMode getContentMode() {
+ if (label != null) {
+ return label.getContentMode();
+ }
+ return CONTENT_DEFAULT;
+ }
+
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/icon-new.png b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/icon-new.png
new file mode 100644
index 0000000..39d606d
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/icon-new.png
Binary files differ
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/public/overlays/overlays.js b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/public/overlays/overlays.js
new file mode 100644
index 0000000..303dcc8
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/public/overlays/overlays.js
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+if (!document.getBoxObjectFor) {
+ document.getBoxObjectFor = function(elem) {
+ var obj = new Object;
+ var rect = elem.getBoundingClientRect();
+ obj.y = rect.top;
+ obj.x = rect.left;
+ obj.width =Math.abs(rect.right-rect.left);
+ obj.height = Math.abs(rect.bottom-rect.top);
+ return obj;
+ };
+}
\ No newline at end of file
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/public/overlays/styles.css b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/public/overlays/styles.css
new file mode 100644
index 0000000..a870eaa
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/public/overlays/styles.css
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.v-generated-body {
+ overflow: auto;
+}
+
+.v-generated-body .v-app {
+ height: auto;
+}
\ No newline at end of file
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/sample/OverlaySampleApplication.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/sample/OverlaySampleApplication.java
new file mode 100644
index 0000000..e83e15e
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/sample/OverlaySampleApplication.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.sample;
+
+import com.vaadin.server.ClassResource;
+import com.vaadin.server.Resource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.*;
+import com.vaadin.ui.Button.ClickEvent;
+import org.vaadin.overlay.CustomClickableOverlay;
+import org.vaadin.overlay.ImageOverlay;
+import org.vaadin.overlay.OverlayClickListener;
+import org.vaadin.overlay.TextOverlay;
+
+public class OverlaySampleApplication extends UI {
+
+ private static final long serialVersionUID = 7831853143147236971L;
+
+ @Override
+ protected void init(VaadinRequest request) {
+ VerticalLayout layout = new VerticalLayout();
+
+ final Label label = new Label("Alignment.TOP_LEFT");
+ layout.addComponent(label);
+
+ for (int i = 0; i < 20; i++) {
+
+ Button button = new Button("Sample Button");
+ layout.addComponent(button);
+
+ final ImageOverlay io = new ImageOverlay(button);
+
+ Resource res = new ClassResource(this.getClass(), "../icon-new.png");
+ io.setImage(res);
+ io.setComponentAnchor(Alignment.TOP_LEFT); // Top left of the button
+ io.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
+ io.setClickListener(new OverlayClickListener() {
+ public void overlayClicked(CustomClickableOverlay overlay) {
+ Notification.show("ImageOverlay Clicked!");
+ }
+ });
+ layout.addComponent(io);
+ io.setEnabled(true);
+
+ final TextOverlay to = new TextOverlay(button, "New!");
+ to.setComponentAnchor(Alignment.MIDDLE_RIGHT); // Top right of the button
+ to.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
+ to.setClickListener(new OverlayClickListener() {
+ public void overlayClicked(CustomClickableOverlay overlay) {
+ Notification.show("TextOverlay Clicked!");
+ }
+ });
+ layout.addComponent(to);
+
+ button.addClickListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Alignment a = io.getComponentAnchor();
+ String s = "";
+ if (Alignment.TOP_LEFT.equals(a)) {
+ a = Alignment.TOP_CENTER;
+ s = "TOP_CENTER";
+ } else if (Alignment.TOP_CENTER.equals(a)) {
+ a = Alignment.TOP_RIGHT;
+ s = "TOP_RIGHT";
+ } else if (Alignment.TOP_RIGHT.equals(a)) {
+ a = Alignment.MIDDLE_RIGHT;
+ s = "MIDDLE_RIGHT";
+ } else if (Alignment.MIDDLE_RIGHT.equals(a)) {
+ a = Alignment.BOTTOM_RIGHT;
+ s = "BOTTOM_RIGHT";
+ } else if (Alignment.BOTTOM_RIGHT.equals(a)) {
+ a = Alignment.BOTTOM_CENTER;
+ s = "BOTTOM_CENTER";
+ } else if (Alignment.BOTTOM_CENTER.equals(a)) {
+ a = Alignment.BOTTOM_LEFT;
+ s = "BOTTOM_LEFT";
+ } else if (Alignment.BOTTOM_LEFT.equals(a)) {
+ a = Alignment.MIDDLE_LEFT;
+ s = "MIDDLE_LEFT";
+ } else if (Alignment.MIDDLE_LEFT.equals(a)) {
+ a = Alignment.TOP_LEFT;
+ s = "TOP_LEFT";
+ }
+ io.setComponentAnchor(a);
+ label.setValue("Alignment." + s);
+ }
+ });
+ }
+
+ setContent(layout);
+ }
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/OverlaysWidgetset.gwt.xml b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/OverlaysWidgetset.gwt.xml
new file mode 100644
index 0000000..673d807
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/OverlaysWidgetset.gwt.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN"
+ "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
+<module>
+ <!--
+ Uncomment the following to compile the widgetset for one browser only.
+ This can reduce the GWT compilation time significantly when debugging.
+ The line should be commented out before deployment to production
+ environments.
+
+ Multiple browsers can be specified for GWT 1.7 as a comma separated
+ list. The supported user agents at the moment of writing were:
+ ie6,ie8,gecko,gecko1_8,safari,opera
+
+ The value gecko is used for Firefox 3 and later, gecko1_8 is for
+ Firefox 2 and safari is used for webkit based browsers including
+ Google Chrome.
+ -->
+ <inherits name="com.vaadin.DefaultWidgetSet"/>
+ <!-- <set-property name="user.agent" value="safari"/> -->
+ <!-- <set-configuration-property name="devModeRedirectEnabled" value="true"/> -->
+</module>
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomClickableOverlayConnector.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomClickableOverlayConnector.java
new file mode 100644
index 0000000..9e9f9d4
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomClickableOverlayConnector.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.widgetset.client;
+
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.shared.ui.Connect;
+import org.vaadin.overlay.CustomClickableOverlay;
+
+/**
+ * @author nevinsky
+ * @version $Id$
+ */
+@Connect(CustomClickableOverlay.class)
+public class CustomClickableOverlayConnector extends CustomOverlayConnector {
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ }
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayConnector.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayConnector.java
new file mode 100644
index 0000000..95d60d8
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayConnector.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.widgetset.client;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ComponentConnector;
+import com.vaadin.client.ConnectorHierarchyChangeEvent;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractComponentContainerConnector;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.ui.AlignmentInfo;
+import com.vaadin.shared.ui.Connect;
+import org.vaadin.overlay.CustomOverlay;
+
+import java.util.List;
+
+/**
+ * @author nevinsky
+ * @version $Id$
+ */
+@Connect(CustomOverlay.class)
+public class CustomOverlayConnector extends AbstractComponentContainerConnector {
+ private static final long serialVersionUID = -1812155693173030620L;
+
+ public CustomOverlayConnector() {
+ }
+
+ @Override
+ protected Widget createWidget() {
+ CustomOverlayWidget widget = new CustomOverlayWidget();
+ return widget;
+ }
+
+ @Override
+ public CustomOverlayWidget getWidget() {
+ return (CustomOverlayWidget) super.getWidget();
+ }
+
+ @Override
+ public CustomOverlayState getState() {
+ return (CustomOverlayState) super.getState();
+ }
+
+ @Override
+ protected void updateWidgetStyleNames() {
+ super.updateWidgetStyleNames();
+ String themeName = getConnection().getConfiguration().getThemeName();
+ getWidget().setThemeName(themeName);
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ if (stateChangeEvent.hasPropertyChanged("x")) {
+ getWidget().x = getState().x;
+ }
+ if (stateChangeEvent.hasPropertyChanged("y")) {
+ getWidget().y = getState().y;
+ }
+ if (stateChangeEvent.hasPropertyChanged("alignBitMask")) {
+ getWidget().align = new AlignmentInfo(getState().alignBitMask);
+ }
+ if (stateChangeEvent.hasPropertyChanged("overlayAlignBitMask")) {
+ getWidget().overlayAlign = new AlignmentInfo(getState().overlayAlignBitMask);
+ }
+ if (stateChangeEvent.hasPropertyChanged("component")) {
+ Connector connector = getState().component;
+ if (connector != null) {
+ Widget w = ((ComponentConnector) connector).getWidget();
+ if (w instanceof CustomOverlayWidget) {
+ w = ((CustomOverlayWidget) w).getOverlayWidget();
+ }
+ getWidget().refCompEl = w.getElement();
+ }
+
+ List<ComponentConnector> connectors = getChildComponents();
+ if (connectors != null && connectors.size() > 0 && connectors.get(0) != null) {
+ Widget p = connectors.get(0).getWidget();
+ Widget w = getWidget().overlay.getWidget();
+ if (p != w && w != null) {
+ getWidget().overlay.clear();
+ }
+ getWidget().overlay.setWidget(p);
+ getWidget().overlay.show();
+ } else {
+ getWidget().overlay.hide();
+ }
+ }
+ getWidget().deferredUpdatePosition();
+ }
+
+ @Override
+ public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) {
+// List<ComponentConnector> children = getChildComponents();
+// CustomOverlayWidget widget = getWidget();
+// widget.clear();
+// if (children != null && children.size() > 0) {
+// widget.overlay = children.get(0);
+// } else {
+// widget.overlay = null;
+// }
+
+ getWidget().deferredUpdatePosition();
+ }
+
+ @Override
+ public void updateCaption(ComponentConnector connector) {
+ //No captions for overlays
+ }
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayState.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayState.java
new file mode 100644
index 0000000..6e9061f
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayState.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.widgetset.client;
+
+import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.ui.AlignmentInfo;
+
+/**
+ * @author nevinsky
+ * @version $Id$
+ */
+public class CustomOverlayState extends AbstractComponentState {
+ public int x = 0;
+ public int y = 0;
+ public int alignBitMask = AlignmentInfo.TOP_LEFT.getBitMask();
+ public int overlayAlignBitMask = AlignmentInfo.TOP_LEFT.getBitMask();
+
+ public Connector component;
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayWidget.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayWidget.java
new file mode 100644
index 0000000..f5d1c9f
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomOverlayWidget.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.widgetset.client;
+
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Event.NativePreviewEvent;
+import com.google.gwt.user.client.Event.NativePreviewHandler;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.Util;
+import com.vaadin.shared.ui.AlignmentInfo;
+
+import java.util.logging.Logger;
+
+
+/**
+ * Client side widget which communicates with the server. Messages from the
+ * server are shown as HTML and mouse clicks are sent to the server.
+ */
+public class CustomOverlayWidget extends SimplePanel {
+
+ /** The log. */
+ private static Logger log = Logger.getLogger("CustomOverlayWidget");
+
+ /** The Constant CLASSNAME. */
+ public static final String CLASSNAME = "v-customoverlay";
+
+ /** The x. */
+ protected int x;
+
+ /** The y. */
+ protected int y;
+
+ /** The ref comp el. */
+ protected Element refCompEl;
+
+ /** The align. */
+ protected AlignmentInfo align = new AlignmentInfo(AlignmentInfo.LEFT, AlignmentInfo.TOP);
+
+ /** The overlay align. */
+ protected AlignmentInfo overlayAlign = new AlignmentInfo(AlignmentInfo.LEFT, AlignmentInfo.TOP);
+
+ /** The overlay. */
+ protected PopupPanel overlay;
+
+ /** The ref y. */
+ private int refY;
+
+ /** The ref x. */
+ private int refX;
+
+ /**
+ * The constructor should first call super() to initialize the component and
+ * then handle any initialization relevant to Vaadin.
+ */
+ public CustomOverlayWidget() {
+ super();
+ setWidget(new HTML()); // Seems that we need this one
+ overlay = new PopupPanel();
+ overlay.addStyleName(CLASSNAME);
+ overlay.setAutoHideEnabled(false);
+ overlay.setAnimationEnabled(false);
+ overlay.setModal(false);
+
+ Event.addNativePreviewHandler(new NativePreviewHandler() {
+
+ public void onPreviewNativeEvent(NativePreviewEvent event) {
+ int typeInt = event.getTypeInt();
+ // We're only listening for these
+ if (typeInt == Event.ONSCROLL) {
+ CustomOverlayWidget.this.updateOverlayPosition();
+ }
+ }
+ });
+ }
+
+ /** Called whenever an update is received from the server.
+ *
+ * @return the overlay widget
+ */
+// public void updateFromUIDL(UIDL uidl, final ApplicationConnection client) {
+//
+// // Custom visibility handling
+// if (uidl.getBooleanAttribute("invisible") && overlay != null) {
+// overlay.hide();
+// }
+// if (client.updateComponent(this, uidl, false)) {
+// return;
+// }
+//
+// // Find the reference component
+// if (uidl.hasAttribute("comp")) {
+// Paintable refComp = client.getPaintable(uidl
+// .getStringAttribute("comp"));
+// if (refComp != null) {
+// Widget w = (Widget) refComp;
+// if (w instanceof VCustomOverlay) {
+// w = ((VCustomOverlay) w).getOverlayWidget();
+// }
+// refCompEl = w.getElement();
+// }
+// }
+//
+//
+// // Render the component
+// final UIDL child = uidl.getChildUIDL(0);
+// if (child != null) {
+// Paintable p = client.getPaintable(child);
+// Widget w = overlay.getWidget();
+// if (p != w && w != null) {
+// client.unregisterPaintable((Paintable) w);
+// overlay.clear();
+// }
+// overlay.setWidget((Widget) p);
+// overlay.show();
+// p.updateFromUIDL(child, client);
+// } else {
+// overlay.hide();
+// }
+//
+// Widget wgt = getOverlayWidget();
+// int w = Util.getRequiredWidth(wgt);
+// int h = Util.getRequiredHeight(wgt);
+// ApplicationConnection.getConsole().log("PAINT: w=" + w + "h=" + h);
+//
+// // Position the component
+// x = uidl.getIntAttribute("x");
+// y = uidl.getIntAttribute("y");
+// align = new AlignmentInfo(uidl.getIntAttribute("align"));
+// overlayAlign = new AlignmentInfo(uidl.getIntAttribute("overlayAlign"));
+//
+// deferredUpdatePosition();
+// }
+ protected Widget getOverlayWidget() {
+ return overlay.getWidget();
+ }
+
+ /** Update overlay position.
+ */
+ protected void updateOverlayPosition() {
+ if (refCompEl != null) {
+ // Calculate the position based on reference component size and the
+ // align point.
+ refY = refCompEl.getAbsoluteTop();
+ refX = refCompEl.getAbsoluteLeft();
+
+ if (align.isBottom()) {
+ refY += refCompEl.getOffsetHeight();
+ } else if (align.isVerticalCenter()) {
+ refY += refCompEl.getOffsetHeight() / 2;
+ }
+ if (align.isRight()) {
+ refX += refCompEl.getOffsetWidth();
+ } else if (align.isHorizontalCenter()) {
+ refX += refCompEl.getOffsetWidth() / 2;
+ }
+ // Show popup
+ overlay.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
+
+ public void setPosition(int offsetWidth, int offsetHeight) {
+ // Calculate the position based on over component size and
+ // the alignment point.
+ Widget wgt = getOverlayWidget();
+ int w = Util.getRequiredWidth(wgt);
+ int h = Util.getRequiredHeight(wgt);
+
+ log.info("POSITION: w=" + w + "h=" + h);
+
+ int top = refY + y;
+ int left = refX + x;
+ if (overlayAlign.isBottom()) {
+ top -= h;
+ } else if (overlayAlign.isVerticalCenter()) {
+ top -= h / 2;
+ }
+
+ if (overlayAlign.isRight()) {
+ left -= w;
+ } else if (overlayAlign.isHorizontalCenter()) {
+ left -= w / 2;
+ }
+ log.info("top=" + top + "left=" + left);
+
+ overlay.setPopupPosition(left, top);
+ }
+ });
+ }
+ }
+
+ /** Deferred update position.
+ */
+ protected void deferredUpdatePosition() {
+ Scheduler scheduler = Scheduler.get();
+ scheduler.scheduleDeferred(new Command() {
+ public void execute() {
+ updateOverlayPosition();
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see com.google.gwt.user.client.ui.Widget#onDetach()
+ */
+ @Override
+ protected void onDetach() {
+ if (overlay != null) {
+ overlay.hide();
+ }
+ super.onDetach();
+ }
+
+ /** Sets the theme name.
+ *
+ * @param themeName
+ * the new theme name
+ */
+ public void setThemeName(String themeName) {
+ overlay.addStyleName(themeName);
+ }
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomTextOverlayConnector.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomTextOverlayConnector.java
new file mode 100644
index 0000000..51f04c8
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/CustomTextOverlayConnector.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.widgetset.client;
+
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.shared.ui.Connect;
+import org.vaadin.overlay.TextOverlay;
+
+/**
+ * @author nevinsky
+ * @version $Id$
+ */
+@Connect(TextOverlay.class)
+public class CustomTextOverlayConnector extends CustomOverlayConnector {
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ }
+}
diff --git a/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/ImageOverlayConnector.java b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/ImageOverlayConnector.java
new file mode 100644
index 0000000..e73bae3
--- /dev/null
+++ b/org.eclipse.osbp.fork.vaadin.addon.overlays/src/org/vaadin/overlay/widgetset/client/ImageOverlayConnector.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010 Sami Ekblad, 2013 Haulmont Development
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vaadin.overlay.widgetset.client;
+
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.shared.ui.Connect;
+import org.vaadin.overlay.ImageOverlay;
+
+/**
+ * @author nevinsky
+ * @version $Id$
+ */
+@Connect(ImageOverlay.class)
+public class ImageOverlayConnector extends CustomOverlayConnector {
+
+ public ImageOverlayConnector() {
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ }
+}