Adding in New Tabs/Pages

Extensions and customization
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
aurora
Posts:6
Joined:13 Apr 2011 06:36
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Adding in New Tabs/Pages

Post by aurora » 13 Apr 2011 07:45

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?

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by mbastian » 13 Apr 2011 16:56

Yes it is possible, it's called a Perspective. Check out this wiki page

aurora
Posts:6
Joined:13 Apr 2011 06:36
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by aurora » 21 Apr 2011 04:41

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!

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by mbastian » 21 Apr 2011 05:51

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.

aurora
Posts:6
Joined:13 Apr 2011 06:36
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by aurora » 27 Apr 2011 05:22

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
Attachments
compiledCodeView.png
view of Gephi when code is compiled and run
GephiAppView.png
view of Gephi when application is just run

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by mbastian » 27 Apr 2011 12:54

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.

aurora
Posts:6
Joined:13 Apr 2011 06:36
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by aurora » 28 Apr 2011 03:01

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
Attachments
messages.log
(20.48KiB)Downloaded 208 times

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by mbastian » 28 Apr 2011 08:06

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.

aurora
Posts:6
Joined:13 Apr 2011 06:36
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Adding in New Tabs/Pages

Post by aurora » 02 May 2011 03:42

Yes that was it, thank you!

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable