|
@@ -64,6 +64,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
private float scalediv20;
|
|
|
private Position unPos;
|
|
|
private ArrayList<Position> savePos;
|
|
|
+ private UnitGraph unitGraph;
|
|
|
|
|
|
private UpdateController updCon;
|
|
|
|
|
@@ -117,11 +118,13 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
* the Model
|
|
|
* @param control
|
|
|
* the Controller
|
|
|
+ * @param unitGraph
|
|
|
*/
|
|
|
- public MyCanvas(Model mod, Control control) {
|
|
|
+ public MyCanvas(Model mod, Control control, UnitGraph unitGraph) {
|
|
|
toolTip = false;
|
|
|
this.controller = control;
|
|
|
this.model = mod;
|
|
|
+ this.unitGraph = unitGraph;
|
|
|
|
|
|
scalediv20 = model.getScale() / 20;
|
|
|
|
|
@@ -341,8 +344,9 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
if (cps instanceof CpsUpperNode) {
|
|
|
JTabbedPane tabbedPane = (JTabbedPane) getParent().getParent().getParent();
|
|
|
for (int i = 4; i < tabbedPane.getTabCount(); i++) {
|
|
|
- if (tabbedPane.getComponentAt(i) != null && ((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport()
|
|
|
- .getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
|
+ if (tabbedPane.getComponentAt(i) != null
|
|
|
+ && ((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport()
|
|
|
+ .getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
|
tabbedPane.remove(i);
|
|
|
break;
|
|
|
}
|
|
@@ -360,7 +364,6 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
controller.cut(null);
|
|
|
- ;
|
|
|
itemPaste.setEnabled(true);
|
|
|
repaint();
|
|
|
}
|
|
@@ -380,7 +383,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
try {
|
|
|
controller.paste(null, mousePosition);
|
|
|
-
|
|
|
+ unitGraph.update(model.getSelectedCpsObjects());
|
|
|
} catch (JsonParseException | UnsupportedFlavorException | IOException e1) {
|
|
|
// TODO Auto-generated catch block
|
|
|
JLabel message = new JLabel("The Clipboard information cannot be pastet into Application.");
|