diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFilters.java b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFilters.java index 7203ad3..316916e 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFilters.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFilters.java @@ -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,7 +23,8 @@ public class ExtendedGridFilters extends GridFilters { private Menu filterMenu; private SeparatorMenuItem separatorItem; private CheckMenuItem checkFilterItem; - + private ExtendedGridFiltersMessages msgs = GWT.create(ExtendedGridFiltersMessages.class); + /** @@ -39,6 +41,7 @@ public class ExtendedGridFilters extends GridFilters { @Override protected void onContextMenu(HeaderContextMenuEvent event) { + int column = event.getColumnIndex(); if (separatorItem == null) { @@ -47,7 +50,7 @@ public class ExtendedGridFilters extends GridFilters { separatorItem.removeFromParent(); if (checkFilterItem == null) { - checkFilterItem = new CheckMenuItem("Inline Filter"); + checkFilterItem = new CheckMenuItem(msgs.inlineFilter()); checkFilterItem .addCheckChangeHandler(new CheckChangeHandler() { diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages.java b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages.java new file mode 100644 index 0000000..2a1dadc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages.java @@ -0,0 +1,19 @@ +package org.gcube.portlets.user.tdwx.client.filter; + +import com.google.gwt.i18n.client.Messages; + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public interface ExtendedGridFiltersMessages extends Messages { + + // + @DefaultMessage("Inline Filter") + String inlineFilter(); + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilter.java b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilter.java index 856f6b6..94583f9 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilter.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilter.java @@ -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 extends Filter { /** * 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 textItems = new ArrayList(); private TextMenu 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 extends Filter { */ public TextFilter(ValueProvider valueProvider) { super(valueProvider); - + msgs = GWT.create(TextFilterMessages.class); setHandler(new TextFilterHandler()); textItems.add(TextItem.CONTAINS); @@ -61,7 +61,7 @@ public class TextFilter extends Filter { textMenu = new TextMenu(this); menu = textMenu; - textMenu.setTextItems(textItems); + textMenu.setTextItems(textItems, msgs); } @@ -122,7 +122,7 @@ public class TextFilter extends Filter { * @return the local-sensitive messages used by this class. */ public TextFilterMessages getMessages() { - return messages; + return msgs; } @Override @@ -154,8 +154,8 @@ public class TextFilter extends Filter { } public void setMessages(TextFilterMessages messages) { - this.messages = messages; - textMenu.setEmptyText(messages.emptyText()); + this.msgs = messages; + textMenu.setEmptyText(messages.enterFilterText()); } diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages.java b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages.java similarity index 90% rename from src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages.java rename to src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages.java index 9611ad2..e5871f8 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages.java @@ -8,7 +8,7 @@ import com.google.gwt.i18n.client.Messages; * email: g.panichi@isti.cnr.it * */ -public interface TextMenuMessages extends Messages { +public interface TextFilterMessages extends Messages { // @DefaultMessage("Enter filter text...") diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenu.java b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenu.java index 4999a08..7f6d977 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenu.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/filter/text/TextMenu.java @@ -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 extends Menu { } protected TextField ct, bg, en, sd; - private TextMenuMessages msgs; + //private TextMenuMessages msgs; private TextFilter filter; @@ -75,7 +74,7 @@ public class TextMenu extends Menu { */ public TextMenu(TextFilter filter) { this.filter = filter; - this.msgs = GWT.create(TextMenuMessages.class); + addBeforeHideHandler(new BeforeHideHandler() { @@ -180,7 +179,7 @@ public class TextMenu extends Menu { * @param textItems * the text items */ - public void setTextItems(List textItems) { + public void setTextItems(List textItems, TextFilterMessages msgs) { this.textItems = textItems; clear(); ImageResource icon = null; diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages.properties new file mode 100644 index 0000000..0585c5c --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages.properties @@ -0,0 +1 @@ +inlineFilter = Inline Filter \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages_es.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages_es.properties new file mode 100644 index 0000000..2d2e76d --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages_es.properties @@ -0,0 +1 @@ +inlineFilter = Filtro En LĂ­nea \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages_it.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages_it.properties new file mode 100644 index 0000000..c227ff3 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/ExtendedGridFiltersMessages_it.properties @@ -0,0 +1 @@ +inlineFilter = Filtro In Linea \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages.properties similarity index 100% rename from src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages.properties rename to src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages.properties diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages_es.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages_es.properties similarity index 100% rename from src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages_es.properties rename to src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages_es.properties diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages_it.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages_it.properties new file mode 100644 index 0000000..8dca183 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextFilterMessages_it.properties @@ -0,0 +1,5 @@ +enterFilterText = Inserire un filtro... +textContains = Contiene +textBegins = Inizia +textEnds = Finisce +soundexAlgorithm = Algoritmo Soundex \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages_it.properties b/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages_it.properties deleted file mode 100644 index aaa60a8..0000000 --- a/src/main/resources/org/gcube/portlets/user/tdwx/client/filter/text/TextMenuMessages_it.properties +++ /dev/null @@ -1,5 +0,0 @@ -enterFilterText = Inserire del testo come filtro... -textContains = Contiene -textBegins = Inizia -textEnds = Finisce -soundexAlgorithm = Algoritmo Soundex \ No newline at end of file