mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-1403: Enhance ability to extend core classes like ContactItem, ContactGroup, etc through plugin
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 { ... }
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12581 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -112,7 +112,7 @@ import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
* Dialog to log in a user into the Spark Server. The LoginDialog is used only
|
||||
* for login in registered users into the Spark Server.
|
||||
*/
|
||||
public final class LoginDialog {
|
||||
public class LoginDialog {
|
||||
private JFrame loginDialog;
|
||||
private static final String BUTTON_PANEL = "buttonpanel"; // NOTRANS
|
||||
private static final String PROGRESS_BAR = "progressbar"; // NOTRANS
|
||||
@ -213,6 +213,12 @@ public final class LoginDialog {
|
||||
|
||||
}
|
||||
|
||||
//This method can be overwritten by subclasses to provide additional validations
|
||||
//(such as certificate download functionality when connecting)
|
||||
protected boolean beforeLoginValidations() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define Login Panel implementation.
|
||||
*/
|
||||
@ -727,7 +733,7 @@ public final class LoginDialog {
|
||||
final SwingWorker loginValidationThread = new SwingWorker() {
|
||||
public Object construct() {
|
||||
|
||||
boolean loginSuccessfull = login();
|
||||
boolean loginSuccessfull = beforeLoginValidations() && login();
|
||||
if (loginSuccessfull) {
|
||||
progressBar.setText(Res.getString("message.connecting.please.wait"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user