[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
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
Gephi forums •Adding in New Tabs/Pages
Page 1 of 1

Adding in New Tabs/Pages

Posted: 13 Apr 2011 07:45
by aurora
Hi,

I'm looking at using gephi for graph analysis for my organisation.

I want to be able to add in a new tab/page (like what is already present "overview", "data lab", "preview"), so that the user does not necessarily have to play around with the already present tabs/pages if he/she does not want to.

Is it possible to do this?

Re: Adding in New Tabs/Pages

Posted: 13 Apr 2011 16:56
by mbastian
Yes it is possible, it's called a Perspective. Check out this wiki page

Re: Adding in New Tabs/Pages

Posted: 21 Apr 2011 04:41
by aurora
excellent thanks, in attempting to add in this, I realised I should probably run through some of the plugin tutorials.

When I was attempting to do the filter plugin it wasn't clear to me how the UI was implemented. I'm new to java, so this maybe an entirely stupid question!

the wiki states that an example for a simple panel is as follows:
"public class MyFilter extends javax.swing.JPanel implements ItemListener { ......"

I assume "MyFilter" is a typo, as it has already been defined as a public class earlier on in "public class MyFilter implements NodeFilter {....",
so assuming this, i defined the panel class as
"public class MyFilterUI extends javax.swing.JPanel implements ItemListener { ......"

So once this has been defined, I assume it somehow has to be called from the "getPanel()" method in "MyFilterBuilder". But I am not sure how!

Is there an already implemented plugin that I can look at that pulls all of this together as an example?

Thank you, and apolgies for such basic questions!

Re: Adding in New Tabs/Pages

Posted: 21 Apr 2011 05:51
by mbastian
When I was attempting to do the filter plugin it wasn't clear to me how the UI was implemented. I'm new to java, so this maybe an entirely stupid question!

the wiki states that an example for a simple panel is as follows:
"public class MyFilter extends javax.swing.JPanel implements ItemListener { ......"

I assume "MyFilter" is a typo, as it has already been defined as a public class earlier on in "public class MyFilter implements NodeFilter {....",
so assuming this, i defined the panel class as
"public class MyFilterUI extends javax.swing.JPanel implements ItemListener { ......"
Correct, thanks for reporting, I fixed the page.
So once this has been defined, I assume it somehow has to be called from the "getPanel()" method in "MyFilterBuilder". But I am not sure how!
simply by doing

Code: Select all

return new MyFilterUI((MyFilter)filter)
Is there an already implemented plugin that I can look at that pulls all of this together as an example?
Example with EdgeWeightFilter

The way UI is defined is a little different, as we wanted to have UIs in a different module, and therefore used Lookup to find UI implementation at runtime.

Re: Adding in New Tabs/Pages

Posted: 27 Apr 2011 05:22
by aurora
Great, that helped lots! I think I have got the basics of it.

One other question, I am using the Gephi 0.7 beta source code at the moment.

When I open the source code via Netbeans, then build/run the software, I get a different view of the software to what I see when I just run the Gephi application (both are using the Gephi 0.7 beta software).

The main difference being that I cannot see the different perspectives (such as Overview, Labratory, Preview) in the compiled Gephi view.

Thanks

Re: Adding in New Tabs/Pages

Posted: 27 Apr 2011 12:54
by mbastian
Something must be wrong and the banner component crash at startup. Please consult the messages.log file in the gephi user dir, you should see an exception with BannerTopComponent. Please report it here.

Re: Adding in New Tabs/Pages

Posted: 28 Apr 2011 03:01
by aurora
Looking at the logs, the error is due to a plugin I wrote to add in a new perspective (apologies I should have mentioned that earlier, also I have moved to gephi 0.8 alpha version).

Basically
1. added a new module - MyPerspectivePlugin
2. added libraries Lookup, Utilities API, Desktop Perspective
3. created class that implements Perspective as follows:

Code: Select all

@ServiceProvider(service = Perspective.class, position=500)
public class TopazPerspective implements Perspective{
    public String getDisplayName() {
        return NbBundle.getMessage(PreviewPerspective.class, "TopazPerspective.name");
    }
    public String getName() {
        return "TopazGroup";
    }
    public Icon getIcon() {
       return ImageUtilities.loadImageIcon("org/gephi/myperspectiveplugin/resources/topaz.png", false);
    }
}
4.In the "Bundle.properties" added line: TopazPerspective.name=Topaz

(Based this on what was already there in DesktopPerspective.java)

This causes the banner to crash just as you stated. As far as I can see from the errors, it seems to be caused by this line
return NbBundle.getMessage(PreviewPerspective.class, "TopazPerspective.name");
-
(When I've commented out that line, (and replaced with "return null"), the perspectives do come up (all 4 of them), however there are other errors when I try to access the perspectives.)
Method: getDefault
Class: class org.gephi.desktop.perspective.BannerTopComponent
Caused: java.util.MissingResourceException: Can't find resource for bundle org.openide.util.NbBundle$PBundle, key TopazPerspective.name
at java.util.ResourceBundle.getObject(ResourceBundle.java:374)
at java.util.ResourceBundle.getString(ResourceBundle.java:334)
at org.openide.util.NbBundle.getMessage(NbBundle.java:637)
at org.gephi.myperspective.TopazPerspective.getDisplayName(TopazPerspective.java:25)
at org.gephi.desktop.perspective.BannerTopComponent.addGroupTabs(BannerTopComponent.java:104)
at org.gephi.desktop.perspective.BannerTopComponent.<init>(BannerTopComponent.java:63)
at org.gephi.desktop.perspective.BannerTopComponent.getDefault(BannerTopComponent.java:286)
My guess is that its unable to find "TopazPerspective.name", have I added it in correctly? Or how do I add this in?

Thanks

Re: Adding in New Tabs/Pages

Posted: 28 Apr 2011 08:06
by mbastian
NbBundle.getMessage(PreviewPerspective.class, "TopazPerspective.name");
The first parameter should be the name of the package where the Bundle.properties file is located. In which Bundle.properties did you add this? If your 'TopazPerspective' class is in a different package, create a new Bundle.properties in this package and replace PreviewPerspective.class with TopazPerspective.class.

Re: Adding in New Tabs/Pages

Posted: 02 May 2011 03:42
by aurora
Yes that was it, thank you!