/*************************************************************************** Title: graphbrowser/GraphView.java Author: Stefan Berghofer, TU Muenchen Options: :tabSize=4:
This class defines the window in which the graph is displayed. It contains methods for handling events such as collapsing / uncollapsing nodes of the graph.
***************************************************************************/
publicvoid paint(Graphics g) {
g.setFont(font);
gra.draw(g); if (highlighted!=null) highlighted.drawBox(g,Color.white);
size = new Dimension(gra.max_x-gra.min_x, gra.max_y-gra.min_y); if (parent_needs_layout) {
parent_needs_layout = false;
getParent().doLayout();
}
}
public Dimension getPreferredSize() { return size;
}
publicvoid mouseMoved(MouseEvent evt) { int x = evt.getX() + gra.min_x; int y = evt.getY() + gra.min_y;
Vertex v2=gra.vertexAt(x,y);
Graphics g=getGraphics();
g.setFont(font);
g.translate(-gra.min_x,-gra.min_y); if (highlighted!=null) {
highlighted.drawBox(g,Color.lightGray);
highlighted=null;
} if (v2!=v) { if (v!=null) v.removeButtons(g); if (v2!=null) v2.drawButtons(g);
v=v2;
}
}
publicvoid mouseDragged(MouseEvent evt) {}
/*****************************************************************/ /* This method is called if successor / predecessor nodes (whose */ /* numbers are stored in Vector c) of a certain node should be */ /* displayed again */ /*****************************************************************/
void uncollapse(Vector c) {
collapsed.removeElement(c);
collapseNodes();
}
/*****************************************************************/ /* This method is called by class TreeBrowser when directories */ /* are collapsed / uncollapsed by the user */ /*****************************************************************/
/*****************************************************************/ /* Inflate node again */ /*****************************************************************/
publicvoid inflateNode(Vector c) {
Enumeration e1;
e1=collapsedDirs.elements(); while (e1.hasMoreElements()) {
Directory d=(Directory)(e1.nextElement()); if (d.collapsed==c) {
tb.selectNode(d.getNode()); return;
}
}
collapsed.removeElement(c);
e1=gra2.getVertices(); while (e1.hasMoreElements()) {
Vertex vx=(Vertex)(e1.nextElement()); if (vx.getUp()==c) vx.setUp(null); if (vx.getDown()==c) vx.setDown(null);
}
int x = vx.getX()-gra.min_x; int y = vx.getY()-gra.min_y; int offset_x = Math.min(scrollp.getHAdjustable().getMaximum(),
Math.max(0,x-vpsize.width/2)); int offset_y = Math.min(scrollp.getVAdjustable().getMaximum(),
Math.max(0,y-vpsize.height/2));
/*****************************************************************/ /* Create new graph with collapsed nodes */ /*****************************************************************/
publicvoid mouseExited(MouseEvent evt) {
Graphics g=getGraphics();
g.setFont(font);
g.translate(-gra.min_x,-gra.min_y); if (highlighted!=null) {
highlighted.drawBox(g,Color.lightGray);
highlighted=null;
} if (v!=null) v.removeButtons(g);
v=null;
}
publicvoid mouseEntered(MouseEvent evt) {}
publicvoid mousePressed(MouseEvent evt) {}
publicvoid mouseReleased(MouseEvent evt) {}
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.