added ClientMasterSequence

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@84709 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-10-30 17:50:22 +00:00
parent 9dea2bb6d8
commit 4e230df547
15 changed files with 257 additions and 60 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/reports-4.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/reports-4.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,6 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="output" path="target/reports-4.5.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry combineaccessrules="false" kind="src" path="/gcube-reporting-library"/>
<classpathentry kind="output" path="target/reports-4.6.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -2,6 +2,6 @@
<<<<<<<=.mine
>>>>>>>=.r71295
eclipse.preferences.version=1
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.5.0-SNAPSHOT
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -5,9 +5,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="report-exporter-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/report-exporter-widget/report-exporter-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="reports"/>
</wb-module>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>reports</artifactId>
<packaging>war</packaging>
<version>4.5.0-SNAPSHOT</version>
<version>4.6.0-SNAPSHOT</version>
<name>gCube Reports Portlet</name>
<description>
gCube Reports Portlet.
@ -147,7 +147,7 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>gcube-reporting-library</artifactId>
<version>[3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
<version>[3.4.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
<scope>${setScope}</scope>
</dependency>
<dependency>

View File

@ -42,6 +42,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSele
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.ClientImage;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientMasterSequence;
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.D4sRichTextarea;
@ -940,12 +941,11 @@ public class Presenter {
case BODY_NOT_FORMATTED:
if (component.isLocked()) {
HTML text = (HTML) component.getContent();
text.addStyleName("readOnlyText");
wp.addComponentToLayout(text, component.isDoubleColLayout());
}
else {
BasicTextArea textArea = (BasicTextArea) component.getContent();
// textArea.getMyInstance().setTop(uiY);
// textArea.getMyInstance().setLeft(uiX);
wp.addComponentToLayout(textArea, component.isDoubleColLayout());
}
@ -1020,6 +1020,10 @@ public class Presenter {
ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent();
wp.addComponentToLayout(rps, component.isDoubleColLayout());
break;
case MASTER_SEQUENCE_LIST:
ClientMasterSequence cmSeq = (ClientMasterSequence) component.getContent();
wp.addComponentToLayout(cmSeq, component.isDoubleColLayout());
break;
case BODY_TABLE_IMAGE:
TextTableImage tti = (TextTableImage) component.getContent();
wp.addComponentToLayout(tti, component.isDoubleColLayout());

View File

@ -29,10 +29,10 @@ public class ToolboxPanel extends SimplePanel {
public ToolboxPanel(AppControllerExplorer appController) {
this.appController = appController;
AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
this.tp = tp;
add(tp);
this.appController.hideSharingFacilities(); //sharing disabled we have problems from Reports
// AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
// this.tp = tp;
// add(tp);
// this.appController.hideSharingFacilities(); //sharing disabled we have problems from Reports
}
public void showExportedVersion(String id, String fileName) {

View File

@ -1,17 +1,18 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.widgets.lighttree.client.Item;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
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.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
@ -19,7 +20,6 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> ImporterDialog </code> class is is the Dialog for importing template or report sections
@ -27,7 +27,7 @@ import com.google.gwt.user.client.ui.Widget;
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2009 (1.4)
*/
public class ImporterDialog extends DialogBox {
public class ImporterDialog extends GCubeDialog {
/**
* this layout panel
@ -65,21 +65,32 @@ public class ImporterDialog extends DialogBox {
HorizontalPanel buttonsContainer = new HorizontalPanel();
// Add a cancel button at the bottom of the dialog
Button cancelButton = new Button("Close",new ClickListener() {
public void onClick(Widget sender) { hide(); }
Button cancelButton = new Button("Close");
cancelButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
Button applyButton = new Button("Import",new ClickListener() {
public void onClick(Widget sender) {
Button applyButton = new Button("Import");
applyButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean result = false;
if (lastSection.isChecked())
if (lastSection.getValue())
result = Window.confirm("You are about to import section " + (listbox.getSelectedIndex()+1) + " as last section in the current document");
else
result = Window.confirm("You are about to import section " + (listbox.getSelectedIndex()+1) + " before section " + (listboxCurr.getSelectedIndex()+1) + " of the current document");
if (result)
presenter.importSection(toimportFrom, listbox.getSelectedIndex()+1, listboxCurr.getSelectedIndex()+1, lastSection.isChecked());
presenter.importSection(toimportFrom, listbox.getSelectedIndex()+1, listboxCurr.getSelectedIndex()+1, lastSection.getValue());
hide();
}
});
@ -152,14 +163,13 @@ public class ImporterDialog extends DialogBox {
listboxCurr.addItem("Section " + i, ""+(i-1));
}
lastSection.addClickHandler(new ClickHandler() {
lastSection.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
CheckBox cb = (CheckBox) sender;
listboxCurr.setEnabled(! cb.isChecked());
@Override
public void onClick(ClickEvent event) {
CheckBox cb = (CheckBox) event.getSource();
listboxCurr.setEnabled(! cb.getValue());
}
});
Grid grid3 = new Grid(2, 2);

View File

@ -8,6 +8,7 @@ import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.MasterSequenceList;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
@ -17,6 +18,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSele
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.ClientImage;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientMasterSequence;
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.DropTSListener;
@ -196,14 +198,16 @@ public class TemplateComponent {
if (sc.isLocked()) {
HTML area = new HTML();
area.setStyleName("report-ui-component");
area.addStyleName("readOnlyText");
//area.addStyleName(getStyle(sc.getType()));
area.getElement().getStyle().setMarginTop(5, Unit.PX);
area.setPixelSize(width, 18);
area.setPixelSize(width-5, 18);
area.setText((String) sc.getPossibleContent());
this.content = area;
}
else {
BasicTextArea bToAdd = new BasicTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, 25, getUserComments() != null, showClose);
int changedWidth = width -5; //because of the inner padding
BasicTextArea bToAdd = new BasicTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), changedWidth, 25, getUserComments() != null, showClose);
bToAdd.setText((String) sc.getPossibleContent());
this.content = bToAdd;
}
@ -358,6 +362,18 @@ public class TemplateComponent {
}
this.content = tti;
break;
case MASTER_SEQUENCE_LIST:
GWT.log("FOUND Master SEQUENCE trying getGroup");
MasterSequenceList masterSequence = (MasterSequenceList) sc.getPossibleContent();
ClientMasterSequence cmSeq = new ClientMasterSequence(presenter, masterSequence);
this.content = cmSeq;
//GWT.log("getGroup: " + repeatableSequence.toString());
//ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
//this.content = rps;
break;
}
}
/**

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.MasterSequence;
import org.gcube.portlets.d4sreporting.common.shared.MasterSequenceList;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
*
* @author massi
*
*/
public class ClientMasterSequence extends Composite implements ClientSequence {
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
private VerticalPanel myPanel = new VerticalPanel();
protected RepeatableSequence repSequence;
protected RepeatableSequence originalSequence = new RepeatableSequence();
/**
* s
* @param p
* @param ms
*/
public ClientMasterSequence(Presenter p, MasterSequenceList msl) {
for (MasterSequence seq : msl.getSequences()) {
if (seq.isSelected()) {
repSequence = seq;
}
}
SequenceWidget seqW = new SequenceWidget(p, this, repSequence, true, false);
seqW.enableClear();
myPanel.add(seqW);
initWidget(myPanel);
}
@Override
public ArrayList<TemplateComponent> getGroupedComponents() {
return groupedComponents;
}
@Override
public boolean add(RepeatableSequence sequence) {
return false;
}
@Override
public SequenceWidget remove(SequenceWidget toRemove) {
myPanel.remove(toRemove);
for (TemplateComponent tc : toRemove.getSeqGroupedComponents()) {
groupedComponents.remove(tc);
}
return toRemove;
}
}

View File

@ -5,16 +5,14 @@ import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
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 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.VerticalPanel;
public class ClientRepeatableSequence extends Composite {
public class ClientRepeatableSequence extends Composite implements ClientSequence {
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
private VerticalPanel myPanel = new VerticalPanel();
@ -66,7 +64,10 @@ public class ClientRepeatableSequence extends Composite {
}
return toReturn;
}
/**
*
* @return
*/
private ArrayList<RepeatableSequence> getRepeats() {
ArrayList<RepeatableSequence> toReturn = new ArrayList<RepeatableSequence>();
int repeatDelimiterCounter = 2;
@ -107,6 +108,7 @@ public class ClientRepeatableSequence extends Composite {
myPanel.add(seqW);
}
protected void addNew(RepeatableSequence sRS) {
SequenceWidget seqW = new SequenceWidget(p, this, sRS, false, true);
myPanel.add(seqW);
@ -122,6 +124,7 @@ public class ClientRepeatableSequence extends Composite {
}
}
@Override
public ArrayList<TemplateComponent> getGroupedComponents() {
return groupedComponents;
}
@ -129,4 +132,20 @@ public class ClientRepeatableSequence extends Composite {
public void setGroupedComponents(ArrayList<TemplateComponent> groupedComponents) {
this.groupedComponents = groupedComponents;
}
@Override
public boolean add(RepeatableSequence sequence) {
SequenceWidget seqW = new SequenceWidget(p, this, sequence, false, true);
myPanel.add(seqW);
return true;
}
@Override
public SequenceWidget remove(SequenceWidget toRemove) {
myPanel.remove(toRemove);
for (TemplateComponent tc : toRemove.getSeqGroupedComponents()) {
groupedComponents.remove(tc);
}
return toRemove;
}
}

View File

@ -0,0 +1,15 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
public interface ClientSequence {
ArrayList<TemplateComponent> getGroupedComponents();
boolean add(RepeatableSequence sequence);
SequenceWidget remove(SequenceWidget toRemove);
}

View File

@ -15,6 +15,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
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.HasAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
@ -25,14 +26,15 @@ public class SequenceWidget extends Composite {
private Button addAnotherB = new Button("Add another Entry");
private Button removeThisB = new Button("Remove Entry");
private Button selectEntryB = new Button("Select New");
private Presenter p;
private HorizontalPanel buttonPanel = new HorizontalPanel();
HorizontalPanel buttonsWrapperPanel = new HorizontalPanel();
private ClientRepeatableSequence owner;
private ClientSequence owner;
private RepeatableSequence repSequence;
private ArrayList<TemplateComponent> seqGroupedComponents = new ArrayList<TemplateComponent>();
public SequenceWidget(Presenter p, ClientRepeatableSequence owner, RepeatableSequence repSequence, boolean isFirst, boolean isNew) {
public SequenceWidget(Presenter p, ClientSequence owner, RepeatableSequence repSequence, boolean notRemovable, boolean isNew) {
this.p = p;
this.owner = owner;
this.repSequence = repSequence;
@ -65,7 +67,7 @@ public class SequenceWidget extends Composite {
}
initWidget(myPanel);
if (isFirst) {
if (notRemovable) {
buttonsWrapperPanel.add(addAnotherB);
addAnotherB.addClickHandler(new ClickHandler() {
@Override
@ -98,9 +100,49 @@ public class SequenceWidget extends Composite {
}
}
public void enableClear() {
Button clearB = new Button("Clear Association");
clearB.getElement().getStyle().setWidth(130, Unit.PX);
clearB.getElement().getStyle().setMargin(10, Unit.PX);
clearB.addStyleName("deleteAssociationButton");
clearB.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
clearAssociation();
}
});
buttonsWrapperPanel.insert(clearB, 0);
}
public void clearAssociation() {
GWT.log("Clearing Association");
//in the MODEL
for (BasicComponent bc : repSequence.getGroupedComponents()) {
if (bc.getType() == ComponentType.BODY_NOT_FORMATTED) {
bc.setPossibleContent("");
bc.setMetadata(new ArrayList<Metadata>());
}
}
//in the VIEW
for (TemplateComponent tc : seqGroupedComponents) {
if (tc.getType() == ComponentType.BODY_NOT_FORMATTED) {
((HTML) tc.getContent()).setText("");
}
}
buttonsWrapperPanel.clear();
selectEntryB.getElement().getStyle().setWidth(130, Unit.PX);
selectEntryB.getElement().getStyle().setMargin(10, Unit.PX);
selectEntryB.addStyleName("deleteAssociationButton");
buttonsWrapperPanel.add(selectEntryB);
}
public void add(TemplateComponent toAdd) {
if (toAdd.getType() != ComponentType.REPEAT_SEQUENCE_INNER) {
owner.groupedComponents.add(toAdd);
owner.getGroupedComponents().add(toAdd);
seqGroupedComponents.add(toAdd);
GWT.log("ToAdd= getType " + toAdd.getType());
myPanel.add(toAdd.getContent());
@ -116,10 +158,10 @@ public class SequenceWidget extends Composite {
}
private void addAnother() {
owner.addNew(repSequence);
owner.add(repSequence);
}
private void removeMe() {
owner.removeSeqWidget(this);
owner.remove(this);
}
}

View File

@ -6,7 +6,7 @@
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<set-property name="user.agent" value="gecko1_8" />
<inherits name='org.gcube.portlets.widgets.exporter.Report_exporter_widget' />
<inherits name='org.gcube.portlets.widgets.guidedtour.GuidedTour' />
<inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />

View File

@ -141,6 +141,20 @@
color: #FFF !important;
}
.deleteAssociationButton {
background-image: none !important;
background-repeat: none !important;
background-color: #12B0FA !important;
color: #FFF !important;
}
.deleteAssociationButton:hover {
background-image: none !important;
background-repeat: none !important;
background-color: #12B0FA !important;
color: #FFF !important;
}
.addEntryButton {
background-image: none !important;
background-repeat: none !important;
@ -471,16 +485,16 @@ tableBorder td {
.title {
background-image: url(images/title.png);
font-size: 16pt;
font-size: 18px;
}
.title-label {
font-size: 16pt;
font-size: 18px;
padding-left: 0px;
}
.title-font {
font-size: 16pt;
font-size: 18px;
padding-left: 0px;
padding-bottom: 10px;
color: #336699;
@ -488,60 +502,73 @@ tableBorder td {
.heading1 {
background-image: url(images/heading_1.png);
font-size: 12pt;
font-size: 16px;
}
.heading1-label {
font-size: 12pt;
font-size: 16px;
padding-left: 0px;
}
.heading2 {
background-image: url(images/heading_2.png);
font-size: 12pt;
font-size: 15px;
}
.heading2-label {
font-size: 15pt;
font-size: 15px;
padding-left: 0px
}
.heading3 {
background-image: url(images/heading_3.png);
font-size: 10pt;
font-size: 13px;
}
.heading3-label {
font-size: 13pt;
font-size: 13px;
padding-left: 2px;
}
.heading4 {
background-image: url(images/heading_4.png);
font-size: 10pt;
font-size: 11px;
}
.heading4-label {
font-size: 12pt;
font-size: 11px;
padding-left: 10px;
}
.heading5 {
background-image: url(images/heading_5.png);
font-size: 10pt;
font-size: 10px;
}
.heading5-label {
font-size: 8pt;
font-size: 10px;
padding-left: 25px;
}
.simpleText {
padding-left: 4px;
padding: 5px 0 0 5px;
font-size: 13px;
color: black;
}
.readOnlyText {
border: 1px solid #CCC !important;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: white;
margin-top: 5px;
padding: 5px;
font-size: 13px;
color: #AAA;
}
.bodyArea {
background-image: none;
}