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


Java JGraph类代码示例

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


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

示例1: adjustDisplaySettings

import org.jgraph.JGraph; //导入依赖的package包/类
private void adjustDisplaySettings( JGraph jg ) {
    jg.setPreferredSize( DEFAULT_SIZE );

    Color  c        = DEFAULT_BG_COLOR;
    String colorStr = null;

    try {
        colorStr = getParameter( "bgcolor" );
    }
     catch( Exception e ) {}

    if( colorStr != null ) {
        c = Color.decode( colorStr );
    }

    jg.setBackground( c );
}
 
开发者ID:LouisJenkinsCS,项目名称:DSL,代码行数:18,代码来源:ASTGraph.java

示例2: paintSelectionBorder

import org.jgraph.JGraph; //导入依赖的package包/类
/**
 * Provided for subclassers to paint a selection border.
 */
protected void paintSelectionBorder(Graphics g)
{
	((Graphics2D) g).setStroke(GraphConstants.SELECTION_STROKE);
	if (childrenSelected)
	{
		if(graph.get()!=null)
			g.setColor(((JGraph)graph.get()).getGridColor());
	}
	else if (focus && selected)
	{
		if(graph.get()!=null)
			g.setColor(((JGraph)graph.get()).getLockedHandleColor());
	}
	else if (selected)
	{
		g.setColor(getDecidedHighlightColor());
	}
	if (childrenSelected || selected)
	{
		Dimension d = getSize();
		g.drawRect(0, 0, d.width-1, d.height-1);
	}
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:27,代码来源:DefaultEdgeRenderer.java

示例3: setAttributes

import org.jgraph.JGraph; //导入依赖的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

示例4: setAttributes

import org.jgraph.JGraph; //导入依赖的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

示例5: main

import org.jgraph.JGraph; //导入依赖的package包/类
public static void main(String[] args) {
    setLookAndFeel();

    DomainModel domainModel = new DomainModel();
    domainModel.setPetriNet(new ListPetriNet());

    JGraph graph = JGraphFactory.createGraph();
    domainModel.setPetriNetGraph(graph);

    GraphService graphService = new GraphServiceImpl(domainModel);

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            MainFrame mainFrame = new MainFrame(graphService);
            mainFrame.setVisible(true);
        }
    });
}
 
开发者ID:tomaszi1,项目名称:petri-nets-simulator,代码行数:20,代码来源:Main.java

示例6: testJGraph

import org.jgraph.JGraph; //导入依赖的package包/类
@Test
public void testJGraph() throws Exception {
	GraphModel model = new DefaultGraphModel();
	GraphLayoutCache view = new GraphLayoutCache(model, new DefaultCellViewFactory());
	JGraph graph = new JGraph(model, view);

	DefaultGraphCell[] cells = new DefaultGraphCell[3];
	cells[0] = createCell("hello", true);
	cells[1] = createCell("world", false);
	DefaultEdge edge = new DefaultEdge();
	GraphConstants.setLineStyle(edge.getAttributes(), GraphConstants.ARROW_LINE);
	edge.setSource(cells[0].getChildAt(0));
	edge.setTarget(cells[1].getChildAt(0));
	cells[2] = edge;
	graph.getGraphLayoutCache().insert(cells);

	JOptionPane.showMessageDialog(null, new JScrollPane(graph));
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:19,代码来源:JGraphTest.java

示例7: getRendererComponent

import org.jgraph.JGraph; //导入依赖的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

示例8: handleMarqueeEvent

import org.jgraph.JGraph; //导入依赖的package包/类
public void handleMarqueeEvent(MouseEvent e, JGraph graph,
		Rectangle2D bounds) {
	// Snap the Point to the Grid
	Rectangle2D snapBounds = graph.snap(bounds);

	if ((bounds.getHeight() >= MIN_HEIGHT)
		|| (bounds.getWidth() >= MIN_WIDTH)) {
		// Create default TComponent vector
		TComponent component = createDefaultComponent(snapBounds);

		getBoard().getGraphLayoutCache().insert(component);
		e.consume();
		// Restore the marquee handler
		getBoard().setMarqueeHandler(
				new TBasicMarqueeHandler(getBoardContainer()));
	}
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:18,代码来源:TComponentMarqueeHandler.java

示例9: CircleLaneView

import org.jgraph.JGraph; //导入依赖的package包/类
public CircleLaneView( FrontEndModel frontEndModel ) throws GUIException
{
	super( new BorderLayout() );
	setName( "CircleLane "  + VERSION );
	
	GraphApparence apparenceMgr = new CircleLaneApparence();
	model = frontEndModel.getCircleLaneModel();
	model.attach( apparenceMgr );
	graph = new JGraph( model );
	layoutMgr = new CircleLaneLayout( graph );
	
	graph.setModel( model );					
	graph.setSelectNewCells(false);
	graph.setEditable(false);
	graph.setCloneable( false );
	graph.setDropEnabled( false );
	graph.setConnectable( false );
	graph.setDisconnectable( false );

	graph.addGraphSelectionListener( graphSelectionListener );
	add( new JScrollPane( graph ) );
}
 
开发者ID:robertocapuano,项目名称:jink,代码行数:23,代码来源:CircleLaneView.java

示例10: layout

import org.jgraph.JGraph; //导入依赖的package包/类
protected void layout( JGraph graph )
{
	Set views = new TreeSet( comparator );

	fillVertex( views );
	int n = views.size();
	int radius_x = (int) (Math.min( n*(max_w) , 1200 )/Math.PI);
	int radius_y = (int) (Math.min( n*(max_h), 700 )/Math.PI);

	double phi = 2*Math.PI / n;
			
	int i=0;
	for ( Iterator j=views.iterator(); j.hasNext(); ++i )
	{
		CellView view = (CellView) j.next();
		double angle = phi*i;

		int x = radius_x + (int)(Math.cos(angle) * radius_x);
		int y = radius_y + (int)(Math.sin(angle) * radius_y);
		
		setLocation( view, x, y );
	}
}
 
开发者ID:robertocapuano,项目名称:jink,代码行数:24,代码来源:CircleLaneLayout.java

示例11: adjustDisplaySettings

import org.jgraph.JGraph; //导入依赖的package包/类
private void adjustDisplaySettings(JGraph jg)
{
    jg.setPreferredSize(DEFAULT_SIZE);

    Color c = DEFAULT_BG_COLOR;
    String colorStr = null;

    try {
        colorStr = getParameter("bgcolor");
    } catch (Exception e) {
    }

    if (colorStr != null) {
        c = Color.decode(colorStr);
    }

    jg.setBackground(c);
}
 
开发者ID:WellingR,项目名称:Maximal-Common-Subgraph,代码行数:19,代码来源:GraphViewer.java

示例12: getRendererComponent

import org.jgraph.JGraph; //导入依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView cellview, boolean sel, boolean focus, boolean preview)
{
    if (cellview instanceof TableVertexView)
    {
        TableVertexView view = (TableVertexView) cellview;

        DBGraphCell myCell = (DBGraphCell) view.getCell();
        table = (DBTable) myCell.obj;

        this.graph = graph;
        this.hasFocus = focus;
        this.selected = sel;
        this.preview = preview;

        setForeground(DEFAULT_FOREGROUND);
        setBackground(DEFAULT_BACKGROUND);

        setComponentOrientation(graph.getComponentOrientation());

        return this;
    }
    return null;
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:24,代码来源:TableRenderer.java

示例13: setupGraph

import org.jgraph.JGraph; //导入依赖的package包/类
private JGraph setupGraph() {
    // Construct Model and Graph
    GraphModel model = new DefaultGraphModel();
    JGraph graph = new JGraph(model);

    // Control-drag should clone selection
    graph.setCloneable(true);

    // Enable edit without final RETURN keystroke
    graph.setInvokesStopCellEditing(true);

    // When over a cell, jump to its default port (we only have one, anyway)
    graph.setJumpToDefaultPort(true);

    return graph;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:GraphView.java

示例14: getRendererComponent

import org.jgraph.JGraph; //导入依赖的package包/类
/**
 * Overrides the parent implementation to return the value component stored
 * in the user object instead of this renderer if a value component exists.
 * This applies some of the values installed to this renderer to the value
 * component (border, opaque) if the latter is a JComponent.
 * 
 * @return Returns a configured renderer for the specified view.
 */
@Override
public Component getRendererComponent(JGraph graph, CellView view,
		boolean sel, boolean focus, boolean preview) {
	isSelected = sel;
	graphForeground = graph.getForeground();
	isGroup = view.getCell() instanceof GroupVertex;
	isPhenodata = view.getCell() instanceof PhenodataVertex;
	if(view.getCell() instanceof AbstractGraphVertex){
		if(isGroup){
			vertex = (GroupVertex)view.getCell();
		} else if(isPhenodata){
			vertex = (PhenodataVertex)view.getCell();
		} else {
			vertex = (GraphVertex)view.getCell();
		}
	}
	this.graph = graph;
	
	return super.getRendererComponent(graph, view, sel, focus, preview);
}
 
开发者ID:chipster,项目名称:chipster,代码行数:29,代码来源:GraphRenderer.java

示例15: doAction

import org.jgraph.JGraph; //导入依赖的package包/类
/**
	 * The abstract function that descendant classes must be overridden to provide customsized handling.
	 *
	 * @param e
	 * @return true if the action is finished successfully; otherwise, return false.
	 */
	protected boolean doAction(ActionEvent e)
	{
//		Log.logInfo(this, "GraphDeleteAction's actionPerformed() is called.");
		JGraph graph = getController().getGraph();
//		if (!graph.isSelectionEmpty())
//		{
			int userChoice = JOptionPane.showConfirmDialog(getMiddlePanel(),
				"ALL mappings will be deleted, are you sure?", "Question",
				JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);

            if (userChoice == JOptionPane.YES_OPTION)
			{
				getController().handleDeleteAll();
			}
//		}
//		else
//		{
//			JOptionPane.showMessageDialog(getMiddlePanel(), "No graph is currently selected.", "No selection", JOptionPane.WARNING_MESSAGE);
//		}
		setSuccessfullyPerformed(true);
		return isSuccessfullyPerformed();
	}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:29,代码来源:GraphDeleteAllAction.java


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