A Flickr Browser.
Mindnumbingly easy! Code below the fold.
// Create a Vertical stack
VerticalPanel vp = new VerticalPanel();
vp.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
// Create the FlickrSearch bean
FlickrSearch search = new FlickrSearch();
// Create the thumbnail image group:
ReflectedImageGroup group = new ReflectedImageGroup( 100, 75, .2, .5);
// Add a Renderer to extract the thumnail url from the Flickr results:
group.setRenderer( new Renderer(){
public Object render(Object o) {
return ((FlickrPhoto) o).getThumbnail();
}
});
// Bind the group to the Flickr bean
Binding images = new Binding(group, "value", search, "photos");
images.setLeft();
images.bind();
// Create a SoftScrollArea around the thumnails:
SoftScrollArea mmsa = new SoftScrollArea();
// Add the mouse move scroller to the area
mmsa.addMouseListener( mmsa.MOUSE_MOVE_SCROLL_LISTENER );
mmsa.setHeight( "190px" );
mmsa.setWidth( "800px" );
// Add the group to the scroll area
mmsa.setWidget( group);
vp.add( mmsa );
// Create the larger image
Image larger = new Image();
// Add a renderer to get the normal URL
larger.setRenderer( new Renderer(){
public Object render(Object o) {
return ((FlickrPhoto) o).getNormal();
}
});
// Bind the larger image to the "Selected" property of the group
Binding bigBinding = new Binding( larger, "value", group, "selected" );
bigBinding.bind();
vp.add( larger );
//Show the whole thing.
RootPanel.get().add( vp );
Chatter
3 days 13 hours ago
3 days 19 hours ago
1 week 17 hours ago
1 week 17 hours ago
1 week 3 days ago
4 weeks 1 day ago
4 weeks 2 days ago
4 weeks 4 days ago
4 weeks 6 days ago
5 weeks 2 days ago