• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GraphSelectionEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initListeners

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/** Initialises the graph selection listener and attributed graph listener. */
private void initListeners() {
    getJGraph().setToolTipEnabled(true);
    // Update ToolBar based on Selection Changes
    getJGraph().getSelectionModel()
        .addGraphSelectionListener(new GraphSelectionListener() {
            @Override
            public void valueChanged(GraphSelectionEvent e) {
                // Update Button States based on Current Selection
                boolean selected = !getJGraph().isSelectionEmpty();
                getDeleteAction().setEnabled(selected);
                getCopyAction().setEnabled(selected);
                getCutAction().setEnabled(selected);
            }
        });
    getJGraph().addJGraphModeListener(this);
    getSnapToGridAction().addSnapListener(this);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:19,代码来源:GraphEditorTab.java


示例2: installListeners

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
@Override
protected void installListeners() {
    this.graphSelectionListener = new GraphSelectionListener() {
        @Override
        public void valueChanged(GraphSelectionEvent e) {
            if (StateDisplay.this.matchSelected) {
                // change only if cells were removed from the selection
                boolean removed = false;
                Object[] cells = e.getCells();
                for (int i = 0; !removed && i < cells.length; i++) {
                    removed = !e.isAddedCell(i);
                }
                if (removed) {
                    clearSelectedMatch(false);
                }
            }
        }
    };
    getSimulatorModel().addListener(this, GRAMMAR, GTS, STATE, MATCH);
    activateListening();
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:StateDisplay.java


示例3: installListeners

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
void installListeners() {
    getJGraph().addPropertyChangeListener(org.jgraph.JGraph.GRAPH_MODEL_PROPERTY,
        new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                updateModel();
            }
        });
    getJGraph().addGraphSelectionListener(new GraphSelectionListener() {
        @Override
        public void valueChanged(GraphSelectionEvent e) {
            clearSelection();
        }
    });
    getFilter().addObserver(new Observer() {
        @Override
        @SuppressWarnings("unchecked")
        public void update(Observable o, Object arg) {
            LabelTree.this.repaint();
            getJGraph().refreshCells((Set<JCell<G>>) arg);
        }
    });
    addMouseListener(new MyMouseListener());
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:25,代码来源:LabelTree.java


示例4: RuleLevelTree

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/** Creates a new tree, for a given rule model. */
public RuleLevelTree(AspectJGraph jGraph) {
    this.jGraph = jGraph;
    setLargeModel(true);
    setEnabled(jGraph.isEnabled());
    setShowsRootHandles(false);
    getUI().setCollapsedIcon(null);
    getUI().setExpandedIcon(null);
    addMouseListener(new MyMouseListener());
    // deselect the level tree whenever the graph
    // selection changes
    jGraph.addGraphSelectionListener(new GraphSelectionListener() {
        @Override
        public void valueChanged(GraphSelectionEvent e) {
            clearSelection();
        }
    });
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:19,代码来源:RuleLevelTree.java


示例5: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/** Sets {@link #oldLabel} based on the {@link JGraph} selection. */
@Override
public void valueChanged(GraphSelectionEvent e) {
    this.oldLabel = null;
    Object[] selection = ((JGraph<?>) e.getSource()).getSelectionCells();
    if (selection != null && selection.length > 0) {
        Collection<? extends Label> selectedEntries = ((JCell<?>) selection[0]).getKeys();
        if (selectedEntries.size() > 0) {
            Label selectedEntry = selectedEntries.iterator()
                .next();
            if (selectedEntry instanceof TypeElement) {
                this.oldLabel = ((TypeElement) selectedEntry).label();
            }
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:17,代码来源:FindReplaceAction.java


示例6: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
public void valueChanged(GraphSelectionEvent e) {
	
	if(isVisible()){
		Object cell = e.getCells()[0];
		if(cell != null){
			if(propertiesPane != null)
				propertiesPane.showProperties(cell, this);			
			showInfoDetails(cell);
			if(cell instanceof PlaceCell || cell instanceof TransitionCell){
				BasicCell basicCell = (BasicCell) cell;
				GraphLabel label = (GraphLabel)getCellFromData(basicCell.getData().getChild("name"));					
				addSelectionCell(label);
			}
		}
	}
}
 
开发者ID:tvaquero,项目名称:itsimple,代码行数:17,代码来源:ItGraph.java


示例7: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(GraphSelectionEvent e) {
    Object[] cells = e.getCells();
    for (int i = 0; i < cells.length; i++) {
        Object c = cells[i];
        if (c instanceof JCell) {
            @SuppressWarnings("unchecked")
            JCell<G> jCell = (JCell<G>) c;
            jCell.putVisual(VisualKey.EMPHASIS, e.isAddedCell(i));
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:13,代码来源:JGraph.java


示例8: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/**
 * Called whenever the value of the selection changes.
 *
 * @param e the event that characterizes the change.
 */
public void valueChanged(GraphSelectionEvent e)
{
	MappingMainPanel mappingPanel= graphController.getMappingPanel();
       mappingPanel.getGraphController().setGraphSelected(true);
	//the graph is in selection mode, do not set property pan for Element or Attribute
       if(!isAClearSelectionEvent(e))
	{//ignore if it is a clear selection event
		Object obj = e.getCell();
		if (obj instanceof DefaultEdge)
		{//only handles edge, when graph is NOT in CLEAR selection mode.
			DefaultEdge edge = (DefaultEdge) obj;
			DefaultPort srcPort=(DefaultPort)edge.getSource();
			DefaultPort trgtPort=(DefaultPort)edge.getTarget();
			//manually highlight if and only if it is orignated from graph selection.
			Object sourceUserObject =srcPort.getUserObject();
			highlightTreeNodeInTree(sourceUserObject);
			//manually highlight if and only if it is orignated from graph selection.
			Object targetUserObject =trgtPort.getUserObject();// getUserObject(target);
			highlightTreeNodeInTree(targetUserObject);
		}
	}
	
	if(e.getCell() instanceof DefaultGraphCell)
	{
		DefaultGraphCell newSelection = (DefaultGraphCell)e.getCell();
		DefaultPropertiesSwitchController propertySwitchConroller =(DefaultPropertiesSwitchController)mappingPanel.getMiddlePanel().getGraphController().getPropertiesSwitchController();
		propertySwitchConroller.setSelectedItem(newSelection);
	}
	mappingPanel.getMiddlePanel().getGraphController().getPropertiesSwitchController().getPropertiesPage().updateProptiesDisplay(null);
	mappingPanel.getMiddlePanel().getGraphController().setGraphSelected(false);
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:37,代码来源:LinkSelectionHighlighter.java


示例9: isAClearSelectionEvent

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/**
 * If it is clear selection event, the isAddedXXX() will return false, so the return will be true, i.e., it is a clear selection event.
 * @param event
 * @return true if it is a clear selection event; otherwise, return false.
 */
private boolean isAClearSelectionEvent(EventObject event)
{
	boolean result = false;
	if(event instanceof GraphSelectionEvent)
	{
		result = !((GraphSelectionEvent) event).isAddedCell();
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:15,代码来源:LinkSelectionHighlighter.java


示例10: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(GraphSelectionEvent e) {
	super.valueChanged(e);
	// Bomb out with a ClassCastException in case the event's source is
	// something unexpected. Not robust, but a good debugging feature :)
	GraphSelectionModel sm = (GraphSelectionModel) e.getSource();

	// New --- Bertoli Marco ---
	// Checks selection cells to enables correct toolbar elements
	boolean foundStations = false;
	boolean foundBlockingRegion = false;
	boolean foundConnection = false;
	boolean cannotAddBlockingRegion = false;
	Object[] cells = sm.getSelectionCells();
	for (Object cell : cells) {
		if (cell instanceof JmtCell) {
			foundStations = true;
			// If selected station is member of a BlockingRegion, signals it
			if (((JmtCell) cell).getParent() instanceof BlockingRegion) {
				cannotAddBlockingRegion = true;
			}
			// If selected cell cannot be added to a blocking region, signals it
			if (((JmtCell) cell).generateOrDestroyJobs()) {
				cannotAddBlockingRegion = true;
			}
		} else if (cell instanceof BlockingRegion) {
			foundBlockingRegion = true;
			cannotAddBlockingRegion = true;
		} else if (cell instanceof JmtEdge) {
			foundConnection = true;
		}
		// Shorten cycle to avoid useless computation
		if (foundStations && foundBlockingRegion) {
			break;
		}
	}

	if (foundStations) {
		mediator.enableCutAction(true);
		mediator.enableCopyAction(true);
		mediator.enableDeleteAction(true);
		mediator.enableAddBlockingRegion(!cannotAddBlockingRegion);
		mediator.enableRotateAction(true);
		mediator.enableSetRight(true);
	} else if (foundBlockingRegion) {
		mediator.enableCutAction(true);
		mediator.enableCopyAction(true);
		mediator.enableDeleteAction(true);
		mediator.enableAddBlockingRegion(false);
		mediator.enableRotateAction(false);
	} else {
		mediator.enableCutAction(false);
		mediator.enableCopyAction(false);
		mediator.enableDeleteAction(false);
		mediator.enableAddBlockingRegion(false);
		mediator.enableRotateAction(false);
	}
	if (foundConnection) {
		mediator.enableDeleteAction(true);
	}
	// End new --- Bertoli Marco ---
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:63,代码来源:JmtGraphUI.java


示例11: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(GraphSelectionEvent e) {
	super.valueChanged(e);
	// Bomb out with a ClassCastException in case the event's source is
	// something unexpected. Not robust, but a good debugging feature :)
	GraphSelectionModel sm = (GraphSelectionModel) e.getSource();

	// New --- Bertoli Marco ---
	// Checks selection cells to enables correct toolbar elements
	boolean foundStations = false;
	boolean cannotAddBlockingRegion = false;
	boolean foundConnection = false;
	Object[] cells = sm.getSelectionCells();
	for (Object cell : cells) {
		if (cell instanceof JmtCell) {
			foundStations = true;
			// If selected station is member of a BlockingRegion, signals it
			if (((JmtCell) cell).getParent() instanceof BlockingRegion) {
				cannotAddBlockingRegion = true;
			}
			// If selected cell cannot be added to a blocking region, signals it
			if (((JmtCell) cell).generateOrDestroyJobs()) {
				cannotAddBlockingRegion = true;
			}
		} else if (cell instanceof BlockingRegion) {
			cannotAddBlockingRegion = true;
		} else if (cell instanceof JmtEdge) {
			foundConnection = true;
		}
		// Shorten cycle to avoid useless computation
		if (cannotAddBlockingRegion && foundStations) {
			break;
		}
	}

	if (foundStations || cannotAddBlockingRegion) {
		mediator.enableCopyAction(true);
		mediator.enableCutAction(true);
		mediator.enableDeleteAction(true);
		mediator.enableAddBlockingRegion(!cannotAddBlockingRegion);

		//            	Giuseppe De Cicco & Fabio Granara
		mediator.enableRotateAction(true);
		mediator.enableSetRight(true);

	} else {
		mediator.enableCopyAction(false);
		mediator.enableCutAction(false);
		mediator.enableDeleteAction(false);
		mediator.enableAddBlockingRegion(false);
	}
	if (foundConnection) {
		mediator.enableDeleteAction(true);
		// End new --- Bertoli Marco ---
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:57,代码来源:JmtGraphUI.java


示例12: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/**
 * Sets the j-cell to the first selected cell. Disables the action if
 * the type of the cell disagrees with the expected type.
 */
@Override
public void valueChanged(GraphSelectionEvent e) {
    refresh();
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:9,代码来源:AspectJGraph.java


示例13: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/** Sets {@link #label} based on the {@link JGraph} selection. */
@Override
public void valueChanged(GraphSelectionEvent e) {
    checkJGraph((JGraph<?>) e.getSource());
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:6,代码来源:SelectColorAction.java


示例14: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
public void valueChanged(GraphSelectionEvent e) {
	editor.updateSelectionButtons();
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:4,代码来源:TBoardContainer.java


示例15: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
public void valueChanged(GraphSelectionEvent graphSelectionEvent)
{
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:4,代码来源:DBWizardEREditor.java


示例16: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
/**
 * Called whenever the value of the selection changes.
 *
 * @param e the event that characterizes the change.
 */
public void valueChanged(GraphSelectionEvent e)
{
	if (mappingPanel.isInDragDropMode())
		return;
	//clean tree highlight if remove graph highlight
    if (!e.isAddedCell())
    {
		if (mappingPanel.getTargetTree() == null)
		{
			JOptionPane.showMessageDialog(mappingPanel, "You should input the source file name first(2).", "No Source file", JOptionPane.ERROR_MESSAGE);
			return;
		}
		else 
			mappingPanel.getTargetTree().clearSelection();
	  
		if (mappingPanel.getSourceTree() == null)
		{
			JOptionPane.showMessageDialog(mappingPanel, "You should input the target file name first(2).", "No Target file", JOptionPane.ERROR_MESSAGE);
			return;
		}
		else 
			mappingPanel.getSourceTree().clearSelection();
    	return;
    }
	if(graphInSelection)
		return;

	graphInSelection = true;
	Object obj = e.getCell();
	if (obj instanceof DefaultEdge)
	{//only handles edge, when graph is NOT in CLEAR selection mode.
		DefaultEdge edge = (DefaultEdge) obj;
		Object source = edge.getSource();
		Object target = edge.getTarget();
		Object sourceUserObject = getUserObject(source);
		highlightTreeNodeInTree(mappingPanel.getSourceTree(), sourceUserObject);

		Object targetUserObject = getUserObject(target);
		highlightTreeNodeInTree(mappingPanel.getTargetTree(), targetUserObject);
	}
	graphInSelection = false;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:48,代码来源:LinkSelectionHighlighter.java


示例17: valueChanged

import org.jgraph.event.GraphSelectionEvent; //导入依赖的package包/类
public void valueChanged(GraphSelectionEvent e) {
	if (!internalSelection) {

		boolean emptySelection = (graph.getSelectionCount() == 0);

		application.getSelectionManager().clearAll(emptySelection, graph);

		ArrayList<AbstractGraphVertex> vertexes = new ArrayList<AbstractGraphVertex>();

		for (Object obj : graph.getSelectionCells()) {

			if (obj instanceof GroupVertex) {
				GroupVertex group = (GroupVertex) obj;

				vertexes.addAll(group.getChildVertexes());
			}

			if (obj instanceof GraphVertex) {
				vertexes.add((AbstractGraphVertex) obj);
			}
		}

		ArrayList<DataItem> items = new ArrayList<DataItem>();

		for (AbstractGraphVertex vertex : vertexes) {
			items.add((DataItem) vertex.getUserObject());
		}

		application.getSelectionManager().selectMultiple(items, graph);
	}
}
 
开发者ID:chipster,项目名称:chipster,代码行数:32,代码来源:GraphPanel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Coordinate类代码示例发布时间:2022-05-23
下一篇:
Java XPathException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap