@Inject
 public CreateThematicMapDialog(
     CySwingApplication application, CyApplicationManager applicationManager) {
   super(application.getJFrame(), true);
   CyNetwork inputNetwork = applicationManager.getCurrentNetwork();
   this.networkName = inputNetwork.getRow(inputNetwork).get(CyNetwork.NAME, String.class);
   setTitle("Create Thematic Map: " + networkName);
   this.applicationManager = applicationManager;
   createContents();
   updateEnablement();
 }
Ejemplo n.º 2
0
  /**
   * @param args the function arguments which must be either one object of type Double or Long
   * @return the result of the function evaluation which is the natural logarithm of the first
   *     argument
   */
  public Object evaluateFunction(final Object[] args) {
    final Long edgeID = FunctionUtil.getArgAsLong(args[0]);

    final CyNetwork currentNetwork = applicationManager.getCurrentNetwork();
    if (currentNetwork == null) return (Long) (-1L);

    final CyEdge edge = currentNetwork.getEdge(edgeID);
    if (edge == null)
      throw new IllegalArgumentException("\"" + edgeID + "\" is not a valid edge identifier.");

    return edge.getSource().getSUID();
  }
 @Tunable(description = "Node attribute to use to weight layout", context = "nogui")
 public ListSingleSelection<String> getNodeAttribute() {
   // Make sure we know the network
   if (network == null) network = appMgr.getCurrentNetwork();
   List<String> attrs = getSupportedNodeAttributes();
   if (attrs == null || attrs.size() == 0) {
     possibleNodeAttributes = null;
   } else {
     possibleNodeAttributes = new ListSingleSelection<String>(attrs);
   }
   return possibleNodeAttributes;
 }
  @Override
  public void run(TaskMonitor taskMonitor) throws Exception {
    if (network == null) network = appMgr.getCurrentNetwork();
    views = new ArrayList<CyNetworkView>(viewMgr.getNetworkViews(network));

    taskMonitor.showMessage(
        TaskMonitor.Level.INFO, "Views for network " + DataUtils.getNetworkTitle(network));
    for (CyNetworkView view : views) {
      taskMonitor.showMessage(TaskMonitor.Level.INFO, "    " + view);
      return;
    }
  }
Ejemplo n.º 5
0
  @Override
  @SuppressWarnings("unchecked")
  public void setValue(final Object value) {
    if (value instanceof ContinuousMapping == false)
      throw new IllegalArgumentException("Value should be ContinuousMapping: this is " + value);

    final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
    final CyNetwork currentNetwork = appMgr.getCurrentNetwork();

    if (currentNetwork == null) return;

    mapping = (ContinuousMapping<K, V>) value;
    Class<? extends CyIdentifiable> type =
        (Class<? extends CyIdentifiable>) mapping.getVisualProperty().getTargetDataType();

    final CyNetworkTableManager netTblMgr = servicesUtil.get(CyNetworkTableManager.class);
    final CyTable attr =
        netTblMgr.getTable(appMgr.getCurrentNetwork(), type, CyNetwork.DEFAULT_ATTRS);

    final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
    editorPanel =
        new C2CMappingEditorPanel<K, V>(vmMgr.getCurrentVisualStyle(), mapping, attr, servicesUtil);
  }
  @Override
  public void run(final TaskMonitor taskMonitor) {
    if (network == null) network = appMgr.getCurrentNetwork();
    Collection<CyNetworkView> views = viewMgr.getNetworkViews(network);

    nodes = nodeList.getValue();

    for (CyNetworkView view : views) {
      Set<View<CyNode>> nodeViews = new HashSet<View<CyNode>>();
      if (nodes == null || nodes.size() == 0) {
        nodeViews = CyLayoutAlgorithm.ALL_NODE_VIEWS;
      } else {
        for (CyNode node : nodes) nodeViews.add(view.getNodeView(node));
      }

      insertTasksAfterCurrentTask(
          algorithm.createTaskIterator(view, layoutContext, nodeViews, getLayoutAttribute()));
    }
  }
  private Collection<String> getAttributes(boolean node) {
    CyNetwork network = applicationManager.getCurrentNetwork();
    CyTable table = node ? network.getDefaultNodeTable() : network.getDefaultEdgeTable();
    Collection<CyColumn> columns = table.getColumns();

    Set<String> attributes =
        new TreeSet<String>(
            new Comparator<String>() {
              public int compare(String s1, String s2) {
                return s1.compareToIgnoreCase(s2);
              }
            });

    for (CyColumn column : columns) {
      if (!CyIdentifiable.SUID.equals(column.getName())
          && (node || Number.class.isAssignableFrom(column.getType()))) {
        attributes.add(column.getName());
      }
    }
    return attributes;
  }
 public CyNetworkView getCurrentNetworkView() {
   CyApplicationManager applicationManager = adapter.getCyApplicationManager();
   return applicationManager == null ? null : applicationManager.getCurrentNetworkView();
 }
 @Tunable(description = "Nodes to layout", context = "nogui")
 public NodeList getnodeList() {
   if (network == null) network = appMgr.getCurrentNetwork();
   nodeList.setNetwork(network);
   return nodeList;
 }