Index: tmp/org.txm.progression.core/.project
===================================================================
--- tmp/org.txm.progression.core/.project	(revision 0)
+++ tmp/org.txm.progression.core/.project	(revision 37)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.progression.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: tmp/org.txm.progression.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/messages/TBXProgressionMessages.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/messages/TBXProgressionMessages.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/messages/TBXProgressionMessages.java	(revision 37)
@@ -0,0 +1,39 @@
+package org.txm.progression.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class TBXProgressionMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.progression.core.messages.messages"; //$NON-NLS-1$
+
+	public static String ChartsEngine_PROGRESSION_X_AXIS_LABEL;
+	public static String ChartsEngine_PROGRESSION_Y_AXIS_CUMULATIVE_LABEL;
+	public static String ChartsEngine_PROGRESSION_Y_AXIS_NOT_CUMULATIVE_LABEL;
+
+	public static String ChartsEngine_PROGRESSION_TITLE_PROGRESSION_OF;
+	public static String ChartsEngine_PROGRESSION_TITLE_IN;
+	public static String ChartsEngine_PROGRESSION_TITLE_DENSITY;
+	public static String ChartsEngine_PROGRESSION_TITLE_STRUCT;
+	public static String ChartsEngine_PROGRESSION_TITLE_PROPERTY;
+	public static String ChartsEngine_PROGRESSION_TITLE_VALUE;
+
+	public static String ComputeProgression_0;
+	public static String ComputeProgression_1;
+	public static String ComputeProgression_10;
+	public static String ComputeProgression_12;
+	public static String ComputeProgression_13;
+	public static String ComputeProgression_2;
+	public static String ComputeProgression_3;
+	public static String ComputeProgression_4;
+	public static String ComputeProgression_5;
+	public static String ComputeProgression_6;
+	public static String ComputeProgression_9;
+
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, TBXProgressionMessages.class);
+	}
+
+	private TBXProgressionMessages() {
+	}
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/messages/TBXProgressionMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages.properties
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages.properties	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages.properties	(revision 37)
@@ -0,0 +1,20 @@
+ChartsEngine_PROGRESSION_X_AXIS_LABEL=T = {0}
+ChartsEngine_PROGRESSION_Y_AXIS_CUMULATIVE_LABEL=Occurrences
+ChartsEngine_PROGRESSION_Y_AXIS_NOT_CUMULATIVE_LABEL=Density
+ChartsEngine_PROGRESSION_TITLE_PROGRESSION_OF=Progression of
+ChartsEngine_PROGRESSION_TITLE_IN=in
+ChartsEngine_PROGRESSION_TITLE_DENSITY=(density)
+ChartsEngine_PROGRESSION_TITLE_STRUCT=structure: 
+ChartsEngine_PROGRESSION_TITLE_PROPERTY=, property: 
+ChartsEngine_PROGRESSION_TITLE_VALUE=, value: 
+ComputeProgression_0=The Progression command is not yet available for discontinuous sub-corpora.
+ComputeProgression_1=CQP error\:
+ComputeProgression_10=Opening progression chart
+ComputeProgression_12=Done\: Number of positions\: {0}
+ComputeProgression_13=Progression failed\: {0}
+ComputeProgression_2=Computing progression of {0} in the corpus {1}
+ComputeProgression_3=Done\: no match found.
+ComputeProgression_4=Computing progression of {0} with queries\: {1}, structural unit\: {2}, property\: {3}, cumulative\: {4}
+ComputeProgression_5=StatEngine is not ready. Canceling command.
+ComputeProgression_6=Error: the Progression needs at least one CQL to work. Aborting
+ComputeProgression_9={0} is not writable

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages_fr.properties	(revision 37)
@@ -0,0 +1,18 @@
+ChartsEngine_PROGRESSION_X_AXIS_LABEL=T = {0}
+ChartsEngine_PROGRESSION_Y_AXIS_CUMULATIVE_LABEL=Occurrences
+ChartsEngine_PROGRESSION_Y_AXIS_NOT_CUMULATIVE_LABEL=Densit�
+ChartsEngine_PROGRESSION_TITLE_PROGRESSION_OF=Progression de
+ChartsEngine_PROGRESSION_TITLE_IN=dans
+ChartsEngine_PROGRESSION_TITLE_DENSITY= (densit�)
+ChartsEngine_PROGRESSION_TITLE_STRUCT=structure :  
+ChartsEngine_PROGRESSION_TITLE_PROPERTY=, propri�t� :  
+ChartsEngine_PROGRESSION_TITLE_VALUE=, valeur 
+ComputeProgression_0=La fonctionnalit� Progression n'est pas encore disponible pour les sous-corpus discontinus.
+ComputeProgression_1=Erreur lors de la r�cup�ration de la derni\u00E8re erreur CQP \:  
+ComputeProgression_10=Ouverture du graphique de progression
+ComputeProgression_12=Termin� \: {0} positions affich�es
+ComputeProgression_13=** \u00C9chec du calcul de la progression \: {0}
+ComputeProgression_2=Calcul de la progression de <{0}> dans le corpus {1}
+ComputeProgression_3=Termin�\: pas de match trouv�.
+ComputeProgression_4=Calcul de la progression de {0} avec la requ\u00EAte \: {1}, la structure \: {2}, la propri�t� \: {3}, cumulatif\: {4}
+ComputeProgression_9=** {0} n''est pas accessible en �criture

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression2.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression2.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression2.java	(revision 37)
@@ -0,0 +1,666 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.progression.core.functions;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.txm.HasResults;
+import org.txm.Messages;
+import org.txm.functions.Function;
+import org.txm.functions.TXMResult;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+/**
+ * Computes a progression similar to the progression of Weblex software.
+ *  
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class Progression2 extends Function implements TXMResult  {
+
+	/** The corpus. */
+	Corpus corpus;
+
+	/** The queries. */
+	List<Query> queries;
+
+	/** The structure. */
+	StructuralUnit structure;
+
+	/** The property. */
+	StructuralUnitProperty property;
+
+	/** The propertyregex. */
+	String propertyRegex;
+
+	/** The Xmin corpus. */
+	int XminCorpus;
+
+	/** The Xmax corpus. */
+	int XmaxCorpus;
+	
+	/** The writer. */
+	private BufferedWriter writer;
+
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static String black = "black"; //$NON-NLS-1$
+
+	/** The colors. */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static String[] colors = {"red","blue","green3","gold", "deeppink1", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		"firebrick","navyblue","green4", "darkgoldenrod1","magenta1", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		"deepskyblue","green","yellow","cyan","greenyellow", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		"seagreen1", black, "grey" }; //$NON-NLS-1$ //$NON-NLS-2$ 
+	//int[] colors16 = {552, 26, 257, 142, 117,133 ,491, 258, 76, 451, 121, 254, 652, 68 ,259, 575};
+
+	/** The monocolors. */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static String[] monocolors = {black, black, black, black, black,
+		black, black, black, black, black,
+		black, black, black, black, black, black }; 
+	//int[] monocolors = {24, 24, 24, 24, 24, 24 ,24, 24, 24, 24, 24, 24, 24, 24 ,24, 24};
+
+	// jeu de 16 couleurs :
+
+	// jeu de 10 couleurs :
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static String[] colors10 = {"red","blue","green4","gold","deeppink1", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+			"firebrick", "deepskyblue","greenyellow", "darkgoldenrod1","magenta1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+	// jeu de 5 couleurs :
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static String[] colors5 = {"red", "blue", "green4", "gold", "deeppink1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+	/** The styles. */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static int[] styles = {
+		1, 2, 3, 4, 5, 6, 1, 2, 3, 4 ,5, 6 ,1 ,2 ,3, 4 }; 
+
+	/** The monostyles. */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static int[] monostyles = {
+		1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ,1 ,1 ,1, 1, 1, 1 }; 
+
+
+	/** The widths. */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static int[] widths = {
+		1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3 }; 
+
+	/** The monowidths. */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated, related to rendering system
+	public static int[] monowidths = {
+		1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; 
+
+
+	/** List of token position in the text. */
+	List<int[]> allPositions = new ArrayList<int[]>();
+
+	/** The structurepositions. */
+	int[] structurePositions = new int[0];
+
+	/** The structurenames. */
+	String[] structureNames = new String[0];
+
+	/** graph boundaries. */
+	int maxY;
+
+	/** The max x. */
+	int maxX;
+
+	/** The name. */
+	String name;
+
+	/** The repeatvalues. */
+	private boolean repeatvalues;
+
+	/** The bande. */
+	private float bande = 0.0f;
+
+	/** The bandemultiplier. */
+	private float bandemultiplier;
+
+	/**
+	 * Instantiates a new progression.
+	 *
+	 * @param corpus the corpus
+	 * @param queries , a curve per query
+	 * @param structure , the structural unit to show
+	 * @param property , the value to display
+	 * @param propertyregex , a selection of the values to display
+	 * @param doCumulative , if true do a cumulative graph, if not compute the density (R
+	 * function)
+	 * @param monochrome the monochrome
+	 * @param monostyle the monostyle
+	 * @param linewidth the linewidth
+	 * @param repeat the repeat
+	 * @param bandemultiplier the bandemultiplier
+	 */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated
+	// FIXME : all parameters related to rendering should removed from this class and centralized in the charts engine system
+	public Progression2(Corpus corpus, List<Query> queries,
+			StructuralUnit structure, StructuralUnitProperty property,
+			String propertyregex, boolean doCumulative, int linewidth, boolean repeat, float bandemultiplier) {
+		//System.out.println("monochrome: "+monochrome+" monostyle: "+monostyle+" width: "+linewidth);
+		this.corpus = corpus; // the corpus which we compute on
+		this.queries = queries; // the query of the selection
+		this.structure = structure;
+		this.property = property;
+		this.propertyRegex = propertyregex;
+		this.repeatvalues = repeat;
+		this.bandemultiplier = bandemultiplier;
+
+		for (int i = 0 ; i < monowidths.length ; i++) {
+			monowidths[i] = linewidth;
+		}
+	}
+
+	/**
+	 * Compute.
+	 *
+	 * @return true, if successful
+	 * @throws CqiClientException the cqi client exception
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public boolean process() throws CqiClientException, IOException, CqiServerError {
+		return stepQueries() && stepStructuralUnits() && stepFinalize();
+	}
+
+	/**
+	 * Test discontinuity of a corpus. If the corpus is a subcorpus then test if the start-end of matches make no hole
+	 * @param corpus
+	 * @return
+	 */
+	public static boolean canRunProgression(Corpus corpus) {
+		//System.out.println(corpus.getMatches());
+		if (corpus.getMatches().size() == 1) return true;
+		else {
+			Match previousMatch = null;
+			for (Match m : corpus.getMatches()) {
+				if (previousMatch == null) {
+					previousMatch = m;
+					continue;
+				}
+				
+				if (m.getStart() == previousMatch.getEnd()+1) {
+					previousMatch = m;
+					continue;
+				} else {
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * Step queries.
+	 *
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public boolean stepQueries() throws CqiClientException
+	{
+		maxX = corpus.getSize();
+		int npositions = 0;
+		for (Query query : queries) {
+			// System.out.println("query  "+query.getQueryString());
+			QueryResult result = corpus.query(query, query.getQueryString()
+					.replace(" ", "_") + "_progression", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$			
+			int nLines = result.getNMatch();
+			if (maxY < nLines)
+				maxY = nLines;
+
+			List<Match> matches = null;
+			if (nLines > 0) {
+				matches = result.getMatches(0, nLines - 1); // get the indexes
+				// sequences of result's tokens
+			} else {
+				matches = new ArrayList<Match>();
+			}
+			//System.out.println("matches: "+matches);
+			int[] positions = new int[matches.size()];
+			// System.out.println("nb positions "+matches.size());
+			// if (matches.size() > 0)
+			allPositions.add(positions);
+			int i = 0;
+			for (Match m : matches) {
+				positions[i++] = m.getStart();
+				npositions++;
+			}
+			result.drop();
+		}
+		return npositions > 0;
+	}
+
+	/**
+	 * Step structural units.
+	 *
+	 * @throws CqiClientException the cqi client exception
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public boolean stepStructuralUnits() throws CqiClientException, IOException, CqiServerError
+	{
+		// structure query
+		if (structure != null) {
+			Query query = new Query("<" + structure.getName() + ">[]"); //$NON-NLS-1$ //$NON-NLS-2$
+			if (property != null) {
+				query = new Query("<" + property.getFullName() + ">[]"); //$NON-NLS-1$ //$NON-NLS-2$
+				if (propertyRegex != null)
+					query = new Query(
+							"<"	+ property.getFullName() + "=\"" + propertyRegex + "\">[]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			}
+
+			// System.out.println("Struct: "+ structure+" property: "+property);
+			// System.out.println(query.getQueryString());
+			QueryResult result = corpus.query(query, query.getQueryString()
+					.replace(" ", "_") + "_progression", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] starts = result.getStarts();
+			result.drop();
+			int nLines = starts.length;
+			
+//			List<Match> matches = new ArrayList<Match>();
+//			if (nLines > 0)
+//				matches = result.getMatches(0, nLines - 1); // get the indexes
+			// sequences of result's tokens
+
+			structurePositions = new int[nLines];
+			structureNames = new String[nLines];
+
+			
+			
+			Map<Property, List<String>> refValues = new HashMap<Property, List<String>>();
+			if (property != null) {
+				List<String> values = CorpusManager.getCorpusManager().getCqiClient().getSingleData(property, starts);
+				refValues.put(property, values);
+			}
+
+			int i = 0;
+			String previousname = ""; //$NON-NLS-1$
+			String currentname = ""; //$NON-NLS-1$
+			int previousposition = -99999;
+			int distmin = 999999;
+			for (int m : starts) {
+				if (property != null)
+					currentname = refValues.get(property).get(i);
+				else
+					currentname = structure.getName() + i;
+
+				if (repeatvalues) {
+					structureNames[i] = currentname;
+					structurePositions[i] = m;
+				} else {
+					if (!previousname.equals(currentname)) {
+						structureNames[i] = currentname;
+						structurePositions[i] = m;
+					}
+				}
+				if (i == 0)
+					structurePositions[i] += 1; 
+
+				if (m - previousposition < distmin) {
+					distmin = m - previousposition;
+				}
+
+				previousname = ""+currentname; //$NON-NLS-1$
+				previousposition = m;
+
+				i++;
+			}
+			this.bande = distmin*bandemultiplier;
+		}
+		return true;
+	}
+
+	/**
+	 * Step finalize.
+	 *
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public boolean stepFinalize() throws CqiClientException
+	{
+		if (corpus instanceof Subcorpus) {
+			List<Match> matches = ((Subcorpus) corpus).getMatches();
+			if (matches.size() == 0) {
+				System.out.println(Messages.Progression_1);
+				return false;
+			}
+			
+			XminCorpus = matches.get(0).getStart();
+			XmaxCorpus = matches.get(matches.size()-1).getEnd();		
+		} else {
+			XminCorpus = 0;
+			XmaxCorpus = corpus.getSize();
+		}
+		//System.out.println("min: "+XminCorpus+ "max: "+XmaxCorpus);
+
+		if (bande <= 0) {
+			bande = ((XmaxCorpus - XminCorpus)/100)*bandemultiplier;
+			if (bande == 0)
+				bande = 1.0f;
+		}
+		return true;
+	}
+
+	/** The norep. */
+	public static int norep = 1;
+
+	/** The prefix r. */
+	public static String prefixR = "Progression"; //$NON-NLS-1$
+
+
+	/**
+	 * 
+	 * @param outfile
+	 * @param encoding
+	 * @return
+	 * @throws IOException
+	 */
+	public boolean toTxt(File outfile, String encoding) throws IOException {
+		// NK: writer declared as class attribute to perform a clean if the operation is interrupted
+		tryAcquireSemaphore();
+		this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile),
+				encoding)); 
+		for (int i = 0 ; i < queries.size() ; i++) {
+			writer.write("* "+queries.get(i)+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			for (int p : allPositions.get(i)) {
+				writer.write(""+p+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}
+		writer.close();
+		releaseSemaphore();
+		return true;
+	}
+	
+
+
+
+
+	/**
+	 * Gets the max x.
+	 *
+	 * @return the max x
+	 */
+	public int getMaxX() {
+		return maxX;
+	}
+
+	/**
+	 * Gets the max y.
+	 *
+	 * @return the max y
+	 */
+	public int getMaxY() {
+		return maxY;
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	/**
+	 * Gets the queries.
+	 *
+	 * @return the queries
+	 */
+	public List<Query> getQueries() {
+		return queries;
+	}
+
+	/**
+	 * Gets the allpositions.
+	 *
+	 * @return the allpositions
+	 */
+	public List<int[]> getAllpositions() {
+		return allPositions;
+	}
+
+	/**
+	 * Gets the positions counts.
+	 *
+	 * @return the positions counts
+	 */
+	public List<Integer> getPositionsCounts() {
+		ArrayList<Integer> counts = new ArrayList<Integer>();
+		for (int[] list : allPositions)
+			counts.add(list.length);
+		return counts;
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return this.queries.toString();
+	}
+
+	/**
+	 * Gets the details.
+	 *
+	 * @return the details
+	 */
+	public String getDetails() {
+		return this.queries.toString();
+	}
+
+	
+	/**
+	 * Checks if is repeatvalues.
+	 *
+	 * @return true, if is repeatvalues
+	 */
+	public boolean isRepeatvalues() {
+		return repeatvalues;
+	}
+
+
+
+	@Override
+	public void clean() {
+		try {
+			this.writer.flush();
+			this.writer.close();	
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	@Override
+	public boolean toTxt(File outfile, String encoding, String colseparator,
+			String txtseparator) throws Exception {
+		return toTxt(outfile, encoding);
+	}
+
+	/**
+	 * @return the allPositions
+	 */
+	public List<int[]> getAllPositions() {
+		return allPositions;
+	}
+
+	/**
+	 * @return the structurePositions
+	 */
+	public int[] getStructurePositions() {
+		return structurePositions;
+	}
+
+	/**
+	 * @return the structureNames
+	 */
+	public String[] getStructureNames() {
+		return structureNames;
+	}
+
+	/**
+	 * @return the structure
+	 */
+	public StructuralUnit getStructure() {
+		return structure;
+	}
+
+	/**
+	 * @return the property
+	 */
+	public StructuralUnitProperty getProperty() {
+		return property;
+	}
+
+	/**
+	 * @return the propertyRegex
+	 */
+	public String getPropertyRegex() {
+		return propertyRegex;
+	}
+
+	/**
+	 * @return the bande
+	 */
+	public float getBande() {
+		return bande;
+	}
+
+	/**
+	 * @return the xminCorpus
+	 */
+	public int getXminCorpus() {
+		return XminCorpus;
+	}
+
+	/**
+	 * @return the xmaxCorpus
+	 */
+	public int getXmaxCorpus() {
+		return XmaxCorpus;
+	}
+
+
+
+	/**
+	 * @param name the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	@Override
+	public String[] getExportTXTExtensions() {
+		return new String[]{"*.txt"};
+	}
+
+	@Override
+	public boolean delete() {
+		return corpus.removeResult(this);
+	}
+
+	@Override
+	public HasResults getParent() {
+		return corpus;
+	}
+
+	/**
+	 * Computes and gets a query constructed from all the queries in alternative mode (with pipe |).
+	 * @return
+	 */
+	public String getQueriesString()	{
+		ArrayList<Integer> allQueriesIndexes = new ArrayList<Integer>(this.queries.size());
+		for(int i = 0; i < this.queries.size(); i++) {
+			allQueriesIndexes.add(i);
+		}
+		return this.getQueriesString(allQueriesIndexes) ;
+	}
+	
+	/**
+	 * Computes and gets a query constructed from all the queries specified by their index in alternative mode (with pipe |).
+	 * @param queriesIndexes
+	 * @return
+	 */
+	public String getQueriesString(ArrayList<Integer> queriesIndexes)	{
+		
+		String query = "";
+		
+		for(int i = 0; i < this.queries.size(); i++) {
+			if(queriesIndexes.contains(i))	{
+				String tmpQuery = this.queries.get(i).getQueryString();
+				// Remove "[" and "]" only if it's a simple query as "[look]" 
+				if(tmpQuery.startsWith("[") && !tmpQuery.contains("="))	{
+					int length = tmpQuery.length();
+					if(tmpQuery.endsWith("]"))	{
+						length--;
+					}
+					tmpQuery = tmpQuery.substring(1, length);
+				}
+				if(query.length() > 0)	{
+					query += " | ";
+				}
+				query += tmpQuery;
+			}
+		}
+
+		return query;
+		
+	}
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression2.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java	(revision 37)
@@ -0,0 +1,157 @@
+package org.txm.progression.core.chartsengine.r;
+
+import java.io.File;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.rosuda.REngine.REXPMismatchException;
+import org.txm.chartsengine.r.core.RChartCreator;
+import org.txm.chartsengine.r.core.RChartsEngine;
+import org.txm.progression.core.chartsengine.base.Utils;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.progression.core.preferences.ProgressionPreferences;
+import org.txm.stat.StatException;
+import org.txm.stat.engine.r.RWorkspace;
+import org.txm.stat.engine.r.RWorkspaceException;
+import org.txm.tbx.preferences.TXMPreferences;
+import org.txm.utils.logger.Log;
+
+/**
+ * R progression chart creator.
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class RProgressionChartCreator extends RChartCreator {
+
+	public RProgressionChartCreator() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public Object createChart(Object resultData, String preferencesNode) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public File createChartFile(Object resultData, File file, String preferencesNode) {
+
+		try {
+			
+			Progression2 progression = (Progression2) resultData;
+			
+			// parameters
+			boolean grayscale = TXMPreferences.getBoolean(preferencesNode, ProgressionPreferences.MONOCHROMATIC);
+			boolean monostyle = TXMPreferences.getBoolean(preferencesNode, ProgressionPreferences.MONO_STYLE);
+			boolean cumulative = TXMPreferences.getBoolean(preferencesNode, ProgressionPreferences.CUMULATIVE);
+			
+			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+			rw.eval("library(textometry)");
+			// System.out.println("create list of positions");
+			String listString = "list("; //$NON-NLS-1$
+			for(int i = 0; i < progression.getAllpositions().size(); i++) {
+				int[] positions = progression.getAllpositions().get(i);
+				// System.out.println("add vector "+i);
+				rw.eval("rm(x" + i + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+				rw.addVectorToWorkspace("x" + i, positions); //$NON-NLS-1$
+				listString += "x" + i + ","; //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			listString = listString.substring(0, listString.length() - 1) + ")"; //$NON-NLS-1$
+			// System.out.println("create positions");
+			rw.eval("rm(positions)"); //$NON-NLS-1$
+			rw.eval("positions <- " + listString); //$NON-NLS-1$
+
+			rw.eval("rm(structurepositions)"); //$NON-NLS-1$
+			rw.addVectorToWorkspace("structurepositions", progression.getStructurePositions()); //$NON-NLS-1$
+			rw.eval("rm(structurenames)"); //$NON-NLS-1$
+			// if (structurenames != null) structurenames = new
+			// String[structurepositions.length];
+			for(int i = 0; i < progression.getStructureNames().length; i++) { // Fix empty attribute values
+				if("".equals(progression.getStructureNames()[i]) || progression.getStructureNames()[i] == null) {  //$NON-NLS-1$
+					progression.getStructureNames()[i] = "--"; //$NON-NLS-1$
+				}
+			}
+			rw.addVectorToWorkspace("structurenames", progression.getStructureNames()); //$NON-NLS-1$
+			// System.out.println("create list positions");
+			// rw.getConnection().assign("positions",Rpositions);
+
+			// System.out.println("create colors vector");
+			rw.eval("rm(colors)"); //$NON-NLS-1$
+			if(grayscale) {
+				rw.addVectorToWorkspace("colors", Progression2.monocolors); //$NON-NLS-1$
+			}
+			else {
+				if(progression.getQueries().size() <= 5) {
+					// System.out.println("uses colors5");
+					rw.addVectorToWorkspace("colors", Progression2.colors5); //$NON-NLS-1$
+				}
+				else if(progression.getQueries().size() <= 10) {
+					// System.out.println("uses colors10");
+					rw.addVectorToWorkspace("colors", Progression2.colors10); //$NON-NLS-1$
+				}
+				else {
+					// System.out.println("uses colors16");
+					rw.addVectorToWorkspace("colors", Progression2.colors); //$NON-NLS-1$
+				}
+			}
+
+			// System.out.println("create styles vector");
+			rw.eval("rm(styles)"); //$NON-NLS-1$
+			if(monostyle) {
+				rw.addVectorToWorkspace("styles", Progression2.monostyles); //$NON-NLS-1$
+			}
+			else {
+				rw.addVectorToWorkspace("styles", Progression2.styles); //$NON-NLS-1$
+			}
+
+			// System.out.println("create styles vector");
+			rw.eval("rm(widths)"); //$NON-NLS-1$
+			rw.addVectorToWorkspace("widths", Progression2.monowidths); //$NON-NLS-1$
+
+			// System.out.println("create names vector");
+			String[] queriesstring = new String[progression.getQueries().size()];
+			for(int i = 0; i < progression.getQueries().size(); i++) {
+				queriesstring[i] = progression.getQueries().get(i).getQueryString();
+			}
+			rw.eval("rm(names)"); //$NON-NLS-1$
+			rw.addVectorToWorkspace("names", queriesstring); //$NON-NLS-1$
+
+			String name = progression.getCorpus().getName();
+
+			String title = Utils.createProgressionChartTitle(progression, cumulative);
+
+			// Escape title string
+			title = StringEscapeUtils.escapeJava(title);
+
+			// System.out.println("BANDE="+bande);
+			String cmd = "progression(positions, names, colors, styles, widths, \"" + name + "\"," + progression.getXminCorpus() + "," + progression.getXmaxCorpus() + ",\"" + cumulative + "\",structurepositions,structurenames, \"" + title + "\", " + progression.getBande() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+			rw.plot(file, cmd, ((RChartsEngine) this.chartsEngine).getRDevice());
+
+			RWorkspace.getRWorkspaceInstance().eval(Progression2.prefixR + Progression2.norep + " <- list(positions=positions, names=names, xmin=" + progression.getXminCorpus() + ",xmax=" + progression.getXmaxCorpus() + ", structpositions=structurepositions, structnames=structurenames)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			Progression2.norep++;
+			Log.info("R exec : " + cmd);
+		}
+		catch(RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		catch(REXPMismatchException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		catch(StatException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+
+		return file;
+	}
+
+
+	@Override
+	public Class getResultDataType() {
+		return Progression2.class;
+	}
+
+
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/base/Utils.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/base/Utils.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/base/Utils.java	(revision 37)
@@ -0,0 +1,62 @@
+package org.txm.progression.core.chartsengine.base;
+
+import org.txm.chartsengine.core.ChartCreator;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.progression.core.messages.TBXProgressionMessages;
+
+/**
+ * Creates a progression chart from the specified <code>Progression</code> result.
+ * @author sjacquot
+ *
+ */
+public abstract class Utils extends ChartCreator {
+
+	public Utils() {
+		// TODO Auto-generated constructor stub
+	}
+
+
+	/**
+	 * Creates a string title, shared by charts engine implementations, for the progression chart from the specified result.
+	 * @param the progression result
+	 * @param doCumulative
+	 * @return the titles string
+	 */
+	public static String createProgressionChartTitle(Progression2 progression, boolean doCumulative)	{
+
+		String title = TBXProgressionMessages.ChartsEngine_PROGRESSION_TITLE_PROGRESSION_OF + " "; //$NON-NLS-1$
+
+		// Put queries in title
+		for(int i = 0; i < progression.getQueries().size(); i++) {
+			title +=  progression.getQueries().get(i).getQueryString();
+			if(i < progression.getQueries().size() - 1)	{
+				title += ", "; //$NON-NLS-1$
+			}
+		}
+
+
+		title += " " + TBXProgressionMessages.ChartsEngine_PROGRESSION_TITLE_IN + " " + progression.getCorpus().getName(); //$NON-NLS-1$ //$NON-NLS-2$
+
+		if(!doCumulative)	{
+			title += " " + TBXProgressionMessages.ChartsEngine_PROGRESSION_TITLE_DENSITY; //$NON-NLS-1$
+		}
+
+
+		// FIXME : is this useful ? I needed to create the setName() method for this.
+		progression.setName(title);
+
+		if (progression.getStructure() != null) {
+			title += "\n(" + TBXProgressionMessages.ChartsEngine_PROGRESSION_TITLE_STRUCT + progression.getStructure().getName();
+			if (progression.getProperty() != null) {
+				title += TBXProgressionMessages.ChartsEngine_PROGRESSION_TITLE_PROPERTY + progression.getProperty().getName();
+				if (progression.getPropertyRegex() != null)	{
+					title += TBXProgressionMessages.ChartsEngine_PROGRESSION_TITLE_VALUE + progression.getPropertyRegex();
+				}
+			}
+			title += ")";
+		}
+
+		return title;
+	}
+	
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/base/Utils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/JFCProgressionChartCreator.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/JFCProgressionChartCreator.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/JFCProgressionChartCreator.java	(revision 37)
@@ -0,0 +1,216 @@
+package org.txm.progression.core.chartsengine.jfreechart.themes.highcharts;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.util.List;
+
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.ValueMarker;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.jfree.ui.RectangleAnchor;
+import org.jfree.ui.TextAnchor;
+import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
+import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
+import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IItemSelectionRenderer;
+import org.txm.chartsengine.jfreechart.core.themes.base.ExtendedNumberAxis;
+import org.txm.progression.core.chartsengine.base.Utils;
+import org.txm.progression.core.chartsengine.jfreechart.themes.highcharts.renderers.ProgressionItemSelectionRenderer;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.progression.core.messages.TBXProgressionMessages;
+import org.txm.progression.core.preferences.ProgressionPreferences;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.tbx.preferences.TXMPreferences;
+
+/**
+ * JFC progression chart creator.
+ * 
+ * @author sjacquot
+ *
+ */
+public class JFCProgressionChartCreator extends JFCChartCreator {
+
+	public JFCProgressionChartCreator() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public JFreeChart createChart(Object resultData, String preferencesNode) {
+
+		
+		Progression2 progression = (Progression2) resultData;
+		
+		// parameters
+//		boolean grayscale = (Boolean)params[0];
+//		boolean monostyle = (Boolean)params[1];
+//		boolean cumulative = (Boolean)params[2];
+
+		boolean grayscale = TXMPreferences.getBoolean(preferencesNode, resultData, ProgressionPreferences.MONOCHROMATIC);
+		boolean monostyle = TXMPreferences.getBoolean(preferencesNode, resultData, ProgressionPreferences.MONO_STYLE);
+		boolean cumulative = TXMPreferences.getBoolean(preferencesNode, resultData, ProgressionPreferences.CUMULATIVE);
+		
+		
+		JFreeChart chart = null;
+
+		// Create the dataset
+		XYSeriesCollection dataset = new XYSeriesCollection();
+		List<int[]> positions = progression.getAllpositions();
+		List<Query> queries = progression.getQueries();
+		// Y axis label
+		String yAxisLabel;
+
+		// Cumulative
+		if(cumulative)	{
+			for(int i = 0; i < progression.getAllpositions().size(); i++) {
+				int[] list = positions.get(i);
+				Query query = queries.get(i);
+				XYSeries series = new XYSeries(query.toString() + " " + list.length);
+				int c = 1;
+				for(int j = 0; j < list.length; j++) {
+					// Add a first point to draw a vertical line
+					if(j == 0)	{
+						series.add(list[j], 0);
+					}
+					series.add(list[j], c++);
+				}
+
+				// FIXME: add a dummy point to draw horizontal line between last point and max X corpus
+				series.add(progression.getXmaxCorpus(), --c);
+				dataset.addSeries(series);
+			}
+
+			// Create the chart
+			yAxisLabel = TBXProgressionMessages.ChartsEngine_PROGRESSION_Y_AXIS_CUMULATIVE_LABEL;
+			chart = this.getChartsEngine().createXYStepChart(dataset, Utils.createProgressionChartTitle(progression, cumulative),
+					TBXProgressionMessages.bind(TBXProgressionMessages.ChartsEngine_PROGRESSION_X_AXIS_LABEL, progression.getXmaxCorpus()), yAxisLabel, true, true, true, true, true);
+
+
+			// Custom renderer
+			chart.getXYPlot().setRenderer(new ProgressionItemSelectionRenderer());
+
+		}
+		// FIXME : Density, to implement when textometry R package will store the result in the Progression class
+		else	{
+
+			// FIXME : density not yet implemented
+			System.err.println("JFCChartsEngine.createProgressionChart(): density mode not yet implemented.");
+
+			for(int i = 0; i < progression.getAllpositions().size(); i++) {
+				int[] liste = positions.get(i);
+				Query query = queries.get(i);
+				XYSeries series = new XYSeries(query.toString() + " " + liste.length);
+
+				for(int j = 0; j <  liste.length; j++) {
+
+					// FIXME : tests y
+					// y <- c( c(0), y , c(y[[length(x)]]) ) // R code
+					// FIXME : random Y value
+					double y = progression.getAllpositions().get(i)[j] * Math.random();
+	//				double y = progression.getAllpositions().get(i)[j];
+					series.add(liste[j], y);
+				}
+				dataset.addSeries(series);
+			}
+
+			// Create the chart
+			yAxisLabel =  TBXProgressionMessages.ChartsEngine_PROGRESSION_Y_AXIS_NOT_CUMULATIVE_LABEL;
+			chart = this.getChartsEngine().createXYLineChart(dataset, Utils.createProgressionChartTitle(progression, cumulative),
+					TBXProgressionMessages.bind(TBXProgressionMessages.ChartsEngine_PROGRESSION_X_AXIS_LABEL, progression.getXmaxCorpus()), yAxisLabel,
+					true, true, true, false, true, false, true, null);
+		}
+
+
+
+        ((IItemSelectionRenderer) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_PROGRESSION);
+        ((IItemSelectionRenderer) chart.getXYPlot().getRenderer()).getItemsSelector().setResultData(progression);
+
+
+		// Add the limit markers
+		BasicStroke dashedStroke = new BasicStroke(0.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f, new float[] {2f}, 0f);
+		Marker marker = new ValueMarker(progression.getXminCorpus());
+        marker.setPaint(Color.gray);
+        marker.setStroke(dashedStroke);
+        chart.getXYPlot().addDomainMarker(marker);
+		marker = new ValueMarker(progression.getXmaxCorpus());
+        marker.setPaint(Color.gray);
+        marker.setStroke(dashedStroke);
+        chart.getXYPlot().addDomainMarker(marker);
+
+
+//        // FIXME : limit with annotations rather than markers (marker height is dynamically adapted to the real chart height.
+        // Annotation have a fixed height)
+//        XYLineAnnotation annotation = new XYLineAnnotation(0, 0, 0, dataset.getRangeUpperBound(true), dashedStroke, Color.gray);
+//        chart.getXYPlot().addAnnotation(annotation, true);
+
+		// Add the part markers
+		if(progression.getStructurePositions().length > 0)	{
+			for(int i = 0; i < progression.getStructurePositions().length; i++) {
+				if(progression.getStructurePositions()[i] != 0)	{
+					marker = new ValueMarker(progression.getStructurePositions()[i]);
+			        marker.setPaint(Color.black);
+			        marker.setLabel(progression.getStructureNames()[i]);
+			        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+			        marker.setLabelTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
+
+
+			        // FIXME: test of rotated annotations rather than using marker label. The problem with this is that the position of annotation is not adjusted when zooming/dezooming.
+			        // FIXME: the best approach is to redefine the drawing method of
+////			        double start = marker.getStartValue();
+////			        double end = TempIntervalMarker.getEndValue();
+////			        double middle = (end - start)/2;
+//			        XYTextAnnotation updateLabel = new XYTextAnnotation("Update", progression.getStructurePositions()[i], 0);
+//			        updateLabel.setFont(new Font("Sans Serif", Font.BOLD, 10));
+//			        updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
+//			        updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
+//			        updateLabel.setRotationAngle(3.14 / 2);
+//			        updateLabel.setPaint(Color.black);
+//			        chart.getXYPlot().addAnnotation(updateLabel);
+
+
+
+			        chart.getXYPlot().addDomainMarker(marker);
+				}
+			}
+		}
+
+		// Custom domain axis for ticks drawing options
+		chart.getXYPlot().setDomainAxis(new ExtendedNumberAxis((NumberAxis) chart.getXYPlot().getDomainAxis(), true, true, progression.getXminCorpus(), progression.getXmaxCorpus()));
+
+		// Custom range axis for ticks drawing options
+		chart.getXYPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getXYPlot().getRangeAxis(), false, true, 0, progression.getMaxY()));
+
+		// Match the X-axis origin value to the min x corpus (for subcorpus case)
+		chart.getXYPlot().getDomainAxis().setLowerBound(progression.getXminCorpus());
+
+
+//        int itemsColorsRenderingMode = Theme.ITEMS_RENDERING_COLORS_MODE;
+//		// Grayscale
+//        if(grayscale)	{
+//        	itemsColorsRenderingMode = Theme.ITEMS_RENDERING_GRAYSCALE_MODE;
+//        }
+
+        // Re-apply theme to the chart to match the colors rendering mode
+        // FIXME : the rendering mode should be pass to all methods, even base methods as createXYLineChart(), createBarChart(), etc.
+        // or better, to be stocked into a member variable in the theme ?
+      //  this.getChartsEngine().getTheme().applyThemeToChart(chart, TXMPreferences.getInt(ProgressionPreferences.PREFERENCES_NODE, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEnginePreferences.PREFERENCES_NODE), monostyle);
+
+		// synchronizes the chart with the shared preferences 
+		//super.syncChart(chart, resultData, ProgressionPreferences.PREFERENCES_NODE);
+		
+		return chart;
+		
+	}
+
+
+	@Override
+	public Class getResultDataType() {
+		return Progression2.class;
+	}
+
+
+	
+
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/JFCProgressionChartCreator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/renderers/ProgressionItemSelectionRenderer.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/renderers/ProgressionItemSelectionRenderer.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/renderers/ProgressionItemSelectionRenderer.java	(revision 37)
@@ -0,0 +1,284 @@
+package org.txm.progression.core.chartsengine.jfreechart.themes.highcharts.renderers;
+
+import java.awt.Color;
+import java.awt.Paint;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.util.ArrayList;
+
+import org.jfree.chart.ChartPanel;
+import org.jfree.chart.labels.XYToolTipGenerator;
+import org.jfree.data.xy.XYDataset;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IItemSelectionRenderer;
+import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYStepRenderer;
+import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.swing.CustomHTMLToolTip;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Match;
+
+/**
+ * Renderer providing item selection system and drawing features for selected item and custom rendering for Progression charts.
+ * @author sjacquot
+ *
+ */
+public class ProgressionItemSelectionRenderer extends ItemSelectionXYStepRenderer {
+
+
+	/**
+	 * Needed to get the Graphics2D object to use in getItemShape() to compute the label text bounds and draw a background rectangle.
+	 */
+	protected ChartPanel chartPanel;
+
+	/**
+	 * Stack to store selected items to draw at last, over others items.
+	 */
+	protected ArrayList itemsToDrawAtLast; 
+	
+
+	/**
+	 * Creates a renderer dedicated to CA charts.
+	 */
+	public ProgressionItemSelectionRenderer() {
+		super();
+		this.setChartType(ChartsEngine.CHART_TYPE_PROGRESSION);
+		// FIXME: simple selection mode
+		//((MultipleItemsSelector) this.multipleItemsSelector).setSimpleSelectionMode(true);
+	}
+
+
+
+	/**
+	 * Initializes the tool tip generator.
+	 */
+	public void initToolTipGenerator(final IItemSelectionRenderer renderer)	{
+		this.setBaseToolTipGenerator(new XYToolTipGenerator() {
+
+			@Override
+			public String generateToolTip(XYDataset dataset, int series, int item) {
+
+				// Hexadecimal color
+				Color color = (Color) getSeriesPaint(series);
+				String hex = "#" + Integer.toHexString(color.getRGB()).substring(2);
+				XYSeriesCollection xyDataset = (XYSeriesCollection) dataset;
+
+//
+//				// FIXME: test affichage des concordances des occurrences directement dans le tooltip
+//				// Progression
+				String concordanceStr = "";
+
+//				if(renderer.getChartType() == ChartsEngine.CHART_TYPE_PROGRESSION)	{
+//					try {
+//						Progression progression = ((Progression)renderer.getItemSelector().getResultData());
+//							//System.out.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() query: " + progression.getQueries().get(xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())));
+//						Property analysisProperty = progression.
+//								getCorpus().
+//								getProperty("word");
+//						List<Property> viewProperties = new ArrayList<Property>();
+//						viewProperties.add(progression.
+//								getCorpus().
+//								getProperty("word"));
+//						ReferencePattern referencePattern = new ReferencePattern();
+//						ReferencePattern refAnalysePattern = new ReferencePattern();
+//						Concordance concordance = new Concordance(progression.getCorpus(), progression.getQueries().get(xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())), analysisProperty, viewProperties, referencePattern, refAnalysePattern, 10, 10);
+//
+//						System.err.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() concordance nlines: " + concordance.getNLines());
+//						System.err.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() item position: " + (xyDataset.getSeries(series).getY(item).intValue() - 1));
+//
+//
+//
+//						Line line = concordance.getLines(xyDataset.getSeries(series).getY(item).intValue() - 1, xyDataset.getSeries(series).getY(item).intValue() - 1).get(0);
+//						concordanceStr = "<p>" + line.leftContextToString() + " <b>" + line.keywordToString() + "</b> " + line.rightContextToString() + "</p>";
+//						//xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())
+//					}
+//					catch(CqiClientException e) {
+//						// TODO Auto-generated catch block
+//						e.printStackTrace();
+//					}
+//					catch(IOException e) {
+//						// TODO Auto-generated catch block
+//						e.printStackTrace();
+//					}
+//					catch(CqiServerError e) {
+//						// TODO Auto-generated catch block
+//						e.printStackTrace();
+//					}
+//				}
+
+				String token = xyDataset.getSeriesKey(series).toString();
+				token = token.substring(0, token.lastIndexOf(" "));
+				int tokenCount = xyDataset.getSeries(series).getItemCount() - 2; // -2 for the 0 point and the dummy last point
+
+				return CustomHTMLToolTip.getDefaultHTMLBody(renderer, hex) + "<p><span style=\"color: " + hex + ";\">" + token + "</span> <b>(" + valuesNumberFormat.format(xyDataset.getSeries(series).getY(item)) + " / " + tokenCount + ")</b>"
+						+ "</p></body><html>";
+				
+				// FIXME: test contexts in tool tip
+//				return CustomHTMLToolTip.getDefaultHTMLBody(renderer, hex) + "<p><span style=\"color: " + hex + ";\">" + xyDataset.getSeriesKey(series)
+//						+ "</span></p><p><b>" + valuesNumberFormat.format(xyDataset.getSeries(series).getY(item)) + ChartsEngineMessages.ChartsEngine_LABEL_VALUE_SEPARATORS
+//						+ " </b><b>" + valuesNumberFormat.format(xyDataset.getSeries(series).getX(item)) + "</b>"
+//						+ concordanceStr
+//						+ "</p></body><html>";
+				
+			}
+		});
+	}
+	
+	
+	
+	@Override
+	public Paint getItemPaint(int series, int item) {
+
+		Color color = (Color) super.getItemPaint(series, item);
+
+		// Skip the line pass
+		if(!isLinePass)	{
+
+			// Change selected item shape color, reducing transparency
+			if(this.multipleItemsSelector.isMouseOverItem(series, item)) {
+				return new Color(color.getRed(), color.getGreen(), color.getBlue(), 195);
+			}
+			// Multiple item selection
+//			else if(this.itemSelector.isMultipleSelectedItem(series, item))	{
+//				// FIXME: rendering tests
+//				return new Color(130, 130, 130, 195);
+//				//return new Color(color.getRed(), color.getGreen(), color.getBlue(), 140);
+//			}
+
+		}
+		
+		return color;
+	}
+
+
+	@Override
+	public Shape getItemShape(int series, int item) {
+
+		Shape s = super.getItemShape(series, item);
+		AffineTransform t = new AffineTransform();
+		// If not selected item reduce the shape therefore it will be hidden by the lines chart
+		if(!this.multipleItemsSelector.isMouseOverItem(series, item) && !this.multipleItemsSelector.isSelectedItem(series, item)) {
+			t.setToScale(0.1, 0.1);
+		}
+		// FIXME: Multiple selection
+//		else if(this.itemSelector.isMultipleSelectedItem(series, item))	{
+////			
+//			// Add a background rectangle to the label selected item
+//			XYSeriesCollection dataset = (XYSeriesCollection) this.getPlot().getDataset();
+//					
+//			Graphics2D graphics = ((Graphics2D) this.chartPanel.getGraphics());
+//			 
+//			// FIXME: get graphics by creating an image insetad of passing the chart panel to this renderer
+////			BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
+////			Graphics2D graphics = img.createGraphics();
+//			// FIXME: rendering quality tests
+////			RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+////			rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+////			rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+////			rh.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+////		    graphics.setRenderingHints(rh);
+//			
+//			Font font = this.getItemLabelFont(series, item);
+//			String label = valuesNumberFormat.format(dataset.getSeries(series).getY(item)) + " / " + (dataset.getSeries(series).getItemCount() - 2); //$NON-NLS-1$ // -2 for the 0 point and the dummy last point;
+//
+//			GlyphVector v = font.createGlyphVector(graphics.getFontMetrics(font).getFontRenderContext(), label);
+//	        Shape labelShape = v.getOutline();
+//	        //Rectangle2D labelBounds = v.getVisualBounds();
+//	        
+//			Rectangle2D labelBounds = font.getStringBounds(label, graphics.getFontRenderContext());
+//
+//			// FIXME : not rounded rectangle version
+////			Shape labelBackground = new Rectangle2D.Double(-bounds.getWidth() / 2, -s.getBounds2D().getHeight() / 2 + 1, bounds.getWidth() + 4, bounds.getHeight() / 2 + 8);
+//
+//			//Rectangle2D labelBounds = font.getStringBounds(label, graphics.getFontRenderContext());
+//			
+//	        //Rectangle labelBounds = labelShape.getBounds();
+//	        
+//			//Shape labelBackground = new RoundRectangle2D.Double(-(labelBounds.getWidth() + 4) / 2, -s.getBounds2D().getHeight() / 2 + 1, labelBounds.getWidth() + 8, labelBounds.getHeight() / 2 + 10, 5, 5);
+//			double width = labelBounds.getWidth() + 10;
+//			double height = labelBounds.getHeight() + 10;
+//			Shape labelBackground = new RoundRectangle2D.Double(-width  / 2, -height / 2 - 15, width, height, 5, 5);
+//			
+//			AffineTransform t2 = new AffineTransform();
+//			t2.setToScale(0.9, 0.9);
+//			Shape labelBackground2 = t2.createTransformedShape(labelBackground);
+//			
+//			
+//			Area a = new Area(s);
+//			a.add(new Area(labelBackground));
+//			//a.add(new Area(labelBackground2));
+//			//a.add(new Area(labelShape));
+//			
+//			s = a;
+//			//t.setToScale(1.5, 1.5);
+//
+//			//return a;
+//			
+//		}
+		else	{
+			t.setToScale(1.5, 1.5);
+		}
+		s = t.createTransformedShape(s);
+		return s;
+	}
+
+
+	/**
+	 * @param chartPanel the chartPanel to set
+	 */
+	public void setChartPanel(ChartPanel chartPanel) {
+		this.chartPanel = chartPanel;
+	}
+
+	
+	@Override
+	public String getSelectedItemLabelFromDataset(XYDataset dataset, int series, int item)	{
+		
+		// manage the first and last dummy point
+		if(item == 0)	{
+			item++;
+		}
+		else if(item == dataset.getItemCount(series) - 1)	{
+			item--;
+		}
+		
+		String label = "";
+		int globalPosition = (int) dataset.getXValue(series, item) + 1;
+		
+		try {
+			
+			Property prop;
+			
+			// Ref
+			prop = ((Progression2)this.multipleItemsSelector.getResultData()).getCorpus().getProperty("ref"); //$NON-NLS-1$
+			// Text id
+			if(prop == null)	{
+				prop = ((Progression2)this.multipleItemsSelector.getResultData()).getCorpus().getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			
+			Match selectedWordMatch = new Match(globalPosition, globalPosition);
+			label = selectedWordMatch.getValueForProperty(prop);
+			
+		}
+		catch(CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		// manage the first 0 dummy point
+		if(item == 0)	{
+			item++;
+		}
+		
+		int tokenCount = ((XYSeriesCollection)dataset).getSeries(series).getItemCount() - 2; // -2 for the 0 point and the dummy last point
+		label += "\n" + globalPosition + " / " + valuesNumberFormat.format(((XYSeriesCollection)dataset).getDomainUpperBound(false)); //$NON-NLS-1$ //$NON-NLS-2$ // -2 for the 0 point and the dummy last point
+
+		label += "\n" + valuesNumberFormat.format(((XYSeriesCollection) dataset).getSeries(series).getY(item)) + " / " + (((XYSeriesCollection) dataset).getSeries(series).getItemCount() - 2); //$NON-NLS-1$ //$NON-NLS-2$ // -2 for the 0 point and the dummy last point 
+		
+		return label;
+	}
+	
+
+
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/renderers/ProgressionItemSelectionRenderer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/package.html
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/package.html	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/package.html	(revision 37)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Progression - inspired by Weblex.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java	(revision 0)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java	(revision 37)
@@ -0,0 +1,59 @@
+package org.txm.progression.core.preferences;
+
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * Default preferences initializer.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class ProgressionPreferences extends AbstractPreferenceInitializer {
+
+
+	// auto populate the preference node qualifier from the current bundle id
+	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(ProgressionPreferences.class).getSymbolicName();
+
+	
+	public static final String PREFERENCES_PREFIX = "progression_"; //$NON-NLS-1$
+	
+	/** The Constant MONOCHROMATIC. */
+	public static final String MONOCHROMATIC = PREFERENCES_PREFIX + "monochrome"; //$NON-NLS-1$
+	
+	/** The Constant CUMULATIVE. */
+	public static final String CUMULATIVE = PREFERENCES_PREFIX + "cumulative"; //$NON-NLS-1$
+	
+	/** The Constant REPEAT_VALUES. */
+	public static final String REPEAT_VALUES = PREFERENCES_PREFIX + "repeat_values"; //$NON-NLS-1$
+	
+	/** The Constant BANDE_MULTIPLIER. */
+	public static final String BANDE_MULTIPLIER = PREFERENCES_PREFIX + "bande_multiplier"; //$NON-NLS-1$
+	
+	/** The Constant MONO_STYLE. */
+	public static final String MONO_STYLE = PREFERENCES_PREFIX + "_mono_style"; //$NON-NLS-1$
+	
+
+	/**
+	 * 
+	 */
+	public ProgressionPreferences() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void initializeDefaultPreferences() {
+		Preferences defaultPreferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
+		defaultPreferences.putBoolean(MONOCHROMATIC, false);
+		defaultPreferences.putBoolean(CUMULATIVE, true);
+		defaultPreferences.putBoolean(REPEAT_VALUES, false);
+		defaultPreferences.putDouble(BANDE_MULTIPLIER, 1.0d);
+		defaultPreferences.putBoolean(MONO_STYLE, true);
+		
+	}
+	
+}

Property changes on: tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/build.properties
===================================================================
--- tmp/org.txm.progression.core/build.properties	(revision 0)
+++ tmp/org.txm.progression.core/build.properties	(revision 37)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Property changes on: tmp/org.txm.progression.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/plugin.xml
===================================================================
--- tmp/org.txm.progression.core/plugin.xml	(revision 0)
+++ tmp/org.txm.progression.core/plugin.xml	(revision 37)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.txm.chartsengine.chartcreator">
+      <ChartCreator
+            chartsEngineName="jfreechart_charts_engine"
+            class="org.txm.progression.core.chartsengine.jfreechart.themes.highcharts.JFCProgressionChartCreator"
+            fileNamePrefix="progression">
+      </ChartCreator>
+      <ChartCreator
+            chartsEngineName="r_charts_engine"
+            class="org.txm.progression.core.chartsengine.r.RProgressionChartCreator"
+            fileNamePrefix="progression">
+      </ChartCreator>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.progression.core.preferences.ProgressionPreferences">
+      </initializer>
+   </extension>
+
+</plugin>

Property changes on: tmp/org.txm.progression.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.progression.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.progression.core/.settings/org.eclipse.jdt.core.prefs	(revision 37)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Property changes on: tmp/org.txm.progression.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/.classpath
===================================================================
--- tmp/org.txm.progression.core/.classpath	(revision 0)
+++ tmp/org.txm.progression.core/.classpath	(revision 37)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tmp/org.txm.progression.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.progression.core/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.progression.core/META-INF/MANIFEST.MF	(revision 37)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Progression TBX
+Bundle-SymbolicName: org.txm.progression.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.txm.chartsengine.core,
+ org.txm.toolbox;bundle-version="0.7.0";visibility:=reexport,
+ org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
+ org.txm.chartsengine.r.core;bundle-version="1.0.0",
+ org.eclipse.core.runtime
+Export-Package: org.txm.progression.core.chartsengine.base,
+ org.txm.progression.core.chartsengine.jfreechart.themes.highcharts,
+ org.txm.progression.core.chartsengine.jfreechart.themes.highcharts.renderers,
+ org.txm.progression.core.chartsengine.r,
+ org.txm.progression.core.functions,
+ org.txm.progression.core.messages,
+ org.txm.progression.core.preferences
+Bundle-Vendor: TXM

Property changes on: tmp/org.txm.progression.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

