|
@@ -177,7 +177,7 @@ public class GUI{
|
|
private final JLabel minGraph = new JLabel("0%");
|
|
private final JLabel minGraph = new JLabel("0%");
|
|
private final JLabel elementGraph = new JLabel("None ");
|
|
private final JLabel elementGraph = new JLabel("None ");
|
|
private final ArrayList<HolonElement> selectedElements = new ArrayList<>();
|
|
private final ArrayList<HolonElement> selectedElements = new ArrayList<>();
|
|
- private final JTree tree = new JTree();
|
|
|
|
|
|
+ private final JTree categoryTree = new JTree();
|
|
/******************************************
|
|
/******************************************
|
|
************* Right Container*************
|
|
************* Right Container*************
|
|
******************************************
|
|
******************************************
|
|
@@ -338,6 +338,7 @@ public class GUI{
|
|
initialize();
|
|
initialize();
|
|
updateCategories(model.getCategories());
|
|
updateCategories(model.getCategories());
|
|
updCon = new UpdateController(model, controller);
|
|
updCon = new UpdateController(model, controller);
|
|
|
|
+ control.OnCategoryChanged.addListener(() -> this.updateCategoryUI(model.getCategories()));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -728,8 +729,8 @@ public class GUI{
|
|
} catch (Exception e2) {
|
|
} catch (Exception e2) {
|
|
System.out.println(e2.getMessage());
|
|
System.out.println(e2.getMessage());
|
|
}
|
|
}
|
|
-
|
|
|
|
- tree.repaint();
|
|
|
|
|
|
+ categoryTree.revalidate();
|
|
|
|
+ categoryTree.repaint();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -1540,7 +1541,7 @@ public class GUI{
|
|
****************/
|
|
****************/
|
|
|
|
|
|
// Override Key Actions
|
|
// Override Key Actions
|
|
- inputMap = tree.getInputMap();
|
|
|
|
|
|
+ inputMap = categoryTree.getInputMap();
|
|
inputMap.put(KeyStroke.getKeyStroke("control C"), cntrlCDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control C"), cntrlCDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control V"), cntrlVDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control V"), cntrlVDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control X"), cntrlXDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control X"), cntrlXDown);
|
|
@@ -1585,9 +1586,9 @@ public class GUI{
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- tree.setCellRenderer(customRenderer);
|
|
|
|
|
|
+ categoryTree.setCellRenderer(customRenderer);
|
|
|
|
|
|
- tree.addMouseMotionListener(new MouseMotionAdapter() {
|
|
|
|
|
|
+ categoryTree.addMouseMotionListener(new MouseMotionAdapter() {
|
|
|
|
|
|
public void mouseDragged(MouseEvent e){
|
|
public void mouseDragged(MouseEvent e){
|
|
checkForDragAndDrop(e);
|
|
checkForDragAndDrop(e);
|
|
@@ -1662,7 +1663,7 @@ public class GUI{
|
|
}});
|
|
}});
|
|
|
|
|
|
|
|
|
|
- tree.addMouseListener(new MouseAdapter() {
|
|
|
|
|
|
+ categoryTree.addMouseListener(new MouseAdapter() {
|
|
|
|
|
|
public void mouseReleased(MouseEvent e) {
|
|
public void mouseReleased(MouseEvent e) {
|
|
try {
|
|
try {
|
|
@@ -1754,16 +1755,16 @@ public class GUI{
|
|
editItem.setEnabled(false);
|
|
editItem.setEnabled(false);
|
|
editItem.addActionListener(actionEvent -> {
|
|
editItem.addActionListener(actionEvent -> {
|
|
});
|
|
});
|
|
- tree.addMouseListener(new MouseAdapter() {
|
|
|
|
|
|
+ categoryTree.addMouseListener(new MouseAdapter() {
|
|
|
|
|
|
public void mousePressed(MouseEvent e) {
|
|
public void mousePressed(MouseEvent e) {
|
|
try {
|
|
try {
|
|
- actualObjectClicked = tree
|
|
|
|
|
|
+ actualObjectClicked = categoryTree
|
|
.getPathForLocation(e.getX(), e.getY())
|
|
.getPathForLocation(e.getX(), e.getY())
|
|
.getLastPathComponent().toString();
|
|
.getLastPathComponent().toString();
|
|
// if an Object was selected, the porperties are shown in
|
|
// if an Object was selected, the porperties are shown in
|
|
// the table
|
|
// the table
|
|
- DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree
|
|
|
|
|
|
+ DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) categoryTree
|
|
.getPathForLocation(e.getX(), e.getY())
|
|
.getPathForLocation(e.getX(), e.getY())
|
|
.getLastPathComponent();
|
|
.getLastPathComponent();
|
|
if (selectedNode.getLevel() == 2) {
|
|
if (selectedNode.getLevel() == 2) {
|
|
@@ -1845,7 +1846,7 @@ public class GUI{
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- scrollPane1.setViewportView(tree);
|
|
|
|
|
|
+ scrollPane1.setViewportView(categoryTree);
|
|
|
|
|
|
scrollPane1.setColumnHeaderView(panel);
|
|
scrollPane1.setColumnHeaderView(panel);
|
|
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
|
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
|
@@ -1995,7 +1996,7 @@ public class GUI{
|
|
|
|
|
|
// Del Button
|
|
// Del Button
|
|
btnDel.addActionListener(actionEvent -> {
|
|
btnDel.addActionListener(actionEvent -> {
|
|
- Object nodeInfo = tree.getLastSelectedPathComponent();
|
|
|
|
|
|
+ Object nodeInfo = categoryTree.getLastSelectedPathComponent();
|
|
if (nodeInfo != null) {
|
|
if (nodeInfo != null) {
|
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) nodeInfo;
|
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) nodeInfo;
|
|
String nodeName = selectedNode.getUserObject().toString();
|
|
String nodeName = selectedNode.getUserObject().toString();
|
|
@@ -2029,7 +2030,7 @@ public class GUI{
|
|
JOptionPane.showMessageDialog(holegJFrame,
|
|
JOptionPane.showMessageDialog(holegJFrame,
|
|
selectObjBeforeErase);
|
|
selectObjBeforeErase);
|
|
}
|
|
}
|
|
- tree.repaint();
|
|
|
|
|
|
+ categoryTree.repaint();
|
|
});
|
|
});
|
|
btnDel.setIcon(new ImageIcon(ImageImport.loadImage("Images/minus.png", 16, 16)));
|
|
btnDel.setIcon(new ImageIcon(ImageImport.loadImage("Images/minus.png", 16, 16)));
|
|
btnDel.setToolTipText("<html><b>Delete</b><br>Removes a Category or a Category Item.</html>");
|
|
btnDel.setToolTipText("<html><b>Delete</b><br>Removes a Category or a Category Item.</html>");
|
|
@@ -2081,7 +2082,7 @@ public class GUI{
|
|
try {
|
|
try {
|
|
controller.loadFile(file.getAbsolutePath());
|
|
controller.loadFile(file.getAbsolutePath());
|
|
canvas.repaint();
|
|
canvas.repaint();
|
|
- tree.repaint();
|
|
|
|
|
|
+ categoryTree.repaint();
|
|
controller.calculateStateAndVisualForCurrentTimeStep();
|
|
controller.calculateStateAndVisualForCurrentTimeStep();
|
|
} catch (IOException | ArchiveException e) {
|
|
} catch (IOException | ArchiveException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -2295,21 +2296,21 @@ public class GUI{
|
|
openMenu.addActionListener(actionEvent -> {
|
|
openMenu.addActionListener(actionEvent -> {
|
|
new AddOnWindow(holegJFrame, controller);
|
|
new AddOnWindow(holegJFrame, controller);
|
|
});
|
|
});
|
|
- openMenu.setAccelerator(KeyStroke.getKeyStroke('N', Toolkit.getDefaultToolkit ().getMenuShortcutKeyMaskEx()));
|
|
|
|
|
|
+ openMenu.setAccelerator(KeyStroke.getKeyStroke('N', Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask()));
|
|
menuWindow.add(openMenu);
|
|
menuWindow.add(openMenu);
|
|
//Outliner
|
|
//Outliner
|
|
JMenuItem openOutliner = new JMenuItem("Open Outliner", new ImageIcon(ImageImport.loadImage("/Button_Images/iconOutliner.png").getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)));
|
|
JMenuItem openOutliner = new JMenuItem("Open Outliner", new ImageIcon(ImageImport.loadImage("/Button_Images/iconOutliner.png").getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)));
|
|
openOutliner.addActionListener(actionEvent -> {
|
|
openOutliner.addActionListener(actionEvent -> {
|
|
outlinerList.add(new Outliner(holegJFrame, model, controller));
|
|
outlinerList.add(new Outliner(holegJFrame, model, controller));
|
|
});
|
|
});
|
|
- openOutliner.setAccelerator(KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit ().getMenuShortcutKeyMaskEx()));
|
|
|
|
|
|
+ openOutliner.setAccelerator(KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask()));
|
|
menuWindow.add(openOutliner);
|
|
menuWindow.add(openOutliner);
|
|
//FlexWindow
|
|
//FlexWindow
|
|
JMenuItem openFlexMenuItem = new JMenuItem("Open Flexibility Panel", new ImageIcon(ImageImport.loadImage("/Button_Images/iconAlgo.png").getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)));
|
|
JMenuItem openFlexMenuItem = new JMenuItem("Open Flexibility Panel", new ImageIcon(ImageImport.loadImage("/Button_Images/iconAlgo.png").getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)));
|
|
openFlexMenuItem.addActionListener(actionEvent -> {
|
|
openFlexMenuItem.addActionListener(actionEvent -> {
|
|
flexList.add(new FlexWindow(holegJFrame, controller));
|
|
flexList.add(new FlexWindow(holegJFrame, controller));
|
|
});
|
|
});
|
|
- openFlexMenuItem.setAccelerator(KeyStroke.getKeyStroke('L', Toolkit.getDefaultToolkit ().getMenuShortcutKeyMaskEx()));
|
|
|
|
|
|
+ openFlexMenuItem.setAccelerator(KeyStroke.getKeyStroke('L', Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask()));
|
|
menuWindow.add(openFlexMenuItem);
|
|
menuWindow.add(openFlexMenuItem);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2418,7 +2419,7 @@ public class GUI{
|
|
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- tree.setModel(treemodel);
|
|
|
|
|
|
+ categoryTree.setModel(treemodel);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2427,8 +2428,8 @@ public class GUI{
|
|
* @param categories
|
|
* @param categories
|
|
* the Categories
|
|
* the Categories
|
|
*/
|
|
*/
|
|
- public void onChange(ArrayList<Category> categories) {
|
|
|
|
- DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
|
|
|
|
|
|
+ public void updateCategoryUI(ArrayList<Category> categories) {
|
|
|
|
+ DefaultTreeModel model = (DefaultTreeModel) categoryTree.getModel();
|
|
updateCategories(categories);
|
|
updateCategories(categories);
|
|
model.reload();
|
|
model.reload();
|
|
}
|
|
}
|