New Jide License
[indepmod/experimental.git] / IndependentModeler / src / cz / cvut / promod / gui / dialogs / pluginsOverview / extensions / ExtensionOverviewTab.java
blob36be3b5f031ee9e4c97c1bfd596c79a94b594070
1 package cz.cvut.promod.gui.dialogs.pluginsOverview.extensions;
3 import cz.cvut.promod.plugin.extension.Extension;
4 import cz.cvut.promod.services.ModelerSession;
6 import javax.swing.*;
7 import javax.swing.event.ListSelectionListener;
8 import javax.swing.event.ListSelectionEvent;
10 import org.apache.log4j.Logger;
12 /**
13 * ProMod, master thesis project
14 * User: Petr Zverina, petr.zverina@gmail.com
15 * Date: 16:49:59, 11.2.2010
17 * Implementation of ExtensionOverviewTab for PluginsOverviewDialog.
19 public class ExtensionOverviewTab extends ExtensionOverviewTabView {
21 private static final Logger LOG = Logger.getLogger(ExtensionOverviewTab.class);
23 private final ExtensionOverviewTabModel model;
25 public ExtensionOverviewTab(){
26 model = new ExtensionOverviewTabModel();
28 initList();
30 initEventHandling();
33 private void initEventHandling() {
34 extensionList.addListSelectionListener(new ListSelectionListener(){
35 public void valueChanged(ListSelectionEvent e) {
36 final String extensionIdentifier =
37 ((ExtensionOverviewTabModel.ExtensionLabelWrapper)model.getElementAt(extensionList.getSelectedIndex())).getIdentifier();
39 updateDialogView(extensionIdentifier);
41 });
44 private void updateDialogView(final String extensionIdentifier) {
45 final Extension extension = ModelerSession.getExtensionService().getExtension(extensionIdentifier);
47 if(extension != null){
48 identifierTextArea.setText(extension.getIdentifier());
49 nameTextArea.setText(extension.getName());
50 descriptionTextArea.setText(extension.getDescription());
51 } else {
52 LOG.error("Missing notation.");
56 private void initList() {
57 extensionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
58 extensionList.setModel(model);