|
@@ -111,9 +111,10 @@ public class GUI<E> implements CategoryListener {
|
|
private final JMenuItem mntmOpen = new JMenuItem("Open");
|
|
private final JMenuItem mntmOpen = new JMenuItem("Open");
|
|
private final JMenuItem mntmNew = new JMenuItem("New");
|
|
private final JMenuItem mntmNew = new JMenuItem("New");
|
|
private final JMenuItem mntmSave = new JMenuItem("Save");
|
|
private final JMenuItem mntmSave = new JMenuItem("Save");
|
|
- private final JMenuItem aboutUs = new JMenuItem("About Us");
|
|
|
|
- private final JMenuItem canvasSize = new JMenuItem("View Size");
|
|
|
|
- private final JMenuItem background = new JMenuItem("Background Image");
|
|
|
|
|
|
+ private final JMenuItem mntmAboutUs = new JMenuItem("About Us");
|
|
|
|
+ private final JMenuItem mntmCanvasSize = new JMenuItem("View Size");
|
|
|
|
+ private final JMenuItem mntmBackground = new JMenuItem("Background Image");
|
|
|
|
+ private final JMenuItem mntmSplitView = new JMenuItem("Split View");
|
|
private final JSplitPane splitPane = new JSplitPane();
|
|
private final JSplitPane splitPane = new JSplitPane();
|
|
private final JSplitPane splitPane1 = new JSplitPane();
|
|
private final JSplitPane splitPane1 = new JSplitPane();
|
|
private final JSplitPane splitPaneCanvasConsole = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
private final JSplitPane splitPaneCanvasConsole = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
@@ -123,15 +124,12 @@ public class GUI<E> implements CategoryListener {
|
|
// private final JScrollPane holonSP = new JScrollPane();
|
|
// private final JScrollPane holonSP = new JScrollPane();
|
|
private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
private final JTabbedPane tabbedPane2 = new JTabbedPane(JTabbedPane.TOP);
|
|
private final JTabbedPane tabbedPane2 = new JTabbedPane(JTabbedPane.TOP);
|
|
- private final JButton splitButton = new JButton("Split View Test");
|
|
|
|
private JSplitPane tempSplit;
|
|
private JSplitPane tempSplit;
|
|
private boolean initSplit = true;
|
|
private boolean initSplit = true;
|
|
|
|
|
|
private JPopupMenu popmenuEdit = new JPopupMenu();
|
|
private JPopupMenu popmenuEdit = new JPopupMenu();
|
|
private JMenuItem editItem = new JMenuItem("Edit Object");
|
|
private JMenuItem editItem = new JMenuItem("Edit Object");
|
|
private String catOfObjToBeEdited;
|
|
private String catOfObjToBeEdited;
|
|
- private final JScrollPane statTab = new JScrollPane();
|
|
|
|
-
|
|
|
|
private FlexiblePane flexPane;
|
|
private FlexiblePane flexPane;
|
|
private StatPanel2 statSplitPane;
|
|
private StatPanel2 statSplitPane;
|
|
private JScrollPane statScrollPane;
|
|
private JScrollPane statScrollPane;
|
|
@@ -431,23 +429,26 @@ public class GUI<E> implements CategoryListener {
|
|
controller.delObjUpperNode(cps, uNC.upperNode);
|
|
controller.delObjUpperNode(cps, uNC.upperNode);
|
|
// Remove UpperNodeTab if UpperNode deleted
|
|
// Remove UpperNodeTab if UpperNode deleted
|
|
if (cps instanceof CpsUpperNode) {
|
|
if (cps instanceof CpsUpperNode) {
|
|
|
|
+ boolean splitView = false;
|
|
for (int i = 4; i < tabbedPane.getTabCount(); i++) {
|
|
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) {
|
|
|
|
+ splitView = true;
|
|
|
|
+ } else if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i))
|
|
|
|
+ .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
((ButtonTabComponent) tabbedPane.getTabComponentAt(i)).removeTabs();
|
|
((ButtonTabComponent) tabbedPane.getTabComponentAt(i)).removeTabs();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// If SplitView is on and the view on
|
|
// If SplitView is on and the view on
|
|
// tabbedPane2 is the deleted upperNode
|
|
// tabbedPane2 is the deleted upperNode
|
|
- if (tabbedPane2.getTabCount() > 0
|
|
|
|
- && ((JScrollPane) tabbedPane2.getSelectedComponent()).getViewport()
|
|
|
|
- .getComponent(0) instanceof UpperNodeCanvas
|
|
|
|
- && ((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getSelectedComponent())
|
|
|
|
- .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
|
|
- ((ButtonTabComponent) tabbedPane.getTabComponentAt(tabbedPane2.getSelectedIndex()))
|
|
|
|
- .removeTabs();
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (splitView
|
|
|
|
+ && ((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getSelectedComponent())
|
|
|
|
+ .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
|
|
+ ((ButtonTabComponent) tabbedPane
|
|
|
|
+ .getTabComponentAt(tabbedPane2.getSelectedIndex())).removeTabs();
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e2) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -465,23 +466,25 @@ public class GUI<E> implements CategoryListener {
|
|
controller.delCanvasObject(cps, save);
|
|
controller.delCanvasObject(cps, save);
|
|
// Remove UpperNodeTab if UpperNode deleted
|
|
// Remove UpperNodeTab if UpperNode deleted
|
|
if (cps instanceof CpsUpperNode) {
|
|
if (cps instanceof CpsUpperNode) {
|
|
|
|
+ boolean splitView = false;
|
|
for (int i = 4; i < tabbedPane.getTabCount(); i++) {
|
|
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) {
|
|
|
|
+ splitView = true;
|
|
|
|
+ } else if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport()
|
|
|
|
+ .getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
((ButtonTabComponent) tabbedPane.getTabComponentAt(i)).removeTabs();
|
|
((ButtonTabComponent) tabbedPane.getTabComponentAt(i)).removeTabs();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// If SplitView is on and the view on
|
|
// If SplitView is on and the view on
|
|
// tabbedPane2 is the deleted upperNode
|
|
// tabbedPane2 is the deleted upperNode
|
|
- if (tabbedPane2.getTabCount() > 0
|
|
|
|
- && ((JScrollPane) tabbedPane2.getSelectedComponent()).getViewport()
|
|
|
|
- .getComponent(0) instanceof UpperNodeCanvas
|
|
|
|
- && ((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getSelectedComponent())
|
|
|
|
- .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
|
|
- ((ButtonTabComponent) tabbedPane.getTabComponentAt(tabbedPane2.getSelectedIndex()))
|
|
|
|
- .removeTabs();
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (splitView && ((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getSelectedComponent())
|
|
|
|
+ .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
|
|
|
|
+ ((ButtonTabComponent) tabbedPane.getTabComponentAt(tabbedPane2.getSelectedIndex()))
|
|
|
|
+ .removeTabs();
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e2) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -697,8 +700,8 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
menuBar.add(mnNewMenuView);
|
|
menuBar.add(mnNewMenuView);
|
|
|
|
|
|
- mnNewMenuView.add(canvasSize);
|
|
|
|
- canvasSize.addActionListener(new ActionListener() {
|
|
|
|
|
|
+ mnNewMenuView.add(mntmCanvasSize);
|
|
|
|
+ mntmCanvasSize.addActionListener(new ActionListener() {
|
|
@Override
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
JPanel myPanel = new JPanel();
|
|
JPanel myPanel = new JPanel();
|
|
@@ -739,10 +742,53 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- mnNewMenuView.add(canvasSize);
|
|
|
|
|
|
+ mnNewMenuView.add(mntmCanvasSize);
|
|
|
|
+ mnNewMenuView.add(mntmSplitView);
|
|
|
|
+
|
|
|
|
+ // Split View
|
|
|
|
+ mntmSplitView.addActionListener(new ActionListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
+ if (splitPaneCanvasConsole.getLeftComponent() instanceof JSplitPane) {
|
|
|
|
+ initSplit = true;
|
|
|
|
+ Component tempC = tabbedPane2.getSelectedComponent();
|
|
|
|
+ tabbedPane.setComponentAt(tabbedPane2.getSelectedIndex(), tempC);
|
|
|
|
+ tabbedPane2.removeAll();
|
|
|
|
+ splitPaneCanvasConsole.setLeftComponent(tabbedPane);
|
|
|
|
+ } else {
|
|
|
|
+ for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
|
|
|
+ tabbedPane2.addTab(tabbedPane.getTitleAt(i), null);
|
|
|
|
+ if (i >= 4) {
|
|
|
|
+ // tabbedPane2.setTabComponentAt(tabbedPane.getTabCount()
|
|
|
|
+ // - 1,
|
|
|
|
+ // new ButtonTabComponent(tabbedPane, tabbedPane2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (tabbedPane.getSelectedComponent() == statScrollPane) {
|
|
|
|
+ tabbedPane.setComponentAt(0, null);
|
|
|
|
+ tabbedPane2.setComponentAt(0, canvasSP);
|
|
|
|
+ tabbedPane2.setSelectedIndex(0);
|
|
|
|
+ } else {
|
|
|
|
+ tabbedPane.setComponentAt(1, null);
|
|
|
|
+ tabbedPane2.setComponentAt(1, statScrollPane);
|
|
|
|
+ tabbedPane2.setSelectedIndex(1);
|
|
|
|
+ }
|
|
|
|
+ tempSplit = new JSplitPane();
|
|
|
|
+ tempSplit.setBorder(null);
|
|
|
|
+ tempSplit.setRightComponent(tabbedPane2);
|
|
|
|
+ tempSplit.setLeftComponent(tabbedPane);
|
|
|
|
+ tempSplit.setDividerLocation(tabbedPane.getWidth() / 2);
|
|
|
|
+ tempSplit.setResizeWeight(0.9);
|
|
|
|
+ splitPaneCanvasConsole.setLeftComponent(tempSplit);
|
|
|
|
+ initSplit = false;
|
|
|
|
+ }
|
|
|
|
+ contentPane.updateUI();
|
|
|
|
+ }
|
|
|
|
|
|
- mnNewMenuView.add(background);
|
|
|
|
- background.addActionListener(new ActionListener() {
|
|
|
|
|
|
+ });
|
|
|
|
+ mnNewMenuView.add(mntmBackground);
|
|
|
|
+
|
|
|
|
+ mntmBackground.addActionListener(new ActionListener() {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
@@ -787,57 +833,14 @@ public class GUI<E> implements CategoryListener {
|
|
splitPane_1.setLeftComponent(lblHolonBodySize);
|
|
splitPane_1.setLeftComponent(lblHolonBodySize);
|
|
|
|
|
|
mnAlgorithm.add(simMenu);
|
|
mnAlgorithm.add(simMenu);
|
|
-
|
|
|
|
|
|
+
|
|
menuBar.add(mnAlgorithm);
|
|
menuBar.add(mnAlgorithm);
|
|
-
|
|
|
|
|
|
+
|
|
menuBar.add(mnHelp);
|
|
menuBar.add(mnHelp);
|
|
|
|
|
|
- mnHelp.add(aboutUs);
|
|
|
|
|
|
+ mnHelp.add(mntmAboutUs);
|
|
|
|
|
|
- // Testing
|
|
|
|
- menuBar.add(splitButton);
|
|
|
|
- // Split View
|
|
|
|
- splitButton.addActionListener(new ActionListener() {
|
|
|
|
- @Override
|
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
|
- if (splitPaneCanvasConsole
|
|
|
|
- .getLeftComponent() instanceof JSplitPane) {
|
|
|
|
- initSplit = true;
|
|
|
|
- Component tempC = tabbedPane2.getSelectedComponent();
|
|
|
|
- tabbedPane.setComponentAt(tabbedPane2.getSelectedIndex(), tempC);
|
|
|
|
- tabbedPane2.removeAll();
|
|
|
|
- splitPaneCanvasConsole.setLeftComponent(tabbedPane);
|
|
|
|
- } else {
|
|
|
|
- for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
|
|
|
- tabbedPane2.addTab(tabbedPane.getTitleAt(i), null);
|
|
|
|
- if (i >= 4) {
|
|
|
|
- // tabbedPane2.setTabComponentAt(tabbedPane.getTabCount()
|
|
|
|
- // - 1,
|
|
|
|
- // new ButtonTabComponent(tabbedPane, tabbedPane2));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (tabbedPane.getSelectedComponent() == statScrollPane) {
|
|
|
|
- tabbedPane.setComponentAt(0, null);
|
|
|
|
- tabbedPane2.setComponentAt(0, canvasSP);
|
|
|
|
- tabbedPane2.setSelectedIndex(0);
|
|
|
|
- } else {
|
|
|
|
- tabbedPane.setComponentAt(1, null);
|
|
|
|
- tabbedPane2.setComponentAt(1, statScrollPane);
|
|
|
|
- tabbedPane2.setSelectedIndex(1);
|
|
|
|
- }
|
|
|
|
- tempSplit = new JSplitPane();
|
|
|
|
- tempSplit.setBorder(null);
|
|
|
|
- tempSplit.setRightComponent(tabbedPane2);
|
|
|
|
- tempSplit.setLeftComponent(tabbedPane);
|
|
|
|
- tempSplit.setDividerLocation(tabbedPane.getWidth() / 2);
|
|
|
|
- tempSplit.setResizeWeight(0.9);
|
|
|
|
- splitPaneCanvasConsole.setLeftComponent(tempSplit);
|
|
|
|
- initSplit = false;
|
|
|
|
- }
|
|
|
|
- contentPane.updateUI();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
|
|
|
@@ -1530,7 +1533,7 @@ public class GUI<E> implements CategoryListener {
|
|
* Pop up - About Us with some important information about the
|
|
* Pop up - About Us with some important information about the
|
|
* developers, source and programming stuff
|
|
* developers, source and programming stuff
|
|
*/
|
|
*/
|
|
- aboutUs.addMouseListener(new MouseAdapter() {
|
|
|
|
|
|
+ mntmAboutUs.addMouseListener(new MouseAdapter() {
|
|
@Override
|
|
@Override
|
|
public void mousePressed(MouseEvent e) {
|
|
public void mousePressed(MouseEvent e) {
|
|
aboutUsPopUp = new AboutUsPopUp();
|
|
aboutUsPopUp = new AboutUsPopUp();
|
|
@@ -2118,9 +2121,9 @@ public class GUI<E> implements CategoryListener {
|
|
mnNewMenuOptions.setText(tempArray[9]);
|
|
mnNewMenuOptions.setText(tempArray[9]);
|
|
mntmResetCategory.setText(tempArray[10]);
|
|
mntmResetCategory.setText(tempArray[10]);
|
|
mnNewMenuView.setText(tempArray[11]);
|
|
mnNewMenuView.setText(tempArray[11]);
|
|
- canvasSize.setText(tempArray[12]);
|
|
|
|
|
|
+ mntmCanvasSize.setText(tempArray[12]);
|
|
mnHelp.setText(tempArray[13]);
|
|
mnHelp.setText(tempArray[13]);
|
|
- aboutUs.setText(tempArray[14]);
|
|
|
|
|
|
+ mntmAboutUs.setText(tempArray[14]);
|
|
mntmEditEdges.setText(tempArray[15]);
|
|
mntmEditEdges.setText(tempArray[15]);
|
|
mnLanguage.setText(tempArray[16]);
|
|
mnLanguage.setText(tempArray[16]);
|
|
canvas.updateLanguages();
|
|
canvas.updateLanguages();
|
|
@@ -2247,7 +2250,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
JScrollPane sp = new JScrollPane(unc);
|
|
JScrollPane sp = new JScrollPane(unc);
|
|
sp.setBorder(null);
|
|
sp.setBorder(null);
|
|
- //Selected tabbed Pane = tabbedPane or tabbedPane2
|
|
|
|
|
|
+ // Selected tabbed Pane = tabbedPane or tabbedPane2
|
|
if (tabTemp == tabbedPane) {
|
|
if (tabTemp == tabbedPane) {
|
|
tabbedPane.add(temp.getName(), sp);
|
|
tabbedPane.add(temp.getName(), sp);
|
|
tabbedPane.setSelectedComponent(sp);
|
|
tabbedPane.setSelectedComponent(sp);
|