|
@@ -53,8 +53,6 @@ import javax.swing.ImageIcon;
|
|
|
import classes.Category;
|
|
|
import classes.CpsObject;
|
|
|
import classes.HolonObject;
|
|
|
-import classes.HolonSwitch;
|
|
|
-import classes.HolonTransformer;
|
|
|
import Interfaces.CategoryListener;
|
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
@@ -104,17 +102,8 @@ public class GUI implements CategoryListener {
|
|
|
private final JToolBar toolBar = new JToolBar();
|
|
|
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
boolean dragging = false;
|
|
|
String actualObjectClicked;
|
|
|
-=======
|
|
|
- private boolean dragging = false;
|
|
|
- private Image img = null;
|
|
|
- private CpsObject tempCps = null;
|
|
|
- private HolonObject tempHol = null;
|
|
|
- private HolonSwitch tempSw = null;
|
|
|
- private HolonTransformer tempTrans = null;
|
|
|
->>>>>>> 1c5a1a2c88c580db3f508d880b0796434747d61f
|
|
|
|
|
|
private final MyCanvas canvas;
|
|
|
|
|
@@ -202,8 +191,9 @@ public class GUI implements CategoryListener {
|
|
|
splitPane_2.setDividerLocation(200);
|
|
|
|
|
|
splitPane.setLeftComponent(scrollPane_1);
|
|
|
-
|
|
|
- Icon icon = new ImageIcon(new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage().getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH));
|
|
|
+ final Image img = new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage()
|
|
|
+ .getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
|
|
|
+ Icon icon = new ImageIcon(img);
|
|
|
DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer();
|
|
|
renderer.setLeafIcon(icon);
|
|
|
|
|
@@ -213,14 +203,9 @@ public class GUI implements CategoryListener {
|
|
|
|
|
|
tree.addMouseListener(new MouseAdapter() {
|
|
|
public void mouseReleased(MouseEvent e) {
|
|
|
- try {
|
|
|
+ try {
|
|
|
if (dragging) {
|
|
|
-<<<<<<< HEAD
|
|
|
HolonObject h = new HolonObject(actualObjectClicked);
|
|
|
-=======
|
|
|
-
|
|
|
- CpsObject h = new CpsObject(tempCps);
|
|
|
->>>>>>> 1c5a1a2c88c580db3f508d880b0796434747d61f
|
|
|
h.setPos((int) canvas.getMousePosition().getX(), (int) canvas.getMousePosition().getY());
|
|
|
controller.addObject(h);
|
|
|
canvas.repaint();
|
|
@@ -228,7 +213,6 @@ public class GUI implements CategoryListener {
|
|
|
}
|
|
|
} catch (Exception e2) {
|
|
|
}
|
|
|
-
|
|
|
frmCyberPhysical.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
|
|
}
|
|
|
});
|
|
@@ -236,7 +220,6 @@ public class GUI implements CategoryListener {
|
|
|
tree.addMouseListener(new MouseAdapter() {
|
|
|
public void mousePressed(MouseEvent e) {
|
|
|
try {
|
|
|
-<<<<<<< HEAD
|
|
|
actualObjectClicked = tree.getPathForLocation(e.getX(), e.getY()).getLastPathComponent().toString();
|
|
|
|
|
|
if (actualObjectClicked.compareTo("Power Plant") == 0 || actualObjectClicked.compareTo("House") == 0
|
|
@@ -245,30 +228,11 @@ public class GUI implements CategoryListener {
|
|
|
dragging = true;
|
|
|
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(0, 0), "Image");
|
|
|
frmCyberPhysical.setCursor(cursor);
|
|
|
-=======
|
|
|
-
|
|
|
- String name = tree.getPathForLocation(e.getX(), e.getY()).getLastPathComponent().toString();
|
|
|
-
|
|
|
- boolean found = false;
|
|
|
- for (Category cat : model.getCategories()) {
|
|
|
- System.out.println(cat.getName()+":");
|
|
|
- for (CpsObject cps : cat.getObjects()) {
|
|
|
- System.out.println(name+" - "+cps.getCompareName());
|
|
|
- if(name.compareTo(cps.getCompareName())==0 ){
|
|
|
- tempCps = cps;
|
|
|
- img = new ImageIcon(this.getClass().getResource(tempCps.getImage())).getImage().getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
|
|
|
- dragging = true;
|
|
|
- Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(0, 0),"Image");
|
|
|
- frmCyberPhysical.setCursor(cursor);
|
|
|
- }
|
|
|
- }
|
|
|
->>>>>>> 1c5a1a2c88c580db3f508d880b0796434747d61f
|
|
|
}
|
|
|
} catch (Exception e2) {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
|
|
|
|
* tree.addTreeSelectionListener(new TreeSelectionListener() {
|
|
@@ -283,9 +247,6 @@ public class GUI implements CategoryListener {
|
|
|
* (Exception e2) {} } });
|
|
|
*/
|
|
|
|
|
|
-=======
|
|
|
-
|
|
|
->>>>>>> 1c5a1a2c88c580db3f508d880b0796434747d61f
|
|
|
scrollPane_1.setViewportView(tree);
|
|
|
|
|
|
scrollPane_1.setColumnHeaderView(panel);
|