Programmatic setting of node tooltips

19 views
Skip to first unread message

Benjamin Hitz

unread,
Sep 7, 2007, 7:17:38 PM9/7/07
to cytoscap...@googlegroups.com
I have a network loaded via XGMML file and visualStyleBuilder=on.
This is current trunk version from SVM (well, yesterdays)
I have a plugin that programmatical runs a layout, and adjusts some
vizual styles that are "overlooked" by XGMML reader.

I want to add tooltips for nodes and edges based on properties.
The edge tool tip works fine, the node tool tips don't work at all
(although there is a ca. 4px black dot drawn).

Neither show up in the VizMapper window, but I don't really care
about that. I asssume I need to add the calculator to the thingy for
that.

I tried several node attributes including ID, canonicalName, etc.
with no results.

Any ideas? Am I missing something? Is this a bug?

--- snippet follows ---


VisualMappingManager vmm =
Cytoscape.getVisualMappingManager();

...

String eTTName = "Edge Name TT";
PassThroughMapping edgeTTMapping = new PassThroughMapping
("", "interaction");
Calculator ettc = vmm.getCalculatorCatalog().getCalculator
(VisualPropertyType.EDGE_TOOLTIP, eTTName);

if (ettc == null) {
System.out.println("Edge Tooltip Calculator rehacking");
ettc = new BasicCalculator(eTTName, edgeTTMapping,
VisualPropertyType.EDGE_TOOLTIP);
}

String nTTName = "Node GO TT";
PassThroughMapping nodeTTMapping = new PassThroughMapping
("", "canonicalName"); // this must match attribute set in XGMML file
Calculator nttc = vmm.getCalculatorCatalog().getCalculator
(VisualPropertyType.NODE_TOOLTIP, nTTName);

if (nttc == null) {
System.out.println("Node Tooltip Calculator rehacking");
nttc = new BasicCalculator(nTTName, nodeTTMapping,
VisualPropertyType.NODE_TOOLTIP);
}

eac.setCalculator(ettc);
eac.setCalculator(nttc);
vmm.applyAppearances();
view.redrawGraph(true, true);

--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO
Consortium
Stanford University ** hi...@genome.stanford.edu

Keiichiro Ono

unread,
Sep 7, 2007, 7:41:12 PM9/7/07
to cytoscap...@googlegroups.com
Hi.
In my environment, both tooltips work fine.

I'm not sure, but maybe it's a simple typo? In the following lines:

eac.setCalculator(ettc);
eac.setCalculator(nttc);

Looks like you are trying to set both to EdgeAppearenceCalculator. Probably

eac.setCalculator(ettc);
nac.setCalculator(nttc);

is correct if nac is set correctly somewhere in your code.

Thanks.
Kei


2007/9/7, Benjamin Hitz <hi...@genome.stanford.edu>:


--
Keiichiro Ono ko...@ucsd.edu

Cytoscape Core Developer Team: http://www.cytoscape.org/
UCSD Bioengineering Ideker Lab: http://chianti.ucsd.edu/idekerlab/

Benjamin Hitz

unread,
Sep 10, 2007, 1:07:30 PM9/10/07
to cytoscap...@googlegroups.com

Doh!
Reply all
Reply to author
Forward
0 new messages