org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel.java Source code

Java tutorial

Introduction

Here is the source code for org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel.java

Source

/*
 * Copyright 2014 OpenNMS Group Inc., Entimoss ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.opennms.features.pluginmgr.vaadin.pluginmanager;

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.opennms.features.pluginmgr.SessionPluginManager;
import org.opennms.karaf.licencemgr.metadata.jaxb.LicenceList;
import org.opennms.karaf.licencemgr.metadata.jaxb.ProductSpecList;

import com.vaadin.annotations.AutoGenerated;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Link;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.CloseEvent;

public class PluginManagerUIMainPanel extends CustomComponent {

    /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":false,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":0} */

    @AutoGenerated
    private VerticalLayout mainLayout;

    @AutoGenerated
    private HorizontalSplitPanel pluginMgrHorSplitPanel_1;

    @AutoGenerated
    private VerticalLayout featureSettingsPanel;

    @AutoGenerated
    private TabSheet featuresTabSheet_1;

    @AutoGenerated
    private VerticalLayout addLicenceTab;

    @AutoGenerated
    private AddLicencePanel addLicencePanel;

    @AutoGenerated
    private VerticalLayout installedLicencesTab;

    @AutoGenerated
    private LicenceDescriptorTablePanel licenceDescriptorTablePanel;

    @AutoGenerated
    private VerticalLayout availablePluginsTab;

    @AutoGenerated
    private ProductDescriptorTablePanel availablePluginsPanel;

    @AutoGenerated
    private VerticalLayout pluginsManifestTab;

    @AutoGenerated
    private ProductDescriptorTablePanel pluginsManifestPanel;

    @AutoGenerated
    private VerticalLayout installedPluginsTab;

    @AutoGenerated
    private ProductDescriptorTablePanel installedPluginsPanel;

    @AutoGenerated
    private VerticalLayout verticalLayout_7;

    @AutoGenerated
    private Button seeFullMessageButton;

    @AutoGenerated
    private TextArea systemMessagesTextArea;

    @AutoGenerated
    private VerticalLayout generalSettingsPanel;

    @AutoGenerated
    private VerticalLayout verticalLayout_6;

    @AutoGenerated
    private HorizontalLayout horizontalLayout_4;

    @AutoGenerated
    private VerticalLayout pluginServerConfigPanel;

    @AutoGenerated
    private HorizontalLayout horizontalLayout_5;

    @AutoGenerated
    private Link openShoppingCartLink;

    @AutoGenerated
    private TextField licenceShoppingCartUrlTxtField;

    @AutoGenerated
    private HorizontalLayout horizontalLayout_6;

    @AutoGenerated
    private Button updatePluginServerButton;

    @AutoGenerated
    private VerticalLayout verticalLayout_3;

    @AutoGenerated
    private TextField pluginServerPasswordTxtField;

    @AutoGenerated
    private TextField pluginServerUsernameTxtField;

    @AutoGenerated
    private TextField pluginServerUrlTxtField;

    @AutoGenerated
    private HorizontalLayout horizontalLayout_2;

    @AutoGenerated
    private Button reloadAvailablePluginsButton;

    @AutoGenerated
    private TextField availablepluginsLastUpdatedTextField;

    @AutoGenerated
    private VerticalLayout verticalLayout_8;

    @AutoGenerated
    private HorizontalLayout horizontalLayout_3;

    @AutoGenerated
    private VerticalLayout verticalLayout_4;

    @AutoGenerated
    private VerticalLayout systemIdPanel;

    @AutoGenerated
    private CheckBox allowUpdateMessagesCheckBox;

    @AutoGenerated
    private CheckBox remoteIsAccessibleCheckBox;

    @AutoGenerated
    private Button generateRandomManifestSystemIdButton;

    @AutoGenerated
    private Button updateSystemIdButton;

    @AutoGenerated
    private TextField manifestSystemIdTextField;

    @AutoGenerated
    private TextField systemIdTxtField;

    @AutoGenerated
    private TextField karafLastUpdatedTextField;

    @AutoGenerated
    private TextField karafInstanceSelectedTextField;

    @AutoGenerated
    private TextField currentKarafUrlTextField;

    @AutoGenerated
    private Button reloadKarafDataButton;

    @AutoGenerated
    private VerticalLayout verticalLayout_2;

    @AutoGenerated
    private ListSelect karafListSelect;

    @AutoGenerated
    private Button editInstancelistButton;

    private static final long serialVersionUID = 1L;

    // local panels - not auto generated
    private AvailablePluginControlsPanel availablePluginsControlsPanel;

    private InstalledPluginControlsPanel installedPluginsControlsPanel;

    private PluginManifestControlsPanel pluginManifestControlsPanel;

    private InstalledLicencesControlsPanel installedLicencesControlsPanel;

    private SessionPluginManager sessionPluginManager;

    private SystemMessages systemMessages = new SystemMessages();

    // default length of karaf instance list
    private static final int KARAF_LIST_SELECT_ROWS = 10;

    public SessionPluginManager getSessionPluginManager() {
        return sessionPluginManager;
    }

    public void setSessionPluginManager(SessionPluginManager sessionPluginManager) {
        this.sessionPluginManager = sessionPluginManager;
    }

    private boolean remoteUpdateControlsEnabled = true;

    public void setRemoteUpdateControlsEnabled(boolean remoteUpdateControlsEnabled) {
        this.remoteUpdateControlsEnabled = remoteUpdateControlsEnabled;
        // set state of update control buttons to remoteUpdateControlsEnabled 
        //TODO UPDATE SYSTEM ID ??
        reloadKarafDataButton.setEnabled(remoteUpdateControlsEnabled);
    }

    public void updateDisplayValues() {

        try {

            // update/add available instances without throwing value change event
            Set<String> instanceNames = sessionPluginManager.getKarafInstances().keySet();
            for (String instanceName : instanceNames) {
                if (!karafListSelect.containsId(instanceName))
                    karafListSelect.addItem(instanceName);
            }
            ;
            List<Object> itemIds = new ArrayList<Object>(karafListSelect.getItemIds());
            for (Object itemid : itemIds) {
                if (!instanceNames.contains(itemid))
                    karafListSelect.removeItem(itemid);
            }

            String karafInstanceSelected = (sessionPluginManager.getKarafInstance() == null) ? ""
                    : sessionPluginManager.getKarafInstance().toString();
            karafInstanceSelectedTextField.setReadOnly(false);
            karafInstanceSelectedTextField.setValue(karafInstanceSelected);
            karafInstanceSelectedTextField.setReadOnly(true);

            String karafInstanceUrl = (sessionPluginManager.getKarafUrl() == null) ? ""
                    : sessionPluginManager.getKarafUrl().toString();
            currentKarafUrlTextField.setReadOnly(false);
            currentKarafUrlTextField.setValue(karafInstanceUrl);
            currentKarafUrlTextField.setReadOnly(true);

            remoteIsAccessibleCheckBox.setValue(sessionPluginManager.getRemoteIsAccessible());
            allowUpdateMessagesCheckBox.setValue(sessionPluginManager.getAllowUpdateMessages());

            Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

            String karaflastupdate = (sessionPluginManager.getKarafInstanceLastUpdated() == null) ? "never updated"
                    : formatter.format(sessionPluginManager.getKarafInstanceLastUpdated());
            karafLastUpdatedTextField.setReadOnly(false);
            karafLastUpdatedTextField.setValue(karaflastupdate);
            karafLastUpdatedTextField.setReadOnly(true);

            String pluginslastupdate = (sessionPluginManager.getAvailablePluginsLastUpdated() == null)
                    ? "never updated"
                    : formatter.format(sessionPluginManager.getAvailablePluginsLastUpdated());
            availablepluginsLastUpdatedTextField.setReadOnly(false);
            availablepluginsLastUpdatedTextField.setValue(pluginslastupdate);
            availablepluginsLastUpdatedTextField.setReadOnly(true);

            ProductSpecList availablePluginsList = sessionPluginManager.getAvailablePlugins();
            availablePluginsPanel.addProductList(availablePluginsList);

            ProductSpecList installedPluginsList = sessionPluginManager.getInstalledPlugins();
            installedPluginsPanel.addProductList(installedPluginsList);

            ProductSpecList pluginsManifestList = sessionPluginManager.getPluginsManifest();
            pluginsManifestPanel.addProductList(pluginsManifestList);

            LicenceList licencelist = sessionPluginManager.getInstalledLicenceList();
            licenceDescriptorTablePanel.addLicenceList(licencelist);

            systemIdTxtField.setReadOnly(false);
            systemIdTxtField.setValue(sessionPluginManager.getSystemId());
            systemIdTxtField.setReadOnly(true);

            manifestSystemIdTextField.setValue(sessionPluginManager.getManifestSystemId());

            pluginServerPasswordTxtField.setValue(sessionPluginManager.getPluginServerPassword());
            pluginServerUsernameTxtField.setValue(sessionPluginManager.getPluginServerUsername());
            pluginServerUrlTxtField.setValue(sessionPluginManager.getPluginServerUrl());
            licenceShoppingCartUrlTxtField.setValue(sessionPluginManager.getLicenceShoppingCartUrl());

            ExternalResource resource = new ExternalResource(sessionPluginManager.getLicenceShoppingCartUrl());
            openShoppingCartLink.setResource(resource);

        } catch (Exception e) {
            systemMessages.error("Problem refreshing display values for " + sessionPluginManager.getKarafInstance(),
                    e);
        }

        mainLayout.markAsDirty();

    }

    /**
     * The constructor should first build the main layout, set the
     * composition root and then do any custom initialization.
     *
     * The constructor will not be automatically regenerated by the
     * visual editor.
     */

    public PluginManagerUIMainPanel(SessionPluginManager sessionPluginManager) {
        this.sessionPluginManager = sessionPluginManager;

        buildMainLayout();
        setCompositionRoot(mainLayout);

        // manually add user code here
        systemMessages.setMessageTextArea(this.systemMessagesTextArea);

        seeFullMessageButton.addClickListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                ErrorMessageWindow sub = new ErrorMessageWindow(systemMessages);
                // Add it to the root component
                UI.getCurrent().addWindow(sub);
            }
        });

        // set up code to open instance editor window
        editInstancelistButton.addClickListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                systemMessages.clear();
                InstanceListEditorWindow instanceListEditorWindow = new InstanceListEditorWindow(
                        sessionPluginManager);

                instanceListEditorWindow.addCloseListener(new Window.CloseListener() {
                    private static final long serialVersionUID = 1L;

                    // inline close-listener updates main display when editor exits
                    public void windowClose(CloseEvent e) {
                        updateDisplayValues();
                    }
                });

                // Add it to the root component
                UI.getCurrent().addWindow(instanceListEditorWindow);
            }
        });

        // check boxes
        updateSystemIdButton.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                systemMessages.clear();
                String message = "";
                // update systemId
                try {
                    String newManifestSystemId = manifestSystemIdTextField.getValue();
                    sessionPluginManager.setManifestSystemId(newManifestSystemId);
                    message = "manifestSystemId for Karaf Instance " + sessionPluginManager.getKarafInstance()
                            + " updated to " + newManifestSystemId;

                    sessionPluginManager.setSystemId(newManifestSystemId);
                    message = message + "\nsystemId for Karaf Instance " + sessionPluginManager.getKarafInstance()
                            + " updated to " + newManifestSystemId;

                    systemMessages.info(message);
                    sessionPluginManager.refreshKarafEntry(); // update the values if we can
                    updateDisplayValues();
                } catch (Exception e) {
                    systemMessages.error(message + "\nproblem updating systemId for Karaf Instance "
                            + sessionPluginManager.getKarafInstance(), e);
                }
            }
        });

        generateRandomManifestSystemIdButton.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                systemMessages.clear();
                // generate random systemId
                try {
                    String randomManifestSystemId = sessionPluginManager.generateRandomManifestSystemId();
                    systemMessages.info("random manifestSystemId generated " + randomManifestSystemId);
                    updateDisplayValues();
                } catch (Exception e) {
                    systemMessages.error("problem generating random systemId.", e);
                }

            }
        });

        remoteIsAccessibleCheckBox.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 1L;

            public void valueChange(ValueChangeEvent event) {
                boolean remoteIsAccessible = (Boolean) event.getProperty().getValue();
                sessionPluginManager.setRemoteIsAccessible(remoteIsAccessible);

                setRemoteUpdateControlsEnabled(remoteIsAccessible);

                addLicencePanel.setRemoteUpdateControlsEnabled(remoteIsAccessible);
                installedLicencesControlsPanel.setRemoteUpdateControlsEnabled(remoteIsAccessible);
                pluginManifestControlsPanel.setRemoteUpdateControlsEnabled(remoteIsAccessible);
                availablePluginsControlsPanel.setRemoteUpdateControlsEnabled(remoteIsAccessible);
                installedPluginsControlsPanel.setRemoteUpdateControlsEnabled(remoteIsAccessible);

                systemMessages.info("Remote is accessible set to " + remoteIsAccessible + " for Karaf Instance "
                        + sessionPluginManager.getKarafInstance());
            }
        });

        allowUpdateMessagesCheckBox.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 1L;

            public void valueChange(ValueChangeEvent event) {
                boolean allowUpdateMessages = (Boolean) event.getProperty().getValue();
                sessionPluginManager.setAllowUpdateMessages(allowUpdateMessages);
                systemMessages.info("Allow update messages set to " + allowUpdateMessages + " for Karaf Instance "
                        + sessionPluginManager.getKarafInstance());
            }
        });

        // plugin Server Panel
        updatePluginServerButton.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                systemMessages.clear();
                // update plugin server
                try {

                    String pluginServerUsername = pluginServerUsernameTxtField.getValue();
                    String pluginServerPassword = pluginServerPasswordTxtField.getValue();
                    String pluginServerUrl = pluginServerUrlTxtField.getValue();
                    String licenceShoppingCartUrl = licenceShoppingCartUrlTxtField.getValue();

                    sessionPluginManager.setPluginManagerBasicData(pluginServerUsername, pluginServerPassword,
                            pluginServerUrl, licenceShoppingCartUrl);

                    systemMessages.info("plugin server password updated to "
                            + pluginServerPasswordTxtField.getValue() + "\nplugin server username updated to "
                            + pluginServerUsernameTxtField.getValue() + "\nplugin server URL updated to "
                            + pluginServerUrlTxtField.getValue() + "\nlicence Shopping Cart URL updated to "
                            + licenceShoppingCartUrlTxtField.getValue() + "\n");

                    updateDisplayValues();
                } catch (Exception e) {
                    systemMessages.error("Problem updating plugin server data", e);
                }

            }
        });

        // karaf select panel
        karafListSelect.setRows(KARAF_LIST_SELECT_ROWS); // Show n items and a scrollbar if there are more
        karafListSelect.setNullSelectionAllowed(false);
        karafListSelect.setImmediate(true);

        // Feedback on value changes
        karafListSelect.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void valueChange(ValueChangeEvent event) {

                systemMessages.clear();
                String karafInstanceSelected = null;
                try {
                    if (karafListSelect.getValue() != null) {
                        karafInstanceSelected = karafListSelect.getValue().toString();
                        sessionPluginManager.setKarafInstance(karafInstanceSelected);
                    }
                    systemMessages.info("Karaf instance changed to " + sessionPluginManager.getKarafInstance());
                } catch (Exception e) {
                    systemMessages.error("Problem changing karaf instance", e);
                }
                updateDisplayValues();
            }
        });

        // Handle the reloadKarafDataButton events with an anonymous class
        reloadKarafDataButton.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                systemMessages.clear();
                //reload data from plugin model
                try {
                    sessionPluginManager.refreshKarafEntry(); // update the values if we can
                    systemMessages.info("karaf data for karaf instance " + sessionPluginManager.getKarafInstance()
                            + " successfully reloaded");
                } catch (Exception e) {
                    systemMessages.error(
                            "problem reloading data for karaf instance " + sessionPluginManager.getKarafInstance(),
                            e);
                }
                updateDisplayValues();
            }
        });

        // Handle the reloadAvailablePluginsButton events with an anonymous class
        reloadAvailablePluginsButton.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                systemMessages.clear();
                //reload data from plugin model
                try {
                    sessionPluginManager.refreshAvailablePlugins();
                    systemMessages.info("Available plugin data successfully reloaded from plugin server: "
                            + sessionPluginManager.getPluginServerUrl());
                } catch (Exception e) {
                    systemMessages.error("Problem retrieving available plugin data.", e);
                }
                updateDisplayValues();
            }
        });

        // Plugins Detail tabs panel

        // update tab content dynamically when tab is selected
        featuresTabSheet_1.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
            private static final long serialVersionUID = 1L;

            public void selectedTabChange(SelectedTabChangeEvent event) {
                systemMessages.clear();
                updateDisplayValues();
            }
        });

        // Available Plugins Tab
        availablePluginsControlsPanel = new AvailablePluginControlsPanel();
        availablePluginsControlsPanel.setSessionPluginManager(sessionPluginManager);
        availablePluginsControlsPanel.setProductDescriptorTablePanel(availablePluginsPanel);
        availablePluginsControlsPanel.setSystemMessages(systemMessages);
        availablePluginsPanel.getControlsVerticalLayout().addComponent(availablePluginsControlsPanel);

        // Installed Plugins Tab
        installedPluginsControlsPanel = new InstalledPluginControlsPanel();
        installedPluginsControlsPanel.setSessionPluginManager(sessionPluginManager);
        installedPluginsControlsPanel.setProductDescriptorTablePanel(installedPluginsPanel);
        installedPluginsControlsPanel.setSystemMessages(systemMessages);
        installedPluginsPanel.getControlsVerticalLayout().addComponent(installedPluginsControlsPanel);

        // Plugin Manifest Table in Installed Plugins Tab
        pluginManifestControlsPanel = new PluginManifestControlsPanel();
        pluginManifestControlsPanel.setSessionPluginManager(sessionPluginManager);
        pluginManifestControlsPanel.setProductDescriptorTablePanel(pluginsManifestPanel);
        pluginManifestControlsPanel.setSystemMessages(systemMessages);
        pluginManifestControlsPanel.setPluginManagerUIMainPanel(this); // used to pass refresh command back
        pluginsManifestPanel.getControlsVerticalLayout().addComponent(pluginManifestControlsPanel);

        // Installed Licences Tab
        installedLicencesControlsPanel = new InstalledLicencesControlsPanel();
        installedLicencesControlsPanel.setSessionPluginManager(sessionPluginManager);
        installedLicencesControlsPanel.setLicenceDescriptorTablePanel(licenceDescriptorTablePanel);
        installedLicencesControlsPanel.setSystemMessages(systemMessages);
        licenceDescriptorTablePanel.getControlsVerticalLayout().addComponent(installedLicencesControlsPanel);

        // Add Licences Tab
        addLicencePanel.setSessionPluginManager(sessionPluginManager);
        addLicencePanel.setSystemMessages(systemMessages);

        // set remote controls according to value session manager
        setRemoteUpdateControlsEnabled(sessionPluginManager.getRemoteIsAccessible());
        addLicencePanel.setRemoteUpdateControlsEnabled(remoteUpdateControlsEnabled);
        installedLicencesControlsPanel.setRemoteUpdateControlsEnabled(remoteUpdateControlsEnabled);
        pluginManifestControlsPanel.setRemoteUpdateControlsEnabled(remoteUpdateControlsEnabled);
        availablePluginsControlsPanel.setRemoteUpdateControlsEnabled(remoteUpdateControlsEnabled);
        installedPluginsControlsPanel.setRemoteUpdateControlsEnabled(remoteUpdateControlsEnabled);

        // update the display
        updateDisplayValues();

    }

    @AutoGenerated
    private VerticalLayout buildMainLayout() {
        // common part: create layout
        mainLayout = new VerticalLayout();
        mainLayout.setImmediate(true);
        mainLayout.setWidth("100%");
        mainLayout.setHeight("100%");
        mainLayout.setMargin(true);

        // top-level component properties
        setWidth("100.0%");
        setHeight("100.0%");

        // pluginMgrHorSplitPanel_1
        pluginMgrHorSplitPanel_1 = buildPluginMgrHorSplitPanel_1();
        mainLayout.addComponent(pluginMgrHorSplitPanel_1);
        mainLayout.setComponentAlignment(pluginMgrHorSplitPanel_1, new Alignment(9));

        return mainLayout;
    }

    @AutoGenerated
    private HorizontalSplitPanel buildPluginMgrHorSplitPanel_1() {
        // common part: create layout
        pluginMgrHorSplitPanel_1 = new HorizontalSplitPanel();
        pluginMgrHorSplitPanel_1.setCaption("Plugin Manager Settings");
        pluginMgrHorSplitPanel_1.setImmediate(true);
        pluginMgrHorSplitPanel_1.setWidth("100.0%");
        pluginMgrHorSplitPanel_1.setHeight("100.0%");

        // generalSettingsPanel
        generalSettingsPanel = buildGeneralSettingsPanel();
        pluginMgrHorSplitPanel_1.addComponent(generalSettingsPanel);

        // featureSettingsPanel
        featureSettingsPanel = buildFeatureSettingsPanel();
        pluginMgrHorSplitPanel_1.addComponent(featureSettingsPanel);

        return pluginMgrHorSplitPanel_1;
    }

    @AutoGenerated
    private VerticalLayout buildGeneralSettingsPanel() {
        // common part: create layout
        generalSettingsPanel = new VerticalLayout();
        generalSettingsPanel.setCaption("General Settings");
        generalSettingsPanel.setImmediate(true);
        generalSettingsPanel.setWidth("100.0%");
        generalSettingsPanel.setHeight("-1px");
        generalSettingsPanel.setMargin(true);

        // verticalLayout_8
        verticalLayout_8 = buildVerticalLayout_8();
        generalSettingsPanel.addComponent(verticalLayout_8);

        // verticalLayout_6
        verticalLayout_6 = buildVerticalLayout_6();
        generalSettingsPanel.addComponent(verticalLayout_6);

        return generalSettingsPanel;
    }

    @AutoGenerated
    private VerticalLayout buildVerticalLayout_8() {
        // common part: create layout
        verticalLayout_8 = new VerticalLayout();
        verticalLayout_8.setImmediate(false);
        verticalLayout_8.setWidth("-1px");
        verticalLayout_8.setHeight("-1px");
        verticalLayout_8.setMargin(false);

        // horizontalLayout_3
        horizontalLayout_3 = buildHorizontalLayout_3();
        verticalLayout_8.addComponent(horizontalLayout_3);

        return verticalLayout_8;
    }

    @AutoGenerated
    private HorizontalLayout buildHorizontalLayout_3() {
        // common part: create layout
        horizontalLayout_3 = new HorizontalLayout();
        horizontalLayout_3.setCaption("Karaf Instance Data");
        horizontalLayout_3.setImmediate(true);
        horizontalLayout_3.setWidth("100.0%");
        horizontalLayout_3.setHeight("100.0%");
        horizontalLayout_3.setMargin(true);
        horizontalLayout_3.setSpacing(true);

        // verticalLayout_2
        verticalLayout_2 = buildVerticalLayout_2();
        horizontalLayout_3.addComponent(verticalLayout_2);

        // verticalLayout_4
        verticalLayout_4 = buildVerticalLayout_4();
        horizontalLayout_3.addComponent(verticalLayout_4);

        return horizontalLayout_3;
    }

    @AutoGenerated
    private VerticalLayout buildVerticalLayout_2() {
        // common part: create layout
        verticalLayout_2 = new VerticalLayout();
        verticalLayout_2.setImmediate(false);
        verticalLayout_2.setWidth("50.0%");
        verticalLayout_2.setHeight("-1px");
        verticalLayout_2.setMargin(true);
        verticalLayout_2.setSpacing(true);

        // editInstancelistButton
        editInstancelistButton = new Button();
        editInstancelistButton.setCaption("Edit Instance List");
        editInstancelistButton.setImmediate(true);
        editInstancelistButton.setDescription("Opens a new dialog to update the instance list");
        editInstancelistButton.setWidth("-1px");
        editInstancelistButton.setHeight("-1px");
        verticalLayout_2.addComponent(editInstancelistButton);

        // karafListSelect
        karafListSelect = new ListSelect();
        karafListSelect.setCaption("Karaf Instances");
        karafListSelect.setImmediate(true);
        karafListSelect.setDescription("Available Karaf Instances");
        karafListSelect.setWidth("100.0%");
        karafListSelect.setHeight("-1px");
        verticalLayout_2.addComponent(karafListSelect);

        return verticalLayout_2;
    }

    @AutoGenerated
    private VerticalLayout buildVerticalLayout_4() {
        // common part: create layout
        verticalLayout_4 = new VerticalLayout();
        verticalLayout_4.setImmediate(true);
        verticalLayout_4.setWidth("50.0%");
        verticalLayout_4.setHeight("100.0%");
        verticalLayout_4.setMargin(true);
        verticalLayout_4.setSpacing(true);

        // reloadKarafDataButton
        reloadKarafDataButton = new Button();
        reloadKarafDataButton.setCaption("Reload Karaf Instance Data");
        reloadKarafDataButton.setImmediate(true);
        reloadKarafDataButton.setWidth("-1px");
        reloadKarafDataButton.setHeight("-1px");
        verticalLayout_4.addComponent(reloadKarafDataButton);

        // systemIdPanel
        systemIdPanel = buildSystemIdPanel();
        verticalLayout_4.addComponent(systemIdPanel);
        verticalLayout_4.setExpandRatio(systemIdPanel, 1.0f);

        return verticalLayout_4;
    }

    @AutoGenerated
    private VerticalLayout buildSystemIdPanel() {
        // common part: create layout
        systemIdPanel = new VerticalLayout();
        systemIdPanel.setImmediate(true);
        systemIdPanel.setDescription("System Id Settings");
        systemIdPanel.setWidth("-1px");
        systemIdPanel.setHeight("-1px");
        systemIdPanel.setMargin(true);
        systemIdPanel.setSpacing(true);

        // currentKarafUrlTextField
        currentKarafUrlTextField = new TextField();
        currentKarafUrlTextField.setCaption("Current Karaf URL");
        currentKarafUrlTextField.setImmediate(true);
        currentKarafUrlTextField.setWidth("100.0%");
        currentKarafUrlTextField.setHeight("-1px");
        systemIdPanel.addComponent(currentKarafUrlTextField);

        // karafInstanceSelectedTextField
        karafInstanceSelectedTextField = new TextField();
        karafInstanceSelectedTextField.setCaption("Current Karaf Instance Name");
        karafInstanceSelectedTextField.setImmediate(true);
        karafInstanceSelectedTextField.setWidth("100.0%");
        karafInstanceSelectedTextField.setHeight("-1px");
        systemIdPanel.addComponent(karafInstanceSelectedTextField);

        // karafLastUpdatedTextField
        karafLastUpdatedTextField = new TextField();
        karafLastUpdatedTextField.setCaption("Current Instance Last Updated");
        karafLastUpdatedTextField.setImmediate(true);
        karafLastUpdatedTextField.setWidth("100.0%");
        karafLastUpdatedTextField.setHeight("-1px");
        systemIdPanel.addComponent(karafLastUpdatedTextField);

        // systemIdTxtField
        systemIdTxtField = new TextField();
        systemIdTxtField.setCaption("Current Instance System Id");
        systemIdTxtField.setImmediate(true);
        systemIdTxtField.setDescription("Actual System Id of the selected Karaf Instance");
        systemIdTxtField.setWidth("100.0%");
        systemIdTxtField.setHeight("-1px");
        systemIdPanel.addComponent(systemIdTxtField);

        // manifestSystemIdTextField
        manifestSystemIdTextField = new TextField();
        manifestSystemIdTextField.setCaption("Manifest System Id");
        manifestSystemIdTextField.setImmediate(true);
        manifestSystemIdTextField.setDescription("System Id Expected for Manifest download");
        manifestSystemIdTextField.setWidth("100.0%");
        manifestSystemIdTextField.setHeight("-1px");
        systemIdPanel.addComponent(manifestSystemIdTextField);

        // updateSystemIdButton
        updateSystemIdButton = new Button();
        updateSystemIdButton.setCaption("Set Karaf  to Manifest System Id");
        updateSystemIdButton.setImmediate(true);
        updateSystemIdButton.setDescription(
                "Sets the systemId of the selected Karaf instance to the value in the System Id field");
        updateSystemIdButton.setWidth("-1px");
        updateSystemIdButton.setHeight("-1px");
        systemIdPanel.addComponent(updateSystemIdButton);

        // generateRandomManifestSystemIdButton
        generateRandomManifestSystemIdButton = new Button();
        generateRandomManifestSystemIdButton.setCaption("Generate Random Manifest System Id");
        generateRandomManifestSystemIdButton.setImmediate(true);
        generateRandomManifestSystemIdButton.setDescription(
                "Generates a new random system id and sets this value in the selected karaf instance");
        generateRandomManifestSystemIdButton.setWidth("-1px");
        generateRandomManifestSystemIdButton.setHeight("-1px");
        systemIdPanel.addComponent(generateRandomManifestSystemIdButton);

        // remoteIsAccessibleCheckBox
        remoteIsAccessibleCheckBox = new CheckBox();
        remoteIsAccessibleCheckBox.setCaption("  Remote is Accessible");
        remoteIsAccessibleCheckBox.setImmediate(false);
        remoteIsAccessibleCheckBox.setDescription(
                "Check if Remote cannot be direcly updated using ReST commands. (i.e behind firewall)");
        remoteIsAccessibleCheckBox.setWidth("-1px");
        remoteIsAccessibleCheckBox.setHeight("-1px");
        systemIdPanel.addComponent(remoteIsAccessibleCheckBox);

        // allowUpdateMessagesCheckBox
        allowUpdateMessagesCheckBox = new CheckBox();
        allowUpdateMessagesCheckBox.setCaption("  Allow Status Update from Remote");
        allowUpdateMessagesCheckBox.setImmediate(false);
        allowUpdateMessagesCheckBox.setDescription("Status update messages are allowed from remote");
        allowUpdateMessagesCheckBox.setWidth("-1px");
        allowUpdateMessagesCheckBox.setHeight("-1px");
        systemIdPanel.addComponent(allowUpdateMessagesCheckBox);
        systemIdPanel.setComponentAlignment(allowUpdateMessagesCheckBox, new Alignment(33));

        return systemIdPanel;
    }

    @AutoGenerated
    private VerticalLayout buildVerticalLayout_6() {
        // common part: create layout
        verticalLayout_6 = new VerticalLayout();
        verticalLayout_6.setCaption("Available Plugins Server");
        verticalLayout_6.setImmediate(false);
        verticalLayout_6.setWidth("100.0%");
        verticalLayout_6.setHeight("-1px");
        verticalLayout_6.setMargin(false);

        // horizontalLayout_2
        horizontalLayout_2 = buildHorizontalLayout_2();
        verticalLayout_6.addComponent(horizontalLayout_2);
        verticalLayout_6.setComponentAlignment(horizontalLayout_2, new Alignment(9));

        // horizontalLayout_4
        horizontalLayout_4 = buildHorizontalLayout_4();
        verticalLayout_6.addComponent(horizontalLayout_4);

        return verticalLayout_6;
    }

    @AutoGenerated
    private HorizontalLayout buildHorizontalLayout_2() {
        // common part: create layout
        horizontalLayout_2 = new HorizontalLayout();
        horizontalLayout_2.setImmediate(true);
        horizontalLayout_2.setWidth("-1px");
        horizontalLayout_2.setHeight("-1px");
        horizontalLayout_2.setMargin(true);
        horizontalLayout_2.setSpacing(true);

        // availablepluginsLastUpdatedTextField
        availablepluginsLastUpdatedTextField = new TextField();
        availablepluginsLastUpdatedTextField.setCaption("Available Pugins Last Updated");
        availablepluginsLastUpdatedTextField.setImmediate(true);
        availablepluginsLastUpdatedTextField.setWidth("-1px");
        availablepluginsLastUpdatedTextField.setHeight("-1px");
        horizontalLayout_2.addComponent(availablepluginsLastUpdatedTextField);
        horizontalLayout_2.setExpandRatio(availablepluginsLastUpdatedTextField, 1.0f);

        // reloadAvailablePluginsButton
        reloadAvailablePluginsButton = new Button();
        reloadAvailablePluginsButton.setCaption("Reload Available Plugins");
        reloadAvailablePluginsButton.setImmediate(true);
        reloadAvailablePluginsButton.setWidth("-1px");
        reloadAvailablePluginsButton.setHeight("-1px");
        horizontalLayout_2.addComponent(reloadAvailablePluginsButton);
        horizontalLayout_2.setExpandRatio(reloadAvailablePluginsButton, 1.0f);
        horizontalLayout_2.setComponentAlignment(reloadAvailablePluginsButton, new Alignment(10));

        return horizontalLayout_2;
    }

    @AutoGenerated
    private HorizontalLayout buildHorizontalLayout_4() {
        // common part: create layout
        horizontalLayout_4 = new HorizontalLayout();
        horizontalLayout_4.setImmediate(true);
        horizontalLayout_4.setWidth("-1px");
        horizontalLayout_4.setHeight("-1px");
        horizontalLayout_4.setMargin(false);
        horizontalLayout_4.setSpacing(true);

        // pluginServerConfigPanel
        pluginServerConfigPanel = buildPluginServerConfigPanel();
        horizontalLayout_4.addComponent(pluginServerConfigPanel);
        horizontalLayout_4.setExpandRatio(pluginServerConfigPanel, 1.0f);

        return horizontalLayout_4;
    }

    @AutoGenerated
    private VerticalLayout buildPluginServerConfigPanel() {
        // common part: create layout
        pluginServerConfigPanel = new VerticalLayout();
        pluginServerConfigPanel.setCaption("Available Plugins Server Settings");
        pluginServerConfigPanel.setImmediate(true);
        pluginServerConfigPanel.setDescription("External server listing plugins");
        pluginServerConfigPanel.setWidth("-1px");
        pluginServerConfigPanel.setHeight("-1px");
        pluginServerConfigPanel.setMargin(true);
        pluginServerConfigPanel.setSpacing(true);

        // pluginServerUrlTxtField
        pluginServerUrlTxtField = new TextField();
        pluginServerUrlTxtField.setCaption("Plugin Server URL");
        pluginServerUrlTxtField.setImmediate(true);
        pluginServerUrlTxtField.setWidth("100.0%");
        pluginServerUrlTxtField.setHeight("-1px");
        pluginServerConfigPanel.addComponent(pluginServerUrlTxtField);

        // horizontalLayout_6
        horizontalLayout_6 = buildHorizontalLayout_6();
        pluginServerConfigPanel.addComponent(horizontalLayout_6);

        // horizontalLayout_5
        horizontalLayout_5 = buildHorizontalLayout_5();
        pluginServerConfigPanel.addComponent(horizontalLayout_5);
        pluginServerConfigPanel.setExpandRatio(horizontalLayout_5, 1.0f);

        return pluginServerConfigPanel;
    }

    @AutoGenerated
    private HorizontalLayout buildHorizontalLayout_6() {
        // common part: create layout
        horizontalLayout_6 = new HorizontalLayout();
        horizontalLayout_6.setImmediate(false);
        horizontalLayout_6.setWidth("-1px");
        horizontalLayout_6.setHeight("-1px");
        horizontalLayout_6.setMargin(false);
        horizontalLayout_6.setSpacing(true);

        // verticalLayout_3
        verticalLayout_3 = buildVerticalLayout_3();
        horizontalLayout_6.addComponent(verticalLayout_3);

        // updatePluginServerButton
        updatePluginServerButton = new Button();
        updatePluginServerButton.setCaption("Update Plugin Server Settings");
        updatePluginServerButton.setImmediate(true);
        updatePluginServerButton.setWidth("-1px");
        updatePluginServerButton.setHeight("-1px");
        horizontalLayout_6.addComponent(updatePluginServerButton);
        horizontalLayout_6.setComponentAlignment(updatePluginServerButton, new Alignment(9));

        return horizontalLayout_6;
    }

    @AutoGenerated
    private VerticalLayout buildVerticalLayout_3() {
        // common part: create layout
        verticalLayout_3 = new VerticalLayout();
        verticalLayout_3.setImmediate(false);
        verticalLayout_3.setWidth("-1px");
        verticalLayout_3.setHeight("-1px");
        verticalLayout_3.setMargin(false);

        // pluginServerUsernameTxtField
        pluginServerUsernameTxtField = new TextField();
        pluginServerUsernameTxtField.setCaption("Plugin Server Username");
        pluginServerUsernameTxtField.setImmediate(true);
        pluginServerUsernameTxtField.setWidth("-1px");
        pluginServerUsernameTxtField.setHeight("-1px");
        verticalLayout_3.addComponent(pluginServerUsernameTxtField);

        // pluginServerPasswordTxtField
        pluginServerPasswordTxtField = new TextField();
        pluginServerPasswordTxtField.setCaption("Plugin Server Password");
        pluginServerPasswordTxtField.setImmediate(true);
        pluginServerPasswordTxtField.setWidth("-1px");
        pluginServerPasswordTxtField.setHeight("-1px");
        verticalLayout_3.addComponent(pluginServerPasswordTxtField);

        return verticalLayout_3;
    }

    @AutoGenerated
    private HorizontalLayout buildHorizontalLayout_5() {
        // common part: create layout
        horizontalLayout_5 = new HorizontalLayout();
        horizontalLayout_5.setImmediate(false);
        horizontalLayout_5.setWidth("100.0%");
        horizontalLayout_5.setHeight("-1px");
        horizontalLayout_5.setMargin(false);
        horizontalLayout_5.setSpacing(true);

        // licenceShoppingCartUrlTxtField
        licenceShoppingCartUrlTxtField = new TextField();
        licenceShoppingCartUrlTxtField.setCaption("Licence Shopping Cart URL");
        licenceShoppingCartUrlTxtField.setImmediate(true);
        licenceShoppingCartUrlTxtField.setWidth("100.0%");
        licenceShoppingCartUrlTxtField.setHeight("-1px");
        horizontalLayout_5.addComponent(licenceShoppingCartUrlTxtField);
        horizontalLayout_5.setExpandRatio(licenceShoppingCartUrlTxtField, 1.0f);

        // openShoppingCartLink
        openShoppingCartLink = new Link();
        openShoppingCartLink.setCaption("Open Shopping Cart");
        openShoppingCartLink.setImmediate(true);
        openShoppingCartLink.setWidth("100.0%");
        openShoppingCartLink.setHeight("-1px");
        horizontalLayout_5.addComponent(openShoppingCartLink);
        horizontalLayout_5.setExpandRatio(openShoppingCartLink, 0.5f);
        horizontalLayout_5.setComponentAlignment(openShoppingCartLink, new Alignment(9));

        return horizontalLayout_5;
    }

    @AutoGenerated
    private VerticalLayout buildFeatureSettingsPanel() {
        // common part: create layout
        featureSettingsPanel = new VerticalLayout();
        featureSettingsPanel.setCaption("Plugin Settings");
        featureSettingsPanel.setImmediate(true);
        featureSettingsPanel.setWidth("100.0%");
        featureSettingsPanel.setHeight("-1px");
        featureSettingsPanel.setMargin(true);
        featureSettingsPanel.setSpacing(true);

        // verticalLayout_7
        verticalLayout_7 = buildVerticalLayout_7();
        featureSettingsPanel.addComponent(verticalLayout_7);

        // featuresTabSheet_1
        featuresTabSheet_1 = buildFeaturesTabSheet_1();
        featureSettingsPanel.addComponent(featuresTabSheet_1);
        featureSettingsPanel.setExpandRatio(featuresTabSheet_1, 1.0f);

        return featureSettingsPanel;
    }

    @AutoGenerated
    private VerticalLayout buildVerticalLayout_7() {
        // common part: create layout
        verticalLayout_7 = new VerticalLayout();
        verticalLayout_7.setImmediate(false);
        verticalLayout_7.setWidth("100.0%");
        verticalLayout_7.setHeight("-1px");
        verticalLayout_7.setMargin(false);
        verticalLayout_7.setSpacing(true);

        // systemMessagesTextArea
        systemMessagesTextArea = new TextArea();
        systemMessagesTextArea.setCaption("System Messages");
        systemMessagesTextArea.setImmediate(true);
        systemMessagesTextArea.setWidth("100.0%");
        systemMessagesTextArea.setHeight("6.0em");
        verticalLayout_7.addComponent(systemMessagesTextArea);

        // seeFullMessageButton
        seeFullMessageButton = new Button();
        seeFullMessageButton.setCaption("See Full Message");
        seeFullMessageButton.setImmediate(true);
        seeFullMessageButton.setDescription("Opens panel to see full error message");
        seeFullMessageButton.setWidth("-1px");
        seeFullMessageButton.setHeight("-1px");
        verticalLayout_7.addComponent(seeFullMessageButton);
        verticalLayout_7.setComponentAlignment(seeFullMessageButton, new Alignment(6));

        return verticalLayout_7;
    }

    @AutoGenerated
    private TabSheet buildFeaturesTabSheet_1() {
        // common part: create layout
        featuresTabSheet_1 = new TabSheet();
        featuresTabSheet_1.setCaption("Plugin Settings");
        featuresTabSheet_1.setImmediate(true);
        featuresTabSheet_1.setWidth("100.0%");
        featuresTabSheet_1.setHeight("-1px");

        // installedPluginsTab
        installedPluginsTab = buildInstalledPluginsTab();
        featuresTabSheet_1.addTab(installedPluginsTab, "Installed Plugins", null);

        // pluginsManifestTab
        pluginsManifestTab = buildPluginsManifestTab();
        featuresTabSheet_1.addTab(pluginsManifestTab, "Plugins Manifest", null);

        // availablePluginsTab
        availablePluginsTab = buildAvailablePluginsTab();
        featuresTabSheet_1.addTab(availablePluginsTab, "Available Plugins", null);

        // installedLicencesTab
        installedLicencesTab = buildInstalledLicencesTab();
        featuresTabSheet_1.addTab(installedLicencesTab, "Installed Licences", null);

        // addLicenceTab
        addLicenceTab = buildAddLicenceTab();
        featuresTabSheet_1.addTab(addLicenceTab, "Add Licence", null);

        return featuresTabSheet_1;
    }

    @AutoGenerated
    private VerticalLayout buildInstalledPluginsTab() {
        // common part: create layout
        installedPluginsTab = new VerticalLayout();
        installedPluginsTab.setImmediate(true);
        installedPluginsTab.setWidth("-1px");
        installedPluginsTab.setHeight("-1px");
        installedPluginsTab.setMargin(true);
        installedPluginsTab.setSpacing(true);

        // installedPluginsPanel
        installedPluginsPanel = new ProductDescriptorTablePanel();
        installedPluginsPanel.setCaption("Plugins Installed in Karaf");
        installedPluginsPanel.setImmediate(true);
        installedPluginsPanel.setDescription("List of plugins which have been confirmed as installed in Karaf");
        installedPluginsPanel.setWidth("100.0%");
        installedPluginsPanel.setHeight("100.0%");
        installedPluginsTab.addComponent(installedPluginsPanel);

        return installedPluginsTab;
    }

    @AutoGenerated
    private VerticalLayout buildPluginsManifestTab() {
        // common part: create layout
        pluginsManifestTab = new VerticalLayout();
        pluginsManifestTab.setCaption("Plugins Manifest");
        pluginsManifestTab.setImmediate(false);
        pluginsManifestTab.setWidth("-1px");
        pluginsManifestTab.setHeight("-1px");
        pluginsManifestTab.setMargin(true);
        pluginsManifestTab.setSpacing(true);

        // pluginsManifestPanel
        pluginsManifestPanel = new ProductDescriptorTablePanel();
        pluginsManifestPanel.setCaption("Manifest of plugins to be installed in Karaf");
        pluginsManifestPanel.setImmediate(true);
        pluginsManifestPanel.setDescription("List of plugins which will be installed when karaf requests manifest");
        pluginsManifestPanel.setWidth("100.0%");
        pluginsManifestPanel.setHeight("100.0%");
        pluginsManifestTab.addComponent(pluginsManifestPanel);

        return pluginsManifestTab;
    }

    @AutoGenerated
    private VerticalLayout buildAvailablePluginsTab() {
        // common part: create layout
        availablePluginsTab = new VerticalLayout();
        availablePluginsTab.setImmediate(true);
        availablePluginsTab.setWidth("-1px");
        availablePluginsTab.setHeight("-1px");
        availablePluginsTab.setMargin(true);
        availablePluginsTab.setSpacing(true);

        // availablePluginsPanel
        availablePluginsPanel = new ProductDescriptorTablePanel();
        availablePluginsPanel.setCaption("Plugins available from Plugin Server ");
        availablePluginsPanel.setImmediate(true);
        availablePluginsPanel.setWidth("100.0%");
        availablePluginsPanel.setHeight("100.0%");
        availablePluginsTab.addComponent(availablePluginsPanel);

        return availablePluginsTab;
    }

    @AutoGenerated
    private VerticalLayout buildInstalledLicencesTab() {
        // common part: create layout
        installedLicencesTab = new VerticalLayout();
        installedLicencesTab.setCaption("Installed Licences");
        installedLicencesTab.setImmediate(true);
        installedLicencesTab.setWidth("-1px");
        installedLicencesTab.setHeight("-1px");
        installedLicencesTab.setMargin(true);

        // licenceDescriptorTablePanel
        licenceDescriptorTablePanel = new LicenceDescriptorTablePanel();
        licenceDescriptorTablePanel.setImmediate(true);
        licenceDescriptorTablePanel.setWidth("100.0%");
        licenceDescriptorTablePanel.setHeight("100.0%");
        installedLicencesTab.addComponent(licenceDescriptorTablePanel);

        return installedLicencesTab;
    }

    @AutoGenerated
    private VerticalLayout buildAddLicenceTab() {
        // common part: create layout
        addLicenceTab = new VerticalLayout();
        addLicenceTab.setCaption("Installed Licences");
        addLicenceTab.setImmediate(true);
        addLicenceTab.setWidth("-1px");
        addLicenceTab.setHeight("-1px");
        addLicenceTab.setMargin(true);

        // addLicencePanel
        addLicencePanel = new AddLicencePanel();
        addLicencePanel.setImmediate(true);
        addLicencePanel.setWidth("100.0%");
        addLicencePanel.setHeight("100.0%");
        addLicenceTab.addComponent(addLicencePanel);

        return addLicenceTab;
    }

}