Hi,
Using the TreeView.java class of prefuse demo project, Im trying to modify one of the node to work as a clickable node, and when user clicks on it, it should lauch the browser, well i have seen many people posting for this but in reply they are told to user Browserlauncher class etc, but my query is how would i modify my .xml file to tell the code which of the node is clickable and which one is not....plz help me with this, i would be really grateful.
And people here is my xml file, i am unable to define my url value to the attribute, plz tell me where im going wrong, currently im able to navigate to the desired page, but every node gets clicked, i.e even those whom i dnt want to be clicked.
here is my xml:
dear all, the problem is resolved when i define itemclicked==2, instead of 1 :) Now the other problem is how to i use image in one of the nodes and make it clickable? any suggestions??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It uses images and is clickable, if I remember right.
Maybe, in the itemClicked method, just get the field value from your node/item and check if its type/value is what you want to be clickable. If not, just exit without doing anything.
Looks like you want nodes with name==URI to be clickable?
Good luck,
Björn
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey, Bjorn, thanks for your response. Yes DataMountain is what im looking at but it defines its images in a folder and also uses amazon.txt file to get the ids of the images, pass it to URL and navigate to the respective page on amazon site. But in my case im using xml file, and also NodeLinkTree layout, in which i have multiple nodes, out of which i want one of my nodes(URI) to be clickable, that i have done already. Now im trying to load an image in another node, on click of that image, i want it to launch browser and open the URL i specify in the code may be..
any suggestions for that please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Using the TreeView.java class of prefuse demo project, Im trying to modify one of the node to work as a clickable node, and when user clicks on it, it should lauch the browser, well i have seen many people posting for this but in reply they are told to user Browserlauncher class etc, but my query is how would i modify my .xml file to tell the code which of the node is clickable and which one is not....plz help me with this, i would be really grateful.
Here is my Java Code
package com.mycompany.mavenproject1;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import prefuse.Constants;
import prefuse.Display;
import prefuse.Visualization;
import prefuse.action.Action;
import prefuse.action.ActionList;
import prefuse.action.ItemAction;
import prefuse.action.RepaintAction;
import prefuse.action.animate.ColorAnimator;
import prefuse.action.animate.LocationAnimator;
import prefuse.action.animate.QualityControlAnimator;
import prefuse.action.animate.VisibilityAnimator;
import prefuse.action.assignment.ColorAction;
import prefuse.action.assignment.FontAction;
import prefuse.action.assignment.SizeAction;
import prefuse.action.filter.FisheyeTreeFilter;
import prefuse.action.layout.CollapsedSubtreeLayout;
import prefuse.action.layout.graph.NodeLinkTreeLayout;
import prefuse.activity.SlowInSlowOutPacer;
import prefuse.controls.ControlAdapter;
import prefuse.controls.FocusControl;
import prefuse.controls.PanControl;
import prefuse.controls.WheelZoomControl;
import prefuse.controls.ZoomControl;
import prefuse.controls.ZoomToFitControl;
import prefuse.data.Schema;
import prefuse.data.Tree;
import prefuse.data.Tuple;
import prefuse.data.event.TupleSetListener;
import prefuse.data.io.TreeMLReader;
import prefuse.data.search.PrefixSearchTupleSet;
import prefuse.data.tuple.TupleSet;
import static prefuse.demos.FisheyeMenu.LABEL;
import prefuse.render.DefaultRendererFactory;
import prefuse.render.EdgeRenderer;
import prefuse.render.AbstractShapeRenderer;
import prefuse.render.LabelRenderer;
import prefuse.util.ColorLib;
import prefuse.util.FontLib;
import prefuse.util.force.ForceItem;
import prefuse.util.ui.BrowserLauncher;
import prefuse.util.ui.JFastLabel;
import prefuse.util.ui.JSearchPanel;
import prefuse.visual.VisualItem;
import prefuse.visual.expression.InGroupPredicate;
import prefuse.visual.sort.ItemSorter;
import prefuse.visual.sort.TreeDepthItemSorter;
/**
*
* @version 1.0
*/
public class NewDspaceTopicMap extends Display {
}// end of class TreeView
Regards,
malih
Last edit: maliha z 2015-09-13
And people here is my xml file, i am unable to define my url value to the attribute, plz tell me where im going wrong, currently im able to navigate to the desired page, but every node gets clicked, i.e even those whom i dnt want to be clicked.
here is my xml:
<declarations>
<attributeDecl name="name" type="String"/>
<attributeDecl name="type" type="String"/>
</declarations>
<branch>
<attribute name="name" value="DDBC"/>
<branch>
<attribute name="name" value="Documents"/>
<branch>
<attribute name="name" value="Reports"/>
<branch>
<attribute name="name" value="Doc name"/>
<branch>
<attribute name="name" value="Efficient Hybrid Parallelism"/>
<leaf>
<attribute name="name" value="Author- Javed, Muhammad Ansar"/>
</leaf>
<leaf>
<attribute name="name" value="Advisor"/>
</leaf>
<branch>
<attribute name="name" value="Co-Advisor"/>
<leaf>
<attribute name="name" value="Jam, Moh"/>
</leaf>
</branch>
<leaf>
<attribute name="name" value="Issue Date-4/24/2015"/>
</leaf>
<branch>
<attribute name="name" value="URI"/>
<leaf>
<attribute name="name" value="1204"/>
</leaf>
</branch>
dear all, the problem is resolved when i define itemclicked==2, instead of 1 :) Now the other problem is how to i use image in one of the nodes and make it clickable? any suggestions??
Hi,
I haven't been reading this forum for years, but take a look at DataMountain Demo http://prefuse.org/gallery/datamountain/
It uses images and is clickable, if I remember right.
Maybe, in the itemClicked method, just get the field value from your node/item and check if its type/value is what you want to be clickable. If not, just exit without doing anything.
Looks like you want nodes with name==URI to be clickable?
Good luck,
Björn
Hey, Bjorn, thanks for your response. Yes DataMountain is what im looking at but it defines its images in a folder and also uses amazon.txt file to get the ids of the images, pass it to URL and navigate to the respective page on amazon site. But in my case im using xml file, and also NodeLinkTree layout, in which i have multiple nodes, out of which i want one of my nodes(URI) to be clickable, that i have done already. Now im trying to load an image in another node, on click of that image, i want it to launch browser and open the URL i specify in the code may be..
any suggestions for that please?