2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2009 - DIGITEO - Antoine ELIAS
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 package org.scilab.modules.xcos.block;
15 import org.scilab.modules.hdf5.scilabTypes.ScilabDouble;
16 import org.scilab.modules.hdf5.scilabTypes.ScilabType;
18 import org.scilab.modules.xcos.utils.XcosEvent;
20 import com.mxgraph.util.mxEventObject;
22 public final class EventOutBlock extends ContextUpdate {
24 private static final long serialVersionUID = 6585655980747217421L;
26 public EventOutBlock() {
30 protected EventOutBlock(String label) {
37 * Initialize the block with the default values
40 protected void setDefaultValues() {
41 super.setDefaultValues();
42 setInterfaceFunctionName("CLKOUTV_f");
43 setSimulationFunctionName("output");
46 public void setExprs(ScilabType exprs) {
47 super.setExprs(exprs);
48 //setValue(((ScilabString) getExprs()).getData()[0][0]);
51 public void updateBlockSettings(BasicBlock modifiedBlock) {
53 double oldValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
54 super.updateBlockSettings(modifiedBlock);
55 double newValue = ((ScilabDouble)getIntegerParameters()).getRealPart()[0][0];
57 if(oldValue != newValue){
58 getParentDiagram().fireEvent(XcosEvent.OUT_EVENT_VALUE_UPDATED, new mxEventObject(new Object[]{oldValue,newValue}));
62 public void setIntegerParameters(ScilabType integerParameters) {
63 super.setIntegerParameters(integerParameters);
64 setValue((int)((ScilabDouble)getIntegerParameters()).getRealPart()[0][0]);