Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Overlays - Yet another new fancy add-on component

Sami Ekblad
1 decade ago Feb 05, 2010 8:18pm

If you have ever wanted to add an image or a text overlay on any Vaadin component, the Overlays add-on is for you.

With ImageOverlay you can put a small (or large) images on top of other components. Like a "New"-icon to highlight a recently added feature or item:

ImageOverlay newLogo = new ImageOverlay(codePanel, new ClassResource(this
        .getClass(), "images/newLogo.png", this));
newLogo.setComponentAnchor(Alignment.TOP_RIGHT);
newLogo.setOverlayAnchor(Alignment.MIDDLE_CENTER);
mainWindow.addComponent(newLogo);

Or if you want to simply add a "No items found" text in the middle of an empty Table, simply use TextOverlay:

TextOverlay notFoundOverlay = new TextOverlay(table, "<i>[No entries found]</i>");
notFoundOverlay.setContentMode(TextOverlay.CONTENT_RAW);
notFoundOverlay.setComponentAnchor(Alignment.MIDDLE_CENTER);
notFoundOverlay.setOverlayAnchor(Alignment.MIDDLE_CENTER);
mainWindow.addComponent(notFoundOverlay);

All overlays can bound and anchored to virtually any other Vaadin component. Also the anchor point in the overlay can be specified using Alignment constants. This allows quick and easy positioning of overlay on Buttons, TextFields, Selects, etc. Furthermore, the position can be fine-tuned using x and y offsets. Overlays can also be anchored to each other as well as stacked.

This is still an experimental component and some browsers may misbehave. I also request for comments for the overlay API, method naming and features.

Try the demo here!

Source code is here (Apache License 2.0)

For your convenience I attached the 6.2 compatible add-on jar file.

André Schild
1 decade ago Apr 30, 2010 6:18pm
Dmitri Livotov
1 decade ago Apr 30, 2010 7:08pm
Sami Ekblad
1 decade ago May 01, 2010 7:58am
André Schild
1 decade ago May 01, 2010 10:01am
Sami Ekblad
1 decade ago May 01, 2010 12:20pm
André Schild
1 decade ago May 03, 2010 10:25am
André Schild
1 decade ago May 05, 2010 10:31am
Sami Ekblad
1 decade ago May 05, 2010 10:47am
Michael Grove
1 decade ago May 21, 2010 5:17pm
Michael Grove
1 decade ago May 21, 2010 5:27pm
Sami Ekblad
1 decade ago May 21, 2010 5:36pm
Michael Grove
1 decade ago May 21, 2010 5:53pm
Michael Grove
1 decade ago May 21, 2010 7:27pm
Sami Ekblad
1 decade ago May 21, 2010 7:37pm
Michael Grove
1 decade ago May 21, 2010 8:50pm
André Schild
1 decade ago May 21, 2010 9:06pm
Sami Ekblad
1 decade ago May 22, 2010 6:12am
Sami Ekblad
1 decade ago May 23, 2010 12:53pm
Michael Grove
1 decade ago May 24, 2010 1:13pm
Michael Grove
1 decade ago May 24, 2010 1:44pm
Sami Ekblad
1 decade ago May 24, 2010 2:08pm
Michael Grove
1 decade ago May 24, 2010 3:13pm
Michael Grove
1 decade ago May 24, 2010 8:38pm
Sami Ekblad
1 decade ago May 24, 2010 9:01pm
Michael Grove
1 decade ago May 24, 2010 9:35pm
Michael Grove
1 decade ago May 24, 2010 10:21pm
André Schild
1 decade ago Jun 01, 2010 2:36pm
Sami Ekblad
1 decade ago Jun 01, 2010 2:42pm
Michael Grove
1 decade ago Jun 02, 2010 1:09pm
André Schild
1 decade ago Jun 02, 2010 3:43pm
dinko ivanov
1 decade ago Jul 30, 2010 10:49am
Sami Ekblad
1 decade ago Aug 03, 2010 8:43am
Sami Ekblad
1 decade ago Aug 03, 2010 4:52pm

Ok, I updated the Overlays add-on to version 0.9.8. Get it at vaadin.com/addon/overlays. Also slightly updated the demo to add sample with fade animations.

This version fixes the removeComponent problem as well as visibility toggling. There still are problems in certain kind of applications with scrolling, but I extracted the needed to fix this CSS as a sample code at the add-on info page.

Raman Gupta
1 decade ago Sep 05, 2010 8:26pm
Sami Ekblad
1 decade ago Sep 07, 2010 12:31pm
Jouni Koivuviita
1 decade ago Sep 07, 2010 2:24pm
Mark Waschkowski
1 decade ago Sep 14, 2010 7:46pm
Raman Gupta
1 decade ago Sep 22, 2010 1:20am
Sami Ekblad
1 decade ago Sep 22, 2010 11:33am