| 1 | |
package org.homeunix.thecave.buddi.view.menu.menus; |
| 2 | |
|
| 3 | |
import java.util.List; |
| 4 | |
|
| 5 | |
import org.homeunix.thecave.buddi.i18n.keys.MenuKeys; |
| 6 | |
import org.homeunix.thecave.buddi.model.prefs.PrefsModel; |
| 7 | |
import org.homeunix.thecave.buddi.plugin.BuddiPluginFactory; |
| 8 | |
import org.homeunix.thecave.buddi.plugin.api.BuddiPanelPlugin; |
| 9 | |
import org.homeunix.thecave.buddi.view.MainFrame; |
| 10 | |
import org.homeunix.thecave.buddi.view.menu.items.PanelMenuEntry; |
| 11 | |
import org.homeunix.thecave.buddi.view.menu.items.SingletonPanelMenuEntry; |
| 12 | |
|
| 13 | |
import ca.digitalcave.moss.swing.MossFrame; |
| 14 | |
import ca.digitalcave.moss.swing.MossMenu; |
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
public class ViewPanelsMenu extends MossMenu { |
| 21 | |
|
| 22 | |
public static final long serialVersionUID = 0; |
| 23 | |
|
| 24 | |
public ViewPanelsMenu(MossFrame frame) { |
| 25 | 30480 | super(frame, PrefsModel.getInstance().getTranslator().get(MenuKeys.MENU_VIEW_PANELS)); |
| 26 | 30480 | } |
| 27 | |
|
| 28 | |
@SuppressWarnings("unchecked") |
| 29 | |
@Override |
| 30 | |
public void updateMenus() { |
| 31 | |
SingletonPanelMenuEntry menuEntry; |
| 32 | 170325 | MainFrame mainFrame = (MainFrame) getFrame(); |
| 33 | 170325 | this.removeAll(); |
| 34 | |
|
| 35 | 170325 | for (BuddiPanelPlugin plugin : (List<BuddiPanelPlugin>) BuddiPluginFactory.getPlugins(BuddiPanelPlugin.class)) { |
| 36 | 0 | if (plugin.isSingleton()) { |
| 37 | 0 | menuEntry = new SingletonPanelMenuEntry(mainFrame, plugin); |
| 38 | 0 | menuEntry.setSelected(mainFrame.isPanelOpen(plugin)); |
| 39 | 0 | this.add(menuEntry); |
| 40 | |
} else { |
| 41 | 0 | this.add(new PanelMenuEntry((MainFrame) getFrame(), plugin)); |
| 42 | |
} |
| 43 | |
} |
| 44 | 170325 | super.updateMenus(); |
| 45 | 170325 | } |
| 46 | |
} |