Math2mat
|
00001 00016 package m2m.frontend.dynamicview.model; 00017 00018 import m2m.backend.structure.StructTreatment; 00019 import m2m.frontend.view.Editor; 00020 00021 import org.eclipse.draw2d.geometry.Rectangle; 00022 import org.eclipse.ui.PlatformUI; 00023 00024 public class PointConnection extends Node 00025 { 00029 private Node outputResult = null; 00033 private boolean isConstant = false; 00034 00035 00040 public boolean getIsConstant() 00041 { 00042 return isConstant; 00043 } 00044 00049 public void setIsConstant(boolean value) 00050 { 00051 this.isConstant = value; 00052 } 00053 00054 00059 public boolean getMonitor() 00060 { 00061 return getElement().getMonitor(); 00062 } 00063 00064 00069 public void setMonitor(boolean monitor) 00070 { 00071 Editor editor = (Editor)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); 00072 StructTreatment treatment = editor.getM2MProject().getStructTreatment(); 00073 00074 getElement().setMonitor(monitor,treatment); 00075 } 00076 00077 00082 public Node getOutputResult() 00083 { 00084 return outputResult; 00085 } 00086 00087 00092 public void setOutputResult(Node outputResult) 00093 { 00094 this.outputResult = outputResult; 00095 } 00096 00097 00102 public boolean CanSetLayout(Rectangle layoutTest) 00103 { 00104 /* Check if the new layout is inside its parent */ 00105 if(!isInParent(layoutTest)) 00106 return false; 00107 00108 /* Check if the new layout is under connection points */ 00109 for(Node node : getParent().getChildrenArray()) 00110 { 00111 if(node != this && outputResult != node) 00112 if(!(outputResult instanceof GraphicFunction && outputResult != null && ((GraphicFunction)outputResult).getOutputPointsConnection().contains(node))) 00113 if(nodeUnderNode(layoutTest, node.getLayout())) 00114 return false; 00115 00116 } 00117 00118 return true; 00119 } 00120 }