fixed paste on Rich Text Area problem #3156
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@102180 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
66059aa721
commit
629d730179
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/reports-4.12.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/reports-4.12.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -31,5 +31,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/reports-4.12.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/reports-4.12.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<<<<<<<=.mine
|
||||
>>>>>>>=.r71295
|
||||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.12.0-SNAPSHOT
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.12.1-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
3
pom.xml
3
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>reports</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>4.12.0-SNAPSHOT</version>
|
||||
<version>4.12.1-SNAPSHOT</version>
|
||||
<name>gCube Reports Manager</name>
|
||||
<description>
|
||||
gCube Reports Portlet.
|
||||
|
@ -183,6 +183,7 @@
|
|||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>fileupload-progress-bar</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
|
|
|
@ -4,10 +4,15 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
|
||||
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||
|
||||
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
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.dom.client.KeyDownEvent;
|
||||
import com.google.gwt.event.dom.client.KeyDownHandler;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
|
@ -17,20 +22,19 @@ 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.Timer;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.RichTextArea;
|
||||
import com.google.gwt.user.client.ui.TextArea;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* <code> D4sRichTextArea </code> class is a template component that goes into the workspace
|
||||
*
|
||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||
* @version October 2008 (0.2)
|
||||
*/
|
||||
public class D4sRichTextarea extends ReportTextArea {
|
||||
//the properties associated
|
||||
|
@ -122,18 +126,75 @@ public class D4sRichTextarea extends ReportTextArea {
|
|||
|
||||
area.addKeyUpHandler(new KeyUpHandler() {
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
HTML div = ReportGenerator.get().getDivHidden();
|
||||
div.setHTML(area.getHTML());
|
||||
int newHeight = div.getOffsetHeight()+20 ;
|
||||
if (newHeight > height-10 && newHeight != currHeight) {
|
||||
resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
|
||||
//Window.alert("myInstance.top: " + myInstance.top);
|
||||
presenter.resizeTemplateComponentInModel(myInstance, myPanel.getOffsetWidth()+5, newHeight);
|
||||
}
|
||||
if (! (event.isAnyModifierKeyDown() && event.getNativeKeyCode() == 86)) { //event.getNativeKeyCode() == 86 is the V (to avoid ctrl V or cmd V)
|
||||
HTML div = ReportGenerator.get().getDivHidden();
|
||||
div.setHTML(area.getHTML());
|
||||
int newHeight = div.getOffsetHeight()+20 ;
|
||||
if (newHeight > height-10 && newHeight != currHeight) {
|
||||
resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
|
||||
//Window.alert("myInstance.top: " + myInstance.top);
|
||||
presenter.resizeTemplateComponentInModel(myInstance, myPanel.getOffsetWidth()+5, newHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
area.addKeyDownHandler(new KeyDownHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyDown(KeyDownEvent event) {
|
||||
if (event.isAnyModifierKeyDown() && event.getNativeKeyCode() == 86) { //event.getNativeKeyCode() == 86 is the V (to avoid ctrl V or cmd V)
|
||||
final GCubeDialog dlg = new GCubeDialog(true);
|
||||
int width = 500;
|
||||
dlg.setWidth(width+"px");
|
||||
dlg.setText("Paste operation");
|
||||
HTML tip = new HTML("Please enter your text here:");
|
||||
final TextArea ta = new TextArea();
|
||||
Button cancel = new Button("Cancel");
|
||||
Button paste = new Button("Paste it");
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.add(cancel);
|
||||
hp.add(paste);
|
||||
|
||||
ta.setWidth(width-20+"px");
|
||||
ta.setHeight("120px");
|
||||
|
||||
VerticalPanel mainPanel = new VerticalPanel();
|
||||
mainPanel.add(tip);
|
||||
mainPanel.add(ta);
|
||||
mainPanel.add(hp);
|
||||
dlg.add(mainPanel);
|
||||
|
||||
cancel.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
dlg.hide();
|
||||
}
|
||||
});
|
||||
paste.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
area.setHTML(area.getHTML()+ta.getText());
|
||||
dlg.hide();
|
||||
}
|
||||
});
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
dlg.center();
|
||||
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
ta.setFocus(true);
|
||||
}
|
||||
};
|
||||
t.schedule(100);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* used to resize the panel
|
||||
* @param width w
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
|
Reference in New Issue