Math2mat

/home/ythoma/docs/math2mat/svn/wp1/framework/m2mGUI/src/m2m/frontend/dynamicview/model/GraphicFunction.java

Go to the documentation of this file.
00001 
00015 package m2m.frontend.dynamicview.model;
00016 
00017 import java.util.Vector;
00018 
00019 import org.eclipse.draw2d.geometry.Rectangle;
00020 
00021 public class GraphicFunction extends Node
00022 {
00026         int fullSizeWidth;
00027         int fullSizeHeight;
00031         int reductSizeWidth;
00032         int reductSizeHeight;
00036         private Vector<PointConnection> outputPointsConnection = new Vector<PointConnection>();
00040         private boolean notReduct = true;
00041         
00046         public int getReductSizeWidth()
00047         {
00048                 return reductSizeWidth;
00049         }
00050         
00051         
00056         public int getReductSizeHeight()
00057         {
00058                 return reductSizeHeight;
00059         }
00060         
00061         
00066         public int getFullSizeWidth()
00067         {
00068                 return fullSizeWidth;
00069         }       
00070         
00071         
00076         public int getFullSizeHeight()
00077         {
00078                 return fullSizeHeight;
00079         }       
00080         
00081         
00087         public void setReductSize(int width, int height)
00088         {
00089                 reductSizeWidth = width;
00090                 reductSizeHeight = height;
00091         }
00092         
00093         
00099         public void setFullSize(int width, int height)
00100         {
00101                 fullSizeWidth = width;
00102                 fullSizeHeight = height;
00103         }
00104         
00105         
00110         public Vector<PointConnection> getOutputPointsConnection()
00111         {
00112                 return outputPointsConnection;
00113         }
00114         
00115         
00120         public void addOutputPointConnection(PointConnection pc)
00121         {
00122                 outputPointsConnection.add(pc);
00123                 pc.setOutputResult(this);
00124         }
00125         
00126         
00132         public void setSize(int width, int height)
00133         {
00134                 Rectangle layout = getLayout();
00135                 Rectangle newLayout = new Rectangle(layout.x, layout.y, width, height);
00136                 if (CanSetLayout(newLayout))
00137                         setLayoutReduction(newLayout);
00138         }
00139     
00140     
00145         public boolean CanSetLayout(Rectangle layoutTest)
00146         {
00147                 /* Check if the new layout is inside its parent */
00148                 if(!isInParent(layoutTest))
00149                         return false;
00150                 
00151                 /* Check if the new layout is under connection points */
00152                 for(Node node : getParent().getChildrenArray())
00153                 {
00154                         if(node != this && !outputPointsConnection.contains(node))
00155                                 if(nodeUnderNode(layoutTest, node.getLayout()))
00156                                         return false;
00157                 }       
00158                 
00159                 return true;
00160         }
00161         
00162         
00167         public void setNotReduct(boolean notReduct)
00168         {
00169                 this.notReduct = notReduct;
00170         }
00171         
00176         public boolean getNotReduct()
00177         {
00178                 return notReduct;
00179         }
00180 }
 All Classes Namespaces Files Functions Variables Enumerations