exports working
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@71453 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
07f21282c4
commit
c368ac1449
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent.UploadType;
|
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent.UploadType;
|
||||||
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
|
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ public class ToolboxPanel extends SimplePanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showExportedVersion(String id, String fileName) {
|
public void showExportedVersion(String id, String fileName) {
|
||||||
|
GWT.log("showExportedVersion");
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(id, fileName, DownloadType.SHOW));
|
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(id, fileName, DownloadType.SHOW));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,6 +4,10 @@ import org.gcube.portlets.user.exporter.shared.TypeExporter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
|
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ToolboxPanel;
|
import org.gcube.portlets.user.reportgenerator.client.ToolboxPanel;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.ItemType;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupHandler;
|
||||||
|
import org.gcube.portlets.user.workspace.lighttree.client.save.WorkspaceLightTreeSavePopup;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
@ -67,12 +71,13 @@ public class ExportOptions extends Composite {
|
||||||
|
|
||||||
|
|
||||||
private void doCallBack(ExportMode mode) {
|
private void doCallBack(ExportMode mode) {
|
||||||
|
switch(mode) {
|
||||||
|
case SAVE:
|
||||||
rpc.save(filePath, workspaceFolderId, itemName, type, true, new AsyncCallback<String>() {
|
rpc.save(filePath, workspaceFolderId, itemName, type, true, new AsyncCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String createdItemId) {
|
public void onSuccess(String createdItemId) {
|
||||||
p.clearExportPanel();
|
p.clearExportPanel();
|
||||||
tbp.showExportedVersion(createdItemId, itemName);
|
tbp.refreshRoot();
|
||||||
Window.alert("Success ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,5 +85,48 @@ public class ExportOptions extends Composite {
|
||||||
Window.alert("Error: " + caught.getMessage());
|
Window.alert("Error: " + caught.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
|
case SAVE_AS:
|
||||||
|
WorkspaceLightTreeSavePopup wpTree = new WorkspaceLightTreeSavePopup("Save Report, select the folder:", true);
|
||||||
|
wpTree.setSelectableTypes(ItemType.FOLDER, ItemType.ROOT);
|
||||||
|
wpTree.setShowEmptyFolders(true);
|
||||||
|
wpTree.addPopupHandler(new PopupHandler(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPopup(PopupEvent event) {
|
||||||
|
rpc.save(filePath, event.getSelectedItem().getId(), event.getName(), type, true, new AsyncCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String createdItemId) {
|
||||||
|
p.clearExportPanel();
|
||||||
|
tbp.refreshRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert("Error: " + caught.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}});
|
||||||
|
wpTree.show();
|
||||||
|
wpTree.center();
|
||||||
|
break;
|
||||||
|
case
|
||||||
|
SAVE_OPEN:
|
||||||
|
rpc.save(filePath, workspaceFolderId, itemName, type, true, new AsyncCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String createdItemId) {
|
||||||
|
p.clearExportPanel();
|
||||||
|
tbp.refreshRoot();
|
||||||
|
tbp.showExportedVersion(createdItemId, itemName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert("Error: " + caught.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
<g:HTML ui:field="saveAs" styleName="exportOption optionSaveAs">Save As</g:HTML>
|
<g:HTML ui:field="saveAs" styleName="exportOption optionSaveAs">Save As</g:HTML>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="tinyMessage">
|
||||||
|
Note: existing copies will be overwritten.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</ui:UiBinder>
|
</ui:UiBinder>
|
|
@ -10,12 +10,22 @@
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
width: 775px;
|
width: 775px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exportResult {
|
.exportResult {
|
||||||
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #444;
|
color: #444;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tinyMessage {
|
||||||
|
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #444;
|
||||||
|
margin-top: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.exportOption {
|
.exportOption {
|
||||||
display: block;
|
display: block;
|
||||||
height: 148px;
|
height: 148px;
|
||||||
|
|
Reference in New Issue