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.ikasan.dashboard.ui.administration.window.NewPolicyWindow.java

License:BSD License

public void init() {
    this.setModal(true);
    this.setResizable(false);

    this.setWidth("600px");
    this.setHeight("400px");

    GridLayout gridLayout = new GridLayout(2, 8);
    gridLayout.setWidth("100%");
    gridLayout.setMargin(true);//from   w ww . j  ava  2s  . co  m
    gridLayout.setSpacing(true);

    gridLayout.setColumnExpandRatio(0, .1f);
    gridLayout.setColumnExpandRatio(1, .9f);

    Label createNewPolicyLabel = new Label("Create a New Policy");
    createNewPolicyLabel.setStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(createNewPolicyLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    this.policyName = new TextField();
    this.policyName.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.policyName.setWidth("80%");

    gridLayout.addComponent(nameLabel, 0, 1);
    gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(policyName, 1, 1);

    Label descriptionLabel = new Label("Description");
    descriptionLabel.setSizeUndefined();
    this.policyDescription = new TextArea();
    this.policyDescription
            .addValidator(new StringLengthValidator("A description must be entered.", 1, null, false));
    this.policyDescription.setRows(4);
    this.policyDescription.setWidth("80%");

    this.policyName.setValidationVisible(false);
    this.policyDescription.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 2);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(policyDescription, 1, 2);

    Button createButton = new Button("Create");
    Button cancelButton = new Button("Cancel");

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    BeanItem<Policy> policyItem = new BeanItem<Policy>(this.policy);

    this.policyName.setPropertyDataSource(policyItem.getItemProperty("name"));
    this.policyDescription.setPropertyDataSource(policyItem.getItemProperty("description"));

    Label linkTypeLabel = new Label("Policy Link Type");
    linkTypeLabel.setSizeUndefined();
    gridLayout.addComponent(linkTypeLabel, 0, 3);
    gridLayout.setComponentAlignment(linkTypeLabel, Alignment.TOP_RIGHT);
    this.linkTypeCombo.setWidth("80%");
    gridLayout.addComponent(this.linkTypeCombo, 1, 3);

    List<PolicyLinkType> policyLinkTypes = this.securityService.getAllPolicyLinkTypes();

    this.linkTypeCombo.removeAllItems();

    for (PolicyLinkType policyLinkType : policyLinkTypes) {
        this.linkTypeCombo.addItem(policyLinkType);
        this.linkTypeCombo.setItemCaption(policyLinkType, policyLinkType.getName());
    }

    policyLinkHintLabel.setCaptionAsHtml(true);
    policyLinkHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " You are linking this policy to an entity. Click link below to search for the entity to link to.");
    policyLinkHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    policyLinkHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    policyLinkHintLabel.setVisible(false);
    gridLayout.addComponent(policyLinkHintLabel, 0, 4, 1, 4);

    linkButton.setStyleName(ValoTheme.BUTTON_LINK);
    linkButton.setVisible(false);
    linkButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            PolicyLinkType policyLinkType = (PolicyLinkType) NewPolicyWindow.this.linkTypeCombo.getValue();

            if (policyLinkType.getName().equals(PolicyLinkTypeConstants.MAPPING_CONFIGURATION_LINK_TYPE)) {
                NewPolicyWindow.this.policyAssociationMappingSearchWindow.clear();
                UI.getCurrent().addWindow(NewPolicyWindow.this.policyAssociationMappingSearchWindow);
            } else if (policyLinkType.getName().equals(PolicyLinkTypeConstants.MODULE_LINK_TYPE)) {
                NewPolicyWindow.this.policyAssociationModuleSearchWindow.clear();
                UI.getCurrent().addWindow(NewPolicyWindow.this.policyAssociationModuleSearchWindow);
            } else if (policyLinkType.getName().equals(PolicyLinkTypeConstants.FLOW_LINK_TYPE)) {
                NewPolicyWindow.this.policyAssociationFlowSearchWindow.clear();
                UI.getCurrent().addWindow(NewPolicyWindow.this.policyAssociationFlowSearchWindow);
            } else if (policyLinkType.getName().equals(PolicyLinkTypeConstants.BUSINESS_STREAM_LINK_TYPE)) {
                NewPolicyWindow.this.policyAssociationBusinessStreamSearchWindow.clear();
                UI.getCurrent().addWindow(NewPolicyWindow.this.policyAssociationBusinessStreamSearchWindow);
            }
        }
    });
    gridLayout.addComponent(this.linkButton, 1, 5);

    final Label linkedEntityLabel = new Label("Linked to");
    linkedEntityLabel.setSizeUndefined();

    this.linkedEntity = new TextArea();
    this.linkedEntity.addValidator(new StringLengthValidator(
            "If a Policy Link Type is selected, you must link to an approptiate entity.", 1, null, false));
    this.linkedEntity.setWidth("80%");
    this.linkedEntity.setValidationVisible(false);
    this.linkedEntity.setHeight("60px");

    gridLayout.addComponent(linkedEntityLabel, 0, 6);
    gridLayout.setComponentAlignment(linkedEntityLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(linkedEntity, 1, 6);
    linkedEntityLabel.setVisible(false);
    linkedEntity.setVisible(false);

    this.policyAssociationMappingSearchWindow.addCloseListener(new Window.CloseListener() {
        // inline close-listener
        public void windowClose(CloseEvent e) {
            if (policyAssociationMappingSearchWindow.getMappingConfiguration() != null) {
                NewPolicyWindow.this.linkedEntity.setValue(
                        policyAssociationMappingSearchWindow.getMappingConfiguration().toStringLite());
                NewPolicyWindow.this.associatedEntityId = NewPolicyWindow.this.policyAssociationMappingSearchWindow
                        .getMappingConfiguration().getId();
            }
        }
    });

    this.policyAssociationFlowSearchWindow.addCloseListener(new Window.CloseListener() {
        // inline close-listener
        public void windowClose(CloseEvent e) {
            if (policyAssociationFlowSearchWindow.getFlow() != null) {
                NewPolicyWindow.this.linkedEntity
                        .setValue(policyAssociationFlowSearchWindow.getFlow().toString());
                NewPolicyWindow.this.associatedEntityId = NewPolicyWindow.this.policyAssociationFlowSearchWindow
                        .getFlow().getId();
            }
        }
    });

    this.policyAssociationModuleSearchWindow.addCloseListener(new Window.CloseListener() {
        // inline close-listener
        public void windowClose(CloseEvent e) {
            if (policyAssociationModuleSearchWindow.getModule() != null) {
                NewPolicyWindow.this.linkedEntity
                        .setValue(policyAssociationModuleSearchWindow.getModule().toString());
                NewPolicyWindow.this.associatedEntityId = NewPolicyWindow.this.policyAssociationModuleSearchWindow
                        .getModule().getId();
            }
        }
    });

    this.policyAssociationBusinessStreamSearchWindow.addCloseListener(new Window.CloseListener() {
        // inline close-listener
        public void windowClose(CloseEvent e) {
            if (policyAssociationBusinessStreamSearchWindow.getBusinessStream() != null) {
                NewPolicyWindow.this.linkedEntity
                        .setValue(policyAssociationBusinessStreamSearchWindow.getBusinessStream().toString());
                NewPolicyWindow.this.associatedEntityId = NewPolicyWindow.this.policyAssociationBusinessStreamSearchWindow
                        .getBusinessStream().getId();
            }
        }

    });

    this.linkTypeCombo.addValueChangeListener(new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            final PolicyLinkType policyLinkType = (PolicyLinkType) event.getProperty().getValue();

            if (policyLinkType != null) {
                linkButton.setVisible(true);
                linkedEntityLabel.setVisible(true);
                linkedEntity.setVisible(true);
                policyLinkHintLabel.setVisible(true);
            } else {
                linkButton.setVisible(false);
                linkedEntityLabel.setVisible(false);
                linkedEntity.setVisible(false);
                policyLinkHintLabel.setVisible(false);
            }
        }
    });

    gridLayout.addComponent(buttonLayout, 0, 7, 1, 7);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    createButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                NewPolicyWindow.this.policyName.validate();
                NewPolicyWindow.this.policyDescription.validate();

                if (linkTypeCombo.getValue() != null) {
                    NewPolicyWindow.this.linkedEntity.validate();
                }
            } catch (InvalidValueException e) {
                NewPolicyWindow.this.policyName.setValidationVisible(true);
                NewPolicyWindow.this.policyDescription.setValidationVisible(true);
                NewPolicyWindow.this.linkedEntity.setValidationVisible(true);

                return;
            }

            NewPolicyWindow.this.policyName.setValidationVisible(false);
            NewPolicyWindow.this.policyDescription.setValidationVisible(false);
            NewPolicyWindow.this.linkedEntity.setValidationVisible(false);

            if (linkTypeCombo.getValue() != null) {
                PolicyLinkType policyLinkType = (PolicyLinkType) linkTypeCombo.getValue();
                String linkedEntityName = linkedEntity.getValue();
                PolicyLink policyLink = new PolicyLink(policyLinkType, associatedEntityId, linkedEntityName);

                securityService.savePolicyLink(policyLink);

                policy.setPolicyLink(policyLink);

                try {
                    securityService.savePolicy(policy);
                } catch (DataIntegrityViolationException e) {
                    Notification.show(
                            "Policy name must be unique. Please confirm that this policy does not already exist!",
                            Notification.Type.ERROR_MESSAGE);

                    return;
                } catch (RuntimeException e) {
                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new PrintWriter(sw);
                    e.printStackTrace(pw);

                    Notification.show("Caught exception trying to save a Policy!", sw.toString(),
                            Notification.Type.ERROR_MESSAGE);

                    return;
                }
            } else {
                PolicyLink policyLink = policy.getPolicyLink();
                policy.setPolicyLink(null);

                try {
                    securityService.savePolicy(policy);
                } catch (DataIntegrityViolationException e) {
                    Notification.show(
                            "Policy name must be unique. Please confirm that this policy does not already exist!",
                            Notification.Type.ERROR_MESSAGE);

                    return;
                } catch (RuntimeException e) {
                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new PrintWriter(sw);
                    e.printStackTrace(pw);

                    Notification.show("Caught exception trying to save a Policy!", sw.toString(),
                            Notification.Type.ERROR_MESSAGE);

                    return;
                }

                if (policyLink != null) {
                    securityService.deletePolicyLink(policyLink);
                }
            }

            Notification.show("New policy successfully created!");

            UI.getCurrent().removeWindow(NewPolicyWindow.this);
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(NewPolicyWindow.this);
        }
    });

    this.setContent(gridLayout);
}

From source file:org.ikasan.dashboard.ui.administration.window.NewRoleWindow.java

License:BSD License

public void init() {
    this.setWidth("550px");
    this.setHeight("240px");
    this.setModal(true);
    this.setResizable(false);

    GridLayout gridLayout = new GridLayout(2, 4);
    gridLayout.setWidth("100%");
    gridLayout.setMargin(true);//from  www  . ja v  a2  s  .  c o m
    gridLayout.setSpacing(true);

    gridLayout.setColumnExpandRatio(0, .1f);
    gridLayout.setColumnExpandRatio(1, .9f);

    Label createNewRoleLabel = new Label("Create a New Role");
    createNewRoleLabel.setStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(createNewRoleLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    this.roleName = new TextField();
    this.roleName.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.roleName.setWidth("80%");

    gridLayout.addComponent(nameLabel, 0, 1);
    gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(roleName, 1, 1);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.roleDescription = new TextArea();
    this.roleDescription
            .addValidator(new StringLengthValidator("A description must be entered.", 1, null, false));
    this.roleDescription.setRows(4);
    roleDescription.setWidth("80%");

    this.roleName.setValidationVisible(false);
    this.roleDescription.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 2);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(roleDescription, 1, 2);

    Button createButton = new Button("Save");
    Button cancelButton = new Button("Cancel");

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    gridLayout.addComponent(buttonLayout, 0, 3, 1, 3);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    BeanItem<Role> policyItem = new BeanItem<Role>(this.role);

    roleName.setPropertyDataSource(policyItem.getItemProperty("name"));
    roleDescription.setPropertyDataSource(policyItem.getItemProperty("description"));

    createButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                NewRoleWindow.this.roleName.validate();
                NewRoleWindow.this.roleDescription.validate();
            } catch (InvalidValueException e) {
                NewRoleWindow.this.roleName.setValidationVisible(true);
                NewRoleWindow.this.roleDescription.setValidationVisible(true);

                return;
            }

            NewRoleWindow.this.roleName.setValidationVisible(false);
            NewRoleWindow.this.roleDescription.setValidationVisible(false);

            UI.getCurrent().removeWindow(NewRoleWindow.this);

            securityService.saveRole(role);

            Notification.show("Role successfully created!");
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(NewRoleWindow.this);
        }
    });

    this.setContent(gridLayout);
}

From source file:org.ikasan.dashboard.ui.mappingconfiguration.panel.MappingConfigurationPanel.java

License:BSD License

/**
 * Helper method to create the form associated with the mapping
 * configuration.//from   w  ww  .  j  a v  a 2s . c o  m
 * 
 * @return the Layout of the form
 */
protected GridLayout createMappingConfigurationForm() {
    Label mappingConfigurationLabel = new Label(this.name);
    mappingConfigurationLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(mappingConfigurationLabel, 0, 0, 1, 0);

    HorizontalLayout clientLabelLayout = new HorizontalLayout();
    clientLabelLayout.setHeight(25, Unit.PIXELS);
    clientLabelLayout.setWidth(100, Unit.PIXELS);

    Label clientLabel = new Label("Client:");
    clientLabel.setSizeUndefined();
    clientLabelLayout.addComponent(clientLabel);
    clientLabelLayout.setComponentAlignment(clientLabel, Alignment.MIDDLE_RIGHT);

    layout.addComponent(clientLabelLayout, 0, 1);
    layout.setComponentAlignment(clientLabelLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout clientComboBoxLayout = new HorizontalLayout();
    clientComboBoxLayout.setHeight(25, Unit.PIXELS);
    clientComboBoxLayout.setWidth(350, Unit.PIXELS);
    this.clientComboBox.setWidth(300, Unit.PIXELS);
    this.clientComboBox.removeAllValidators();
    this.clientComboBox.addValidator(new NullValidator("A client must be selected!", false));
    this.clientComboBox.setValidationVisible(false);
    clientComboBoxLayout.addComponent(this.clientComboBox);
    layout.addComponent(clientComboBoxLayout, 1, 1);

    HorizontalLayout typeLabelLayout = new HorizontalLayout();
    typeLabelLayout.setHeight(25, Unit.PIXELS);
    typeLabelLayout.setWidth(100, Unit.PIXELS);

    Label typeLabel = new Label("Type:");
    typeLabel.setSizeUndefined();
    typeLabelLayout.addComponent(typeLabel);
    typeLabelLayout.setComponentAlignment(typeLabel, Alignment.MIDDLE_RIGHT);

    layout.addComponent(typeLabelLayout, 0, 2);
    layout.setComponentAlignment(typeLabelLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout typeComboBoxLayout = new HorizontalLayout();
    typeComboBoxLayout.setHeight(25, Unit.PIXELS);
    typeComboBoxLayout.setWidth(350, Unit.PIXELS);
    this.typeComboBox.setWidth(300, Unit.PIXELS);
    this.typeComboBox.removeAllValidators();
    this.typeComboBox.addValidator(new NullValidator("A type must be selected!", false));
    this.typeComboBox.setValidationVisible(false);
    typeComboBoxLayout.addComponent(this.typeComboBox);
    layout.addComponent(typeComboBoxLayout, 1, 2);

    HorizontalLayout sourceContextLabelLayout = new HorizontalLayout();
    sourceContextLabelLayout.setHeight(25, Unit.PIXELS);
    sourceContextLabelLayout.setWidth(100, Unit.PIXELS);

    Label sourceContextLabel = new Label("Source Context:");
    sourceContextLabel.setSizeUndefined();
    sourceContextLabelLayout.addComponent(sourceContextLabel);
    sourceContextLabelLayout.setComponentAlignment(sourceContextLabel, Alignment.MIDDLE_RIGHT);

    layout.addComponent(sourceContextLabelLayout, 0, 3);
    layout.setComponentAlignment(sourceContextLabelLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout sourceContextComboBoxLayout = new HorizontalLayout();
    sourceContextComboBoxLayout.setHeight(25, Unit.PIXELS);
    sourceContextComboBoxLayout.setWidth(350, Unit.PIXELS);
    this.sourceContextComboBox.setWidth(300, Unit.PIXELS);
    this.sourceContextComboBox.removeAllValidators();
    this.sourceContextComboBox.addValidator(new NullValidator("A source context must be selected", false));
    this.sourceContextComboBox.setValidationVisible(false);
    sourceContextComboBoxLayout.addComponent(this.sourceContextComboBox);
    layout.addComponent(sourceContextComboBoxLayout, 1, 3);

    HorizontalLayout targetContextLabelLayout = new HorizontalLayout();
    targetContextLabelLayout.setHeight(25, Unit.PIXELS);
    targetContextLabelLayout.setWidth(100, Unit.PIXELS);

    Label targetContextLabel = new Label("Target Context:");
    targetContextLabel.setSizeUndefined();
    targetContextLabelLayout.addComponent(targetContextLabel);
    targetContextLabelLayout.setComponentAlignment(targetContextLabel, Alignment.MIDDLE_RIGHT);

    layout.addComponent(targetContextLabelLayout, 0, 4);
    layout.setComponentAlignment(targetContextLabelLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout targetContextComboBoxLayout = new HorizontalLayout();
    targetContextComboBoxLayout.setHeight(25, Unit.PIXELS);
    targetContextComboBoxLayout.setWidth(350, Unit.PIXELS);
    this.targetContextComboBox.setWidth(300, Unit.PIXELS);
    this.targetContextComboBox.removeAllValidators();
    this.targetContextComboBox.addValidator(new NullValidator("A target context must be selected", false));
    this.targetContextComboBox.setValidationVisible(false);
    targetContextComboBoxLayout.addComponent(this.targetContextComboBox);
    layout.addComponent(this.targetContextComboBox, 1, 4);

    HorizontalLayout descriptionLabelLayout = new HorizontalLayout();
    descriptionLabelLayout.setHeight(25, Unit.PIXELS);
    descriptionLabelLayout.setWidth(100, Unit.PIXELS);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    descriptionLabelLayout.addComponent(descriptionLabel);
    descriptionLabelLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);

    layout.addComponent(descriptionLabelLayout, 0, 5);
    layout.setComponentAlignment(descriptionLabelLayout, Alignment.TOP_RIGHT);

    HorizontalLayout descriptionTextAreaLayout = new HorizontalLayout();
    descriptionTextAreaLayout.setHeight(75, Unit.PIXELS);
    descriptionTextAreaLayout.setWidth(350, Unit.PIXELS);
    this.descriptionTextArea = new TextArea();
    this.descriptionTextArea.setWidth(300, Unit.PIXELS);
    this.descriptionTextArea.setRows(4);
    this.descriptionTextArea
            .addValidator(new StringLengthValidator("A description must be entered.", 1, null, true));
    this.descriptionTextArea.setValidationVisible(false);
    descriptionTextAreaLayout.addComponent(this.descriptionTextArea);
    layout.addComponent(descriptionTextAreaLayout, 1, 5);

    Label numParamsLabel = new Label("Number of source parameters:");
    numParamsLabel.setWidth(175, Unit.PIXELS);

    layout.addComponent(numParamsLabel, 2, 1);
    this.numberOfParametersTextField = new TextField();
    this.numberOfParametersTextField.setWidth(75, Unit.PIXELS);
    this.numberOfParametersTextField.removeAllValidators();
    this.numberOfParametersTextField.addValidator(
            new LongValidator("Number of source parameters " + "and key location queries must be defined."));
    this.numberOfParametersTextField.setValidationVisible(false);
    layout.addComponent(this.numberOfParametersTextField, 3, 1);

    HorizontalLayout queriesLabelLayout = new HorizontalLayout();
    queriesLabelLayout.setHeight(25, Unit.PIXELS);
    queriesLabelLayout.setWidth(250, Unit.PIXELS);

    return layout;
}

From source file:org.ikasan.dashboard.ui.topology.component.BusinessStreamTab.java

License:BSD License

public Layout createBusinessStreamLayout() {
    this.businessStreamTable = new Table();
    this.businessStreamTable.addContainerProperty("Server Name", String.class, null);
    this.businessStreamTable.addContainerProperty("Module Name", String.class, null);
    this.businessStreamTable.addContainerProperty("Flow Name", String.class, null);
    this.businessStreamTable.addContainerProperty("", Button.class, null);
    this.businessStreamTable.setWidth("100%");
    this.businessStreamTable.setHeight(600, Unit.PIXELS);
    this.businessStreamTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    this.businessStreamTable.setDragMode(TableDragMode.ROW);
    this.businessStreamTable.setDropHandler(new DropHandler() {
        @Override/*from ww  w .  j  av  a2 s  .c  o m*/
        public void drop(final DragAndDropEvent dropEvent) {
            final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
                    .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

            if (authentication != null
                    && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication
                            .hasGrantedAuthority(SecurityConstants.MODIFY_BUSINESS_STREAM_AUTHORITY))) {
                Notification.show("You do not have the privilege to modify a business stream.");
                return;
            }

            final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable();

            if (t.getItemId() instanceof Flow) {
                final Flow flow = (Flow) t.getItemId();

                final BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue();
                BusinessStreamFlowKey key = new BusinessStreamFlowKey();
                key.setBusinessStreamId(businessStream.getId());
                key.setFlowId(flow.getId());
                final BusinessStreamFlow businessStreamFlow = new BusinessStreamFlow(key);
                businessStreamFlow.setFlow(flow);
                businessStreamFlow.setOrder(businessStreamTable.getItemIds().size());

                if (!businessStream.getFlows().contains(businessStreamFlow)) {
                    businessStream.getFlows().add(businessStreamFlow);

                    topologyService.saveBusinessStream(businessStream);

                    Button deleteButton = new Button();
                    Resource deleteIcon = VaadinIcons.TRASH;
                    deleteButton.setIcon(deleteIcon);
                    deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
                    deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                    deleteButton.setDescription("Delete the flow from the business stream.");

                    deleteButton.setData(businessStreamFlow);

                    // Add the delete functionality to each role that is added
                    deleteButton.addClickListener(new Button.ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            businessStream.getFlows().remove(businessStreamFlow);

                            topologyService.deleteBusinessStreamFlow(businessStreamFlow);
                            topologyService.saveBusinessStream(businessStream);

                            businessStreamTable.removeItem(businessStreamFlow.getFlow());
                        }
                    });

                    businessStreamTable
                            .addItem(
                                    new Object[] { flow.getModule().getServer().getName(),
                                            flow.getModule().getName(), flow.getName(), deleteButton },
                                    businessStreamFlow);
                }
            } else if (t.getItemId() instanceof Module) {
                final Module sourceContainer = (Module) t.getItemId();

                for (Flow flow : sourceContainer.getFlows()) {

                    final BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue();
                    BusinessStreamFlowKey key = new BusinessStreamFlowKey();
                    key.setBusinessStreamId(businessStream.getId());
                    key.setFlowId(flow.getId());
                    final BusinessStreamFlow businessStreamFlow = new BusinessStreamFlow(key);
                    businessStreamFlow.setFlow(flow);
                    businessStreamFlow.setOrder(businessStreamTable.getItemIds().size());

                    if (!businessStream.getFlows().contains(businessStreamFlow)) {
                        businessStream.getFlows().add(businessStreamFlow);

                        topologyService.saveBusinessStream(businessStream);

                        Button deleteButton = new Button();
                        Resource deleteIcon = VaadinIcons.TRASH;

                        deleteButton.setIcon(deleteIcon);
                        deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
                        deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                        deleteButton.setDescription("Delete the flow from the business stream.");
                        deleteButton.setData(businessStreamFlow);

                        // Add the delete functionality to each role that is added
                        deleteButton.addClickListener(new Button.ClickListener() {
                            public void buttonClick(ClickEvent event) {
                                businessStream.getFlows().remove(businessStreamFlow);

                                topologyService.deleteBusinessStreamFlow(businessStreamFlow);
                                topologyService.saveBusinessStream(businessStream);

                                businessStreamTable.removeItem(businessStreamFlow.getFlow());
                            }
                        });

                        businessStreamTable.addItem(
                                new Object[] { flow.getModule().getServer().getName(),
                                        flow.getModule().getName(), flow.getName(), deleteButton },
                                businessStreamFlow);
                    }
                }
            } else {
                Notification.show("Only modules or flows can be dragged to this table.");
            }
        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }
    });

    GridLayout layout = new GridLayout(1, 6);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();

    Label tableDropHintLabel = new Label();
    tableDropHintLabel.setCaptionAsHtml(true);
    tableDropHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " Drag modules or flows from the topology tree to the table below to build a business stream.");
    tableDropHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    tableDropHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);

    layout.addComponent(tableDropHintLabel);

    GridLayout controlsLayout = new GridLayout(3, 3);
    controlsLayout.setColumnExpandRatio(0, .05f);
    controlsLayout.setColumnExpandRatio(1, .65f);
    controlsLayout.setColumnExpandRatio(2, .3f);

    controlsLayout.setWidth("100%");
    controlsLayout.setSpacing(true);

    Label newBusinessStreamLabel = new Label("New Business Stream:");
    newBusinessStreamLabel.setSizeUndefined();
    controlsLayout.addComponent(newBusinessStreamLabel, 0, 0);
    controlsLayout.setComponentAlignment(newBusinessStreamLabel, Alignment.MIDDLE_RIGHT);

    Button newButton = new Button();
    newButton.setIcon(VaadinIcons.PLUS);
    newButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    newButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    newButton.setDescription("Create a new business stream.");
    newButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final NewBusinessStreamWindow newBusinessStreamWindow = new NewBusinessStreamWindow();
            UI.getCurrent().addWindow(newBusinessStreamWindow);

            newBusinessStreamWindow.addCloseListener(new Window.CloseListener() {
                // inline close-listener
                public void windowClose(CloseEvent e) {
                    topologyService.saveBusinessStream(newBusinessStreamWindow.getBusinessStream());

                    businessStreamCombo.addItem(newBusinessStreamWindow.getBusinessStream());
                    businessStreamCombo.setItemCaption(newBusinessStreamWindow.getBusinessStream(),
                            newBusinessStreamWindow.getBusinessStream().getName());

                    businessStreamCombo.select(newBusinessStreamWindow.getBusinessStream());

                    businessStreamTable.removeAllItems();
                }
            });
        }
    });

    final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
            .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

    if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            && !authentication.hasGrantedAuthority(SecurityConstants.CREATE_BUSINESS_STREAM_AUTHORITY))) {
        newButton.setVisible(false);
    }

    controlsLayout.addComponent(newButton, 1, 0);

    Label businessStreamLabel = new Label("Business Stream:");
    businessStreamLabel.setSizeUndefined();

    final TextArea descriptionTextArea = new TextArea();
    descriptionTextArea.setReadOnly(true);

    this.businessStreamCombo.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty() != null && event.getProperty().getValue() != null) {
                final BusinessStream businessStream = (BusinessStream) event.getProperty().getValue();

                descriptionTextArea.setReadOnly(false);
                descriptionTextArea.setValue(businessStream.getDescription());
                descriptionTextArea.setReadOnly(true);

                businessStreamTable.removeAllItems();

                for (final BusinessStreamFlow businessStreamFlow : businessStream.getFlows()) {
                    logger.info("Adding flow: " + businessStreamFlow);
                    Button deleteButton = new Button();
                    deleteButton.setIcon(VaadinIcons.TRASH);
                    deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
                    deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                    deleteButton.setDescription("Delete the flow from the business stream.");

                    // Add the delete functionality to each role that is added
                    deleteButton.addClickListener(new Button.ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            businessStream.getFlows().remove(businessStreamFlow);

                            topologyService.deleteBusinessStreamFlow(businessStreamFlow);
                            topologyService.saveBusinessStream(businessStream);

                            businessStreamTable.removeItem(businessStreamFlow.getFlow());
                        }
                    });

                    final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService
                            .getCurrentRequest().getWrappedSession()
                            .getAttribute(DashboardSessionValueConstants.USER);

                    if (authentication != null
                            && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
                                    && !authentication.hasGrantedAuthority(
                                            SecurityConstants.MODIFY_BUSINESS_STREAM_AUTHORITY))) {
                        deleteButton.setVisible(false);
                    }

                    businessStreamTable.addItem(
                            new Object[] { businessStreamFlow.getFlow().getModule().getServer().getName(),
                                    businessStreamFlow.getFlow().getName(),
                                    businessStreamFlow.getFlow().getName(), deleteButton },
                            businessStreamFlow);
                }
            }
        }
    });
    businessStreamCombo.setWidth("100%");

    controlsLayout.addComponent(businessStreamLabel, 0, 1);
    controlsLayout.setComponentAlignment(businessStreamLabel, Alignment.MIDDLE_RIGHT);
    controlsLayout.addComponent(businessStreamCombo, 1, 1);

    Button deleteButton = new Button();
    deleteButton.setIcon(VaadinIcons.TRASH);
    deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    deleteButton.setDescription("Delete the selected business stream.");
    deleteButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            Collection<BusinessStreamFlow> businessStreamFlows = (Collection<BusinessStreamFlow>) businessStreamTable
                    .getItemIds();

            for (BusinessStreamFlow businessStreamFlow : businessStreamFlows) {
                topologyService.deleteBusinessStreamFlow(businessStreamFlow);
            }

            BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue();

            topologyService.deleteBusinessStream(businessStream);

            businessStreamTable.removeAllItems();

            List<BusinessStream> businessStreams = topologyService.getAllBusinessStreams();

            businessStreamCombo.removeItem(businessStream);

            descriptionTextArea.setValue("");
        }
    });

    if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            && !authentication.hasGrantedAuthority(SecurityConstants.DELETE_BUSINESS_STREAM_AUTHORITY))) {
        deleteButton.setVisible(false);
    }

    controlsLayout.addComponent(deleteButton, 2, 1);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();

    descriptionTextArea.setRows(4);
    descriptionTextArea.setWidth("100%");
    controlsLayout.addComponent(descriptionLabel, 0, 2);
    controlsLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    controlsLayout.addComponent(descriptionTextArea, 1, 2);

    layout.addComponent(controlsLayout);
    layout.addComponent(this.businessStreamTable);

    return layout;
}

From source file:org.ikasan.dashboard.ui.topology.window.CategorisedErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(4, 7);
    layout.setWidth("100%");
    layout.setSpacing(true);//from  ww w.j a  va2  s  . co m
    layout.setColumnExpandRatio(0, .10f);
    layout.setColumnExpandRatio(1, .30f);
    layout.setColumnExpandRatio(2, .05f);
    layout.setColumnExpandRatio(3, .30f);

    Label errorOccurrenceDetailsLabel = new Label(" Categorised Error Occurence Details", ContentMode.HTML);
    Label errorCategoryLabel = new Label();

    if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.BLOCKER)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.BAN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.BAN.getHtml() + " Blocker", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.CRITICAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.EXCLAMATION.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.EXCLAMATION.getHtml() + " Critical", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.MAJOR)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_UP.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_UP.getHtml() + " Major", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.TRIVIAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_DOWN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_DOWN.getHtml() + " Trivial", ContentMode.HTML);
    }

    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 3, 0);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.categorisedErrorOccurrence.getErrorOccurrence().getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    Label errorMessageLabel = new Label("Error Message:");
    errorMessageLabel.setSizeUndefined();
    layout.addComponent(errorMessageLabel, 0, 5);
    layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT);

    final TextArea errorMessageTextArea = new TextArea();
    errorMessageTextArea.setWidth("650px");
    errorMessageTextArea.setRows(6);
    errorMessageTextArea
            .setValue(this.categorisedErrorOccurrence.getErrorCategorisation().getErrorDescription());

    layout.addComponent(errorMessageTextArea, 1, 5, 3, 5);

    AceEditor editor = new AceEditor();
    editor.setCaption("Error Details");
    editor.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    label = new Label("Error Category:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    layout.addComponent(errorCategoryLabel, 3, 1);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_LEFT);

    label = new Label("System Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField systemAction = new TextField();
    systemAction.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getAction());
    systemAction.setReadOnly(true);
    systemAction.setWidth("80%");
    layout.addComponent(systemAction, 3, 2);

    label = new Label("User Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField userAction = new TextField();
    userAction.setValue("");
    userAction.setReadOnly(true);
    userAction.setWidth("80%");
    layout.addComponent(userAction, 3, 3);

    label = new Label("User Action By:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    Label userActionBy = new Label();
    userActionBy.setValue("");
    userActionBy.setReadOnly(true);
    userActionBy.setWidth("80%");
    layout.addComponent(userActionBy, 3, 4);

    AceEditor eventEditor = new AceEditor();
    eventEditor.setCaption("Event Payload");

    if (this.categorisedErrorOccurrence.getErrorOccurrence().getEvent() != null) {
        eventEditor
                .setValue(new String((byte[]) this.categorisedErrorOccurrence.getErrorOccurrence().getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(300, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    //      wrapperLayout.addComponent(vSplitPanel, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java

License:BSD License

@SuppressWarnings("unchecked")
public void populate(Component component) {
    configuration = this.configurationManagement.getConfiguration(component.getConfigurationId());

    if (configuration == null) {
        Server server = component.getFlow().getModule().getServer();

        String url = "http://" + server.getUrl() + ":" + server.getPort()
                + component.getFlow().getModule().getContextRoot() + "/rest/configuration/createConfiguration/"
                + component.getFlow().getModule().getName() + "/" + component.getFlow().getName() + "/"
                + component.getName();//from w w  w  .j  a va2 s  . c om

        logger.info("Configuration Url: " + url);

        IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
                .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

        HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(authentication.getName(),
                (String) authentication.getCredentials());

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.register(feature);

        Client client = ClientBuilder.newClient(clientConfig);

        ObjectMapper mapper = new ObjectMapper();

        WebTarget webTarget = client.target(url);

        Response response = webTarget.request().get();

        if (response.getStatus() != 200) {
            response.bufferEntity();

            String responseMessage = response.readEntity(String.class);
            Notification.show("An error was received trying to create configured resource '"
                    + component.getConfigurationId() + "': " + responseMessage, Type.ERROR_MESSAGE);
        }

        configuration = this.configurationManagement.getConfiguration(component.getConfigurationId());
    }

    final List<ConfigurationParameter> parameters = (List<ConfigurationParameter>) configuration
            .getParameters();

    this.layout = new GridLayout(2, parameters.size() + 6);
    this.layout.setSpacing(true);
    this.layout.setColumnExpandRatio(0, .25f);
    this.layout.setColumnExpandRatio(1, .75f);

    this.layout.setWidth("95%");
    this.layout.setMargin(true);

    Label configurationParametersLabel = new Label("Configuration Parameters");
    configurationParametersLabel.setStyleName(ValoTheme.LABEL_HUGE);
    this.layout.addComponent(configurationParametersLabel, 0, 0);

    GridLayout paramLayout = new GridLayout(2, 2);
    paramLayout.setSpacing(true);
    paramLayout.setSizeFull();
    paramLayout.setMargin(true);
    paramLayout.setColumnExpandRatio(0, .25f);
    paramLayout.setColumnExpandRatio(1, .75f);

    Label configuredResourceIdLabel = new Label("Configured Resource Id");
    configuredResourceIdLabel.addStyleName(ValoTheme.LABEL_LARGE);
    configuredResourceIdLabel.addStyleName(ValoTheme.LABEL_BOLD);
    Label configuredResourceIdValueLabel = new Label(configuration.getConfigurationId());
    configuredResourceIdValueLabel.addStyleName(ValoTheme.LABEL_LARGE);
    configuredResourceIdValueLabel.addStyleName(ValoTheme.LABEL_BOLD);

    paramLayout.addComponent(configuredResourceIdLabel, 0, 0);
    paramLayout.setComponentAlignment(configuredResourceIdLabel, Alignment.TOP_RIGHT);
    paramLayout.addComponent(configuredResourceIdValueLabel, 1, 0);

    Label configurationDescriptionLabel = new Label("Description:");
    configurationDescriptionLabel.setSizeUndefined();
    paramLayout.addComponent(configurationDescriptionLabel, 0, 1);
    paramLayout.setComponentAlignment(configurationDescriptionLabel, Alignment.TOP_RIGHT);

    TextArea conmfigurationDescriptionTextField = new TextArea();
    conmfigurationDescriptionTextField.setRows(4);
    conmfigurationDescriptionTextField.setWidth("80%");
    paramLayout.addComponent(conmfigurationDescriptionTextField, 1, 1);

    this.layout.addComponent(paramLayout, 0, 1, 1, 1);

    int i = 2;

    for (ConfigurationParameter parameter : parameters) {
        if (parameter instanceof ConfigurationParameterIntegerImpl) {
            this.layout.addComponent(
                    this.createTextAreaPanel(parameter, new IntegerValidator("Must be a valid number")), 0, i,
                    1, i);
        } else if (parameter instanceof ConfigurationParameterStringImpl) {
            this.layout.addComponent(this.createTextAreaPanel(parameter, new StringValidator()), 0, i, 1, i);
        } else if (parameter instanceof ConfigurationParameterBooleanImpl) {
            this.layout.addComponent(this.createTextAreaPanel(parameter, new BooleanValidator()), 0, i, 1, i);
        } else if (parameter instanceof ConfigurationParameterLongImpl) {
            this.layout.addComponent(this.createTextAreaPanel(parameter, new LongValidator()), 0, i, 1, i);
        } else if (parameter instanceof ConfigurationParameterMapImpl) {
            this.layout.addComponent(this.createMapPanel((ConfigurationParameterMapImpl) parameter), 0, i, 1,
                    i);
        } else if (parameter instanceof ConfigurationParameterListImpl) {
            this.layout.addComponent(this.createListPanel((ConfigurationParameterListImpl) parameter), 0, i, 1,
                    i);
        }

        i++;
    }

    Button saveButton = new Button("Save");
    saveButton.addStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                for (TextArea textField : textFields.values()) {
                    textField.validate();
                }
            } catch (InvalidValueException e) {
                e.printStackTrace();
                for (TextArea textField : textFields.values()) {
                    textField.setValidationVisible(true);
                }

                Notification.show("There are errors on the form above", Type.ERROR_MESSAGE);

                return;
            }

            for (ConfigurationParameter parameter : parameters) {
                TextArea textField = ComponentConfigurationWindow.this.textFields.get(parameter.getName());
                TextArea descriptionTextField = ComponentConfigurationWindow.this.descriptionTextFields
                        .get(parameter.getName());

                if (parameter != null && descriptionTextField != null) {
                    parameter.setDescription(descriptionTextField.getValue());
                }

                if (parameter instanceof ConfigurationParameterIntegerImpl) {
                    logger.info("Setting Integer value: " + textField.getValue());

                    if (textField.getValue() != null && textField.getValue().length() > 0)
                        parameter.setValue(new Integer(textField.getValue()));
                } else if (parameter instanceof ConfigurationParameterStringImpl) {
                    logger.info("Setting String value: " + textField.getValue());
                    if (textField.getValue() != null && textField.getValue().length() > 0)
                        parameter.setValue(textField.getValue());
                } else if (parameter instanceof ConfigurationParameterBooleanImpl) {
                    logger.info("Setting Boolean value: " + textField.getValue());
                    if (textField.getValue() != null && textField.getValue().length() > 0)
                        parameter.setValue(new Boolean(textField.getValue()));
                } else if (parameter instanceof ConfigurationParameterLongImpl) {
                    logger.info("Setting Boolean value: " + textField.getValue());
                    if (textField.getValue() != null && textField.getValue().length() > 0)
                        parameter.setValue(new Long(textField.getValue()));
                } else if (parameter instanceof ConfigurationParameterMapImpl) {
                    ConfigurationParameterMapImpl mapParameter = (ConfigurationParameterMapImpl) parameter;

                    HashMap<String, String> map = new HashMap<String, String>();

                    logger.info("Saving map: " + mapTextFields.size());

                    for (String key : mapTextFields.keySet()) {
                        if (key.startsWith(parameter.getName())) {
                            TextFieldKeyValuePair pair = mapTextFields.get(key);

                            logger.info("Saving for key: " + key);

                            if (pair.key.getValue() != "") {
                                map.put(pair.key.getValue(), pair.value.getValue());
                            }
                        }
                    }

                    parameter.setValue(map);
                } else if (parameter instanceof ConfigurationParameterListImpl) {
                    ConfigurationParameterListImpl mapParameter = (ConfigurationParameterListImpl) parameter;

                    ArrayList<String> map = new ArrayList<String>();

                    for (String key : valueTextFields.keySet()) {
                        if (key.startsWith(parameter.getName())) {
                            map.add(valueTextFields.get(key).getValue());
                        }
                    }

                    parameter.setValue(map);
                }

            }

            ComponentConfigurationWindow.this.configurationManagement.saveConfiguration(configuration);

            Notification notification = new Notification("Saved",
                    "The configuration has been saved successfully!", Type.HUMANIZED_MESSAGE);
            notification.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE);
            notification.show(Page.getCurrent());
        }
    });

    Button deleteButton = new Button("Delete");
    deleteButton.addStyleName(ValoTheme.BUTTON_SMALL);
    deleteButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            DeleteConfigurationAction action = new DeleteConfigurationAction(configuration,
                    configurationManagement, ComponentConfigurationWindow.this);

            IkasanMessageDialog dialog = new IkasanMessageDialog("Delete configuration",
                    "Are you sure you would like to delete this configuration?", action);

            UI.getCurrent().addWindow(dialog);
        }
    });

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(saveButton, 0, 0);
    buttonLayout.addComponent(deleteButton, 1, 0);

    this.layout.addComponent(buttonLayout, 0, i, 1, i);
    this.layout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    Panel configurationPanel = new Panel();
    configurationPanel.setContent(this.layout);

    this.setContent(configurationPanel);
}

From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java

License:BSD License

protected Panel createTextAreaPanel(ConfigurationParameter parameter, Validator validator) {
    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");

    GridLayout paramLayout = new GridLayout(2, 3);
    paramLayout.setSpacing(true);/*  w ww .j av  a 2  s  . c o m*/
    paramLayout.setSizeFull();
    paramLayout.setMargin(true);
    paramLayout.setColumnExpandRatio(0, .25f);
    paramLayout.setColumnExpandRatio(1, .75f);

    Label label = new Label(parameter.getName());
    label.setIcon(VaadinIcons.COG);
    label.addStyleName(ValoTheme.LABEL_LARGE);
    label.addStyleName(ValoTheme.LABEL_BOLD);
    label.setSizeUndefined();
    paramLayout.addComponent(label, 0, 0, 1, 0);
    paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT);

    logger.info(parameter.getName() + " " + parameter.getValue());
    Label valueLabel = new Label("Value:");
    valueLabel.setSizeUndefined();
    TextArea textField = new TextArea();
    textField.addValidator(validator);
    textField.setNullSettingAllowed(true);
    textField.setNullRepresentation("");
    textField.setValidationVisible(false);
    textField.setRows(4);
    textField.setWidth("80%");
    textField.setId(parameter.getName());

    if (parameter instanceof ConfigurationParameterIntegerImpl) {
        StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() {
            protected java.text.NumberFormat getFormat(Locale locale) {
                NumberFormat format = super.getFormat(locale);
                format.setGroupingUsed(false);
                return format;
            };
        };

        // either set for the field or in your field factory for multiple fields
        textField.setConverter(plainIntegerConverter);
    } else if (parameter instanceof ConfigurationParameterLongImpl) {
        StringToLongConverter plainLongConverter = new StringToLongConverter() {
            protected java.text.NumberFormat getFormat(Locale locale) {
                NumberFormat format = super.getFormat(locale);
                format.setGroupingUsed(false);
                return format;
            };
        };

        // either set for the field or in your field factory for multiple fields
        textField.setConverter(plainLongConverter);
    }

    textFields.put(parameter.getName(), textField);

    BeanItem<ConfigurationParameter> parameterItem = new BeanItem<ConfigurationParameter>(parameter);

    if (parameter.getValue() != null) {
        textField.setPropertyDataSource(parameterItem.getItemProperty("value"));
    }

    paramLayout.addComponent(valueLabel, 0, 1);
    paramLayout.addComponent(textField, 1, 1);
    paramLayout.setComponentAlignment(valueLabel, Alignment.TOP_RIGHT);

    Label paramDescriptionLabel = new Label("Description:");
    paramDescriptionLabel.setSizeUndefined();
    TextArea descriptionTextField = new TextArea();
    descriptionTextField.setRows(4);
    descriptionTextField.setWidth("80%");
    descriptionTextField.setId(parameter.getName());

    paramLayout.addComponent(paramDescriptionLabel, 0, 2);
    paramLayout.addComponent(descriptionTextField, 1, 2);
    paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT);

    descriptionTextFields.put(parameter.getName(), descriptionTextField);

    if (parameter.getDescription() != null) {
        descriptionTextField.setValue(parameter.getDescription());
    }

    paramPanel.setContent(paramLayout);

    return paramPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java

License:BSD License

protected Panel createMapPanel(final ConfigurationParameterMapImpl parameter) {
    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");

    GridLayout paramLayout = new GridLayout(2, 3);
    paramLayout.setSpacing(true);// w ww . j  a va 2s  .co m
    paramLayout.setSizeFull();
    paramLayout.setMargin(true);
    paramLayout.setColumnExpandRatio(0, .25f);
    paramLayout.setColumnExpandRatio(1, .75f);

    Label label = new Label(parameter.getName());
    label.setIcon(VaadinIcons.COG);
    label.addStyleName(ValoTheme.LABEL_LARGE);
    label.addStyleName(ValoTheme.LABEL_BOLD);
    label.setSizeUndefined();
    paramLayout.addComponent(label, 0, 0, 1, 0);
    paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT);

    final Map<String, String> valueMap = parameter.getValue();

    final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1);
    mapLayout.setMargin(true);
    mapLayout.setSpacing(true);

    int i = 0;

    for (final String key : valueMap.keySet()) {
        final Label keyLabel = new Label("Key");
        final Label valueLabel = new Label("Value");

        final TextField keyField = new TextField();
        keyField.setValue(key);

        final TextField valueField = new TextField();
        valueField.setValue(valueMap.get(key));

        mapLayout.addComponent(keyLabel, 0, i);
        mapLayout.addComponent(keyField, 1, i);
        mapLayout.addComponent(valueLabel, 2, i);
        mapLayout.addComponent(valueField, 3, i);
        final String mapKey = parameter.getName() + i;
        TextFieldKeyValuePair pair = new TextFieldKeyValuePair();
        pair.key = keyField;
        pair.value = valueField;

        this.mapTextFields.put(mapKey, pair);

        final Button removeButton = new Button("remove");
        removeButton.setStyleName(ValoTheme.BUTTON_LINK);
        removeButton.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                valueMap.remove(key);
                mapLayout.removeComponent(keyLabel);
                mapLayout.removeComponent(valueLabel);
                mapLayout.removeComponent(keyField);
                mapLayout.removeComponent(valueField);
                mapLayout.removeComponent(removeButton);

                mapTextFields.remove(mapKey);
            }
        });

        mapLayout.addComponent(removeButton, 4, i);

        i++;
    }

    final Button addButton = new Button("add");
    addButton.setStyleName(ValoTheme.BUTTON_LINK);
    addButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final Label keyLabel = new Label("Key");
            final Label valueLabel = new Label("Value");

            final TextField keyField = new TextField();

            final TextField valueField = new TextField();

            mapLayout.insertRow(mapLayout.getRows());

            mapLayout.removeComponent(addButton);
            mapLayout.addComponent(keyLabel, 0, mapLayout.getRows() - 2);
            mapLayout.addComponent(keyField, 1, mapLayout.getRows() - 2);
            mapLayout.addComponent(valueLabel, 2, mapLayout.getRows() - 2);
            mapLayout.addComponent(valueField, 3, mapLayout.getRows() - 2);

            final String mapKey = parameter.getName() + mapTextFields.size();
            TextFieldKeyValuePair pair = new TextFieldKeyValuePair();
            pair.key = keyField;
            pair.value = valueField;

            mapTextFields.put(mapKey, pair);

            final Button removeButton = new Button("remove");
            removeButton.setStyleName(ValoTheme.BUTTON_LINK);
            removeButton.addClickListener(new Button.ClickListener() {
                public void buttonClick(ClickEvent event) {
                    mapLayout.removeComponent(keyLabel);
                    mapLayout.removeComponent(valueLabel);
                    mapLayout.removeComponent(keyField);
                    mapLayout.removeComponent(valueField);

                    mapLayout.removeComponent(removeButton);

                    mapTextFields.remove(mapKey);
                }
            });

            mapLayout.addComponent(removeButton, 4, mapLayout.getRows() - 2);

            mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1);
        }
    });

    mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1);

    Panel mapPanel = new Panel();
    mapPanel.setStyleName("dashboard");
    mapPanel.setContent(mapLayout);

    paramLayout.addComponent(mapPanel, 0, 1, 1, 1);
    paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER);
    paramPanel.setContent(paramLayout);

    Label paramDescriptionLabel = new Label("Description:");
    paramDescriptionLabel.setSizeUndefined();
    TextArea descriptionTextField = new TextArea();
    descriptionTextField.setRows(4);
    descriptionTextField.setWidth("80%");
    descriptionTextField.setId(parameter.getName());

    paramLayout.addComponent(paramDescriptionLabel, 0, 2);
    paramLayout.addComponent(descriptionTextField, 1, 2);
    paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT);

    descriptionTextFields.put(parameter.getName(), descriptionTextField);

    if (parameter.getDescription() != null) {
        descriptionTextField.setValue(parameter.getDescription());
    }

    return paramPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java

License:BSD License

protected Panel createListPanel(final ConfigurationParameterListImpl parameter) {
    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");

    GridLayout paramLayout = new GridLayout(2, 3);
    paramLayout.setSpacing(true);/* w  w w . j  av a  2 s.  c  om*/
    paramLayout.setSizeFull();
    paramLayout.setMargin(true);
    paramLayout.setColumnExpandRatio(0, .25f);
    paramLayout.setColumnExpandRatio(1, .75f);

    Label label = new Label(parameter.getName());
    label.setIcon(VaadinIcons.COG);
    label.addStyleName(ValoTheme.LABEL_LARGE);
    label.addStyleName(ValoTheme.LABEL_BOLD);
    label.setSizeUndefined();
    paramLayout.addComponent(label, 0, 0, 1, 0);
    paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT);

    final List<String> valueList = parameter.getValue();

    final GridLayout listLayout = new GridLayout(3, (valueList.size() != 0 ? valueList.size() : 1) + 1);
    listLayout.setWidth("450px");
    listLayout.setMargin(true);
    listLayout.setSpacing(true);

    listLayout.setColumnExpandRatio(0, 0.25f);
    listLayout.setColumnExpandRatio(1, 0.5f);
    listLayout.setColumnExpandRatio(2, 0.25f);

    int i = 0;

    for (final String value : valueList) {
        final Label valueLabel = new Label("Value");

        final TextField valueField = new TextField();
        valueField.setValue(value);
        valueField.setWidth("90%");

        listLayout.addComponent(valueLabel, 0, i);
        listLayout.addComponent(valueField, 1, i);

        final String mapKey = parameter.getName() + i;

        this.valueTextFields.put(mapKey, valueField);

        final Button removeButton = new Button("remove");
        removeButton.setStyleName(ValoTheme.BUTTON_LINK);
        removeButton.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                valueList.remove(value);
                listLayout.removeComponent(valueLabel);
                listLayout.removeComponent(valueField);
                listLayout.removeComponent(removeButton);

                valueTextFields.remove(mapKey);
            }
        });

        listLayout.addComponent(removeButton, 2, i);

        i++;
    }

    final Button addButton = new Button("add");
    addButton.setStyleName(ValoTheme.BUTTON_LINK);
    addButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final Label valueLabel = new Label("Value");

            final TextField valueField = new TextField();
            valueField.setWidth("90%");

            listLayout.insertRow(listLayout.getRows());

            listLayout.removeComponent(addButton);
            listLayout.addComponent(valueLabel, 0, listLayout.getRows() - 2);
            listLayout.addComponent(valueField, 1, listLayout.getRows() - 2);

            final String mapKey = parameter.getName() + valueTextFields.size();

            valueTextFields.put(mapKey, valueField);

            final Button removeButton = new Button("remove");
            removeButton.setStyleName(ValoTheme.BUTTON_LINK);
            removeButton.addClickListener(new Button.ClickListener() {
                public void buttonClick(ClickEvent event) {
                    listLayout.removeComponent(valueLabel);
                    listLayout.removeComponent(valueField);

                    listLayout.removeComponent(removeButton);

                    valueTextFields.remove(mapKey);
                }
            });

            listLayout.addComponent(removeButton, 2, listLayout.getRows() - 2);

            listLayout.addComponent(addButton, 0, listLayout.getRows() - 1);
        }
    });

    listLayout.addComponent(addButton, 0, listLayout.getRows() - 1);

    Panel mapPanel = new Panel();
    mapPanel.setStyleName("dashboard");
    mapPanel.setContent(listLayout);

    paramLayout.addComponent(mapPanel, 0, 1, 1, 1);
    paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER);
    paramPanel.setContent(paramLayout);

    Label paramDescriptionLabel = new Label("Description:");
    paramDescriptionLabel.setSizeUndefined();
    TextArea descriptionTextField = new TextArea();
    descriptionTextField.setRows(4);
    descriptionTextField.setWidth("80%");
    descriptionTextField.setId(parameter.getName());

    paramLayout.addComponent(paramDescriptionLabel, 0, 2);
    paramLayout.addComponent(descriptionTextField, 1, 2);
    paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT);

    descriptionTextFields.put(parameter.getName(), descriptionTextField);

    if (parameter.getDescription() != null) {
        descriptionTextField.setValue(parameter.getDescription());
    }

    return paramPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(2, 6);
    layout.setSizeFull();/*from  www.  ja v  a  2 s.  c o  m*/
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.25f);
    layout.setColumnExpandRatio(1, 0.75f);

    Label errorOccurrenceDetailsLabel = new Label("Error Occurence Details");
    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.errorOccurrence.getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.errorOccurrence.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.errorOccurrence.getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.errorOccurrence.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    label = new Label("Error Message:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 5);
    layout.setComponentAlignment(label, Alignment.TOP_RIGHT);

    TextArea tf5 = new TextArea();
    tf5.setValue(this.errorOccurrence.getErrorMessage());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    tf5.setRows(3);
    layout.addComponent(tf5, 1, 5);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    AceEditor editor = new AceEditor();
    //      editor.setCaption("Error Details");
    editor.setValue(this.errorOccurrence.getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    AceEditor eventEditor = new AceEditor();
    //      eventEditor.setCaption("Event Payload");

    if (this.errorOccurrence.getEvent() != null) {
        eventEditor.setValue(new String((byte[]) this.errorOccurrence.getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(230, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}