Java Code Examples for org.jgraph.graph.GraphConstants#setAutoSize()
The following examples show how to use
org.jgraph.graph.GraphConstants#setAutoSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OverviewGraphModel.java From CQL with GNU Affero General Public License v3.0 | 6 votes |
/** * * * @param vertex * * @return */ private static AttributeMap commonVertexAttributes(OverviewVertex vertex) { AttributeMap map = new AttributeMap(); GraphConstants.setAutoSize(map, true); GraphConstants.setInset(map, 5); GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12)); GraphConstants.setOpaque(map, true); ImageIcon icon = vertex.getThumbnail(); if (icon != null) { GraphConstants.setIcon(map, vertex.getThumbnail()); } else { GraphConstants.setIcon(map, new ImageIcon()); } GraphConstants.setVerticalTextPosition(map, SwingConstants.TOP); return map; }
Example 2
Source File: GraphVisitor.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public DefaultGraphCell createVertex(String name, double x, double y, Color bg, boolean raised) { // Create vertex with the given name DefaultGraphCell cell = new DefaultGraphCell(name); GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createEtchedBorder()); GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(x, y, 10, 10)); GraphConstants.setResize(cell.getAttributes(), true); GraphConstants.setAutoSize(cell.getAttributes(), true); // Set fill color if (bg != null) { GraphConstants.setOpaque(cell.getAttributes(), true); GraphConstants.setGradientColor(cell.getAttributes(), bg); } // Set raised border if (raised) GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createRaisedBevelBorder()); else // Set black border GraphConstants.setBorderColor(cell.getAttributes(), Color.black); return cell; }
Example 3
Source File: Overview.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
/** * Add one one of our verticies to the overview * * @param theNode The node to be added */ public void addVertex(OverviewVertex theNode) { // The next call will fire a rendering. At this point, the model adapter // does not know // where it should place the node, and picks a default value. This will // cause an update // in our Node's x and y coordinates, making it forget where it was // initialized. // We store it's initializeded position so as not to lose them in the // first rendering. int initX = theNode.getX(); int initY = theNode.getY(); // Make sure the name is unique; increment it if not. if (isNameUsed(theNode.getName())) { theNode.setName(getNewName(theNode.getName())); } // Add our sketch to the graph getGraphLayoutCache().insert(theNode); // Add our vertex to the appropriate map if (theNode instanceof SketchNode) { _sketchNodes.put(theNode.toString(), (SketchNode) theNode); _appFrame.getInfoTreeUI().addSketch((SketchNode) theNode); } else if (theNode instanceof ViewNode) { _viewNodes.put(theNode.toString(), (ViewNode) theNode); _appFrame.getInfoTreeUI().addView((ViewNode) theNode); } // Set the on-screen position of our sketch to the attributes of the // sketch AttributeMap nAttribs = theNode.getAttributes(); GraphConstants.setAutoSize(nAttribs, true); GraphConstants.setBounds(nAttribs, new Rectangle2D.Double(initX, initY, 0, 0)); // Reload the graph to reflect the new changes refresh(theNode); }
Example 4
Source File: ViewGraphModel.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
/** * Returns the attribute map for vertices (i.e. EntityNodes). * * @return a map of attributes to be used for new vertices */ private AttributeMap vertexAttributes() { AttributeMap map = new AttributeMap(); GraphConstants.setAutoSize(map, true); GraphConstants.setInset(map, 5); GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "entity_border"), getIntWidth(_mode + "entity_border", 1))); GraphConstants.setBackground(map, getColor(_mode + "entity_bg")); GraphConstants.setForeground(map, getColor(_mode + "entity_fg")); GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12)); GraphConstants.setOpaque(map, true); return map; }
Example 5
Source File: ViewGraphModel.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
/** * Returns the attribute map for virtual vertices (i.e. constaint nodes). * * @return a map of attributes to be used for new virtual vertices */ private AttributeMap virtualVertexAttributes() { AttributeMap map = new AttributeMap(); GraphConstants.setAutoSize(map, true); GraphConstants.setInset(map, 5); GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "constraint_border"), getIntWidth(_mode + "constraint_border", 1))); GraphConstants.setBackground(map, getColor(_mode + "constraint_bg")); GraphConstants.setForeground(map, getColor(_mode + "constraint_fg")); GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12)); GraphConstants.setOpaque(map, true); return map; }
Example 6
Source File: SketchGraphModel.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
/** * Returns the attribute map for vertices (i.e. EntityNodes). * * @return a map of attributes to be used for new vertices */ private AttributeMap vertexAttributes() { AttributeMap map = new AttributeMap(); GraphConstants.setAutoSize(map, true); GraphConstants.setInset(map, 5); GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "entity_border"), getIntWidth(_mode + "entity_border", 1))); GraphConstants.setBackground(map, getColor(_mode + "entity_bg")); GraphConstants.setForeground(map, getColor(_mode + "entity_fg")); GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12)); GraphConstants.setOpaque(map, true); return map; }
Example 7
Source File: SketchGraphModel.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
/** * Returns the attribute map for virtual vertices (i.e. constaint nodes). * * @return a map of attributes to be used for new virtual vertices */ private AttributeMap virtualVertexAttributes() { AttributeMap map = new AttributeMap(); GraphConstants.setAutoSize(map, true); GraphConstants.setInset(map, 5); GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "constraint_border"), getIntWidth(_mode + "constraint_border", 1))); GraphConstants.setBackground(map, getColor(_mode + "constraint_bg")); GraphConstants.setForeground(map, getColor(_mode + "constraint_fg")); GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12)); GraphConstants.setOpaque(map, true); return map; }
Example 8
Source File: TableCell.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
public TableCell(Table aTable) { super(aTable); GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(20, 20, 40, 20)); GraphConstants.setGradientColor(getAttributes(), Color.orange); GraphConstants.setOpaque(getAttributes(), false); GraphConstants.setAutoSize(getAttributes(), true); GraphConstants.setEditable(getAttributes(), true); addPort(); }
Example 9
Source File: ViewCell.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
public ViewCell(View aTable) { super(aTable); GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(20, 20, 40, 20)); GraphConstants.setGradientColor(getAttributes(), Color.orange); GraphConstants.setOpaque(getAttributes(), false); GraphConstants.setAutoSize(getAttributes(), true); GraphConstants.setEditable(getAttributes(), true); addPort(); }
Example 10
Source File: SubjectAreaCell.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
public SubjectAreaCell(SubjectArea aArea) { super(aArea); GraphConstants.setAutoSize(getAttributes(), true); GraphConstants.setEditable(getAttributes(), true); GraphConstants.setInset(getAttributes(), 20); GraphConstants.setGroupOpaque(getAttributes(), true); }
Example 11
Source File: CommentCell.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
public CommentCell(Comment aTable) { super(aTable); GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(20, 20, 40, 20)); GraphConstants.setOpaque(getAttributes(), false); GraphConstants.setAutoSize(getAttributes(), true); GraphConstants.setResize(getAttributes(), true); GraphConstants.setEditable(getAttributes(), true); }