ports/math/scilab/files/patch-debian-jgraphx
Wen Heping 01eca2900d - Unbreak it and update to 5.2.0
PR:		ports/143867
Submitted by:	Rob Farmer <rfarmer@predatorlabs.net>
Approved by:	maintainer
Feature safe:	yes
2010-02-25 02:09:17 +00:00

328 lines
14 KiB
Text

--- modules/xcos/src/java/org/scilab/modules/graph/ScilabGraph.java 2010-01-22 16:43:29.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/graph/ScilabGraph.java 2010-01-22 16:44:22.000000000 +0100
@@ -75,7 +75,7 @@
public void invoke(Object source, mxEventObject evt) {
if (!redoInAction) {
- undoManager.undoableEditHappened((mxUndoableEdit) evt.getArgAt(0));
+ undoManager.undoableEditHappened((mxUndoableEdit) evt.getProperty("edit"));
incrementUndoCounter();
}
}
@@ -86,7 +86,7 @@
*/
mxIEventListener selectionHandler = new mxIEventListener() {
public void invoke(Object source, mxEventObject evt) {
- List<mxUndoableChange> changes = ((mxUndoableEdit) evt.getArgAt(0)).getChanges();
+ List<mxUndoableChange> changes = ((mxUndoableEdit) evt.getProperty("edit")).getChanges();
setSelectionCells(getSelectionCellsForChanges(changes));
}
};
@@ -209,10 +209,12 @@
* com.mxgraph.util.mxUndoManager
*/
public void redo() {
+ if (!redoInAction) {
incrementUndoCounter();
redoInAction = true;
undoManager.redo();
redoInAction = false;
+ }
}
/**
--- modules/xcos/src/java/org/scilab/modules/xcos/actions/ShowHideShadowAction.java 2010-01-22 16:55:10.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/actions/ShowHideShadowAction.java 2010-01-22 16:55:42.000000000 +0100
@@ -63,11 +63,15 @@
if (allCells[i] instanceof BasicBlock) {
//((BasicBlock) allCells[i])
mxCellState state = getGraph(null).getView().getState(allCells[i]);
- Hashtable<String, Object> style = (state != null) ? state.getStyle() : getGraph(null).getCellStyle(allCells[i]);
-
+ Map<String, Object> style;
+ if (state != null) {
+ style = state.getStyle();
+ } else {
+ style = getGraph(null).getCellStyle(allCells[i]);
+ }
if (style != null)
{
- String value = (mxUtils.isTrue(style, mxConstants.STYLE_SHADOW, false)) ? "0" : "1";
+ String value = Boolean.toString(mxUtils.isTrue(style, mxConstants.STYLE_SHADOW, false));
getGraph(null).setCellStyles(mxConstants.STYLE_SHADOW, value, new Object[] { allCells[i] });
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosCanvas.java 2010-01-22 16:55:52.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosCanvas.java 2010-01-22 16:57:58.000000000 +0100
@@ -17,7 +17,7 @@
public class XcosCanvas extends mxInteractiveCanvas{
public Object drawVertex(int x, int y, int w, int h,
- Hashtable<String, Object> style) {
+ Map<String, Object> style) {
if (g != null)
{
@@ -90,7 +90,7 @@
start = (int) Math.round(start * scale);
// Removes some styles to draw the content area
- Hashtable<String, Object> cloned = new Hashtable<String, Object>(
+ Map<String, Object> cloned = new Hashtable<String, Object>(
style);
cloned.remove(mxConstants.STYLE_FILLCOLOR);
cloned.remove(mxConstants.STYLE_ROUNDED);
--- modules/xcos/src/java/org/scilab/modules/xcos/block/BasicBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/BasicBlock.java 2010-01-22 16:45:37.000000000 +0100
@@ -562,7 +562,7 @@
*/
if (getParentDiagram() instanceof SuperBlockDiagram) {
SuperBlock parentBlock = ((SuperBlockDiagram) getParentDiagram()).getContainer();
- parentBlock.getParentDiagram().fireEvent(XcosEvent.SUPER_BLOCK_UPDATED,new mxEventObject(new Object[] { parentBlock }));
+ parentBlock.getParentDiagram().fireEvent(new mxEventObject(XcosEvent.SUPER_BLOCK_UPDATED, "block", parentBlock));
}
}
@@ -606,7 +606,7 @@
// Now read new Block
BasicBlock modifiedBlock = BlockReader.readBlockFromFile(tempInput.getAbsolutePath());
updateBlockSettings(modifiedBlock);
- getParentDiagram().fireEvent(XcosEvent.ADD_PORTS, new mxEventObject(new Object[] {currentBlock}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.ADD_PORTS, "block", currentBlock));
setLocked(false);
}
};
--- modules/xcos/src/java/org/scilab/modules/xcos/block/EventInBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/EventInBlock.java 2010-01-22 16:47:03.000000000 +0100
@@ -51,7 +51,7 @@
double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
if(oldValue != newValue){
- getParentDiagram().fireEvent(XcosEvent.IN_EVENT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.IN_EVENT_VALUE_UPDATED, "old", oldValue, "new", newValue));
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/block/EventOutBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/EventOutBlock.java 2010-01-22 16:47:19.000000000 +0100
@@ -51,7 +51,7 @@
double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
if(oldValue != newValue){
- getParentDiagram().fireEvent(XcosEvent.OUT_EVENT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.OUT_EVENT_VALUE_UPDATED, "old", oldValue, "new", newValue));
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/block/ExplicitInBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/ExplicitInBlock.java 2010-01-22 16:48:57.000000000 +0100
@@ -50,7 +50,7 @@
double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
if(oldValue != newValue){
- getParentDiagram().fireEvent(XcosEvent.IN_EXPLICIT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.IN_EXPLICIT_VALUE_UPDATED, "old", oldValue, "new", newValue));
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/block/ExplicitOutBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/ExplicitOutBlock.java 2010-01-22 16:49:18.000000000 +0100
@@ -51,7 +51,7 @@
double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
if(oldValue != newValue){
- getParentDiagram().fireEvent(XcosEvent.OUT_EXPLICIT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.OUT_EXPLICIT_VALUE_UPDATED, "old", oldValue, "new", newValue));
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/block/ImplicitInBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/ImplicitInBlock.java 2010-01-22 16:49:36.000000000 +0100
@@ -51,7 +51,7 @@
double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
if(oldValue != newValue){
- getParentDiagram().fireEvent(XcosEvent.IN_IMPLICIT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.IN_IMPLICIT_VALUE_UPDATED, "old", oldValue, "new", newValue));
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/block/ImplicitOutBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/ImplicitOutBlock.java 2010-01-22 16:49:52.000000000 +0100
@@ -51,7 +51,7 @@
double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
if(oldValue != newValue){
- getParentDiagram().fireEvent(XcosEvent.OUT_IMPLICIT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.OUT_IMPLICIT_VALUE_UPDATED, "old", oldValue, "new", newValue));
}
}
--- modules/xcos/src/java/org/scilab/modules/xcos/block/SuperBlock.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/block/SuperBlock.java 2010-01-22 16:46:14.000000000 +0100
@@ -386,7 +386,7 @@
updateExportedExplicitOutputPort();
updateExportedImplicitOutputPort();
updateExportedEventOutputPort();
- getParentDiagram().fireEvent(XcosEvent.SUPER_BLOCK_UPDATED, new mxEventObject(new Object[] {this}));
+ getParentDiagram().fireEvent(new mxEventObject(XcosEvent.SUPER_BLOCK_UPDATED, "block", this));
}
--- modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosCanvas.java 2010-01-23 22:49:59.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosCanvas.java 2010-01-23 23:32:57.000000000 +0100
@@ -7,6 +7,7 @@
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.util.Hashtable;
+import java.util.Map;
import com.mxgraph.swing.view.mxInteractiveCanvas;
import com.mxgraph.util.mxConstants;
--- modules/xcos/src/java/org/scilab/modules/xcos/palette/XcosPalette.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/palette/XcosPalette.java 2010-01-24 00:01:43.000000000 +0100
@@ -187,8 +187,9 @@
selectedEntry.setOpaque(true);
}
- eventSource.fireEvent(mxEvent.SELECT, new mxEventObject(new Object[] {
- selectedEntry, t, last }));
+
+ eventSource.fireEvent(new mxEventObject(mxEvent.SELECT, "entry",
+ selectedEntry, "transferable", t, "previous", last));
}
--- modules/xcos/src/java/org/scilab/modules/xcos/actions/ShowHideShadowAction.java 2010-01-23 22:49:59.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/actions/ShowHideShadowAction.java 2010-01-23 23:59:58.000000000 +0100
@@ -13,6 +13,7 @@
package org.scilab.modules.xcos.actions;
import java.util.Hashtable;
+import java.util.Map;
import org.scilab.modules.graph.ScilabGraph;
import org.scilab.modules.graph.actions.DefaultAction;
--- modules/xcos/src/java/org/scilab/modules/xcos/graph/XcosDiagram.java 2009-12-16 08:25:20.000000000 +0100
+++ modules/xcos/src/java/org/scilab/modules/xcos/graph/XcosDiagram.java 2010-01-23 23:57:56.000000000 +0100
@@ -625,7 +625,7 @@
public void invoke(Object source, mxEventObject evt) {
getModel().beginUpdate();
refresh();
- BasicBlock updatedBlock = (BasicBlock) evt.getArgAt(0);
+ BasicBlock updatedBlock = (BasicBlock) evt.getProperty("block");
BlockPositioning.updateBlockView(updatedBlock);
getModel().endUpdate();
}
@@ -639,7 +639,7 @@
*/
private class ModelTracker implements mxIEventListener {
public void invoke(Object source, mxEventObject evt) {
- List<mxUndoableChange> changes = (List<mxUndoableChange>) evt.getArgAt(0);
+ List<mxUndoableChange> changes = (List<mxUndoableChange>) evt.getProperty("changes");
List<Object> objects = new ArrayList<Object>();
getModel().beginUpdate();
for (int i = 0; i < changes.size(); ++i) {
@@ -660,7 +660,8 @@
firedCells[j] = objects.get(j);
}
//fireEvent(XcosEvent.FORCE_CELL_RESHAPE, new mxEventObject(new Object[] {firedCells}));
- fireEvent(XcosEvent.FORCE_CELL_VALUE_UPDATE, new mxEventObject(new Object[] {firedCells}));
+ fireEvent(new mxEventObject(XcosEvent.FORCE_CELL_VALUE_UPDATE, "cells", firedCells));
+
}
getModel().endUpdate();
}
@@ -671,7 +672,7 @@
*/
private class ForceCellValueUpdate implements mxIEventListener {
public void invoke(Object source, mxEventObject evt) {
- Object[] cells = (Object[]) evt.getArgs()[0];
+ Object[] cells = (Object[]) evt.getProperty("cells");
getModel().beginUpdate();
@@ -704,7 +705,7 @@
*/
private class ForceCellReshapeTracker implements mxIEventListener {
public void invoke(Object source, mxEventObject evt) {
- Object[] cells = (Object[]) evt.getArgs()[0];
+ Object[] cells = (Object[]) evt.getProperty("cells");
getModel().beginUpdate();
for (int i = 0; i < cells.length; ++i) {
Object cell = cells[i];
@@ -723,16 +724,15 @@
*/
private class SuperBlockUpdateTracker implements mxIEventListener {
public void invoke(Object source, mxEventObject evt) {
- assert evt.getArgs()[0] instanceof SuperBlock;
- SuperBlock updatedBlock = (SuperBlock) evt.getArgs()[0];
+ assert evt.getProperty("block") instanceof SuperBlock;
+ SuperBlock updatedBlock = (SuperBlock) evt.getProperty("block");
updatedBlock.setRealParameters(BlockWriter
.convertDiagramToMList(updatedBlock.getChild()));
if (updatedBlock.getParentDiagram() instanceof SuperBlockDiagram) {
SuperBlock parentBlock = ((SuperBlockDiagram) updatedBlock
.getParentDiagram()).getContainer();
- parentBlock.getParentDiagram().fireEvent(
- XcosEvent.SUPER_BLOCK_UPDATED,
- new mxEventObject(new Object[] { parentBlock }));
+ parentBlock.getParentDiagram().fireEvent(new mxEventObject(XcosEvent.SUPER_BLOCK_UPDATED,"block", parentBlock));
+
}
BlockPositioning.updateBlockView(updatedBlock);
refresh();
@@ -751,7 +751,7 @@
}
public void invoke(Object source, mxEventObject evt) {
- Object[] cells = (Object[]) evt.getArgs()[0];
+ Object[] cells = (Object[]) evt.getProperty("cells");
diagram.getModel().beginUpdate();
for (int i = 0; i < cells.length; ++i) {
@@ -782,7 +782,7 @@
}
public void invoke(Object source, mxEventObject evt) {
- Object[] cells = (Object[]) evt.getArgs()[0];
+ Object[] cells = (Object[]) evt.getProperty("cells");
for (int i = 0; i < cells.length; i++) {
if (cells[i] instanceof BasicLink) {
BasicLink link = (BasicLink) cells[i];
@@ -900,7 +900,7 @@
*/
private class CellResizedTracker implements mxIEventListener {
public void invoke(Object source, mxEventObject evt) {
- Object[] cells = (Object[]) evt.getArgs()[0];
+ Object[] cells = (Object[]) evt.getProperty("cells");
getModel().beginUpdate();
for (int i = 0; i < cells.length; ++i) {
if (cells[i] instanceof BasicBlock) {
@@ -916,7 +916,7 @@
*/
private class UndoUpdateTracker implements mxIEventListener {
public void invoke(Object source, mxEventObject evt) {
- List<mxUndoableChange> changes = ((mxUndoableEdit) evt.getArgAt(0)).getChanges();
+ List<mxUndoableChange> changes = ((mxUndoableEdit) evt.getProperty("edit")).getChanges();
Object[] changedCells = getSelectionCellsForChanges(changes);
getModel().beginUpdate();
for (Object object : changedCells) {
@@ -1712,7 +1712,7 @@
//getParentTab().setName((String) properties.get("title"));
// Clear all undo events in Undo Manager
- undoManager.reset();
+ undoManager.clear();
setModified(false);
}
@@ -2051,7 +2051,7 @@
* This function will reset the UndoManager in a stable state.
*/
public void resetUndoManager() {
- undoManager.reset();
+ undoManager.clear();
resetUndoCounter();