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;
@ -51,14 +52,13 @@ public class FileToolBar {
private TextButton propertiesButton;
private TextButton importCSVButton;
//private TextButton importJSONButton;
// private TextButton importJSONButton;
private TextButton importSDMXButton;
private TextButton exportSDMXButton;
private TextButton exportCSVButton;
private TextButton exportJSONButton;
private TextButton timelineButton;
private TextButton backgroundButton;
@ -66,20 +66,17 @@ public class FileToolBar {
private TextButton historyButton;
private TextButton undoButton;
//Help
// Help
private TextButton helpButton;
private TextButton languageButton;
//private TextButton logsButton;
//private TextButton testButton;
// private TextButton logsButton;
// private TextButton testButton;
//Language Menu
// 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,18 +251,15 @@ 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,42 +448,36 @@ 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,48 +503,41 @@ public class FileToolBar {
}
}
private Menu createLanguageMenu() {
Menu menuReplace = new Menu();
enItem = new MenuItem(msgs.english());
// TabularDataResources.INSTANCE.sflagEN());
// TabularDataResources.INSTANCE.sflagEN());
itItem = new MenuItem(msgs.italian());
// TabularDataResources.INSTANCE.sflagIT());
// TabularDataResources.INSTANCE.sflagIT());
esItem = new MenuItem(msgs.spanish());
// TabularDataResources.INSTANCE.sflagES());
// 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));
@Override
public void onSelection(SelectionEvent<Item> event) {
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));
@Override
public void onSelection(SelectionEvent<Item> event) {
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));
@Override
public void onSelection(SelectionEvent<Item> event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.LANGUAGE_ES));
}
});
}
});
menuReplace.add(enItem);
menuReplace.add(esItem);
@ -573,7 +545,6 @@ public class FileToolBar {
return menuReplace;
}
public void setUI(UIStateEvent event) {
UIStateType uiStateType = event.getUIStateType();
try {
@ -586,7 +557,7 @@ public class FileToolBar {
deleteButton.disable();
propertiesButton.disable();
importCSVButton.enable();
//importJSONButton.disable();
// importJSONButton.disable();
importSDMXButton.enable();
exportCSVButton.disable();
exportJSONButton.disable();
@ -595,7 +566,7 @@ public class FileToolBar {
backgroundButton.enable();
historyButton.disable();
undoButton.disable();
//testButton.disable();
// testButton.disable();
break;
case TR_CLOSE:
case TR_READONLY:
@ -606,7 +577,7 @@ public class FileToolBar {
deleteButton.disable();
propertiesButton.disable();
importCSVButton.enable();
//importJSONButton.disable();
// importJSONButton.disable();
importSDMXButton.enable();
exportCSVButton.disable();
exportJSONButton.disable();
@ -615,7 +586,7 @@ public class FileToolBar {
backgroundButton.enable();
historyButton.disable();
undoButton.disable();
//testButton.disable();
// testButton.disable();
break;
case TR_OPEN:
case TABLEUPDATE:
@ -627,10 +598,15 @@ public class FileToolBar {
deleteButton.enable();
propertiesButton.enable();
importCSVButton.enable();
//importJSONButton.disable();
// importJSONButton.disable();
importSDMXButton.enable();
TRId trId=event.getTrId();
if (trId!=null&& trId.getTableType()!=null && trId.getTableType().compareTo("Codelist") == 0) {
TRId trId = event.getTrId();
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();
@ -641,7 +617,7 @@ public class FileToolBar {
backgroundButton.enable();
historyButton.enable();
undoButton.enable();
//testButton.enable();
// testButton.enable();
break;
case WIZARD_OPEN:
openButton.disable();
@ -651,7 +627,7 @@ public class FileToolBar {
deleteButton.disable();
propertiesButton.disable();
importCSVButton.disable();
//importJSONButton.disable();
// importJSONButton.disable();
importSDMXButton.disable();
exportCSVButton.disable();
exportJSONButton.disable();
@ -660,7 +636,7 @@ public class FileToolBar {
backgroundButton.disable();
historyButton.disable();
undoButton.disable();
//testButton.disable();
// testButton.disable();
break;
default:
break;

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>