Revision 1548

tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1548)
1485 1485
		return false;
1486 1486
	}
1487 1487

  
1488
	
1488 1489
	/**
1490
	 * Checks if the result has at least one child visible.
1491
	 * @return true if the result has at least one child visible
1492
	 */
1493
	public boolean hasVisibleChild() {
1494
		return !this.getChildren(true).isEmpty();
1495
	}
1496
	
1497
	
1498
	/**
1489 1499
	 * Gets all the children results (not a clone).
1490 1500
	 * 
1491 1501
	 * @return
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ExportChartEditorView.java (revision 1548)
68 68

  
69 69
	public static final String ID = "org.txm.chartsengine.rcp.handlers.ExportChartEditorView"; //$NON-NLS-1$
70 70

  
71
	// FIXME: tests to disable command if the chart is null and reenable it when the chart is computed 
72
//	public boolean isEnabled() {
73
//		return false;
74
//	}
75
//	public void setEnabled(Object evaluationContext) {
76
//		System.out.println("ExportChartEditorView.setEnabled()");
77
//		//System.out.println("ExportChartEditorView.setEnabled(): " + evaluationContext);
78
//		this.setBaseEnabled(false);
79
//	}
80
	
81 71
	@Override
82 72
	public Object execute(ExecutionEvent event) throws ExecutionException {
83 73

  
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 1548)
932 932
	//	chartEditor.getComposite().addListener(SWT.Activate, listener); // TODO : test AWT delegation
933 933

  
934 934

  
935
		// FIXME: For Swing focus debug
936
		if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
937
			swingComponent.addFocusListener(new FocusListener() {
935
		swingComponent.addFocusListener(new FocusListener() {
936
			
937
			@Override
938
			public void focusLost(FocusEvent e) {
938 939
				
939
				@Override
940
				public void focusLost(FocusEvent e) {
941
					// TODO Auto-generated method stub
940
				// FIXME: For Swing focus debug
941
				if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
942 942
					swingComponent.setBorder(javax.swing.BorderFactory.createEmptyBorder());
943
					Display.getDefault().asyncExec(new Runnable() {
944
						
945
						@Override
946
						public void run() {
947
							// TODO Auto-generated method stub
948
							chartEditor.deactivateContext();						
949
						}
950
					});
951 943
				}
952 944
				
953
				@Override
954
				public void focusGained(FocusEvent e) {
945
				Display.getDefault().asyncExec(new Runnable() {
946
					
947
					@Override
948
					public void run() {
949
						// TODO Auto-generated method stub
950
						chartEditor.deactivateContext();						
951
					}
952
				});
953
			}
954
			
955
			@Override
956
			public void focusGained(FocusEvent e) {
957
				
958
				// FIXME: For Swing focus debug
959
				if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
955 960
					swingComponent.setBorder(new LineBorder(Color.red, 1));
961
				}
962
				
963
				Display.getDefault().asyncExec(new Runnable() {
956 964
					
957
					Display.getDefault().asyncExec(new Runnable() {
958
						
959
						@Override
960
						public void run() {
961
							// TODO Auto-generated method stub
962
							chartEditor.activateContext();						
963
						}
964
					});
965
				}
966
			});
967
		}
965
					@Override
966
					public void run() {
967
						// TODO Auto-generated method stub
968
						chartEditor.activateContext();						
969
					}
970
				});
971
			}
972
		});
968 973
		
969 974

  
970 975
		// FIXME: SWT tool tips test rather than using Swing
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 1548)
12 12
import org.eclipse.swt.layout.GridData;
13 13
import org.eclipse.swt.widgets.Composite;
14 14
import org.eclipse.swt.widgets.Group;
15
import org.eclipse.swt.widgets.ToolItem;
15 16
import org.eclipse.ui.PlatformUI;
16 17
import org.eclipse.ui.contexts.IContextActivation;
17 18
import org.eclipse.ui.contexts.IContextService;
......
46 47
	 */
47 48
	protected ChartEditorToolBar chartToolBar;
48 49

  
50
	/**
51
	 * Export chart editor view tool item button.
52
	 */
53
	protected ToolItem exportChartEditorViewButton;
54

  
55
	/**
56
	 * Copy chart view to clipboard tool item button.
57
	 */
58
	protected ToolItem copyChartViewToClipboardButton;
49 59
	
50 60
	/**
51 61
	 * The advanced tool bar.
......
119 129
		this.getFirstLineComposite().getLayout().numColumns += 1;
120 130
		//this.chartToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED));
121 131

  
132
		this.exportChartEditorViewButton = this.chartToolBar.getItemByContributionId("exportChartEditorView"); //$NON-NLS-1$
133
		this.copyChartViewToClipboardButton = this.chartToolBar.getItemByContributionId("copyChartViewToClipboard"); //$NON-NLS-1$
134
		
135
		
122 136
		// Advanced tool bar
123 137
		//this.advancedToolBarComposite = new Composite(parent, SWT.NONE);
124 138
		Group group = this.topToolBar.installGroup(SWTComponentsProviderMessages.rendering, SWTComponentsProviderMessages.showHideRenderingParameters, 
......
133 147
		//TODO MD: hack ?
134 148
		//this.resultArea.dispose();
135 149
		
136
		
137 150
		// Chart composite
138 151
		this.chartComposite = SWTChartsComponentsProvider.getComponentsProvider(this.getResult().getChartsEngine()).createComposite(this, this.getResultArea());
139 152
		
......
172 185
	}
173 186

  
174 187

  
188
	@Override
189
	public void setDirty(boolean dirty) {
190
		super.setDirty(dirty);
191
		
192
		// enable/disable the buttons according to the computed state of the chart
193
		this.exportChartEditorViewButton.setEnabled(this.getResult().hasBeenComputedOnce());
194
		this.copyChartViewToClipboardButton.setEnabled(this.getResult().hasBeenComputedOnce());
195
		
196
	}
197
	
175 198
	/**
176 199
	 * Initializes the default context menus.
177 200
	 */
......
515 538
	 * Copy the current chart view to clipboard.
516 539
	 */
517 540
	public void copyChartViewToClipboard()	{
518
		this.chartComposite.copyChartViewToClipboard();
541
		try {
542
			this.chartComposite.copyChartViewToClipboard();
543
		}
544
		catch (Exception e) {
545
			Log.finest("ChartEditor.copyChartViewToClipboard(): nothing done, the chart has not yet been computed."); //$NON-NLS-1$
546
		}
519 547
	}
520 548

  
521 549
	/**
tmp/org.txm.chartsengine.rcp/plugin.xml (revision 1548)
50 50
         <command
51 51
               commandId="ExportChartEditorView"
52 52
               icon="icons/export_view.png"
53
               id="exportChartEditorView"
53 54
               style="push">
54 55
         </command>
55 56
         <command
56 57
               commandId="CopyChartViewToClipboard"
57 58
               icon="icons/copy_view.gif"
59
               id="copyChartViewToClipboard"
58 60
               style="push">
59 61
         </command>
60 62
         <separator
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 1548)
4 4
import org.osgi.service.prefs.Preferences;
5 5
import org.txm.chartsengine.core.ChartsEngine;
6 6
import org.txm.core.preferences.TXMPreferences;
7
import org.txm.utils.OSDetector;
7 8

  
8 9
/**
9 10
 * Preferences initializer and manager.
......
69 70
	public final static String CHART_TYPE = "chart_type"; //$NON-NLS-1$
70 71
	
71 72
	
72
	/**
73
	 * Default font string representation.
74
	 */
75
	public final static String DEFAULT_FONT = "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$
76
	
77
	//public final static String DEFAULT_FONT = "1|Lucida Sans|11|0;"; //$NON-NLS-1$
78
	
79
	//public final static String DEFAULT_FONT = "1|Tahoma|8.25|0|WINDOWS|1|-11|0|0|0|400|0|0|0|1|0|0|0|0|Tahoma;"; //$NON-NLS-1$
80
	// TODO: version Linux : 1|Lucida Sans|11.0|0|GTK|1|
81
	
82
	
83 73
	public final static String DEFAULT_CHART_TYPE = "[Default]"; //$NON-NLS-1$
84 74
	
85 75

  
......
119 109
		preferences.put(MONOCHROME_COLOR, "0,220,20"); //$NON-NLS-1$
120 110
		preferences.putBoolean(MULTIPLE_LINE_STROKES, false);
121 111
		
122
		// FIXME: maybe need to check here the target OS and set a default Unicode installed font
123
		preferences.put(FONT, DEFAULT_FONT);
112
		// Check the target OS and set the default font from the JVM embedded font
113
		String defaultFont; 
114
		if(OSDetector.isFamilyUnix())	{
115
			defaultFont = "1|Lucida Sans|11.0|0|GTK|1|"; //$NON-NLS-1$ other version: "1|Lucida Sans|11|0"
116
		}
117
		else	{
118
			defaultFont = "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$
119
		}
120
		
121
		preferences.put(FONT, defaultFont);
124 122
	}
125 123
}
126 124

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1548)
161 161
	/**
162 162
	 * To keep track of the parameters used for the last computing and updates only the widgets if a parameter has changed. 
163 163
	 */
164
	// FIXME: SJ: useless?
164 165
	//protected HashMap<String, Object> lastComputingParameters = new HashMap<String, Object>();
165 166

  
166 167
	/**
......
824 825
							if(update)	{
825 826

  
826 827
								// popup alert to inform user that the result has been manually edited
827
								if (TXMEditor.this.getResult().isAltered() && !MessageDialog.openQuestion(getShell(), "Warning", TXMCoreMessages.bind("The {0} has been edited. Its changes will be lost. Do you want to continue?", TXMEditor.this.getResult().getResultype()))) {
828
								if (TXMEditor.this.getResult().isAltered()
829
									&& !MessageDialog.openQuestion(getShell(), "Warning", TXMCoreMessages.bind("The {0} has been edited. Its changes will be lost. Do you want to continue?", TXMEditor.this.getResult().getResultype()))) {
828 830
										setCanceled(true);
829 831
								}
830 832
								else	{
831 833

  
832 834
									// FIXME: SJ: this code doesn't work well, commented because a rendering parameter change in CA display the popup because of the Eigenvalues children
835
									// FIXME: SJ: to fix that, temporarily or not, I had finally this test on the visibility state of the children. Actually this test may be useful for any result type
833 836
									// popup alert to inform user that children results will be recomputed
834
//									if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)
835
//											&& TXMEditor.this.getResult().hasChildren() && !MessageDialog.openQuestion(getShell(), "Warning", "All descendant results will be updated. Do you want to continue?"))	{
836
//										setCanceled(true);
837
//									}
837
									if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)
838
											&& TXMEditor.this.getResult().hasVisibleChild() && !MessageDialog.openQuestion(getShell(), "Warning", "All descendant results will be updated. Do you want to continue?"))	{
839
										setCanceled(true);
840
									}
838 841
									
839 842

  
840 843
									
......
1269 1272
			try {
1270 1273
				f.setAccessible(true);
1271 1274
				Object object = f.get(this);
1272
//				if (object == null) {
1273
//					continue; // widget not set
1274
//				}
1275
				if (object == null) {
1276
					continue; // widget not set
1277
				}
1275 1278
				Object value = null;
1276 1279
				if(object instanceof ToolItem)	{
1277 1280
					value = ((ToolItem)object).getSelection(); 
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 1548)
539 539
			}
540 540

  
541 541
			XminCorpus = matches.get(0).getStart();
542
			XmaxCorpus = matches.get(matches.size()-1).getEnd();		
542
			XmaxCorpus = matches.get(matches.size()-1).getEnd();
543 543
		}
544 544
		else {
545 545
			XminCorpus = 0;
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/Eigenvalues.java (revision 1548)
41 41
	}
42 42

  
43 43
	/**
44
	 * Convenience method to get the eigenvalues CA
44
	 * Convenience method to get the eigenvalues casted CA
45 45
	 * 
46 46
	 * @return the eigenvalues CA
47 47
	 */

Also available in: Unified diff