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'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
<inherits name="com.google.gwt.http.HTTP"/>
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
@ -10,7 +12,7 @@
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- 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.dark.Dark'/> -->
@ -29,6 +31,26 @@
<!-- Specify the app entry point class. -->
<!-- <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 -->
<source path='client' />

View File

@ -1,8 +1,8 @@
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 com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
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 {
protected String WIDTH = "320px";
protected String HEIGHT = "540px";
protected TRId trId;
protected EventBus eventBus;
protected UserInfo userInfo;
private static final String WIDTH = "320px";
private static final String HEIGHT = "540px";
private ResourcesMessages msgs;
public ResourcesDialog(TRId trId, EventBus eventBus) {
this.trId = trId;
this.eventBus=eventBus;
initMessages();
initWindow();
ResourcesPanel resourcesPanel= new ResourcesPanel(this, trId, eventBus);
add(resourcesPanel);
}
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Resources");
setHeadingText(msgs.resourcesDialogHead());
//getHeader().setIcon(Resources.IMAGES.side_list());
}
/**
* {@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.ResourceTDType;
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 com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.user.client.ui.Image;
@ -40,7 +42,10 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
private static final String THUMBNAIL_WIDTH = "160px";
private static final String THUMBNAIL_HEIGHT = "160px";
private static final String DESCRIPTION_HEIGHT = "70px";
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
private Image thumbnail;
private TextField name;
private TextArea description;
@ -49,11 +54,11 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
private ResourceTDDescriptor descriptor;
private TextButton removeButton;
private TextButton btnDelete;
private TextButton saveButton;
private TextButton btnSave;
private TextButton openButton;
private TextButton btnOpen;
private ResourcesListViewPanel parent;
@ -62,9 +67,15 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
public ResourcesListViewDetailPanel(ResourcesListViewPanel parent) {
super();
this.parent = parent;
initMessages();
init();
}
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void init() {
addStyleName(ThemeStyles.get().style().border());
@ -158,17 +169,17 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
thumbnail.setHeight(THUMBNAIL_HEIGHT);
name = new TextField();
FieldLabel nameLabel = new FieldLabel(name, "Name");
FieldLabel nameLabel = new FieldLabel(name, msgs.nameLabel());
nameLabel.setLabelAlign(LabelAlign.TOP);
description = new TextArea();
description.setHeight(DESCRIPTION_HEIGHT);
FieldLabel descriptionLabel = new FieldLabel(description, "Description");
FieldLabel descriptionLabel = new FieldLabel(description, msgs.descriptionLabel());
descriptionLabel.setLabelAlign(LabelAlign.TOP);
creationDate = new TextField();
FieldLabel creationDateLabel = new FieldLabel(creationDate,
"Creation Date");
msgs.creationDateLabel());
creationDateLabel.setLabelAlign(LabelAlign.TOP);
v = new VerticalLayoutContainer();
@ -201,10 +212,10 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
return;
}
openButton = new TextButton("Open");
openButton.setIcon(ResourceBundle.INSTANCE.resources());
openButton.setIconAlign(IconAlign.RIGHT);
openButton.setToolTip("Open");
btnOpen = new TextButton(msgs.btnOpenText());
btnOpen.setIcon(ResourceBundle.INSTANCE.resources());
btnOpen.setIconAlign(IconAlign.RIGHT);
btnOpen.setToolTip(msgs.btnOpenToolTip());
SelectHandler openHandler = new SelectHandler() {
public void onSelect(SelectEvent event) {
@ -212,12 +223,12 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
}
};
openButton.addSelectHandler(openHandler);
btnOpen.addSelectHandler(openHandler);
saveButton = new TextButton("Save");
saveButton.setIcon(ResourceBundle.INSTANCE.save());
saveButton.setIconAlign(IconAlign.RIGHT);
saveButton.setToolTip("Save");
btnSave = new TextButton(msgsCommon.btnSaveText());
btnSave.setIcon(ResourceBundle.INSTANCE.save());
btnSave.setIconAlign(IconAlign.RIGHT);
btnSave.setToolTip(msgsCommon.btnSaveToolTip());
SelectHandler saveHandler = new SelectHandler() {
public void onSelect(SelectEvent event) {
@ -225,12 +236,12 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
}
};
saveButton.addSelectHandler(saveHandler);
btnSave.addSelectHandler(saveHandler);
removeButton = new TextButton("Delete");
removeButton.setIcon(ResourceBundle.INSTANCE.delete());
removeButton.setIconAlign(IconAlign.RIGHT);
removeButton.setToolTip("Save");
btnDelete = new TextButton(msgs.btnDeleteText());
btnDelete.setIcon(ResourceBundle.INSTANCE.delete());
btnDelete.setIconAlign(IconAlign.RIGHT);
btnDelete.setToolTip(msgs.btnDeleteToolTip());
SelectHandler removeHandler = new SelectHandler() {
public void onSelect(SelectEvent event) {
@ -238,72 +249,72 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
}
};
removeButton.addSelectHandler(removeHandler);
btnDelete.addSelectHandler(removeHandler);
ResourceTDType resourceTDType = descriptor.getResourceType();
switch (resourceTDType) {
case CHART:
openButton.setIcon(ResourceBundle.INSTANCE.chart());
openButton.setVisible(true);
saveButton.setVisible(true);
removeButton.setVisible(true);
btnOpen.setIcon(ResourceBundle.INSTANCE.chart());
btnOpen.setVisible(true);
btnSave.setVisible(true);
btnDelete.setVisible(true);
break;
case CODELIST:
openButton.setVisible(false);
saveButton.setVisible(false);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(false);
btnDelete.setVisible(true);
break;
case CSV:
openButton.setVisible(false);
saveButton.setVisible(true);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(true);
btnDelete.setVisible(true);
break;
case GENERIC_FILE:
openButton.setIcon(ResourceBundle.INSTANCE.file());
openButton.setVisible(true);
saveButton.setVisible(true);
removeButton.setVisible(true);
btnOpen.setIcon(ResourceBundle.INSTANCE.file());
btnOpen.setVisible(true);
btnSave.setVisible(true);
btnDelete.setVisible(true);
break;
case GENERIC_TABLE:
openButton.setVisible(false);
saveButton.setVisible(false);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(false);
btnDelete.setVisible(true);
break;
case GUESSER:
openButton.setVisible(false);
saveButton.setVisible(false);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(false);
btnDelete.setVisible(true);
break;
case JSON:
openButton.setVisible(false);
saveButton.setVisible(true);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(true);
btnDelete.setVisible(true);
break;
case MAP:
openButton.setIcon(ResourceBundle.INSTANCE.gis());
openButton.setVisible(true);
saveButton.setVisible(false);
removeButton.setVisible(true);
btnOpen.setIcon(ResourceBundle.INSTANCE.gis());
btnOpen.setVisible(true);
btnSave.setVisible(false);
btnDelete.setVisible(true);
break;
case SDMX:
openButton.setVisible(false);
saveButton.setVisible(false);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(false);
btnDelete.setVisible(true);
break;
default:
openButton.setVisible(false);
saveButton.setVisible(false);
removeButton.setVisible(true);
btnOpen.setVisible(false);
btnSave.setVisible(false);
btnDelete.setVisible(true);
break;
}
buttonMenu = new HBoxLayoutContainer();
buttonMenu.setPack(BoxLayoutPack.CENTER);
buttonMenu.add(openButton, new BoxLayoutData(new Margins(5, 2, 5, 2)));
buttonMenu.add(saveButton, new BoxLayoutData(new Margins(5, 2, 5, 2)));
buttonMenu.add(btnOpen, new BoxLayoutData(new Margins(5, 2, 5, 2)));
buttonMenu.add(btnSave, new BoxLayoutData(new Margins(5, 2, 5, 2)));
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 com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
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 HEIGHT = "480px";
private ResourcesListViewPanel resourcesPanel;
private ResourcesMessages msgs;
public ResourcesListViewDialog(EventBus eventBus) {
initMessages();
initWindow();
resourcesPanel = new ResourcesListViewPanel(
eventBus);
@ -27,13 +30,17 @@ public class ResourcesListViewDialog extends Window {
}
protected void initMessages() {
msgs = GWT.create(ResourcesMessages.class);
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Resources List View");
setHeadingText(msgs.resourcesListViewDialogHead());
// 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.save.SaveResourceWizard;
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.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -200,18 +201,25 @@ public class ResourcesListViewPanel extends FramedPanel {
private Menu contextMenu;
private MenuItem openItem;
private MenuItem saveItem;
private MenuItem removeItem;
private MenuItem deleteItem;
private RemoveResourceSession removeResourceSession;
private SaveResourceSession saveResourceSession;
private ToolBar statusBar;
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
public ResourcesListViewPanel(EventBus eventBus) {
super();
this.eventBus = eventBus;
forceLayoutOnResize = true;
initMessages();
init();
create();
}
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
public void open(TRId trId) {
try {
@ -226,6 +234,7 @@ public class ResourcesListViewPanel extends FramedPanel {
}
protected void init() {
forceLayoutOnResize = true;
setHeaderVisible(false);
setBodyBorder(false);
setResize(true);
@ -300,10 +309,10 @@ public class ResourcesListViewPanel extends FramedPanel {
filterField.bind(store);
ToolBar toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Filter:"));
toolBar.add(new LabelToolItem(msgs.toolBarFilterLabel()));
toolBar.add(filterField);
toolBar.add(new SeparatorToolItem());
toolBar.add(new LabelToolItem("Sort By:"));
toolBar.add(new LabelToolItem(msgs.toolBarSortBy()));
comboSort = new SimpleComboBox<String>(
new StringLabelProvider<String>());
@ -519,13 +528,12 @@ public class ResourcesListViewPanel extends FramedPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error Retrieving Resources: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert(
"Error retrieving resources",
UtilsGXT3.alert(msgs.errorRetrievingResourcesHead(),
caught.getLocalizedMessage());
}
}
@ -538,12 +546,10 @@ public class ResourcesListViewPanel extends FramedPanel {
if (result != null && result.size() > 0) {
statusBar.clear();
statusBar
.add(new LabelToolItem(
"Number of Resources: "
+ result.size()));
.add(new LabelToolItem(msgs.statusBarNumberOfResources(result.size())));
} else {
statusBar.clear();
statusBar.add(new LabelToolItem("No Resource"));
statusBar.add(new LabelToolItem(msgs.statusBarNoResource()));
}
statusBar.forceLayout();
@ -563,7 +569,7 @@ public class ResourcesListViewPanel extends FramedPanel {
contextMenu = new Menu();
openItem = new MenuItem();
openItem.setText("Open");
openItem.setText(msgs.itemOpenText());
openItem.setIcon(ResourceBundle.INSTANCE.resources());
openItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -582,7 +588,7 @@ public class ResourcesListViewPanel extends FramedPanel {
});
saveItem = new MenuItem();
saveItem.setText("Save");
saveItem.setText(msgs.itemSaveText());
saveItem.setIcon(ResourceBundle.INSTANCE.save());
saveItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -600,10 +606,10 @@ public class ResourcesListViewPanel extends FramedPanel {
});
removeItem = new MenuItem();
removeItem.setText("Delete");
removeItem.setIcon(ResourceBundle.INSTANCE.delete());
removeItem.addSelectionHandler(new SelectionHandler<Item>() {
deleteItem = new MenuItem();
deleteItem.setText(msgs.itemDeleteText());
deleteItem.setIcon(ResourceBundle.INSTANCE.delete());
deleteItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
@ -633,41 +639,41 @@ public class ResourcesListViewPanel extends FramedPanel {
openItem.setIcon(ResourceBundle.INSTANCE.chart());
contextMenu.add(openItem);
contextMenu.add(saveItem);
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case CODELIST:
contextMenu.clear();
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case CSV:
contextMenu.clear();
contextMenu.add(saveItem);
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case GUESSER:
contextMenu.clear();
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case JSON:
contextMenu.clear();
contextMenu.add(saveItem);
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case MAP:
contextMenu.clear();
openItem.setIcon(ResourceBundle.INSTANCE.gis());
contextMenu.add(openItem);
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case SDMX:
contextMenu.clear();
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case GENERIC_FILE:
@ -675,17 +681,17 @@ public class ResourcesListViewPanel extends FramedPanel {
openItem.setIcon(ResourceBundle.INSTANCE.file());
contextMenu.add(openItem);
contextMenu.add(saveItem);
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
case GENERIC_TABLE:
contextMenu.clear();
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
break;
default:
contextMenu.clear();
contextMenu.add(removeItem);
contextMenu.add(deleteItem);
listView.setContextMenu(contextMenu);
event.setCancelled(true);
break;
@ -744,7 +750,7 @@ public class ResourcesListViewPanel extends FramedPanel {
public void onSuccess() {
SaveResourceWizard saveResourceWizard = new SaveResourceWizard(
saveResourceSession, "Save Resource", eventBus);
saveResourceSession, msgs.saveResourceWizardHead(), eventBus);
saveResourceWizard.addListener(new WizardListener() {
@ -795,13 +801,13 @@ public class ResourcesListViewPanel extends FramedPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error removing the resource: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error removing the resource: "
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRemovingTheResource()
+ caught.getLocalizedMessage());
}
}
@ -874,8 +880,8 @@ public class ResourcesListViewPanel extends FramedPanel {
} else {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving uri from resolver");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingURIFromResolver());
}
}
@ -904,8 +910,8 @@ public class ResourcesListViewPanel extends FramedPanel {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error",
"Error retrieving uri from resolver");
.alert(msgsCommon.error(),
msgs.errorRetrievingURIFromResolver());
}
}
@ -922,8 +928,8 @@ public class ResourcesListViewPanel extends FramedPanel {
} else {
Log.error("Error with resource: no valid resource");
UtilsGXT3.alert("Error with resource",
"Error no valid InternalUri");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorNoValidInternalUri());
}
@ -985,8 +991,8 @@ public class ResourcesListViewPanel extends FramedPanel {
} else {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving uri from resolver");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingURIFromResolver());
}
}
@ -1000,7 +1006,7 @@ public class ResourcesListViewPanel extends FramedPanel {
} else {
Log.error("Error with resource: no valid resource");
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.shared.exception.TDGWTIsLockedException;
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.RemoveResourceSession;
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.save.SaveResourceWizard;
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.type.SessionExpiredType;
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.widget.core.client.FramedPanel;
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.BeforeShowContextMenuHandler;
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 {
protected String WIDTH = "298px";
protected String HEIGHT = "520px";
private static final String GRID_RESOURCE_HEIGHT = "300px";
private static final String GRID_RESOURCE_WIDTH = "200px";
private static final String WIDTH = "298px";
private static final String HEIGHT = "520px";
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
private ResourcesDialog parent;
private TRId trId;
private EventBus eventBus;
protected ResourcesDialog parent;
protected UserInfo userInfo;
protected TRId trId;
protected TableData table;
protected String headingTitle;
protected VerticalLayoutContainer vl;
protected EventBus eventBus;
protected ListStore<ResourceTDDescriptor> store;
protected ListLoader<ListLoadConfig, ListLoadResult<ResourceTDDescriptor>> loader;
protected Grid<ResourceTDDescriptor> grid;
protected ResourceTDDescriptor currentTDDescriptor;
protected int currentRowIndex;
protected RollBackSession rollBackSession;
private ListStore<ResourceTDDescriptor> store;
private ListLoader<ListLoadConfig, ListLoadResult<ResourceTDDescriptor>> loader;
private Grid<ResourceTDDescriptor> grid;
private boolean drawed = false;
private Menu contextMenu;
@ -118,6 +113,7 @@ public class ResourcesPanel extends FramedPanel {
this.trId = trId;
this.eventBus = eventBus;
forceLayoutOnResize = true;
initMessages();
retrieveUserInfo();
}
@ -126,9 +122,15 @@ public class ResourcesPanel extends FramedPanel {
this.trId = trId;
this.eventBus = eventBus;
forceLayoutOnResize = true;
initMessages();
retrieveUserInfo();
}
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void retrieveUserInfo() {
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
@ -140,7 +142,7 @@ public class ResourcesPanel extends FramedPanel {
Log.error("Error Retrieving User Info: "
+ 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;"
+ "font-size: 12px; margin:2px; text-align: left;'>"
+ "<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;'>"
+ SafeHtmlUtils.htmlEscape(value.getName())
+
@ -195,7 +197,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>"
+ "</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;'>"
+ SafeHtmlUtils.htmlEscape(value
.getDescription())
@ -204,7 +206,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>"
+ "</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;'>"
+ SafeHtmlUtils.htmlEscape(value
.getCreationDate())
@ -213,7 +215,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>"
+ "</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;'>"
+ new SafeHtmlBuilder()
.append(value.getCreatorId())
@ -223,7 +225,7 @@ public class ResourcesPanel extends FramedPanel {
"</td>"
+ "</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;'>"
+ SafeHtmlUtils.htmlEscape(value
.getResourceType().toString())
@ -249,7 +251,7 @@ public class ResourcesPanel extends FramedPanel {
if (resource instanceof StringResourceTD) {
StringResourceTD stringResourceTD = (StringResourceTD) resource;
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;'>"
+ SafeHtmlUtils
.htmlEscape(stringResourceTD
@ -260,7 +262,7 @@ public class ResourcesPanel extends FramedPanel {
if (resource instanceof TableResourceTD) {
TableResourceTD tableResourceTD = (TableResourceTD) resource;
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;'>"
+ new SafeHtmlBuilder()
.append(tableResourceTD
@ -281,7 +283,7 @@ public class ResourcesPanel extends FramedPanel {
});
ColumnConfig<ResourceTDDescriptor, String> nameCol = new ColumnConfig<ResourceTDDescriptor, String>(
props.name(), 142, "Name");
props.name(), 142, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() {
@ -296,7 +298,7 @@ public class ResourcesPanel extends FramedPanel {
});
ColumnConfig<ResourceTDDescriptor, ResourceTDType> typeColumn = new ColumnConfig<ResourceTDDescriptor, ResourceTDType>(
props.resourceType(), 30, "Type");
props.resourceType(), 30, msgs.typeCol());
ResourceTDTypeButtonCell button = new ResourceTDTypeButtonCell();
button.addSelectHandler(new SelectHandler() {
@ -369,7 +371,7 @@ public class ResourcesPanel extends FramedPanel {
grid.setLoader(loader);
grid.setSelectionModel(sm);
grid.setSize("200px", "300px");
grid.setSize(GRID_RESOURCE_WIDTH, GRID_RESOURCE_HEIGHT);
grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true);
@ -378,7 +380,7 @@ public class ResourcesPanel extends FramedPanel {
grid.setColumnReordering(true);
grid.setColumnResize(true);
grid.getView().setAutoExpandColumn(nameCol);
grid.getView().setEmptyText("Empty");
grid.getView().setEmptyText(msgs.gridEmptyText());
expander.initPlugin(grid);
@ -393,7 +395,7 @@ public class ResourcesPanel extends FramedPanel {
contextMenu = new Menu();
openItem = new MenuItem();
openItem.setText("Open");
openItem.setText(msgs.itemOpenText());
openItem.setIcon(ResourceBundle.INSTANCE.resources());
openItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -408,7 +410,7 @@ public class ResourcesPanel extends FramedPanel {
});
saveItem = new MenuItem();
saveItem.setText("Save");
saveItem.setText(msgs.itemSaveText());
saveItem.setIcon(ResourceBundle.INSTANCE.save());
saveItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -423,7 +425,7 @@ public class ResourcesPanel extends FramedPanel {
});
removeItem = new MenuItem();
removeItem.setText("Delete");
removeItem.setText(msgs.itemDeleteText());
removeItem.setIcon(ResourceBundle.INSTANCE.delete());
removeItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -565,7 +567,7 @@ public class ResourcesPanel extends FramedPanel {
public void onSuccess() {
SaveResourceWizard saveResourceWizard = new SaveResourceWizard(
saveResourceSession, "Save Resource", eventBus);
saveResourceSession, msgs.saveResourceWizardHead(), eventBus);
saveResourceWizard.addListener(new WizardListener() {
@ -618,13 +620,13 @@ public class ResourcesPanel extends FramedPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error removing the resource: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error removing the resource: "
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingResourcesFixed()
+ caught.getLocalizedMessage());
}
}
@ -695,8 +697,8 @@ public class ResourcesPanel extends FramedPanel {
} else {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving uri from resolver");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingURIFromResolver());
}
}
@ -725,8 +727,8 @@ public class ResourcesPanel extends FramedPanel {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error",
"Error retrieving uri from resolver");
.alert(msgsCommon.error(),
msgs.errorRetrievingURIFromResolver());
}
}
@ -743,8 +745,8 @@ public class ResourcesPanel extends FramedPanel {
} else {
Log.error("Error with resource: no valid resource");
UtilsGXT3.alert("Error with resource",
"Error no valid InternalUri");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorNoValidInternalUri());
}
@ -772,8 +774,8 @@ public class ResourcesPanel extends FramedPanel {
} else {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving uri from resolver");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingURIFromResolver());
}
}
@ -792,8 +794,8 @@ public class ResourcesPanel extends FramedPanel {
} else {
Log.error("Error with resource: no valid resource");
UtilsGXT3.alert("Error with resource",
"Error no valid InternalUri");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorNoValidInternalUri());
}
@ -814,12 +816,12 @@ public class ResourcesPanel extends FramedPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error Retrieving Resources: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving resources",
UtilsGXT3.alert(msgs.errorRetrievingResourcesHead(),
caught.getLocalizedMessage());
}
}
@ -857,13 +859,13 @@ public class ResourcesPanel extends FramedPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving current TRId: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving current tabular resource id");
UtilsGXT3.alert(msgsCommon.error(),
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.user.UserInfo;
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.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
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.web.bindery.event.shared.SimpleEventBus;
@ -23,13 +25,16 @@ import com.google.web.bindery.event.shared.SimpleEventBus;
public class ResourcesWidgetEntry implements EntryPoint {
// private ResourceTDDescriptor resourceTDDescriptor;
private CommonMessages msgsCommon;
private ResourcesMessages msgs;
private SimpleEventBus eventBus;
private TRId trId;
private TabResource tabResource;
public void onModuleLoad() {
Log.info("Hello!");
initMessages();
eventBus = new SimpleEventBus();
trId = new TRId();
// TabularResource: [ id=202, type=STANDARD, lastTable=[ id=4901,
@ -42,6 +47,11 @@ public class ResourcesWidgetEntry implements EntryPoint {
trId.setTableId("4884");
retrieveUserInfo();
}
protected void initMessages(){
msgs = GWT.create(ResourcesMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
private void start() {
try {
@ -76,7 +86,7 @@ public class ResourcesWidgetEntry implements EntryPoint {
Log.error("Error Retrieving User Info: "
+ 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: "
+ caught.getLocalizedMessage());
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: "
+ 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'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
<inherits name="com.google.gwt.http.HTTP"/>
@ -12,7 +14,7 @@
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- 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.dark.Dark'/> -->
@ -31,6 +33,26 @@
<!-- Specify the app entry point class. -->
<!-- <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 -->
<source path='client' />