refs 5870: TDM - adding new functionalities to portlets

Task-Url: https://support.d4science.org/issues/5870

Updated to support SDMX Dataset export

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@142038 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-02-01 18:29:24 +00:00
parent 08b1af28d9
commit 4bdb8c982c
2 changed files with 97 additions and 120 deletions

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -58,7 +59,6 @@ public class FileToolBar {
private TextButton exportCSVButton;
private TextButton exportJSONButton;
private TextButton timelineButton;
private TextButton backgroundButton;
@ -72,14 +72,11 @@ public class FileToolBar {
// private TextButton logsButton;
// private TextButton testButton;
// Language Menu
private MenuItem enItem;
private MenuItem itItem;
private MenuItem esItem;
public FileToolBar(EventBus eventBus) {
this.eventBus = eventBus;
msgs = GWT.create(FileToolBarMessages.class);
@ -92,7 +89,6 @@ public class FileToolBar {
protected void build() {
toolBar = new ToolBar();
toolBar.setSpacing(1);
toolBar.setEnableOverflow(false);
@ -126,9 +122,6 @@ public class FileToolBar {
fileLayout.setWidget(0, 0, openButton);
fileLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
closeButton = new TextButton(msgs.closeButton(),
TabularDataResources.INSTANCE.trClose32());
closeButton.disable();
@ -148,7 +141,6 @@ public class FileToolBar {
fileLayout.setWidget(0, 1, closeButton);
fileLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
cloneButton = new TextButton(msgs.cloneButton(),
TabularDataResources.INSTANCE.clone32());
cloneButton.disable();
@ -168,7 +160,6 @@ public class FileToolBar {
fileLayout.setWidget(0, 2, cloneButton);
fileLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
shareButton = new TextButton(msgs.shareButton(),
TabularDataResources.INSTANCE.trShare32());
shareButton.disable();
@ -188,7 +179,6 @@ public class FileToolBar {
fileLayout.setWidget(0, 3, shareButton);
fileLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
deleteButton = new TextButton(msgs.deleteButton(),
TabularDataResources.INSTANCE.delete());
deleteButton.disable();
@ -261,17 +251,14 @@ public class FileToolBar {
importLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
/*
importJSONButton = new TextButton("JSON",
TabularDataResources.INSTANCE.json());
importJSONButton.disable();
importJSONButton.setToolTip("Import table from JSON source");
importJSONButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_JSON));
}
});
importLayout.setWidget(1, 1, importJSONButton);
* importJSONButton = new TextButton("JSON",
* TabularDataResources.INSTANCE.json()); importJSONButton.disable();
* importJSONButton.setToolTip("Import table from JSON source");
* importJSONButton.addSelectHandler(new SelectHandler() {
*
* public void onSelect(SelectEvent event) { eventBus.fireEvent(new
* RibbonEvent(RibbonType.IMPORT_JSON)); } }); importLayout.setWidget(1,
* 1, importJSONButton);
*/
cleanCells(importLayout.getElement());
@ -329,7 +316,6 @@ public class FileToolBar {
exportLayout.setWidget(1, 2, exportJSONButton);
cleanCells(exportLayout.getElement());
// TimeLine (Tasks)
ButtonGroup taskGroup = new ButtonGroup();
taskGroup.setId("TasksStatus");
@ -432,7 +418,6 @@ public class FileToolBar {
FlexTable helpLayout = new FlexTable();
helpGroup.add(helpLayout);
languageButton = new TextButton(msgs.languageButton(),
TabularDataResources.INSTANCE.language32());
languageButton.enable();
@ -463,41 +448,35 @@ public class FileToolBar {
helpLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
/*
logsButton = new TextButton("Logs",
TabularDataResources.INSTANCE.logs32());
logsButton.enable();
logsButton.setToolTip("Show Logs");
logsButton.setScale(ButtonScale.LARGE);
logsButton.setIconAlign(IconAlign.TOP);
logsButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
logsButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.LOGS));
}
});
helpLayout.setWidget(0, 1, logsButton);
helpLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
* logsButton = new TextButton("Logs",
* TabularDataResources.INSTANCE.logs32()); logsButton.enable();
* logsButton.setToolTip("Show Logs");
* logsButton.setScale(ButtonScale.LARGE);
* logsButton.setIconAlign(IconAlign.TOP);
* logsButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
* logsButton.addSelectHandler(new SelectHandler() {
*
* public void onSelect(SelectEvent event) { eventBus.fireEvent(new
* RibbonEvent(RibbonType.LOGS)); } });
*
* helpLayout.setWidget(0, 1, logsButton);
* helpLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
*/
/*
testButton = new TextButton("Test",
TabularDataResources.INSTANCE.test32());
testButton.disable();
testButton.setToolTip("Test");
testButton.setScale(ButtonScale.LARGE);
testButton.setIconAlign(IconAlign.TOP);
testButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
testButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.TEST));
}
});
helpLayout.setWidget(0, 2, testButton);
helpLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
* testButton = new TextButton("Test",
* TabularDataResources.INSTANCE.test32()); testButton.disable();
* testButton.setToolTip("Test");
* testButton.setScale(ButtonScale.LARGE);
* testButton.setIconAlign(IconAlign.TOP);
* testButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
* testButton.addSelectHandler(new SelectHandler() {
*
* public void onSelect(SelectEvent event) { eventBus.fireEvent(new
* RibbonEvent(RibbonType.TEST)); } });
*
* helpLayout.setWidget(0, 2, testButton);
* helpLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
*/
cleanCells(helpLayout.getElement());
@ -524,7 +503,6 @@ public class FileToolBar {
}
}
private Menu createLanguageMenu() {
Menu menuReplace = new Menu();
enItem = new MenuItem(msgs.english());
@ -534,35 +512,29 @@ public class FileToolBar {
esItem = new MenuItem(msgs.spanish());
// TabularDataResources.INSTANCE.sflagES());
enItem
.addSelectionHandler(new SelectionHandler<Item>() {
enItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.LANGUAGE_EN));
eventBus.fireEvent(new RibbonEvent(RibbonType.LANGUAGE_EN));
}
});
itItem
.addSelectionHandler(new SelectionHandler<Item>() {
itItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.LANGUAGE_IT));
eventBus.fireEvent(new RibbonEvent(RibbonType.LANGUAGE_IT));
}
});
esItem
.addSelectionHandler(new SelectionHandler<Item>() {
esItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.LANGUAGE_ES));
eventBus.fireEvent(new RibbonEvent(RibbonType.LANGUAGE_ES));
}
});
@ -573,7 +545,6 @@ public class FileToolBar {
return menuReplace;
}
public void setUI(UIStateEvent event) {
UIStateType uiStateType = event.getUIStateType();
try {
@ -630,7 +601,12 @@ public class FileToolBar {
// importJSONButton.disable();
importSDMXButton.enable();
TRId trId = event.getTrId();
if (trId!=null&& trId.getTableType()!=null && trId.getTableType().compareTo("Codelist") == 0) {
if (trId != null
&& trId.getTableType() != null
&& (trId.getTableType().compareTo(
TableType.CODELIST.getTableTypeLabel()) == 0 || trId
.getTableType().compareTo(
TableType.DATASET.getTableTypeLabel()) == 0)) {
exportSDMXButton.enable();
} else {
exportSDMXButton.disable();

View File

@ -8,5 +8,6 @@
<layout-cacheable>false</layout-cacheable>
<instanceable>false</instanceable>
<ajaxable>false</ajaxable>
<css-class-wrapper>TabularDataManagerCSS</css-class-wrapper>
</portlet>
</liferay-portlet-app>