Example usage for com.vaadin.ui TextArea TextArea

List of usage examples for com.vaadin.ui TextArea TextArea

Introduction

In this page you can find the example usage for com.vaadin.ui TextArea TextArea.

Prototype

public TextArea() 

Source Link

Document

Constructs an empty TextArea.

Usage

From source file:org.metawidget.vaadin.ui.widgetbuilder.ReadOnlyWidgetBuilder.java

License:LGPL

public Component buildWidget(String elementName, Map<String, String> attributes, VaadinMetawidget metawidget) {

    // Not read-only?

    if (!WidgetBuilderUtils.isReadOnly(attributes)) {
        return null;
    }/*from w  w  w  .j  a v  a2 s  .  c  o m*/

    // Hidden

    if (TRUE.equals(attributes.get(HIDDEN))) {
        return null;
    }

    // Action

    if (ACTION.equals(elementName)) {
        Button button = new Button(metawidget.getLabelString(attributes));
        button.setEnabled(false);

        return button;
    }

    if (TRUE.equals(attributes.get(MASKED))) {
        return new Panel();
    }

    // Lookups

    String lookup = attributes.get(LOOKUP);

    if (lookup != null && !"".equals(lookup)) {
        // May have alternate labels

        String lookupLabels = attributes.get(LOOKUP_LABELS);

        if (lookupLabels != null && !"".equals(lookupLabels)) {
            return new LookupLabel(CollectionUtils.newHashMap(CollectionUtils.fromString(lookup),
                    CollectionUtils.fromString(lookupLabels)));
        }

        return new Label();
    }

    // Lookup the Class

    Class<?> clazz = WidgetBuilderUtils.getActualClassOrType(attributes, String.class);

    if (clazz != null) {
        // Primitives

        if (clazz.isPrimitive()) {
            return new Label();
        }

        if (String.class.equals(clazz)) {
            if (TRUE.equals(attributes.get(LARGE))) {
                TextArea textarea = new TextArea();
                textarea.setReadOnly(true);

                return textarea;
            }

            return new Label();
        }

        if (Character.class.equals(clazz)) {
            return new Label();
        }

        if (Date.class.equals(clazz)) {
            return new Label();
        }

        if (Boolean.class.equals(clazz)) {
            return new Label();
        }

        if (Number.class.isAssignableFrom(clazz)) {
            return new Label();
        }

        // Collections

        if (Collection.class.isAssignableFrom(clazz)) {
            return null;
        }
    }

    // Not simple, but don't expand

    if (TRUE.equals(attributes.get(DONT_EXPAND))) {
        return new Label();
    }

    // Nested Metawidget

    return null;
}

From source file:org.metawidget.vaadin.ui.widgetbuilder.VaadinWidgetBuilder.java

License:LGPL

public Component buildWidget(String elementName, Map<String, String> attributes, VaadinMetawidget metawidget) {

    // Hidden/*  ww  w .j a  va2s  . c  o  m*/

    if (TRUE.equals(attributes.get(HIDDEN))) {
        return new Stub();
    }

    // Action

    if (ACTION.equals(elementName)) {
        return new Button();
    }

    // Lookup the Class

    Class<?> clazz = WidgetBuilderUtils.getActualClassOrType(attributes, String.class);

    // Support mandatory Booleans (can be rendered as a checkbox, even
    // though they have a Lookup)

    if (Boolean.class.equals(clazz) && TRUE.equals(attributes.get(REQUIRED))) {
        return new CheckBox();
    }

    // Lookups

    String lookup = attributes.get(LOOKUP);

    if (lookup != null && !"".equals(lookup)) {
        return createSelectComponent(attributes, lookup, metawidget);
    }

    if (clazz != null) {

        // Primitives

        if (clazz.isPrimitive()) {
            // booleans

            if (boolean.class.equals(clazz)) {
                return new CheckBox();
            }

            // chars

            if (char.class.equals(clazz)) {
                TextField textField = new TextField();
                textField.setMaxLength(1);

                return textField;
            }

            // Ranged

            String minimumValue = attributes.get(MINIMUM_VALUE);
            String maximumValue = attributes.get(MAXIMUM_VALUE);

            if (minimumValue != null && !"".equals(minimumValue) && maximumValue != null
                    && !"".equals(maximumValue)) {
                Slider slider = new Slider();
                slider.setMin(Double.parseDouble(minimumValue));
                try {
                    // Use big 'D' Double for Vaadin 6/7 compatibility
                    slider.setValue(Double.valueOf(slider.getMin()));
                } catch (ValueOutOfBoundsException e) {
                    throw WidgetBuilderException.newException(e);
                }
                slider.setMax(Double.parseDouble(maximumValue));

                return slider;
            }

            // Not-ranged

            return createTextField(attributes);
        }

        // Strings

        if (String.class.equals(clazz)) {
            if (TRUE.equals(attributes.get(MASKED))) {
                return new PasswordField();
            }

            if (TRUE.equals(attributes.get(LARGE))) {
                return new TextArea();
            }

            return createTextField(attributes);
        }

        // Characters

        if (Character.class.isAssignableFrom(clazz)) {
            TextField textField = new TextField();
            textField.setMaxLength(1);

            return textField;
        }

        // Dates

        if (Date.class.equals(clazz)) {
            return new PopupDateField();
        }

        // Numbers
        //
        // Note: we use a text field, not a JSpinner or JSlider, because
        // BeansBinding gets upset at doing 'setValue( null )' if the Integer
        // is null. We can still use JSpinner/JSliders for primitives, though.

        if (Number.class.isAssignableFrom(clazz)) {
            return createTextField(attributes);
        }

        // Collections

        if (Collection.class.isAssignableFrom(clazz)) {
            return new Stub();
        }
    }

    // Not simple, but don't expand

    if (TRUE.equals(attributes.get(DONT_EXPAND))) {
        return createTextField(attributes);
    }

    return null;
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.ErrorMessageWindow.java

License:Apache License

public ErrorMessageWindow(SystemMessages systemMessages) {
    super("Full Log Message"); // Set window caption
    center();//from w ww  .  j a v  a  2  s  . c o m
    setHeight("75%");
    setWidth("75%");

    // Some basic content for the window
    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();

    TextArea ta = new TextArea();
    ta.setWordwrap(true);
    ta.setImmediate(true);
    ta.setWidth("100%");
    ta.setHeight("100%");
    content.addComponent(ta);
    content.setExpandRatio(ta, 1.0f);

    if (systemMessages != null) {
        ta.setValue(systemMessages.getLongMessage());
    } else {
        ta.setValue("Error: systemMessages should not be null");
        LOG.error("Error: systemMessages should not be null");
    }
    ta.setReadOnly(false);

    content.setMargin(true);
    setContent(content);

    // Disable the close button
    setClosable(false);

    // Trivial logic for closing the sub-window
    Button ok = new Button("OK");
    ok.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            close(); // Close the sub-window
        }
    });
    content.addComponent(ok);
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.LicenceDescriptorPanel.java

License:Apache License

@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(true);/* w  ww  .j av a  2 s  .c  o  m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

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

    // licenceTextArea
    licenceTextArea = new TextArea();
    licenceTextArea.setCaption("Licence String");
    licenceTextArea.setImmediate(true);
    licenceTextArea.setWidth("400px");
    licenceTextArea.setHeight("200px");
    mainLayout.addComponent(licenceTextArea);

    // licenceMetadataVerticalLayout
    licenceMetadataVerticalLayout = buildLicenceMetadataVerticalLayout();
    mainLayout.addComponent(licenceMetadataVerticalLayout);

    return mainLayout;
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.ManualManifestEditor.java

License:Apache License

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

    // saveAndExitButton
    saveAndExitButton = new Button();
    saveAndExitButton.setCaption("Save Manifest and Exit");
    saveAndExitButton.setImmediate(true);
    saveAndExitButton.setWidth("-1px");
    saveAndExitButton.setHeight("-1px");
    editManifestControlsVerticalLayout.addComponent(saveAndExitButton);

    // cancelAndExitButton
    cancelAndExitButton = new Button();
    cancelAndExitButton.setCaption("Cancel and Exit");
    cancelAndExitButton.setImmediate(true);
    cancelAndExitButton.setWidth("-1px");
    cancelAndExitButton.setHeight("-1px");
    editManifestControlsVerticalLayout.addComponent(cancelAndExitButton);

    // messageTextArea
    messageTextArea = new TextArea();
    messageTextArea.setImmediate(false);
    messageTextArea.setWidth("-1px");
    messageTextArea.setHeight("-1px");
    editManifestControlsVerticalLayout.addComponent(messageTextArea);

    return editManifestControlsVerticalLayout;
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel.java

License:Apache License

@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);//  w  w  w  . j av  a 2  s . co m
    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;
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.ProductDescriptorPanel.java

License:Apache License

@AutoGenerated
private VerticalLayout buildVerticalLayout_2() {
    // common part: create layout
    verticalLayout_2 = new VerticalLayout();
    verticalLayout_2.setImmediate(false);
    verticalLayout_2.setWidth("100.0%");
    verticalLayout_2.setHeight("100.0%");
    verticalLayout_2.setMargin(false);// ww  w  .ja  v a2 s . c o  m
    verticalLayout_2.setSpacing(true);

    // horizontalLayout_1
    horizontalLayout_1 = buildHorizontalLayout_1();
    verticalLayout_2.addComponent(horizontalLayout_1);

    // systemPluginCheckBox
    systemPluginCheckBox = new CheckBox();
    systemPluginCheckBox.setCaption("System Plugin");
    systemPluginCheckBox.setImmediate(true);
    systemPluginCheckBox.setDescription("System Plugins cannot be removed by the plugin manager");
    systemPluginCheckBox.setWidth("-1px");
    systemPluginCheckBox.setHeight("-1px");
    verticalLayout_2.addComponent(systemPluginCheckBox);

    // productNameTextField
    productNameTextField = new TextField();
    productNameTextField.setCaption("Product Name");
    productNameTextField.setImmediate(true);
    productNameTextField.setWidth("100.0%");
    productNameTextField.setHeight("-1px");
    verticalLayout_2.addComponent(productNameTextField);
    verticalLayout_2.setExpandRatio(productNameTextField, 1.0f);

    // productIdTextField
    productIdTextField = new TextField();
    productIdTextField.setCaption("Product Id");
    productIdTextField.setImmediate(true);
    productIdTextField.setWidth("100.0%");
    productIdTextField.setHeight("-1px");
    verticalLayout_2.addComponent(productIdTextField);
    verticalLayout_2.setExpandRatio(productIdTextField, 1.0f);

    // featureRepositoryTextField
    featureRepositoryTextField = new TextField();
    featureRepositoryTextField.setCaption("Feature Repository URL");
    featureRepositoryTextField.setImmediate(true);
    featureRepositoryTextField.setWidth("100.0%");
    featureRepositoryTextField.setHeight("-1px");
    verticalLayout_2.addComponent(featureRepositoryTextField);
    verticalLayout_2.setExpandRatio(featureRepositoryTextField, 1.0f);

    // packageingDescriptorTextField
    packageingDescriptorTextField = new TextField();
    packageingDescriptorTextField.setCaption("Packaging Descriptor");
    packageingDescriptorTextField.setImmediate(true);
    packageingDescriptorTextField
            .setDescription("Provides a locator for the Karaf kar or rpm which delivered this feature");
    packageingDescriptorTextField.setWidth("100.0%");
    packageingDescriptorTextField.setHeight("-1px");
    verticalLayout_2.addComponent(packageingDescriptorTextField);
    verticalLayout_2.setExpandRatio(packageingDescriptorTextField, 1.0f);

    // productDescriptionTextArea
    productDescriptionTextArea = new TextArea();
    productDescriptionTextArea.setCaption("Product Description");
    productDescriptionTextArea.setImmediate(true);
    productDescriptionTextArea.setWidth("100.0%");
    productDescriptionTextArea.setHeight("6.0em");
    verticalLayout_2.addComponent(productDescriptionTextArea);
    verticalLayout_2.setExpandRatio(productDescriptionTextArea, 1.0f);

    // productUrlTextField
    productUrlTextField = new TextField();
    productUrlTextField.setCaption("Product URL");
    productUrlTextField.setImmediate(true);
    productUrlTextField.setWidth("100.0%");
    productUrlTextField.setHeight("-1px");
    verticalLayout_2.addComponent(productUrlTextField);
    verticalLayout_2.setExpandRatio(productUrlTextField, 1.0f);

    // licenceTypeTextField
    licenceTypeTextField = new TextField();
    licenceTypeTextField.setCaption("Licence Type");
    licenceTypeTextField.setImmediate(true);
    licenceTypeTextField.setWidth("100.0%");
    licenceTypeTextField.setHeight("-1px");
    licenceTypeTextField.setNullSettingAllowed(true);
    verticalLayout_2.addComponent(licenceTypeTextField);
    verticalLayout_2.setExpandRatio(licenceTypeTextField, 1.0f);

    // organizationTextField
    organizationTextField = new TextField();
    organizationTextField.setCaption("Organization");
    organizationTextField.setImmediate(true);
    organizationTextField.setWidth("100.0%");
    organizationTextField.setHeight("-1px");
    organizationTextField.setNullSettingAllowed(true);
    verticalLayout_2.addComponent(organizationTextField);
    verticalLayout_2.setExpandRatio(organizationTextField, 1.0f);

    return verticalLayout_2;
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.SimpleInstanceListEditor.java

License:Apache License

@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(true);// w  ww . j av  a  2  s .  c om
    verticalLayout_3.setSpacing(true);

    // instructionLabel
    instructionLabel = new Label();
    instructionLabel.setImmediate(false);
    instructionLabel.setWidth("100.0%");
    instructionLabel.setHeight("-1px");
    instructionLabel.setValue("Label");
    verticalLayout_3.addComponent(instructionLabel);

    // karafInstanceSelectedTextField
    karafInstanceSelectedTextField = new TextField();
    karafInstanceSelectedTextField.setCaption("Instance Name");
    karafInstanceSelectedTextField.setImmediate(false);
    karafInstanceSelectedTextField.setWidth("100.0%");
    karafInstanceSelectedTextField.setHeight("-1px");
    verticalLayout_3.addComponent(karafInstanceSelectedTextField);

    // currentKarafUrlTextField
    currentKarafUrlTextField = new TextField();
    currentKarafUrlTextField.setCaption("Instance Url");
    currentKarafUrlTextField.setImmediate(false);
    currentKarafUrlTextField.setWidth("100.0%");
    currentKarafUrlTextField.setHeight("-1px");
    verticalLayout_3.addComponent(currentKarafUrlTextField);

    // instanceUsernameTextField
    instanceUsernameTextField = new TextField();
    instanceUsernameTextField.setCaption("Instance User Name");
    instanceUsernameTextField.setImmediate(false);
    instanceUsernameTextField.setWidth("100.0%");
    instanceUsernameTextField.setHeight("-1px");
    verticalLayout_3.addComponent(instanceUsernameTextField);

    // instancePasswordTextField
    instancePasswordTextField = new TextField();
    instancePasswordTextField.setCaption("Instance Password");
    instancePasswordTextField.setImmediate(false);
    instancePasswordTextField.setWidth("100.0%");
    instancePasswordTextField.setHeight("-1px");
    verticalLayout_3.addComponent(instancePasswordTextField);

    // 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");
    verticalLayout_3.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");
    verticalLayout_3.addComponent(allowUpdateMessagesCheckBox);

    // saveKarafInstanceManifestButton
    saveKarafInstanceManifestButton = new Button();
    saveKarafInstanceManifestButton.setCaption("Update / Save Karaf Instance");
    saveKarafInstanceManifestButton.setImmediate(true);
    saveKarafInstanceManifestButton.setWidth("-1px");
    saveKarafInstanceManifestButton.setHeight("-1px");
    verticalLayout_3.addComponent(saveKarafInstanceManifestButton);

    // messageTextArea
    messageTextArea = new TextArea();
    messageTextArea.setImmediate(true);
    messageTextArea.setWidth("-1px");
    messageTextArea.setHeight("-1px");
    verticalLayout_3.addComponent(messageTextArea);

    return verticalLayout_3;
}

From source file:org.opennms.features.topology.app.internal.TopologyUI.java

License:Open Source License

@Override
public void menuBarUpdated(CommandManager commandManager) {
    if (m_menuBar != null) {
        m_rootLayout.removeComponent(m_menuBar);
    }/* w ww . j  av a 2  s .  co  m*/

    if (m_contextMenu != null) {
        m_contextMenu.detach();
    }

    m_menuBar = commandManager.getMenuBar(m_graphContainer, this);
    m_menuBar.setWidth(100, Unit.PERCENTAGE);
    // Set expand ratio so that extra space is not allocated to this vertical component
    if (m_showHeader) {
        m_rootLayout.addComponent(m_menuBar, 1);
    } else {
        m_rootLayout.addComponent(m_menuBar, 0);
    }

    m_contextMenu = commandManager
            .getContextMenu(new DefaultOperationContext(this, m_graphContainer, DisplayLocation.CONTEXTMENU));
    m_contextMenu.setAsContextMenuOf(this);

    // Add Menu Item to share the View with others
    m_menuBar.addItem("Share", FontAwesome.SHARE, new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            // create the share link
            String fragment = getPage().getLocation().getFragment();
            String url = getPage().getLocation().toString().replace("#" + getPage().getLocation().getFragment(),
                    "");
            String shareLink = String.format("%s?%s=%s", url,
                    TopologyUIRequestHandler.PARAMETER_HISTORY_FRAGMENT, fragment);

            // Create the Window
            Window shareWindow = new Window();
            shareWindow.setCaption("Share Link");
            shareWindow.setModal(true);
            shareWindow.setClosable(true);
            shareWindow.setResizable(false);
            shareWindow.setWidth(400, Unit.PIXELS);

            TextArea shareLinkField = new TextArea();
            shareLinkField.setValue(shareLink);
            shareLinkField.setReadOnly(true);
            shareLinkField.setRows(3);
            shareLinkField.setWidth(100, Unit.PERCENTAGE);

            // Close Button
            Button close = new Button("Close");
            close.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
            close.addClickListener(event -> shareWindow.close());

            // Layout for Buttons
            HorizontalLayout buttonLayout = new HorizontalLayout();
            buttonLayout.setMargin(true);
            buttonLayout.setSpacing(true);
            buttonLayout.setWidth("100%");
            buttonLayout.addComponent(close);
            buttonLayout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);

            // Content Layout
            VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.setMargin(true);
            verticalLayout.setSpacing(true);
            verticalLayout.addComponent(
                    new Label("Please use the following link to share the current view with others."));
            verticalLayout.addComponent(shareLinkField);
            verticalLayout.addComponent(buttonLayout);

            shareWindow.setContent(verticalLayout);

            getUI().addWindow(shareWindow);
        }
    });

    updateMenuItems();
}

From source file:org.opennms.features.topology.app.internal.ui.ToolbarPanel.java

License:Open Source License

public ToolbarPanel(final ToolbarPanelController controller) {
    addStyleName(Styles.TOOLBAR);/*  w  w w  .  j  a va2 s  . c o  m*/
    this.layoutManager = controller.getLayoutManager();

    final Property<Double> scale = controller.getScaleProperty();
    final Boolean[] eyeClosed = new Boolean[] { false };
    final Button showFocusVerticesBtn = new Button();
    showFocusVerticesBtn.setIcon(FontAwesome.EYE);
    showFocusVerticesBtn.setDescription("Toggle Highlight Focus Nodes");
    showFocusVerticesBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (eyeClosed[0]) {
                showFocusVerticesBtn.setIcon(FontAwesome.EYE);
            } else {
                showFocusVerticesBtn.setIcon(FontAwesome.EYE_SLASH);
            }
            eyeClosed[0] = !eyeClosed[0]; // toggle
            controller.toggleHighlightFocus();
        }
    });

    final Button magnifyBtn = new Button();
    magnifyBtn.setIcon(FontAwesome.PLUS);
    magnifyBtn.setDescription("Magnify");
    magnifyBtn.addClickListener(
            (Button.ClickListener) event -> scale.setValue(Math.min(1, scale.getValue() + 0.25)));

    final Button demagnifyBtn = new Button();
    demagnifyBtn.setIcon(FontAwesome.MINUS);
    demagnifyBtn.setDescription("Demagnify");
    demagnifyBtn.addClickListener(
            (Button.ClickListener) event -> scale.setValue(Math.max(0, scale.getValue() - 0.25)));

    m_szlOutBtn = new Button();
    m_szlOutBtn.setId("szlOutBtn");
    m_szlOutBtn.setIcon(FontAwesome.ANGLE_DOWN);
    m_szlOutBtn.setDescription("Decrease Semantic Zoom Level");
    m_szlOutBtn.setEnabled(controller.getSemanticZoomLevel() > 0);
    m_szlOutBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            int szl = controller.getSemanticZoomLevel();
            if (szl > 0) {
                setSemanticZoomLevel(controller, szl - 1);
                controller.saveHistory();
            }
        }
    });

    final Button szlInBtn = new Button();
    szlInBtn.setId("szlInBtn");
    szlInBtn.setIcon(FontAwesome.ANGLE_UP);
    szlInBtn.setDescription("Increase Semantic Zoom Level");
    szlInBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            setSemanticZoomLevel(controller, controller.getSemanticZoomLevel() + 1);
            controller.saveHistory();
        }
    });

    m_zoomLevelLabel.setId("szlInputLabel");

    m_panBtn = new Button();
    m_panBtn.setIcon(FontAwesome.ARROWS);
    m_panBtn.setDescription("Pan Tool");
    m_panBtn.addStyleName(Styles.SELECTED);

    m_selectBtn = new Button();
    m_selectBtn.setIcon(IonicIcons.ANDROID_EXPAND);
    m_selectBtn.setDescription("Selection Tool");
    m_selectBtn.setStyleName("toolbar-button");
    m_selectBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            m_selectBtn.addStyleName(Styles.SELECTED);
            m_panBtn.removeStyleName(Styles.SELECTED);
            controller.setActiveTool(ActiveTool.select);
        }
    });

    m_panBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            m_panBtn.addStyleName(Styles.SELECTED);
            m_selectBtn.removeStyleName(Styles.SELECTED);
            controller.setActiveTool(ActiveTool.pan);
        }
    });

    Button showAllMapBtn = new Button();
    showAllMapBtn.setId("showEntireMapBtn");
    showAllMapBtn.setIcon(FontAwesome.GLOBE);
    showAllMapBtn.setDescription("Show Entire Map");
    showAllMapBtn.addClickListener((Button.ClickListener) event -> controller.showAllMap());

    Button centerSelectionBtn = new Button();
    centerSelectionBtn.setIcon(FontAwesome.LOCATION_ARROW);
    centerSelectionBtn.setDescription("Center On Selection");
    centerSelectionBtn.addClickListener((Button.ClickListener) event -> controller.centerMapOnSelection());

    Button shareButton = new Button("", FontAwesome.SHARE_SQUARE_O);
    shareButton.setDescription("Share");
    shareButton.addClickListener((x) -> {
        // Create the share link
        String fragment = getUI().getPage().getLocation().getFragment();
        String url = getUI().getPage().getLocation().toString().replace("#" + fragment, "");
        String shareLink = String.format("%s?%s=%s", url, PARAMETER_HISTORY_FRAGMENT, fragment);

        // Create the Window
        Window shareWindow = new Window();
        shareWindow.setCaption("Share Link");
        shareWindow.setModal(true);
        shareWindow.setClosable(true);
        shareWindow.setResizable(false);
        shareWindow.setWidth(400, Sizeable.Unit.PIXELS);

        TextArea shareLinkField = new TextArea();
        shareLinkField.setValue(shareLink);
        shareLinkField.setReadOnly(true);
        shareLinkField.setRows(3);
        shareLinkField.setWidth(100, Sizeable.Unit.PERCENTAGE);

        // Close Button
        Button close = new Button("Close");
        close.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
        close.addClickListener(event -> shareWindow.close());

        // Layout for Buttons
        HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.setMargin(true);
        buttonLayout.setSpacing(true);
        buttonLayout.setWidth("100%");
        buttonLayout.addComponent(close);
        buttonLayout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);

        // Content Layout
        VerticalLayout verticalLayout = new VerticalLayout();
        verticalLayout.setMargin(true);
        verticalLayout.setSpacing(true);
        verticalLayout.addComponent(
                new Label("Please use the following link to share the current view with others."));
        verticalLayout.addComponent(shareLinkField);
        verticalLayout.addComponent(buttonLayout);

        shareWindow.setContent(verticalLayout);

        getUI().addWindow(shareWindow);
    });

    // Refresh Button
    Button refreshButton = new Button();
    refreshButton.setId("refreshNow");
    refreshButton.setIcon(FontAwesome.REFRESH);
    refreshButton.setDescription("Refresh Now");
    refreshButton.addClickListener((event) -> controller.refreshUI());

    // Layer Layout
    layerLayout = new VerticalLayout();
    layerLayout.setId("layerComponent");
    layerLayout.setSpacing(true);
    layerLayout.setMargin(true);

    // Layer Button
    layerButton = new Button();
    layerButton.setId("layerToggleButton");
    layerButton.setIcon(FontAwesome.BARS);
    layerButton.setDescription("Layers");
    layerButton.addClickListener((event) -> {
        boolean isCollapsed = layerButton.getStyleName().contains(Styles.EXPANDED);
        setLayerLayoutVisible(!isCollapsed);
    });

    // Save button
    layerSaveButton = new Button();
    layerSaveButton.setId("saveLayerButton");
    layerSaveButton.setIcon(FontAwesome.FLOPPY_O);
    layerSaveButton.addClickListener((event) -> controller.saveLayout());

    // Actual Layout for the Toolbar
    CssLayout contentLayout = new CssLayout();
    contentLayout.addStyleName("toolbar-component");
    contentLayout.addComponent(createGroup(szlInBtn, m_zoomLevelLabel, m_szlOutBtn));
    contentLayout.addComponent(
            createGroup(refreshButton, centerSelectionBtn, showAllMapBtn, layerButton, showFocusVerticesBtn));
    contentLayout.addComponent(createGroup(m_panBtn, m_selectBtn));
    contentLayout.addComponent(createGroup(magnifyBtn, demagnifyBtn));
    contentLayout.addComponent(createGroup(shareButton));
    contentLayout.addComponent(createGroup(layerSaveButton));

    // Toolbar
    addComponent(contentLayout);
}