|
@@ -1,55 +1,54 @@
|
|
|
package ui.view;
|
|
|
|
|
|
+import java.awt.BorderLayout;
|
|
|
+import java.awt.Color;
|
|
|
+import java.awt.Component;
|
|
|
+import java.awt.Cursor;
|
|
|
+import java.awt.Dimension;
|
|
|
+import java.awt.Image;
|
|
|
+import java.awt.Point;
|
|
|
+import java.awt.Toolkit;
|
|
|
+import java.awt.event.ActionEvent;
|
|
|
+import java.awt.event.ActionListener;
|
|
|
+import java.awt.event.MouseAdapter;
|
|
|
+import java.awt.event.MouseEvent;
|
|
|
+import java.beans.PropertyChangeEvent;
|
|
|
+import java.beans.PropertyChangeListener;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
+import javax.swing.BoxLayout;
|
|
|
+import javax.swing.DefaultComboBoxModel;
|
|
|
+import javax.swing.ImageIcon;
|
|
|
+import javax.swing.JButton;
|
|
|
+import javax.swing.JCheckBoxMenuItem;
|
|
|
+import javax.swing.JComboBox;
|
|
|
+import javax.swing.JEditorPane;
|
|
|
+import javax.swing.JFileChooser;
|
|
|
import javax.swing.JFrame;
|
|
|
import javax.swing.JLabel;
|
|
|
-import javax.swing.JMenuBar;
|
|
|
import javax.swing.JMenu;
|
|
|
+import javax.swing.JMenuBar;
|
|
|
import javax.swing.JMenuItem;
|
|
|
-import javax.swing.JSlider;
|
|
|
import javax.swing.JOptionPane;
|
|
|
-import javax.swing.JTree;
|
|
|
-import javax.swing.border.LineBorder;
|
|
|
-import javax.print.DocFlavor.STRING;
|
|
|
-import javax.swing.BoxLayout;
|
|
|
-import javax.swing.JSplitPane;
|
|
|
+import javax.swing.JPanel;
|
|
|
+import javax.swing.JPopupMenu;
|
|
|
import javax.swing.JScrollPane;
|
|
|
+import javax.swing.JSlider;
|
|
|
+import javax.swing.JSplitPane;
|
|
|
import javax.swing.JTabbedPane;
|
|
|
import javax.swing.JTable;
|
|
|
+import javax.swing.JToolBar;
|
|
|
+import javax.swing.JTree;
|
|
|
+import javax.swing.event.ChangeEvent;
|
|
|
+import javax.swing.event.ChangeListener;
|
|
|
+import javax.swing.table.DefaultTableModel;
|
|
|
+import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
import javax.swing.tree.DefaultTreeModel;
|
|
|
import javax.swing.tree.TreeCellRenderer;
|
|
|
|
|
|
-import com.sun.beans.editors.StringEditor;
|
|
|
-import com.sun.javafx.geom.Edge;
|
|
|
-
|
|
|
-import ui.controller.Control;
|
|
|
-import ui.model.*;
|
|
|
-
|
|
|
-import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
-import javax.swing.JEditorPane;
|
|
|
-import javax.swing.JFileChooser;
|
|
|
-import javax.swing.table.DefaultTableModel;
|
|
|
-import javax.swing.table.TableCellEditor;
|
|
|
-
|
|
|
-import java.awt.Color;
|
|
|
-import java.awt.Component;
|
|
|
-import java.awt.Cursor;
|
|
|
-import java.awt.Dimension;
|
|
|
-import java.awt.Image;
|
|
|
-import java.awt.Point;
|
|
|
-import java.awt.Toolkit;
|
|
|
-import java.awt.BorderLayout;
|
|
|
-
|
|
|
-import javax.swing.JPanel;
|
|
|
-import javax.swing.JToolBar;
|
|
|
-import javax.swing.JButton;
|
|
|
-import javax.swing.JComboBox;
|
|
|
-import javax.swing.DefaultComboBoxModel;
|
|
|
-import javax.swing.ImageIcon;
|
|
|
-
|
|
|
+import Interfaces.CategoryListener;
|
|
|
import classes.Category;
|
|
|
import classes.CpsEdge;
|
|
|
import classes.CpsNode;
|
|
@@ -58,22 +57,10 @@ import classes.HolonElement;
|
|
|
import classes.HolonObject;
|
|
|
import classes.HolonSwitch;
|
|
|
import classes.HolonTransformer;
|
|
|
-import Interfaces.CategoryListener;
|
|
|
-
|
|
|
-import java.awt.event.ActionListener;
|
|
|
-import java.awt.event.MouseAdapter;
|
|
|
-import java.awt.event.MouseEvent;
|
|
|
-import java.awt.event.MouseListener;
|
|
|
-import java.beans.PropertyChangeEvent;
|
|
|
-import java.beans.PropertyChangeListener;
|
|
|
-import java.awt.event.ActionEvent;
|
|
|
-
|
|
|
-import javax.swing.JSlider;
|
|
|
-import javax.swing.event.ChangeListener;
|
|
|
-import javax.swing.event.TableModelEvent;
|
|
|
-import javax.swing.event.ChangeEvent;
|
|
|
+import ui.controller.Control;
|
|
|
+import ui.model.Model;
|
|
|
|
|
|
-public class GUI implements CategoryListener {
|
|
|
+public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
private JFrame frmCyberPhysical;
|
|
|
|
|
@@ -171,6 +158,12 @@ public class GUI implements CategoryListener {
|
|
|
private final JLabel lblImageSize = new JLabel("Image Size");
|
|
|
// Time Stuff
|
|
|
private TimePanel timePanel;
|
|
|
+ private final JMenu mnAlgorithm = new JMenu("Algorithm");
|
|
|
+ private final JCheckBoxMenuItem chckbxmntmUseAlgorithm = new JCheckBoxMenuItem("Use Algorithm");
|
|
|
+ private final JSplitPane splitPane_2 = new JSplitPane();
|
|
|
+ private final JLabel label_1 = new JLabel("New label");
|
|
|
+ private final JLabel lblSelect = new JLabel("Select");
|
|
|
+ private final JComboBox comboBoxAlgo = new JComboBox();
|
|
|
|
|
|
/**
|
|
|
* Create the application.
|
|
@@ -235,6 +228,16 @@ public class GUI implements CategoryListener {
|
|
|
menuBar.add(mnHelp);
|
|
|
|
|
|
mnHelp.add(aboutUs);
|
|
|
+
|
|
|
+ menuBar.add(mnAlgorithm);
|
|
|
+
|
|
|
+ mnAlgorithm.add(chckbxmntmUseAlgorithm);
|
|
|
+
|
|
|
+ mnAlgorithm.add(splitPane_2);
|
|
|
+
|
|
|
+ splitPane_2.setLeftComponent(lblSelect);
|
|
|
+
|
|
|
+ splitPane_2.setRightComponent(comboBoxAlgo);
|
|
|
|
|
|
unitGraph.setBackground(Color.WHITE);
|
|
|
|
|
@@ -245,6 +248,8 @@ public class GUI implements CategoryListener {
|
|
|
|
|
|
tabbedPane.addTab("Modeling", new ImageIcon(new ImageIcon(this.getClass().getResource("/Images/home.png"))
|
|
|
.getImage().getScaledInstance(30, 30, Image.SCALE_SMOOTH)), canvasSP, "Model a CPS");
|
|
|
+
|
|
|
+ tabbedPane.addTab("New tab", null, label_1, null);
|
|
|
|
|
|
tabbedPane.addTab("Simulation",
|
|
|
new ImageIcon(new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage()
|
|
@@ -743,6 +748,8 @@ public class GUI implements CategoryListener {
|
|
|
|
|
|
try {
|
|
|
controller.loadFile(file.getAbsolutePath());
|
|
|
+ canvas.repaint();
|
|
|
+ tree.repaint();
|
|
|
} catch (IOException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
@@ -962,5 +969,23 @@ public class GUI implements CategoryListener {
|
|
|
tableModelProperties.insertRow(2, tempEnergy);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ private static void addPopup(Component component, final JPopupMenu popup) {
|
|
|
+ component.addMouseListener(new MouseAdapter() {
|
|
|
+ public void mousePressed(MouseEvent e) {
|
|
|
+ if (e.isPopupTrigger()) {
|
|
|
+ showMenu(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void mouseReleased(MouseEvent e) {
|
|
|
+ if (e.isPopupTrigger()) {
|
|
|
+ showMenu(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void showMenu(MouseEvent e) {
|
|
|
+ popup.show(e.getComponent(), e.getX(), e.getY());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|