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


Java AggregateItem类代码示例

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


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

示例1: handleAggregate

import prefuse.visual.AggregateItem; //导入依赖的package包/类
public static void handleAggregate(Visualization vis, int id, String nodeType, String edgeType, boolean enable) {
	
	AggregateTable at = (AggregateTable) vis.getGroup("aggregates");
	
	System.out.println("Aggregate: " + nodeType + ":" + enable);
	
	Iterator iter = vis.items(new FieldMatchGroupPredicate("graph.nodes", "type", nodeType));
	while(iter.hasNext()) {
		VisualItem item = (VisualItem) iter.next();
		Iterator aggregates = at.getAggregates(item);
		if (!aggregates.hasNext()) {
			addAggregate(id, (NodeItem)item, (AggregateItem) at.addItem(), enable);
		} else {
			while(aggregates.hasNext()) {
				addAggregate(id, (NodeItem)item, (AggregateItem) aggregates.next(), enable);
			}
		}
	}
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:20,代码来源:AggregateControl.java

示例2: itemExited

import prefuse.visual.AggregateItem; //导入依赖的package包/类
/**
 * @see prefuse.controls.Control#itemExited(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
 */
@Override
public void itemExited(VisualItem item, MouseEvent e) {

	Display d = (Display)e.getSource();
	d.setCursor(Cursor.getDefaultCursor());

	if ( !(item instanceof AggregateItem))
		return;

	if ( item instanceof AggregateItem ){
		if ( activeItem == item ) {
			activeItem = null;
			setFixed(item, false);
		}
	}
}
 
开发者ID:renespeck,项目名称:Cugar,代码行数:20,代码来源:AggregateDragControl.java

示例3: itemPressed

import prefuse.visual.AggregateItem; //导入依赖的package包/类
/**
 * @see prefuse.controls.Control#itemPressed(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
 */
@Override
public void itemPressed(VisualItem item, MouseEvent e) {
	if (!SwingUtilities.isLeftMouseButton(e)) return;

	dragged = false;
	Display d = (Display)e.getComponent();
	d.getAbsoluteCoordinate(e.getPoint(), down);

	if ( item instanceof AggregateItem )				
		setFixed(item, true);	

	if ( item instanceof NodeItem ){
		if(!item.isFixed()){
			if(focusItem != null){	
				focusItem.setFixed(false);
			}
			focusItem = item;
			item.setFixed(true);
			d.getVisualization().getGroup(Visualization.FOCUS_ITEMS).setTuple(item);
			d.revalidate();
			d.repaint();
		}else
			item.setFixed(false);
	}			
}
 
开发者ID:renespeck,项目名称:Cugar,代码行数:29,代码来源:AggregateDragControl.java

示例4: process

import prefuse.visual.AggregateItem; //导入依赖的package包/类
@Override
public void process(VisualItem item, double frac) {

    AggregateItem ai = (AggregateItem) item;
    float[] poly = (float[]) ai.get(VisualItem.POLYGON);

    if (poly == null || poly.length * 2 != ai.getAggregateSize()) {
        poly = new float[ai.getAggregateSize() * 2];
        ai.set(VisualItem.POLYGON, poly);
    }

    int i = 0;
    @SuppressWarnings("unchecked")
    Iterator<VisualItem> visualItems = ai.items();
    while (visualItems.hasNext()) {
        VisualItem vi = visualItems.next();
        poly[i] = (float) vi.getX();
        i++;
        poly[i] = (float) vi.getY();
        i++;
    }
}
 
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:23,代码来源:PolygonAggregateLayout.java

示例5: itemEntered

import prefuse.visual.AggregateItem; //导入依赖的package包/类
public void itemEntered(VisualItem item, MouseEvent e) {
    Display d = (Display)e.getSource();
    d.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    activeItem = item;
    if ( !(item instanceof AggregateItem) )
        setFixed(item, true);
}
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:8,代码来源:DLGVisualizer.java

示例6: itemPressed

import prefuse.visual.AggregateItem; //导入依赖的package包/类
public void itemPressed(VisualItem item, MouseEvent e) {
    if (!SwingUtilities.isLeftMouseButton(e)) return;
    dragged = false;
    Display d = (Display)e.getComponent();
    d.getAbsoluteCoordinate(e.getPoint(), down);
    if ( item instanceof AggregateItem )
        setFixed(item, true);
}
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:9,代码来源:DLGVisualizer.java

示例7: setFixed

import prefuse.visual.AggregateItem; //导入依赖的package包/类
protected static void setFixed(VisualItem item, boolean fixed) {
    if ( item instanceof AggregateItem ) {
        Iterator items = ((AggregateItem)item).items();
        while ( items.hasNext() ) {
            setFixed((VisualItem)items.next(), fixed);
        }
    } else {
        item.setFixed(fixed);
    }
}
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:11,代码来源:DLGVisualizer.java

示例8: move

import prefuse.visual.AggregateItem; //导入依赖的package包/类
protected static void move(VisualItem item, double dx, double dy) {
    if ( item instanceof AggregateItem ) {
        Iterator items = ((AggregateItem)item).items();
        while ( items.hasNext() ) {
            move((VisualItem)items.next(), dx, dy);
        }
    } else {
        double x = item.getX();
        double y = item.getY();
        item.setStartX(x);  item.setStartY(y);
        item.setX(x+dx);    item.setY(y+dy);
        item.setEndX(x+dx); item.setEndY(y+dy);
    }
}
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:15,代码来源:DLGVisualizer.java

示例9: initDataGroups

import prefuse.visual.AggregateItem; //导入依赖的package包/类
private void initDataGroups() {
    // create sample graph
    // 9 nodes broken up into 3 interconnected cliques
    Graph g = new Graph();
    for ( int i=0; i<3; ++i ) {
        Node n1 = g.addNode();
        Node n2 = g.addNode();
        Node n3 = g.addNode();
        g.addEdge(n1, n2);
        g.addEdge(n1, n3);
        g.addEdge(n2, n3);
    }
    g.addEdge(0, 3);
    g.addEdge(3, 6);
    g.addEdge(6, 0);
    
    // add visual data groups
    VisualGraph vg = m_vis.addGraph(GRAPH, g);
    m_vis.setInteractive(EDGES, null, false);
    m_vis.setValue(NODES, null, VisualItem.SHAPE,
            new Integer(Constants.SHAPE_ELLIPSE));
    
    AggregateTable at = m_vis.addAggregates(AGGR);
    at.addColumn(VisualItem.POLYGON, float[].class);
    at.addColumn("id", int.class);
    
    // add nodes to aggregates
    // create an aggregate for each 3-clique of nodes
    Iterator nodes = vg.nodes();
    for ( int i=0; i<3; ++i ) {
        AggregateItem aitem = (AggregateItem)at.addItem();
        aitem.setInt("id", i);
        for ( int j=0; j<3; ++j ) {
            aitem.addItem((VisualItem)nodes.next());
        }
    }
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:38,代码来源:AggregateDemo.java

示例10: itemEntered

import prefuse.visual.AggregateItem; //导入依赖的package包/类
/**
 * @see prefuse.controls.Control#itemEntered(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
 */
public void itemEntered(VisualItem item, MouseEvent e) {
    Display d = (Display)e.getSource();
    d.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    activeItem = item;
    if ( !(item instanceof AggregateItem) )
        setFixed(item, true);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:11,代码来源:AggregateDemo.java

示例11: itemPressed

import prefuse.visual.AggregateItem; //导入依赖的package包/类
/**
 * @see prefuse.controls.Control#itemPressed(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
 */
public void itemPressed(VisualItem item, MouseEvent e) {
    if (!SwingUtilities.isLeftMouseButton(e)) return;
    dragged = false;
    Display d = (Display)e.getComponent();
    d.getAbsoluteCoordinate(e.getPoint(), down);
    if ( item instanceof AggregateItem )
        setFixed(item, true);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:12,代码来源:AggregateDemo.java

示例12: collapseAggregate

import prefuse.visual.AggregateItem; //导入依赖的package包/类
public static void collapseAggregate(Visualization vis, String nodeType, boolean enable) {
	Iterator iter = vis.items(new FieldMatchGroupPredicate("aggregates", "type", nodeType));
	

	while(iter.hasNext()) {
		AggregateItem aitem = (AggregateItem)iter.next();
		
		double x = aitem.getBounds().getCenterX();
		double y = aitem.getBounds().getCenterY();

		// Make all items invisable...
		Iterator aiter = aitem.items();
		while(aiter.hasNext()) { 
			NodeItem item = (NodeItem)aiter.next();
			item.setVisible(enable);
			
			if (!enable) {
				item.setFixed(true);
				PrefuseLib.setX(item, null, x);
				PrefuseLib.setY(item, null, y);
			}
			
			Iterator edges = item.edges();
			while(edges.hasNext()) {
				EdgeItem e = (EdgeItem)edges.next();
				VisualItem target = e.getTargetItem();
				VisualItem source = e.getSourceItem();
				if (aitem.containsItem(target) && aitem.containsItem(source)) {
					e.setVisible(enable);
				}
			}
		}
	}
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:35,代码来源:AggregateControl.java

示例13: addAggregate

import prefuse.visual.AggregateItem; //导入依赖的package包/类
private static void addAggregate(int id, NodeItem node, AggregateItem aitem, boolean enable) {
	System.out.println("\t" + node.toString());
	
	aitem.set("id", id);
	aitem.set("type", node.getString("type"));
	Iterator edges = node.edges();
	if (enable) {
		aitem.addItem(node);
	} else {
		aitem.removeItem(node);
	}
	
	while(edges.hasNext()) {
		EdgeItem e = (EdgeItem)edges.next();
		VisualItem target = e.getTargetItem();
		VisualItem source = e.getSourceItem();
		
		System.out.println("\t\t-->" + target.toString());
		System.out.println("\t\t-->" + source.toString());
		
		aitem.setInt("id", 1);
    	if (!target.equals(node)) {
    		if (enable) {
    			aitem.addItem(target);
    		} else {
    			aitem.removeItem(target);
    		}
    	}
    	if (!source.equals(node)) {
    		if (enable) {
    			aitem.addItem(source);
    		} else {
    			aitem.removeItem(source);
    		}
    	}
   }

}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:39,代码来源:AggregateControl.java

示例14: initDataGroups

import prefuse.visual.AggregateItem; //导入依赖的package包/类
private void initDataGroups() {
    // create sample graph
    // 9 nodes broken up into 3 interconnected cliques
    Graph g = new Graph();
    for ( int i=0; i<3; ++i ) {
        Node n1 = g.addNode();
        Node n2 = g.addNode();
        Node n3 = g.addNode();
        g.addEdge(n1, n2);
        g.addEdge(n1, n3);
        g.addEdge(n2, n3);
    }
    g.addEdge(0, 3);
    g.addEdge(3, 6);
    g.addEdge(6, 0);
    
    // add visual data groups
    VisualGraph vg = m_vis.addGraph(GRAPH, g);
    m_vis.setInteractive(EDGES, null, false);
    m_vis.setValue(NODES, null, VisualItem.SHAPE,
            new Integer(Constants.SHAPE_ELLIPSE));
    
    AggregateTable at = m_vis.addAggregates(AGGR);
    at.addColumn(VisualItem.POLYGON, float[].class);
    at.addColumn("id", int.class);
    
    // add nodes to aggregates
    // create an aggregate for each 3-clique of nodes
    Iterator<?> nodes = vg.nodes();
    for ( int i=0; i<3; ++i ) {
        AggregateItem aitem = (AggregateItem)at.addItem();
        aitem.setInt("id", i);
        for ( int j=0; j<3; ++j ) {
            aitem.addItem((VisualItem)nodes.next());
        }
    }
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:38,代码来源:AggregateDemo.java

示例15: setFixed

import prefuse.visual.AggregateItem; //导入依赖的package包/类
protected static void setFixed(VisualItem item, boolean fixed) {
    if ( item instanceof AggregateItem ) {
        Iterator<?> items = ((AggregateItem)item).items();
        while ( items.hasNext() ) {
            setFixed((VisualItem)items.next(), fixed);
        }
    } else {
        item.setFixed(fixed);
    }
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:11,代码来源:AggregateDemo.java


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