partially implement text table image

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@71268 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-03-12 17:10:16 +00:00
parent a9165be746
commit f159ee4eaa
22 changed files with 368 additions and 144 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/reports-4.0.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/reports-4.0.4-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -30,5 +30,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/reports-4.0.3-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/reports-4.0.4-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,5 +1,5 @@
#Thu Mar 07 19:02:40 CET 2013
#Tue Mar 12 17:50:07 CET 2013
eclipse.preferences.version=1
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.0.3-SNAPSHOT
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.0.4-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>reports</artifactId>
<packaging>war</packaging>
<version>4.0.3-SNAPSHOT</version>
<version>4.0.4-SNAPSHOT</version>
<name>gCube Reports Portlet</name>
<description>
gCube Reports Portlet.

View File

@ -44,6 +44,7 @@ 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.ReportTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
import org.gcube.portlets.user.reportgenerator.client.targets.TextTableImage;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
@ -1048,6 +1049,10 @@ public class Presenter {
ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent();
wp.addComponentToLayout(rps, component.isDoubleColLayout());
break;
case BODY_TABLE_IMAGE:
TextTableImage tti = (TextTableImage) component.getContent();
wp.addComponentToLayout(tti, component.isDoubleColLayout());
break;
}
}
}

View File

@ -135,7 +135,7 @@ public class ReportGenerator implements EntryPoint {
mainLayout.add(cellPanel);
divHidden.setStyleName("d4sFrame");
divHidden.setWidth("500");
divHidden.setWidth("750px");
divHidden.setStyleName("d4sRichTextArea");
divHidden.addStyleName("setVisibilityOff");
divHidden.addStyleName("hasRichTextToolbar");

View File

@ -25,6 +25,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterA
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingInnerArea;
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.TextTableImage;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
@ -144,8 +145,10 @@ public class TemplateComponent {
* @param myModel the model
* @param sc the serialiazble to convert
* @param presenter .
* @param showClose
* @param owner needed only for the TextTableImage case and because im in hurry
*/
public TemplateComponent(TemplateModel myModel, BasicComponent sc, Presenter presenter) {
public TemplateComponent(TemplateModel myModel, BasicComponent sc, Presenter presenter, boolean showClose, TextTableImage owner) {
this.myModel = myModel;
//
//Coords start = new Coords(x, y);
@ -184,7 +187,7 @@ public class TemplateComponent {
this.content = area;
}
else {
BasicTextArea bToAdd = new BasicTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, 25, getUserComments() != null);
BasicTextArea bToAdd = new BasicTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, 25, getUserComments() != null, showClose);
bToAdd.setText((String) sc.getPossibleContent());
this.content = bToAdd;
}
@ -201,7 +204,7 @@ public class TemplateComponent {
}
else {
height = 40;
D4sRichTextarea ta = new D4sRichTextarea(sc.getType(), presenter, sc.getX(), sc.getY(),width, height, getUserComments() != null);
D4sRichTextarea ta = new D4sRichTextarea(sc.getType(), presenter, sc.getX(), sc.getY(),width, height, getUserComments() != null, showClose, owner);
ta.setHTML((String) sc.getPossibleContent());
//ta.setStyleName("cw-RichText");
ta.setPixelSize(width, height);
@ -210,17 +213,17 @@ public class TemplateComponent {
this.setLocked(sc.isLocked());
break;
case TOC:
ReportTextArea dp2 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
ReportTextArea dp2 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null, showClose);
dp2.addStyleName("tocArea");
this.content = dp2;
break;
case BIBLIO:
ReportTextArea dp3 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
ReportTextArea dp3 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null, showClose);
dp3.addStyleName("biblioArea");
this.content = dp3;
break;
case PAGEBREAK:
ReportTextArea dp4 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
ReportTextArea dp4 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null, showClose);
dp4.addStyleName("pagebreak");
this.content = dp4;
break;
@ -300,6 +303,16 @@ public class TemplateComponent {
ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
this.content = rps;
break;
case BODY_TABLE_IMAGE:
TextTableImage tti = null;
if (sc.getPossibleContent() == null) { //is is a template
tti = new TextTableImage(presenter, true);
} else {
RepeatableSequence seq = (RepeatableSequence) sc.getPossibleContent();
tti = new TextTableImage(presenter, seq);
}
this.content = tti;
break;
}
}
/**
@ -395,12 +408,17 @@ public class TemplateComponent {
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), height);
content = toStore;
break;
case BODY_TABLE_IMAGE:
TextTableImage tti = (TextTableImage) this.content;
RepeatableSequence toSave = new RepeatableSequence(getSerializableSequence(tti), height);
content = toSave;
break;
}
return new BasicComponent(x, y, width, height, templatePage, type, idInBasket, "param empty", content, this.doubleColLayout, isLocked(), metadata);
}
/**
* this method constructs a SerializableRepeatableSequence sequence that can be serializable
* this method constructs a RepeatableSequence sequence that can be serializable from the ClientRepeatableSequence
* @param repSeq
* @return
*/
@ -412,6 +430,19 @@ public class TemplateComponent {
return sComps;
}
/**
* this method constructs a Sequence that can be serializable from the TextTableImage Widget
* @param repSeq
* @return
*/
private ArrayList<BasicComponent> getSerializableSequence(TextTableImage seq) {
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : seq.getAddedComponents()) {
sComps.add(tc.getSerializable());
}
return sComps;
}
/**
* @return .
*/

View File

@ -200,7 +200,7 @@ public class TemplateModel {
BasicComponent references = new BasicComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.HEADING_2, "", "REFERENCES", false, true, singleSection.getAllMetadata());
TemplateComponent referencesTC = new TemplateComponent(this, references, presenter);
TemplateComponent referencesTC = new TemplateComponent(this, references, presenter, false, null);
singleSection.addComponent(referencesTC);
sections.put(""+totalPages, singleSection);
@ -216,11 +216,11 @@ public class TemplateModel {
TemplateSection singleSection = getSection(totalPages);
BasicComponent entry = new BasicComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.HEADING_2, "", "Bibliographic Entry", false, true, singleSection.getAllMetadata());
TemplateComponent entryTC = new TemplateComponent(this, entry, presenter);
TemplateComponent entryTC = new TemplateComponent(this, entry, presenter, false, null);
singleSection.addComponent(entryTC);
BasicComponent entryText = new BasicComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.BODY, "", citation, false, false, singleSection.getAllMetadata());
TemplateComponent entryTextTC = new TemplateComponent(this, entryText, presenter);
TemplateComponent entryTextTC = new TemplateComponent(this, entryText, presenter, false, null);
singleSection.addComponent(entryTextTC);
storeInSession();
}
@ -295,7 +295,7 @@ public class TemplateModel {
List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>();
for (BasicComponent sc : serialazableSection.getComponents()) { //for each page component
myTemplateSection.add(new TemplateComponent(this, sc, presenter));
myTemplateSection.add(new TemplateComponent(this, sc, presenter, false, null));
}
//TODO: load also metadata
GWT.log("Section Metadata:"+serialazableSection.getMetadata().size(), null);
@ -321,7 +321,7 @@ public class TemplateModel {
BasicSection toImport = toLoad.getSections().get(sectionNoToimport-1);
List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>();
for (BasicComponent sc : toImport.getComponents()) { //for each page component
myTemplateSection.add(new TemplateComponent(this, sc, presenter));
myTemplateSection.add(new TemplateComponent(this, sc, presenter, false, null));
}
//TODO: load also metadata
GWT.log("Section Metadata:"+toImport.getMetadata().size(), null);

View File

@ -4,14 +4,16 @@ import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
@ -21,19 +23,21 @@ import com.google.gwt.user.client.ui.Widget;
* @version July 2011 (3.0)
*/
public class BasicTextArea extends ReportTextArea {
private TextArea textArea = new TextArea();
private RichTextArea textArea = new RichTextArea();
private VerticalPanel myPanel;
private Presenter presenter;
int currHeight = 0;
public BasicTextArea(ComponentType type, final Presenter presenter, int left, int top, int width, final int height, boolean hasComments) {
super(type, presenter, left, top, width, height, hasComments);
this.presenter = presenter;
public BasicTextArea(ComponentType type, final Presenter presenter, int left, int top, final int width, final int height, boolean hasComments, boolean showClose) {
super(type, presenter, left, top, width, height, hasComments, showClose);
currHeight = height;
myPanel = getResizablePanel();
textArea.setPixelSize(width, height);
textArea.getElement().getStyle().setMarginTop(-4, Unit.PX); //this is needed because the richtextarea has margin 8px and a not able to modify it via css
textArea.addMouseOutHandler(new MouseOutHandler() {
@ -85,6 +89,33 @@ public class BasicTextArea extends ReportTextArea {
}
});
textArea.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
HTML div = ReportGenerator.get().getDivHidden();
div.setHTML(textArea.getHTML());
int newHeight = div.getOffsetHeight();
if (newHeight > currHeight) {
resizePanel(width, newHeight);
presenter.resizeTemplateComponentInModel(myInstance, width, newHeight);
currHeight = newHeight;
}
}
});
textArea.addMouseDownHandler(new MouseDownHandler() {
public void onMouseDown(MouseDownEvent event) {
HTML div = ReportGenerator.get().getDivHidden();
div.setHTML(textArea.getHTML());
int newHeight = div.getOffsetHeight();
if (newHeight > currHeight) {
resizePanel(width, newHeight);
presenter.resizeTemplateComponentInModel(myInstance, width, newHeight);
currHeight = newHeight;
}
}
});
}
public String getText() {
return textArea.getText();
@ -93,5 +124,19 @@ public class BasicTextArea extends ReportTextArea {
textArea.setText(text);
}
/**
* used to resize the panel
* @param width w
* @param height h
*/
@Override
public void resizePanel(int width, int height) {
if (height > 25) {
mainPanel.setPixelSize(width, height);
resizablePanel.setPixelSize(width, height);
textArea.setPixelSize(width-4, height);
currHeight = height;
}
}
}

View File

@ -14,6 +14,7 @@ import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.RichTextArea;
@ -48,6 +49,8 @@ public class D4sRichTextarea extends ReportTextArea {
*/
public D4sRichTextarea() {}
private TextTableImage owner;
/**
*
* @param presenter .
@ -57,8 +60,10 @@ public class D4sRichTextarea extends ReportTextArea {
* @param height .
* @param type .
*/
public D4sRichTextarea(ComponentType type, final Presenter presenter, int left, int top, int width, final int height, boolean hasComments) {
super(type, presenter, left, top, width, height, hasComments);
public D4sRichTextarea(ComponentType type, final Presenter presenter, int left, int top, final int width,
final int height, boolean hasComments, boolean showClose, TextTableImage owner) {
super(type, presenter, left, top, width, height, hasComments, showClose);
this.owner = owner;
currHeight = height;
myPanel = getResizablePanel();
@ -91,16 +96,16 @@ public class D4sRichTextarea extends ReportTextArea {
presenter.enableTextToolBar(area);
presenter.enableBiblioEntry(area);
firstClick = false;
ReportGenerator.get().getDivHidden().setPixelSize(area.getOffsetWidth(), -1);
ReportGenerator.get().getDivHidden().setPixelSize(width, -1);
}
HTML div = ReportGenerator.get().getDivHidden();
div.setHTML(area.getHTML());
int newHeight = div.getOffsetHeight()+20 ;
if (newHeight > height-10 && newHeight != currHeight) {
presenter.shiftComponentsByTextArea(myInstance.top, newHeight - currHeight);
resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
resizePanel(width, div.getOffsetHeight());
//Window.alert("myInstance.top: " + myInstance.top);
presenter.resizeTemplateComponentInModel(myInstance, myPanel.getOffsetWidth(), newHeight);
presenter.resizeTemplateComponentInModel(myInstance, width, newHeight);
}
}
});
@ -112,42 +117,7 @@ public class D4sRichTextarea extends ReportTextArea {
}
});
//TODO: aggiorna
// area.addKeyDownHandler(new KeyDownHandler() {
// public void onKeyDown(KeyDownEvent event) {
//// if (event.isAnyModifierKeyDown() && event.getNativeKeyCode() == 86) { //event.getNativeKeyCode() == 86 is the V (to avoid ctrl V or cmd V)
//// MessageBox.show(new MessageBoxConfig() {
//// {
//// setTitle("Paste operation");
//// setMsg("Please enter your text here (PLAIN)");
//// setWidth(500);
//// setButtons(MessageBox.OKCANCEL);
//// setMultiline(true);
//// setCallback(new MessageBox.PromptCallback() {
//// public void execute(String btnID, String text) {
//// if (btnID.compareTo("ok") == 0) {
//// area.setText(text);
////
//// //resize if needed
//// HTML div = ReportGenerator.get().getDivHidden();
//// //GWT.log("element.getHTML():\n" + area.getHTML(), null);
//// div.setHTML(area.getHTML());
//// int newHeight = div.getOffsetHeight()+20 ;
//// if (newHeight > height-10 && newHeight != currHeight) {
//// resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
//// }
//// }
////
//// }
//// });
//// }
//// });
// event.stopPropagation();
// event.preventDefault();
// }
//
// }
// });
area.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
HTML div = ReportGenerator.get().getDivHidden();
@ -174,7 +144,7 @@ public class D4sRichTextarea extends ReportTextArea {
mainPanel.setPixelSize(width, height+20);
resizablePanel.setPixelSize(width, height+20);
mainPanel.setWidgetPosition(topPanel, width-30 , 0);
area.setPixelSize(width-4, height+20);
area.setPixelSize(width, height+20);
currHeight = height + 20;
}
}
@ -208,4 +178,12 @@ public class D4sRichTextarea extends ReportTextArea {
public void setFirstClick(boolean firstClick) {
this.firstClick = firstClick;
}
@Override
public void removeTemplateComponent() {
if (owner != null) {
owner.removeFromParent(this);
removeFromParent();
}
}
}

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.client.ImageConstants;
import org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.dialog.CommentDialog;
@ -9,6 +10,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
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.Image;
@ -48,6 +50,8 @@ public class ReportTextArea extends Composite {
protected VerticalPanel resizablePanel;
protected Image commentImage;
private HTML closeImage = new HTML();
/**
*
* @return .
@ -74,7 +78,7 @@ public class ReportTextArea extends Composite {
* @param height .
* @param type a
*/
public ReportTextArea(ComponentType type, final Presenter presenter, int left, int top, int width, int height, boolean hasComments) {
public ReportTextArea(ComponentType type, final Presenter presenter, int left, int top, int width, int height, boolean hasComments, boolean isRemovable) {
myInstance = this;
@ -115,12 +119,29 @@ public class ReportTextArea extends Composite {
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
mainPanel.add(resizablePanel, 0, 0);
mainPanel.add(topPanel, width-18, 0);
mainPanel.add(topPanel, width-30, 0);
mainPanel.setStyleName("d4sFrame");
initWidget(mainPanel);
if (isRemovable) {
closeImage.setHeight("15px");
closeImage.setStyleName("closeImage");
closeImage.setTitle("Click to remove");
topPanel.add(closeImage);
}
closeImage.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
remove();
}
});
}
private void remove() {
removeTemplateComponent();
}
public void removeTemplateComponent() { }
/**
*
* @return .
@ -240,21 +261,21 @@ public class ReportTextArea extends Composite {
}
public void showComment(String comment) {
// final Window window = new Window();
// window.setTitle("");
// window.setMaximizable(true);
// window.setResizable(true);
// window.setLayout(new FitLayout());
// window.setWidth(200);
// window.setHeight(100);
// window.setModal(false);
//
// Panel windowPanel = new Panel();
// windowPanel.setBaseCls("comment-popup");
// windowPanel.setHtml(comment);
// windowPanel.setShadow(true);
// window.add(windowPanel);
// window.setPosition(commentImage.getAbsoluteLeft()+25, commentImage.getAbsoluteTop());
// window.show();
// final Window window = new Window();
// window.setTitle("");
// window.setMaximizable(true);
// window.setResizable(true);
// window.setLayout(new FitLayout());
// window.setWidth(200);
// window.setHeight(100);
// window.setModal(false);
//
// Panel windowPanel = new Panel();
// windowPanel.setBaseCls("comment-popup");
// windowPanel.setHtml(comment);
// windowPanel.setShadow(true);
// window.add(windowPanel);
// window.setPosition(commentImage.getAbsoluteLeft()+25, commentImage.getAbsoluteTop());
// window.show();
}
}

View File

@ -62,7 +62,7 @@ public class SequenceWidget extends Composite {
sComp.setPossibleContent("");
sComp.setMetadata(new ArrayList<Metadata>());
}
add(new TemplateComponent(p.getModel(), sComp, p));
add(new TemplateComponent(p.getModel(), sComp, p, false, null));
}
initWidget(myPanel);

View File

@ -0,0 +1,156 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
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.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
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.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
*
* @author Massimiliano Assante ISTI-CNR
*
*/
public class TextTableImage extends Composite {
public static final int DEFAULT_HEIGHT = 100;
public static final int DEFAULT_WIDTH = 700;
private FocusPanel focusPanel = new FocusPanel();
private VerticalPanel mainPanel = new VerticalPanel();
private HorizontalPanel controlPanel;
private Button addTextB = new Button("Add Text");
private Button addImageB = new Button("Add Image");
private Button addTableB = new Button("Add Table");
private Presenter presenter;
private ArrayList<TemplateComponent> addedComponents = new ArrayList<TemplateComponent>();
/**
* constructor to be used when reading from a template
* @param presenter
*/
public TextTableImage(Presenter presenter, boolean isFromTemplate) {
this.presenter = presenter;
mainPanel.setStyleName("imageTableTextPanel");
controlPanel = getControlPanel();
controlPanel.setStyleName("imageTableTextControlPanel");
mainPanel.add(controlPanel);
focusPanel.add(mainPanel);
initWidget(focusPanel);
if (isFromTemplate) {
int height = 40;
D4sRichTextarea firstText = new D4sRichTextarea(ComponentType.BODY, presenter, 0, 0, DEFAULT_WIDTH, height, false, true, this);
firstText.setPixelSize(DEFAULT_WIDTH, height);
mainPanel.add(firstText);
//construct the first component and add it
TemplateComponent toAdd = new TemplateComponent(presenter.getModel(), 0, 0, DEFAULT_WIDTH, height,
presenter.getModel().getCurrentPage(), ComponentType.BODY, "", firstText);
add(toAdd);
}
}
/**
* constructor to be used when reading from a report
* @param presenter
* @param sRS
*/
public TextTableImage(Presenter presenter, RepeatableSequence sRS) {
this(presenter, false);
if (sRS != null && sRS.getGroupedComponents().size() > 0) {
for (BasicComponent sComp : sRS.getGroupedComponents()) {
add(new TemplateComponent(presenter.getModel(), sComp, presenter, true, this));
}
}
}
public void add(TemplateComponent toAdd) {
addedComponents.add(toAdd);
GWT.log("ToAdd= getType " + toAdd.getType());
mainPanel.add(toAdd.getContent());
}
private void addNewText() {
int height = 40;
D4sRichTextarea text = new D4sRichTextarea(ComponentType.BODY, presenter, 0, 0, DEFAULT_WIDTH, height, false, true, this);
text.setPixelSize(DEFAULT_WIDTH, height);
TemplateComponent toAdd = new TemplateComponent(presenter.getModel(), 0, 0, DEFAULT_WIDTH, height,
presenter.getModel().getCurrentPage(), ComponentType.BODY, "", text);
add(toAdd);
}
private void addNewTable() {
}
/**
*
* @return
*/
private HorizontalPanel getControlPanel() {
final HorizontalPanel toReturn = new HorizontalPanel();
addTextB.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
addNewText();
}
});
addImageB.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
addTableB.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
toReturn.setSpacing(3);
toReturn.add(addTextB);
toReturn.add(addTableB);
toReturn.add(addImageB);
//set style for buttons
for (int i = 0; i < toReturn.getWidgetCount(); i++) {
if (toReturn.getWidget(i) instanceof Button) {
Button b = (Button) toReturn.getWidget(i);
b.addStyleName("tableButton");
}
}
return toReturn;
}
public ArrayList<TemplateComponent> getAddedComponents() {
return addedComponents;
}
public void removeFromParent(D4sRichTextarea d4sRichTextarea) {
for (TemplateComponent tc : addedComponents) {
if (tc.getType() == ComponentType.BODY) {
D4sRichTextarea toCheck = (D4sRichTextarea) tc.getContent();
if (toCheck.equals(d4sRichTextarea)) {
addedComponents.remove(tc);
break;
}
}
}
}
}

View File

@ -878,8 +878,6 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ASLSession d4Session = getASLSession();
d4Session.setAttribute(CURRENT_REPORT_INSTANCE, model);
System.out.println("SAVED");
Vector<BasicSection> sections = model.getSections();
for (BasicSection section : sections) {
for (BasicComponent component : section.getComponents()) {

View File

@ -1,5 +1,21 @@
@import url('reports/old-dialog.css');
.closeImage {
background: url(images/close.png) 0px 0px no-repeat;
height: 15px;
width: 15px;
}
.closeImage:hover {
background: url(images/close.png) 0px -16px no-repeat;
cursor: pointer;
cursor: hand;
}
.closeImage:active {
background: url(images/close.png) 0px -32px no-repeat;
}
.deleteEntryButton {
background-image: none !important;
background-repeat: none !important;
@ -40,6 +56,16 @@
width: 600px;
}
.imageTableTextPanel {
background-color: transparent;
margin: 8px 0px;
}
.imageTableTextControlPanel {
margin-top: 5px;
}
.imageWrapperPanel {
background-color: transparent;
border-bottom: 2px dashed #FFF;
@ -452,8 +478,6 @@ tableBorder td {
.setVisibilityOn {
margin-top: 1px;
visibility: visible;
cursor: pointer;
cursor: hand;
}
.templateFrame {
@ -663,37 +687,3 @@ gwt-MenuBar {
border: 1px solid #BBBBBB;
border-spacing: 0px;
}
/* *********** FANCY FILE UPLOAD **************/
.fancyfileupload-pending {
font-family: arial;
font-size: 10px;
background: orange;
width: 200px;
}
.fancyfileupload-loading {
font-family: arial;
font-size: 10px;
background: orange;
width: 200px;
}
.fancyfileupload-loaded {
font-family: arial;
font-size: 10px;
background: lightgreen;
width: 200px;
}
.fancyfileupload-failed {
font-family: arial;
font-size: 10px;
background: blue;
width: 200px;
}
/* *********** END FANCY FILE UPLOAD **************/
.droppingArea-Text {
border: 1px inset black;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB