本文整理汇总了Java中org.eclipse.zest.core.widgets.GraphConnection类的典型用法代码示例。如果您正苦于以下问题:Java GraphConnection类的具体用法?Java GraphConnection怎么用?Java GraphConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphConnection类属于org.eclipse.zest.core.widgets包,在下文中一共展示了GraphConnection类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: flowGraphNodeDoubleClicked
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
public void flowGraphNodeDoubleClicked(GraphNode node){
DerivedStreamContainer psc=gs.getContainerNameMap().get(node.getData());
if(psc==null){
return;
}
for(Long downId: psc.getDownContainerIdList()){
DerivedStreamContainer downStream=gs.getContainerIdMap().get(downId);
if(downStream==null){ return; }
if(flowGraph.getData(downStream.getUniqueName())==null){
GraphNode downNode=newFlowGraphNode(downStream);
new GraphConnection(flowGraph, SWT.ARROW, node, downNode);
}
}
flowGraph.removeMouseListener(flowGraphListener);
flowGraph.setLayoutAlgorithm(flowLayoutAlgorithm, true);
flowGraph.addMouseListener(flowGraphListener);
}
示例2: createConnections
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
private void createConnections(Refinement refinement) {
int connectionStyle = ZestStyles.CONNECTIONS_DIRECTED;
for (RefinementReason reason : refinement.getReasons()) {
VariationPoint sourceVP = reason.getSource();
VariationPoint targetVP = reason.getTarget();
GraphNode source = nodeIndex.get(sourceVP);
GraphNode target = nodeIndex.get(targetVP);
if (!isValidNewConnection(source, target)) {
continue;
}
GraphConnection connection = new GraphConnection(this, connectionStyle, source, target);
connection.setHighlightColor(COLOR_CONNECTION_HIGHLIGHT);
if (!areFocused(sourceVP, targetVP)) {
connection.setLineStyle(SWT.LINE_DASH);
connection.setLineColor(COLOR_CONNECTION_NOTFOCUSED);
} else {
connection.setLineColor(COLOR_CONNECTION_FOCUSED);
}
connection.setTooltip(new Label(reason.getReason()));
connectedNodes.put(source, target);
}
}
示例3: clear
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
/**
* Clear the graph.
*/
public void clear() {
nodeIndex.clear();
connectedNodes.clear();
focusedRefinement = null;
Object[] nodeArray = getNodes().toArray();
for (Object nodeObj : nodeArray) {
((GraphNode) nodeObj).dispose();
}
Object[] connectionArray = getConnections().toArray();
for (Object connectionObj : connectionArray) {
((GraphConnection) connectionObj).dispose();
}
this.layout();
}
示例4: instanceTableCellSelected
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
public void instanceTableCellSelected(String instanceName){
if(instanceName==null){
return;
}
DerivedStreamContainer dsc=gs.getContainerNameMap().get(instanceName);
clearGraph(flowGraph);
if(dsc==null){
return;
}
GraphNode selfNode=newFlowGraphNode(dsc);
for(Stream upStream: dsc.getUpStreams()){
GraphNode upNode=newFlowGraphNode(upStream);
new GraphConnection(flowGraph, SWT.ARROW, upNode, selfNode);
}
for(Long downId: dsc.getDownContainerIdList()){
DerivedStreamContainer downStream=gs.getContainerIdMap().get(downId);
if(downStream==null){ return; }
GraphNode downNode=newFlowGraphNode(downStream);
new GraphConnection(flowGraph, SWT.ARROW, selfNode, downNode);
}
flowGraph.removeMouseListener(flowGraphListener);
flowGraph.setLayoutAlgorithm(flowLayoutAlgorithm, true);
flowGraph.addMouseListener(flowGraphListener);
updateInstanceStatTable(instanceName);
}
示例5: addFactoryState
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
private void addFactoryState(int depth, GraphNode envnode,
CTFactoryState state) {
GraphNode factorystatenode = getNode(state, "" + state);
factorystatenode.setBackgroundColor(graph.LIGHT_BLUE);
setNodeLocation(depth, factorystatenode);
new GraphConnection(graph, SWT.NONE, envnode, factorystatenode);
CTFactory factory = state.getFactory();
addFactory(depth + 3, factorystatenode, factory);
List<CTFactoryState> fs = state.getFactories();
for (CTFactoryState childstate : fs) {
addFactoryState(depth + 3, factorystatenode, childstate);
}
List<CTToolUser> toolusers = state.getToolUsers();
for (CTToolUser tooluser : toolusers) {
String toolname = tooluser.getName();
if (toolname == null) {
toolname = "" + tooluser;
}
GraphNode toolusernode = getNode(tooluser, toolname);
setNodeLocation(depth, toolusernode);
new GraphConnection(graph, SWT.NONE, factorystatenode, toolusernode);
}
}
示例6: addFactory
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
private void addFactory(int depth, GraphNode parent, CTFactory factory) {
GraphNode factorynode = getNode(factory, "" + factory);
setNodeLocation(depth, factorynode);
new GraphConnection(graph, SWT.NONE, parent, factorynode);
Set<String> fs = factory.getFactories();
for (String string : fs) {
CTAttachedFactory childfactory = factory.getFactory(string);
addFactory(depth + 3, factorynode, childfactory.getFactory());
}
addEnvironment(depth + 1, factorynode, factory.getEnvironment());
}
示例7: addEnvironment
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
private void addEnvironment(int depth, GraphNode parent,
CTEnvironment environment) {
Set<String> tools = environment.getTools();
for (String string : tools) {
CTTool tool = environment.getTool(string);
GraphNode toolnode = getNode(tool, string);
setNodeLocation(depth, toolnode);
new GraphConnection(graph, SWT.NONE, parent, toolnode);
}
}
示例8: clear
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
private void clear() {
List<GraphConnection> cs = new LinkedList<GraphConnection>(
graph.getConnections());
for (GraphConnection c : cs) {
c.dispose();
}
List<GraphNode> ns = new LinkedList<GraphNode>(graph.getNodes());
for (GraphNode graphNode : ns) {
graphNode.dispose();
}
nodes.clear();
}
示例9: construct
import org.eclipse.zest.core.widgets.GraphConnection; //导入依赖的package包/类
@Override
public Control construct(Composite parent) {
Composite content = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(content);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(content);
Graph graph = new Graph(content, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(graph);
// now a few nodes
GraphNode node1 = new GraphNode(graph, SWT.NONE, "Jim");
GraphNode node2 = new GraphNode(graph, SWT.NONE, "Jack");
GraphNode node3 = new GraphNode(graph, SWT.NONE, "Joe");
GraphNode node4 = new GraphNode(graph, SWT.NONE, "Bill");
// Lets have a directed connection
new GraphConnection(graph, ZestStyles.CONNECTIONS_DIRECTED, node1,
node2);
// Lets have a dotted graph connection
new GraphConnection(graph, ZestStyles.CONNECTIONS_DOT, node2, node3);
// Standard connection
new GraphConnection(graph, SWT.NONE, node3, node1);
// Change line color and line width
GraphConnection graphConnection = new GraphConnection(graph, SWT.NONE,
node1, node4);
graphConnection.changeLineColor(parent.getDisplay().getSystemColor(SWT.COLOR_GREEN));
// Also set a text
graphConnection.setText("This is a text");
graphConnection.setHighlightColor(parent.getDisplay().getSystemColor(SWT.COLOR_RED));
graphConnection.setLineWidth(3);
graph.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
// Selection listener on graphConnect or GraphNode is not supported
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=236528
graph.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
System.out.println(e);
}
});
return content;
}