Converted all CRLF to LF.
[indepmod/experimental.git] / IndependentModeler / src / cz / cvut / promod / gui / dialogs / pluginsOverview / extensions / ExtensionOverviewTabModel.java
blob154f1be1e6954a2ff7f7dcd1a26bdb4dfdd15125
1 package cz.cvut.promod.gui.dialogs.pluginsOverview.extensions;
3 import cz.cvut.promod.services.ModelerSession;
4 import cz.cvut.promod.plugin.extension.Extension;
6 import javax.swing.*;
7 import javax.swing.event.ListDataListener;
8 import java.util.List;
9 import java.util.LinkedList;
11 /**
12 * ProMod, master thesis project
13 * User: Petr Zverina, petr.zverina@gmail.com
14 * Date: 17:20:11, 11.2.2010
16 * A Model component of ExtensionOverviewTab.
18 public class ExtensionOverviewTabModel implements ListModel {
20 private final List<ExtensionLabelWrapper> extensionsList;
23 public ExtensionOverviewTabModel() {
24 extensionsList = new LinkedList<ExtensionLabelWrapper>();
26 initList();
29 private void initList() {
30 for(final Extension extension : ModelerSession.getExtensionService().getExtensions()){
31 extensionsList.add(new ExtensionLabelWrapper(extension.getIdentifier(), extension.getName()));
35 public int getSize() {
36 return extensionsList.size();
39 public Object getElementAt(int index) {
40 return extensionsList.get(index);
43 public void addListDataListener(ListDataListener l) {
47 public void removeListDataListener(ListDataListener l) {
51 /**
52 * Represents a list in list of extensions.
54 protected static class ExtensionLabelWrapper {
56 private final String identifier;
57 private final String displayName;
59 private ExtensionLabelWrapper(final String identifier, final String displayName) {
60 this.identifier = identifier;
61 this.displayName = displayName;
64 public String getIdentifier() {
65 return identifier;
68 @Override
69 public String toString() {
70 return displayName;