1 package cz
.cvut
.promod
.gui
.dialogs
.pluginsOverview
.notations
;
3 import cz
.cvut
.promod
.services
.ModelerSession
;
4 import cz
.cvut
.promod
.services
.pluginLoaderService
.utils
.NotationSpecificPlugins
;
5 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.module
.Module
;
7 import javax
.swing
.event
.ListDataListener
;
10 import java
.util
.LinkedList
;
13 * ProMod, master thesis project
14 * User: Petr Zverina, petr.zverina@gmail.com
15 * Date: 18:00:07, 11.2.2010
17 * A Module component of NotationOverviewTab.
19 public class NotationOverviewTabModel
implements ListModel
{
21 private final List
<NotationLabelWrapper
> notationsList
;
24 public NotationOverviewTabModel() {
25 notationsList
= new LinkedList
<NotationLabelWrapper
>();
30 private void initList(){
31 for(final String identifier
: ModelerSession
.getNotationService().getNotationsIdentifiers()){
32 final NotationSpecificPlugins specificPlugins
= ModelerSession
.getNotationService().getNotationSpecificPlugins(identifier
);
33 final List
<ModuleListModel
.ModuleLabelWrapper
> modulesList
= new LinkedList
<ModuleListModel
.ModuleLabelWrapper
>();
34 for(final Module module
: specificPlugins
.getModules()){
35 modulesList
.add(new ModuleListModel
.ModuleLabelWrapper(module
.getIdentifier(), module
.getName()));
38 notationsList
.add(new NotationLabelWrapper(
39 specificPlugins
.getNotation().getIdentifier(), specificPlugins
.getNotation().getFullName(), new ModuleListModel(modulesList
)
44 public int getSize() {
45 return notationsList
.size();
48 public Object
getElementAt(int index
) {
49 return notationsList
.get(index
);
52 public void addListDataListener(ListDataListener l
) {
56 public void removeListDataListener(ListDataListener l
) {
61 * Represents a list in list of notations.
63 protected static class NotationLabelWrapper
{
65 private final String identifier
;
66 private final String displayName
;
68 private final ModuleListModel moduleListModel
;
70 private NotationLabelWrapper(final String identifier
,
71 final String displayName
,
72 final ModuleListModel moduleListModel
) {
74 this.identifier
= identifier
;
75 this.displayName
= displayName
;
76 this.moduleListModel
= moduleListModel
;
79 public String
getIdentifier() {
84 public String
toString() {
88 public ModuleListModel
getModuleListModel() {
89 return moduleListModel
;