79 lines
1.7 KiB
Java
79 lines
1.7 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.portlets.user.dataminermanager.client.widgets;
|
|
|
|
import java.util.Map;
|
|
|
|
import com.google.gwt.resources.client.ImageResource;
|
|
import com.google.gwt.user.client.ui.HTML;
|
|
import com.google.gwt.user.client.ui.Image;
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;
|
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
|
|
|
/**
|
|
*
|
|
* @author Giancarlo Panichi
|
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class Section extends SimpleContainer {
|
|
|
|
private VerticalLayoutContainer v;
|
|
|
|
|
|
public Section(String title, ImageResource img) {
|
|
super();
|
|
v = new VerticalLayoutContainer();
|
|
v.addStyleName("jobViewer-section");
|
|
createHeader(title, img);
|
|
add(v);
|
|
}
|
|
|
|
public Section(String title, ImageResource img, Map<String, String> map) {
|
|
super();
|
|
v = new VerticalLayoutContainer();
|
|
v.addStyleName("jobViewer-section");
|
|
createHeader(title, img);
|
|
addMap(map);
|
|
|
|
add(v);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private void createHeader(String title, ImageResource img) {
|
|
HorizontalLayoutContainer hp = new HorizontalLayoutContainer();
|
|
hp.addStyleName("jobViewer-section-header");
|
|
|
|
if (img!=null) {
|
|
Image image = new Image(img);
|
|
image.addStyleName("jobViewer-section-header-image");
|
|
hp.add(image);
|
|
}
|
|
|
|
if (title!=null) {
|
|
HTML htmlTitle = new HTML(title);
|
|
htmlTitle.addStyleName("jobViewer-section-header-title");
|
|
hp.add(htmlTitle);
|
|
}
|
|
|
|
v.add(hp);
|
|
}
|
|
|
|
|
|
public void add(Widget widget) {
|
|
v.add(widget);
|
|
}
|
|
|
|
public void addMap(Map<String, String> map) {
|
|
v.add(new HashMapViewer(map));
|
|
}
|
|
|
|
|
|
|
|
}
|