|
@@ -56,6 +56,7 @@ import javax.swing.ImageIcon;
|
|
|
|
|
|
import classes.Category;
|
|
import classes.Category;
|
|
import classes.CpsObject;
|
|
import classes.CpsObject;
|
|
|
|
+import classes.GlobalVariables;
|
|
import classes.HolonElement;
|
|
import classes.HolonElement;
|
|
import classes.HolonObject;
|
|
import classes.HolonObject;
|
|
import classes.HolonSwitch;
|
|
import classes.HolonSwitch;
|
|
@@ -200,7 +201,7 @@ public class GUI implements CategoryListener {
|
|
splitPane_2.setDividerLocation(200);
|
|
splitPane_2.setDividerLocation(200);
|
|
|
|
|
|
splitPane.setLeftComponent(scrollPane_1);
|
|
splitPane.setLeftComponent(scrollPane_1);
|
|
- img = new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage().getScaledInstance(30, 30,
|
|
|
|
|
|
+ img = new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage().getScaledInstance(GlobalVariables.SCALE, GlobalVariables.SCALE,
|
|
java.awt.Image.SCALE_SMOOTH);
|
|
java.awt.Image.SCALE_SMOOTH);
|
|
Icon icon = new ImageIcon(img);
|
|
Icon icon = new ImageIcon(img);
|
|
|
|
|
|
@@ -214,21 +215,22 @@ public class GUI implements CategoryListener {
|
|
CpsObject tempCPS = null;
|
|
CpsObject tempCPS = null;
|
|
|
|
|
|
for (Category cat : model.getCategories()) {
|
|
for (Category cat : model.getCategories()) {
|
|
|
|
+ if (value.toString().compareTo(cat.getCompareName()) == 0) {
|
|
|
|
+ label.setText(cat.getCompareName());
|
|
|
|
+ }
|
|
for (CpsObject cps : cat.getObjects()) {
|
|
for (CpsObject cps : cat.getObjects()) {
|
|
if (value.toString().compareTo(cps.getCompareName()) == 0) {
|
|
if (value.toString().compareTo(cps.getCompareName()) == 0) {
|
|
tempCPS = cps;
|
|
tempCPS = cps;
|
|
- // System.out.println(tempCPS.getImage());
|
|
|
|
imgR = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage()
|
|
imgR = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage()
|
|
- .getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
|
|
|
|
|
|
+ .getScaledInstance(GlobalVariables.SCALE, GlobalVariables.SCALE, java.awt.Image.SCALE_SMOOTH);
|
|
if (imgR != null) {
|
|
if (imgR != null) {
|
|
label.setIcon(new ImageIcon(imgR));
|
|
label.setIcon(new ImageIcon(imgR));
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
-
|
|
|
|
|
|
+ label.setText(cps.getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- label.setText(value.toString());
|
|
|
|
|
|
+ if(label.getText().length() == 0) label.setText(value.toString());
|
|
return label;
|
|
return label;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -247,14 +249,7 @@ public class GUI implements CategoryListener {
|
|
public void mouseReleased(MouseEvent e) {
|
|
public void mouseReleased(MouseEvent e) {
|
|
try {
|
|
try {
|
|
if (dragging) {
|
|
if (dragging) {
|
|
-
|
|
|
|
- // if(){
|
|
|
|
- // HolonSwitch h = new HolonSwitch(actualObjectClicked);
|
|
|
|
- // }else if(){
|
|
|
|
- // HolonTransformer h = new
|
|
|
|
- // HolonTransformer(actualObjectClicked);
|
|
|
|
- // }else{
|
|
|
|
- HolonObject h = new HolonObject(actualObjectClicked);
|
|
|
|
|
|
+ HolonObject h = new HolonObject(tempCps);
|
|
h.setPos((int) canvas.getMousePosition().getX(), (int) canvas.getMousePosition().getY());
|
|
h.setPos((int) canvas.getMousePosition().getX(), (int) canvas.getMousePosition().getY());
|
|
controller.addObject(h);
|
|
controller.addObject(h);
|
|
for (int i = 0; i < model.getObjectsOnCanvas().size(); i++) {
|
|
for (int i = 0; i < model.getObjectsOnCanvas().size(); i++) {
|
|
@@ -292,7 +287,7 @@ public class GUI implements CategoryListener {
|
|
for (CpsObject cps : cat.getObjects()) {
|
|
for (CpsObject cps : cat.getObjects()) {
|
|
if (actualObjectClicked.compareTo(cps.getCompareName()) == 0) {
|
|
if (actualObjectClicked.compareTo(cps.getCompareName()) == 0) {
|
|
img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage()
|
|
img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage()
|
|
- .getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
|
|
|
|
|
|
+ .getScaledInstance(GlobalVariables.SCALE, GlobalVariables.SCALE, java.awt.Image.SCALE_SMOOTH);
|
|
tempCps = cps;
|
|
tempCps = cps;
|
|
dragging = true;
|
|
dragging = true;
|
|
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(0, 0),
|
|
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(0, 0),
|