Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SimpleSelection.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SimpleSelection.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SimpleSelection.java	(revision 3713)
@@ -0,0 +1,65 @@
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.objects.Match;
+
+public class SimpleSelection<T extends Match> extends Selection {
+	
+	ArrayList<T> matches;
+	IQuery query;
+	
+	public SimpleSelection(IQuery q, ArrayList<T> matcheList) {
+		query = q;
+		matches= matcheList;
+	}
+
+	@Override
+	public List<T> getMatches() throws Exception {
+		return matches;
+	}
+
+	@Override
+	public List<T> getMatches(int from, int to) throws Exception {
+		if (to > matches.size()) to = matches.size();
+		return matches.subList(from, to + 1); // +1 because Match.getMatches is start-end inclusive and List.subList is start inclusif and end exclusif
+	}
+
+	@Override
+	public int getNMatch() throws Exception {
+		return matches.size();
+	}
+
+	@Override
+	public IQuery getQuery() {
+		return query;
+	}
+
+	@Override
+	public boolean isTargetUsed() throws Exception {
+		return false;
+	}
+
+	@Override
+	public void drop() throws Exception {
+		// TODO Auto-generated method stub
+	}
+
+	@Override
+	public boolean delete(int iMatch) {
+		if (iMatch < 0) return false;
+		if (iMatch >= matches.size()) return false;
+		return matches.remove(iMatch) != null;
+	}
+
+	@Override
+	public boolean delete(Match match) {
+		return matches.remove(match);
+	}
+
+	@Override
+	public boolean delete(ArrayList<Match> matchesToRemove) {
+		return matches.removeAll(matchesToRemove);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SimpleSelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java
===================================================================
--- TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java	(revision 3713)
@@ -5,6 +5,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
@@ -14,6 +15,7 @@
 import org.txm.core.results.TXMParameters;
 import org.txm.libs.deptreeviz.UDDepTreeVizPrintTree;
 import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.core.SimpleSelection;
 import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.CQPCorpus;
@@ -34,8 +36,13 @@
 	
 	Subcorpus udSentences;
 
-	private QueryResult matches;
+	private QueryResult rawMatches;
 	
+	private LinkedHashMap<org.txm.objects.Match, List<Integer>> matchingSentencesToMatches;
+	private ArrayList<org.txm.objects.Match> matchingSentencesKeys;
+
+	private int nTotalMatches;
+	
 	public UDTreeSearch(CQPCorpus corpus) {
 		this(null, corpus);
 	}
@@ -53,15 +60,15 @@
 	}
 	
 	public boolean isComputed() {
-		return matches != null;
+		return matchingSentencesToMatches != null;
 	}
 	
 	public boolean isDrawn() {
-		return matches != null;
+		return matchingSentencesToMatches != null;
 	}
 	
 	public Selection getSelection() {
-		return matches;
+		return new SimpleSelection<org.txm.objects.Match>(pQuery, matchingSentencesKeys);
 	}
 	
 	@Override
@@ -69,27 +76,13 @@
 		
 		if (!isDrawn()) return false; // no result
 		try {
-			//File file = File.createTempFile("txm", ".svg", new File(Toolbox.getTxmHomePath(), "results"));
+
+			org.txm.objects.Match matchingSentence = this.matchingSentencesKeys.get(sent);
+			Match submatch = rawMatches.getMatch(this.matchingSentencesToMatches.get(matchingSentence).get(sub)); // use the set highlight in the Graph
 			
-			//String engine = UDTreePreferences.getInstance().getString(UDTreePreferences.ENGINE);
+			int[] positions = new int[matchingSentence.size()];
+			for (int i = 0 ; i < matchingSentence.size() ; i++) positions[i] = matchingSentence.getStart()+i;
 			
-			Match match = this.matches.getMatches().get(sent);
-			org.txm.objects.Match sentence = null;
-			for (org.txm.objects.Match s : udSentences.getMatches()) {
-				if (s.getStart() <= match.getStart() && match.getEnd() <= s.getEnd()) {
-					sentence = s;
-					break;
-				}
-			}
-			
-			if (sentence == null) {
-				Log.warning("Error: match positions not found in sentences positions");
-				return false;
-			}
-			
-			int[] positions = new int[sentence.size()];
-			for (int i = 0 ; i < sentence.size() ; i++) positions[i] = sentence.getStart()+i;
-			
 			String prefix = UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX));
 			
 			String[] Tvalues = new String[positions.length];
@@ -140,10 +133,17 @@
 			ArrayList<String> conll = new ArrayList<String>();
 			
 			for (int p = 0 ; p < positions.length ; p++) {
+				
+				boolean startOfSubMatch = submatch.getStart() == positions[p];
+				boolean endOfSubMatch = submatch.getEnd() == positions[p];
+				
 				StringBuilder buffer = new StringBuilder();
 				for (String prop : ImportCoNLLUAnnotations.UD_PROPERTY_NAMES) {
+					
 					if (buffer.length() > 0) buffer.append("\t");
+					if (prop.equals("form") && startOfSubMatch) buffer.append("[");
 					buffer.append(values.get(prefix+prop)[p]);
+					if (prop.equals("form") && endOfSubMatch) buffer.append("]");
 				}
 				
 				conll.add(buffer.toString());
@@ -215,27 +215,27 @@
 		return ready;
 	}
 	
-	public int getNSentences() {
-		if (matches == null) return 0;
+	public int getNMatchingSentences() {
 		
-			try {
-				return matches.getMatches().size();
-			}
-			catch (CqiClientException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				return 0;
-			}//getNMatch();
+		if (matchingSentencesToMatches == null) return 0;
+		
+		return matchingSentencesToMatches.size();
 	}
 	
-	public int getNSubGraph(int matchNo) {
+	public int getNSubMatch() {
 		
-		return 1;
+		if (matchingSentencesKeys == null) return 0;
+		
+		org.txm.objects.Match currentSent = matchingSentencesKeys.get(pIndex);
+		
+		List<Integer> submatches = matchingSentencesToMatches.get(currentSent);
+		
+		return submatches.size();
 	}
 	
-	public int getSub(int matchNo) {
+	public int getSub(int matchingSent) {
 		
-		return 1;
+		return pSubIndex;//matchingSentencesToMatches.get(matchingSentencesKeys.get(matchingSent)).size();
 	}
 	
 	/**
@@ -307,16 +307,50 @@
 		
 		String prefix = UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX));
 		
-		
 		if (pQuery == null || pQuery.getQueryString().length() == 0) {
-			pQuery = new CQLQuery("["+prefix+"deprel=\"root\"]"); // [ud-deprel="root"]
+			pQuery = new CQLQuery("["+prefix+"id=\"1\"]"); // MD or use [ud-deprel="root"] ? but don't work if the corpus is not parsed
 		}
 		
 		udSentences = UDSearchEngine.getSentenceSubcorpus(corpus, prefix);
-
-		matches = udSentences.query((CQLQuery)pQuery, "matches", false);
+		rawMatches = udSentences.query((CQLQuery)pQuery, "matches", false);
+		nTotalMatches = 0; // counted below
 		
-		return matches.getNMatch() > 0;
+		matchingSentencesToMatches = new LinkedHashMap<org.txm.objects.Match, List<Integer>>();;
+		int nSent = udSentences.getSize();
+		int imatch = 0;
+		int nMatch = rawMatches.getNMatch();
+		List<? extends org.txm.objects.Match> sentMatches = udSentences.getMatches();
+		for (int iSent = 0 ; iSent < nSent ; iSent++) {
+			if (imatch >= nMatch) { // all matches processed
+				break;
+			}
+			org.txm.objects.Match sentMatch = sentMatches.get(iSent);
+			for (; imatch < nMatch ; imatch++) {
+				Match currentMatch = rawMatches.getMatch(imatch);
+				if (currentMatch.getStart() > sentMatch.getEnd()) { // the match is after the sentence, process the next sentence
+					break;
+				} else if (sentMatch.getStart() > currentMatch.getEnd()) { // the sentence is after the match -> should not happen
+					Log.warning("Warning: should not happen: the sentence is after the match: iSent="+iSent+" "+sentMatch+" imatch="+imatch+" "+currentMatch);
+				} else {
+					if (!matchingSentencesToMatches.containsKey(sentMatch)) {
+						matchingSentencesToMatches.put(sentMatch, new ArrayList<Integer>());
+					}
+					matchingSentencesToMatches.get(sentMatch).add(imatch);
+					nTotalMatches++;
+				}
+			}
+		}
+		
+		if (imatch < nMatch) {
+			Log.warning("Warning: should not happen: the matches should all be in the 'ud-s' subcorpus");
+		}
+		
+		matchingSentencesKeys = new ArrayList<org.txm.objects.Match>(matchingSentencesToMatches.keySet());
+		
+		pIndex = 0;
+		pSubIndex = 0;
+		
+		return true;
 	}
 	
 	@Override
@@ -332,7 +366,7 @@
 	@Override
 	public boolean hasSubMatchesStrategy() {
 		
-		return false;
+		return true;
 	}
 	
 	public static boolean hasUDProperties(CQPCorpus corpus) {
@@ -418,4 +452,9 @@
 		
 		return new String[] {UDTreePreferences.DEPTREEVIZ, UDTreePreferences.BRAT};
 	}
+
+	@Override
+	public int getTotalSubMatch() {
+		return nTotalMatches;
+	}
 }
Index: TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java	(revision 3713)
@@ -120,7 +120,7 @@
 	public static Subcorpus getSentenceSubcorpus(CQPCorpus corpus, String prefix) throws CqiClientException, InterruptedException {
 		
 		Subcorpus udSentences = corpus.getSubcorpusByName(corpus.getName()+TXMPreferences.PARENT_NAME_SEPARATOR+"ud-s");
-		if (udSentences != null) udSentences.compute();
+		if (udSentences != null) udSentences.compute(false);
 		
 		CQLQuery sentencesQuery = new CQLQuery("["+prefix+"id=\"1\"] ["+prefix+"id !=\"1\"]+ [:"+prefix+"id=\"1|__UNDEF__\":]");
 		if (udSentences == null) { // no ud-s subcorpus, create it
Index: TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/search/URSSelection.java
===================================================================
--- TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/search/URSSelection.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/search/URSSelection.java	(revision 3713)
@@ -1,67 +1,14 @@
 package org.txm.annotation.urs.search;
 
 import java.util.ArrayList;
-import java.util.List;
 
-import org.txm.objects.Match;
 import org.txm.searchengine.core.IQuery;
-import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.core.SimpleSelection;
 
-public class URSSelection extends Selection {
+public class URSSelection extends SimpleSelection<URSMatch> {
 
-	ArrayList<URSMatch> matches;
-	IQuery query;
-	
 	public URSSelection(IQuery query, ArrayList<URSMatch> matches2) {
-		this.query = query;
-		matches = matches2;
+		super(query, matches2);
 	}
-	
-	@Override
-	public List<? extends Match> getMatches() throws Exception {
-		return matches;
-	}
 
-	@Override
-	public List<? extends Match> getMatches(int from, int to) throws Exception {
-		if (to > matches.size()) to = matches.size();
-		return matches.subList(from, to + 1); // +1 because Match.getMatches is start-end inclusive and List.subList is start inclusif and end exclusif
-	}
-
-	@Override
-	public int getNMatch() throws Exception {
-		return matches.size();
-	}
-
-	@Override
-	public IQuery getQuery() {
-		return query;
-	}
-
-	@Override
-	public boolean isTargetUsed() throws Exception {
-		return false;
-	}
-
-	@Override
-	public void drop() throws Exception {
-		// TODO Auto-generated method stub
-	}
-
-	@Override
-	public boolean delete(int iMatch) {
-		if (iMatch < 0) return false;
-		if (iMatch >= matches.size()) return false;
-		return matches.remove(iMatch) != null;
-	}
-
-	@Override
-	public boolean delete(Match match) {
-		return matches.remove(match);
-	}
-
-	@Override
-	public boolean delete(ArrayList<Match> matchesToRemove) {
-		return matches.removeAll(matchesToRemove);
-	}
 }
Index: TXM/trunk/bundles/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java
===================================================================
--- TXM/trunk/bundles/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java	(revision 3713)
@@ -92,10 +92,12 @@
 		return "no query";
 	}
 	
-	public abstract int getNSentences();
+	public abstract int getNMatchingSentences();
 	
-	public abstract int getNSubGraph(int matchNo);
+	public abstract int getNSubMatch();
 	
+	public abstract int getTotalSubMatch();
+	
 	public final List<String> getNT() {
 		return NT;
 	}
@@ -115,8 +117,6 @@
 		return NLS.bind("Rendering {0} Syntactic Tree...", this.getSelector().getEngine());
 	}
 	
-	public abstract int getSub(int matchNo);
-	
 	public final List<String> getT() {
 		return T;
 	}
Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/NewNavigationWidget.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/NewNavigationWidget.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/NewNavigationWidget.java	(revision 3713)
@@ -239,7 +239,6 @@
 		prev.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
 		next.setImage(IImageKeys.getImage(IImageKeys.CTRLPLAY));
 		last.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
-		
 	}
 	
 	/**
@@ -250,7 +249,6 @@
 		this(parent, SWT.NONE);
 	}
 	
-	
 	public void addGoToKeyListener(KeyListener keyListener) {
 		currentPositionText.addKeyListener(keyListener);
 		currentPositionText.setEditable(true);
@@ -258,6 +256,14 @@
 		// currentPosition.setBackground(new Color(currentPosition.get));
 	}
 	
+	public int getShift() {
+		return shift;
+	}
+	
+	public void setShift(int shift) {
+		this.shift = shift;
+	}
+	
 	/**
 	 * Adds the first listener.
 	 *
@@ -330,8 +336,6 @@
 		prev.setEnabled(b);
 	}
 	
-	
-	
 	protected int getCurrentPositionFromTextField() {
 		int ret = -1;
 		try {
@@ -344,8 +348,6 @@
 		return ret;
 	}
 	
-	
-	
 	/**
 	 * @return the minPosition
 	 */
@@ -353,7 +355,6 @@
 		return minPosition;
 	}
 	
-	
 	/**
 	 * @param minPosition the minPosition to set
 	 */
@@ -361,6 +362,12 @@
 		this.minPosition = minPosition;
 	}
 	
+	/**
+	 * @param maxPosition the maxPosition to set
+	 */
+	public void setMinimum(int minPosition) {
+		this.minPosition = minPosition;
+	}
 	
 	/**
 	 * @return the maxPosition
@@ -369,7 +376,6 @@
 		return maxPosition;
 	}
 	
-	
 	/**
 	 * @param maxPosition the maxPosition to set
 	 */
@@ -378,6 +384,13 @@
 	}
 	
 	/**
+	 * @param maxPosition the maxPosition to set
+	 */
+	public void setMaximum(int maxPosition) {
+		this.maxPosition = maxPosition;
+	}
+	
+	/**
 	 * Refreshes the widgets.
 	 */
 	public void refresh() {
@@ -412,7 +425,6 @@
 		this.infoLine.setText(s);
 	}
 	
-	
 	/**
 	 * @param currentPosition the currentPosition to set
 	 */
@@ -423,7 +435,15 @@
 		this.currentPosition = newPosition + this.shift;
 	}
 	
+	/**
+	 * To be compatible with the swtCombo.getSelection() method
+	 * @return
+	 */
+	public void setSelection(int newPosition) {
+		setCurrentPosition(newPosition);
+	}
 	
+	
 	/**
 	 * @return the currentPosition
 	 */
@@ -431,6 +451,13 @@
 		return this.currentPosition - this.shift;
 	}
 	
+	/**
+	 * To be compatible with the swtCombo.getSelection() method
+	 * @return
+	 */
+	public int getSelection() {
+		return getCurrentPosition();
+	}
 	
 	/**
 	 * @return the currentPositionText
Index: TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java
===================================================================
--- TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java	(revision 3713)
@@ -44,6 +44,8 @@
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.GLComposite;
 import org.txm.rcp.swt.widget.LargeQueryField;
+import org.txm.rcp.swt.widget.NavigationWidget;
+import org.txm.rcp.swt.widget.NewNavigationWidget;
 import org.txm.rcp.utils.SWTEditorsUtils;
 import org.txm.rcp.views.QueriesView;
 import org.txm.rcp.views.corpora.CorporaView;
@@ -72,10 +74,10 @@
 	Browser svgPanel;
 	
 	@Parameter(key = TXMPreferences.INDEX)
-	Spinner sentSpinner;
+	NewNavigationWidget sentSpinner;
 	
 	@Parameter(key = TXMPreferences.SUB_INDEX)
-	Spinner subSpinner;
+	NewNavigationWidget subSpinner;
 	
 	Button okButton;
 	
@@ -86,10 +88,10 @@
 	@Parameter(key = TXMPreferences.QUERY)
 	private LargeQueryField queryArea;
 	
-	private Label subCounterLabel;
+//	private Label subCounterLabel;
+//	
+//	private Label sentCounterLabel;
 	
-	private Label sentCounterLabel;
-	
 	@Parameter(key = TreeSearchPreferences.NTFEATURE)
 	private org.eclipse.swt.widgets.List NTCombo;
 	
@@ -142,18 +144,19 @@
 					
 					queryArea.setQueryClass(currentSelector.getQueryClass());
 					initializeFields();
+					
 					getEditorInput().setResult(tsPerRepresentation.get(currentSelector.getEngine()));
 					representationLabel.setImage(IImageKeys.getImage(tsPerRepresentation.get(currentSelector.getEngine()).getIconPath()));
 					
 					// if (e.widget == sentSpinner && tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) {
-					
-					subSpinner.setSelection(1);
-					subSpinner.setMaximum(tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1));
-					subCounterLabel.setText("/" + tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1)); //$NON-NLS-1$
-					// }
+					//subSpinner.setSelection(0);
 				}
 				
 				
+				//subSpinner.setMaximum(tsPerRepresentation.get(currentSelector.getEngine()).getNSubMatch());
+//				subCounterLabel.setText("/" + tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection())); //$NON-NLS-1$
+				// }
+				
 				TreeSearchEditor.this.compute(true);
 				// reloadGraph();
 			}
@@ -256,15 +259,23 @@
 					queryAreaLayoutData.minimumHeight = 0;
 					queryAreaLayoutData.grabExcessVerticalSpace = false;
 					queryAreaLayoutData.grabExcessHorizontalSpace = false;
+					queryAreaLayoutData.minimumWidth = 0;
 				} else {
 					search.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE));
 					queryArea.setVisible(true);
 					queryAreaLabel.setVisible(true);
-					queryAreaLayoutData.heightHint = 80;
-					queryAreaLayoutData.minimumHeight = 80;
 					queryAreaLayoutData.grabExcessVerticalSpace = true;
 					queryAreaLayoutData.grabExcessHorizontalSpace = true;
+					if (currentSelector.getEngine().equals("UD")) {
+						queryAreaLayoutData.minimumHeight = 0;
+						queryAreaLayoutData.heightHint = 00;
+					} else {
+						queryAreaLayoutData.minimumHeight = 80;
+						queryAreaLayoutData.heightHint = 80;
+					}
+					queryAreaLayoutData.minimumWidth = 150;
 				}
+				queryArea.layout();
 				navigationAreaComposite.getParent().getParent().layout();
 			}
 			
@@ -279,8 +290,7 @@
 		queryArea = new LargeQueryField(navigationAreaComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, currentSelector.getQueryClass());
 		GridData queryAreaLayoutData = new GridData(GridData.FILL, GridData.FILL, true, true);
 		queryAreaLayoutData.horizontalSpan = 2;
-		queryAreaLayoutData.heightHint = 80;
-		queryAreaLayoutData.minimumHeight = 80;
+		
 		queryArea.setLayoutData(queryAreaLayoutData);
 		queryArea.setVisible(false);
 		
@@ -301,52 +311,55 @@
 		search.setImage(IImageKeys.getImage(IImageKeys.ACTION_SEARCH));
 		queryArea.setVisible(false);
 		queryAreaLabel.setVisible(false);
-		queryAreaLayoutData.heightHint = 0;
-		queryAreaLayoutData.minimumHeight = 0;
-		queryAreaLayoutData.grabExcessVerticalSpace = false;
-		queryAreaLayoutData.grabExcessHorizontalSpace = false;
 		
 		// fill param Area
 		Label l3 = new Label(navigationAreaComposite, SWT.NONE);
-		l3.setText("Match "); //$NON-NLS-1$
+		l3.setText("Sentence "); //$NON-NLS-1$
 		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
 		l3.setLayoutData(gdata);
 		
-		sentSpinner = new Spinner(navigationAreaComposite, SWT.BORDER);
+		sentSpinner = new NewNavigationWidget(navigationAreaComposite, SWT.NONE);
 		sentSpinner.setMinimum(1);
-		sentSpinner.setIncrement(1);
 		sentSpinner.setMaximum(10000000);
-		sentSpinner.setSelection(1);
+		sentSpinner.setSelection(0);
+		sentSpinner.refresh();
 		
 		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
 		sentSpinner.setLayoutData(gdata);
-		sentSpinner.addSelectionListener(selChangedListener);
+		sentSpinner.addFirstListener(selChangedListener);
+		sentSpinner.addPreviousListener(selChangedListener);
+		sentSpinner.addNextListener(selChangedListener);
+		sentSpinner.addLastListener(selChangedListener);
 		
-		sentCounterLabel = new Label(navigationAreaComposite, SWT.NONE);
-		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
-		gdata.minimumWidth = 100;
-		sentCounterLabel.setLayoutData(gdata);
 		
+//		sentCounterLabel = new Label(navigationAreaComposite, SWT.NONE);
+//		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
+//		gdata.minimumWidth = 100;
+//		sentCounterLabel.setLayoutData(gdata);
+		
 		new Label(navigationAreaComposite, SWT.NONE);
 		
 		// if (tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) {
 		Label l4 = new Label(navigationAreaComposite, SWT.NONE);
-		l4.setText("Sub-Match "); //$NON-NLS-1$
+		l4.setText("Match "); //$NON-NLS-1$
 		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
 		l4.setLayoutData(gdata);
 		
-		subSpinner = new Spinner(navigationAreaComposite, SWT.BORDER);
+		subSpinner = new NewNavigationWidget(navigationAreaComposite, SWT.NONE);
 		subSpinner.setMinimum(1);
-		subSpinner.setIncrement(1);
 		subSpinner.setMaximum(100000000);
-		subSpinner.setSelection(1);
+		subSpinner.setSelection(0);
 		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
 		subSpinner.setLayoutData(gdata);
-		subSpinner.addSelectionListener(selChangedListener);
+		subSpinner.addFirstListener(selChangedListener);
+		subSpinner.addPreviousListener(selChangedListener);
+		subSpinner.addNextListener(selChangedListener);
+		subSpinner.addLastListener(selChangedListener);
+		subSpinner.refresh();
 		
-		subCounterLabel = new Label(navigationAreaComposite, SWT.NONE);
-		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
-		subCounterLabel.setLayoutData(gdata);
+//		subCounterLabel = new Label(navigationAreaComposite, SWT.NONE);
+//		gdata = new GridData(SWT.FILL, SWT.CENTER, false, false);
+//		subCounterLabel.setLayoutData(gdata);
 		// }
 		
 		Composite mainPanel = this.getResultArea();
@@ -489,22 +502,23 @@
 		
 		if (ts.isComputed()) {
 			queryArea.setText(ts.getQuery());
-			sentCounterLabel.setText("/" + ts.getNSentences()); //$NON-NLS-1$
-			if (ts.getNSentences() > 0) {
-				subCounterLabel.setText("/" + ts.getNSubGraph(0)); //$NON-NLS-1$
-			}
+			
+//			sentCounterLabel.setText("/" + ts.getNSentences()); //$NON-NLS-1$
+//			if (ts.getNSentences() > 0) {
+//				subCounterLabel.setText("/" + ts.getNSubGraph(0)); //$NON-NLS-1$
+//			}
 		}
 		else {
-			sentCounterLabel.setText(Messages.NoSentence);
-			if (ts.hasSubMatchesStrategy()) subCounterLabel.setText(Messages.NoSubGraph);
+//			sentCounterLabel.setText(Messages.NoSentence);
+//			if (ts.hasSubMatchesStrategy()) subCounterLabel.setText(Messages.NoSubGraph);
 		}
 		
 		if (!ts.isDrawn()) {
-			sentSpinner.setSelection(ts.getCurrentMatchIndex() + 1);
-			sentSpinner.setMaximum(ts.getNSentences());
+			sentSpinner.setSelection(ts.getCurrentMatchIndex());
+			sentSpinner.setMaximum(ts.getNMatchingSentences());
 			// if (ts.hasSubMatchesStrategy()) {
-			subSpinner.setSelection(ts.getSub(0));
-			subSpinner.setMaximum(ts.getNSubGraph(0));
+			subSpinner.setSelection(ts.getCurrentSubMatchIndex());
+			subSpinner.setMaximum(ts.getNSubMatch());
 			// }
 			
 			try {
@@ -516,11 +530,11 @@
 			}
 		}
 		else {
-			sentSpinner.setSelection(1);
-			if (ts.hasSubMatchesStrategy()) subSpinner.setSelection(1);
+			sentSpinner.setSelection(0);
+			if (ts.hasSubMatchesStrategy()) subSpinner.setSelection(0);
 			if (ts.isComputed()) {
-				sentSpinner.setMaximum(ts.getNSentences());
-				if (ts.hasSubMatchesStrategy()) subSpinner.setMaximum(ts.getNSubGraph(0));
+				sentSpinner.setMaximum(ts.getNMatchingSentences());
+				if (ts.hasSubMatchesStrategy()) subSpinner.setMaximum(ts.getNSubMatch());
 			}
 			else {
 				sentSpinner.setMaximum(1);
@@ -533,7 +547,7 @@
 		// return;
 		// }
 		
-		sentCounterLabel.getParent().layout();
+//		sentCounterLabel.getParent().layout();
 		getMainParametersComposite().getParent().layout();
 		
 	}
@@ -575,17 +589,25 @@
 		// protected IStatus run(IProgressMonitor monitor) {
 		try {
 			TreeSearch ts = tsPerRepresentation.get(currentSelector.getEngine());
-			if (ts.getNSentences() > 0) {
+			if (ts.getNMatchingSentences() > 0) {
 				
-				sentCounterLabel.setText("/" + ts.getNSentences()); //$NON-NLS-1$
-				if (ts.hasSubMatchesStrategy()) subCounterLabel.setText("/" + ts.getNSubGraph(0)); //$NON-NLS-1$
+//				sentCounterLabel.setText("/" + ts.getNSentences()); //$NON-NLS-1$
+//				if (ts.hasSubMatchesStrategy()) subCounterLabel.setText("/" + ts.getNSubGraph(0)); //$NON-NLS-1$
+				sentSpinner.setEnabled(true);
+				subSpinner.setEnabled(true);
 				sentSpinner.setSelection(ts.getCurrentMatchIndex());
-				sentSpinner.setMaximum(ts.getNSentences());
-				
+				sentSpinner.setMaximum(ts.getNMatchingSentences());
+				sentSpinner.refresh();
 				subSpinner.setSelection(ts.getCurrentSubMatchIndex());
-				subSpinner.setMaximum(ts.getNSubGraph(0));
-				
+				subSpinner.setMaximum(ts.getNSubMatch());
+				subSpinner.refresh();
 				reloadGraph();
+				Log.warning(""+ts.getNMatchingSentences()+" matching sentence(s) for "+ts.getTotalSubMatch()+" matches.");
+			} else {
+				Log.warning("No matching sentence.");
+				svgPanel.setText("");
+				sentSpinner.setEnabled(false);
+				subSpinner.setEnabled(false);
 			}
 			
 			CorporaView.refresh();
@@ -616,12 +638,12 @@
 //		}
 		List<String> T = Arrays.asList(TCombo.getSelection());
 		List<String> NT = Arrays.asList(NTCombo.getSelection());
-		int sent = sentSpinner.getSelection() - 1;
+		int sent = sentSpinner.getSelection();
 		int sub = 0;
 		
 		TreeSearch ts = tsPerRepresentation.get(currentSelector.getEngine());
 		
-		if (ts.hasSubMatchesStrategy()) sub = subSpinner.getSelection() - 1;
+		if (ts.hasSubMatchesStrategy()) sub = subSpinner.getSelection();
 		
 		ts.setIndexAndSubIndex(sent, sub);
 		
Index: TXM/trunk/bundles/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java
===================================================================
--- TXM/trunk/bundles/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java	(revision 3712)
+++ TXM/trunk/bundles/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java	(revision 3713)
@@ -150,30 +150,30 @@
 		return ready;
 	}
 	
-	public int getNSentences() {
+	public int getNMatchingSentences() {
 		if (tsresult == null) return 0;
 		return tsresult.getNumberOfMatch();
 	}
 	
-	public int getNSubGraph(int matchNo) {
+	public int getNSubMatch() {
 		if (tsresult == null) return 0;
-		if (tsresult.getMatch(matchNo) == null) return 0;
+		if (tsresult.getMatch(pIndex) == null) return 0;
 		
-		return tsresult.getMatch(matchNo).getNumberOfSubGraph();
+		return tsresult.getMatch(pIndex).getNumberOfSubGraph();
 	}
 	
-	// public int getSent() {
-	// if (tsresult == null) return 0;
-	// return tsresult.getCurrentMatchNo();
-	// }
+//	// public int getSent() {
+//	// if (tsresult == null) return 0;
+//	// return tsresult.getCurrentMatchNo();
+//	// }
+//	
+//	public int getSub(int matchNo) {
+//		if (tsresult == null) return 0;
+//		if (tsresult.getMatch(matchNo) == null) return 0;
+//		
+//		return tsresult.getMatch(matchNo).getCurrentSubMatchNo();
+//	}
 	
-	public int getSub(int matchNo) {
-		if (tsresult == null) return 0;
-		if (tsresult.getMatch(matchNo) == null) return 0;
-		
-		return tsresult.getMatch(matchNo).getCurrentSubMatchNo();
-	}
-	
 	/**
 	 * @return the query or the generic one
 	 */
@@ -256,6 +256,9 @@
 			
 			tsresult = tscorpus.query(pQuery.getQueryString());
 			tsresult.getFirst();
+			
+			pIndex = 0;
+			pSubIndex = 0;
 //		} else {
 //			
 //		}
@@ -373,7 +376,11 @@
 	@Override
 	public String[] getAvailableVisualisations() {
 		
-		// TODO Auto-generated method stub
-		return null;
+		return null; // only one visualisation
 	}
+
+	@Override
+	public int getTotalSubMatch() {
+		return tsresult.getForest().getSubMatchesSum();
+	}
 }
