|
@@ -1,18 +1,15 @@
|
|
|
package ui.view;
|
|
|
|
|
|
-import java.awt.BasicStroke;
|
|
|
-import java.awt.Color;
|
|
|
-import java.awt.Graphics;
|
|
|
-import java.awt.Graphics2D;
|
|
|
-import java.awt.Image;
|
|
|
-import java.awt.Point;
|
|
|
-import java.awt.RenderingHints;
|
|
|
+import classes.*;
|
|
|
+import com.google.gson.JsonParseException;
|
|
|
+import ui.controller.Control;
|
|
|
+import ui.controller.UpdateController;
|
|
|
+import ui.model.Model;
|
|
|
+
|
|
|
+import javax.swing.*;
|
|
|
+import java.awt.*;
|
|
|
import java.awt.datatransfer.UnsupportedFlavorException;
|
|
|
-import java.awt.event.ActionEvent;
|
|
|
-import java.awt.event.ActionListener;
|
|
|
-import java.awt.event.MouseEvent;
|
|
|
-import java.awt.event.MouseListener;
|
|
|
-import java.awt.event.MouseMotionListener;
|
|
|
+import java.awt.event.*;
|
|
|
import java.awt.geom.Line2D;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
@@ -20,23 +17,6 @@ import java.util.ArrayList;
|
|
|
import java.util.Timer;
|
|
|
import java.util.TimerTask;
|
|
|
|
|
|
-import javax.swing.ImageIcon;
|
|
|
-import javax.swing.JLabel;
|
|
|
-import javax.swing.JMenuItem;
|
|
|
-import javax.swing.JOptionPane;
|
|
|
-import javax.swing.JPanel;
|
|
|
-import javax.swing.JPopupMenu;
|
|
|
-import javax.swing.JScrollPane;
|
|
|
-import javax.swing.JSplitPane;
|
|
|
-import javax.swing.JTabbedPane;
|
|
|
-
|
|
|
-import classes.*;
|
|
|
-import com.google.gson.JsonParseException;
|
|
|
-
|
|
|
-import ui.controller.Control;
|
|
|
-import ui.controller.UpdateController;
|
|
|
-import ui.model.Model;
|
|
|
-
|
|
|
|
|
|
* This Class is the Canvas. All Objects will be visualized here
|
|
|
*
|
|
@@ -45,59 +25,52 @@ import ui.model.Model;
|
|
|
public class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
- private Image img = null;
|
|
|
- private int x = 0;
|
|
|
- private int y = 0;
|
|
|
+ public final JMenuItem itemPaste = new JMenuItem(Languages.getLanguage()[97]);
|
|
|
|
|
|
private final Model model;
|
|
|
private final Control controller;
|
|
|
- private Graphics2D g2;
|
|
|
- private int cx, cy;
|
|
|
- private int sx, sy;
|
|
|
private final float scalediv20;
|
|
|
- private Position unPos;
|
|
|
- private ArrayList<Position> savePos;
|
|
|
private final UpdateController updCon;
|
|
|
-
|
|
|
- ArrayList<HolonElement> dataSelected = new ArrayList<>();
|
|
|
- ArrayList<AbstractCpsObject> tempSelected = new ArrayList<>();
|
|
|
-
|
|
|
private final boolean[] showedInformation = new boolean[5];
|
|
|
- private boolean dragging = false;
|
|
|
- private boolean dragged = false;
|
|
|
- private boolean drawEdge = false;
|
|
|
- private boolean click = false;
|
|
|
- private boolean doMark = false;
|
|
|
- public AbstractCpsObject tempCps = null;
|
|
|
- private CpsEdge edgeHighlight = null;
|
|
|
-
|
|
|
|
|
|
private final JPopupMenu popmenu = new JPopupMenu();
|
|
|
private final JMenuItem itemDelete = new JMenuItem(Languages.getLanguage()[98]);
|
|
|
private final JMenuItem itemCut = new JMenuItem(Languages.getLanguage()[95]);
|
|
|
private final JMenuItem itemCopy = new JMenuItem(Languages.getLanguage()[96]);
|
|
|
- public final JMenuItem itemPaste = new JMenuItem(Languages.getLanguage()[97]);
|
|
|
private final JMenuItem itemGroup = new JMenuItem(Languages.getLanguage()[99]);
|
|
|
private final JMenuItem itemUngroup = new JMenuItem(Languages.getLanguage()[100]);
|
|
|
private final JMenuItem itemTrack = new JMenuItem(Languages.getLanguage()[101]);
|
|
|
private final JMenuItem itemUntrack = new JMenuItem(Languages.getLanguage()[102]);
|
|
|
-
|
|
|
+ private final Position toolTipPos = new Position();
|
|
|
+ private final int ANIMTIME = 500;
|
|
|
+ private final int animFPS = 60;
|
|
|
+ private final int animDelay = 1000 / animFPS;
|
|
|
+ public AbstractCpsObject tempCps = null;
|
|
|
+ ArrayList<HolonElement> dataSelected = new ArrayList<>();
|
|
|
+ ArrayList<AbstractCpsObject> tempSelected = new ArrayList<>();
|
|
|
+ private Image img = null;
|
|
|
+ private int x = 0;
|
|
|
+ private int y = 0;
|
|
|
+ private Graphics2D g2;
|
|
|
+ private int cx, cy;
|
|
|
+ private int sx, sy;
|
|
|
+ private Position unPos;
|
|
|
+ private ArrayList<Position> savePos;
|
|
|
+ private boolean dragging = false;
|
|
|
+ private boolean dragged = false;
|
|
|
+ private boolean drawEdge = false;
|
|
|
+ private boolean click = false;
|
|
|
+ private boolean doMark = false;
|
|
|
+ private CpsEdge edgeHighlight = null;
|
|
|
+
|
|
|
|
|
|
private boolean toolTip;
|
|
|
- private final Position toolTipPos = new Position();
|
|
|
private String toolTipText = "";
|
|
|
-
|
|
|
private Point mousePosition = new Point();
|
|
|
-
|
|
|
-
|
|
|
|
|
|
private javax.swing.Timer animT;
|
|
|
- private final int ANIMTIME = 500;
|
|
|
-
|
|
|
private ArrayList<AbstractCpsObject> animCps = null;
|
|
|
- private final int animFPS = 60;
|
|
|
private int animDuration = ANIMTIME;
|
|
|
- private final int animDelay = 1000 / animFPS;
|
|
|
private int animSteps = animDuration / animDelay;
|
|
|
|
|
|
|
|
@@ -197,11 +170,11 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
|
|
|
itemUngroup.addActionListener(actionEvent -> {
|
|
|
|
|
|
- JTabbedPane tabbedPane = (JTabbedPane) getParent().getParent().getParent();
|
|
|
- for (int i = 4; i < tabbedPane.getTabCount(); i++) {
|
|
|
- if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport()
|
|
|
+ JTabbedPane tabbedPaneInner = (JTabbedPane) getParent().getParent().getParent();
|
|
|
+ for (int i = 1; i < tabbedPaneInner.getTabCount(); i++) {
|
|
|
+ if (((UpperNodeCanvas) ((JScrollPane) tabbedPaneInner.getComponentAt(i)).getViewport()
|
|
|
.getComponent(0)).upperNode.getId() == tempCps.getId()) {
|
|
|
- tabbedPane.remove(i);
|
|
|
+ tabbedPaneInner.remove(i);
|
|
|
break;
|
|
|
}
|
|
|
}
|