Usage is as simple as it can get. Just add a Lightbox2Panel to your Page/Panel or whatever component like this:
LightBox2Panel panel = new LightBox2Panel("myComponentId", new Model(myLightBoxConfig));
add(panel);
A LightBox2Config contains of a List of Pictures and thei Thumbnails. Additionally, you can pass a second list of Images to the Lightbox2Config, containing instances of HiddenLightBoxImage. Those will then not be be rendered as part of the list of thumbnails, but nevertheless added to the series of images that lightbox will show.
List<LightBoxImage> list = new LinkedList<LightBoxImage>();
list.add(new LightBoxImage("/images/pic1_fullsize.png","/images/pic1_thumbnail.png"));
list.add(new LightBoxImage("/images/pic2_fullsize.png","/images/pic2_thumbnail.png"));
list.add(new LightBoxImage("/images/pic3_fullsize.png","/images/pic3_thumbnail.png"
,"Imagefooter-text of Pic3"));
List<HiddenLightBoxImage> hiddenOnes = new LinkedList<HiddenLightBoxImage>();
hiddenOnes.add(new HiddenLightBoxImage("/images/pic4_fullsize.png"));
add(new LightBox2Panel("myComponentId", new Model(new LightBox2Config(list, hiddenOnes)));
As of 1.1, the Lightbox2Panel can be used in an Ajax-Context, just like any other component. An example:
Panel panel = new LightBox2Panel("myComponentId",
new PropertyModel(someDataModel,"lightboxConfig"));
add(panel);
[...]
DropDownChoice ddc = new DropDownChoice( [...] );
ddc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
protected void onUpdate(AjaxRequestTarget target) {
target.addComponent(panel);
}
});