added discovery of RSG WebService

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@87128 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-12-17 18:19:51 +00:00
parent 91bf8f0852
commit b082b54aa7
48 changed files with 827 additions and 67 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/reports-4.6.16-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/reports-4.6.17-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -26,10 +26,10 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/reports-4.6.16-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/reports-4.6.17-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.6.16-SNAPSHOT
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.17-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -7,30 +7,6 @@
<dependent-module archiveName="gcube-reporting-modeler-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-modeler/gcube-reporting-modeler">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-client-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-client/reports-store-gateway-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-model-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-model/reports-store-gateway-support-model">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-interface-dto-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-interface-dto/reports-store-gateway-interface-dto">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-web-base-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-web-base/reports-store-gateway-web-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-compiler-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-compiler/reports-store-gateway-support-compiler">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-compiler-bridge-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-compiler-bridge/reports-store-gateway-support-compiler-bridge">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-builder-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-builder/reports-store-gateway-support-builder">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="document-workflow-library-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/document-workflow-library/document-workflow-library">
<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.6.16-SNAPSHOT</version>
<version>4.6.17-SNAPSHOT</version>
<name>gCube Reports Manager</name>
<description>
gCube Reports Portlet.

View File

@ -362,10 +362,10 @@ public class Headerbar extends Composite{
// });
// importMenu.addItem(item);
importMenu.addSeparator();
MenuItem exportVME = new MenuItem("Export Current to VME-DB", true, importVMEReport);
importMenu.addItem(exportVME);
//
// importMenu.addSeparator();
// MenuItem exportVME = new MenuItem("Export Current to VME-DB", true, importVMEReport);
// importMenu.addItem(exportVME);
return toReturn;
}

View File

@ -3,11 +3,11 @@ package org.gcube.portlets.user.reportgenerator.client.Presenter;
import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.client.uicomponents.richtext.RichTextToolbar;
import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.ReportService;
@ -51,6 +51,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.HeadingTextArea;
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.client.toolbar.RichTextToolbar;
import org.gcube.portlets.user.reportgenerator.client.uibinder.ExportOptions;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
@ -126,6 +127,8 @@ public class Presenter {
private CommonCommands commonCommands;
private boolean menuForWorkflowDocument = false;
private boolean isVME = false;
/**
* eventbus events handler
*/
@ -251,6 +254,8 @@ public class Presenter {
public void onSuccess(final SessionInfo sessionInfo) {
currentUser = sessionInfo.getUsername();
currentScope = sessionInfo.getScope();
isVME = sessionInfo.isVME();
addTextToolBar(true);
if (sessionInfo.isWorkflowDocument()) {
model.getModelService().getWorkflowDocumentFromDocumentLibrary(new AsyncCallback<Model>() {
@ -267,14 +272,14 @@ public class Presenter {
}
});
}
else {
else { //not in workflow mode check if a report was open
model.getModelService().readTemplateFromSession(new AsyncCallback<Model>() {
public void onFailure(Throwable caught) {
dlg.hide();
}
public void onSuccess(Model result) {
dlg.hide();
if (result != null) {
if (result != null) { //there was one report open in session
loadModel(result, true);
header.enableExports();
} else
@ -616,7 +621,7 @@ public class Presenter {
*
*/
public void addTextToolBar(boolean enableCommands) {
RichTextToolbar rtbar = new RichTextToolbar(new RichTextArea(), false, getCommands(), true);
RichTextToolbar rtbar = new RichTextToolbar(new RichTextArea(), getCommands(), isVME);
rtbar.enableCommands(enableCommands);
currentSelectedToolbar = rtbar;
@ -634,7 +639,7 @@ public class Presenter {
*/
public void enableTextToolBar(RichTextArea d4sArea) {
RichTextToolbar rtbar = new RichTextToolbar(d4sArea, false, getCommands(), true);
RichTextToolbar rtbar = new RichTextToolbar(d4sArea, getCommands(), isVME);
if (menuForWorkflowDocument) //disable open and save buttons from the toolbar
rtbar.enableCommands(false);
currentSelectedToolbar = rtbar;
@ -1235,7 +1240,10 @@ public class Presenter {
BasicSection firstSection = reportRef.getSections().get(0);
if (firstSection.getComponents() != null && firstSection.getComponents().size()==2) {
ReportReferences toPass = (ReportReferences) firstSection.getComponents().get(1).getPossibleContent();
clientSeqSelected.add(toPass.getTuples().get(0).getKey(), toPass.getTuples().get(0));
GWT.log("Singola?" + toPass.isSingleRelation());
String refKey = toPass.getTuples().get(0).getKey();
Tuple ref = toPass.getTuples().get(0);
clientSeqSelected.add(refKey, ref, toPass.isSingleRelation());
}
else {
Window.alert("Sorry, we could not locate the ReportRef correctly in the model instance");

View File

@ -10,6 +10,9 @@ import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.store.ListStore;
@ -23,6 +26,8 @@ import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.tips.QuickTip;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager;
@ -49,6 +54,7 @@ public class ImportVMEReportDialog extends Window {
this.eventBus = eventBus;
this.type = type;
setModal(true);
setResizable(false);
mainPanel.setHeaderVisible(false);
setWidth(WIDTH);
setHeight(HEIGHT);
@ -124,6 +130,7 @@ public class ImportVMEReportDialog extends Window {
column.setId("rfmo");
column.setHeader("Owner");
column.setWidth(15);
column.setHidden(true);
configs.add(column);
column = new ColumnConfig();
@ -144,6 +151,7 @@ public class ImportVMEReportDialog extends Window {
*/
GroupingStore<VMEReportBean> store = new GroupingStore<VMEReportBean>();
store.add(reports);
if (type != VMETypeIdentifier.Rfmo)
store.groupBy("rfmo");
@ -162,6 +170,17 @@ public class ImportVMEReportDialog extends Window {
view.setShowGroupedColumn(true);
view.setStartCollapsed(true);
grid.setView(view);
grid.addListener(Events.OnMouseOver, new Listener<GridEvent<VMEReportBean>>(){
@Override
public void handleEvent(GridEvent<VMEReportBean> ge) {
if (ge != null && ge.getModel() != null) {
grid.setTitle(ge.getModel().getName());
}
}
});
view.setForceFit(true);
ContentPanel gridPanel = new ContentPanel(new FitLayout());
gridPanel.setHeaderVisible(false);
@ -230,6 +249,7 @@ public class ImportVMEReportDialog extends Window {
break;
case Rfmo:
toReturn = "RFMO";
break;
default:
toReturn = "Unknown Category!";
break;

View File

@ -35,6 +35,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.TextTableImage;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Hidden;
import com.google.gwt.user.client.ui.Widget;
@ -324,6 +325,14 @@ public class TemplateComponent {
instr.setHTML(preserveLineBreaks(content));
this.content = instr;
break;
case HIDDEN_FIELD:
String hiddenValue = (String) sc.getPossibleContent();
if (hiddenValue == null) {
hiddenValue = "-1";
}
Hidden hiddenField = new Hidden("SequenceId", hiddenValue);
this.content = hiddenField;
break;
case TIME_SERIES:
TSArea tsa;
@ -497,6 +506,9 @@ public class TemplateComponent {
case INSTRUCTION:
content = ((HTML) this.content).getHTML();
break;
case HIDDEN_FIELD:
content = ((Hidden) this.content).getValue();
break;
case REPEAT_SEQUENCE:
ClientRepeatableSequence repSeq = (ClientRepeatableSequence) this.content;
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), repSeq.getIdentifier(), height);

View File

@ -133,7 +133,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
}
@Override
public boolean add(String id, RepeatableSequence sequence) {
public boolean add(String id, RepeatableSequence sequence, boolean isSingleRelation) {
SequenceWidget seqW = new SequenceWidget(p, this, sequence, false, true);
myPanel.add(seqW);
return true;
@ -150,7 +150,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
@Override
public void AddButtonClicked(RepeatableSequence sequence) {
add("not needed", sequence);
add("not needed", sequence, false);
}
public String getIdentifier() {

View File

@ -115,19 +115,23 @@ public class ClientReportReference extends Composite implements ClientSequence {
}
@Override
public boolean add(String id, RepeatableSequence sequence) {
public boolean add(String id, RepeatableSequence sequence, boolean isSingleRelation) {
//(beacuse the ref is indented
for (BasicComponent bc : sequence.getGroupedComponents()) {
bc.setWidth(bc.getWidth()-(indentationValue+5));
}
if (first.isSelectNewEnabled()) {
first = getRefSequence(p, this, sequence, true, false);
if (first.isAnEmptyRef()) { //this is the case when the current ref is not set and is only one
GWT.log("isEmpty");
first = getRefSequence(p, this, sequence, true, true);
myPanel.clear();
myPanel.add(first);
tupleList.clear();
first.enableClear();
if (isSingleRelation)
first.removeAddAnotherButton();
} else {
SequenceWidget seqW = getRefSequence(p, this, sequence, false, true);
SequenceWidget seqW = getRefSequence(p, this, sequence, false, false);
myPanel.add(seqW);
first.hideClearAssociationButton();
}

View File

@ -9,7 +9,7 @@ public interface ClientSequence {
ArrayList<TemplateComponent> getGroupedComponents();
boolean add(String id, RepeatableSequence sequence);
boolean add(String id, RepeatableSequence sequence, boolean isSingleRelation);
SequenceWidget remove(SequenceWidget toRemove);

View File

@ -34,7 +34,8 @@ public class SequenceWidget extends Composite {
private RepeatableSequence repSequence;
private ArrayList<TemplateComponent> seqGroupedComponents = new ArrayList<TemplateComponent>();
private boolean isSelectingNew = false;
//in case of references tells if the ref is empty
private boolean isEmptyRef = false;
public SequenceWidget(Presenter p, ClientSequence owner, RepeatableSequence repSequence, boolean notRemovable, boolean isNew) {
this.owner = owner;
@ -42,6 +43,7 @@ public class SequenceWidget extends Composite {
addAnotherB.getElement().getStyle().setMargin(10, Unit.PX);
addAnotherB.getElement().getStyle().setWidth(130, Unit.PX);
addAnotherB.addStyleName("addEntryButton");
buttonPanel.getElement().getStyle().setMarginTop(20, Unit.PX);
myPanel = new VerticalPanel();
myPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
myPanel.setStyleName("seqWidget");
@ -66,7 +68,6 @@ public class SequenceWidget extends Composite {
}
TemplateComponent toAdd = new TemplateComponent(p.getModel(), sComp, p, false, null);
if (isNew && sComp.getType() == ComponentType.REPORT_REFERENCE ) { //when adding a new Sequence blanks the Ref
GWT.log("E' NOVA");
ClientReportReference cRef = (ClientReportReference) toAdd.getContent();
cRef.clear();
}
@ -115,6 +116,9 @@ public class SequenceWidget extends Composite {
return buttonsWrapperPanel.remove(clearB);
}
protected boolean hideAddEntryButton() {
return buttonsWrapperPanel.remove(addAnotherB);
}
private void addAnother() {
owner.AddButtonClicked(repSequence);
@ -172,11 +176,11 @@ public class SequenceWidget extends Composite {
});
buttonsWrapperPanel.add(selectNewB);
isSelectingNew = true;
isEmptyRef = true;
}
protected boolean isSelectNewEnabled() {
return isSelectingNew;
protected boolean isAnEmptyRef() {
return isEmptyRef;
}
public void add(TemplateComponent toAdd) {

View File

@ -0,0 +1,105 @@
package org.gcube.portlets.user.reportgenerator.client.toolbar;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ImageBundle;
/**
* This {@link ImageBundle} is used for all the button icons. Using an image
* bundle allows all of these images to be packed into a single image, which
* saves a lot of HTTP requests, drastically improving startup time.
*/
@SuppressWarnings("deprecation")
public interface Images extends ImageBundle {
/**
* @return .
*/
AbstractImagePrototype importing();
/**
* @return .
*/
AbstractImagePrototype bold();
/**
* @return .
*/
AbstractImagePrototype createLink();
/**
* @return .
*/
AbstractImagePrototype hr();
/**
* @return .
*/
AbstractImagePrototype indent();
/**
* @return .
*/
AbstractImagePrototype insertImage();
/**
* @return .
*/
AbstractImagePrototype italic();
/**
* @return .
*/
AbstractImagePrototype justifyCenter();
/**
* @return .
*/
AbstractImagePrototype justifyLeft();
/**
* @return .
*/
AbstractImagePrototype justifyRight();
/**
* @return .
*/
AbstractImagePrototype newdoc();
/**
* @return .
*/
AbstractImagePrototype open_template();
/**
* @return .
*/
AbstractImagePrototype open_report();
/**
* @return .
*/
AbstractImagePrototype ol();
/**
* @return .
*/
AbstractImagePrototype removeFormat();
/**
* @return .
*/
AbstractImagePrototype removeLink();
/**
* @return .
*/
AbstractImagePrototype save();
/**
* @return .
*/
AbstractImagePrototype strikeThrough();
/**
* @return .
*/
AbstractImagePrototype subscript();
/**
* @return .
*/
AbstractImagePrototype superscript();
/**
* @return .
*/
AbstractImagePrototype ul();
/**
* @return .
*/
AbstractImagePrototype underline();
/**
* @return .
*/
AbstractImagePrototype foreColors();
}

View File

@ -0,0 +1,41 @@
bold = Toggle Bold
createLink = Create Link
hr = Insert Horizontal Rule
indent = Indent Right
insertImage = Insert Static Image
italic = Toggle Italic
justifyCenter = Center
justifyLeft = Left Justify
justifyRight = Right Justify
ol = Insert Ordered List
outdent = Indent Left
removeFormat = Remove Formatting
removeLink = Remove Link
strikeThrough = Toggle Strikethrough
subscript = Toggle Subscript
superscript = Toggle Superscript
ul = Insert Unordered List
underline = Toggle Underline
color = Color
black = Black
white = White
red = Red
green = Green
yellow = Yellow
blue = Blue
font = Font
normal = Normal
size = Size
xxsmall = XX-Small
xsmall = X-Small
small = Small
medium = Medium
large = Large
xlarge = X-Large
xxlarge = XX-Large
save = Save
newdoc = New Template
open_template = Open Template
open_report = Open Report
importing = Import from Template
forecolors = Text Color

View File

@ -0,0 +1,518 @@
package org.gcube.portlets.user.reportgenerator.client.toolbar;
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
import java.util.HashMap;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.i18n.client.Constants;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
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.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* A sample toolbar for use with {@link RichTextArea}. It provides a simple UI
* for all rich text formatting, dynamically displayed only for the available
* functionality.
*/
public class RichTextToolbar extends Composite {
private boolean isVME = false;
/**
* We use an inner EventListener class to avoid exposing event methods on the
* RichTextToolbar itself.
*/
private class EventListener implements ClickHandler, ChangeHandler, KeyUpHandler {
@SuppressWarnings("deprecation")
@Override
public void onChange(ChangeEvent event) {
Widget sender = (Widget) event.getSource();
if (sender == fonts) {
basic.setFontName(fonts.getValue(fonts.getSelectedIndex()));
fonts.setSelectedIndex(0);
} else if (sender == fontSizes) {
basic.setFontSize(fontSizesConstants[fontSizes.getSelectedIndex() - 1]);
fontSizes.setSelectedIndex(0);
}
}
@SuppressWarnings("deprecation")
@Override
public void onClick(ClickEvent event) {
Widget sender = (Widget) event.getSource();
if (sender == bold) {
basic.toggleBold();
} else if (sender == save) {
//call the command of Templates or Reports
commands.get("save").execute();
} else if (sender == newdoc) {
commands.get("newdoc").execute();
} else if (sender == open_report) {
commands.get("open_report").execute();
} else if (sender == open_template) {
commands.get("open_template").execute();
} else if (sender == importing) {
commands.get("importing").execute();
}else if (sender == insertImage) {
commands.get("insertImage").execute();
} else if (sender == italic) {
basic.toggleItalic();
} else if (sender == underline) {
basic.toggleUnderline();
} else if (sender == strikethrough) {
extended.toggleStrikethrough();
}else if (sender == subscript) {
extended.toggleSubscript();
} else if (sender == superscript) {
extended.toggleSuperscript();
}
else if (sender == justifyLeft) {
basic.setJustification(RichTextArea.Justification.LEFT);
} else if (sender == justifyCenter) {
basic.setJustification(RichTextArea.Justification.CENTER);
} else if (sender == justifyRight) {
basic.setJustification(RichTextArea.Justification.RIGHT);
} else if (sender == createLink) {
String url = Window.prompt("Enter a link URL:", "http://");
if (url != null) {
extended.createLink(url);
}
} else if (sender == removeLink) {
extended.removeLink();
}
// else if (sender == ol) {
// extended.insertOrderedList();
// } else if (sender == ul) {
// extended.insertUnorderedList();
// }
else if (sender == foreColorButton) {
commands.get("pickColor").execute();
}
else if (sender == removeFormat) {
extended.removeFormat();
} else if (sender == richText) {
// We use the RichTextArea's onKeyUp event to update the toolbar status.
// This will catch any cases where the user moves the cursur using the
// keyboard, or uses one of the browser's built-in keyboard shortcuts.
updateStatus();
}
}
@Override
public void onKeyUp(KeyUpEvent event) {
Widget sender = (Widget) event.getSource();
if (sender == richText) {
updateStatus();
}
}
}
private static final RichTextArea.FontSize[] fontSizesConstants = new RichTextArea.FontSize[] {
RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL,
RichTextArea.FontSize.SMALL, RichTextArea.FontSize.MEDIUM,
RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE,
RichTextArea.FontSize.XX_LARGE};
private Images images = (Images) GWT.create(Images.class);
private Strings strings = (Strings) GWT.create(Strings.class);
private EventListener listener = new EventListener();
private RichTextArea richText;
@SuppressWarnings("deprecation")
private RichTextArea.BasicFormatter basic;
@SuppressWarnings("deprecation")
private RichTextArea.ExtendedFormatter extended;
private VerticalPanel outer = new VerticalPanel();
private HorizontalPanel topPanel = new HorizontalPanel();
private HorizontalPanel bottomPanel = new HorizontalPanel();
private ToggleButton bold;
private ToggleButton italic;
private ToggleButton underline;
private ToggleButton strikethrough;
private ToggleButton superscript;
private ToggleButton subscript;
private PushButton justifyLeft;
private PushButton justifyCenter;
private PushButton justifyRight;
private PushButton save;
private PushButton newdoc;
private PushButton open_template;
private PushButton open_report;
private PushButton importing;
// private PushButton ol;
// private PushButton ul;
private PushButton insertImage;
private PushButton createLink;
private PushButton removeLink;
private PushButton removeFormat;
// private ListBox backColors;
// private ListBox foreColors;
private ListBox fonts;
private ListBox fontSizes;
private PushButton foreColorButton;
private HashMap<String, Command> commands;
/**
* Creates a new toolbar that drives the given rich text area.
*
* @param richText the rich text area to be controlled
* @param useOnePanel if true display all the bottons on one panel
* @param commands the Commands to call
*/
@SuppressWarnings("deprecation")
public RichTextToolbar(RichTextArea richText, HashMap<String, Command> commands, boolean isVme) {
this.isVME = isVme;
this.commands = commands;
this.richText = richText;
this.basic = richText.getBasicFormatter();
this.extended = richText.getExtendedFormatter();
topPanel.setHeight("20px");
topPanel.setSpacing(2);
outer.add(bottomPanel);
topPanel.setWidth("100%");
outer.setWidth("100%");
HorizontalPanel hp = new HorizontalPanel();
hp.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
hp.add(topPanel);
outer.add(hp);
outer.setHeight("20px");
initWidget(outer);
setStyleName("goog-toolbar");
richText.addStyleName("hasRichTextToolbar");
if (basic != null) {
//add the new template button
topPanel.add(newdoc = createPushButton(images.newdoc(), strings.newdoc()));
open_report = createPushButton(images.open_report(),strings.open_report());
//add the open report button
topPanel.add(open_report);
//add the open template button
topPanel.add(open_template = createPushButton(images.open_template(),strings.open_template()));
//add the save button
topPanel.add(save = createPushButton(images.save(), strings.save()));
//add the save button
topPanel.add(importing = createPushButton(images.importing(), strings.importing()));
if (! isVme) {
topPanel.add(new HTML("&nbsp;"));
fonts = createFontList();
fonts.setPixelSize(150, 18);
topPanel.add(fonts);
topPanel.add(new HTML("&nbsp;"));
topPanel.add(fontSizes = createFontSizes());
}
// We only use these listeners for updating status, so don't hook them up
// unless at least basic editing is supported.
richText.addKeyUpHandler(listener);
richText.addClickHandler(listener);
}
if (! isVme) {
if (basic != null) {
topPanel.add(bold = createToggleButton(images.bold(), strings.bold()));
topPanel.add(italic = createToggleButton(images.italic(), strings.italic()));
topPanel.add(underline = createToggleButton(images.underline(), strings.underline()));
topPanel.add(new HTML("&nbsp;", true));
topPanel.add(subscript = createToggleButton(images.subscript(),"subscript"));
topPanel.add(superscript = createToggleButton(images.superscript(),
"superscript"));
topPanel.add(strikethrough = createToggleButton(images.strikeThrough(),
strings.strikeThrough()));
topPanel.add(new HTML("&nbsp;", true));
topPanel.add(justifyLeft = createPushButton(images.justifyLeft(),
strings.justifyLeft()));
topPanel.add(justifyCenter = createPushButton(images.justifyCenter(),
strings.justifyCenter()));
topPanel.add(justifyRight = createPushButton(images.justifyRight(),
strings.justifyRight()));
topPanel.add(new HTML("&nbsp;", true));
}
if (extended != null) {
// topPanel.add(ol = createPushButton(images.ol(), strings.ol()));
// topPanel.add(ul = createPushButton(images.ul(), strings.ul()));
//TODO: To be re-enabled in the future
// topPanel.add(insertImage = createPushButton(images.insertImage(),
// strings.insertImage()));
topPanel.add(createLink = createPushButton(images.createLink(),
strings.createLink()));
topPanel.add(removeLink = createPushButton(images.removeLink(),
strings.removeLink()));
topPanel.add(removeFormat = createPushButton(images.removeFormat(),
strings.removeFormat()));
topPanel.add(foreColorButton = createPushButton(images.foreColors(),
"Text Color"));
}
if (basic != null) {
topPanel.add(new HTML("&nbsp;"));
// topPanel.add(foreColors = createColorList("Color"));
// foreColors.setStyleName("listbox");
}
}
}
private ListBox createFontList() {
ListBox lb = new ListBox();
lb.addChangeHandler(listener);
lb.setVisibleItemCount(1);
lb.addItem(strings.font(), "");
lb.addItem(strings.normal(), "");
lb.addItem("Times New Roman", "Times New Roman");
lb.addItem("Arial", "Arial");
lb.addItem("Courier New", "Courier New");
lb.addItem("Georgia", "Georgia");
lb.addItem("Trebuchet", "Trebuchet");
lb.addItem("Verdana", "Verdana");
lb.setStyleName("listbox");
lb.setPixelSize(100, 18);
return lb;
}
private ListBox createFontSizes() {
ListBox lb = new ListBox();
lb.addChangeHandler(listener);
lb.setVisibleItemCount(1);
lb.addItem(strings.size());
lb.addItem(strings.xxsmall());
lb.addItem(strings.xsmall());
lb.addItem(strings.small());
lb.addItem(strings.medium());
lb.addItem(strings.large());
lb.addItem(strings.xlarge());
lb.addItem(strings.xxlarge());
lb.setStyleName("listbox");
lb.setPixelSize(100, 18);
return lb;
}
private PushButton createPushButton(AbstractImagePrototype img, String tip) {
Image toAdd = img.createImage();
//toAdd.setSize("15", "15");
PushButton pb = new PushButton(toAdd);
pb.addClickHandler(listener);
pb.setTitle(tip);
pb.setPixelSize(15, 15);
pb.setStyleName("myButton");
return pb;
}
private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) {
ToggleButton tb = new ToggleButton(img.createImage());
tb.addClickHandler(listener);
tb.setTitle(tip);
tb.setPixelSize(15, 15);
tb.setStyleName("myButton");
return tb;
}
/**
* Updates the status of all the stateful buttons.
*/
private void updateStatus() {
if (basic != null) {
bold.setDown(basic.isBold());
italic.setDown(basic.isItalic());
underline.setDown(basic.isUnderlined());
}
if (extended != null) {
strikethrough.setDown(extended.isStrikethrough());
}
}
/**
* set the buttons enable or not
* @param enable true to enable the widget, false to disable it
*/
public void setEnabled(boolean enable) {
if (! isVME) {
bold.setEnabled(enable);
italic.setEnabled(enable);
underline.setEnabled(enable);
strikethrough.setEnabled(enable);
justifyLeft.setEnabled(enable);
justifyCenter.setEnabled(enable);
justifyRight.setEnabled(enable);
superscript.setEnabled(enable);
subscript.setEnabled(enable);
foreColorButton.setEnabled(enable);
// insertImage.setEnabled(enable);
// ol.setEnabled(enable);
// ul.setEnabled(enable);
createLink.setEnabled(enable);
removeLink.setEnabled(enable);
removeFormat.setEnabled(enable);
//foreColors.setEnabled(enable);
fonts.setEnabled(enable);
fontSizes.setEnabled(enable);
}
}
public void enableCommands(boolean enable) {
save.setEnabled(enable);
newdoc.setEnabled(enable);
open_template.setEnabled(enable);
open_report.setEnabled(enable);
importing.setEnabled(enable);
}
/**
*
* @return the formatter
*/
public RichTextArea.ExtendedFormatter getExtendedFormatter() {
return extended;
}
/**
*
* @return the current textArea
*/
public RichTextArea getRichTextArea() {
return richText;
}
/**
* This {@link Constants} interface is used to make the toolbar's strings
* internationalizable.
*/
public interface Strings extends Constants {
String insertImage();
String importing();
String black();
String blue();
String bold();
String color();
String createLink();
String font();
String green();
String hr();
String italic();
String justifyCenter();
String justifyLeft();
String justifyRight();
String large();
String medium();
String normal();
String newdoc();
String open_template();
String open_report();
String ol();
String outdent();
String red();
String removeFormat();
String removeLink();
String save();
String size();
String small();
String strikeThrough();
String ul();
String underline();
String white();
String xlarge();
String xsmall();
String xxlarge();
String xxsmall();
String yellow();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

View File

@ -1,5 +1,8 @@
package org.gcube.portlets.user.reportgenerator.server.servlet;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -32,7 +35,6 @@ import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.application.rsg.client.RsgClient;
import org.gcube.application.rsg.service.RsgService;
import org.gcube.application.rsg.service.dto.NameValue;
import org.gcube.application.rsg.service.dto.ReportEntry;
import org.gcube.application.rsg.service.dto.ReportType;
import org.gcube.application.rsg.support.builder.exceptions.ReportBuilderException;
@ -58,6 +60,8 @@ import org.gcube.common.homelibrary.home.workspace.folder.items.Report;
import org.gcube.common.homelibrary.home.workspace.folder.items.ReportTemplate;
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.ImageDocument;
import org.gcube.common.homelibrary.home.workspace.folder.items.ts.TimeSeries;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.admin.wfdocslibrary.client.WfDocsLibrary;
@ -85,6 +89,8 @@ import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -125,6 +131,10 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
*
*/
public static final String PREVIOUS_REPORT_INSTANCE = "myPreviousReport";
/**
*
*/
public static final String RSG_WS_ADDRESS = "RSG_WS_ADDRESS";
/**
@ -549,6 +559,16 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
}
}
private String getRSGWSAddress() {
String addr = (String) getASLSession().getAttribute(RSG_WS_ADDRESS);
_log.trace("getRSGWSAddress: " + addr);
return addr;
}
private void setRSGWSAddress(String addr) {
getASLSession().setAttribute(RSG_WS_ADDRESS, addr);
_log.trace("setting RSG WS address to " + addr);
}
/**
*
* @return
@ -1143,17 +1163,20 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
getASLSession().setAttribute(WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE, "1");
getASLSession().setAttribute(WfDocsLibrary.WORKFLOW_GIVEN_NAME, "TEST REPORT");
getASLSession().setAttribute(WfDocsLibrary.WORKFLOW_READONLY_ATTRIBUTE, true);
return new SessionInfo(getUserBean(), getVreName(), true, true);
return new SessionInfo(getUserBean(), getVreName(), true, true, false);
}
boolean isVME = isReportsStoreGatewayAvailable();
if (getASLSession().getAttribute(WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE) == null) {
_log.debug("WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE is NULL: ");
return new SessionInfo(getUserBean(), getVreName(), false, false);
return new SessionInfo(getUserBean(), getVreName(), false, false, isVME);
}
else {
_log.debug("FOUND WORKFLOW_ID_ATTRIBUTE ***** ");
//String workflowid = getASLSession().getAttribute(WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE).toString();
Boolean canEdit = ! (Boolean) getASLSession().getAttribute(WfDocsLibrary.WORKFLOW_READONLY_ATTRIBUTE);
return new SessionInfo(getUserBean(), getVreName(), true, canEdit);
return new SessionInfo(getUserBean(), getVreName(), true, canEdit, false);
}
}
@ -1478,7 +1501,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ReportType type = new ReportType();
type.setTypeIdentifier("Vme");
RsgService rsgClient = new RsgClient();
RsgService rsgClient = new RsgClient(getRSGWSAddress());
for (ReportEntry re : rsgClient.listReports(type)) {
String rfmo = re.getOwner();
@ -1500,7 +1523,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ArrayList<VMEReportBean> toReturn = new ArrayList<VMEReportBean>();
ReportType type = new ReportType();
type.setTypeIdentifier(refType.toString());
RsgService rsgClient = new RsgClient();
RsgService rsgClient = new RsgClient(getRSGWSAddress());
for (ReportEntry re :rsgClient.listReports(new ReportType(refType.getId()))) {
String rfmo = re.getOwner();
@ -1513,7 +1536,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
@Override
public Model importVMEReport(String id, String name, VMETypeIdentifier refType) {
RsgService rsgClient = new RsgClient();
RsgService rsgClient = new RsgClient(getRSGWSAddress());
CompiledReport cr = null;
if (refType == VMETypeIdentifier.Vme) {
@ -1539,7 +1562,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
@Override
public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) {
RsgService rsgClient = new RsgClient();
RsgService rsgClient = new RsgClient(getRSGWSAddress());
_log.info("Importing Ref type= " + refType.getId() + " id=" + id);
CompiledReport cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id);
Model model = null;
@ -1552,4 +1575,35 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
}
return model;
}
/**
* this method ch
* @return true if an instance of the ReportsStoreGateway is available in the infrastructure
*/
private boolean isReportsStoreGatewayAvailable() {
String scope = getASLSession().getScope();
_log.info("Looking for a running ReportsStoreGateway WS in " + scope);
String previousScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope);
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Category/string() eq 'Service'");
query.addCondition("$resource/Profile/Name/string() eq 'ReportsStoreGateway'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> list = client.submit(query);
ScopeProvider.instance.set(previousScope);
if (list.size() > 1) {
_log.warn("Multiple ReportsStoreGateway Service Endpoints available in the scope, should be only one.");
return false;
}
else if (list.size() == 1) {
ServiceEndpoint se = list.get(0);
String host = se.profile().runtime().hostedOn();
String accessPoint = se.profile().accessPoints().iterator().next().address();
setRSGWSAddress(host+accessPoint);
return true;
}
else return false;
}
}

View File

@ -9,18 +9,24 @@ public class SessionInfo implements Serializable {
private String scope;
private Boolean isWorkflowDocument;
private Boolean isEditable;
private Boolean isVME;
public SessionInfo() { }
public SessionInfo(UserBean user, String scope,
Boolean isWorkflowDocument, Boolean canEdit) {
public SessionInfo(
org.gcube.portlets.user.reportgenerator.shared.UserBean user,
String scope, Boolean isWorkflowDocument, Boolean isEditable,
Boolean isVME) {
super();
this.user = user;
this.scope = scope;
this.isWorkflowDocument = isWorkflowDocument;
this.isEditable = canEdit;
this.isEditable = isEditable;
this.isVME = isVME;
}
public UserBean getUsername() {
return user;
}
@ -53,5 +59,13 @@ public class SessionInfo implements Serializable {
this.isEditable = canEdit;
}
public Boolean isVME() {
return isVME;
}
public void setIsVME(Boolean isVME) {
this.isVME = isVME;
}
}

View File

@ -187,15 +187,18 @@
}
.seqWidget {
margin-top: 10px;
margin-top: 15px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
border: 1px dashed maroon;
}
.seqWidget-shadow {
background-color: #FFF;
opacity: 0.9;
border: none;
border: 1px dashed #6C8CD5;
}
@ -475,7 +478,7 @@ tableBorder td {
}
.instructionArea {
margin-top: 5px;
margin: 5px 5px 0;
font-family: "Courier New", Courier, monospace;
font-size: 11px;
color: #666;
@ -591,6 +594,7 @@ tableBorder td {
padding: 5px 0 0 5px;
font-size: 13px;
color: black;
margin-left: 5px;
}
.readOnlyText {