[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
Gephi forumsPlease post new questions on facebook group too (https://www.facebook.com/groups/gephi) 2017-02-10T15:13:54+01:00 https://forum-gephi.org/app.php/feed/topic/6135 2017-02-10T15:13:54+01:002017-02-10T15:13:54+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14191#p14191 <![CDATA[Re: Implement NodePressAndDraggingEventListener]]>
Yes I have the same pom.xml file, and as you said Eclipse+Maven is the cause of the problem, so I tried to execute with Maven command line in Windows, and it works good, Thanks.

Now I need to figure how to fix this problem in Eclipse, because I need to use Gephi in an existing java application in Eclipse.

Statistics:Posted by yacine — 10 Feb 2017 15:13


]]>
2017-02-09T19:45:03+01:002017-02-09T19:45:03+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14190#p14190 <![CDATA[Re: Implement NodePressAndDraggingEventListener]]> It should work in any IDE, or even without an IDE.

That seems to indicate that you are not correctly including the gephi toolkit jar in your compile path or something similar.

What does your pom look like? It should be similar to this https://github.com/gephi/gephi-toolkit- ... er/pom.xml Are you able to build it with maven command line? Eclipse + maven has always been a painful experience to me.

Statistics:Posted by eduramiba — 09 Feb 2017 19:45


]]>
2017-02-09T19:23:48+01:002017-02-09T19:23:48+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14189#p14189 <![CDATA[Re: Implement NodePressAndDraggingEventListener]]>
So ok I get started with your example,

Firstly, I'm using eclipse, is that a problem, because I see that NetBeans is recomended? and in my case I can't use Netbeans.

Secondly, I'm trying to use the MouseListenerTemplate but eclipse show me an compilation error on the @Override, and when I delete the implemented methods, and implement them again it doesn't show the @Override attribute before method declaration, is that the problem why I get nothing when clicked on the graph nodes?

Thanks again for your response.
errors.PNG

Statistics:Posted by yacine — 09 Feb 2017 19:23


]]>
2017-02-09T18:07:25+01:002017-02-09T18:07:25+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14188#p14188 <![CDATA[Re: Implement NodePressAndDraggingEventListener]]> You should use separate classes for each thing.

My advice is: copy my example files as-is. Verify it's working. Then, make small changes in the files until it does what you need.

Statistics:Posted by eduramiba — 09 Feb 2017 18:07


]]>
2017-02-09T17:50:17+01:002017-02-09T17:50:17+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14187#p14187 <![CDATA[Re: Implement NodePressAndDraggingEventListener]]>
I did but I get nothing when I click on the graph nodes;

Here is my code:

package giphy;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.Component;
import java.io.File;
import java.util.concurrent.TimeUnit;

import javax.swing.JFrame;

import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphEvent;
import org.gephi.graph.api.GraphListener;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.Node;
import org.gephi.graph.api.UndirectedGraph;
import org.gephi.io.importer.api.Container;
import org.gephi.io.importer.api.EdgeDefault;
import org.gephi.io.importer.api.ImportController;
import org.gephi.io.processor.plugin.DefaultProcessor;
import org.gephi.layout.plugin.AutoLayout;
import org.gephi.layout.plugin.force.StepDisplacement;
import org.gephi.layout.plugin.force.yifanHu.YifanHuLayout;
import org.gephi.layout.plugin.forceAtlas.ForceAtlasLayout;
import org.gephi.preview.api.PreviewController;
import org.gephi.preview.api.PreviewModel;
import org.gephi.preview.api.PreviewMouseEvent;
import org.gephi.preview.api.PreviewProperties;
import org.gephi.preview.api.PreviewProperty;
import org.gephi.preview.api.ProcessingTarget;
import org.gephi.preview.api.RenderTarget;
import org.gephi.preview.spi.MouseResponsiveRenderer;
import org.gephi.preview.spi.PreviewMouseListener;
import org.gephi.preview.types.DependantOriginalColor;
import org.gephi.project.api.ProjectController;
import org.gephi.project.api.Workspace;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.lookup.ServiceProvider;

import processing.core.PApplet;

@ServiceProvider(service = MouseResponsiveRenderer.class)

public class GephiTest implements MouseResponsiveRenderer, PreviewMouseListener {

public static void main (String args[]){

//Init a project - and therefore a workspace
ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
projectController.newProject();
projectController.newWorkspace(projectController.getCurrentProject());

ImportController importController = Lookup.getDefault().lookup(ImportController.class);

Container container;

//Import FILE
try {

File file = new File(GephiTest.class.getClassLoader().getResource("test.gexf").toURI());
container = importController.importFile(file);
}
catch (Exception ex) {
Exceptions.printStackTrace(ex);
return;
}

importController.process(container, new DefaultProcessor(), projectController.getCurrentWorkspace());
//Preview configuration
PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);


PreviewModel previewModel = previewController.getModel();

previewModel.getProperties().putValue(PreviewProperty.SHOW_NODE_LABELS, Boolean.FALSE);
previewModel.getProperties().putValue(PreviewProperty.SHOW_NODE_LABELS, Boolean.FALSE);
//previewModel.getProperties().putValue(PreviewProperty.VISIBILITY_RATIO, 0.5);
previewModel.getProperties().putValue(PreviewProperty.NODE_LABEL_COLOR, new DependantOriginalColor(Color.WHITE));
previewModel.getProperties().putValue(PreviewProperty.EDGE_CURVED, Boolean.FALSE);
previewModel.getProperties().putValue(PreviewProperty.EDGE_OPACITY, 50);
previewModel.getProperties().putValue(PreviewProperty.EDGE_RADIUS, 10f);
previewModel.getProperties().putValue(PreviewProperty.BACKGROUND_COLOR, Color.BLACK);
previewController.refreshPreview();

//New Processing target, get the PApplet
ProcessingTarget target = (ProcessingTarget) previewController.getRenderTarget(RenderTarget.PROCESSING_TARGET);
PApplet applet = target.getApplet();
applet.init();

//Refresh the preview and reset the zoom
previewController.render(target);
target.refresh();
target.resetZoom();

//Add the applet to a JFrame and display
JFrame frame = new JFrame("Test Preview");
frame.setLayout(new BorderLayout());

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add((Component) applet, BorderLayout.CENTER);

frame.pack();
frame.setVisible(true);

}

@Override
public boolean needsPreviewMouseListener(
PreviewMouseListener previewMouseListener) {
// TODO Auto-generated method stub
System.err.println("needsPreviewMouseListener");
return true;
}

@Override
public void mouseClicked(PreviewMouseEvent event,
PreviewProperties properties, Workspace workspace) {
// TODO Auto-generated method stub
System.err.println("mouseClicked");

}

@Override
public void mouseDragged(PreviewMouseEvent event,
PreviewProperties properties, Workspace workspace) {
// TODO Auto-generated method stub
System.err.println("mouseDragged");

}

@Override
public void mousePressed(PreviewMouseEvent event,
PreviewProperties properties, Workspace workspace) {
// TODO Auto-generated method stub
System.err.println("mousePressed");

}

@Override
public void mouseReleased(PreviewMouseEvent event,
PreviewProperties properties, Workspace workspace) {
// TODO Auto-generated method stub
System.err.println("mouseReleased");

}


}

Statistics:Posted by yacine — 09 Feb 2017 17:50


]]>
2017-02-09T13:26:42+01:002017-02-09T13:26:42+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14185#p14185 <![CDATA[Re: Implement NodePressAndDraggingEventListener]]> https://github.com/gephi/gephi-toolkit- ... ns/preview

Statistics:Posted by eduramiba — 09 Feb 2017 13:26


]]>
2017-02-09T13:00:03+01:002017-02-09T13:00:03+01:00 https://forum-gephi.org/viewtopic.php?t=6135&p=14184#p14184 <![CDATA[Implement NodePressAndDraggingEventListener]]>
What I need to do, is to allow user to drag the nodes, I cant find how to do that,

Any help will be appreciated.

this is my code:
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphEvent;
import org.gephi.graph.api.GraphListener;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.Node;
import org.gephi.graph.api.UndirectedGraph;
import org.gephi.io.importer.api.Container;
import org.gephi.io.importer.api.EdgeDefault;
import org.gephi.io.importer.api.ImportController;
import org.gephi.io.processor.plugin.DefaultProcessor;
import org.gephi.preview.api.PreviewController;
import org.gephi.preview.api.PreviewModel;
import org.gephi.preview.api.PreviewProperty;
import org.gephi.preview.api.ProcessingTarget;
import org.gephi.preview.api.RenderTarget;
import org.gephi.preview.types.DependantOriginalColor;
import org.gephi.project.api.ProjectController;
import org.gephi.project.api.Workspace;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;

import processing.core.PApplet;

public class GephiTest {

public static void main (String args[]){

//Init a project - and therefore a workspace
ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
projectController.newProject();
projectController.newWorkspace(projectController.getCurrentProject());

ImportController importController = Lookup.getDefault().lookup(ImportController.class);

Container container;
try {

File file = new File(GephiTest.class.getClassLoader().getResource("test.gexf").toURI());
container = importController.importFile(file);
}
catch (Exception ex) {
Exceptions.printStackTrace(ex);
return;
}

importController.process(container, new DefaultProcessor(), projectController.getCurrentWorkspace());
//Preview configuration
PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);


PreviewModel previewModel = previewController.getModel();

//previewModel.getProperties().putValue(PreviewProperty.SHOW_NODE_LABELS, Boolean.FALSE);
previewModel.getProperties().putValue(PreviewProperty.SHOW_NODE_LABELS, Boolean.TRUE);
previewModel.getProperties().putValue(PreviewProperty.VISIBILITY_RATIO, 0.5);
previewModel.getProperties().putValue(PreviewProperty.NODE_LABEL_COLOR, new DependantOriginalColor(Color.WHITE));
previewModel.getProperties().putValue(PreviewProperty.EDGE_CURVED, Boolean.FALSE);
previewModel.getProperties().putValue(PreviewProperty.EDGE_OPACITY, 50);
previewModel.getProperties().putValue(PreviewProperty.EDGE_RADIUS, 10f);
previewModel.getProperties().putValue(PreviewProperty.BACKGROUND_COLOR, Color.BLACK);
previewController.refreshPreview();

//New Processing target, get the PApplet
ProcessingTarget target = (ProcessingTarget) previewController.getRenderTarget(RenderTarget.PROCESSING_TARGET);
PApplet applet = target.getApplet();
applet.init();
//Refresh the preview and reset the zoom
previewController.render(target);
target.refresh();
target.resetZoom();


//test get nodes:
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
DirectedGraph directedGraph = graphModel.getDirectedGraph();

Node node = directedGraph.getNode("23");
System.out.println(node.getNodeData().getLabel());


//

//Add the applet to a JFrame and display
JFrame frame = new JFrame("Test Preview");
frame.setLayout(new BorderLayout());

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add((Component) applet, BorderLayout.CENTER);

frame.pack();
frame.setVisible(true);

}
}

Statistics:Posted by yacine — 09 Feb 2017 13:00


]]>