Author: lucaa
Date: 2008-02-22 16:36:57 +0100 (Fri, 22 Feb 2008)
New Revision: 7918

Modified:
   
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/Watch.java
   
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/data/DataManager.java
   
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/AnalysisDialog.java
   
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/SearchEngineFeedDialog.java
   
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/public/Watch.css
   
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/TagCloud
   
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations
   
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations.fr
Log:
XWATCH-31: Write a filter top prevent usual words to be displayed in the text 
analysis
* Added a parameter to the WatchCode.TagCloud to select language
* Added a language selection radio group in the text analysis dialog
* Fixed language translations



Modified: 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/Watch.java
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/Watch.java
    2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/Watch.java
    2008-02-22 15:36:57 UTC (rev 7918)
@@ -467,7 +467,9 @@
 
     public void openAnalysisWizard() {
         // Placeholder for Analysis
-        AnalysisDialog analysisDialog = new AnalysisDialog(this, "analysis", 
Dialog.BUTTON_CANCEL);
+        String[] languages = {"en", "fr"};
+        AnalysisDialog analysisDialog = new AnalysisDialog(this, "analysis", 
Dialog.BUTTON_CANCEL, 
+                languages);
         analysisDialog.show();
     }
 

Modified: 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/data/DataManager.java
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/data/DataManager.java
 2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/data/DataManager.java
 2008-02-22 15:36:57 UTC (rev 7918)
@@ -538,9 +538,12 @@
         watch.getXWikiServiceInstance().updateProperty(article.getPageName(), 
"XWiki.FeedEntryClass", "read", 1, cb);
     }
 
-    public void getAnalysisHTML(FilterStatus filterStatus, AsyncCallback cb) {
+    public void getAnalysisHTML(FilterStatus filterStatus, String language, 
AsyncCallback cb) {
         Map map = filterStatus.getMap();
         map.put("space", watch.getWatchSpace());
+        if (language != null && !language.trim().equals("")) {
+            map.put("filterlang", language);
+        }
         
watch.getXWikiServiceInstance().getDocumentContent(Constants.DEFAULT_CODE_SPACE 
+ "." + Constants.PAGE_TAGCLOUD, true, map, cb);
     }
 

Modified: 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/AnalysisDialog.java
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/AnalysisDialog.java
 2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/AnalysisDialog.java
 2008-02-22 15:36:57 UTC (rev 7918)
@@ -34,6 +34,7 @@
 
 public class AnalysisDialog extends Dialog {
     protected HTML analysisHTML;
+    protected String[] languages;
 
     /**
      * Choice dialog
@@ -42,23 +43,61 @@
      * @param buttonModes button modes Dialog.BUTTON_CANCEL|Dialog.BUTTON_NEXT 
for Cancel / Next
      */
     public AnalysisDialog(XWikiGWTApp app, String name, int buttonModes) {
+        this(app, name, buttonModes, new String[0]);
+    }
+    
+    public AnalysisDialog(XWikiGWTApp app, String name, int buttonModes, 
String[] languages) {
         super(app, name, buttonModes);
 
+        this.languages = languages;
         FlowPanel main = new FlowPanel();
         main.addStyleName(getCSSName("main"));
 
         HTMLPanel invitationPanel = new 
HTMLPanel(app.getTranslation(getDialogTranslationName() + ".invitation"));
         invitationPanel.addStyleName(getCssPrefix() + "-invitation");
         main.add(invitationPanel);
+        main.add(getLanguageSelectionPanel());
         main.add(getAnalysisPanel());
         main.add(getActionsPanel());
         add(main);
     }
+    
+    protected Panel getLanguageSelectionPanel() {
+        FlowPanel languagePanel = new FlowPanel();
+        Label langLabel = new 
Label(app.getTranslation(getDialogTranslationName() + ".language"));
+        languagePanel.add(langLabel);
+        String langRadioGroupName = "langRadioGroup";
+        for (int i = 0; i < this.languages.length; i++) {
+            final String currentLanguage = this.languages[i];
+            RadioButton langRadio = new RadioButton(langRadioGroupName, 
+                    app.getTranslation("language." + currentLanguage));
+            if 
(((Watch)app).getLocale().trim().toLowerCase().equals(currentLanguage.toLowerCase()))
 {
+                langRadio.setChecked(true);
+            }
+            langRadio.addClickListener(new ClickListener() {
+                private String language = currentLanguage;
+                public void onClick(Widget widget) {
+                    //activate current language
+                    AnalysisDialog.this.fetchAnalysisHTML(language);
+                }
+            });
+            languagePanel.add(langRadio);
+        }
+        languagePanel.addStyleName(getCssPrefix() + "-lang");
+        return languagePanel;
+    }
 
     protected Widget getAnalysisPanel() {
         analysisHTML = new HTML();
-        final Watch watch = (Watch) app;
-        watch.getDataManager().getAnalysisHTML(watch.getFilterStatus(), new 
XWikiAsyncCallback(watch) {
+        analysisHTML.setStyleName(getCssPrefix() + "-html");
+        this.fetchAnalysisHTML(null);
+        return analysisHTML;
+    }
+    
+    protected void fetchAnalysisHTML(final String language) {
+        final Watch watch = (Watch)app;
+        watch.getDataManager().getAnalysisHTML(watch.getFilterStatus(), 
language, 
+                new XWikiAsyncCallback(watch) {
             public void onSuccess(Object result) {
                 super.onSuccess(result);
                 analysisHTML.setHTML((String) result);
@@ -80,9 +119,6 @@
                     }
                 });
             }
-        });
-        analysisHTML.setStyleName(getCssPrefix() + "-html");
-        return analysisHTML;
+        });        
     }
-
 }

Modified: 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/SearchEngineFeedDialog.java
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/SearchEngineFeedDialog.java
 2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/client/ui/dialog/SearchEngineFeedDialog.java
 2008-02-22 15:36:57 UTC (rev 7918)
@@ -62,7 +62,8 @@
         }
 
         String query = searchTermTextBox.getText();
-        String language = (searchLanguageListBox==null) ? null : 
searchLanguageListBox.getItemText(searchLanguageListBox.getSelectedIndex());
+        String language = (searchLanguageListBox==null) ? null 
+            : 
searchLanguageListBox.getValue(searchLanguageListBox.getSelectedIndex());
         String url = getURL(query, language);
         feed.setUrl(url);
         List groups = new ArrayList();
@@ -133,7 +134,7 @@
             for (int i=0;i<languages.length;i++) {
                 String language = languages[i];
                 String languageText = app.getTranslation("language." + 
language);
-                searchLanguageListBox.addItem(language, languageText);
+                searchLanguageListBox.addItem(languageText, language);
             }
             paramsPanel.add(searchLanguageListBox);
         }

Modified: 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/public/Watch.css
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/public/Watch.css
     2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/gwt/src/main/java/com/xpn/xwiki/watch/public/Watch.css
     2008-02-22 15:36:57 UTC (rev 7918)
@@ -653,7 +653,15 @@
        padding: 10px;
 }
 
+div.analysis-lang {
+       text-align: center;
+}
 
+div.analysis-lang div.gwt-Label {
+       display: inline;
+}
+
+
 img.watch-configtype-help-content-image {
        width: 180px ;
        height:  75px;

Modified: 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/TagCloud
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/TagCloud
  2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/TagCloud
  2008-02-22 15:36:57 UTC (rev 7918)
@@ -126,7 +126,11 @@
     content += " " + 
itemdoc.getValue("content").replaceAll("&lt;.*?&gt;","").replaceAll("[\"&lt;&gt;]","")
  }
  if (content!="") { 
-  def tagcloud = xwiki.autotag.generateTagCloud(content, 0)
+  langFilter = request.filterlang;
+  if (!langFilter) {
+    langFilter = context.getLanguage();
+  }
+  def tagcloud = xwiki.autotag.generateTagCloud(content, langFilter)
   println tagcloud.getHtml()
  } else {
    println "No data: "

Modified: 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations
      2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations
      2008-02-22 15:36:57 UTC (rev 7918)
@@ -245,6 +245,7 @@
 watch.analysis.caption=XWiki Watch Text Analysis
 watch.analysis.invitation=Here is a list of the words that are the most 
frequent in the articles matching your current filter:
 watch.analysis.noselection=Please select a word
+watch.analysis.language=Select content language: 
 watch.pressreview.caption=XWiki Watch Press Review
 watch.pressreview.invitation=Here is the list of Articles matching the Filters 
that were Activated before generating the Press Review:
 watch.pressreview.noselection=There is no other Article in this Press Review
@@ -359,5 +360,8 @@
 watch.filter.dates.days = S, M, T, W, T, F, S
 watch.filter.dates.firstDayOfWeek = 0
 
+watch.language.en=English
+watch.language.fr=French
+
 </content>
 </xwikidoc>

Modified: 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations.fr
===================================================================
--- 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations.fr
   2008-02-22 15:25:30 UTC (rev 7917)
+++ 
xwiki-products/xwiki-watch/trunk/wikis/watch/src/main/resources/WatchCode/Translations.fr
   2008-02-22 15:36:57 UTC (rev 7918)
@@ -233,6 +233,7 @@
 watch.analysis.caption=XWiki Watch Analyse textuelle
 watch.analysis.invitation=Voici les mots les plus pr�sents dans les articles 
correspondant � votre filtre:
 watch.analysis.noselection=Veuillez choisir un mot
+watch.analysis.language=Choisissez la langue du contenu: 
 watch.pressreview.caption=XWiki Watch Revue de Presse
 watch.pressreview.invitation=Voici la liste d'articles correspondant � votre 
filtre:
 watch.pressreview.noselection=Il n'y a pas de flux dans votre revue de presse
@@ -359,5 +360,8 @@
 watch.filter.dates.days = D, L, M, M, J, V, S
 watch.filter.dates.firstDayOfWeek = 1
 
+watch.language.en=Anglais
+watch.language.fr=Fran�ais
+
 </content>
 </xwikidoc>

_______________________________________________
notifications mailing list
notifications@xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to