added support for images almost complete
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@71053 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
17b18d7926
commit
d1b7b9fbcf
|
@ -1,4 +1,5 @@
|
||||||
|
#Thu Mar 07 16:00:56 CET 2013
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/home/gioia/workspace/reports/target/reports-4.1.0-SNAPSHOT
|
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.1.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -178,6 +178,12 @@
|
||||||
<version>10.8.2.2</version>
|
<version>10.8.2.2</version>
|
||||||
<scope>${setScope}</scope>
|
<scope>${setScope}</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>1.2.2</version>
|
||||||
|
<scope>${setScope}</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>portal-service</artifactId>
|
<artifactId>portal-service</artifactId>
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.gcube.portlets.user.exporter.client.ReportExporterPopup;
|
||||||
import org.gcube.portlets.user.exporter.client.event.ReportExporterEvent;
|
import org.gcube.portlets.user.exporter.client.event.ReportExporterEvent;
|
||||||
import org.gcube.portlets.user.exporter.client.event.ReportExporterEventHandler;
|
import org.gcube.portlets.user.exporter.client.event.ReportExporterEventHandler;
|
||||||
import org.gcube.portlets.user.exporter.shared.TypeExporter;
|
import org.gcube.portlets.user.exporter.shared.TypeExporter;
|
||||||
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
|
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.TitleBar;
|
import org.gcube.portlets.user.reportgenerator.client.TitleBar;
|
||||||
|
@ -20,7 +19,6 @@ import org.gcube.portlets.user.reportgenerator.client.WorkspacePanel;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.AddBiblioEntryDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.AddBiblioEntryDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.DeleteCitationsDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.DeleteCitationsDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.ReportStructureDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.ReportStructureDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.LoadingPopup;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEvent;
|
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEvent;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEventHandler;
|
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEventHandler;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.events.AddCommentEvent;
|
import org.gcube.portlets.user.reportgenerator.client.events.AddCommentEvent;
|
||||||
|
@ -38,13 +36,12 @@ import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
|
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
|
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.targets.ClientImage;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.Coords;
|
import org.gcube.portlets.user.reportgenerator.client.targets.Coords;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.DroppingArea;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
|
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
||||||
|
@ -53,8 +50,6 @@ import org.gcube.portlets.user.reportgenerator.shared.UserBean;
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.event.shared.SimpleEventBus;
|
import com.google.gwt.event.shared.SimpleEventBus;
|
||||||
|
@ -62,14 +57,9 @@ import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
|
||||||
import com.google.gwt.user.client.ui.CellPanel;
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
||||||
import com.google.gwt.user.client.ui.RichTextArea;
|
import com.google.gwt.user.client.ui.RichTextArea;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1000,13 +990,9 @@ public class Presenter {
|
||||||
wp.addComponentToLayout(textArea, component.isDoubleColLayout());
|
wp.addComponentToLayout(textArea, component.isDoubleColLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
case STATIC_IMAGE:
|
|
||||||
ImageArea imgToPlace = (ImageArea) component.getContent();
|
|
||||||
wp.addComponentToLayout(imgToPlace, component.isDoubleColLayout());
|
|
||||||
break;
|
break;
|
||||||
case DYNA_IMAGE:
|
case DYNA_IMAGE:
|
||||||
DroppingArea imageDropping = (DroppingArea) component.getContent();
|
ClientImage imageDropping = (ClientImage) component.getContent();
|
||||||
wp.addComponentToLayout(imageDropping, component.isDoubleColLayout());
|
wp.addComponentToLayout(imageDropping, component.isDoubleColLayout());
|
||||||
break;
|
break;
|
||||||
case FAKE_TEXTAREA:
|
case FAKE_TEXTAREA:
|
||||||
|
|
|
@ -13,8 +13,6 @@ import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||||
*
|
|
||||||
* @version April 2012 (1.1)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ToolboxPanel extends SimplePanel {
|
public class ToolboxPanel extends SimplePanel {
|
||||||
|
|
|
@ -16,22 +16,19 @@ import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
|
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
|
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.targets.ClientImage;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
|
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.DropImageListener;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
|
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.DroppingArea;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
|
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingInnerArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingInnerArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
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.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +43,8 @@ public class TemplateComponent {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final static String DEFAULT_IMAGE_PATH= GWT.getModuleBaseURL() + "../images/organization_logo.jpg";
|
public final static String DEFAULT_IMAGE_NAME= "image_placeholder.png";
|
||||||
|
public final static String DEFAULT_IMAGE_PATH= GWT.getModuleBaseURL() + "../images/" + DEFAULT_IMAGE_NAME;
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
|
@ -166,34 +164,22 @@ public class TemplateComponent {
|
||||||
|
|
||||||
switch (sc.getType()) {
|
switch (sc.getType()) {
|
||||||
case DYNA_IMAGE:
|
case DYNA_IMAGE:
|
||||||
DroppingArea dp;
|
ClientImage dp = new ClientImage(sc, presenter, sc.getWidth());
|
||||||
String possibelContent = ((String) sc.getPossibleContent());
|
|
||||||
if (possibelContent.startsWith("http")) {
|
|
||||||
dp = new DroppingArea(presenter, width, height,possibelContent);
|
|
||||||
|
|
||||||
dp.showImage(new Image(possibelContent));
|
|
||||||
}
|
|
||||||
else if (possibelContent.startsWith("/"))
|
|
||||||
dp = new DroppingArea(presenter, width, height, "");
|
|
||||||
else if (sc.getPossibleContent().equals(DEFAULT_IMAGE_PATH)) {
|
|
||||||
dp = new DroppingArea(presenter, width, height, "");
|
|
||||||
} else {
|
|
||||||
dp = new DroppingArea(presenter, width, height, possibelContent);
|
|
||||||
}
|
|
||||||
dp.setPixelSize(width, height);
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
DropImageListener dropListener = new DropImageListener(dp);
|
|
||||||
|
|
||||||
this.content = dp;
|
this.content = dp;
|
||||||
break;
|
|
||||||
case STATIC_IMAGE:
|
|
||||||
String imagePath = (String) sc.getPossibleContent();
|
|
||||||
|
|
||||||
ImageArea img = new ImageArea(presenter, imagePath, myModel.getTemplateName(), true, width, height);
|
// String possibelContent = ((String) sc.getPossibleContent());
|
||||||
img.setPixelSize(width, height);
|
// if (possibelContent.startsWith("http")) {
|
||||||
this.content = img;
|
// dp = new ClientImage(presenter, width, height,possibelContent);
|
||||||
|
//
|
||||||
|
// dp.showImage(new Image(possibelContent));
|
||||||
|
// }
|
||||||
|
// else if (possibelContent.startsWith("/"))
|
||||||
|
// dp = new DroppingArea(presenter, width, height, "");
|
||||||
|
// else if (sc.getPossibleContent().equals(DEFAULT_IMAGE_PATH)) {
|
||||||
|
// dp = new DroppingArea(presenter, width, height, "");
|
||||||
|
// } else {
|
||||||
|
// dp = new DroppingArea(presenter, width, height, possibelContent);
|
||||||
|
// }
|
||||||
break;
|
break;
|
||||||
case HEADING_1:
|
case HEADING_1:
|
||||||
case HEADING_2:
|
case HEADING_2:
|
||||||
|
@ -362,18 +348,13 @@ public class TemplateComponent {
|
||||||
String id = "";
|
String id = "";
|
||||||
switch (this.getType()) {
|
switch (this.getType()) {
|
||||||
case DYNA_IMAGE:
|
case DYNA_IMAGE:
|
||||||
DroppingArea da = (DroppingArea) this.content;
|
ClientImage da = (ClientImage) this.content;
|
||||||
content = da.getDroppedImage().getUrl();
|
content = da.getDroppedImage().getUrl();
|
||||||
id = da.getIdInBasket();
|
id = da.getIdInBasket();
|
||||||
idInBasket = id;
|
idInBasket = id;
|
||||||
if (((String) content).compareTo("") == 0)
|
if (((String) content).compareTo("") == 0)
|
||||||
content = DEFAULT_IMAGE_PATH;
|
content = DEFAULT_IMAGE_PATH;
|
||||||
break;
|
break;
|
||||||
case STATIC_IMAGE:
|
|
||||||
ImageArea tmp = ((ImageArea) this.content);
|
|
||||||
String imageName = tmp.getImageName();
|
|
||||||
content = tmp.getUrl();
|
|
||||||
break;
|
|
||||||
case BODY:
|
case BODY:
|
||||||
if (this.isLocked()) {
|
if (this.isLocked()) {
|
||||||
content = ((HTML) this.content).getHTML();
|
content = ((HTML) this.content).getHTML();
|
||||||
|
|
|
@ -30,7 +30,6 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
* The <code> TemplateModel </code> class represents the current Template state, the model in the the MVC pattern
|
* The <code> TemplateModel </code> class represents the current Template state, the model in the the MVC pattern
|
||||||
*
|
*
|
||||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||||
* @version July 2011 (3.0)
|
|
||||||
*/
|
*/
|
||||||
public class TemplateModel {
|
public class TemplateModel {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,327 @@
|
||||||
|
package org.gcube.portlets.user.reportgenerator.client.targets;
|
||||||
|
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
|
||||||
|
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
|
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
||||||
|
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.ItemType;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupHandler;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.load.WorkspaceLightTreeLoadPopup;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.core.client.RunAsyncCallback;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Button;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
|
import com.google.gwt.user.client.ui.TextBox;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||||
|
*/
|
||||||
|
public class ClientImage extends Composite {
|
||||||
|
|
||||||
|
private String expectedContent = "";
|
||||||
|
|
||||||
|
private final String METADATA_TITLE_KEY = "title";
|
||||||
|
private final String METADATA_DESC_KEY = "description";
|
||||||
|
private final String METADATA_SOURCE_KEY = "source";
|
||||||
|
|
||||||
|
private VerticalPanel mainPanel = new VerticalPanel();
|
||||||
|
private SimplePanel imagePanel = new SimplePanel();
|
||||||
|
private Image currImage;
|
||||||
|
private Presenter presenter;
|
||||||
|
|
||||||
|
private String idInBasket;
|
||||||
|
|
||||||
|
private String currentUser;
|
||||||
|
private String currentScope;
|
||||||
|
|
||||||
|
private final int DEFAULT_HEIGHT = 100;
|
||||||
|
|
||||||
|
private TextBox titleTB = new TextBox();
|
||||||
|
private TextBox descTB = new TextBox();
|
||||||
|
private TextBox sourceTB = new TextBox();
|
||||||
|
|
||||||
|
private Button resetB = new Button("Clear Image");
|
||||||
|
private Button addImageB = new Button("Select Image");
|
||||||
|
private Button uploadImageB = new Button("Upload Image");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param presenter
|
||||||
|
* @param width
|
||||||
|
* @param tag
|
||||||
|
*/
|
||||||
|
public ClientImage(BasicComponent co, Presenter presenter, int width) {
|
||||||
|
this.presenter = presenter;
|
||||||
|
|
||||||
|
HorizontalPanel controlPanel = getControlPanel();
|
||||||
|
VerticalPanel attributesPanel = getAttributesPanel(co);
|
||||||
|
mainPanel.add(controlPanel);
|
||||||
|
mainPanel.add(imagePanel);
|
||||||
|
mainPanel.add(attributesPanel);
|
||||||
|
|
||||||
|
mainPanel.setWidth((TemplateModel.TEMPLATE_WIDTH-95)+"px");
|
||||||
|
imagePanel.setSize(width+"px", DEFAULT_HEIGHT+"px");
|
||||||
|
attributesPanel.setWidth((TemplateModel.TEMPLATE_WIDTH-95)+"px");
|
||||||
|
|
||||||
|
mainPanel.setStyleName("imageWrapperPanel");
|
||||||
|
imagePanel.setStyleName("imagePanel");
|
||||||
|
controlPanel.setStyleName("tableControlPanel");
|
||||||
|
attributesPanel.setStyleName("tableAttributesPanel");
|
||||||
|
|
||||||
|
String imageURL = (String) co.getPossibleContent();
|
||||||
|
|
||||||
|
if (imageURL == null || imageURL.trim().compareTo("") == 0 || imageURL.endsWith(TemplateComponent.DEFAULT_IMAGE_NAME)) {
|
||||||
|
GWT.log("Empty ImageUrl="+imageURL);
|
||||||
|
imagePanel.addStyleName("imageEmptyPanel");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GWT.log("Found ImageUrl="+imageURL);
|
||||||
|
showImage(new Image(imageURL));
|
||||||
|
}
|
||||||
|
|
||||||
|
//set style for buttons
|
||||||
|
for (int i = 0; i < controlPanel.getWidgetCount(); i++) {
|
||||||
|
if (controlPanel.getWidget(i) instanceof Button) {
|
||||||
|
Button b = (Button) controlPanel.getWidget(i);
|
||||||
|
b.addStyleName("tableButton");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initWidget(mainPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HorizontalPanel getControlPanel() {
|
||||||
|
final HorizontalPanel toReturn = new HorizontalPanel();
|
||||||
|
|
||||||
|
resetB.addClickHandler(new ClickHandler() {
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addImageB.addClickHandler(new ClickHandler() {
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
openFileExplorer(addImageB.getAbsoluteLeft(), addImageB.getAbsoluteTop());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
uploadImageB.addClickHandler(new ClickHandler() {
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
toReturn.setSpacing(3);
|
||||||
|
|
||||||
|
toReturn.add(uploadImageB);
|
||||||
|
toReturn.add(resetB);
|
||||||
|
toReturn.add(addImageB);
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VerticalPanel getAttributesPanel(BasicComponent co) {
|
||||||
|
VerticalPanel toReturn = new VerticalPanel();
|
||||||
|
|
||||||
|
for (Metadata md : co.getMetadata()) {
|
||||||
|
if (md.getAttribute().compareTo(METADATA_TITLE_KEY) == 0)
|
||||||
|
titleTB.setText(md.getValue());
|
||||||
|
if (md.getAttribute().compareTo(METADATA_DESC_KEY) == 0)
|
||||||
|
descTB.setText(md.getValue());
|
||||||
|
if (md.getAttribute().compareTo(METADATA_SOURCE_KEY) == 0)
|
||||||
|
sourceTB.setText(md.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalPanel hp1 = new HorizontalPanel();
|
||||||
|
HTML title = new HTML("Title: <span style=\"color: red;\">* </span>", true);
|
||||||
|
hp1.add(title);
|
||||||
|
hp1.add(titleTB);
|
||||||
|
titleTB.setWidth("135px");
|
||||||
|
|
||||||
|
|
||||||
|
HTML desc = new HTML(" Description: ", true);
|
||||||
|
|
||||||
|
HTML source = new HTML("Source: ", true);
|
||||||
|
|
||||||
|
|
||||||
|
hp1.add(desc);
|
||||||
|
hp1.add(descTB);
|
||||||
|
descTB.setWidth("435px");
|
||||||
|
toReturn.add(hp1);
|
||||||
|
|
||||||
|
toReturn.add(source);
|
||||||
|
toReturn.add(sourceTB);
|
||||||
|
sourceTB.setWidth("693px");
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(Widget w) {
|
||||||
|
mainPanel.add(w);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* called when dropped an image on the area
|
||||||
|
* @param toShow the image to show
|
||||||
|
*/
|
||||||
|
public void showImage(Image toShow) {
|
||||||
|
imagePanel.clear();
|
||||||
|
this.currImage = toShow;
|
||||||
|
toShow.setWidth(toShow.getWidth()+"px");
|
||||||
|
imagePanel.setSize(toShow.getWidth()+"px", toShow.getHeight()+"px");
|
||||||
|
imagePanel.add(toShow);
|
||||||
|
presenter.storeChangeInSession(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param url .
|
||||||
|
* @param id the id in the folder
|
||||||
|
*/
|
||||||
|
public void dropImage(String url, String id)
|
||||||
|
{
|
||||||
|
GWT.log("URL:" + url, null);
|
||||||
|
idInBasket = id;
|
||||||
|
showImage(new Image(url));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fetchImage(String identifier, final boolean isInteralImage, boolean fullDetails) {
|
||||||
|
ReportGenerator.get().getWSTreeService().getImageById(identifier, isInteralImage, fullDetails, new AsyncCallback<GWTWorkspaceItem>() {
|
||||||
|
|
||||||
|
public void onSuccess(GWTWorkspaceItem result) {
|
||||||
|
if (isInteralImage) {
|
||||||
|
GWTImageDocument image = (GWTImageDocument) result;
|
||||||
|
dropImage(image.getImageUrl(), image.getId());
|
||||||
|
} else {
|
||||||
|
GWTExternalImage image = (GWTExternalImage) result;
|
||||||
|
dropImage(image.getImageUrl(), image.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert("Could not fetch image from infrastructure " + caught.getCause());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the image
|
||||||
|
*/
|
||||||
|
public Image getDroppedImage() {
|
||||||
|
if (currImage == null)
|
||||||
|
return new Image();
|
||||||
|
return currImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return a URL which is lookable for on the web
|
||||||
|
* @param imageName .
|
||||||
|
* @param templateName .
|
||||||
|
* @return .
|
||||||
|
*/
|
||||||
|
public String getImageURL(String imageName, String templateName) {
|
||||||
|
currentUser = presenter.getCurrentUser().getUsername();
|
||||||
|
currentScope = presenter.getCurrentScope();
|
||||||
|
/**
|
||||||
|
* Images will be stored under webapps/usersArea...
|
||||||
|
* GWT.getModuleBaseURL() returns * e.g. http://dlib28.isti.cnr.it/templatecreator/html/
|
||||||
|
* need to get just http://dlib28.isti.cnr.it/
|
||||||
|
*/
|
||||||
|
//remove "/html/" and get e.g. http://dlib28.isti.cnr.it/templatecreator
|
||||||
|
String host = GWT.getModuleBaseURL().substring(0, GWT.getModuleBaseURL().length()-6);
|
||||||
|
|
||||||
|
//loog for last slash
|
||||||
|
int lastSlash = host.lastIndexOf("/");
|
||||||
|
|
||||||
|
//get what i need : e.g. http://dlib28.isti.cnr.it/ or host = "http://localhost:8080/";
|
||||||
|
host = host.substring(0, lastSlash +1 );
|
||||||
|
//host = "http://localhost:8080/";
|
||||||
|
|
||||||
|
String imgURL = host + "usersArea/" + currentScope + "/templates/"
|
||||||
|
+ currentUser + "/CURRENT_OPEN/images/" + imageName;
|
||||||
|
|
||||||
|
return imgURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return .
|
||||||
|
*/
|
||||||
|
public String getIdInBasket() {
|
||||||
|
return idInBasket;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idInBasket .
|
||||||
|
*/
|
||||||
|
public void setIdInBasket(String idInBasket) {
|
||||||
|
this.idInBasket = idInBasket;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return expectedContent
|
||||||
|
*/
|
||||||
|
public String getExpectedContent() {
|
||||||
|
return expectedContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param expectedContent .
|
||||||
|
*/
|
||||||
|
public void setExpectedContent(String expectedContent) {
|
||||||
|
this.expectedContent = expectedContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openFileExplorer(final int left, final int top) {
|
||||||
|
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
|
||||||
|
public void onSuccess() {
|
||||||
|
|
||||||
|
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Select the Image", true, true);
|
||||||
|
wpTreepopup.setShowableTypes(ItemType.IMAGE_DOCUMENT, ItemType.EXTERNAL_IMAGE);
|
||||||
|
wpTreepopup.setSelectableTypes(ItemType.IMAGE_DOCUMENT, ItemType.EXTERNAL_IMAGE);
|
||||||
|
|
||||||
|
wpTreepopup.addPopupHandler(new PopupHandler() {
|
||||||
|
public void onPopup(PopupEvent event) {
|
||||||
|
if (! event.isCanceled()) {
|
||||||
|
if (event.getSelectedItem() != null) {
|
||||||
|
if (event.getSelectedItem().getType() == ItemType.IMAGE_DOCUMENT)
|
||||||
|
fetchImage(event.getSelectedItem().getId(), true, true);
|
||||||
|
else
|
||||||
|
fetchImage(event.getSelectedItem().getId(), false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wpTreepopup.setPopupPosition(left, top);
|
||||||
|
wpTreepopup.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onFailure(Throwable reason) {
|
||||||
|
Window.alert("There are networks problem, please check your connection.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,122 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.reportgenerator.client.targets;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItemType;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.GWTFolderItem;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.GWTFolderItemType;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
|
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.dnd.DropTarget;
|
|
||||||
import com.extjs.gxt.ui.client.dnd.Insert;
|
|
||||||
import com.extjs.gxt.ui.client.dnd.DND.Operation;
|
|
||||||
import com.extjs.gxt.ui.client.event.DNDEvent;
|
|
||||||
import com.extjs.gxt.ui.client.store.TreeStoreModel;
|
|
||||||
import com.extjs.gxt.ui.client.widget.Html;
|
|
||||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Massimiliano Assante assante@isti.cnr.it
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class DropImageListener extends DropTarget {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static final String TIFF = "image/tiff";
|
|
||||||
|
|
||||||
protected DroppingArea panel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param panel .
|
|
||||||
* @param config .
|
|
||||||
*/
|
|
||||||
public DropImageListener(DroppingArea panel) {
|
|
||||||
super(panel);
|
|
||||||
this.panel = panel;
|
|
||||||
//IMPORTANT
|
|
||||||
setOperation(Operation.COPY);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void showFeedback(DNDEvent event) {
|
|
||||||
if (!isValidDropTarget(event)) {
|
|
||||||
Insert.get().hide();
|
|
||||||
event.getStatus().setStatus(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
super.showFeedback(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private boolean isValidDropTarget(DNDEvent event) {
|
|
||||||
GWT.log("isValidDropTarget");
|
|
||||||
TreePanel<FileModel> source = (TreePanel<FileModel>) event.getDragSource().getComponent();
|
|
||||||
List<FileModel> selection = source.getSelectionModel().getSelection();
|
|
||||||
|
|
||||||
for (FileModel model : selection) {
|
|
||||||
GWT.log("selection: " + model.getGXTFolderItemType());
|
|
||||||
if(model.getGXTFolderItemType()!=null){
|
|
||||||
|
|
||||||
if (model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE) || model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT))
|
|
||||||
return true;
|
|
||||||
//
|
|
||||||
// if (model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.TIME_SERIES))
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// if(source.getStore().getParent(model) == target.getModel())
|
|
||||||
// return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param source .
|
|
||||||
* @param e .
|
|
||||||
* @param data .
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
protected void onDragDrop(DNDEvent event) {
|
|
||||||
|
|
||||||
super.onDragDrop(event);
|
|
||||||
|
|
||||||
if(event.getData() != null){
|
|
||||||
List<TreeStoreModel> listItemsSource = event.getData();
|
|
||||||
GWT.log("Number of move " + listItemsSource.size());
|
|
||||||
|
|
||||||
FileModel sourceFileModel = null; //for print
|
|
||||||
|
|
||||||
for(TreeStoreModel itemSource : listItemsSource){
|
|
||||||
|
|
||||||
sourceFileModel = (FileModel) itemSource.getModel();
|
|
||||||
|
|
||||||
if(sourceFileModel.getParentFileModel()!=null)
|
|
||||||
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
|
|
||||||
else
|
|
||||||
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
|
|
||||||
|
|
||||||
GWT.log("Child count: " + itemSource.getChildCount());
|
|
||||||
|
|
||||||
panel.fetchImage(sourceFileModel.getIdentifier(), false , true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,214 +0,0 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.targets;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.widget.Component;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.user.client.Window;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
|
||||||
import com.google.gwt.user.client.ui.HasAlignment;
|
|
||||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
|
||||||
import com.google.gwt.user.client.ui.Image;
|
|
||||||
import com.google.gwt.user.client.ui.Label;
|
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <code> DroppingArea </code> class is a Widget you can drop image on
|
|
||||||
*
|
|
||||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
|
||||||
* @version May 20012 (3.5)
|
|
||||||
*/
|
|
||||||
public class DroppingArea extends Component {
|
|
||||||
|
|
||||||
private String expectedContent = "";
|
|
||||||
|
|
||||||
private VerticalPanel mainPanel;
|
|
||||||
private Image droppedImage;
|
|
||||||
private Presenter presenter;
|
|
||||||
|
|
||||||
private String idInBasket;
|
|
||||||
|
|
||||||
private String currentUser;
|
|
||||||
private String currentScope;
|
|
||||||
|
|
||||||
Label label;
|
|
||||||
|
|
||||||
private int width, height;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param presenter .
|
|
||||||
* @param width .
|
|
||||||
* @param height .
|
|
||||||
* @param tag the label to display
|
|
||||||
*/
|
|
||||||
public DroppingArea(Presenter presenter, int width, int height, String tag) {
|
|
||||||
if (tag.equals("")) {
|
|
||||||
tag = "No suggestions available";
|
|
||||||
}
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
this.presenter = presenter;
|
|
||||||
mainPanel = new VerticalPanel();
|
|
||||||
super.setWidth(width+"px");
|
|
||||||
super.setHeight(height+"px");
|
|
||||||
mainPanel.setWidth(width+"px");
|
|
||||||
mainPanel.setHeight(height+"px");
|
|
||||||
setElement(mainPanel.getElement());
|
|
||||||
|
|
||||||
addStyleName("droppingArea-Image");
|
|
||||||
|
|
||||||
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
|
|
||||||
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
|
||||||
|
|
||||||
label = new Label(tag);
|
|
||||||
label.addStyleName("label");
|
|
||||||
mainPanel.add(label);
|
|
||||||
|
|
||||||
droppedImage = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Widget w) {
|
|
||||||
mainPanel.add(w);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* called when dropped an image on the area
|
|
||||||
* @param toShow the image to show
|
|
||||||
*/
|
|
||||||
public void showImage(Image toShow) {
|
|
||||||
|
|
||||||
//mainPanel.remove(label);
|
|
||||||
mainPanel.clear();
|
|
||||||
this.droppedImage = toShow;
|
|
||||||
toShow.setPixelSize(width, height);
|
|
||||||
|
|
||||||
mainPanel.add(toShow);
|
|
||||||
presenter.storeChangeInSession(this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param url .
|
|
||||||
* @param id the id in the folder
|
|
||||||
*/
|
|
||||||
public void dropImage(String url, String id)
|
|
||||||
{
|
|
||||||
GWT.log("URL:" + url, null);
|
|
||||||
idInBasket = id;
|
|
||||||
showImage(new Image(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fetchImage(String identifier, boolean isInteralImage, boolean fullDetails) {
|
|
||||||
this.mask("fetching image, pleas wait", "loading-indicator");
|
|
||||||
ReportGenerator.get().getWSTreeService().getImageById(identifier, isInteralImage, fullDetails, new AsyncCallback<GWTWorkspaceItem>() {
|
|
||||||
|
|
||||||
public void onSuccess(GWTWorkspaceItem result) {
|
|
||||||
unmask();
|
|
||||||
GWTExternalImage image = (GWTExternalImage) result;
|
|
||||||
dropImage(image.getImageUrl(), image.getId());
|
|
||||||
}
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
unmask();
|
|
||||||
Window.alert("Could not fetch image from infrastructure " + caught.getCause());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return the image
|
|
||||||
*/
|
|
||||||
public Image getDroppedImage() {
|
|
||||||
if (droppedImage == null)
|
|
||||||
return new Image();
|
|
||||||
return droppedImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return the possible content
|
|
||||||
*/
|
|
||||||
public Label getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param label set the label
|
|
||||||
*/
|
|
||||||
public void setLabel(Label label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a URL which is lookable for on the web
|
|
||||||
* @param imageName .
|
|
||||||
* @param templateName .
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
public String getImageURL(String imageName, String templateName) {
|
|
||||||
currentUser = presenter.getCurrentUser().getUsername();
|
|
||||||
currentScope = presenter.getCurrentScope();
|
|
||||||
/**
|
|
||||||
* Images will be stored under webapps/usersArea...
|
|
||||||
* GWT.getModuleBaseURL() returns * e.g. http://dlib28.isti.cnr.it/templatecreator/html/
|
|
||||||
* need to get just http://dlib28.isti.cnr.it/
|
|
||||||
*/
|
|
||||||
//remove "/html/" and get e.g. http://dlib28.isti.cnr.it/templatecreator
|
|
||||||
String host = GWT.getModuleBaseURL().substring(0, GWT.getModuleBaseURL().length()-6);
|
|
||||||
|
|
||||||
//loog for last slash
|
|
||||||
int lastSlash = host.lastIndexOf("/");
|
|
||||||
|
|
||||||
//get what i need : e.g. http://dlib28.isti.cnr.it/ or host = "http://localhost:8080/";
|
|
||||||
host = host.substring(0, lastSlash +1 );
|
|
||||||
//host = "http://localhost:8080/";
|
|
||||||
|
|
||||||
String imgURL = host + "usersArea/" + currentScope + "/templates/"
|
|
||||||
+ currentUser + "/CURRENT_OPEN/images/" + imageName;
|
|
||||||
|
|
||||||
return imgURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
public String getIdInBasket() {
|
|
||||||
return idInBasket;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param idInBasket .
|
|
||||||
*/
|
|
||||||
public void setIdInBasket(String idInBasket) {
|
|
||||||
this.idInBasket = idInBasket;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return expectedContent
|
|
||||||
*/
|
|
||||||
public String getExpectedContent() {
|
|
||||||
return expectedContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param expectedContent .
|
|
||||||
*/
|
|
||||||
public void setExpectedContent(String expectedContent) {
|
|
||||||
this.expectedContent = expectedContent;
|
|
||||||
if (expectedContent.compareTo("") != 0)
|
|
||||||
label.setText(expectedContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.targets;
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.user.client.Window;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
|
||||||
import com.google.gwt.user.client.ui.Image;
|
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
/**
|
|
||||||
* <code> ImageArea </code> class is the Widget that goes into the workspace
|
|
||||||
*
|
|
||||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
|
||||||
* @version October 2008 (0.2)
|
|
||||||
*/
|
|
||||||
public class ImageArea extends Composite {
|
|
||||||
|
|
||||||
private String templateName;
|
|
||||||
private String imageName;
|
|
||||||
|
|
||||||
private String currentUser;
|
|
||||||
private String currentScope;
|
|
||||||
|
|
||||||
VerticalPanel myPanel;
|
|
||||||
Image myImage = new Image();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an image with a specified URL. The load event will be fired once
|
|
||||||
* the image at the given URL has been retrieved by the browser.
|
|
||||||
*
|
|
||||||
* @param presenter .
|
|
||||||
* @param param the imageName of the image to be displayed or the URL to be displayed depending on the isURL param
|
|
||||||
* @param myTemplate the template name that owns the image, useful when template it's saved with another name
|
|
||||||
* to eventually copy the images in the new template images folder
|
|
||||||
* @param isURL true if passing a URL, false is passing image name
|
|
||||||
* @param w width
|
|
||||||
* @param h height
|
|
||||||
*/
|
|
||||||
public ImageArea(Presenter presenter, String param, String myTemplate, boolean isURL, int w, int h) {
|
|
||||||
myPanel = new VerticalPanel();
|
|
||||||
currentUser = presenter.getCurrentUser().getUsername();
|
|
||||||
currentScope = presenter.getCurrentScope();
|
|
||||||
//Window.alert("Image Area");
|
|
||||||
|
|
||||||
if (isURL) {
|
|
||||||
//need to get the name from the URL
|
|
||||||
int lastSlash = param.lastIndexOf("/");
|
|
||||||
if (lastSlash > -1) {
|
|
||||||
imageName = param.substring(lastSlash+1, param.length());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
imageName = param;
|
|
||||||
this.templateName = "CURRENT_OPEN";
|
|
||||||
//Window.alert(param);
|
|
||||||
myImage.setUrl(param);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
imageName = param;
|
|
||||||
this.templateName = myTemplate;
|
|
||||||
|
|
||||||
String imgURL = getImageURL(imageName, "CURRENT_OPEN");
|
|
||||||
|
|
||||||
|
|
||||||
myImage.setUrl(imgURL);
|
|
||||||
}
|
|
||||||
myImage.setPixelSize(w, h);
|
|
||||||
myPanel.setStyleName("d4sFrame");
|
|
||||||
myPanel.add(myImage);
|
|
||||||
initWidget(myPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
public String getUrl() {
|
|
||||||
return myImage.getUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a URL which is lookable for on the web
|
|
||||||
* @param imageName .
|
|
||||||
* @param templateName .
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
public String getImageURL(String imageName, String templateName) {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Images will be stored under webapps/usersArea...
|
|
||||||
* GWT.getModuleBaseURL() returns * e.g. http://dlib28.isti.cnr.it/templatecreator/html/
|
|
||||||
* need to get just http://dlib28.isti.cnr.it/
|
|
||||||
*/
|
|
||||||
//remove "/html/" and get e.g. http://dlib28.isti.cnr.it/templatecreator
|
|
||||||
String host = GWT.getModuleBaseURL().substring(0, GWT.getModuleBaseURL().length()-6);
|
|
||||||
|
|
||||||
//loog for last slash
|
|
||||||
int lastSlash = host.lastIndexOf("/");
|
|
||||||
|
|
||||||
//get what i need : e.g. http://dlib28.isti.cnr.it/ or host = "http://localhost:8080/";
|
|
||||||
host = host.substring(0, lastSlash +1 );
|
|
||||||
//host = "http://localhost:8080/";
|
|
||||||
|
|
||||||
String imgURL = host + "usersArea/" + currentScope + "/templates/"
|
|
||||||
+ currentUser + "/" + "CURRENT_OPEN" + "/images/" + imageName;
|
|
||||||
GWT.log(imgURL);
|
|
||||||
return imgURL;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return a string containing the owner template name
|
|
||||||
*/
|
|
||||||
public String getTemplateName() {
|
|
||||||
return templateName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param myTemplate the template owner
|
|
||||||
*/
|
|
||||||
public void setTemplateName(String myTemplate) {
|
|
||||||
this.templateName = myTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
public String getImageName() {
|
|
||||||
return imageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param imageName .
|
|
||||||
*/
|
|
||||||
public void setImageName(String imageName) {
|
|
||||||
this.imageName = imageName;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return the scope in which the application is running on
|
|
||||||
*/
|
|
||||||
public String getCurrentScope() {
|
|
||||||
return currentScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return the user username who is using the application
|
|
||||||
*/
|
|
||||||
public String getCurrentUser() {
|
|
||||||
return currentUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -14,7 +14,7 @@
|
||||||
.addEntryButton {
|
.addEntryButton {
|
||||||
background-image: none !important;
|
background-image: none !important;
|
||||||
background-repeat: none !important;
|
background-repeat: none !important;
|
||||||
background-color: #02990C !important;
|
background-color: #02990C !important
|
||||||
color: #FFF !important;
|
color: #FFF !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,23 @@
|
||||||
width: 600px;
|
width: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imageWrapperPanel {
|
||||||
|
background-color: transparent;
|
||||||
|
border-bottom: 2px dashed #FFF;
|
||||||
|
margin: 8px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imagePanel {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imageEmptyPanel {
|
||||||
|
background: #FFF url('images/droppingImage_bg.gif') repeat !important;
|
||||||
|
}
|
||||||
|
|
||||||
.tablePanel {
|
.tablePanel {
|
||||||
border-bottom: 2px dashed #FFF;
|
border-bottom: 2px dashed #FFF;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Reference in New Issue