Révision 1707
| tmp/org.txm.ahc.core/src/org/txm/ahc/core/functions/AHC.java (revision 1707) | ||
|---|---|---|
| 683 | 683 |
|
| 684 | 684 |
@Override |
| 685 | 685 |
public String getSimpleName() {
|
| 686 |
// FIXME: to define |
|
| 687 |
// StringBuffer buffer = new StringBuffer(); |
|
| 688 |
// buffer.append(this.columnsComputing ? "cols" : "rows"); //$NON-NLS-1$ |
|
| 689 |
// buffer.append(this.method); |
|
| 690 |
// buffer.append(this.metric); |
|
| 691 |
// buffer.append(this.numberOfClusters); |
|
| 692 |
if(this.hasBeenComputedOnce) {
|
|
| 693 |
return this.getName(); |
|
| 686 |
try {
|
|
| 687 |
return this.getName(); |
|
| 694 | 688 |
} |
| 695 |
else {
|
|
| 689 |
catch (Exception e) {
|
|
| 696 | 690 |
return this.getEmptyName(); |
| 697 |
} |
|
| 698 |
|
|
| 691 |
} |
|
| 699 | 692 |
} |
| 700 | 693 |
|
| 701 | 694 |
@Override |
| tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1707) | ||
|---|---|---|
| 176 | 176 |
|
| 177 | 177 |
initRCPStuffs(); |
| 178 | 178 |
|
| 179 |
// FIXME: SJ: this code doesn't flush the other nodes (EditionsPreferences, Tokenizer, etc. see if it's a problem at this stage or not) |
|
| 180 | 179 |
this.autoSaveParametersFromAnnotations(); |
| 181 | 180 |
this.saveParameters(); |
| 182 | 181 |
TXMPreferences.flush(this); |
| ... | ... | |
| 367 | 366 |
} |
| 368 | 367 |
|
| 369 | 368 |
/** |
| 370 |
* Loads and create the persisted results from the preferences service. |
|
| 369 |
* Loads and creates the persisted results from the preferences service.
|
|
| 371 | 370 |
*/ |
| 372 | 371 |
public void loadResults(Class clazz) {
|
| 373 |
// if (TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED)) {
|
|
| 372 |
|
|
| 374 | 373 |
Log.finest("*** Project.loadResults(): reloading project persitent results...");
|
| 375 | 374 |
|
| 376 |
IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace(); |
|
| 377 |
// IProject projects[] = rcpWorkspace.getRoot().getProjects(); |
|
| 378 |
|
|
| 379 |
// Log.fine("Toolbox.initialize(): " + projects.length + " project(s) found in workspace.");
|
|
| 380 |
|
|
| 381 | 375 |
ArrayList<String> resultNodePaths = TXMPreferences.getAllResultsNodePaths(this.getParametersNodeRootPath()); |
| 382 | 376 |
|
| 383 | 377 |
Log.fine("Loading " + resultNodePaths.size() + " result(s) from project " + this.getName() + "...");
|
| 384 | 378 |
|
| 385 |
|
|
| 379 |
//TXMPreferences.dump(); |
|
| 380 |
|
|
| 386 | 381 |
ArrayList<String> errors = new ArrayList<String>(); |
| 387 |
for (String parametersNodePath : resultNodePaths) {
|
|
| 382 |
for (String resultNodePath : resultNodePaths) {
|
|
| 388 | 383 |
|
| 389 |
// skip non-TXMResult preference node |
|
| 390 |
// if (TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier).isEmpty()) {
|
|
| 391 |
// continue; |
|
| 392 |
// } |
|
| 393 |
|
|
| 394 | 384 |
try {
|
| 395 |
Preferences node = TXMPreferences.preferencesRootNode.node(parametersNodePath); |
|
| 396 |
String className = node.get("class", ""); //$NON-NLS-1$
|
|
| 385 |
Preferences node = TXMPreferences.preferencesRootNode.node(resultNodePath); |
|
| 397 | 386 |
|
| 387 |
|
|
| 388 |
String className = node.get("class", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 389 |
|
|
| 398 | 390 |
// Skip Project object |
| 399 | 391 |
if (Project.class.getName().equals(className)) { // already loaded in loadProjectFromProjectScope
|
| 400 | 392 |
continue; |
| 401 | 393 |
} |
| 402 | 394 |
|
| 403 | 395 |
if (className == null || className.length() == 0) {
|
| 404 |
errors.add(NLS.bind("Warning: can not restore object with no class name set with path={0}.", parametersNodePath)); //$NON-NLS-1$
|
|
| 396 |
errors.add(NLS.bind("Warning: can not restore object with no class name set with path={0}.", resultNodePath)); //$NON-NLS-1$
|
|
| 405 | 397 |
node.removeNode(); |
| 406 | 398 |
continue; |
| 407 | 399 |
} |
| ... | ... | |
| 410 | 402 |
continue; // only load the result of class=clazz |
| 411 | 403 |
} |
| 412 | 404 |
|
| 413 |
Log.fine("\nProject.loadResults(): loading from result node qualifier " + parametersNodePath);
|
|
| 405 |
Log.fine("\nProject.loadResults(): loading from result node qualifier " + resultNodePath);
|
|
| 414 | 406 |
//Log.finest("Toolbox.initialize(): class = " + TXMPreferences.getString("class", nodeQualifier));
|
| 415 | 407 |
//TXMPreferences.dump(); |
| 416 |
TXMResult result = TXMResult.getResult(this, parametersNodePath);
|
|
| 408 |
TXMResult result = TXMResult.getResult(this, resultNodePath);
|
|
| 417 | 409 |
if (result != null) { // result already restored
|
| 418 | 410 |
continue; |
| 419 | 411 |
} |
| ... | ... | |
| 436 | 428 |
|
| 437 | 429 |
Class<?> cl = bundle.loadClass(className); |
| 438 | 430 |
Constructor<?> cons = cl.getConstructor(String.class); |
| 439 |
result = (TXMResult) cons.newInstance(parametersNodePath);
|
|
| 431 |
result = (TXMResult) cons.newInstance(resultNodePath);
|
|
| 440 | 432 |
|
| 441 | 433 |
// not an internal persistence (eg. corpus or partition) |
| 442 | 434 |
if (!result.isInternalPersistable()) {
|
| ... | ... | |
| 449 | 441 |
} |
| 450 | 442 |
if (errors.size() > 0) {
|
| 451 | 443 |
for (int i = 0 ; i < 20 && i < errors.size() ; i++) {
|
| 452 |
Log.warning(errors.get(i));
|
|
| 444 |
Log.fine(errors.get(i));
|
|
| 453 | 445 |
} |
| 454 | 446 |
if (errors.size() > 20) {
|
| 455 |
Log.warning("more: "+(errors.size()-20)+"...");
|
|
| 447 |
Log.fine("more: "+(errors.size()-20)+"...");
|
|
| 456 | 448 |
} |
| 457 | 449 |
} |
| 458 | 450 |
|
| tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swing/SVGPanel.java (revision 1707) | ||
|---|---|---|
| 51 | 51 |
import org.w3c.dom.svg.SVGDocument; |
| 52 | 52 |
|
| 53 | 53 |
/** |
| 54 |
* SVG Batik Swing panel. |
|
| 54 |
* SVG Batik SVG canvas swing panel.
|
|
| 55 | 55 |
*/ |
| 56 |
public class SVGPanel extends JPanel implements IChartComponent {
|
|
| 56 |
public class SVGPanel extends JSVGCanvas implements IChartComponent {
|
|
| 57 | 57 |
|
| 58 | 58 |
protected boolean squareOffEnabled; |
| 59 | 59 |
|
| ... | ... | |
| 70 | 70 |
/** |
| 71 | 71 |
* The Batik SVG canvas. |
| 72 | 72 |
*/ |
| 73 |
protected JSVGCanvas svgCanvas; |
|
| 73 |
//protected JSVGCanvas svgCanvas;
|
|
| 74 | 74 |
|
| 75 | 75 |
|
| 76 | 76 |
/** |
| ... | ... | |
| 90 | 90 |
* @param frame the frame |
| 91 | 91 |
*/ |
| 92 | 92 |
public SVGPanel() {
|
| 93 |
super(new BorderLayout()); |
|
| 93 |
//super(new BorderLayout()); |
|
| 94 |
super(null, true, false); |
|
| 95 |
|
|
| 96 |
//this.svgCanvas = new JSVGCanvas(null, true, false); |
|
| 97 |
//this.add("Center", svgCanvas); //$NON-NLS-1$
|
|
| 94 | 98 |
|
| 95 |
this.svgCanvas = new JSVGCanvas(null, true, false); |
|
| 96 |
this.add("Center", svgCanvas); //$NON-NLS-1$
|
|
| 97 |
|
|
| 98 | 99 |
// TODO: needed for automatic refresh after dynamically modifying the SVG DOM |
| 99 | 100 |
//svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC); |
| 100 | 101 |
|
| 101 |
List<Interactor> list = svgCanvas.getInteractors();
|
|
| 102 |
List<Interactor> list = this.getInteractors();
|
|
| 102 | 103 |
list.clear(); |
| 103 | 104 |
|
| 104 | 105 |
|
| ... | ... | |
| 216 | 217 |
|
| 217 | 218 |
|
| 218 | 219 |
|
| 220 |
// |
|
| 221 |
// |
|
| 222 |
// /** |
|
| 223 |
// * Loads SVG document from the specified URL. |
|
| 224 |
// * |
|
| 225 |
// * @param url the url |
|
| 226 |
// */ |
|
| 227 |
// public void loadSVGDocument(String url) {
|
|
| 228 |
// this.svgCanvas.loadSVGDocument(url); |
|
| 229 |
// } |
|
| 230 |
// |
|
| 231 |
// |
|
| 232 |
// /** |
|
| 233 |
// * Returns the SVG document. |
|
| 234 |
// * @return |
|
| 235 |
// */ |
|
| 236 |
// public SVGDocument getSVGDocument() {
|
|
| 237 |
// return this.svgCanvas.getSVGDocument(); |
|
| 238 |
// } |
|
| 219 | 239 |
|
| 220 | 240 |
|
| 221 |
/** |
|
| 222 |
* Loads SVG document from the specified URL. |
|
| 223 |
* |
|
| 224 |
* @param url the url |
|
| 225 |
*/ |
|
| 226 |
public void loadSVGDocument(String url) {
|
|
| 227 |
this.svgCanvas.loadSVGDocument(url); |
|
| 228 |
} |
|
| 229 |
|
|
| 230 |
|
|
| 231 |
/** |
|
| 232 |
* Returns the SVG document. |
|
| 233 |
* @return |
|
| 234 |
*/ |
|
| 235 |
public SVGDocument getSVGDocument() {
|
|
| 236 |
return this.svgCanvas.getSVGDocument(); |
|
| 237 |
} |
|
| 238 |
|
|
| 239 |
|
|
| 240 | 241 |
// ---------------------------------------------------------------------- |
| 241 | 242 |
// Interactors |
| 242 | 243 |
// ---------------------------------------------------------------------- |
| ... | ... | |
| 303 | 304 |
}; |
| 304 | 305 |
|
| 305 | 306 |
|
| 306 |
/** |
|
| 307 |
* @return the svgCanvas |
|
| 308 |
*/ |
|
| 309 |
public JSVGCanvas getSVGCanvas() {
|
|
| 310 |
return svgCanvas; |
|
| 311 |
} |
|
| 307 |
// /** |
|
| 308 |
// * @return the svgCanvas |
|
| 309 |
// */ |
|
| 310 |
// public JSVGCanvas getSVGCanvas() {
|
|
| 311 |
// return svgCanvas; |
|
| 312 |
// } |
|
| 313 |
// |
|
| 312 | 314 |
|
| 313 | 315 |
|
| 314 | 316 |
|
| 315 |
|
|
| 316 | 317 |
/** |
| 317 | 318 |
* Resets pan and zoom. |
| 318 | 319 |
*/ |
| ... | ... | |
| 320 | 321 |
this.zoom = 0; |
| 321 | 322 |
AffineTransform trans = AffineTransform.getTranslateInstance(0, 0); |
| 322 | 323 |
trans.scale(1, 1); |
| 323 |
this.svgCanvas.setRenderingTransform(trans);
|
|
| 324 |
this.setRenderingTransform(trans); |
|
| 324 | 325 |
|
| 325 | 326 |
// Square unit axis ratio constraint |
| 326 | 327 |
if(this.squareOffEnabled) {
|
| ... | ... | |
| 344 | 345 |
|
| 345 | 346 |
|
| 346 | 347 |
if(zoomIn) {
|
| 347 |
trans.scale(this.svgCanvas.getRenderingTransform().getScaleX() * 1.1, this.svgCanvas.getRenderingTransform().getScaleY() * 1.1);
|
|
| 348 |
trans.scale(this.getRenderingTransform().getScaleX() * 1.1, this.getRenderingTransform().getScaleY() * 1.1);
|
|
| 348 | 349 |
} |
| 349 | 350 |
else {
|
| 350 |
trans.scale(this.svgCanvas.getRenderingTransform().getScaleX() * 0.9, this.svgCanvas.getRenderingTransform().getScaleY() * 0.9);
|
|
| 351 |
trans.scale(this.getRenderingTransform().getScaleX() * 0.9, this.getRenderingTransform().getScaleY() * 0.9);
|
|
| 351 | 352 |
} |
| 352 | 353 |
|
| 353 | 354 |
// trans.translate(-x + this.svgCanvas.getRenderingTransform().getTranslateX(), -y + this.svgCanvas.getRenderingTransform().getTranslateY()); |
| ... | ... | |
| 358 | 359 |
|
| 359 | 360 |
|
| 360 | 361 |
if(trans.getDeterminant() != 0) {
|
| 361 |
this.svgCanvas.setRenderingTransform(trans);
|
|
| 362 |
this.setRenderingTransform(trans); |
|
| 362 | 363 |
} |
| 363 | 364 |
} |
| 364 | 365 |
|
| ... | ... | |
| 389 | 390 |
trans.translate(-x, -y); |
| 390 | 391 |
|
| 391 | 392 |
if(trans.getDeterminant() != 0) {
|
| 392 |
this.svgCanvas.setRenderingTransform(trans);
|
|
| 393 |
this.setRenderingTransform(trans); |
|
| 393 | 394 |
} |
| 394 | 395 |
} |
| 395 | 396 |
|
| ... | ... | |
| 397 | 398 |
@Override |
| 398 | 399 |
public void pan(double srcX, double srcY, double dstX, double dstY, double panFactor) {
|
| 399 | 400 |
|
| 400 |
AffineTransform trans = this.svgCanvas.getRenderingTransform();
|
|
| 401 |
AffineTransform trans = this.getRenderingTransform(); |
|
| 401 | 402 |
trans.translate(-dstX * panFactor, dstY * panFactor); |
| 402 |
this.svgCanvas.setRenderingTransform(trans);
|
|
| 403 |
this.setRenderingTransform(trans); |
|
| 403 | 404 |
|
| 404 | 405 |
} |
| 405 | 406 |
|
| tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 1707) | ||
|---|---|---|
| 1 | 1 |
package org.txm.chartsengine.svgbatik.rcp.swt; |
| 2 |
import java.awt.Component; |
|
| 3 |
import java.awt.Graphics2D; |
|
| 4 |
import java.awt.Toolkit; |
|
| 5 |
import java.awt.datatransfer.DataFlavor; |
|
| 6 |
import java.awt.datatransfer.Transferable; |
|
| 7 |
import java.awt.datatransfer.UnsupportedFlavorException; |
|
| 8 |
import java.awt.image.BufferedImage; |
|
| 9 | 2 |
import java.io.File; |
| 10 |
import java.io.IOException; |
|
| 11 | 3 |
import java.net.MalformedURLException; |
| 12 | 4 |
|
| 13 | 5 |
import org.eclipse.swt.widgets.Composite; |
| 14 |
import org.txm.chartsengine.rcp.IChartComponent; |
|
| 15 | 6 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
| 16 | 7 |
import org.txm.chartsengine.rcp.swt.SwingChartComposite; |
| 17 | 8 |
import org.txm.chartsengine.svgbatik.rcp.swing.SVGPanel; |
| tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java (revision 1707) | ||
|---|---|---|
| 152 | 152 |
//((Element)this.composite.getSVGDocument().getFirstChild()).setAttribute("viewBox", "20 20 400 350"); // FIXME : how to get the correct area after the charts has been zoomed or moved ?
|
| 153 | 153 |
|
| 154 | 154 |
// Adjust dimensions from component |
| 155 |
((Element)composite.getSVGDocument().getFirstChild()).setAttribute("width", String.valueOf(composite.getPanel().getSVGCanvas().getWidth()));
|
|
| 156 |
((Element)composite.getSVGDocument().getFirstChild()).setAttribute("height", String.valueOf(composite.getPanel().getSVGCanvas().getHeight()));
|
|
| 155 |
((Element)composite.getSVGDocument().getFirstChild()).setAttribute("width", String.valueOf(composite.getPanel().getWidth()));
|
|
| 156 |
((Element)composite.getSVGDocument().getFirstChild()).setAttribute("height", String.valueOf(composite.getPanel().getHeight()));
|
|
| 157 | 157 |
|
| 158 | 158 |
|
| 159 | 159 |
TranscoderInput input = new TranscoderInput(composite.getSVGDocument()); |
Formats disponibles : Unified diff