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


Java CellView类代码示例

本文整理汇总了Java中org.jgraph.graph.CellView的典型用法代码示例。如果您正苦于以下问题:Java CellView类的具体用法?Java CellView怎么用?Java CellView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getRoots

import org.jgraph.graph.CellView; //导入依赖的package包/类
/**
 * Return all cells that intersect the given rectangle.
 */
public CellView[] getRoots(Rectangle clip) {
	java.util.List<CellView> result = new ArrayList<CellView>();
	CellView[] views = getRoots();
	Rectangle2D bounds;
	for (CellView view : views) {
		bounds = view.getBounds();
		if (bounds != null) {
			if (bounds.intersects(clip)) {
				result.add(view);
			}
		}
	}
	views = new CellView[result.size()];
	result.toArray(views);
	return views;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:20,代码来源:JmtGraphLayoutCache.java

示例2: isDescendant

import org.jgraph.graph.CellView; //导入依赖的package包/类
protected boolean isDescendant(CellView parentView, CellView childView) {
	if (parentView == null || childView == null) {
		return false;
	}

	Object parent = parentView.getCell();
	Object child = childView.getCell();
	Object ancestor = child;

	do {
		if (ancestor == parent) {
			return true;
		}
	} while ((ancestor = mediator.getParent(ancestor)) != null);

	return false;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:18,代码来源:GraphMouseListner.java

示例3: getVertexAt

import org.jgraph.graph.CellView; //导入依赖的package包/类
/** Gets the first vertex at this position.
 *
 * @param x horizontal coordinate
 * @param y vertical coordinate
 * @return first vertex
 */
public JmtCell getVertexAt(int x, int y) {
	CellView[] cellViews = getGraphLayoutCache().getAllViews();
	for (CellView cellView : cellViews) {
		if (cellView.getCell() instanceof JmtCell) {
			if (cellView.getBounds().contains(x, y)) {
				return (JmtCell) cellView.getCell();
			}
		}
	}
	return null;
	//		Object cell = null;
	//		Object oldCell = null;
	//		do {
	//			cell = getNextCellForLocation(oldCell, x, y);
	//			if (oldCell == cell)
	//				return null;
	//			else
	//				oldCell = cell;
	//		} while (!((cell instanceof JmtCell) || cell == null));

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

示例4: getFirstCellForLocation

import org.jgraph.graph.CellView; //导入依赖的package包/类
/**
 * Helper method for {@link #getFirstCellForLocation(double, double)} and
 * {@link #getPortViewAt(double, double)}. Returns the topmost visible cell
 * at a given point. A flag controls if we want only vertices or only edges.
 * @param x x-coordinate of the location we want to find a cell at
 * @param y y-coordinate of the location we want to find a cell at
 * @param vertex <tt>true</tt> if we are not interested in edges
 * @param edge <tt>true</tt> if we are not interested in vertices
 * @return the topmost visible cell at a given point
 */
protected JCell<G> getFirstCellForLocation(double x, double y, boolean vertex, boolean edge) {
    x /= this.scale;
    y /= this.scale;
    JCell<G> result = null;
    Rectangle xyArea = new Rectangle((int) (x - 2), (int) (y - 2), 4, 4);
    // iterate over the roots and query the visible ones
    CellView[] viewRoots = this.graphLayoutCache.getRoots();
    for (int i = viewRoots.length - 1; result == null && i >= 0; i--) {
        CellView jCellView = viewRoots[i];
        if (!(jCellView.getCell() instanceof JCell)) {
            continue;
        }
        @SuppressWarnings("unchecked")
        JCell<G> jCell = (JCell<G>) jCellView.getCell();
        boolean typeCorrect =
            vertex ? jCell instanceof JVertex : edge ? jCell instanceof JEdge : true;
        if (typeCorrect && !jCell.isGrayedOut()) {
            // now see if this jCell is sufficiently close to the point
            if (jCellView.intersects(this, xyArea)) {
                result = jCell;
            }
        }
    }
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:36,代码来源:JGraph.java

示例5: setLayouting

import org.jgraph.graph.CellView; //导入依赖的package包/类
/** Sets the layouting flag to the given value. */
public void setLayouting(boolean layouting) {
    if (layouting != this.layouting) {
        this.layouting = layouting;
        if (layouting) {
            // start the layouting
            getModel().beginUpdate();
        } else {
            // reroute the loops
            GraphLayoutCache cache = getGraphLayoutCache();
            for (CellView view : cache.getRoots()) {
                if (view instanceof EdgeView && ((EdgeView) view).isLoop()) {
                    view.update(cache);
                }
            }
            // end the layouting
            getModel().endUpdate();
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:21,代码来源:JGraph.java

示例6: reloadRoots

import org.jgraph.graph.CellView; //导入依赖的package包/类
@Override
protected void reloadRoots() {
    // Reorder roots
    Object[] orderedCells = DefaultGraphModel.getAll(this.graphModel);
    List<CellView> newRoots = new ArrayList<>();
    for (Object element : orderedCells) {
        CellView view = getMapping(element, true);
        if (view != null) {
            // the following line is commented out wrt the super implementation
            // to prevent over-enthousiastic refreshing
            // view.refresh(this, this, true);
            if (view.getParentView() == null) {
                newRoots.add(view);
            }
        }
    }
    this.roots = newRoots;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:19,代码来源:JGraphLayoutCache.java

示例7: reload

import org.jgraph.graph.CellView; //导入依赖的package包/类
@Override
public synchronized void reload() {
    List<CellView> newRoots = new ArrayList<>();
    @SuppressWarnings("unchecked")
    Map<?,?> oldMapping = new Hashtable<>(this.mapping);
    this.mapping.clear();
    @SuppressWarnings("unchecked")
    Set<Object> rootsSet = new HashSet<Object>(this.roots);
    for (Map.Entry<?,?> entry : oldMapping.entrySet()) {
        Object cell = entry.getKey();
        CellView oldView = (CellView) entry.getValue();
        CellView newView = getMapping(cell, true);
        // thr following test is the only change wrt the super-implementation
        if (newView != null) {
            newView.changeAttributes(this, oldView.getAttributes());
            // newView.refresh(getModel(), this, false);
            if (rootsSet.contains(oldView)) {
                newRoots.add(newView);
            }
        }
    }
    // replace hidden
    this.hiddenMapping.clear();
    this.roots = newRoots;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:26,代码来源:JGraphLayoutCache.java

示例8: completeSelect

import org.jgraph.graph.CellView; //导入依赖的package包/类
/**
 * Completes the select drag action.
 */
@SuppressWarnings("unchecked")
private void completeSelect(MouseEvent evt) {
    Rectangle bounds = this.selectHandler.getBounds();
    if (getJGraphMode() == PAN_MODE) {
        getJGraph().zoomTo(bounds);
    } else {
        // adapt the bound to the scale
        bounds = getJGraph().fromScreen(bounds).getBounds();
        // collect the cells that are entirely in the bounds
        ArrayList<JCell<G>> list = new ArrayList<>();
        CellView[] views = getJGraph().getGraphLayoutCache().getRoots();
        for (int i = 0; i < views.length; i++) {
            if (bounds.contains(views[i].getBounds())) {
                list.add((JCell<G>) views[i].getCell());
            }
        }
        selectCellsForEvent(list, evt);
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:23,代码来源:JGraphUI.java

示例9: mouseReleased

import org.jgraph.graph.CellView; //导入依赖的package包/类
public void mouseReleased(MouseEvent e) {
	if (index != -1) {
		cachedBounds = computeBounds(e);
		int cachedStartPoint = computeStartCorner(e);
		vertex.setBounds(cachedBounds);
		TBoardConstants.setStartCorner(vertex.getAttributes(),
				cachedStartPoint);
		CellView[] views = AbstractCellView
				.getDescendantViews(new CellView[] { vertex });
		Map attributes = GraphConstants.createAttributes(views, null);
		graph.getGraphLayoutCache().edit(attributes, null, null, null);
	}
	e.consume();
	cachedBounds = null;
	initialBounds = null;
	firstDrag = true;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:18,代码来源:TLineView.java

示例10: installAttributes

import org.jgraph.graph.CellView; //导入依赖的package包/类
protected void installAttributes(CellView view) {
	// Get the oval attributes
	Map map = view.getAllAttributes();
	
	// Apply all the component properties		
	// Apply border
	borderColor = TBoardConstants.getBorderColor(map);
	if (borderColor != null)
		borderWidth = Math.max(1, Math.round(TBoardConstants.getLineWidth(map)));
	else borderWidth = 0;
	
	// Apply background and gradient
	backgroundColor = TBoardConstants.getBackground(map);
	setOpaque((backgroundColor != null));
	
	gradientColor = TBoardConstants.getGradientColor(map);
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:18,代码来源:TRoundRectRenderer.java

示例11: installAttributes

import org.jgraph.graph.CellView; //导入依赖的package包/类
protected void installAttributes(CellView view) {
	super.installAttributes(view);
	// Initialize id prefix
	String idOrder = "";
	// Get TGridCell attributes
	Map map = view.getAllAttributes();
	// If is the first cell (1,1) of the grid
	if ((TBoardConstants.getColumn(map) == 1)
			&& (TBoardConstants.getRow(map) == 1)) {
		// Add an arrow character that symbolizes the grid order
		switch (TBoardConstants
				.getOrder(((TGrid)((TGridCell)view.getCell()).getParent())
						.getAttributes())) {
		case TGrid.COLUMNS:
			idOrder = "↓ ";
			break;
		case TGrid.ROWS:
			idOrder = "→ ";
			break;
		case TGrid.CUSTOM:
			idOrder = "↺ ";
		}
	}
	// Append the string in the beginning of the grid cell id
	id = idOrder + id;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:27,代码来源:TGridCellRenderer.java

示例12: installAttributes

import org.jgraph.graph.CellView; //导入依赖的package包/类
protected void installAttributes(CellView view) {
	// Get the oval attributes
	Map map = view.getAllAttributes();
	
	// Apply all the component properties		
	// Apply border
	borderColor = TBoardConstants.getBorderColor(map);
	if (borderColor != null)
		borderWidth = Math.max(1, Math.round(TBoardConstants.getLineWidth(map)));
	else borderWidth = 0;
	
	// Apply background and gradient
	backgroundColor = TBoardConstants.getBackground(map);
	setOpaque((backgroundColor != null));

	gradientColor = TBoardConstants.getGradientColor(map);
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:18,代码来源:TOvalRenderer.java

示例13: installAttributes

import org.jgraph.graph.CellView; //导入依赖的package包/类
protected void installAttributes(CellView view) {
	// Get the oval attributes
	Map map = view.getAllAttributes();
	
	// Apply all the component properties		
	// Apply border
	Color borderColor = TBoardConstants.getBorderColor(map);
	if (borderColor != null) {
		int borderWidth = Math.max(1, Math.round(TBoardConstants.getLineWidth(map)));
		setBorder(BorderFactory.createLineBorder(borderColor, borderWidth));
	} else setBorder(null);

	// Apply background and gradient
	Color backgroundColor = TBoardConstants.getBackground(map);
	setBackground(backgroundColor);
	setOpaque((backgroundColor != null));
	
	setGradientColor(TBoardConstants.getGradientColor(map));
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:20,代码来源:TRectangleRenderer.java

示例14: getRendererComponent

import org.jgraph.graph.CellView; //导入依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView view,
		boolean sel, boolean focus, boolean preview) {
	gridColor = graph.getGridColor();
	highlightColor = graph.getHighlightColor();
	lockedHandleColor = graph.getLockedHandleColor();
	isDoubleBuffered = graph.isDoubleBuffered();
	if (view instanceof VertexView) {
		this.view = (VertexView)view;
		this.hasFocus = focus;
		this.childrenSelected = graph.getSelectionModel()
				.isChildrenSelected(view.getCell());
		this.selected = sel;
		this.preview = preview;
		if (this.view.isLeaf()
				|| GraphConstants.isGroupOpaque(view.getAllAttributes()))
			installAttributes(view);
		else
			resetAttributes();
		return this;
	}
	return null;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:23,代码来源:TComponentRenderer.java

示例15: isDescendant

import org.jgraph.graph.CellView; //导入依赖的package包/类
protected boolean isDescendant(CellView parentView, CellView childView) {
	if (parentView == null || childView == null) {
		return false;
	}

	Object parent = parentView.getCell();
	Object child = childView.getCell();
	Object ancestor = child;

	do {
		if (ancestor == parent)
			return true;
	} while ((ancestor = graphModel.getParent(ancestor)) != null);

	return false;
}
 
开发者ID:tvaquero,项目名称:itsimple,代码行数:17,代码来源:ItGraphUI.java


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