Révision 652

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ExportChart.java (revision 652)
98 98
		// Select default chart export file format
99 99
		dialog.setFilterIndex(defaultChartFormatIndex);
100 100

  
101
		// FIXME: how to define a default name here from Object s ? We may need to add a getName() method in TXMResult and check that every results in TXM.
102
		// It could be useful for other purposes too
103
//		dialog.setFileName(ChartsEngine.cleanFileName(chartEditorPart.getPartName()));
104 101
		dialog.setOverwrite(true);
105 102

  
106 103
		if (LastOpened.getFile(ID) != null) {
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ExportChartEditorView.java (revision 652)
83 83
	@Override
84 84
	public Object execute(ExecutionEvent event) throws ExecutionException {
85 85

  
86
		final ChartEditor chartEditorPart = SWTChartsComponentsProvider.getActiveChartEditor(event);
86
		final ChartEditor chartEditor = SWTChartsComponentsProvider.getActiveChartEditor(event);
87 87
		
88 88
		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
89 89
		final FileDialog dialog = new FileDialog(shell, SWT.SAVE);
......
103 103
		dialog.setFilterExtensions(extensions);
104 104
		// Select default chart export file format
105 105
		dialog.setFilterIndex(defaultChartFormatIndex);
106
		dialog.setFileName(ChartsEngine.cleanFileName(chartEditorPart.getPartName()));
106
		
107
		dialog.setFileName(chartEditor.getResult().getValidFileName());
108
		
107 109
		dialog.setOverwrite(true);
108 110

  
109 111

  
......
142 144
						this.runInit(monitor);
143 145
						monitor.beginTask(RCPMessages.ExportResult_1, 100);
144 146

  
145
						String outputFormat = chartEditorPart.getSWTChartsComponentsProvider().getEditorSupportedExportFileFormats().get(dialog.getFilterIndex());
146
						chartEditorPart.exportView(file, outputFormat);
147
						String outputFormat = chartEditor.getSWTChartsComponentsProvider().getEditorSupportedExportFileFormats().get(dialog.getFilterIndex());
148
						chartEditor.exportView(file, outputFormat);
147 149

  
148 150
						if(file.exists()) {
149 151

  
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 652)
82 82
			cmd += "barplot(" + ssizes + ", col=colors, names.arg=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
83 83
					", main=\"" + title + "\", horiz=F, las=2, ylab=\"" + ylab + "\");\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
84 84

  
85
			if(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID))	{
85
			if(result.isGridVisible())	{
86 86
				cmd += this.getChartsEngine().getGridPlotCmd();
87 87
			}
88 88
			
tmp/org.txm.ca.core/src/org/txm/ca/core/preferences/CAPreferences.java (revision 652)
80 80
		
81 81
		// shared charts rendering preferences
82 82
		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
83
		
84
		// disable unavailable functionality
85
		TXMPreferences.setEmpty(PREFERENCES_NODE, ChartsEnginePreferences.RENDERING_COLORS_MODE);
86

  
83 87
	}
84 88
	
85 89
}
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RCAChartCreator.java (revision 652)
8 8
import org.txm.ca.core.chartsengine.base.Utils;
9 9
import org.txm.ca.core.functions.CA;
10 10
import org.txm.ca.core.messages.CACoreMessages;
11
import org.txm.ca.core.preferences.CAPreferences;
12 11
import org.txm.ca.core.statsengine.r.functions.FactoMineRCA;
13 12
import org.txm.chartsengine.core.results.ChartResult;
14 13
import org.txm.chartsengine.r.core.RChartCreator;
......
118 117
		return destFile;
119 118
	}
120 119
	
121
	@Override
122
	public Object createChart(ChartResult result) {
123
		// TODO Auto-generated method stub
124
		return null;
125
	}
126 120

  
121

  
127 122
	@Override
128 123
	public File createChartFile(ChartResult result, File file) {
129 124

  
130 125
		CA ca = (CA) result;
131
		
132
		// parameters
133
		boolean showIndividual = result.getBooleanParameterValue(CAPreferences.SHOW_INDIVIDUALS);
134
		boolean showVariables = result.getBooleanParameterValue(CAPreferences.SHOW_VARIABLES);
135
		
136 126
	
137 127
		// FactoMineR R package
138 128
		if(ca.useFactoMineR())	{
139
			return this.createFactorialMapChart((FactoMineRCA) ca.getCA(), file, showIndividual, showVariables, ca.getFirstDimension(), ca.getSecondDimension(), Utils.createCAFactorialMapChartTitle(ca));
129
			return this.createFactorialMapChart((FactoMineRCA) ca.getCA(), file, ca.isShowIndividuals(), ca.isShowVariables(), ca.getFirstDimension(), ca.getSecondDimension(), Utils.createCAFactorialMapChartTitle(ca));
140 130
		}
141 131
		// CA R package
142 132
		else	{
143
			return this.createFactorialMapChart((org.txm.ca.core.statsengine.r.functions.CA) ca.getCA(), file, showIndividual, showVariables, ca.getFirstDimension(), ca.getSecondDimension());
133
			return this.createFactorialMapChart((org.txm.ca.core.statsengine.r.functions.CA) ca.getCA(), file, ca.isShowIndividuals(), ca.isShowVariables(), ca.getFirstDimension(), ca.getSecondDimension());
144 134
		}
145 135
	}
146 136

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 652)
153 153
			if (parent.getLayout() instanceof GridLayout)	{
154 154
				this.parametersGroupsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
155 155
			}
156

  
156
			
157
			
157 158
			// computing parameters components
158 159
			boolean showComputingParameters = false;
159 160
			// only show the area if the result can not compute and is dirty
......
603 604
				// FIXME: debug
604 605
				System.err.println("TXMEditor.refresh(): manually updating editor from result.");
605 606
				this.updateEditorFromResult(update);  // subclasses manual settings
606
				
607
				this.__updateEditorFromResult(update);
608 607
			}
609 608
			
609
			this.__updateEditorFromResult(update); // essentially for ChartEditor
610
			
611
			
610 612
			topToolBar.redraw();
611 613
			CorporaView.refreshObject(this);
612 614
			TXMResultDebugView.refreshView();
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 652)
37 37
// null when calling getChildren(), see if that's what we want
38 38
public abstract class TXMResult implements Cloneable, IProgressMonitor {
39 39

  
40
	
41
	public static final DateFormat ID_TIME_FORMAT = new SimpleDateFormat("YYYYMMDD");
42
	public static final Pattern FILE_NAME_PATTERN = Pattern.compile("[^a-zA-Z0-9\\.-]+"); //$NON-NLS-1$
43
	public static final String UNDERSCORE = "_";
44

  
45
	
40 46
	/**
41 47
	 * Unique ID of the object built with : class + date + number
42 48
	 */
43 49
	protected String uniqueID;
44
	//protected String path;
45
	public static final DateFormat ID_TIME_FORMAT = new SimpleDateFormat("YYYYMMDD");
46
	/** Editor can use this to test if the result need to be saved */
50
	
51
	/**
52
	 * Editor can use this to test if the result has been computed once.
53
	 */
47 54
	protected boolean hasBeenComputedOnce = false;
48

  
49
	public static final Pattern fileNamePattern = Pattern.compile("[^a-zA-Z0-9\\.-]+"); //$NON-NLS-1$
50
	public static final String UNDERSCORE = "_";
51

  
52 55
	
53 56
	/**
54 57
	 * The weight, essentially used for sorting purpose.
......
1125 1128
	public abstract String getSimpleName();
1126 1129

  
1127 1130
	/**
1128
	 * Gets some details about how the result has been computed  (eg. additional
1129
	 * parameters, etc.). Shown in large UI area
1131
	 * Gets some details about how the result has been computed  (eg. additional parameters, etc.). Shown in large UI area.
1130 1132
	 * 
1131 1133
	 * @return
1132 1134
	 */
......
1158 1160
	// FIXME: to discuss and/or to move in export layer
1159 1161
	public String getValidFileName() {
1160 1162
		try {
1161
			 fileNamePattern.matcher(this.getName()).replaceAll(UNDERSCORE); //$NON-NLS-1$
1163
			 return FILE_NAME_PATTERN.matcher(this.getName()).replaceAll(UNDERSCORE); //$NON-NLS-1$
1162 1164
		} catch (Exception e) {
1165
			Log.printStackTrace(e);
1163 1166
		}
1164 1167
		return "";
1165 1168
	}
......
1192 1195
		return b.toString();
1193 1196
	}
1194 1197

  
1195
	// @Override
1196
	// public String toString() {
1197
	// StringBuilder b = new StringBuilder(super.toString());
1198
	//		b.append(": " + this.getName()); //$NON-NLS-1$
1199
	// return b.toString();
1200
	// }
1201

  
1202 1198
	/**
1203 1199
	 * Gets the weight of the node. Essentially used for sorting purpose.
1204 1200
	 * 

Formats disponibles : Unified diff