diff options
author | Clément DAVID <clement.david@scilab.org> | 2010-05-17 14:08:21 +0200 |
---|---|---|
committer | Bruno JOFRET <bruno.jofret@scilab.org> | 2010-05-25 10:59:10 +0200 |
commit | 150fc91fba811a27285ce0ee240df4b4f87dfefa (patch) | |
tree | e453f2e8747f9415034114b8a645f94875ec8be6 | |
parent | 341e54c660b1ec504b2dacc9e4e337a179f1a2e2 (diff) | |
download | scilab-150fc91fba811a27285ce0ee240df4b4f87dfefa.zip scilab-150fc91fba811a27285ce0ee240df4b4f87dfefa.tar.gz |
Xcos: call setDefaultValues after any port instantiation
Setting the default values is just a hook called at the end of the instanciation.
Change-Id: I81870217928dd4110b669cbdfc71b000381a9208
6 files changed, 12 insertions, 7 deletions
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/SuperBlock.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/SuperBlock.java index 50f31bf..cfec779 100644 --- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/SuperBlock.java +++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/SuperBlock.java | |||
@@ -511,7 +511,6 @@ public final class SuperBlock extends BasicBlock { | |||
511 | while (blockCount > portCount) { // add if required | 511 | while (blockCount > portCount) { // add if required |
512 | BasicPort port; | 512 | BasicPort port; |
513 | port = block.getReferencedPortClass().newInstance(); | 513 | port = block.getReferencedPortClass().newInstance(); |
514 | port.setDefaultValues(); | ||
515 | addPort(port); | 514 | addPort(port); |
516 | portCount++; | 515 | portCount++; |
517 | } | 516 | } |
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/actions/RegionToSuperblockAction.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/actions/RegionToSuperblockAction.java index 3919425..cce8e95 100644 --- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/actions/RegionToSuperblockAction.java +++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/actions/RegionToSuperblockAction.java | |||
@@ -465,14 +465,12 @@ public final class RegionToSuperblockAction extends VertexSelectionDependantActi | |||
465 | if (link.getOutGoing()) { // OUT_f | 465 | if (link.getOutGoing()) { // OUT_f |
466 | block = BlockFactory.createBlock("OUT_f"); | 466 | block = BlockFactory.createBlock("OUT_f"); |
467 | ExplicitInputPort port = new ExplicitInputPort(); | 467 | ExplicitInputPort port = new ExplicitInputPort(); |
468 | port.setDefaultValues(); | ||
469 | block.addPort(port); | 468 | block.addPort(port); |
470 | link.setPortNumber(maxValues.get(0) + 1); | 469 | link.setPortNumber(maxValues.get(0) + 1); |
471 | maxValues.set(0, maxValues.get(0) + 1); | 470 | maxValues.set(0, maxValues.get(0) + 1); |
472 | } else { // IN_f | 471 | } else { // IN_f |
473 | block = BlockFactory.createBlock("IN_f"); | 472 | block = BlockFactory.createBlock("IN_f"); |
474 | ExplicitOutputPort port = new ExplicitOutputPort(); | 473 | ExplicitOutputPort port = new ExplicitOutputPort(); |
475 | port.setDefaultValues(); | ||
476 | block.addPort(port); | 474 | block.addPort(port); |
477 | link.setPortNumber(maxValues.get(1) + 1); | 475 | link.setPortNumber(maxValues.get(1) + 1); |
478 | maxValues.set(1, maxValues.get(1) + 1); | 476 | maxValues.set(1, maxValues.get(1) + 1); |
@@ -481,14 +479,12 @@ public final class RegionToSuperblockAction extends VertexSelectionDependantActi | |||
481 | if (link.getOutGoing()) { // OUTIMPL_f | 479 | if (link.getOutGoing()) { // OUTIMPL_f |
482 | block = BlockFactory.createBlock("OUTIMPL_f"); | 480 | block = BlockFactory.createBlock("OUTIMPL_f"); |
483 | ImplicitInputPort port = new ImplicitInputPort(); | 481 | ImplicitInputPort port = new ImplicitInputPort(); |
484 | port.setDefaultValues(); | ||
485 | block.addPort(port); | 482 | block.addPort(port); |
486 | link.setPortNumber(maxValues.get(2) + 1); | 483 | link.setPortNumber(maxValues.get(2) + 1); |
487 | maxValues.set(2, maxValues.get(2) + 1); | 484 | maxValues.set(2, maxValues.get(2) + 1); |
488 | } else { // INIMPL_f | 485 | } else { // INIMPL_f |
489 | block = BlockFactory.createBlock("INIMPL_f"); | 486 | block = BlockFactory.createBlock("INIMPL_f"); |
490 | ImplicitOutputPort port = new ImplicitOutputPort(); | 487 | ImplicitOutputPort port = new ImplicitOutputPort(); |
491 | port.setDefaultValues(); | ||
492 | block.addPort(port); | 488 | block.addPort(port); |
493 | link.setPortNumber(maxValues.get(3) + 1); | 489 | link.setPortNumber(maxValues.get(3) + 1); |
494 | maxValues.set(3, maxValues.get(3) + 1); | 490 | maxValues.set(3, maxValues.get(3) + 1); |
@@ -497,14 +493,12 @@ public final class RegionToSuperblockAction extends VertexSelectionDependantActi | |||
497 | if (link.getOutGoing()) { // CLKOUTV_f | 493 | if (link.getOutGoing()) { // CLKOUTV_f |
498 | block = BlockFactory.createBlock("CLKOUTV_f"); | 494 | block = BlockFactory.createBlock("CLKOUTV_f"); |
499 | ControlPort port = new ControlPort(); | 495 | ControlPort port = new ControlPort(); |
500 | port.setDefaultValues(); | ||
501 | block.addPort(port); | 496 | block.addPort(port); |
502 | link.setPortNumber(maxValues.get(4) + 1); | 497 | link.setPortNumber(maxValues.get(4) + 1); |
503 | maxValues.set(4, maxValues.get(4) + 1); | 498 | maxValues.set(4, maxValues.get(4) + 1); |
504 | } else { // CLKINV_f | 499 | } else { // CLKINV_f |
505 | block = BlockFactory.createBlock("CLKINV_f"); | 500 | block = BlockFactory.createBlock("CLKINV_f"); |
506 | CommandPort port = new CommandPort(); | 501 | CommandPort port = new CommandPort(); |
507 | port.setDefaultValues(); | ||
508 | block.addPort(port); | 502 | block.addPort(port); |
509 | link.setPortNumber(maxValues.get(5) + 1); | 503 | link.setPortNumber(maxValues.get(5) + 1); |
510 | maxValues.set(5, maxValues.get(5) + 1); | 504 | maxValues.set(5, maxValues.get(5) + 1); |
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/command/CommandPort.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/command/CommandPort.java index 6049964..bf6a09d 100644 --- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/command/CommandPort.java +++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/command/CommandPort.java | |||
@@ -14,6 +14,7 @@ package org.scilab.modules.xcos.port.command; | |||
14 | 14 | ||
15 | import org.scilab.modules.xcos.port.BasicPort; | 15 | import org.scilab.modules.xcos.port.BasicPort; |
16 | import org.scilab.modules.xcos.port.Orientation; | 16 | import org.scilab.modules.xcos.port.Orientation; |
17 | import org.scilab.modules.xcos.port.control.ControlPort; | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * A command port acts generate execution ticks to another block. | 20 | * A command port acts generate execution ticks to another block. |
@@ -33,6 +34,8 @@ public class CommandPort extends BasicPort { | |||
33 | public CommandPort() { | 34 | public CommandPort() { |
34 | super("CommandPort"); | 35 | super("CommandPort"); |
35 | setOrientation(Orientation.SOUTH); | 36 | setOrientation(Orientation.SOUTH); |
37 | |||
38 | setDefaultValues(); | ||
36 | } | 39 | } |
37 | 40 | ||
38 | /** | 41 | /** |
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/control/ControlPort.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/control/ControlPort.java index 9701fa2..742b48b 100644 --- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/control/ControlPort.java +++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/control/ControlPort.java | |||
@@ -14,6 +14,7 @@ package org.scilab.modules.xcos.port.control; | |||
14 | 14 | ||
15 | import org.scilab.modules.xcos.port.BasicPort; | 15 | import org.scilab.modules.xcos.port.BasicPort; |
16 | import org.scilab.modules.xcos.port.Orientation; | 16 | import org.scilab.modules.xcos.port.Orientation; |
17 | import org.scilab.modules.xcos.port.command.CommandPort; | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * A control port acts as the execution tick for the block. | 20 | * A control port acts as the execution tick for the block. |
@@ -30,6 +31,8 @@ public class ControlPort extends BasicPort { | |||
30 | public ControlPort() { | 31 | public ControlPort() { |
31 | super("ControlPort"); | 32 | super("ControlPort"); |
32 | setOrientation(Orientation.NORTH); | 33 | setOrientation(Orientation.NORTH); |
34 | |||
35 | setDefaultValues(); | ||
33 | } | 36 | } |
34 | 37 | ||
35 | /** | 38 | /** |
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/input/InputPort.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/input/InputPort.java index 70c37e8..a8eac32 100644 --- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/input/InputPort.java +++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/input/InputPort.java | |||
@@ -14,6 +14,7 @@ package org.scilab.modules.xcos.port.input; | |||
14 | 14 | ||
15 | import org.scilab.modules.xcos.port.BasicPort; | 15 | import org.scilab.modules.xcos.port.BasicPort; |
16 | import org.scilab.modules.xcos.port.Orientation; | 16 | import org.scilab.modules.xcos.port.Orientation; |
17 | import org.scilab.modules.xcos.port.output.OutputPort; | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * An input port acts as a protection barrier between a link and the internal functions of | 20 | * An input port acts as a protection barrier between a link and the internal functions of |
@@ -33,5 +34,7 @@ public abstract class InputPort extends BasicPort { | |||
33 | protected InputPort(String type) { | 34 | protected InputPort(String type) { |
34 | super(type); | 35 | super(type); |
35 | setOrientation(Orientation.WEST); | 36 | setOrientation(Orientation.WEST); |
37 | |||
38 | setDefaultValues(); | ||
36 | } | 39 | } |
37 | } | 40 | } |
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/output/OutputPort.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/output/OutputPort.java index 20af5c1..42b9da3 100644 --- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/output/OutputPort.java +++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/port/output/OutputPort.java | |||
@@ -14,6 +14,7 @@ package org.scilab.modules.xcos.port.output; | |||
14 | 14 | ||
15 | import org.scilab.modules.xcos.port.BasicPort; | 15 | import org.scilab.modules.xcos.port.BasicPort; |
16 | import org.scilab.modules.xcos.port.Orientation; | 16 | import org.scilab.modules.xcos.port.Orientation; |
17 | import org.scilab.modules.xcos.port.input.InputPort; | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * An output port acts as a protection barrier between the internal functions of | 20 | * An output port acts as a protection barrier between the internal functions of |
@@ -33,5 +34,7 @@ public abstract class OutputPort extends BasicPort { | |||
33 | public OutputPort(String type) { | 34 | public OutputPort(String type) { |
34 | super(type); | 35 | super(type); |
35 | setOrientation(Orientation.EAST); | 36 | setOrientation(Orientation.EAST); |
37 | |||
38 | setDefaultValues(); | ||
36 | } | 39 | } |
37 | } | 40 | } |