use of jgnash.plugin.SwingPlugin in project jgnash by ccavanaugh.
the class OptionDialog method initComponents.
private void initComponents() {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle(rb.getString("Title.Options"));
tabbedPane = new JTabbedPane();
tabbedPane.addTab(rb.getString("Tab.Accounts"), new AccountOptions());
tabbedPane.addTab(rb.getString("Tab.General"), new GeneralOptions(this));
tabbedPane.addTab(rb.getString("Tab.Network"), new NetworkOptions());
tabbedPane.addTab(rb.getString("Tab.Register"), new RegisterOptions());
tabbedPane.addTab(rb.getString("Tab.Reminders"), new ReminderOptions());
tabbedPane.addTab(rb.getString("Tab.Report"), new ReportOptions());
tabbedPane.addTab(rb.getString("Tab.StartupShutdown"), new StartupOptions());
for (final Plugin plugin : PluginFactory.getPlugins()) {
final JPanel optionsPanel = ((SwingPlugin) plugin).getOptionsPanel();
if (optionsPanel != null) {
Object name = optionsPanel.getClientProperty(Plugin.OPTIONS_NAME);
if (name != null) {
tabbedPane.addTab((String) name, optionsPanel);
}
}
}
closeButton = new JButton(rb.getString("Button.Close"));
closeButton.addActionListener(this);
}
use of jgnash.plugin.SwingPlugin in project jgnash by ccavanaugh.
the class MainFrame method loadPlugins.
private void loadPlugins() {
// Only load Swing based plugins
PluginFactory.loadPlugins(plugin -> plugin instanceof SwingPlugin);
PluginFactory.startPlugins(Plugin.PluginPlatform.Swing);
for (final Plugin plugin : PluginFactory.getPlugins()) {
final JMenuItem[] menuItems = ((SwingPlugin) plugin).getMenuItems();
if (menuItems != null) {
for (JMenuItem menuItem : menuItems) {
final Object precedingId = menuItem.getClientProperty(SwingPlugin.PRECEDING_MENU_IDREF);
if (precedingId != null && precedingId instanceof String) {
addMenuItem((String) precedingId, menuItem);
}
}
}
}
}
Aggregations