Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@86938 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-12-13 17:42:07 +00:00
parent 20dda08bd9
commit 9c84bef478
2 changed files with 55 additions and 36 deletions

View File

@ -35,6 +35,12 @@ public interface TabularDataResources extends ClientBundle {
@Source("properties.png")
ImageResource properties();
@Source("template.png")
ImageResource template();
@Source("template_32.png")
ImageResource template32();
@Source("sdmx.png")
ImageResource sdmx();

View File

@ -36,7 +36,7 @@ public class FileToolBar {
protected ToolBar toolBar;
protected TextButton openButton;
protected TextButton deleteButton;
protected TextButton deleteButton;
protected TextButton closeButton;
protected TextButton propertiesButton;
@ -48,6 +48,8 @@ public class FileToolBar {
protected TextButton exportCSVButton;
protected TextButton exportJSONButton;
protected TextButton templateButton;
public FileToolBar(EventBus eventBus) {
this.eventBus = eventBus;
build();
@ -61,8 +63,7 @@ public class FileToolBar {
toolBar = new ToolBar();
toolBar.setSpacing(1);
toolBar.setEnableOverflow(false);
// File
ButtonGroup fileGroup = new ButtonGroup();
fileGroup.setId("File");
@ -86,14 +87,13 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.OPEN));
eventBus.fireEvent(new RibbonEvent(RibbonType.OPEN));
}
});
dataLayout.setWidget(0, 0, openButton);
dataLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
closeButton = new TextButton("Close",
TabularDataResources.INSTANCE.close32());
closeButton.disable();
@ -107,16 +107,12 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.CLOSE));
eventBus.fireEvent(new RibbonEvent(RibbonType.CLOSE));
}
});
dataLayout.setWidget(0, 1, closeButton);
dataLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
deleteButton = new TextButton("Delete",
TabularDataResources.INSTANCE.delete());
@ -129,13 +125,9 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.DELETE));
eventBus.fireEvent(new RibbonEvent(RibbonType.DELETE));
}
});
propertiesButton = new TextButton("Properties",
TabularDataResources.INSTANCE.properties());
@ -148,8 +140,7 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.PROPERTIES));
eventBus.fireEvent(new RibbonEvent(RibbonType.PROPERTIES));
}
});
@ -175,8 +166,7 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.IMPORTSDMX));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORTSDMX));
}
});
@ -190,8 +180,7 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.IMPORTCSV));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORTCSV));
}
});
importLayout.setWidget(0, 2, importCSVButton);
@ -204,8 +193,7 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.IMPORTJSON));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORTJSON));
}
});
importLayout.setWidget(1, 2, importJSONButton);
@ -217,7 +205,7 @@ public class FileToolBar {
exportGroup.setId("Export");
exportGroup.setStyleName("ribbon");
exportGroup.setHeadingText("Export");
//exportGroup.disable();
// exportGroup.disable();
toolBar.add(exportGroup);
FlexTable exportLayout = new FlexTable();
@ -234,8 +222,7 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.EXPORTSDMX));
eventBus.fireEvent(new RibbonEvent(RibbonType.EXPORTSDMX));
}
});
@ -250,8 +237,7 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.EXPORTCSV));
eventBus.fireEvent(new RibbonEvent(RibbonType.EXPORTCSV));
}
});
exportLayout.setWidget(0, 2, exportCSVButton);
@ -264,12 +250,41 @@ public class FileToolBar {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.EXPORTJSON));
eventBus.fireEvent(new RibbonEvent(RibbonType.EXPORTJSON));
}
});
exportLayout.setWidget(1, 2, exportJSONButton);
// Template
ButtonGroup templateGroup = new ButtonGroup();
templateGroup.setId("Template");
templateGroup.setStyleName("ribbon");
templateGroup.setHeadingText("Template");
templateGroup.disable();
toolBar.add(templateGroup);
FlexTable templateLayout = new FlexTable();
templateGroup.add(templateLayout);
templateButton = new TextButton("Template",
TabularDataResources.INSTANCE.template32());
templateButton.disable();
templateButton.setToolTip("Template");
templateButton.setScale(ButtonScale.LARGE);
templateButton.setIconAlign(IconAlign.TOP);
templateButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateButton.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
// eventBus.fireEvent(new RibbonEvent(
// RibbonType.EXPORTSDMX));
}
});
templateLayout.setWidget(0, 0, templateButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
cleanCells(exportLayout.getElement());
eventBus.addHandler(UIStateEvent.TYPE,
@ -278,7 +293,6 @@ public class FileToolBar {
@Override
public void onUIState(UIStateEvent event) {
setUI(event);
}
});
@ -296,9 +310,8 @@ public class FileToolBar {
}
}
public void setUI(UIStateEvent event) {
UIStateType uiStateType=event.getUIStateType();
UIStateType uiStateType = event.getUIStateType();
try {
switch (uiStateType) {
case START:
@ -333,8 +346,8 @@ public class FileToolBar {
importCSVButton.enable();
importJSONButton.disable();
importSDMXButton.enable();
if(event.getTrId().getTableType().compareTo("Codelist")==0){
if (event.getTrId().getTableType().compareTo("Codelist") == 0) {
exportSDMXButton.enable();
} else {
exportSDMXButton.disable();