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