Updated i18n support
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@113932 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b83be35272
commit
6c1c6874d5
|
@ -1,10 +1,11 @@
|
|||
package org.gcube.portlets.user.tdwx.client.filter;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.sencha.gxt.data.shared.loader.FilterPagingLoadConfig;
|
||||
import com.sencha.gxt.data.shared.loader.Loader;
|
||||
import com.sencha.gxt.widget.core.client.event.CheckChangeEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HeaderContextMenuEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.CheckChangeEvent.CheckChangeHandler;
|
||||
import com.sencha.gxt.widget.core.client.event.HeaderContextMenuEvent;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.AbstractGridFilters;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.Filter;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.GridFilters;
|
||||
|
@ -22,6 +23,7 @@ public class ExtendedGridFilters<M> extends GridFilters<M> {
|
|||
private Menu filterMenu;
|
||||
private SeparatorMenuItem separatorItem;
|
||||
private CheckMenuItem checkFilterItem;
|
||||
private ExtendedGridFiltersMessages msgs = GWT.create(ExtendedGridFiltersMessages.class);
|
||||
|
||||
|
||||
|
||||
|
@ -39,6 +41,7 @@ public class ExtendedGridFilters<M> extends GridFilters<M> {
|
|||
|
||||
@Override
|
||||
protected void onContextMenu(HeaderContextMenuEvent event) {
|
||||
|
||||
int column = event.getColumnIndex();
|
||||
|
||||
if (separatorItem == null) {
|
||||
|
@ -47,7 +50,7 @@ public class ExtendedGridFilters<M> extends GridFilters<M> {
|
|||
separatorItem.removeFromParent();
|
||||
|
||||
if (checkFilterItem == null) {
|
||||
checkFilterItem = new CheckMenuItem("Inline Filter");
|
||||
checkFilterItem = new CheckMenuItem(msgs.inlineFilter());
|
||||
checkFilterItem
|
||||
.addCheckChangeHandler(new CheckChangeHandler<CheckMenuItem>() {
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.gcube.portlets.user.tdwx.client.filter;
|
||||
|
||||
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 ExtendedGridFiltersMessages extends Messages {
|
||||
|
||||
//
|
||||
@DefaultMessage("Inline Filter")
|
||||
String inlineFilter();
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -5,9 +5,9 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.user.tdwx.client.filter.text.TextMenu.TextItem;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
import com.sencha.gxt.data.shared.loader.FilterConfig;
|
||||
import com.sencha.gxt.messages.client.DefaultMessages;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.Filter;
|
||||
|
||||
/**
|
||||
|
@ -21,26 +21,26 @@ public class TextFilter<M> extends Filter<M, String> {
|
|||
/**
|
||||
* The default locale-sensitive messages used by this class.
|
||||
*/
|
||||
public class DefaultTextFilterMessages implements TextFilterMessages {
|
||||
/*public class DefaultTextFilterMessages implements TextFilterMessages {
|
||||
|
||||
@Override
|
||||
public String emptyText() {
|
||||
return DefaultMessages.getMessages().stringFilter_emptyText();
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* The locale-sensitive messages used by this class.
|
||||
*/
|
||||
public interface TextFilterMessages {
|
||||
/*public interface TextFilterMessages {
|
||||
String emptyText();
|
||||
}
|
||||
}*/
|
||||
|
||||
private List<TextItem> textItems = new ArrayList<TextItem>();
|
||||
private TextMenu<M> textMenu;
|
||||
private TextFilterMessages messages = new DefaultTextFilterMessages();
|
||||
|
||||
private TextFilterMessages msgs;
|
||||
|
||||
/**
|
||||
* Creates a text filter for the specified value provider. See
|
||||
|
@ -51,7 +51,7 @@ public class TextFilter<M> extends Filter<M, String> {
|
|||
*/
|
||||
public TextFilter(ValueProvider<? super M, String> valueProvider) {
|
||||
super(valueProvider);
|
||||
|
||||
msgs = GWT.create(TextFilterMessages.class);
|
||||
setHandler(new TextFilterHandler());
|
||||
|
||||
textItems.add(TextItem.CONTAINS);
|
||||
|
@ -61,7 +61,7 @@ public class TextFilter<M> extends Filter<M, String> {
|
|||
|
||||
textMenu = new TextMenu<M>(this);
|
||||
menu = textMenu;
|
||||
textMenu.setTextItems(textItems);
|
||||
textMenu.setTextItems(textItems, msgs);
|
||||
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class TextFilter<M> extends Filter<M, String> {
|
|||
* @return the local-sensitive messages used by this class.
|
||||
*/
|
||||
public TextFilterMessages getMessages() {
|
||||
return messages;
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,8 +154,8 @@ public class TextFilter<M> extends Filter<M, String> {
|
|||
}
|
||||
|
||||
public void setMessages(TextFilterMessages messages) {
|
||||
this.messages = messages;
|
||||
textMenu.setEmptyText(messages.emptyText());
|
||||
this.msgs = messages;
|
||||
textMenu.setEmptyText(messages.enterFilterText());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.google.gwt.i18n.client.Messages;
|
|||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface TextMenuMessages extends Messages {
|
||||
public interface TextFilterMessages extends Messages {
|
||||
|
||||
//
|
||||
@DefaultMessage("Enter filter text...")
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.user.tdwx.client.resources.ResourceBundle;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Cursor;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
@ -52,7 +51,7 @@ public class TextMenu<M> extends Menu {
|
|||
}
|
||||
|
||||
protected TextField ct, bg, en, sd;
|
||||
private TextMenuMessages msgs;
|
||||
//private TextMenuMessages msgs;
|
||||
|
||||
|
||||
private TextFilter<M> filter;
|
||||
|
@ -75,7 +74,7 @@ public class TextMenu<M> extends Menu {
|
|||
*/
|
||||
public TextMenu(TextFilter<M> filter) {
|
||||
this.filter = filter;
|
||||
this.msgs = GWT.create(TextMenuMessages.class);
|
||||
|
||||
|
||||
addBeforeHideHandler(new BeforeHideHandler() {
|
||||
|
||||
|
@ -180,7 +179,7 @@ public class TextMenu<M> extends Menu {
|
|||
* @param textItems
|
||||
* the text items
|
||||
*/
|
||||
public void setTextItems(List<TextItem> textItems) {
|
||||
public void setTextItems(List<TextItem> textItems, TextFilterMessages msgs) {
|
||||
this.textItems = textItems;
|
||||
clear();
|
||||
ImageResource icon = null;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
inlineFilter = Inline Filter
|
|
@ -0,0 +1 @@
|
|||
inlineFilter = Filtro En Línea
|
|
@ -0,0 +1 @@
|
|||
inlineFilter = Filtro In Linea
|
|
@ -0,0 +1,5 @@
|
|||
enterFilterText = Inserire un filtro...
|
||||
textContains = Contiene
|
||||
textBegins = Inizia
|
||||
textEnds = Finisce
|
||||
soundexAlgorithm = Algoritmo Soundex
|
|
@ -1,5 +0,0 @@
|
|||
enterFilterText = Inserire del testo come filtro...
|
||||
textContains = Contiene
|
||||
textBegins = Inizia
|
||||
textEnds = Finisce
|
||||
soundexAlgorithm = Algoritmo Soundex
|
Loading…
Reference in New Issue