Kevin Trometer 8 anos atrás
pai
commit
f85502e553

+ 0 - 7
src/classes/Edge.java

@@ -7,13 +7,6 @@ public class Edge {
 	
 	CpsObject A;
 	CpsObject B;
-	
-
-	
-	
-
-
-
 
 	Edge(CpsObject A, CpsObject B, float maxCapacity){
 		setA(A);

+ 5 - 1
src/ui/view/GUI.java

@@ -147,6 +147,7 @@ public class GUI implements CategoryListener {
 	private CpsObject tempCps = null;
 
 	private MyCanvas canvas;
+	private UnitGraph testgraph; // for testing, remove later
 	private final JSplitPane splitPane_3 = new JSplitPane();
 	private final JSlider slider = new JSlider();
 	private final JLabel lblImageSize = new JLabel("Image Size");
@@ -158,6 +159,7 @@ public class GUI implements CategoryListener {
 		this.controller = control;
 		this.model = control.getModel();
 		this.canvas = new MyCanvas(model, control);
+		this.testgraph = new UnitGraph(model, control); // for testing, remove later
 		control.initListener(this);
 		initialize();
 		updateCategories(model.getCategories());
@@ -210,6 +212,8 @@ public class GUI implements CategoryListener {
 
 		mnHelp.add(aboutUs);
 
+		testgraph.setBackground(Color.WHITE);
+		
 		canvas.setBackground(Color.WHITE);
 		canvas.setPreferredSize(new Dimension(10000, 10000));
 		JScrollPane canvasSP = new JScrollPane(canvas);
@@ -259,7 +263,7 @@ public class GUI implements CategoryListener {
 		 */
 		scrollProperties.setViewportView(tableProperties);
 		scrollElements.setViewportView(tableHolonElement);
-		scrollGraph.setViewportView(tableGraph);
+		scrollGraph.setViewportView(testgraph);
 
 		frmCyberPhysical.getContentPane().setLayout(new BorderLayout(0, 0));
 

+ 5 - 0
src/ui/view/MyCanvas.java

@@ -22,11 +22,14 @@ import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 import javax.swing.JToolTip;
 
+import com.sun.javafx.geom.Edge;
+
 import classes.CpsNode;
 import classes.CpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
+import javafx.util.Pair;
 import ui.controller.Control;
 import ui.model.*;
 
@@ -124,6 +127,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 			}
 		}
 
+		
+		
 		// Objects
 		for (CpsObject cps : model.getObjectsOnCanvas()) {
 			img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage();

+ 93 - 0
src/ui/view/UnitGraph.java

@@ -0,0 +1,93 @@
+package ui.view;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import ui.controller.Control;
+import ui.model.Model;
+
+class UnitGraph extends JPanel implements MouseListener, MouseMotionListener {
+
+	private static final long serialVersionUID = 1L;
+	private Control controller;
+	private Model model;
+	Graphics2D g2;
+
+	public UnitGraph(final Model model, Control control) {
+		
+		this.controller = control;
+		this.model = model;
+
+		this.addMouseListener(this);
+		this.addMouseMotionListener(this);
+		repaint();
+		this.add(new JButton("rdsfxgbsdugfbadasu"));
+	}
+
+	/**
+	 * Paints all Components on the Canvas
+	 * 
+	 * @param Graphics
+	 * 
+	 */
+	public void paintComponent(Graphics g) {
+		super.paintComponent(g);
+		g2 = (Graphics2D) g;
+		RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2.setRenderingHints(rh);
+		
+		g2.drawLine(0, this.getHeight()/2, this.getWidth(), this.getHeight()/2);
+	}
+
+	@Override
+	public void mouseDragged(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void mouseMoved(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void mouseClicked(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void mouseEntered(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void mouseExited(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void mousePressed(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void mouseReleased(MouseEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+}