本文整理汇总了Java中org.jgraph.graph.DefaultGraphCell.addPort方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultGraphCell.addPort方法的具体用法?Java DefaultGraphCell.addPort怎么用?Java DefaultGraphCell.addPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgraph.graph.DefaultGraphCell
的用法示例。
在下文中一共展示了DefaultGraphCell.addPort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCell
import org.jgraph.graph.DefaultGraphCell; //导入方法依赖的package包/类
/**
* Creates a new JGraph cell with the specified rendering information.
*
* @param name String that is the cell name.
* @param x Double that is the X coordinate.
* @param y Double that is the Y coordinate.
* @param scale Double that is the scale information.
* @param color Color of the future graph cell.
* @return DMGraph cell generated with the specified rendering information.
* @throws Exception
*/
public static DefaultGraphCell createCell(String name, double x, double y,
double scale, Color color) throws Exception {
DefaultGraphCell cell = new DefaultGraphCell(name);
GraphConstants.setBounds(cell.getAttributes(),
new Rectangle2D.Double(x, y, scale, scale));
GraphConstants.setBorder(cell.getAttributes(),
BorderFactory.createRaisedBevelBorder());
GraphConstants.setOpaque(cell.getAttributes(), true);
cell.addPort(new Point2D.Double(0, 0));
if (color != null) {
GraphConstants.setGradientColor(cell.getAttributes(), color);
} else {
GraphConstants.setGradientColor(cell.getAttributes(), Color.BLUE);
}
return cell;
}
示例2: createVertex
import org.jgraph.graph.DefaultGraphCell; //导入方法依赖的package包/类
public DefaultGraphCell createVertex(String name, double x,
double y, double w, double h, Color bg, boolean raised) {
// Create vertex with the given name
DefaultGraphCell cell = new DefaultGraphCell(name);
/* ob.x = x;
ob.y = y;*/
// System.out.println("adding node:"+ob.toString()+" to cell "+cellCount +"at ("+x+","+y+")");
// Set bounds
GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(
x, y, w, h));
// Set fill color
if (bg != null) {
GraphConstants.setGradientColor(cell.getAttributes(), bg);
GraphConstants.setOpaque(cell.getAttributes(), true);
}
// Set raised border
if (raised)
GraphConstants.setBorder(cell.getAttributes(), BorderFactory
.createRaisedBevelBorder());
else
// Set black border
GraphConstants.setBorderColor(cell.getAttributes(), Color.black);
// Add a Floating Port
cell.addPort();
return cell;
}
示例3: createEdge
import org.jgraph.graph.DefaultGraphCell; //导入方法依赖的package包/类
/**
* Creates a new edge in JGraph.
*
* @param source DefaultGraphCell that is the source for the edge.
* @param target DefaultGraphCell that is the target for the edge.
* @return DefaultGraphCell that was generated to connect the source with
* the target.
* @throws Exception
*/
public static DefaultGraphCell createEdge(DefaultGraphCell source,
DefaultGraphCell target) throws Exception {
DefaultEdge edge = new DefaultEdge();
source.addPort();
edge.setSource(source.getChildAt(source.getChildCount() - 1));
target.addPort();
edge.setTarget(target.getChildAt(target.getChildCount() - 1));
return edge;
}
示例4: adjustLayout
import org.jgraph.graph.DefaultGraphCell; //导入方法依赖的package包/类
private static void adjustLayout(FeatureDefinitionEntry feature, @Nullable Color bg) {
DefaultGraphCell cell = _featureGraphModelAdapter.getVertexCell(feature);
GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(25, 25, 200, 20));
GraphConstants.setAutoSize(cell.getAttributes(), true);
if (bg != null) {
GraphConstants.setBackground(cell.getAttributes(), bg);
GraphConstants.setOpaque(cell.getAttributes(), true);
}
GraphConstants.setBorderColor(cell.getAttributes(), Color.black);
cell.addPort();
}
示例5: createCell
import org.jgraph.graph.DefaultGraphCell; //导入方法依赖的package包/类
private DefaultGraphCell createCell(String name, boolean raised) {
DefaultGraphCell cell = new DefaultGraphCell(name);
cell.addPort();
GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createRaisedBevelBorder());
return cell;
}
示例6: createWeightedEdge
import org.jgraph.graph.DefaultGraphCell; //导入方法依赖的package包/类
/**
* Creates a new weighted edge in JGraph.
*
* @param source DefaultGraphCell that is the source for the edge.
* @param target DefaultGraphCell that is the target for the edge.
* @param weight Double that is the weight of the edge.
* @return DefaultGraphCell that was generated to connect the source with
* the target, with the specified weight.
* @throws Exception
*/
public static DefaultGraphCell createWeightedEdge(DefaultGraphCell source,
DefaultGraphCell target, double weight) throws Exception {
DefaultEdge edge = new DefaultEdge((new Double(weight)).toString());
source.addPort();
edge.setSource(source.getChildAt(source.getChildCount() - 1));
target.addPort();
edge.setTarget(target.getChildAt(target.getChildCount() - 1));
return edge;
}