本文整理汇总了Java中org.cytoscape.view.model.CyNetworkView.updateView方法的典型用法代码示例。如果您正苦于以下问题:Java CyNetworkView.updateView方法的具体用法?Java CyNetworkView.updateView怎么用?Java CyNetworkView.updateView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cytoscape.view.model.CyNetworkView
的用法示例。
在下文中一共展示了CyNetworkView.updateView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateView
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public static void updateView(CyNetworkView view, String layoutAlgorName){
CyAppAdapter appAdapter = CyActivator.getCyAppAdapter();
CyLayoutAlgorithmManager alMan = appAdapter.getCyLayoutAlgorithmManager();
CyLayoutAlgorithm algor = null;
if (layoutAlgorName == null) {
algor = alMan.getDefaultLayout(); // default grid layout
} else{
algor = alMan.getLayout(layoutAlgorName);
}
if(algor == null){
algor = alMan.getDefaultLayout();
throw new IllegalArgumentException ("No such algorithm found '" + layoutAlgorName + "'.");
}
TaskIterator itr = algor.createTaskIterator(view,algor.createLayoutContext(),CyLayoutAlgorithm.ALL_NODE_VIEWS,null);
appAdapter.getTaskManager().execute(itr);// We use the synchronous task manager otherwise the visual style and updateView() may occur before the view is relayed out:
SynchronousTaskManager<?> synTaskMan = appAdapter.getCyServiceRegistrar().getService(SynchronousTaskManager.class);
synTaskMan.execute(itr);
view.updateView(); // update view layout part
appAdapter.getVisualMappingManager().getVisualStyle(view).apply(view); // update view style part
}
示例2: UpdateNodeNames
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public static void UpdateNodeNames(CyNetworkView myNetView) {
if (done == 1) {
return;
}
CyNetwork myNetwork = myNetView.getModel();
DataConnectionRest dataConnection = new DataConnectionRest();
for (View<CyNode> myNode : myNetView.getNodeViews()) {
int nodeID = Integer.parseInt(myNetwork.getRow(myNode.getModel()).get(CyNetwork.NAME, String.class).replaceAll("\"", ""));
String userName = dataConnection.getUserNameFromID(nodeID);
myNode.setVisualProperty(BasicVisualLexicon.NODE_LABEL, userName);
myNode.setVisualProperty(BasicVisualLexicon.NODE_WIDTH, userName.length() * 7.5);
}
myNetView.updateView();
done = 1;
}
示例3: updateVisualStyle
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
/**
* updates visual style for a specific network
*/
public static void updateVisualStyle(Plugin plugin, CyNetworkView view, CyNetwork network) {
VisualStyle vs = plugin.getVisualStypeCreator().getVisualStyle(network);
plugin.getVisualMappingManager().setVisualStyle(vs, view);
vs.apply(view);
view.updateView();
}
示例4: ShowAdjacentNodes
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public static void ShowAdjacentNodes(CyNetworkView myNetView) {
TreeMap<Long, CyNode> nodesToKeep = new TreeMap<Long, CyNode>();
CyNetwork myNetwork = myNetView.getModel();
CyNode node = nodeView.getModel();
// include the current node in the list of nodes to keep
nodesToKeep.put(node.getSUID(), node);
// get all neighbors of current node
List<CyNode> myNeighbors = myNetwork.getNeighborList(node, CyEdge.Type.ANY);
Iterator<CyNode> myNeighborsIter = myNeighbors.iterator();
while (myNeighborsIter.hasNext()) {
CyNode tempNode = myNeighborsIter.next();
if (!nodesToKeep.containsKey(tempNode.getSUID())) {
nodesToKeep.put(tempNode.getSUID(), tempNode);
}
}
// for each node in the view, set it visible or not depending on nodesToKeep
for (View<CyNode> myNode : myNetView.getNodeViews()) {
if (!nodesToKeep.containsKey(myNode.getModel().getSUID())) {
myNode.setVisualProperty(BasicVisualLexicon.NODE_VISIBLE, false);
}
else {
myNode.setVisualProperty(BasicVisualLexicon.NODE_VISIBLE, true);
}
}
// for each edge in the view, set it visible or not depending on whether the endpoints are in nodesToKeep
for (View<CyEdge> myEdge : myNetView.getEdgeViews()) {
if (nodesToKeep.containsKey(myEdge.getModel().getSource().getSUID()) &&
nodesToKeep.containsKey(myEdge.getModel().getTarget().getSUID())) {
myEdge.setVisualProperty(BasicVisualLexicon.EDGE_VISIBLE, true);
}
else {
myEdge.setVisualProperty(BasicVisualLexicon.EDGE_VISIBLE, false);
}
}
myNetView.updateView();
}
示例5: updateVisualStyle
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public static void updateVisualStyle(VisualMappingManager visualMappingMgr, CyNetworkView view, CyNetwork network) {
VisualStyle vs = visualMappingMgr.getDefaultVisualStyle();
visualMappingMgr.setVisualStyle(vs, view);
vs.apply(view);
view.updateView();
}
示例6: executeFilter
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
/**
* Executes the Edge Filter.
*/
void executeFilter() {
HashSet<String> selectedInteractionSet = new HashSet<String>();
for (JCheckBox checkBox : checkBoxSet) {
String action = checkBox.getActionCommand();
if (checkBox.isSelected()) {
selectedInteractionSet.add(action);
}
}
//collect edges with currently selected interaction types
final ArrayList<CyEdge> edgeList = new ArrayList<CyEdge>();
for (CyEdge edge: cyNetwork.getEdgeList()) {
String interactionType = cyNetwork.getRow(edge).get("interaction", String.class);
if (!selectedInteractionSet.contains(interactionType)) {
edgeList.add(edge);
}
}
final CyNetworkView networkView =
App.cyServices.applicationManager.getCurrentNetworkView();
//Un-hide all edges
setVisibleEdges(cyNetwork.getEdgeList(), true, networkView);
//Hide unchecked type edges
setVisibleEdges(edgeList, false, networkView);
//update view
App.cyServices.mappingManager.getVisualStyle(networkView).apply(networkView);
networkView.updateView();
}
示例7: applyXYMap
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public void applyXYMap(Map<String,List<Double>> xyMap, CyNetwork currNetwork, CyApplicationManager manager){
CyNetworkView currNetworkView2 = manager.getCurrentNetworkView();
List<CyNode> currNodes = currNetwork.getNodeList();
for (CyNode node:currNodes){
String nName=currNetwork.getRow(node).get("name", String.class);
for (Map.Entry<String, List<Double>> entry : xyMap.entrySet()) {
String key = entry.getKey();
if (key.equals(nName)){
List<Double> values = entry.getValue();
View<CyNode> currNodeView= currNetworkView2.getNodeView(node) ;
currNodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, values.get(0));
currNodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, values.get(1));
}
}
}
currNetworkView2.updateView();
currNetworkView2.fitContent();
}
示例8: doMyLayout
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public void doMyLayout (double pourcentage){
undoSlider.setPourcentage(pourcentage);
//System.out.println("LIST in do Layout " );
//dMet.getNetworkList(adapter);
final CyApplicationManager manager = adapter.getCyApplicationManager();
final CyNetworkManager netmanager = adapter.getCyNetworkManager();
CyNetworkView currNetworkView = manager.getCurrentNetworkView();
//System.out.println(" do layout p " + pourcentage);
CyNetwork currNetwork = manager.getCurrentNetwork();
//CyTable myreftable = myrefnetwork.getDefaultNodeTable();
List<CyNode> currNodes = currNetwork.getNodeList();
for (CyNode pcaNode:currNodes){
String pcaName = currNetwork.getRow(pcaNode).get("name", String.class);
//System.out.println("name " + pcaName);
for (Map.Entry<String, List<Double>> pcaEntry : netMap2.entrySet()) {
String pcaKey = pcaEntry.getKey();
// to be given by user p%
for (Map.Entry<String, List<Double>> currEntry : currNetMap.entrySet()) {
String currKey = currEntry.getKey();
//System.out.println("pcaKey " + pcaKey);
//System.out.println("currKey " + currKey);
if ((pcaKey.equals(currKey)) && (pcaKey.equals(pcaName))) {
//System.out.println("pcaKey " + pcaKey);
//System.out.println("currKey " + currKey);
List<Double> pcaValues = pcaEntry.getValue();
Double xpca = pcaValues.get(0);
Double ypca = pcaValues.get(1);
List<Double> currValues = currEntry.getValue();
Double xcurr = currValues.get(0);
Double ycurr = currValues.get(1);
dMet.computePoint (xpca, ypca, xcurr, ycurr, pourcentage);
Double xNew=dMet.xNew;
Double yNew=dMet.yNew;
View<CyNode> pcaNodeView= currNetworkView.getNodeView(pcaNode) ;
pcaNodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, xNew);
pcaNodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, yNew);
}
}
}
}
currNetworkView.updateView();
currNetworkView.fitContent();
//AbstractCyEdit myCyEdit = new UndoSlider();
//undo.postEdit(myCyEdit);
}