SelectingTool.isOnlySuperVerticesSelection = b;
}
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
IGraphPane graphPane = Tool.getGraphPane();
Point mouseLocation = e.getPoint();
Set<IVertex> vertices = graphPane.getSelectedVertices();
for (IVertex v : vertices) {
if (v.hitTest(mouseLocation)) {
moveOn(mouseLocation);
return;
}
}
graphPane.deselectVertices();
Set<SimpleVertex> simpleVertices = graphPane.getGraphModel().getSimpleVertices();
for (SimpleVertex v : simpleVertices) {
if (v.hitTest(mouseLocation)) {
if (!SelectingTool.isOnlySuperVerticesSelection() ||
v.getSuperVertex() == null || v.getSuperVertex().isHidden()) {
graphPane.selectVertex(v);
moveOn(mouseLocation);
return;
}
}
}
Set<SuperVertex> superVertices = graphPane.getGraphModel().getSuperVertices();
for (SuperVertex v : superVertices) {
/*boolean leftX = v.leftBorderTest(mouseLocation);
boolean rightX = v.rightBorderTest(mouseLocation);
boolean topY = v.topBorderTest(mouseLocation);
boolean bottomY = v.bottomBorderTest(mouseLocation);
if (leftX || rightX || topY || bottomY) {
resizeOn(mouseLocation, v, leftX, rightX, topY, bottomY);
} else*/
if (v.hitTest(mouseLocation)) {
graphPane.selectVertex(v);
moveOn(mouseLocation);
return;
}
}
SelectingTool.left = mouseLocation;
} else if (e.getButton() == MouseEvent.BUTTON3) {
IGraphPane graphPane = Tool.getGraphPane();
Point mouseLocation = e.getPoint();
Set<IVertex> vertices = graphPane.getSelectedVertices();
boolean show = false;
Set<SuperVertex> forPopUp = new HashSet<SuperVertex>();
for (IVertex vertex : vertices) {
if (vertex instanceof SuperVertex) {
forPopUp.add((SuperVertex) vertex);
} else if (vertex instanceof SimpleVertex) {
SimpleVertex simple = (SimpleVertex) vertex;
if (simple.getSuperVertex() != null) {
forPopUp.add(simple.getSuperVertex());
}
}
if (vertex.hitTest(mouseLocation)) {
show = true;
}
}
if (show) {
showPopUp(mouseLocation, forPopUp.toArray(new SuperVertex[forPopUp.size()]));
return;
}
/*
if (!SelectingTool.isOnlySuperVerticesSelection()) {
Set<SimpleVertex> simpleVertices = graphPane.getGraphModel().getSimpleVertices();
for (SimpleVertex v : simpleVertices) {
if (v.hitTest(mouseLocation) && v.getSuperVertex() != null) {
showPopUp(mouseLocation, v.getSuperVertex());
return;
}
}
}*/
Set<SuperVertex> superVertices = graphPane.getGraphModel().getSuperVertices();
for (SuperVertex v : superVertices) {
if (v.hitTest(mouseLocation)) {
showPopUp(mouseLocation, v);
return;
}