New Panel Associated with Tab

I am new to Spark… my employer just started using it. As a developer, one of the first things I want to do is develop plugins for it.

One of your examples shows how to create a new Tab… but this just shows how to create a button. If I want to display my own pane where the contact list normally displays when my tab is selected, how do I do this (similar to how the Conferences tab takes over the contact list area).

Thanks.

Just for reference, I am new to Spark and to Swing development… though I have been doing server side java for 5+ years.

The example shows using a simple JButton, but you can add any kind of Component.

It sounds like you are wanting to add a new JPanel Component that is similar to the ContactList’'s display.

Here are some links to information in how to do this:

JTabbedPane Docs first:

http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTabbedPane.html

How to use Tabbed Panes:

http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html

How to use Panels:

http://java.sun.com/docs/books/tutorial/uiswing/components/panel.html

Let me know if I misunderstood you and I will try and help you any way I can.

_Aaron

Thanks. I think this is enough information for me to get into trouble. I guess it is just my lack of knowledge about Swing… which I hope to remedy asap.

Thanks again,

Dan.

Ok, what am I doing wrong now? My plugin builds fine using your ant script. I deploy it and get this error:

Oct 3, 2006 4:23:54 PM org.jivesoftware.spark.util.log.Log error

SEVERE:

java.lang.IllegalArgumentException: Provider must be an IQProvider or a Class instance.

at org.jivesoftware.smack.provider.ProviderManager.addIQProvider(ProviderManager.j ava:277)

at org.jivesoftware.spark.plugin.PluginClassLoader.loadSmackProvider(PluginClassLo ader.java:142)

at org.jivesoftware.spark.plugin.PluginClassLoader.checkForSmackProviders(PluginCl assLoader.java:102)

at org.jivesoftware.spark.plugin.PluginClassLoader.addPlugin(PluginClassLoader.jav a:87)

at org.jivesoftware.spark.PluginManager.loadPublicPlugins(PluginManager.java:495)

at org.jivesoftware.spark.PluginManager.loadPlugins(PluginManager.java:163)

at org.jivesoftware.spark.Workspace$4.finished(Workspace.java:259)

at org.jivesoftware.spark.util.SwingWorker$2$1.run(SwingWorker.java:139)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Oct 3, 2006 4:23:54 PM org.jivesoftware.spark.util.log.Log error

SEVERE: Unable to load plugin com.bn.plugins.AHDStats.

java.lang.ClassCastException: com.bn.plugins.AHDStats

at org.jivesoftware.spark.PluginManager.loadPublicPlugin(PluginManager.java:242)

at org.jivesoftware.spark.PluginManager.loadPublicPlugins(PluginManager.java:501)

at org.jivesoftware.spark.PluginManager.loadPlugins(PluginManager.java:163)

at org.jivesoftware.spark.Workspace$4.finished(Workspace.java:259)

at org.jivesoftware.spark.util.SwingWorker$2$1.run(SwingWorker.java:139)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Here is the relevant code:

public class AHDStats implements Plugin

{

private void addTabToSpark()

{

Workspace workspace = SparkManager.getWorkspace();

JTabbedPane tabbedPane = workspace.getWorkspacePane();

JPanel panel = new JPanel(false);

JLabel label = new JLabel(“AHD Stats”);

panel.setLayout(new GridLayout(1, 1));

panel.add(label);

tabbedPane.addTab(“AHD Stats”, null, panel, “AHD Stats”);

}

public void initialize()

{

addTabToSpark();

}

}

Here is my relevant plugin.xml

<plugin>

<name>AHD Tab</name>

<version>1.0</version>

<author>Dan Daley</author>

<homePage></homePage>

<email></email>

<description>Sample Plugin</description>

<class>com.bn.plugins.AHDStats</class>

<minSparkVersion>2.0.1</minSparkVersion>

</plugin>

Thanks,

I am running 2.0.2

Dan.

See my error posting…

Ok… I am getting closer. My test works if I deploy to the Spark instance that comes with the development kit. If I deploy to the version of Spark that I downloaded and installed, I get the above error.

What would cause this? I noticed that version 1.1.0 comes with the development kit, but the version I downloaded was 2.0.2. Do I need a different development kit for this version?

Thanks,

Dan.

Yeah, that Sparkplug Development Kit won’'t work for 2.0.1.

This is what you can do.

Just copy the Spark\lib directory from the Spark 2.0.1 you downloaded, into sparkplugdir\spark\lib

Just need to upgrade the libs, and the spark.jar, which is also in the lib directory.

Thanks. I got this working and am on my way to my first plugin! Already sent a proof of concept plugin to my manager that gives him statistics from our helpdesk.

That is awesome

That kind of freedom really makes Spark attractive to devs.

Yes it is awsome, I have seen the plugin from Dan, as we work for the same manager. Great potental. I have been a fan of wildfire/spark since I found it.