You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.8 KiB
Java
107 lines
2.8 KiB
Java
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products;
|
|
|
|
import java.util.List;
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ImageView;
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
|
|
|
import com.github.gwtbootstrap.client.ui.Column;
|
|
import com.github.gwtbootstrap.client.ui.Heading;
|
|
import com.github.gwtbootstrap.client.ui.Label;
|
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
|
import com.github.gwtbootstrap.client.ui.Thumbnails;
|
|
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
|
import com.google.gwt.core.client.GWT;
|
|
import com.google.gwt.dom.client.Style.Unit;
|
|
import com.google.gwt.uibinder.client.UiBinder;
|
|
import com.google.gwt.uibinder.client.UiField;
|
|
import com.google.gwt.user.client.ui.Composite;
|
|
import com.google.gwt.user.client.ui.FlowPanel;
|
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
|
|
|
|
public class ConcessioneView extends Composite {
|
|
|
|
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
|
|
|
|
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
|
|
}
|
|
|
|
@UiField
|
|
Heading titolo;
|
|
|
|
@UiField
|
|
Paragraph introduzione;
|
|
|
|
@UiField
|
|
Column autori;
|
|
|
|
@UiField
|
|
Column contributore;
|
|
|
|
@UiField
|
|
HTMLPanel imagesPanel;
|
|
|
|
private ConcessioneDV concessioneDV;
|
|
|
|
private Thumbnails thumbNails = new Thumbnails();
|
|
|
|
public ConcessioneView() {
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
}
|
|
|
|
|
|
public ConcessioneView(ConcessioneDV concessioneDV) {
|
|
this();
|
|
this.concessioneDV = concessioneDV;
|
|
titolo.setText(concessioneDV.getNome());
|
|
introduzione.setText(concessioneDV.getIntroduzione());
|
|
|
|
for (String author : concessioneDV.getAuthors()) {
|
|
addLabel(autori, author);
|
|
//autori.add(new Label(author));
|
|
}
|
|
|
|
addLabel(contributore, concessioneDV.getContributore());
|
|
|
|
addImages();
|
|
}
|
|
|
|
private void addImages() {
|
|
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
|
if(immagini!=null && immagini.size()>0) {
|
|
imagesPanel.setVisible(true);
|
|
int i = 0;
|
|
for (UploadedImageDV uploadedImageDV : immagini) {
|
|
if(i==0)
|
|
imagesPanel.add(thumbNails);
|
|
|
|
thumbNails.add(new ImageView(uploadedImageDV));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public void addLabel(FlowPanel w, String labelValue, LabelType type){
|
|
Label label = new Label(labelValue);
|
|
label.setType(type);
|
|
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
|
w.add(label);
|
|
}
|
|
|
|
public void addLabel(FlowPanel w, String labelValue){
|
|
com.google.gwt.user.client.ui.Label label = new com.google.gwt.user.client.ui.Label(labelValue);
|
|
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
|
w.add(label);
|
|
}
|
|
|
|
public ConcessioneDV getConcessioneDV() {
|
|
return concessioneDV;
|
|
}
|
|
|
|
}
|