SparkPlug: extend the plugin mechanism, make it more powerful (SPARK-1311)

[SPARK-1403] Enhance ability to extend core classes like ContactItem, ContactGroup, etc through plugin Created: 05/Jul/11  Updated: 28/Oct/20  Resolved: 19/Oct/11

Status: Closed
Project: Spark
Components: None
Affects versions: None
Fix versions: None
Parent: SparkPlug: extend the plugin mechanism, make it more powerful

Type: Sub-task Priority: Major
Reporter: Mircea Carasel Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Attachments: File SPARK-1403.patch     Java Archive File testPlugin.jar    

 Comments   
Comment by Mircea Carasel [ 05/Jul/11 ]

Attached patch description

1. It introduces a component registry (UIComponentRegistry.java) that offer the possibility for plugin to replace some default components with their own instances

By default Spark implementation are going to be used

Spark classes that can be replaced:
+ private static Class<? extends ContactItem> contactItemClass = ContactItem.class;
+ private static Class<? extends ContactInfoWindow> contactInfoWindowClass = ContactInfoWindow.class;
+ private static Class<? extends ContactGroup> contactGroupClass = ContactGroup.class;
+ private static Class<? extends ContactList> contactListClass = ContactList.class;
+ private static Class<? extends StatusBar> statusBarClass = StatusBar.class;
+ private static Class<? extends CommandPanel> commandPanelClass = CommandPanel.class;
+ private static Class<? extends SparkTabbedPane> workspaceTabPaneClass = SparkTabbedPane.class;
+ private static Class<? extends LoginDialog> loginDialogClass = LoginDialog.class;
+ private static Class<? extends ThemePanel> themePanelClass = ThemePanel.class;
+ private static Class<? extends ConferenceServices> conferenceServicesClass = ConferenceServices.class;

2. It also contains minor changes in Spark code to support such mechanism

Example on how a plugin can register its own ContactItem implementation:

public class TestPlugin implements Plugin {

public TestPlugin()

{ UIComponentRegistry.registerContactItem(TestContactItem.class); }

....
}
where TestContactItem extends Spark ContactItem:

public class TestContactItem extends ContactItem

{ ... }
Comment by Mircea Carasel [ 05/Jul/11 ]

The attached test plugin contains example on how to extend ContactItem through plugin

Comment by Mircea Carasel [ 29/Aug/11 ]

commited: r12581 = 7de4cd9aa842418178f0280ccf9c5e473671e0f8
1. It introduces a component registry (UIComponentRegistry.java) that offer the possibility for plugin to replace some default components with their own instances

By default Spark implementation are going to be used

Spark classes that can be replaced:
private static Class<? extends ContactItem> contactItemClass = ContactItem.class;
private static Class<? extends ContactInfoWindow> contactInfoWindowClass = ContactInfoWindow.class;
private static Class<? extends ContactGroup> contactGroupClass = ContactGroup.class;
private static Class<? extends ContactList> contactListClass = ContactList.class;
private static Class<? extends StatusBar> statusBarClass = StatusBar.class;
private static Class<? extends CommandPanel> commandPanelClass = CommandPanel.class;
private static Class<? extends SparkTabbedPane> workspaceTabPaneClass = SparkTabbedPane.class;
private static Class<? extends LoginDialog> loginDialogClass = LoginDialog.class;
private static Class<? extends ThemePanel> themePanelClass = ThemePanel.class;
private static Class<? extends ConferenceServices> conferenceServicesClass = ConferenceServices.class;

2. It also contains changes in Spark code to support such mechanism, separates a bit UI building from business login
and exposes some UI elements through protected get/set methods

Example on how a plugin can register its own ContactItem implementation:

public class TestPlugin implements Plugin {

public TestPlugin()

{ UIComponentRegistry.registerContactItem(TestContactItem.class); }

....
}
where TestContactItem extends Spark ContactItem:

public class TestContactItem extends ContactItem

{ ... }

Phase2:
commited: r12582 = ac966579032b14d708e5cafb625c25a1d5691a80
-Chat and Group Chat changes to support extension through plugin
-created ButtonFactory class responsible with button creations and use it when needed
-UIComponentRegistry is imporved with Chat/GroupCHat registration capabilities

Phase3:
commited: r12583 = c3b1aadf13de5dbb9649868cf12b786174324b9c
-LoginDialog: put username, password, serverName protected get/set methods
-some more get/set methods to expose UI objects

Comment by Mircea Carasel [ 31/Aug/11 ]

Phase 4:
commited: r12585 = 547e12fda2fa7f16a428a579b33e67510289f755

-GroupChatParticipantList - exposed some fields(protected get methods) and changed some methods from private to protected
-LoginDialog - introduced afterLogin method that does nothing but can be overwritten by subclasses - it is automatically
called after successful login. It is useful when subclasses would like to do some additional settings after login
-created new protected method to retrieve _usernames

Comment by Mircea Carasel [ 12/Sep/11 ]

commited

r12590 = eb8c807a7f5e25d45af0454395ee16b4f888e8f5

-fix concurency problem in Spark.java
-fix potential Null Pointer Exception in EmoticonManager that may occur when no emoticon package is installed
-expose setText method of JTextPanel functionality in ChatArea (the original is overwritted) to offer the posibility to
inject different Document (HTMLDocument) for Spark TranscriptWindow

Comment by Mircea Carasel [ 12/Sep/11 ]

commited

r12591 = c1c382df83fa3f1edbf7b84f1ba8a0ab27854a8c

Add eZuce copyright for the new classes

Comment by Mircea Carasel [ 12/Sep/11 ]

commited

r12592 = aed1f9dec3aca5bd320e4b8a3c45650b9b161abd

make emoticon button icon overridable from plugin

Comment by Mircea Carasel [ 13/Sep/11 ]

commited

r12594 = 3c0b73c19b25d627c07e21cb3e81802b2cfcfae2

Set message attributes before insertMessage is called - this is useful when transcript window is extended and insertMessage overwritten,
since more information will be available to be displayed for the chat area Document

Comment by Mircea Carasel [ 14/Sep/11 ]

commited

r12595 = 98a72d7504ae54f566dbce57f889ce729631fbed

make ConferenceServices.getDefaultBookmark protected so it can be overwritten in subclasses

Comment by Walter Ebeling [ 16/Sep/11 ]

This is a huge rework that is very much welcome. Can you ensure that the community get's some documentation about the capabilities introduced by your changes?

Comment by Mircea Carasel [ 16/Sep/11 ]

sure - I will write some docs and provide examples

Comment by Mircea Carasel [ 25/Sep/11 ]

commited

r12839 = cc70289f32e5767add260d7ab0b60199acd4d92c

Settings, tema, register group chat buttons creations are moved to ButtonFactory
window on top chat button creation moved to ButtonFactory
this permits the ability to override UI from plugin

make RolloverButton's decorate method protected

Comment by Mircea Carasel [ 27/Sep/11 ]

commited

r12842 = 361088d5e6bdfd0d8caf415cc91ed632716d0a82

OTR Plugin - use addComponent from TranscriptWindow for inserting UI panel, instead of duplicating code

-make sure to scrollToBottom after adding OTR UI panel in Transcript window
-make sure to scrollToBottom when message is received in GroupChat
NOTE: scrollToBottom call should be redesigned - to avoid calling it every time a message/component is sent/received
We should develop notify mechanism to trigger scrollToBottom in one single place when message/component is sent/received

Comment by Mircea Carasel [ 13/Oct/11 ]

commited

r12867 = c36c985912825d81429299353cd81e93e8999fba

SparkTransferManager.java: use TranscriptWindow.addComponent instead of duplicating code

Comment by Mircea Carasel [ 13/Oct/11 ]

Walter,
I am thinking to close this issue ( SPARK-1403 Closed ) and propose it for Spark 2.7.0 release - what do you think?
I will write some docs by then...

Comment by Walter Ebeling [ 13/Oct/11 ]

Hi Mircea, if you are happy with the features you have put into it, you should close it. I propose that we let 2.7.0 bake as beta1 in the community a bit.

Comment by Mircea Carasel [ 19/Oct/11 ]

I mark the ticket as resolved. For any new improvements on this field, also based on community testing, will open new tickets.

Comment by Mircea Carasel [ 02/Nov/11 ]

commited

r12889 = 7f7e22bef522aba34e863e0186f940570e6ec7fd

SPARK-1403: create dedicate, overridable method for Connection configuration creation

Comment by Mircea Carasel [ 24/Nov/11 ]

r12898 = 57cd94cf227245a709c9a17794db858278b7d2c4

move OTR button creation in ButtonFactory

Comment by Mircea Carasel [ 19/Dec/11 ]

commited
r12923 = c346206b38338c06cfef3faee8d51e65162c7dd0

create utility method in VCardManager to load personal vcard

Comment by Walter Ebeling [ 24/Feb/13 ]

Mass closing of resolved issues

Generated at Fri Mar 29 12:26:52 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100248-rev:6a03a54452e975225e04dfda06fdac6fd9e95b00.