当前位置: 首页>>代码示例>>Java>>正文


Java GraphConstants.setBounds方法代码示例

本文整理汇总了Java中org.jgraph.graph.GraphConstants.setBounds方法的典型用法代码示例。如果您正苦于以下问题:Java GraphConstants.setBounds方法的具体用法?Java GraphConstants.setBounds怎么用?Java GraphConstants.setBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgraph.graph.GraphConstants的用法示例。


在下文中一共展示了GraphConstants.setBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startEditingAtCell

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
 * Selects the specified cell and initiates editing.
 * The edit-attempt fails if the <code>CellEditor</code>
 * does not allow
 * editing for the specified item.
 */
public void startEditingAtCell(Object cell) {
	graph.startEditingAtCell(cell);
	if ((cell != null) && (cell instanceof JmtCell)) {
		JmtCell jcell = (JmtCell) cell;
		showStationParameterPanel(((CellComponent) jcell.getUserObject()).getKey(),
				StationParameterPanel.INPUT_SECTION, null);
		// Updates cell dimensions if name was changed too much...
		Hashtable<Object, Map> nest = new Hashtable<Object, Map>();
		Dimension cellDimension = jcell.getSize(graph);
		Map attr = jcell.getAttributes();
		Rectangle2D oldBounds = GraphConstants.getBounds(attr);
		if (oldBounds.getWidth() != cellDimension.getWidth()) {
			GraphConstants.setBounds(attr, new Rectangle2D.Double(oldBounds.getX(), oldBounds.getY(),
					cellDimension.getWidth(), cellDimension.getHeight()));
			nest.put(cell, attr);
			jcell.updatePortPositions(nest, GraphConstants.getIcon(attr), cellDimension);
			graph.getGraphLayoutCache().edit(nest);
		}
	}
	// Blocking region editing
	else if ((cell != null) && (cell instanceof BlockingRegion)) {
		showBlockingRegionParameterPanel(((BlockingRegion) cell).getKey());
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:31,代码来源:Mediator.java

示例2: setAttributes

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
 * Sets all the attributes like background colour, dimensions, port number
 * & position
 *
 * @param pt
 * @return created map
 */
public Hashtable<Object, Map> setAttributes(Point2D pt, JGraph graph) {
	//contains attributes of the cell & ports
	Hashtable<Object, Map> nest = new Hashtable<Object, Map>();

	Dimension cellDimension = getSize(graph);
	//contains attributes of the cell
	Map attr = getAttributes();
	GraphConstants.setBounds(attr, new Rectangle2D.Double(pt.getX(), pt.getY(), cellDimension.getWidth(), cellDimension.getHeight()));
	GraphConstants.setEditable(attr, false);
	GraphConstants.setBackground(attr, graph.getBackground());
	nest.put(this, attr);

	//create ports
	ports = createPorts();
	Icon icon = GraphConstants.getIcon(attr);
	updatePortPositions(nest, icon, cellDimension);
	for (Port port : ports) {
		add((DefaultPort) port);
	}
	return nest;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:29,代码来源:JmtCell.java

示例3: setAttributes

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
 * Sets all the attribults like background colour, dimensions, port number
 * & position
 * @param pt
 * @return created map
 */
public Hashtable<Object, Map> setAttributes(Point2D pt, JGraph graph) {
	//contains attribute of the cell & ports
	Hashtable<Object, Map> nest = new Hashtable<Object, Map>();

	Dimension cellDimension = getSize(graph);
	//contains attrib of cell
	Map attr = getAttributes();
	GraphConstants.setBounds(attr, new Rectangle2D.Double(pt.getX(), pt.getY(), cellDimension.getWidth(), cellDimension.getHeight()));
	GraphConstants.setEditable(attr, false);
	GraphConstants.setBackground(attr, graph.getBackground());
	nest.put(this, attr);

	//create ports
	ports = createPorts();
	Icon icon = GraphConstants.getIcon(attr);
	updatePortPositions(nest, icon, cellDimension);
	for (Port port : ports) {
		add((DefaultPort) port);
	}
	return nest;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:28,代码来源:JmtCell.java

示例4: positionVertexAt

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static void positionVertexAt (Object vertex,
                                      int x,
                                      int y)
{
    DefaultGraphCell cell = jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();
    Rectangle2D bounds = GraphConstants.getBounds(attr);

    Rectangle2D newBounds = new Rectangle2D.Double(
            x,
            y,
            bounds.getWidth(),
            bounds.getHeight());

    GraphConstants.setBounds(attr, newBounds);

    // TODO: Clean up generics once JGraph goes generic
    AttributeMap cellAttr = new AttributeMap();
    cellAttr.put(cell, attr);
    jgAdapter.edit(cellAttr, null, null, null);
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:23,代码来源:SIGraphTest.java

示例5: evolvePosition

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
private void evolvePosition(GraphCell aCell, int movementX, int movementY) {

        if (movementX != 0 || movementY != 0) {
            Rectangle2D theBounds;
            Map theAttributes = modelModifications.get(aCell);
            if (theAttributes != null) {
                theBounds = GraphConstants.getBounds(theAttributes);
            } else {
                theAttributes = new HashMap();
                theBounds = GraphConstants.getBounds(aCell.getAttributes());

                modelModifications.put(aCell, theAttributes);
            }

            theBounds.setRect(theBounds.getX() + movementX, theBounds.getY() + movementY, theBounds.getWidth(),
                    theBounds.getHeight());
            GraphConstants.setBounds(theAttributes, theBounds);
        }
    }
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:20,代码来源:ERDesignerGraphLayout.java

示例6: positionVertexAt

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // FIXME hb 28-nov-05: See FIXME below
private void positionVertexAt(Object vertex, int x, int y)
{
    DefaultGraphCell cell = jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();
    Rectangle2D bounds = GraphConstants.getBounds(attr);

    Rectangle2D newBounds =
        new Rectangle2D.Double(
            x,
            y,
            bounds.getWidth(),
            bounds.getHeight());

    GraphConstants.setBounds(attr, newBounds);

    // TODO: Clean up generics once JGraph goes generic
    AttributeMap cellAttr = new AttributeMap();
    cellAttr.put(cell, attr);
    jgAdapter.edit(cellAttr, null, null, null);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:22,代码来源:DrawPanel_old.java

示例7: layout

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
Map layout( ThreadModel thread_m )
{
	Map attr = GraphConstants.createMap();
	
	common( attr );
	
	Coordinate c = (Coordinate) threadToCol.get( thread_m );
	if ( c==null)
	{
		c = new Coordinate( threadToCol.size() +1, 0 );
		threadToCol.put( thread_m, c );
	}
	
	Rectangle rec = new Rectangle( c.col*step_x + step_x/10, c.row*step_y, step_x - step_x/10, 3 * step_y/4 );
	GraphConstants.setBounds( attr, rec );
	
	c.row++;
	threadToCol.put( thread_m, c );
	return attr;
}
 
开发者ID:robertocapuano,项目名称:jink,代码行数:21,代码来源:SwimmingLaneLayout.java

示例8: createCell

import org.jgraph.graph.GraphConstants; //导入方法依赖的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;
}
 
开发者ID:datapoet,项目名称:hubminer,代码行数:28,代码来源:JGraphConverter.java

示例9: createVertex

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
private void createVertex(DefaultGraphCell cell, double x, double y, double w, double h)
{
    // Set bounds
    GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(x, y, w, h));

    GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createRaisedBevelBorder());

    GraphConstants.setEditable(cell.getAttributes(), false);
    GraphConstants.setSizeable(cell.getAttributes(), true);
    GraphConstants.setAutoSize(cell.getAttributes(), false);
    GraphConstants.setRouting(cell.getAttributes(), GraphConstants.ROUTING_SIMPLE);
    GraphConstants.setBendable(cell.getAttributes(), true);

    // Add a Floating Port
    hmPorts.put(cell.getUserObject(), cell.addPort());
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:17,代码来源:DBWizardEREditor.java

示例10: createVertex

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
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;
    }
 
开发者ID:fabioz,项目名称:Pydev,代码行数:26,代码来源:GraphVisitor.java

示例11: createBounds

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
	{
//		final int ALPHA = 255;
		GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
//		GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
		GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
		GraphConstants.setBackground(map, c.darker());
		// Add a nice looking gradient background
		GraphConstants.setGradientColor(map, c.darker());
		// Make sure the cell is resized on insert
//		GraphConstants.setSize();
//		GraphConstants.setResize(map, true);
		// Add a Border Color Attribute to the Map
		GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
		GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
		GraphConstants.setMoveable(map, moveable);
		GraphConstants.setOpaque(map, true);
		GraphConstants.setResize(map, false);
		GraphConstants.setAutoSize(map, true);
		return map;
	}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:22,代码来源:UIHelper.java

示例12: createBounds

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
{
	//		final int ALPHA = 255;
	GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
	//		GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
	GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
	GraphConstants.setBackground(map, c.darker());
	// Add a nice looking gradient background
	GraphConstants.setGradientColor(map, c.darker());
	// Make sure the cell is resized on insert
	//		GraphConstants.setSize();
	//		GraphConstants.setResize(map, true);
	// Add a Border Color Attribute to the Map
	GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
	GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
	GraphConstants.setMoveable(map, moveable);
	GraphConstants.setOpaque(map, true);
	GraphConstants.setResize(map, false);
	GraphConstants.setAutoSize(map, true);
	return map;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:22,代码来源:UIHelper.java

示例13: repositionSons

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
private void repositionSons(JmtCell padre, List<Object> sons, int numero, int cont) {
	inRepositionSons = true;
	Object[] listEdges = null;
	GraphModel graphmodel = graph.getModel();

	flag1 = true;

	int j = 0;
	Rectangle boundspadre = GraphConstants.getBounds(padre.getAttributes()).getBounds();
	int w = boundspadre.y + ((heightMax + 35) * (numero + 1)) - 38;

	for (int i = cont; i < sons.size(); i++) {
		if (((JmtCell) sons.get(i)).seen == false) {
			Rectangle bounds = GraphConstants.getBounds(((JmtCell) sons.get(i)).getAttributes()).getBounds();
			bounds.setLocation((int) (boundspadre.getCenterX()) + widthMax + 50 - (int) (bounds.getWidth() / 2),
					w - (int) (bounds.getHeight() / 2) + 80);
			GraphConstants.setBounds(((JmtCell) sons.get(i)).getAttributes(), bounds);

			((JmtCell) sons.get(i)).seen = true;
			listEdges = DefaultGraphModel.getOutgoingEdges(graphmodel, sons.get(i));

			if (listEdges.length > 0) {
				flag = true;
				j = searchNext((JmtCell) sons.get(i));
				inRepositionSons = true;
			}

			if (j > 0) {
				j = j - 1;
			}

			listEdges = null;
		}

		w = w + (heightMax + ((heightMax + 15) * j) + 30);
		j = 0;
	}

	inRepositionSons = false;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:41,代码来源:Mediator.java

示例14: positionVertexAt

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
private void positionVertexAt( Object vertex, int x, int y ) {
    DefaultGraphCell cell = adapter.getVertexCell( vertex );
    Map              attr = cell.getAttributes(  );
    Rectangle        b    = GraphConstants.getBounds( attr ).getBounds();

    GraphConstants.setBounds( attr, new Rectangle( x, y, b.width, b.height ) );

    Map cellAttr = new HashMap(  );
    cellAttr.put( cell, attr );
    adapter.edit( cellAttr, null, null, null );
}
 
开发者ID:LouisJenkinsCS,项目名称:DSL,代码行数:12,代码来源:ASTGraph.java

示例15: startEditingAtCell

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
 * Selects the specified cell and initiates editing.
 * The edit-attempt fails if the <code>CellEditor</code>
 * does not allow
 * editing for the specified item.
 */
public void startEditingAtCell(Object cell) {
	graph.startEditingAtCell(cell);
	if ((cell != null) && (cell instanceof JmtCell)) {
		JmtCell jcell = (JmtCell) cell;
		StationParameterPanel stationPanel = new jmt.gui.common.panels.StationParameterPanel(model, model,
				((CellComponent) jcell.getUserObject()).getKey());
		// Adds on the top a panel to change station name
		stationPanel.add(new StationNamePanel(model, ((CellComponent) jcell.getUserObject()).getKey()), BorderLayout.NORTH);
		dialogFactory.getDialog(stationPanel, "Editing " + jcell.getUserObject().toString() + " Properties...");

		// Updates cell dimensions if name was changed too much...
		Hashtable<Object, Map> nest = new Hashtable<Object, Map>();
		Dimension cellDimension = jcell.getSize(graph);
		Map attr = jcell.getAttributes();
		Rectangle2D oldBounds = GraphConstants.getBounds(attr);
		if (oldBounds.getWidth() != cellDimension.getWidth()) {
			GraphConstants.setBounds(attr, new Rectangle2D.Double(oldBounds.getX(), oldBounds.getY(), cellDimension.getWidth(), cellDimension
					.getHeight()));
			nest.put(cell, attr);
			jcell.updatePortPositions(nest, GraphConstants.getIcon(attr), cellDimension);
			graph.getGraphLayoutCache().edit(nest);
		}
	}
	// Blocking region editing
	else if ((cell != null) && (cell instanceof BlockingRegion)) {
		Object regionKey = ((BlockingRegion) cell).getKey();
		dialogFactory.getDialog(new BlockingRegionParameterPanel(model, model, regionKey), "Editing " + model.getRegionName(regionKey)
				+ " Properties...");
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:37,代码来源:Mediator.java


注:本文中的org.jgraph.graph.GraphConstants.setBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。