Example usage for com.vaadin.ui GridLayout GridLayout

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

Introduction

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

Prototype

public GridLayout(int columns, int rows) 

Source Link

Document

Constructor for a grid of given size (number of columns and rows).

Usage

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

License:BSD License

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

    GridLayout gridLayout = new GridLayout(2, 4);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);/*w  ww. j a v a  2 s  . c  o  m*/
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("New Business Steam");
    Label nameLabel = new Label("Name:");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

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

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

    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.setWidth("90%");
    this.roleDescription.setRows(4);

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

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

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

    GridLayout buttonLayout = new GridLayout(2, 1);
    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<BusinessStream> policyItem = new BeanItem<BusinessStream>(this.businessStream);

    roleName.setPropertyDataSource(policyItem.getItemProperty("name"));
    roleDescription.setPropertyDataSource(policyItem.getItemProperty("description"));
    this.businessStream.setFlows(new HashSet<BusinessStreamFlow>());

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

                return;
            }

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

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

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

    this.setContent(gridLayout);
}

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

License:BSD License

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

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);/*from w  w  w. j a  v a2  s .c om*/
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("New Server");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

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

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

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

    Label urlLabel = new Label("URL:");
    urlLabel.setSizeUndefined();
    this.url = new TextField();
    this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false));
    this.url.setWidth("90%");

    gridLayout.addComponent(urlLabel, 0, 2);
    gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(url, 1, 2);

    Label portLabel = new Label("Port Number:");
    portLabel.setSizeUndefined();
    this.port = new TextField();
    this.port.addValidator(new IntegerValidator("A port number and must be a valid number."));
    this.port.setWidth("45%");

    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
    this.port.setConverter(plainIntegerConverter);

    gridLayout.addComponent(portLabel, 0, 3);
    gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(port, 1, 3);

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

    this.name.setValidationVisible(false);
    this.description.setValidationVisible(false);
    this.url.setValidationVisible(false);
    this.port.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 4);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(description, 1, 4);

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

    GridLayout buttonLayout = new GridLayout(2, 1);
    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, 5, 1, 5);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    BeanItem<Server> policyItem = new BeanItem<Server>(this.server);

    name.setPropertyDataSource(policyItem.getItemProperty("name"));
    description.setPropertyDataSource(policyItem.getItemProperty("description"));
    url.setPropertyDataSource(policyItem.getItemProperty("url"));
    port.setPropertyDataSource(policyItem.getItemProperty("port"));

    createButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                NewServerWindow.this.name.validate();
                NewServerWindow.this.description.validate();
                NewServerWindow.this.url.validate();
                NewServerWindow.this.port.validate();
            } catch (InvalidValueException e) {
                NewServerWindow.this.name.setValidationVisible(true);
                NewServerWindow.this.description.setValidationVisible(true);
                NewServerWindow.this.url.setValidationVisible(true);
                NewServerWindow.this.port.setValidationVisible(true);

                return;
            }

            NewServerWindow.this.name.setValidationVisible(false);
            NewServerWindow.this.description.setValidationVisible(false);
            NewServerWindow.this.url.setValidationVisible(false);
            NewServerWindow.this.port.setValidationVisible(false);

            topologyService.save(server);

            Notification.show("New Server Created!");

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

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

    this.setContent(gridLayout);
}

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

License:BSD License

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

    GridLayout gridLayout = new GridLayout(2, 7);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);/*from   w  w  w  . j a  va 2  s  . co m*/
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("Server");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

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

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

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

    Label urlLabel = new Label("URL:");
    urlLabel.setSizeUndefined();
    this.url = new TextField();
    this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false));
    this.url.setWidth("90%");

    gridLayout.addComponent(urlLabel, 0, 3);
    gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(url, 1, 3);

    Label portLabel = new Label("Port Number:");
    portLabel.setSizeUndefined();
    this.port = new TextField();
    this.port.addValidator(new IntegerValidator("A port number and must be a valid number."));
    this.port.setWidth("45%");

    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
    this.port.setConverter(plainIntegerConverter);

    gridLayout.addComponent(portLabel, 0, 4);
    gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(port, 1, 4);

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

    this.name.setValidationVisible(false);
    this.description.setValidationVisible(false);
    this.url.setValidationVisible(false);
    this.port.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 5);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(description, 1, 5);

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

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(saveButton);
    buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

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

    BeanItem<Server> serverItem = new BeanItem<Server>(this.server);

    name.setPropertyDataSource(serverItem.getItemProperty("name"));
    description.setPropertyDataSource(serverItem.getItemProperty("description"));
    url.setPropertyDataSource(serverItem.getItemProperty("url"));
    this.port.setPropertyDataSource(serverItem.getItemProperty("port"));

    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                ServerWindow.this.name.validate();
                ServerWindow.this.description.validate();
                ServerWindow.this.url.validate();
                ServerWindow.this.port.validate();
            } catch (InvalidValueException e) {
                ServerWindow.this.name.setValidationVisible(true);
                ServerWindow.this.description.setValidationVisible(true);
                ServerWindow.this.url.setValidationVisible(true);
                ServerWindow.this.port.setValidationVisible(true);

                return;
            }

            ServerWindow.this.name.setValidationVisible(false);
            ServerWindow.this.description.setValidationVisible(false);
            ServerWindow.this.url.setValidationVisible(false);
            ServerWindow.this.port.setValidationVisible(false);

            topologyService.save(server);

            Notification.show("New Server Created!");

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

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

    this.setContent(gridLayout);
}

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

License:BSD License

/**
  * Helper method to initialise this object.
  * //from  w  w  w  .  j av  a2  s  .co m
  * @param message
  */
protected void init() {
    setModal(true);
    setResizable(false);
    setHeight("320px");
    setWidth("550px");

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setWidth("500px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);

    Label startupControlLabel = new Label("Startup Control");
    startupControlLabel.addStyleName(ValoTheme.LABEL_HUGE);

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

    Label moduleNameLabel = new Label();
    moduleNameLabel.setContentMode(ContentMode.HTML);
    moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:");
    moduleNameLabel.setSizeUndefined();
    gridLayout.addComponent(moduleNameLabel, 0, 1);
    gridLayout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT);

    startupControl = this.startupControlService.getStartupControl(flow.getModule().getName(), flow.getName());

    startupControlItem = new BeanItem<StartupControl>(startupControl);

    moduleNameTextField = new TextField();
    moduleNameTextField.setRequired(true);
    moduleNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("moduleName"));
    moduleNameTextField.setReadOnly(true);
    moduleNameTextField.setWidth("90%");
    gridLayout.addComponent(moduleNameTextField, 1, 1);

    Label flowNameLabel = new Label();
    flowNameLabel.setContentMode(ContentMode.HTML);
    flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:");
    flowNameLabel.setSizeUndefined();
    gridLayout.addComponent(flowNameLabel, 0, 2);
    gridLayout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT);

    flowNameTextField = new TextField();
    flowNameTextField.setRequired(true);
    flowNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("flowName"));
    flowNameTextField.setReadOnly(true);
    flowNameTextField.setWidth("90%");
    gridLayout.addComponent(flowNameTextField, 1, 2);

    Label startupTypeLabel = new Label("Startup Type:");
    startupTypeLabel.setSizeUndefined();
    this.startupType = new ComboBox();
    this.startupType.addItem(StartupType.MANUAL);
    this.startupType.setItemCaption(StartupType.MANUAL, "Manual");
    this.startupType.addItem(StartupType.AUTOMATIC);
    this.startupType.setItemCaption(StartupType.AUTOMATIC, "Automatic");
    this.startupType.addItem(StartupType.DISABLED);
    this.startupType.setItemCaption(StartupType.DISABLED, "Disabled");
    this.startupType.setPropertyDataSource(startupControlItem.getItemProperty("startupType"));
    this.startupType.setNullSelectionAllowed(false);

    this.startupType.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.startupType.setWidth("90%");
    this.startupType.setValidationVisible(false);

    gridLayout.addComponent(startupTypeLabel, 0, 3);
    gridLayout.setComponentAlignment(startupTypeLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.startupType, 1, 3);

    Label commentLabel = new Label("Comment:");
    commentLabel.setSizeUndefined();
    this.comment = new TextArea();
    this.comment.setRows(3);
    this.comment.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.comment.setWidth("90%");
    this.comment.setValidationVisible(false);
    this.comment.setNullRepresentation("");
    this.comment.setPropertyDataSource(startupControlItem.getItemProperty("comment"));

    gridLayout.addComponent(commentLabel, 0, 4);
    gridLayout.setComponentAlignment(commentLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.comment, 1, 4);

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

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(saveButton);
    buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

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

    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            StartupControl sc = startupControlItem.getBean();

            if (((StartupType) startupType.getValue()) == StartupType.DISABLED
                    && (comment.getValue() == null || comment.getValue().length() == 0)) {
                Notification.show("A comment must be entered for a 'Disabled' start up type!",
                        Type.ERROR_MESSAGE);

                return;
            } else {
                final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService
                        .getCurrentRequest().getWrappedSession()
                        .getAttribute(DashboardSessionValueConstants.USER);

                StartupControlConfigurationWindow.this.startupControlService.setStartupType(sc.getModuleName(),
                        sc.getFlowName(), (StartupType) startupType.getValue(), comment.getValue(),
                        authentication.getName());

                Notification.show("Saved!");
            }
        }
    });

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

    this.setContent(gridLayout);
}

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

License:BSD License

/**
  * Helper method to initialise this object.
  * //ww w  .j ava2  s .c  om
  * @param message
  */
protected void init() {
    setModal(true);
    setHeight("90%");
    setWidth("90%");

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

    Label wiretapLabel = new Label("Wiretap Configuration");
    wiretapLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(wiretapLabel);

    Label moduleNameLabel = new Label();
    moduleNameLabel.setContentMode(ContentMode.HTML);
    moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:");
    moduleNameLabel.setSizeUndefined();
    layout.addComponent(moduleNameLabel, 0, 1);
    layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT);

    TextField moduleNameTextField = new TextField();
    moduleNameTextField.setRequired(true);
    moduleNameTextField.setValue(this.component.getFlow().getModule().getName());
    moduleNameTextField.setReadOnly(true);
    moduleNameTextField.setWidth("80%");
    layout.addComponent(moduleNameTextField, 1, 1);

    Label flowNameLabel = new Label();
    flowNameLabel.setContentMode(ContentMode.HTML);
    flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:");
    flowNameLabel.setSizeUndefined();
    layout.addComponent(flowNameLabel, 0, 2);
    layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT);

    TextField flowNameTextField = new TextField();
    flowNameTextField.setRequired(true);
    flowNameTextField.setValue(this.component.getFlow().getName());
    flowNameTextField.setReadOnly(true);
    flowNameTextField.setWidth("80%");
    layout.addComponent(flowNameTextField, 1, 2);

    Label componentNameLabel = new Label();
    componentNameLabel.setContentMode(ContentMode.HTML);
    componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:");
    componentNameLabel.setSizeUndefined();
    layout.addComponent(componentNameLabel, 0, 3);
    layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT);

    TextField componentNameTextField = new TextField();
    componentNameTextField.setRequired(true);
    componentNameTextField.setValue(this.component.getName());
    componentNameTextField.setReadOnly(true);
    componentNameTextField.setWidth("80%");
    layout.addComponent(componentNameTextField, 1, 3);

    Label errorCategoryLabel = new Label("Relationship:");
    errorCategoryLabel.setSizeUndefined();
    layout.addComponent(errorCategoryLabel, 0, 4);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT);

    final ComboBox relationshipCombo = new ComboBox();
    //      relationshipCombo.addValidator(new StringLengthValidator(
    //               "An relationship must be selected!", 1, -1, false));
    relationshipCombo.setImmediate(false);
    relationshipCombo.setValidationVisible(false);
    relationshipCombo.setRequired(true);
    relationshipCombo.setRequiredError("A relationship must be selected!");
    relationshipCombo.setHeight("30px");
    relationshipCombo.setNullSelectionAllowed(false);
    layout.addComponent(relationshipCombo, 1, 4);
    relationshipCombo.addItem("before");
    relationshipCombo.setItemCaption("before", "Before");
    relationshipCombo.addItem("after");
    relationshipCombo.setItemCaption("after", "After");

    Label jobTypeLabel = new Label("Job Type:");
    jobTypeLabel.setSizeUndefined();
    layout.addComponent(jobTypeLabel, 0, 5);
    layout.setComponentAlignment(jobTypeLabel, Alignment.MIDDLE_RIGHT);

    final ComboBox jobTopCombo = new ComboBox();
    //      jobTopCombo.addValidator(new StringLengthValidator(
    //               "A job type must be selected!", 1, -1, false));
    jobTopCombo.setImmediate(false);
    jobTopCombo.setValidationVisible(false);
    jobTopCombo.setRequired(true);
    jobTopCombo.setRequiredError("A job type must be selected!");
    jobTopCombo.setHeight("30px");
    jobTopCombo.setNullSelectionAllowed(false);
    layout.addComponent(jobTopCombo, 1, 5);
    jobTopCombo.addItem("loggingJob");
    jobTopCombo.setItemCaption("loggingJob", "Logging Job");
    jobTopCombo.addItem("wiretapJob");
    jobTopCombo.setItemCaption("wiretapJob", "Wiretap Job");

    final Label timeToLiveLabel = new Label("Time to Live:");
    timeToLiveLabel.setSizeUndefined();
    timeToLiveLabel.setVisible(false);
    layout.addComponent(timeToLiveLabel, 0, 6);
    layout.setComponentAlignment(timeToLiveLabel, Alignment.MIDDLE_RIGHT);

    final TextField timeToLiveTextField = new TextField();
    timeToLiveTextField.setRequired(true);
    timeToLiveTextField.setValidationVisible(false);
    jobTopCombo.setRequiredError("A time to live value must be entered!");
    timeToLiveTextField.setVisible(false);
    timeToLiveTextField.setWidth("40%");
    layout.addComponent(timeToLiveTextField, 1, 6);

    jobTopCombo.addValueChangeListener(new ComboBox.ValueChangeListener() {

        /* (non-Javadoc)
         * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent)
         */
        @Override
        public void valueChange(ValueChangeEvent event) {
            String value = (String) event.getProperty().getValue();

            if (value.equals("wiretapJob")) {
                timeToLiveLabel.setVisible(true);
                timeToLiveTextField.setVisible(true);
            } else {
                timeToLiveLabel.setVisible(false);
                timeToLiveTextField.setVisible(false);
            }
        }

    });

    GridLayout buttonLayouts = new GridLayout(3, 1);
    buttonLayouts.setSpacing(true);

    Button saveButton = new Button("Save");
    saveButton.setStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                relationshipCombo.validate();
                jobTopCombo.validate();

                if (timeToLiveTextField.isVisible()) {
                    timeToLiveTextField.validate();
                }
            } catch (InvalidValueException e) {
                relationshipCombo.setValidationVisible(true);
                relationshipCombo.markAsDirty();
                jobTopCombo.setValidationVisible(true);
                jobTopCombo.markAsDirty();

                if (timeToLiveTextField.isVisible()) {
                    timeToLiveTextField.setValidationVisible(true);
                    timeToLiveTextField.markAsDirty();
                }

                Notification.show("There are errors on the wiretap creation form!", Type.ERROR_MESSAGE);
                return;
            }

            createWiretap((String) relationshipCombo.getValue(), (String) jobTopCombo.getValue(),
                    timeToLiveTextField.getValue());
        }
    });

    Button cancelButton = new Button("Cancel");
    cancelButton.setStyleName(ValoTheme.BUTTON_SMALL);
    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    buttonLayouts.addComponent(saveButton);
    buttonLayouts.addComponent(cancelButton);

    layout.addComponent(buttonLayouts, 0, 7, 1, 7);
    layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER);

    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");
    paramPanel.setContent(layout);

    triggerTable = new Table();

    Label existingWiretapLabel = new Label("Existing Wiretaps");
    existingWiretapLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(existingWiretapLabel, 0, 8, 1, 8);

    layout.addComponent(triggerTable, 0, 9, 1, 9);
    layout.setComponentAlignment(triggerTable, Alignment.TOP_CENTER);

    this.triggerTable.setWidth("80%");
    this.triggerTable.setHeight(150, Unit.PIXELS);
    this.triggerTable.setCellStyleGenerator(new IkasanCellStyleGenerator());
    this.triggerTable.addStyleName(ValoTheme.TABLE_SMALL);
    this.triggerTable.addStyleName("ikasan");
    this.triggerTable.addContainerProperty("Job Type", String.class, null);
    this.triggerTable.addContainerProperty("Relationship", String.class, null);
    this.triggerTable.addContainerProperty("Trigger Parameters", String.class, null);
    this.triggerTable.addContainerProperty("", Button.class, null);

    refreshTriggerTable();

    GridLayout wrapper = new GridLayout(1, 1);
    wrapper.setMargin(true);
    wrapper.setSizeFull();
    wrapper.addComponent(paramPanel);

    this.setContent(wrapper);
}

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

License:BSD License

protected Panel createWiretapDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();
    errorOccurrenceDetailsPanel.setSizeFull();
    errorOccurrenceDetailsPanel.setStyleName("dashboard");

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

    Label wiretapDetailsLabel = new Label("Wiretap Details");
    wiretapDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(wiretapDetailsLabel);

    Label moduleNameLabel = new Label("Module Name:");
    moduleNameLabel.setSizeUndefined();

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

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

    Label flowNameLabel = new Label("Flow Name:");
    flowNameLabel.setSizeUndefined();

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

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

    Label componentNameLabel = new Label("Component Name:");
    componentNameLabel.setSizeUndefined();

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

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

    Label dateTimeLabel = new Label("Date/Time:");
    dateTimeLabel.setSizeUndefined();

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

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

    Label eventIdLabel = new Label("Event Id:");
    eventIdLabel.setSizeUndefined();

    layout.addComponent(eventIdLabel, 0, 5);
    layout.setComponentAlignment(eventIdLabel, Alignment.MIDDLE_RIGHT);

    TextField tf5 = new TextField();
    tf5.setValue(((WiretapFlowEvent) wiretapEvent).getEventId());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    layout.addComponent(tf5, 1, 5);

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

    AceEditor editor = new AceEditor();
    editor.setCaption("Event");
    editor.setValue(this.wiretapEvent.getEvent());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setWidth("100%");
    editor.setHeight(550, Unit.PIXELS);

    //      HorizontalLayout formLayout = new HorizontalLayout();
    //      formLayout.setWidth("100%");
    //      formLayout.setHeight(120, Unit.PIXELS);
    //      formLayout.addComponent(layout);
    wrapperLayout.addComponent(layout, 0, 0);
    wrapperLayout.addComponent(editor, 0, 2);
    wrapperLayout.setComponentAlignment(editor, Alignment.TOP_LEFT);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.investovator.ui.dataplayback.admin.DataPlaybackEngineAdminDashboard.java

License:Open Source License

public DataPlaybackEngineAdminDashboard() {
    this.content = new GridLayout(3, 2);
    this.setContent(this.content);
}

From source file:org.investovator.ui.dataplayback.user.dashboard.dailysummary.DailySummarySinglePlayerMainView.java

License:Open Source License

public DailySummarySinglePlayerMainView() {
    //set a link to this class
    mySelf = this;

    content = new GridLayout(3, 3);
    content.setSizeFull();

}

From source file:org.investovator.ui.utils.dashboard.dataplayback.BasicMainView.java

License:Open Source License

public void setupPanel() {
    //clear everything
    //        content.removeAllComponents();

    //add components only if components have not already been added
    if (content.getComponentCount() == 0) {

        //Main chart
        HorizontalLayout chartContainer = new HorizontalLayout();
        chartContainer.setWidth(95, Unit.PERCENTAGE);
        chartContainer.setMargin(true);/*w  ww . j  a  v  a2s. c om*/
        //            chartContainer.setHeight(30,Unit.PERCENTAGE);
        mainChart = buildMainChart();
        chartContainer.addComponent(mainChart);
        chartContainer.setComponentAlignment(mainChart, Alignment.MIDDLE_CENTER);
        chartContainer.setCaption(mainChart.getCaption());
        //            chartContainer.setCaption("Price");
        //            chartContainer.addStyleName("center-caption");

        content.addComponent(chartContainer);
        content.setExpandRatio(chartContainer, 1.3f);
        content.setComponentAlignment(chartContainer, Alignment.MIDDLE_CENTER);

        //Quantity chart
        HorizontalLayout quantityChartContainer = new HorizontalLayout();
        quantityChartContainer.setWidth(95, Unit.PERCENTAGE);
        //            quantityChartContainer.setMargin(true);
        quantityChartContainer.setMargin(new MarginInfo(true, true, false, true));
        //            quantityChartContainer.setHeight(30,Unit.PERCENTAGE);
        quantityChart = buildQuantityChart();
        quantityChartContainer.addComponent(quantityChart);
        quantityChartContainer.setComponentAlignment(quantityChart, Alignment.MIDDLE_CENTER);
        //            quantityChartContainer.setCaption("Quantity");
        //            quantityChartContainer.addStyleName("center-caption");

        content.addComponent(quantityChartContainer);
        content.setExpandRatio(quantityChartContainer, 1.0f);

        content.setComponentAlignment(quantityChartContainer, Alignment.MIDDLE_CENTER);

        //bottom row conatainer
        HorizontalLayout bottowRow = new HorizontalLayout();
        bottowRow.setWidth(100, Unit.PERCENTAGE);
        content.addComponent(bottowRow);
        content.setExpandRatio(bottowRow, 1.0f);

        //Stock price table
        GridLayout stockPriceTableContainer = new GridLayout(1, 2);
        //add a caption to the table
        //            Label tableCaption=new Label("Stock Price Table");
        //            stockPriceTableContainer.addComponent(tableCaption, 0, 0);
        //            stockPriceTableContainer.setComponentAlignment(tableCaption,Alignment.MIDDLE_RIGHT);
        stockPriceTable = setupStockPriceTable();
        stockPriceTableContainer.addComponent(stockPriceTable, 0, 1);
        stockPriceTableContainer.setMargin(new MarginInfo(false, true, true, true));
        stockPriceTableContainer.setCaption("Stock Price Table");
        stockPriceTableContainer.addStyleName("center-caption");

        stockPriceTableContainer.setComponentAlignment(stockPriceTable, Alignment.MIDDLE_CENTER);
        bottowRow.addComponent(stockPriceTableContainer);
        //            bottowRow.setExpandRatio(stockPriceTableContainer,1.0f);

        //buy-sell window
        GridLayout buySellWindowContainer = new GridLayout(1, 2);
        //            //add a caption to the table
        //            Label buySellWindowCaption=new Label("Buy/Sell Stocks");
        //            buySellWindowContainer.addComponent(buySellWindowCaption,0,0);
        //            buySellWindowContainer.setComponentAlignment(buySellWindowCaption,Alignment.MIDDLE_CENTER);
        Component buySellWindow = setupBuySellForm();
        buySellWindowContainer.addComponent(buySellWindow, 0, 1);
        buySellWindowContainer.setMargin(new MarginInfo(false, false, true, false));
        buySellWindowContainer.setCaption("Buy/Sell Stocks");
        buySellWindowContainer.addStyleName("center-caption");

        buySellWindowContainer.setComponentAlignment(buySellWindow, Alignment.MIDDLE_CENTER);
        bottowRow.addComponent(buySellWindowContainer);
        //            bottowRow.setExpandRatio(buySellWindowContainer,1.0f);

        //portfolio data
        //            VerticalLayout myPortfolioLayout=new VerticalLayout();
        //            myPortfolioLayout.setMargin(new MarginInfo(false,true,true,true));
        //            bottowRow.addComponent(myPortfolioLayout);
        //add a caption to the table
        //            Label portfolioCaption=new Label("My Portfolio");
        //            myPortfolioLayout.addComponent(portfolioCaption);
        //            myPortfolioLayout.setComponentAlignment(portfolioCaption,Alignment.MIDDLE_CENTER);

        HorizontalLayout portfolioContainer = new HorizontalLayout();
        portfolioContainer.setMargin(new MarginInfo(false, true, true, true));
        portfolioContainer.setCaption("My Portfolio");
        portfolioContainer.addStyleName("center-caption");
        bottowRow.addComponent(portfolioContainer);
        //            bottowRow.setExpandRatio(portfolioContainer,1.0f);

        //portfolio table
        portfolioTable = setupPortfolioTable();
        portfolioContainer.addComponent(portfolioTable);
        //            portfolioContainer.setExpandRatio(portfolioTable,1.0f);

        //profit chart
        //            HorizontalLayout profitContainer = new HorizontalLayout();
        //            bottowRow.addComponent(profitContainer);

        profitChart = setupProfitChart();
        profitChart.setCaption("Profit Chart");
        profitChart.addStyleName("center-caption");
        bottowRow.addComponent(profitChart);
        bottowRow.setExpandRatio(profitChart, 1.3f);

        //            Component accountInfo=setUpAccountInfoForm();
        //            accountInfo.setCaption("Profit Chart");
        //            accountInfo.addStyleName("center-caption");
        //
        //            bottowRow.addComponent(accountInfo);
        //            bottowRow.setExpandRatio(accountInfo,1.3f);

        this.setContent(content);
    }

}

From source file:org.investovator.ui.utils.dashboard.DecisionMakerPanel.java

License:Open Source License

public DecisionMakerPanel() {
    this.slowPeriod = 26;
    this.quickPeriod = 12;

    this.content = new GridLayout(2, 2);
    this.setContent(this.content);
    this.generatorFactory = new MASignalGenFactory();
}