Updated i18n support
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@113885 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.portlets.user.td.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.gcube.portlets.user.td.chartswidget.client.ChartsWidgetTD;
|
||||
|
@ -80,6 +81,8 @@ import com.allen_sauer.gwt.log.client.Log;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
import com.google.gwt.event.shared.SimpleEventBus;
|
||||
import com.google.gwt.i18n.client.LocaleInfo;
|
||||
import com.google.gwt.user.client.Cookies;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
@ -98,6 +101,7 @@ import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler
|
|||
*/
|
||||
public class TabularDataController {
|
||||
|
||||
private static final String TD_LANG_COOKIE = "TDLangCookie";
|
||||
private SimpleEventBus eventBus;
|
||||
private MainBoxPanel mainBoxPanel;
|
||||
private UIStateType uiState = UIStateType.START;
|
||||
|
@ -339,8 +343,39 @@ public class TabularDataController {
|
|||
|
||||
}
|
||||
|
||||
protected void checkLocale() {
|
||||
String[] locales = LocaleInfo.getAvailableLocaleNames();
|
||||
|
||||
for (String locale : locales) {
|
||||
Log.debug("Locale avaible:" + locale);
|
||||
}
|
||||
|
||||
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
|
||||
.getLocaleCookieName());
|
||||
Log.debug(TD_LANG_COOKIE+":" + currentLocaleCookie);
|
||||
|
||||
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
||||
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
||||
|
||||
}
|
||||
|
||||
protected void changeLanguage(String localeName) {
|
||||
Date now = new Date();
|
||||
long nowLong = now.getTime();
|
||||
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
|
||||
now.setTime(nowLong);
|
||||
String cookieLang=Cookies.getCookie(TD_LANG_COOKIE);
|
||||
if(cookieLang!=null){
|
||||
Cookies.removeCookie(TD_LANG_COOKIE);
|
||||
}
|
||||
Cookies.setCookie(TD_LANG_COOKIE, localeName, now);
|
||||
com.google.gwt.user.client.Window.Location.reload();
|
||||
}
|
||||
|
||||
//
|
||||
public void restoreUISession() {
|
||||
checkLocale();
|
||||
|
||||
String value = com.google.gwt.user.client.Window.Location
|
||||
.getParameter("TabularResourceId");
|
||||
TRId startTRId = new TRId(value);
|
||||
|
@ -655,7 +690,6 @@ public class TabularDataController {
|
|||
eventBus.fireEvent(dataViewRequestEvent);
|
||||
}
|
||||
|
||||
|
||||
private void deleteTabularResource() {
|
||||
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Confirm",
|
||||
|
@ -761,7 +795,7 @@ public class TabularDataController {
|
|||
case LOGS:
|
||||
openLogsWindow();
|
||||
break;
|
||||
|
||||
|
||||
case DUPLICATE_DETECTION:
|
||||
openDuplicatesRowsDetection();
|
||||
break;
|
||||
|
@ -916,7 +950,15 @@ public class TabularDataController {
|
|||
case CREATE_GIS_MAP:
|
||||
openCreateMapWizard();
|
||||
break;
|
||||
|
||||
case LANGUAGE_EN:
|
||||
changeLanguage("en");
|
||||
break;
|
||||
case LANGUAGE_ES:
|
||||
changeLanguage("es");
|
||||
break;
|
||||
case LANGUAGE_IT:
|
||||
changeLanguage("it");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -938,7 +980,6 @@ public class TabularDataController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void doWidgetRequestCommand(WidgetRequestEvent event) {
|
||||
WidgetRequestType widgetRequestType = event.getWidgetRequestType();
|
||||
switch (widgetRequestType) {
|
||||
|
@ -2004,7 +2045,7 @@ public class TabularDataController {
|
|||
UtilsGXT3.alert("Error", "No tabular resource present");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void openDuplicatesRowsDelete() {
|
||||
Log.debug("Request Duplicates Rows Delete Tab");
|
||||
if (trId != null) {
|
||||
|
@ -2017,8 +2058,6 @@ public class TabularDataController {
|
|||
UtilsGXT3.alert("Error", "No tabular resource present");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void openGeospatialCSquare() {
|
||||
Log.debug("Request Geospatial Create C-Square Coordiantes Tab");
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.google.gwt.core.client.EntryPoint;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.i18n.client.LocaleInfo;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
|
@ -73,17 +72,7 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
protected void loadMainPanel() {
|
||||
String[] locales=LocaleInfo.getAvailableLocaleNames();
|
||||
|
||||
for(String locale:locales){
|
||||
Log.debug("Locale avaible:"+locale);
|
||||
}
|
||||
|
||||
LocaleInfo currentLocale = LocaleInfo.getCurrentLocale();
|
||||
Log.debug("Current Locale:"+currentLocale.getLocaleName());
|
||||
|
||||
|
||||
protected void loadMainPanel() {
|
||||
TabularDataController controller = new TabularDataController();
|
||||
EventBus eventBus = controller.getEventBus();
|
||||
|
||||
|
|
|
@ -489,4 +489,19 @@ public interface TabularDataResources extends ClientBundle {
|
|||
@Source("point.png")
|
||||
ImageResource geometryPoint();
|
||||
|
||||
@Source("flag_gb.png")
|
||||
ImageResource flagGB();
|
||||
|
||||
@Source("flag_it.png")
|
||||
ImageResource flagIT();
|
||||
|
||||
@Source("flag_es.png")
|
||||
ImageResource flagES();
|
||||
|
||||
@Source("language_32.png")
|
||||
ImageResource language32();
|
||||
|
||||
@Source("language.png")
|
||||
ImageResource language();
|
||||
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 469 B |
After Width: | Height: | Size: 599 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 886 B |
After Width: | Height: | Size: 2.0 KiB |
|
@ -14,6 +14,8 @@ import com.allen_sauer.gwt.log.client.Log;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.NodeList;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonArrowAlign;
|
||||
|
@ -24,6 +26,9 @@ import com.sencha.gxt.widget.core.client.button.ButtonGroup;
|
|||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +38,7 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|||
*
|
||||
*/
|
||||
public class FileToolBar {
|
||||
|
||||
private FileToolBarMessages msgs;
|
||||
private EventBus eventBus;
|
||||
private ToolBar toolBar;
|
||||
|
||||
|
@ -60,13 +65,22 @@ public class FileToolBar {
|
|||
// History
|
||||
private TextButton historyButton;
|
||||
private TextButton undoButton;
|
||||
|
||||
|
||||
//Help
|
||||
private TextButton helpButton;
|
||||
private TextButton languageButton;
|
||||
//private TextButton logsButton;
|
||||
|
||||
//Language Menu
|
||||
private MenuItem enItem;
|
||||
private MenuItem itItem;
|
||||
private MenuItem esItem;
|
||||
|
||||
|
||||
|
||||
public FileToolBar(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
msgs = GWT.create(FileToolBarMessages.class);
|
||||
build();
|
||||
}
|
||||
|
||||
|
@ -75,7 +89,7 @@ public class FileToolBar {
|
|||
}
|
||||
|
||||
protected void build() {
|
||||
FileToolBarMessages msgs = GWT.create(FileToolBarMessages.class);
|
||||
|
||||
|
||||
toolBar = new ToolBar();
|
||||
toolBar.setSpacing(1);
|
||||
|
@ -416,6 +430,21 @@ public class FileToolBar {
|
|||
FlexTable helpLayout = new FlexTable();
|
||||
helpGroup.add(helpLayout);
|
||||
|
||||
|
||||
|
||||
languageButton = new TextButton(msgs.languageButton(),
|
||||
TabularDataResources.INSTANCE.language32());
|
||||
languageButton.enable();
|
||||
languageButton.setScale(ButtonScale.LARGE);
|
||||
languageButton.setIconAlign(IconAlign.TOP);
|
||||
languageButton.setToolTip(msgs.languageButtonToolTip());
|
||||
languageButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
languageButton.setMenu(createLanguageMenu());
|
||||
|
||||
helpLayout.setWidget(0, 0, languageButton);
|
||||
helpLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
|
||||
|
||||
|
||||
helpButton = new TextButton(msgs.helpButton(),
|
||||
TabularDataResources.INSTANCE.help32());
|
||||
helpButton.enable();
|
||||
|
@ -430,8 +459,8 @@ public class FileToolBar {
|
|||
}
|
||||
});
|
||||
|
||||
helpLayout.setWidget(0, 0, helpButton);
|
||||
helpLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
|
||||
helpLayout.setWidget(0, 1, helpButton);
|
||||
helpLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
|
||||
|
||||
/*
|
||||
logsButton = new TextButton("Logs",
|
||||
|
@ -475,6 +504,56 @@ public class FileToolBar {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Menu createLanguageMenu() {
|
||||
Menu menuReplace = new Menu();
|
||||
enItem = new MenuItem(msgs.english(),
|
||||
TabularDataResources.INSTANCE.flagGB());
|
||||
itItem = new MenuItem(msgs.italian(),
|
||||
TabularDataResources.INSTANCE.flagIT());
|
||||
esItem = new MenuItem(msgs.spanish(),
|
||||
TabularDataResources.INSTANCE.flagES());
|
||||
|
||||
enItem
|
||||
.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
eventBus.fireEvent(new RibbonEvent(
|
||||
RibbonType.LANGUAGE_EN));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
itItem
|
||||
.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
eventBus.fireEvent(new RibbonEvent(
|
||||
RibbonType.LANGUAGE_IT));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
esItem
|
||||
.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
eventBus.fireEvent(new RibbonEvent(
|
||||
RibbonType.LANGUAGE_ES));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
menuReplace.add(enItem);
|
||||
menuReplace.add(itItem);
|
||||
menuReplace.add(esItem);
|
||||
return menuReplace;
|
||||
}
|
||||
|
||||
|
||||
public void setUI(UIStateEvent event) {
|
||||
UIStateType uiStateType = event.getUIStateType();
|
||||
|
|
|
@ -141,5 +141,20 @@ public interface FileToolBarMessages extends Messages {
|
|||
@DefaultMessage("Help")
|
||||
String helpButtonToolTip();
|
||||
|
||||
@DefaultMessage("Language")
|
||||
String languageButton();
|
||||
|
||||
@DefaultMessage("Language")
|
||||
String languageButtonToolTip();
|
||||
|
||||
//
|
||||
@DefaultMessage("English")
|
||||
String english();
|
||||
|
||||
@DefaultMessage("Italian")
|
||||
String italian();
|
||||
|
||||
@DefaultMessage("Spanish")
|
||||
String spanish();
|
||||
|
||||
}
|
|
@ -57,12 +57,12 @@ public class TabularDataRibbon {
|
|||
con = new VerticalLayoutContainer();
|
||||
con.add(modifyToolBar.getToolBar(), vldata);
|
||||
ribbon.add(con, msgs.modify());
|
||||
|
||||
/*
|
||||
ruleToolBar = new RuleToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.add(ruleToolBar.getToolBar(), vldata);
|
||||
ribbon.add(con, msgs.rule());
|
||||
|
||||
*/
|
||||
templateToolBar = new TemplateToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.add(templateToolBar.getToolBar(), vldata);
|
||||
|
|
|
@ -70,10 +70,10 @@
|
|||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.user.td.client.TabularDataPortlet' />
|
||||
|
||||
<set-configuration-property name="locale.cookie"
|
||||
value="lang" />
|
||||
<set-configuration-property name="locale.cookie"
|
||||
value="TDLangCookie" />
|
||||
<set-configuration-property name="locale.queryparam"
|
||||
value="lang" />
|
||||
value="TDLang" />
|
||||
<set-configuration-property name="locale.usemeta"
|
||||
value="Y" />
|
||||
<set-configuration-property name="locale.useragent"
|
||||
|
|
After Width: | Height: | Size: 469 B |
After Width: | Height: | Size: 599 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 886 B |
After Width: | Height: | Size: 2.0 KiB |
|
@ -37,4 +37,10 @@ undoButton = Undo
|
|||
undoButtonToolTip = Discard last operation
|
||||
helpGroupHeadingText = Help
|
||||
helpButton = Help
|
||||
helpButtonToolTip = Help
|
||||
helpButtonToolTip = Help
|
||||
languageButton = Language
|
||||
languageButtonToolTip = Language
|
||||
english = English
|
||||
italian = Italian
|
||||
spanish = Spanish
|
||||
|
|
@ -37,4 +37,9 @@ undoButton = Deshacer
|
|||
undoButtonToolTip = Olvidese de la ùltima operaciòn
|
||||
helpGroupHeadingText = Ayuda
|
||||
helpButton = Ayuda
|
||||
helpButtonToolTip = Ayuda
|
||||
helpButtonToolTip = Ayuda
|
||||
languageButton = Idioma
|
||||
languageButtonToolTip = Idioma
|
||||
english = Inglés
|
||||
italian = Italiano
|
||||
spanish = Español
|
|
@ -37,4 +37,9 @@ undoButton = Indietro
|
|||
undoButtonToolTip = Dimentica l''ultima operazione
|
||||
helpGroupHeadingText = Aiuto
|
||||
helpButton = Aiuto
|
||||
helpButtonToolTip = Aiuto
|
||||
helpButtonToolTip = Aiuto
|
||||
languageButton = Lingua
|
||||
languageButtonToolTip = Lingua
|
||||
english = Inglese
|
||||
italian = Italiano
|
||||
spanish = Spagnolo
|
|
@ -78,9 +78,9 @@
|
|||
<entry-point class='org.gcube.portlets.user.td.client.TabularDataPortlet' />
|
||||
|
||||
<set-configuration-property name="locale.cookie"
|
||||
value="lang" />
|
||||
value="TDLangCookie" />
|
||||
<set-configuration-property name="locale.queryparam"
|
||||
value="lang" />
|
||||
value="TDLang" />
|
||||
<set-configuration-property name="locale.usemeta"
|
||||
value="Y" />
|
||||
<set-configuration-property name="locale.useragent"
|
||||
|
@ -96,11 +96,11 @@
|
|||
<set-property-fallback name="locale" value="en" />
|
||||
|
||||
|
||||
<!--
|
||||
<!--
|
||||
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
||||
<set-property name="log_DivLogger" value="ENABLED" />
|
||||
<set-property name="log_GWTLogger" value="ENABLED" />
|
||||
<set-property name="log_SystemLogger" value="ENABLED" /> -->
|
||||
<set-property name="log_SystemLogger" value="ENABLED" /> -->
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED" /> -->
|
||||
|
||||
|
||||
|
|