Proposal: make IM panel tab position optional

Hi,

I would like to propose to enhance functionality in Spark to provide tabs positions optional (contact list tab, conference tab, any plugin tab)

Currently they are set to bottom and there is no way to make it optional

In Workspace.java we have:

workspacePane = new SparkTabbedPane(JTabbedPane.BOTTOM);

We can make it optional in to ways:

  1. adding a system property variable, the code will become:

// Initialize workspace pane, defaulting the tabs to the bottom.

final String tabsTop = System.getProperty(“tabs.top”);

if (tabsTop == null) {

workspacePane = new SparkTabbedPane(JTabbedPane.BOTTOM);

} else {

workspacePane = new SparkTabbedPane();

}

  1. we can add a property in default.properties that will say true:

sample:

TABS_POSITION_TOP=true

(The default will position will remain BOTTOM)

I am very open to contribute with a patch

Any feedback appreciated, Thanks!

Mircea Carasel

We are reworking the look and feel of Spark to make it light. Your idea fits well to the design goal of having a lightweight look. A patch might be useful, but there are several pending code changes in the trunk that might make it difficult to merge. The whole process is recorded as http://issues.igniterealtime.org/browse/SPARK-1298

Hi, I created a patch that adds:

TABS_PLACEMENT_TOP variable in default.properties. When marked true, tabs will be positioned by default on top. Otherwise the default position is bottom

Also I exposed the the tab placement position in Workspace.java

In this way any plugin can inject it’s own position, no matter what the default is

public void setTabPlacement(int type)

In the plugin class you just do something like:

public class IMPlugin implements Plugin {

/**

  • Called after Spark is loaded to initialize the new plugin.

*/

@Override

public void initialize() {

final Workspace w = Workspace.getInstance();

final SparkTabbedPane pane = w.getWorkspacePane();

pane.setTabPlacement(JTabbedPane.TOP);

}

I am attaching the patch Please review

Thanks, Mircea
SPARK-1298.patch.zip (1258 Bytes)

I am attaching a second patch on this matter that proves the benefits that http://community.igniterealtime.org/docs/DOC-2180 brings

This patch creates a dedicated context: PluggableDefaults.java that holds spark defaults for:

-Workspace tabs position (defaults to BOTTOM)

-a flag for the Person search field to be displayed or not (defaults to true)

Any plugin can overwrite these defaults. Just set your defaults inside the plugin constructor.

Sample:

public class IMPlugin implements Plugin {

** public IMPlugin() {**

** PluggableDefaults.getInstance().setTabPosition(JTabbedPane.TOP);**

** PluggableDefaults.getInstance().setDisplaySearchField(false);**

** }**

/**

  • Called after Spark is loaded to initialize the new plugin.

*/

@Override

public void initialize() {

}

/**

  • Called when Spark is shutting down to allow for persistence of

  • information or releasing of resources.

*/

@Override

public void shutdown() {

// nothing to do

}

/**

  • Return true if the Spark can shutdown on users request.

  • @return true if Spark can shutdown on users request.

*/

@Override

public boolean canShutDown() {

return true;

}

/**

  • Is called when a user explicitly asked to uninstall this plugin. The

  • plugin owner is responsible to clean up any resources and remove any

  • components install in Spark.

*/

@Override

public void uninstall() {

// Remove all resources belonging to this plugin.

}

}

This attached patch works together with: http://community.igniterealtime.org/docs/DOC-2180

and improves SPARK-1298.patch. This one is no longer needed

Please review

Thanks,

Mircea
SPARK-extend-sparkplug-to-set-defaults.zip (1767 Bytes)