915: TDM - Support the Spanish language

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

Updated Spanish Support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-resources-widget@119987 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-10-22 16:56:00 +00:00
parent bfdf1e4b25
commit 57febdc175
9 changed files with 373 additions and 170 deletions

View File

@ -2,6 +2,8 @@
<module rename-to='ResourcesWidget'> <module rename-to='ResourcesWidget'>
<!-- Inherit the core Web Toolkit stuff. --> <!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' /> <inherits name='com.google.gwt.user.User' />
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
<inherits name="com.google.gwt.http.HTTP"/> <inherits name="com.google.gwt.http.HTTP"/>
<!-- We need the JUnit module in the main module, --> <!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) --> <!-- otherwise eclipse complains (Google plugin bug?) -->
@ -10,7 +12,7 @@
<!-- Inherit the default GWT style sheet. You can change --> <!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting --> <!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. --> <!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' /> <!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
@ -30,6 +32,26 @@
<!-- <entry-point class='org.gcube.portlets.user.td.resourceswidget.client.ResourcesWidgetEntry' <!-- <entry-point class='org.gcube.portlets.user.td.resourceswidget.client.ResourcesWidgetEntry'
/> --> /> -->
<!--
<set-configuration-property name="locale.cookie"
value="TDLangCookie" />
<set-configuration-property name="locale.queryparam"
value="TDLang" />
<set-configuration-property name="locale.usemeta"
value="Y" />
<set-configuration-property name="locale.useragent"
value="Y" />
<set-configuration-property name="locale.searchorder"
value="cookie,queryparam,meta,useragent" />
<extend-property name="locale" values="en" />
<extend-property name="locale" values="it" />
<extend-property name="locale" values="es" />
<set-property name="locale" value="en, it, es" />
<set-property-fallback name="locale" value="en" />
-->
<!-- Specify the paths for translatable code --> <!-- Specify the paths for translatable code -->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.td.resourceswidget.client; package org.gcube.portlets.user.td.resourceswidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -16,32 +16,33 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
* *
*/ */
public class ResourcesDialog extends Window { public class ResourcesDialog extends Window {
protected String WIDTH = "320px"; private static final String WIDTH = "320px";
protected String HEIGHT = "540px"; private static final String HEIGHT = "540px";
protected TRId trId; private ResourcesMessages msgs;
protected EventBus eventBus;
protected UserInfo userInfo;
public ResourcesDialog(TRId trId, EventBus eventBus) { public ResourcesDialog(TRId trId, EventBus eventBus) {
this.trId = trId; initMessages();
this.eventBus=eventBus;
initWindow(); initWindow();
ResourcesPanel resourcesPanel= new ResourcesPanel(this, trId, eventBus); ResourcesPanel resourcesPanel= new ResourcesPanel(this, trId, eventBus);
add(resourcesPanel); add(resourcesPanel);
} }
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Resources"); setHeadingText(msgs.resourcesDialogHead());
//getHeader().setIcon(Resources.IMAGES.side_list()); //getHeader().setIcon(Resources.IMAGES.side_list());
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -7,8 +7,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.shared.mime.MimeTypeSupport; import org.gcube.portlets.user.td.widgetcommonevent.shared.mime.MimeTypeSupport;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeUri; import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
@ -41,6 +43,9 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
private static final String THUMBNAIL_HEIGHT = "160px"; private static final String THUMBNAIL_HEIGHT = "160px";
private static final String DESCRIPTION_HEIGHT = "70px"; private static final String DESCRIPTION_HEIGHT = "70px";
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
private Image thumbnail; private Image thumbnail;
private TextField name; private TextField name;
private TextArea description; private TextArea description;
@ -49,11 +54,11 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
private ResourceTDDescriptor descriptor; private ResourceTDDescriptor descriptor;
private TextButton removeButton; private TextButton btnDelete;
private TextButton saveButton; private TextButton btnSave;
private TextButton openButton; private TextButton btnOpen;
private ResourcesListViewPanel parent; private ResourcesListViewPanel parent;
@ -62,10 +67,16 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
public ResourcesListViewDetailPanel(ResourcesListViewPanel parent) { public ResourcesListViewDetailPanel(ResourcesListViewPanel parent) {
super(); super();
this.parent = parent; this.parent = parent;
initMessages();
init(); init();
} }
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void init() { protected void init() {
addStyleName(ThemeStyles.get().style().border()); addStyleName(ThemeStyles.get().style().border());
// getElement().getStyle().setBackgroundColor("white"); // getElement().getStyle().setBackgroundColor("white");
@ -158,17 +169,17 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
thumbnail.setHeight(THUMBNAIL_HEIGHT); thumbnail.setHeight(THUMBNAIL_HEIGHT);
name = new TextField(); name = new TextField();
FieldLabel nameLabel = new FieldLabel(name, "Name"); FieldLabel nameLabel = new FieldLabel(name, msgs.nameLabel());
nameLabel.setLabelAlign(LabelAlign.TOP); nameLabel.setLabelAlign(LabelAlign.TOP);
description = new TextArea(); description = new TextArea();
description.setHeight(DESCRIPTION_HEIGHT); description.setHeight(DESCRIPTION_HEIGHT);
FieldLabel descriptionLabel = new FieldLabel(description, "Description"); FieldLabel descriptionLabel = new FieldLabel(description, msgs.descriptionLabel());
descriptionLabel.setLabelAlign(LabelAlign.TOP); descriptionLabel.setLabelAlign(LabelAlign.TOP);
creationDate = new TextField(); creationDate = new TextField();
FieldLabel creationDateLabel = new FieldLabel(creationDate, FieldLabel creationDateLabel = new FieldLabel(creationDate,
"Creation Date"); msgs.creationDateLabel());
creationDateLabel.setLabelAlign(LabelAlign.TOP); creationDateLabel.setLabelAlign(LabelAlign.TOP);
v = new VerticalLayoutContainer(); v = new VerticalLayoutContainer();
@ -201,10 +212,10 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
return; return;
} }
openButton = new TextButton("Open"); btnOpen = new TextButton(msgs.btnOpenText());
openButton.setIcon(ResourceBundle.INSTANCE.resources()); btnOpen.setIcon(ResourceBundle.INSTANCE.resources());
openButton.setIconAlign(IconAlign.RIGHT); btnOpen.setIconAlign(IconAlign.RIGHT);
openButton.setToolTip("Open"); btnOpen.setToolTip(msgs.btnOpenToolTip());
SelectHandler openHandler = new SelectHandler() { SelectHandler openHandler = new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -212,12 +223,12 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
} }
}; };
openButton.addSelectHandler(openHandler); btnOpen.addSelectHandler(openHandler);
saveButton = new TextButton("Save"); btnSave = new TextButton(msgsCommon.btnSaveText());
saveButton.setIcon(ResourceBundle.INSTANCE.save()); btnSave.setIcon(ResourceBundle.INSTANCE.save());
saveButton.setIconAlign(IconAlign.RIGHT); btnSave.setIconAlign(IconAlign.RIGHT);
saveButton.setToolTip("Save"); btnSave.setToolTip(msgsCommon.btnSaveToolTip());
SelectHandler saveHandler = new SelectHandler() { SelectHandler saveHandler = new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -225,12 +236,12 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
} }
}; };
saveButton.addSelectHandler(saveHandler); btnSave.addSelectHandler(saveHandler);
removeButton = new TextButton("Delete"); btnDelete = new TextButton(msgs.btnDeleteText());
removeButton.setIcon(ResourceBundle.INSTANCE.delete()); btnDelete.setIcon(ResourceBundle.INSTANCE.delete());
removeButton.setIconAlign(IconAlign.RIGHT); btnDelete.setIconAlign(IconAlign.RIGHT);
removeButton.setToolTip("Save"); btnDelete.setToolTip(msgs.btnDeleteToolTip());
SelectHandler removeHandler = new SelectHandler() { SelectHandler removeHandler = new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -238,72 +249,72 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
} }
}; };
removeButton.addSelectHandler(removeHandler); btnDelete.addSelectHandler(removeHandler);
ResourceTDType resourceTDType = descriptor.getResourceType(); ResourceTDType resourceTDType = descriptor.getResourceType();
switch (resourceTDType) { switch (resourceTDType) {
case CHART: case CHART:
openButton.setIcon(ResourceBundle.INSTANCE.chart()); btnOpen.setIcon(ResourceBundle.INSTANCE.chart());
openButton.setVisible(true); btnOpen.setVisible(true);
saveButton.setVisible(true); btnSave.setVisible(true);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case CODELIST: case CODELIST:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(false); btnSave.setVisible(false);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case CSV: case CSV:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(true); btnSave.setVisible(true);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case GENERIC_FILE: case GENERIC_FILE:
openButton.setIcon(ResourceBundle.INSTANCE.file()); btnOpen.setIcon(ResourceBundle.INSTANCE.file());
openButton.setVisible(true); btnOpen.setVisible(true);
saveButton.setVisible(true); btnSave.setVisible(true);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case GENERIC_TABLE: case GENERIC_TABLE:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(false); btnSave.setVisible(false);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case GUESSER: case GUESSER:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(false); btnSave.setVisible(false);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case JSON: case JSON:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(true); btnSave.setVisible(true);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case MAP: case MAP:
openButton.setIcon(ResourceBundle.INSTANCE.gis()); btnOpen.setIcon(ResourceBundle.INSTANCE.gis());
openButton.setVisible(true); btnOpen.setVisible(true);
saveButton.setVisible(false); btnSave.setVisible(false);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
case SDMX: case SDMX:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(false); btnSave.setVisible(false);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
default: default:
openButton.setVisible(false); btnOpen.setVisible(false);
saveButton.setVisible(false); btnSave.setVisible(false);
removeButton.setVisible(true); btnDelete.setVisible(true);
break; break;
} }
buttonMenu = new HBoxLayoutContainer(); buttonMenu = new HBoxLayoutContainer();
buttonMenu.setPack(BoxLayoutPack.CENTER); buttonMenu.setPack(BoxLayoutPack.CENTER);
buttonMenu.add(openButton, new BoxLayoutData(new Margins(5, 2, 5, 2))); buttonMenu.add(btnOpen, new BoxLayoutData(new Margins(5, 2, 5, 2)));
buttonMenu.add(saveButton, new BoxLayoutData(new Margins(5, 2, 5, 2))); buttonMenu.add(btnSave, new BoxLayoutData(new Margins(5, 2, 5, 2)));
buttonMenu buttonMenu
.add(removeButton, new BoxLayoutData(new Margins(5, 2, 5, 2))); .add(btnDelete, new BoxLayoutData(new Margins(5, 2, 5, 2)));
} }

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.resourceswidget.client;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -18,8 +19,10 @@ public class ResourcesListViewDialog extends Window {
private static final String WIDTH = "640px"; private static final String WIDTH = "640px";
private static final String HEIGHT = "480px"; private static final String HEIGHT = "480px";
private ResourcesListViewPanel resourcesPanel; private ResourcesListViewPanel resourcesPanel;
private ResourcesMessages msgs;
public ResourcesListViewDialog(EventBus eventBus) { public ResourcesListViewDialog(EventBus eventBus) {
initMessages();
initWindow(); initWindow();
resourcesPanel = new ResourcesListViewPanel( resourcesPanel = new ResourcesListViewPanel(
eventBus); eventBus);
@ -28,12 +31,16 @@ public class ResourcesListViewDialog extends Window {
} }
protected void initMessages() {
msgs = GWT.create(ResourcesMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Resources List View"); setHeadingText(msgs.resourcesListViewDialogHead());
// getHeader().setIcon(Resources.IMAGES.side_list()); // getHeader().setIcon(Resources.IMAGES.side_list());
} }

View File

@ -21,6 +21,7 @@ import org.gcube.portlets.user.td.resourceswidget.client.charts.ChartViewerDialo
import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.resourceswidget.client.save.SaveResourceWizard; import org.gcube.portlets.user.td.resourceswidget.client.save.SaveResourceWizard;
import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -200,19 +201,26 @@ public class ResourcesListViewPanel extends FramedPanel {
private Menu contextMenu; private Menu contextMenu;
private MenuItem openItem; private MenuItem openItem;
private MenuItem saveItem; private MenuItem saveItem;
private MenuItem removeItem; private MenuItem deleteItem;
private RemoveResourceSession removeResourceSession; private RemoveResourceSession removeResourceSession;
private SaveResourceSession saveResourceSession; private SaveResourceSession saveResourceSession;
private ToolBar statusBar; private ToolBar statusBar;
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
public ResourcesListViewPanel(EventBus eventBus) { public ResourcesListViewPanel(EventBus eventBus) {
super(); super();
this.eventBus = eventBus; this.eventBus = eventBus;
forceLayoutOnResize = true; initMessages();
init(); init();
create(); create();
} }
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
public void open(TRId trId) { public void open(TRId trId) {
try { try {
this.trId = trId; this.trId = trId;
@ -226,6 +234,7 @@ public class ResourcesListViewPanel extends FramedPanel {
} }
protected void init() { protected void init() {
forceLayoutOnResize = true;
setHeaderVisible(false); setHeaderVisible(false);
setBodyBorder(false); setBodyBorder(false);
setResize(true); setResize(true);
@ -300,10 +309,10 @@ public class ResourcesListViewPanel extends FramedPanel {
filterField.bind(store); filterField.bind(store);
ToolBar toolBar = new ToolBar(); ToolBar toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Filter:")); toolBar.add(new LabelToolItem(msgs.toolBarFilterLabel()));
toolBar.add(filterField); toolBar.add(filterField);
toolBar.add(new SeparatorToolItem()); toolBar.add(new SeparatorToolItem());
toolBar.add(new LabelToolItem("Sort By:")); toolBar.add(new LabelToolItem(msgs.toolBarSortBy()));
comboSort = new SimpleComboBox<String>( comboSort = new SimpleComboBox<String>(
new StringLabelProvider<String>()); new StringLabelProvider<String>());
@ -519,13 +528,12 @@ public class ResourcesListViewPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.error("Error Retrieving Resources: " Log.error("Error Retrieving Resources: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert( UtilsGXT3.alert(msgs.errorRetrievingResourcesHead(),
"Error retrieving resources",
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
} }
@ -538,12 +546,10 @@ public class ResourcesListViewPanel extends FramedPanel {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
statusBar.clear(); statusBar.clear();
statusBar statusBar
.add(new LabelToolItem( .add(new LabelToolItem(msgs.statusBarNumberOfResources(result.size())));
"Number of Resources: "
+ result.size()));
} else { } else {
statusBar.clear(); statusBar.clear();
statusBar.add(new LabelToolItem("No Resource")); statusBar.add(new LabelToolItem(msgs.statusBarNoResource()));
} }
statusBar.forceLayout(); statusBar.forceLayout();
@ -563,7 +569,7 @@ public class ResourcesListViewPanel extends FramedPanel {
contextMenu = new Menu(); contextMenu = new Menu();
openItem = new MenuItem(); openItem = new MenuItem();
openItem.setText("Open"); openItem.setText(msgs.itemOpenText());
openItem.setIcon(ResourceBundle.INSTANCE.resources()); openItem.setIcon(ResourceBundle.INSTANCE.resources());
openItem.addSelectionHandler(new SelectionHandler<Item>() { openItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -582,7 +588,7 @@ public class ResourcesListViewPanel extends FramedPanel {
}); });
saveItem = new MenuItem(); saveItem = new MenuItem();
saveItem.setText("Save"); saveItem.setText(msgs.itemSaveText());
saveItem.setIcon(ResourceBundle.INSTANCE.save()); saveItem.setIcon(ResourceBundle.INSTANCE.save());
saveItem.addSelectionHandler(new SelectionHandler<Item>() { saveItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -600,10 +606,10 @@ public class ResourcesListViewPanel extends FramedPanel {
}); });
removeItem = new MenuItem(); deleteItem = new MenuItem();
removeItem.setText("Delete"); deleteItem.setText(msgs.itemDeleteText());
removeItem.setIcon(ResourceBundle.INSTANCE.delete()); deleteItem.setIcon(ResourceBundle.INSTANCE.delete());
removeItem.addSelectionHandler(new SelectionHandler<Item>() { deleteItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override @Override
public void onSelection(SelectionEvent<Item> event) { public void onSelection(SelectionEvent<Item> event) {
@ -633,41 +639,41 @@ public class ResourcesListViewPanel extends FramedPanel {
openItem.setIcon(ResourceBundle.INSTANCE.chart()); openItem.setIcon(ResourceBundle.INSTANCE.chart());
contextMenu.add(openItem); contextMenu.add(openItem);
contextMenu.add(saveItem); contextMenu.add(saveItem);
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case CODELIST: case CODELIST:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case CSV: case CSV:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(saveItem); contextMenu.add(saveItem);
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case GUESSER: case GUESSER:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case JSON: case JSON:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(saveItem); contextMenu.add(saveItem);
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case MAP: case MAP:
contextMenu.clear(); contextMenu.clear();
openItem.setIcon(ResourceBundle.INSTANCE.gis()); openItem.setIcon(ResourceBundle.INSTANCE.gis());
contextMenu.add(openItem); contextMenu.add(openItem);
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case SDMX: case SDMX:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case GENERIC_FILE: case GENERIC_FILE:
@ -675,17 +681,17 @@ public class ResourcesListViewPanel extends FramedPanel {
openItem.setIcon(ResourceBundle.INSTANCE.file()); openItem.setIcon(ResourceBundle.INSTANCE.file());
contextMenu.add(openItem); contextMenu.add(openItem);
contextMenu.add(saveItem); contextMenu.add(saveItem);
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
case GENERIC_TABLE: case GENERIC_TABLE:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
break; break;
default: default:
contextMenu.clear(); contextMenu.clear();
contextMenu.add(removeItem); contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu); listView.setContextMenu(contextMenu);
event.setCancelled(true); event.setCancelled(true);
break; break;
@ -744,7 +750,7 @@ public class ResourcesListViewPanel extends FramedPanel {
public void onSuccess() { public void onSuccess() {
SaveResourceWizard saveResourceWizard = new SaveResourceWizard( SaveResourceWizard saveResourceWizard = new SaveResourceWizard(
saveResourceSession, "Save Resource", eventBus); saveResourceSession, msgs.saveResourceWizardHead(), eventBus);
saveResourceWizard.addListener(new WizardListener() { saveResourceWizard.addListener(new WizardListener() {
@ -795,13 +801,13 @@ public class ResourcesListViewPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.error("Error removing the resource: " Log.error("Error removing the resource: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error removing the resource: " msgs.errorRemovingTheResource()
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
} }
} }
@ -874,8 +880,8 @@ public class ResourcesListViewPanel extends FramedPanel {
} else { } else {
Log.error("Error with uri resolver: " Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error retrieving uri from resolver"); msgs.errorRetrievingURIFromResolver());
} }
} }
@ -904,8 +910,8 @@ public class ResourcesListViewPanel extends FramedPanel {
Log.error("Error with uri resolver: " Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3 UtilsGXT3
.alert("Error", .alert(msgsCommon.error(),
"Error retrieving uri from resolver"); msgs.errorRetrievingURIFromResolver());
} }
} }
@ -922,8 +928,8 @@ public class ResourcesListViewPanel extends FramedPanel {
} else { } else {
Log.error("Error with resource: no valid resource"); Log.error("Error with resource: no valid resource");
UtilsGXT3.alert("Error with resource", UtilsGXT3.alert(msgsCommon.error(),
"Error no valid InternalUri"); msgs.errorNoValidInternalUri());
} }
@ -985,8 +991,8 @@ public class ResourcesListViewPanel extends FramedPanel {
} else { } else {
Log.error("Error with uri resolver: " Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error retrieving uri from resolver"); msgs.errorRetrievingURIFromResolver());
} }
} }
@ -1000,7 +1006,7 @@ public class ResourcesListViewPanel extends FramedPanel {
} else { } else {
Log.error("Error with resource: no valid resource"); Log.error("Error with resource: no valid resource");
UtilsGXT3 UtilsGXT3
.alert("Error with resource", "Error no valid InternalUri"); .alert(msgsCommon.error(), msgs.errorNoValidInternalUri());
} }
} }

View File

@ -0,0 +1,122 @@
package org.gcube.portlets.user.td.resourceswidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface ResourcesMessages extends Messages {
@DefaultMessage("Resources List View")
String resourcesListViewDialogHead();
@DefaultMessage("Filter:")
String toolBarFilterLabel();
@DefaultMessage("Sort By:")
String toolBarSortBy();
@DefaultMessage("Error retrieving resources")
String errorRetrievingResourcesHead();
@DefaultMessage("Number of Resources: {0}")
String statusBarNumberOfResources(int size);
@DefaultMessage("No Resource")
String statusBarNoResource();
@DefaultMessage("Open")
String itemOpenText();
@DefaultMessage("Save")
String itemSaveText();
@DefaultMessage("Delete")
String itemDeleteText();
@DefaultMessage("Save Resource")
String saveResourceWizardHead();
@DefaultMessage("Error removing the resource: ")
String errorRemovingTheResource();
@DefaultMessage("Error retrieving uri from resolver!")
String errorRetrievingURIFromResolver();
@DefaultMessage("Error no valid InternalUri!")
String errorNoValidInternalUri();
@DefaultMessage("Name")
String nameLabel();
@DefaultMessage("Description")
String descriptionLabel();
@DefaultMessage("Creation Date")
String creationDateLabel();
@DefaultMessage("Open")
String btnOpenText();
@DefaultMessage("Open")
String btnOpenToolTip();
@DefaultMessage("Delete")
String btnDeleteText();
@DefaultMessage("Delete")
String btnDeleteToolTip();
@DefaultMessage("Resources")
String resourcesDialogHead();
@DefaultMessage("Error retrieving User Info")
String errorRetrievingUserInfo();
@DefaultMessage("Name: ")
String nameLabelFixed();
@DefaultMessage("Description: ")
String descriptionLabelFixed();
@DefaultMessage("Creation Date: ")
String creationDateLabelFixed();
@DefaultMessage("Creator Id: ")
String creatorIdLabelFixed();
@DefaultMessage("Type: ")
String typeLabelFixed();
@DefaultMessage("Value: ")
String valueLabelFixed();
@DefaultMessage("Table Id: ")
String tableIdLabelFixed();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Type")
String typeCol();
@DefaultMessage("Empty")
String gridEmptyText();
@DefaultMessage("Error removing the resource: ")
String errorRetrievingResourcesFixed();
@DefaultMessage("Error retrieving current tabular resource id!")
String errorRetrievingCurrentTabularResourceId();
@DefaultMessage("Error get TR information!")
String errorGetTRInformation();
@DefaultMessage("Error setting Active TR!")
String errorSettingActiveTR();
}

View File

@ -6,8 +6,6 @@ import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.RemoveResourceSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.RemoveResourceSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
@ -24,6 +22,7 @@ import org.gcube.portlets.user.td.resourceswidget.client.properties.ResourceTDDe
import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.resourceswidget.client.save.SaveResourceWizard; import org.gcube.portlets.user.td.resourceswidget.client.save.SaveResourceWizard;
import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -60,7 +59,6 @@ import com.sencha.gxt.data.shared.loader.ListLoader;
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding; import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.container.MarginData; import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent; import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent;
import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent.BeforeShowContextMenuHandler; import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent.BeforeShowContextMenuHandler;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -84,24 +82,21 @@ import com.sencha.gxt.widget.core.client.menu.MenuItem;
* *
*/ */
public class ResourcesPanel extends FramedPanel { public class ResourcesPanel extends FramedPanel {
protected String WIDTH = "298px"; private static final String GRID_RESOURCE_HEIGHT = "300px";
protected String HEIGHT = "520px"; private static final String GRID_RESOURCE_WIDTH = "200px";
private static final String WIDTH = "298px";
private static final String HEIGHT = "520px";
protected ResourcesDialog parent; private CommonMessages msgsCommon;
protected UserInfo userInfo; private ResourcesMessages msgs;
protected TRId trId;
protected TableData table;
protected String headingTitle;
protected VerticalLayoutContainer vl;
protected EventBus eventBus;
protected ListStore<ResourceTDDescriptor> store; private ResourcesDialog parent;
protected ListLoader<ListLoadConfig, ListLoadResult<ResourceTDDescriptor>> loader; private TRId trId;
protected Grid<ResourceTDDescriptor> grid; private EventBus eventBus;
protected ResourceTDDescriptor currentTDDescriptor; private ListStore<ResourceTDDescriptor> store;
protected int currentRowIndex; private ListLoader<ListLoadConfig, ListLoadResult<ResourceTDDescriptor>> loader;
protected RollBackSession rollBackSession; private Grid<ResourceTDDescriptor> grid;
private boolean drawed = false; private boolean drawed = false;
private Menu contextMenu; private Menu contextMenu;
@ -118,6 +113,7 @@ public class ResourcesPanel extends FramedPanel {
this.trId = trId; this.trId = trId;
this.eventBus = eventBus; this.eventBus = eventBus;
forceLayoutOnResize = true; forceLayoutOnResize = true;
initMessages();
retrieveUserInfo(); retrieveUserInfo();
} }
@ -126,9 +122,15 @@ public class ResourcesPanel extends FramedPanel {
this.trId = trId; this.trId = trId;
this.eventBus = eventBus; this.eventBus = eventBus;
forceLayoutOnResize = true; forceLayoutOnResize = true;
initMessages();
retrieveUserInfo(); retrieveUserInfo();
} }
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void retrieveUserInfo() { protected void retrieveUserInfo() {
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() { TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
@ -140,7 +142,7 @@ public class ResourcesPanel extends FramedPanel {
Log.error("Error Retrieving User Info: " Log.error("Error Retrieving User Info: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error retrieving User Info"); UtilsGXT3.alert(msgsCommon.error(), msgs.errorRetrievingUserInfo());
} }
} }
@ -187,7 +189,7 @@ public class ResourcesPanel extends FramedPanel {
+ "width: 100%; border: none;" + "width: 100%; border: none;"
+ "font-size: 12px; margin:2px; text-align: left;'>" + "font-size: 12px; margin:2px; text-align: left;'>"
+ "<tr>" + "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Name: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.nameLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ SafeHtmlUtils.htmlEscape(value.getName()) + SafeHtmlUtils.htmlEscape(value.getName())
+ +
@ -195,7 +197,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>" "</td>"
+ "</tr>" + "</tr>"
+ "<tr>" + "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Description: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.descriptionLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ SafeHtmlUtils.htmlEscape(value + SafeHtmlUtils.htmlEscape(value
.getDescription()) .getDescription())
@ -204,7 +206,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>" "</td>"
+ "</tr>" + "</tr>"
+ "<tr>" + "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Creation Date: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.creationDateLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ SafeHtmlUtils.htmlEscape(value + SafeHtmlUtils.htmlEscape(value
.getCreationDate()) .getCreationDate())
@ -213,7 +215,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>" "</td>"
+ "</tr>" + "</tr>"
+ "<tr>" + "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Creator Id: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.creatorIdLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ new SafeHtmlBuilder() + new SafeHtmlBuilder()
.append(value.getCreatorId()) .append(value.getCreatorId())
@ -223,7 +225,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>" "</td>"
+ "</tr>" + "</tr>"
+ "<tr>" + "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Type: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.typeLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ SafeHtmlUtils.htmlEscape(value + SafeHtmlUtils.htmlEscape(value
.getResourceType().toString()) .getResourceType().toString())
@ -249,7 +251,7 @@ public class ResourcesPanel extends FramedPanel {
if (resource instanceof StringResourceTD) { if (resource instanceof StringResourceTD) {
StringResourceTD stringResourceTD = (StringResourceTD) resource; StringResourceTD stringResourceTD = (StringResourceTD) resource;
resourceData = "<tr>" resourceData = "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Value: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.valueLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ SafeHtmlUtils + SafeHtmlUtils
.htmlEscape(stringResourceTD .htmlEscape(stringResourceTD
@ -260,7 +262,7 @@ public class ResourcesPanel extends FramedPanel {
if (resource instanceof TableResourceTD) { if (resource instanceof TableResourceTD) {
TableResourceTD tableResourceTD = (TableResourceTD) resource; TableResourceTD tableResourceTD = (TableResourceTD) resource;
resourceData = "<tr>" resourceData = "<tr>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>Table Id: </b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"+msgs.tableIdLabelFixed()+"</b></td>"
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
+ new SafeHtmlBuilder() + new SafeHtmlBuilder()
.append(tableResourceTD .append(tableResourceTD
@ -281,7 +283,7 @@ public class ResourcesPanel extends FramedPanel {
}); });
ColumnConfig<ResourceTDDescriptor, String> nameCol = new ColumnConfig<ResourceTDDescriptor, String>( ColumnConfig<ResourceTDDescriptor, String> nameCol = new ColumnConfig<ResourceTDDescriptor, String>(
props.name(), 142, "Name"); props.name(), 142, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -296,7 +298,7 @@ public class ResourcesPanel extends FramedPanel {
}); });
ColumnConfig<ResourceTDDescriptor, ResourceTDType> typeColumn = new ColumnConfig<ResourceTDDescriptor, ResourceTDType>( ColumnConfig<ResourceTDDescriptor, ResourceTDType> typeColumn = new ColumnConfig<ResourceTDDescriptor, ResourceTDType>(
props.resourceType(), 30, "Type"); props.resourceType(), 30, msgs.typeCol());
ResourceTDTypeButtonCell button = new ResourceTDTypeButtonCell(); ResourceTDTypeButtonCell button = new ResourceTDTypeButtonCell();
button.addSelectHandler(new SelectHandler() { button.addSelectHandler(new SelectHandler() {
@ -369,7 +371,7 @@ public class ResourcesPanel extends FramedPanel {
grid.setLoader(loader); grid.setLoader(loader);
grid.setSelectionModel(sm); grid.setSelectionModel(sm);
grid.setSize("200px", "300px"); grid.setSize(GRID_RESOURCE_WIDTH, GRID_RESOURCE_HEIGHT);
grid.getView().setStripeRows(true); grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true); grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true); grid.getView().setAutoFill(true);
@ -378,7 +380,7 @@ public class ResourcesPanel extends FramedPanel {
grid.setColumnReordering(true); grid.setColumnReordering(true);
grid.setColumnResize(true); grid.setColumnResize(true);
grid.getView().setAutoExpandColumn(nameCol); grid.getView().setAutoExpandColumn(nameCol);
grid.getView().setEmptyText("Empty"); grid.getView().setEmptyText(msgs.gridEmptyText());
expander.initPlugin(grid); expander.initPlugin(grid);
@ -393,7 +395,7 @@ public class ResourcesPanel extends FramedPanel {
contextMenu = new Menu(); contextMenu = new Menu();
openItem = new MenuItem(); openItem = new MenuItem();
openItem.setText("Open"); openItem.setText(msgs.itemOpenText());
openItem.setIcon(ResourceBundle.INSTANCE.resources()); openItem.setIcon(ResourceBundle.INSTANCE.resources());
openItem.addSelectionHandler(new SelectionHandler<Item>() { openItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -408,7 +410,7 @@ public class ResourcesPanel extends FramedPanel {
}); });
saveItem = new MenuItem(); saveItem = new MenuItem();
saveItem.setText("Save"); saveItem.setText(msgs.itemSaveText());
saveItem.setIcon(ResourceBundle.INSTANCE.save()); saveItem.setIcon(ResourceBundle.INSTANCE.save());
saveItem.addSelectionHandler(new SelectionHandler<Item>() { saveItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -423,7 +425,7 @@ public class ResourcesPanel extends FramedPanel {
}); });
removeItem = new MenuItem(); removeItem = new MenuItem();
removeItem.setText("Delete"); removeItem.setText(msgs.itemDeleteText());
removeItem.setIcon(ResourceBundle.INSTANCE.delete()); removeItem.setIcon(ResourceBundle.INSTANCE.delete());
removeItem.addSelectionHandler(new SelectionHandler<Item>() { removeItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -565,7 +567,7 @@ public class ResourcesPanel extends FramedPanel {
public void onSuccess() { public void onSuccess() {
SaveResourceWizard saveResourceWizard = new SaveResourceWizard( SaveResourceWizard saveResourceWizard = new SaveResourceWizard(
saveResourceSession, "Save Resource", eventBus); saveResourceSession, msgs.saveResourceWizardHead(), eventBus);
saveResourceWizard.addListener(new WizardListener() { saveResourceWizard.addListener(new WizardListener() {
@ -618,13 +620,13 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.error("Error removing the resource: " Log.error("Error removing the resource: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error removing the resource: " msgs.errorRetrievingResourcesFixed()
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
} }
} }
@ -695,8 +697,8 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
Log.error("Error with uri resolver: " Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error retrieving uri from resolver"); msgs.errorRetrievingURIFromResolver());
} }
} }
@ -725,8 +727,8 @@ public class ResourcesPanel extends FramedPanel {
Log.error("Error with uri resolver: " Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3 UtilsGXT3
.alert("Error", .alert(msgsCommon.error(),
"Error retrieving uri from resolver"); msgs.errorRetrievingURIFromResolver());
} }
} }
@ -743,8 +745,8 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
Log.error("Error with resource: no valid resource"); Log.error("Error with resource: no valid resource");
UtilsGXT3.alert("Error with resource", UtilsGXT3.alert(msgsCommon.error(),
"Error no valid InternalUri"); msgs.errorNoValidInternalUri());
} }
@ -772,8 +774,8 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
Log.error("Error with uri resolver: " Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error retrieving uri from resolver"); msgs.errorRetrievingURIFromResolver());
} }
} }
@ -792,8 +794,8 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
Log.error("Error with resource: no valid resource"); Log.error("Error with resource: no valid resource");
UtilsGXT3.alert("Error with resource", UtilsGXT3.alert(msgsCommon.error(),
"Error no valid InternalUri"); msgs.errorNoValidInternalUri());
} }
@ -814,12 +816,12 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.error("Error Retrieving Resources: " Log.error("Error Retrieving Resources: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving resources", UtilsGXT3.alert(msgs.errorRetrievingResourcesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
} }
@ -857,13 +859,13 @@ public class ResourcesPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.error("Error retrieving current TRId: " Log.error("Error retrieving current TRId: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"Error retrieving current tabular resource id"); msgs.errorRetrievingCurrentTabularResourceId());
} }
} }
} }

View File

@ -5,12 +5,14 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo; import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.SimpleEventBus; import com.google.web.bindery.event.shared.SimpleEventBus;
@ -23,6 +25,8 @@ import com.google.web.bindery.event.shared.SimpleEventBus;
public class ResourcesWidgetEntry implements EntryPoint { public class ResourcesWidgetEntry implements EntryPoint {
// private ResourceTDDescriptor resourceTDDescriptor; // private ResourceTDDescriptor resourceTDDescriptor;
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
private SimpleEventBus eventBus; private SimpleEventBus eventBus;
private TRId trId; private TRId trId;
@ -30,6 +34,7 @@ public class ResourcesWidgetEntry implements EntryPoint {
public void onModuleLoad() { public void onModuleLoad() {
Log.info("Hello!"); Log.info("Hello!");
initMessages();
eventBus = new SimpleEventBus(); eventBus = new SimpleEventBus();
trId = new TRId(); trId = new TRId();
// TabularResource: [ id=202, type=STANDARD, lastTable=[ id=4901, // TabularResource: [ id=202, type=STANDARD, lastTable=[ id=4901,
@ -43,6 +48,11 @@ public class ResourcesWidgetEntry implements EntryPoint {
retrieveUserInfo(); retrieveUserInfo();
} }
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
private void start() { private void start() {
try { try {
// ResourcesDialog dialog=new ResourcesDialog(trId,eventBus); // ResourcesDialog dialog=new ResourcesDialog(trId,eventBus);
@ -76,7 +86,7 @@ public class ResourcesWidgetEntry implements EntryPoint {
Log.error("Error Retrieving User Info: " Log.error("Error Retrieving User Info: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error retrieving User Info"); UtilsGXT3.alert(msgsCommon.error(), msgs.errorRetrievingUserInfo());
} }
} }
@ -103,7 +113,7 @@ public class ResourcesWidgetEntry implements EntryPoint {
Log.error("Error get TR information: " Log.error("Error get TR information: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3 UtilsGXT3
.alert("Error", "Error get TR information"); .alert(msgsCommon.error(), msgs.errorGetTRInformation());
} }
@ -132,7 +142,7 @@ public class ResourcesWidgetEntry implements EntryPoint {
Log.error("Error setting Active TR: " Log.error("Error setting Active TR: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error setting Active TR"); UtilsGXT3.alert(msgsCommon.error(), msgs.errorSettingActiveTR());
} }

View File

@ -2,6 +2,8 @@
<module rename-to='ResourcesWidget'> <module rename-to='ResourcesWidget'>
<!-- Inherit the core Web Toolkit stuff. --> <!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' /> <inherits name='com.google.gwt.user.User' />
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
<inherits name="com.google.gwt.http.HTTP"/> <inherits name="com.google.gwt.http.HTTP"/>
@ -12,7 +14,7 @@
<!-- Inherit the default GWT style sheet. You can change --> <!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting --> <!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. --> <!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' /> <!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
@ -32,6 +34,26 @@
<!-- <entry-point class='org.gcube.portlets.user.td.resourceswidget.client.ResourcesWidgetEntry' <!-- <entry-point class='org.gcube.portlets.user.td.resourceswidget.client.ResourcesWidgetEntry'
/> --> /> -->
<!--
<set-configuration-property name="locale.cookie"
value="TDLangCookie" />
<set-configuration-property name="locale.queryparam"
value="TDLang" />
<set-configuration-property name="locale.usemeta"
value="Y" />
<set-configuration-property name="locale.useragent"
value="Y" />
<set-configuration-property name="locale.searchorder"
value="cookie,queryparam,meta,useragent" />
<extend-property name="locale" values="en" />
<extend-property name="locale" values="it" />
<extend-property name="locale" values="es" />
<set-property name="locale" value="en, it, es" />
<set-property-fallback name="locale" value="en" />
-->
<!-- Specify the paths for translatable code --> <!-- Specify the paths for translatable code -->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />