|
|
@ -49,14 +49,14 @@ import settings.*; |
|
|
*/ |
|
|
*/ |
|
|
public class GUIGraphHandler extends JPanel implements MouseListener |
|
|
public class GUIGraphHandler extends JPanel implements MouseListener |
|
|
{ |
|
|
{ |
|
|
private int counter = 0; |
|
|
|
|
|
|
|
|
|
|
|
private boolean canDelete; |
|
|
private boolean canDelete; |
|
|
|
|
|
|
|
|
private JTabbedPane theTabs; |
|
|
private JTabbedPane theTabs; |
|
|
private JPopupMenu backMenu, graphMenu; |
|
|
private JPopupMenu backMenu, graphMenu; |
|
|
|
|
|
|
|
|
private ArrayList<Graph> models; |
|
|
|
|
|
private ArrayList<GraphOptions> options; |
|
|
|
|
|
|
|
|
private java.util.List<Graph> models; |
|
|
|
|
|
private java.util.List<GraphOptions> options; |
|
|
|
|
|
|
|
|
private GUIPlugin plug; |
|
|
private GUIPlugin plug; |
|
|
|
|
|
|
|
|
@ -125,8 +125,6 @@ public class GUIGraphHandler extends JPanel implements MouseListener |
|
|
|
|
|
|
|
|
models = new ArrayList<Graph>(); |
|
|
models = new ArrayList<Graph>(); |
|
|
options = new ArrayList<GraphOptions>(); |
|
|
options = new ArrayList<GraphOptions>(); |
|
|
counter = 0; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void initComponents() |
|
|
private void initComponents() |
|
|
@ -399,7 +397,6 @@ public class GUIGraphHandler extends JPanel implements MouseListener |
|
|
models.remove(theTabs.getSelectedIndex()); |
|
|
models.remove(theTabs.getSelectedIndex()); |
|
|
options.remove(theTabs.getSelectedIndex()); |
|
|
options.remove(theTabs.getSelectedIndex()); |
|
|
theTabs.remove(graph); |
|
|
theTabs.remove(graph); |
|
|
counter--; |
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
deleteGraph.putValue(Action.NAME, "Delete graph"); |
|
|
deleteGraph.putValue(Action.NAME, "Delete graph"); |
|
|
@ -550,8 +547,27 @@ public class GUIGraphHandler extends JPanel implements MouseListener |
|
|
|
|
|
|
|
|
public int addGraph(Graph m) |
|
|
public int addGraph(Graph m) |
|
|
{ |
|
|
{ |
|
|
return addGraph(m, "Graph " + (counter + 1)); |
|
|
|
|
|
|
|
|
String name = ""; |
|
|
|
|
|
|
|
|
|
|
|
boolean nameNew; |
|
|
|
|
|
int counter = 1; |
|
|
|
|
|
|
|
|
|
|
|
while (true) |
|
|
|
|
|
{ |
|
|
|
|
|
name = "Graph " + (counter); |
|
|
|
|
|
nameNew = true; |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < theTabs.getComponentCount(); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if(theTabs.getTitleAt(i).equals(name)) |
|
|
|
|
|
nameNew = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (nameNew) |
|
|
|
|
|
return addGraph(m, name); |
|
|
|
|
|
|
|
|
|
|
|
counter++; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public int addGraph(Graph m, String tabName) |
|
|
public int addGraph(Graph m, String tabName) |
|
|
@ -575,9 +591,6 @@ public class GUIGraphHandler extends JPanel implements MouseListener |
|
|
// make this new tab the default selection |
|
|
// make this new tab the default selection |
|
|
theTabs.setSelectedIndex(theTabs.indexOfComponent(m)); |
|
|
theTabs.setSelectedIndex(theTabs.indexOfComponent(m)); |
|
|
|
|
|
|
|
|
// increase the graph counter |
|
|
|
|
|
counter++; |
|
|
|
|
|
|
|
|
|
|
|
// return the index of the component |
|
|
// return the index of the component |
|
|
return index; |
|
|
return index; |
|
|
} |
|
|
} |
|
|
|