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


Java GraphConstants.getBounds方法代码示例

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


在下文中一共展示了GraphConstants.getBounds方法的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: 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

示例3: 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

示例4: 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

示例5: maxDimension

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
private Dimension maxDimension( List cells )
{
	Dimension dim = new Dimension();
	
	for ( Iterator i=cells.iterator(); i.hasNext(); )
	{
		DefaultGraphCell cell = (DefaultGraphCell) i.next();
		
		Map attr = cell.getAttributes();
		Rectangle bounds = GraphConstants.getBounds( attr );

		if (bounds!=null)
		{
			dim.width = Math.max( dim.width, bounds.width );
			dim.height = Math.max( dim.height, bounds.height );
		}
	}
	
	return dim;
}
 
开发者ID:robertocapuano,项目名称:jink,代码行数:21,代码来源:TiLayoutManager.java

示例6: 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

示例7: updateAutoSize

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
 * Overwritten to freeze nodes to their center on
 * size changes.
 */
@Override
public void updateAutoSize(CellView view) {
    if (view != null && !isEditing()) {
        Rectangle2D bounds =
            (view.getAttributes() != null) ? GraphConstants.getBounds(view.getAttributes())
                : null;
        AttributeMap attrs = getModel().getAttributes(view.getCell());
        if (bounds == null) {
            bounds = GraphConstants.getBounds(attrs);
        }
        if (bounds != null) {
            boolean autosize = GraphConstants.isAutoSize(view.getAllAttributes());
            boolean resize = GraphConstants.isResize(view.getAllAttributes());
            if (autosize || resize) {
                Dimension2D d = getPreferredSize(view);
                int inset = 2 * GraphConstants.getInset(view.getAllAttributes());
                // adjust the x,y corner so that the center stays in place
                double shiftX = (bounds.getWidth() - d.getWidth() - inset) / 2;
                double shiftY = (bounds.getHeight() - d.getHeight() - inset) / 2;
                bounds.setFrame(bounds.getX() + shiftX, bounds.getY() + shiftY, d.getWidth(),
                    d.getHeight());
                // Remove resize attribute
                snap(bounds);
                if (resize) {
                    if (view.getAttributes() != null) {
                        view.getAttributes().remove(GraphConstants.RESIZE);
                    }
                    attrs.remove(GraphConstants.RESIZE);
                }
                view.refresh(getGraphLayoutCache(), getGraphLayoutCache(), false);
            }
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:39,代码来源:JGraph.java

示例8: intersects

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public boolean intersects(JGraph aGraph, Rectangle2D aRect) {
    GraphCell theCell = (GraphCell) getParentView().getCell();
    Rectangle2D theBounds = GraphConstants.getBounds(theCell.getAttributes());

    return theBounds.contains(aRect.getX(), aRect.getY());
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:8,代码来源:DefaultPortView.java

示例9: transferAttributesToProperties

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public void transferAttributesToProperties(Map aAttributes) {

    Table theTable = (Table) getUserObject();
    Rectangle2D theBounds = GraphConstants.getBounds(aAttributes);
    theTable.getProperties().setPointProperty(ModelItem.PROPERTY_LOCATION,
            (int) theBounds.getX(), (int) theBounds.getY());
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:9,代码来源:TableCell.java

示例10: transferAttributesToProperties

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public void transferAttributesToProperties(Map aAttributes) {

    View theTable = (View) getUserObject();
    Rectangle2D theBounds = GraphConstants.getBounds(aAttributes);
    theTable.getProperties().setPointProperty(ModelItem.PROPERTY_LOCATION,
            (int) theBounds.getX(), (int) theBounds.getY());
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:9,代码来源:ViewCell.java

示例11: transferAttributesToProperties

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public void transferAttributesToProperties(Map aAttributes) {

    Comment theComment = (Comment) getUserObject();
    Rectangle2D theBounds = GraphConstants.getBounds(aAttributes);
    theComment.getProperties().setPointProperty(ModelItem.PROPERTY_LOCATION,
            (int) theBounds.getX(), (int) theBounds.getY());
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:9,代码来源:CommentCell.java

示例12: getLocation

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public Point getLocation() {

    GraphCell theCell = getCell();
    Rectangle2D theBounds = GraphConstants.getBounds(theCell.getAttributes());
    return new Point((int) theBounds.getX(), (int) theBounds.getY());
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:8,代码来源:VertexCellElement.java

示例13: getSize

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public Dimension getSize() {

    if (size == null) {
        GraphCell theCell = getCell();
        Rectangle2D theBounds = GraphConstants.getBounds(theCell.getAttributes());
        size = new Dimension((int) theBounds.getWidth(), (int) theBounds.getHeight());
    }
    return size;

}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:12,代码来源:VertexCellElement.java

示例14: handleDrag

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public void handleDrag(MouseEvent e) {
	mediator.setIsReleased(false);
	mediator.autoscroll(e.getPoint());
	if (ml.getHandler() != null && ml.getHandler() == ml.getMarquee()) {
		ml.getMarquee().mouseDragged(e);
	} else if (ml.getHandler() == null && !mediator.isGraphEditing() && ml.getFocus() != null) {
		if (!mediator.isCellSelected(ml.getFocus().getCell())) {
			mediator.selectCellForEvent(ml.getFocus().getCell(), e);
			ml.setCell(null);
		}
		if (ml.getHandle() != null) {
			ml.getHandle().mousePressed(e);
		}
		ml.setHandler(ml.getHandle());
	}
	if (ml.getHandle() != null && ml.getHandler() == ml.getHandle()) {
		// BERTOLI MARCO - Added to avoid dragging of unselected elements (caused bugs)
		if (mediator.getGraph().getSelectionCells().length > 0) {
			ml.getHandle().mouseDragged(e);
			graphtmp = (JmtJGraph) mediator.getGraph();
			cells = graphtmp.getSelectionCells();
			Xmin = new Integer[cells.length];
			Ymin = new Integer[cells.length];
			//Xmax = new Integer[cells.length];
			//Ymax = new Integer[cells.length];
			if (cells.length > 0) {
				for (int i = 0; i < cells.length; i++) {
					if (cells[i] instanceof JmtCell) {
						Rectangle2D rett = GraphConstants.getBounds(((JmtCell) cells[i]).getAttributes());
						Xmin[i] = new Integer((int) rett.getMinX());
						Ymin[i] = new Integer((int) rett.getMinY());
						//Xmax[i] = new Integer((int) rett.getMaxX());
						//Ymax[i] = new Integer((int) rett.getMaxY());
						moved = true;
					}
					if (cells[i] instanceof BlockingRegion) {
						CellView groupview = (graphtmp.getGraphLayoutCache()).getMapping(cells[i], false);
						Rectangle2D rett2 = groupview.getBounds();
						if (rett2 != null) {
							Xmin[i] = new Integer((int) rett2.getMinX());
							Ymin[i] = new Integer((int) rett2.getMinY());
							//Xmax[i] = new Integer((int) rett2.getMaxX());
							//Ymax[i] = new Integer((int) rett2.getMaxY());
							moved = true;
						}
					}
				}
			}
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:53,代码来源:SelectState.java

示例15: handleDrag

import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public void handleDrag(MouseEvent e) {

	mediator.setIsReleased(false);
	mediator.autoscroll(e.getPoint());
	if (ml.getHandler() != null && ml.getHandler() == ml.getMarquee()) {
		ml.getMarquee().mouseDragged(e);
	} else if (ml.getHandler() == null && !mediator.isGraphEditing() && ml.getFocus() != null) {
		if (!mediator.isCellSelected(ml.getFocus().getCell())) {
			mediator.selectCellForEvent(ml.getFocus().getCell(), e);
			ml.setCell(null);
		}
		if (ml.getHandle() != null) {
			ml.getHandle().mousePressed(e);
		}
		ml.setHandler(ml.getHandle());
	}
	if (ml.getHandle() != null && ml.getHandler() == ml.getHandle()) {
		// BERTOLI MARCO - Added to avoid dragging of unselected elements (caused bugs)
		if (mediator.getGraph().getSelectionCells().length > 0) {
			ml.getHandle().mouseDragged(e);
			Xmin = null;
			Ymin = null;
			Xmax = null;
			Ymax = null;
			graphtmp = (JmtJGraph) mediator.getGraph();
			cells = graphtmp.getSelectionCells();
			Xmin = new Integer[cells.length];
			Ymin = new Integer[cells.length];
			Xmax = new Integer[cells.length];
			Ymax = new Integer[cells.length];
			//System.out.println("Numero di cell  in drag: " + cells.length);
			if (cells.length > 0) {
				for (int i = 0; i < cells.length; i++) {
					if (cells[i] instanceof JmtCell) {
						Rectangle2D rett = GraphConstants.getBounds(((JmtCell) cells[i]).getAttributes());
						//                		rappresentano l angolo altro-sinistro di ogni cella selezionata
						Xmin[i] = new Integer((int) rett.getMinX());
						Ymin[i] = new Integer((int) rett.getMinY());
						Xmax[i] = new Integer((int) rett.getMaxX());
						Ymax[i] = new Integer((int) rett.getMaxY());
						moved = true;
					}
					if (cells[i] instanceof BlockingRegion) {
						CellView groupview = (graphtmp.getGraphLayoutCache()).getMapping(cells[i], false);
						Rectangle2D rett2 = groupview.getBounds();

						Object[] celgru = new Object[1];
						celgru[0] = cells[i];
						//celle presenti nel blocking region incluse port e regione

						//                			Object[] celless=graphtmp.getDescendants(celgru);
						//System.out.println("Numero di celle in gruppo: "+ celless.length);

						if (rett2 != null) {
							//System.out.println("Dentro DRAG mi restituisce un rettangolo se � di tipoBLockingRegion");
							Xmin[i] = new Integer((int) rett2.getMinX());
							Ymin[i] = new Integer((int) rett2.getMinY());
							//                        		Xmax[i]=new Integer((int) rett2.getMaxX());
							//                        		Ymax[i]=new Integer((int) rett2.getMaxY());
							//System.out.println("Valori: "+ X[i]+", "+Y[i]);
							moved = true;
						}

					}
				}
			}
		}
	}

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:72,代码来源:SelectState.java


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