Example usage for com.vaadin.ui ComboBox ComboBox

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

Introduction

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

Prototype

public ComboBox() 

Source Link

Document

Constructs an empty combo box without a caption.

Usage

From source file:org.iespuigcastellar.attendancemanager.screenlayouts.TeacherMainLayout.java

License:Open Source License

private void initLayout() {

    passwordChangeWindow = new PasswordChangeWindow();
    passwordChangeWindow.setCaption(app.locale.getString("TEACHERMAINLAYOUT_CHANGEMYPASSWORD_BUTTON"));

    datePopupDateField = new PopupDateField("");
    datePopupDateField.setDescription(app.locale.getString("TEACHERMAINLAYOUT_DATEFIELD_DESCRIPTION"));
    datePopupDateField.setValue(new java.util.Date());
    datePopupDateField.setResolution(PopupDateField.RESOLUTION_DAY);
    datePopupDateField.setImmediate(true);
    datePopupDateField.addListener(ValueChangeEvent.class, this, "changedDate");

    classblockComboBox = new ComboBox();
    classblockComboBox.setInputPrompt(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_INPUTPROMPT"));
    classblockComboBox.setDescription(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_DESCRIPTION"));
    classblockComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
    classblockComboBox.setImmediate(true);
    classblockComboBox.addContainerProperty("name", String.class, "");
    classblockComboBox.setItemCaptionPropertyId("name");
    classblockComboBox.addListener(ValueChangeEvent.class, this, "changedClassblock");

    Button logoutButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_LOGOUTBUTTON_CAPTION"));

    logoutButton.addListener(new Button.ClickListener() {
        @Override// w  w  w. j a  va2s  . c  o  m
        public void buttonClick(ClickEvent event) {
            Logger.log("User " + app.user.getLogin() + " closes session");
            app.storage.close();
            getApplication().close();
        }
    });

    Button changePasswordButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_CHANGEMYPASSWORD_BUTTON"));
    changePasswordButton.setIcon(new ThemeResource("../runo/icons/16/user.png"));
    changePasswordButton.setStyleName(Button.STYLE_LINK);
    changePasswordButton.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            // Open window if not open already
            if (passwordChangeWindow.getParent() != null) {
                // Window already open
            } else {
                // open window
                getWindow().addWindow(passwordChangeWindow);
            }
        }
    });

    GridLayout optionsGridLayout = new GridLayout(2, 1);
    HorizontalLayout haLayout = new HorizontalLayout();

    haLayout.setSpacing(true);

    haLayout.addComponent(changePasswordButton);
    haLayout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_LEFT);
    haLayout.addComponent(datePopupDateField);
    haLayout.addComponent(classblockComboBox);

    optionsGridLayout.addComponent(haLayout);
    optionsGridLayout.addComponent(logoutButton);
    optionsGridLayout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT);
    optionsGridLayout.setWidth("100%");

    addComponent(optionsGridLayout);

    table.setSizeFull();
    table.setImmediate(true);
    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(true);
    table.addContainerProperty("Name", String.class, null);
    table.addContainerProperty("Surname 1", String.class, null);
    table.addContainerProperty("Surname 2", String.class, null);
    table.addContainerProperty("Miss", CheckBox.class, null);
    table.addContainerProperty("Excused", CheckBox.class, null);
    table.addContainerProperty("Delay", CheckBox.class, null);
    table.addContainerProperty("Expulsion", CheckBox.class, null);

    table.setColumnExpandRatio("Name", 1);
    table.setColumnExpandRatio("Surname 1", 1);
    table.setColumnExpandRatio("Surname 2", 1);

    table.setColumnHeaders(new String[] { app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_NAME"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME1"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME2"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_MISS"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXCUSED"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_DELAY"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXPULSION") });
    addComponent(table);
    setExpandRatio(table, 1);
    setSizeFull();
}

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

License:BSD License

/**
  * Helper method to initialise this object.
  * /*from  w  ww. java 2s .c  om*/
  * @param message
  */
protected void init() {
    this.setSizeFull();
    this.setModal(true);

    this.serverCombo = new ComboBox();
    this.moduleCombo = new ComboBox();

    this.createSearchPanel();
    this.createResultsPanel();

    VerticalLayout leftPanelLayout = new VerticalLayout();
    leftPanelLayout.setMargin(true);
    leftPanelLayout.setWidth(320, Unit.PIXELS);
    leftPanelLayout.setHeight("100%");
    leftPanelLayout.addComponent(this.searchPanel);

    HorizontalLayout rightPanelLayout = new HorizontalLayout();
    rightPanelLayout.setSizeFull();
    rightPanelLayout.setMargin(true);
    rightPanelLayout.addComponent(this.resultsPanel);

    this.horizontalSplitPanel = new HorizontalSplitPanel(leftPanelLayout, rightPanelLayout);
    this.horizontalSplitPanel.setSizeFull();
    this.horizontalSplitPanel.setSplitPosition(320, Unit.PIXELS);
    this.horizontalSplitPanel.setLocked(true);
    this.horizontalSplitPanel.addStyleName("ikasansplitpanel");
    this.setContent(horizontalSplitPanel);
}

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

License:BSD License

/**
  * Helper method to initialise this object.
  * /* ww  w. j  av a2  s.com*/
  * @param message
  */
protected void init() {
    this.setSizeFull();
    this.setModal(true);

    this.serverCombo = new ComboBox();

    this.createSearchPanel();
    this.createResultsPanel();

    VerticalLayout leftPanelLayout = new VerticalLayout();
    leftPanelLayout.setMargin(true);
    leftPanelLayout.setWidth(320, Unit.PIXELS);
    leftPanelLayout.setHeight("100%");
    leftPanelLayout.addComponent(this.searchPanel);

    HorizontalLayout rightPanelLayout = new HorizontalLayout();
    rightPanelLayout.setSizeFull();
    rightPanelLayout.setMargin(true);
    rightPanelLayout.addComponent(this.resultsPanel);

    this.horizontalSplitPanel = new HorizontalSplitPanel(leftPanelLayout, rightPanelLayout);
    this.horizontalSplitPanel.setSizeFull();
    this.horizontalSplitPanel.setSplitPosition(320, Unit.PIXELS);
    this.horizontalSplitPanel.setLocked(true);
    this.horizontalSplitPanel.addStyleName("ikasansplitpanel");
    this.setContent(horizontalSplitPanel);
}

From source file:org.ikasan.dashboard.ui.topology.panel.TopologyViewPanel.java

License:BSD License

protected void init() {
    this.tabsheetPanel = new Panel();
    this.tabsheetPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    this.tabsheetPanel.setSizeFull();

    this.createModuleTreePanel();

    this.setWidth("100%");
    this.setHeight("100%");

    this.businessStreamCombo = new ComboBox();

    HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
    hsplit.setStyleName(ValoTheme.SPLITPANEL_LARGE);

    HorizontalLayout leftLayout = new HorizontalLayout();
    leftLayout.setSizeFull();//from   w ww . j  ava 2 s  .c  o m
    leftLayout.setMargin(true);
    leftLayout.addComponent(this.topologyTreePanel);
    hsplit.setFirstComponent(leftLayout);
    HorizontalLayout rightLayout = new HorizontalLayout();
    rightLayout.setSizeFull();
    rightLayout.setMargin(true);
    rightLayout.addComponent(this.tabsheetPanel);
    hsplit.setSecondComponent(rightLayout);
    hsplit.setSplitPosition(30, Unit.PERCENTAGE);

    this.flowStates = this.topologyCache.getStateMap();

    this.setContent(hsplit);
}

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

License:BSD License

protected void setupComboBoxesAndItems() {
    layout.removeComponent(actionCombo);
    layout.removeComponent(errorCategoryCombo);
    actionCombo = new ComboBox();
    actionCombo.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("action"));
    actionCombo.setRequired(true);//from  w  ww .  ja  v  a  2  s  .c o  m
    actionCombo.setRequiredError("An action must be selected!");
    actionCombo.setValidationVisible(false);
    actionCombo.setNullSelectionAllowed(false);
    actionCombo.addValidator(new StringLengthValidator("An action must be selected!", 1, -1, false));
    actionCombo.setHeight("30px");

    errorCategoryCombo = new ComboBox();
    errorCategoryCombo
            .addValidator(new StringLengthValidator("An error category must be selected!", 1, -1, false));
    errorCategoryCombo.setValidationVisible(false);
    errorCategoryCombo.setPropertyDataSource(errorCategorisationItem.getItemProperty("errorCategory"));
    errorCategoryCombo.setRequired(true);
    errorCategoryCombo.setHeight("30px");
    errorCategoryCombo.setNullSelectionAllowed(false);

    actionCombo.addItem(ErrorCategorisationLink.EXCLUDE_EVENT_ACTION);
    actionCombo.addItem(ErrorCategorisationLink.RETRY_ACTION);
    actionCombo.addItem(ErrorCategorisationLink.STOP_ACTION);

    errorCategoryCombo.addItem(ErrorCategorisation.TRIVIAL);
    errorCategoryCombo.setItemIcon(ErrorCategorisation.TRIVIAL, VaadinIcons.ARROW_DOWN);
    errorCategoryCombo.addItem(ErrorCategorisation.MAJOR);
    errorCategoryCombo.setItemIcon(ErrorCategorisation.MAJOR, VaadinIcons.ARROW_UP);
    errorCategoryCombo.addItem(ErrorCategorisation.CRITICAL);
    errorCategoryCombo.setItemIcon(ErrorCategorisation.CRITICAL, VaadinIcons.EXCLAMATION_CIRCLE_O);
    errorCategoryCombo.addItem(ErrorCategorisation.BLOCKER);
    errorCategoryCombo.setItemIcon(ErrorCategorisation.BLOCKER, VaadinIcons.BAN);

    layout.addComponent(actionCombo, 1, 6);
    layout.addComponent(errorCategoryCombo, 1, 7);
}

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

License:BSD License

/**
  * Helper method to initialise this object.
  * /*from   w  ww .ja  v  a  2 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.
  * // w  w w .  j ava  2s.  c o m
  * @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.investovator.ui.main.components.DataUploadWindow.java

License:Open Source License

private void setLayout() {

    //Window Properties
    setCaption("Upload Data");
    setResizable(false);/*  w w  w .  j a v a 2  s.c  o  m*/
    setClosable(true);
    setModal(true);
    center();

    content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(true);

    companySelectLayout = new HorizontalLayout();
    companyDetailUploadLayout = new HorizontalLayout();
    newCompanyForm = new FormLayout();

    newCompanyCheckBox = new CheckBox("New Company");

    companySelect = new ComboBox();

    companySelect = new ComboBox();
    companySelect.setNullSelectionAllowed(false);
    companySelect.setImmediate(true);

    dataTypeSelect = new ComboBox();
    dataTypeSelect.setNullSelectionAllowed(false);

    dataUpload = new Upload();
    dataUpload.setCaption("Select Data File");
    dataUpload.setButtonCaption(null);

    detailUpload = new Upload();
    detailUpload.setCaption("select Company Info XML");
    detailUpload.setButtonCaption(null);

    symbol = new TextField("Company Symbol");
    symbol.setRequired(true);
    companyName = new TextField("Company Name");
    companyName.setRequired(true);

    submitButton = new Button("Upload Data");

    newCompanyForm.addComponent(symbol);
    newCompanyForm.addComponent(companyName);

    companyDetailUploadLayout.addComponent(detailUpload);

    companySelectLayout.addComponent(companySelect);
    companySelectLayout.addComponent(newCompanyCheckBox);

    content.addComponent(companySelectLayout);
    content.addComponent(dataTypeSelect);
    content.addComponent(dataUpload);
    content.addComponent(submitButton);

    content.setComponentAlignment(submitButton, Alignment.MIDDLE_CENTER);

    setContent(content);
    setDefaults();
    bindListeners();

}

From source file:org.investovator.ui.nngaming.QuoteUI.java

License:Open Source License

private void setupUI() {

    //Trade Button
    tradeButton = new Button("Place Order");
    tradeButton.addClickListener(tradeButtonClickListener);
    tradeButton.setWidth("100%");

    //Price Layout
    price = new TextField("Price");
    price.addValueChangeListener(priceValueChangedListener);
    price.setImmediate(true);/*from  w w  w. j a  va2 s. c om*/
    price.setWidth("100%");

    amount = new Label();
    amount.setCaption("Amount");
    amount.addStyleName("outlined");
    amount.setWidth("100%");

    stocks = new TextField("Stocks");
    stocks.addValueChangeListener(stocksChangedListener);
    stocks.setImmediate(true);
    stocks.setWidth("100%");

    //Stock Select
    stockSelect = new ComboBox();
    stockSelect.setCaption("Select stock to trade");
    stockSelect.setNullSelectionAllowed(false);
    stockSelect.setImmediate(true);
    stockSelect.setWidth("100%");
    stockSelect.addValueChangeListener(selectSymbolValueChange);

    VerticalLayout column1 = new VerticalLayout();
    column1.setSpacing(true);
    column1.setWidth("100%");
    column1.addComponent(stockSelect);
    column1.setComponentAlignment(stockSelect, Alignment.MIDDLE_LEFT);
    column1.addComponent(price);
    column1.setComponentAlignment(price, Alignment.MIDDLE_LEFT);
    column1.addComponent(amount);
    column1.setComponentAlignment(amount, Alignment.MIDDLE_LEFT);

    //Side Select
    sideSelect = new ComboBox("Select Order Type");
    sideSelect.addItem("Buy Order");
    sideSelect.addItem("Sell Order");
    sideSelect.select("Buy Order");
    isBuy = true;
    sideSelect.setNullSelectionAllowed(false);
    sideSelect.addValueChangeListener(sideSelectValueChangeListener);
    sideSelect.setImmediate(true);
    sideSelect.setWidth("100%");

    VerticalLayout column2 = new VerticalLayout();

    column2.setSpacing(true);
    column2.setWidth("100%");
    column2.addComponent(sideSelect);
    column2.setComponentAlignment(sideSelect, Alignment.MIDDLE_RIGHT);
    column2.addComponent(stocks);
    column2.setComponentAlignment(stocks, Alignment.MIDDLE_RIGHT);
    column2.addComponent(tradeButton);
    column2.setComponentAlignment(tradeButton, Alignment.BOTTOM_RIGHT);

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(column1);
    layout.addComponent(column2);
    layout.setSpacing(true);

    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.MIDDLE_RIGHT);
    this.setSpacing(true);
    this.setMargin(new MarginInfo(false, false, false, true));
    this.setImmediate(true);
    this.setWidth("100%");

}

From source file:org.investovator.ui.nngaming.StockAnalysisView.java

License:Open Source License

private void createParameterSelect() {
    stockSelect = new ComboBox();
    stockSelect.setCaption("Select StockID");
    stockSelect.setImmediate(true);//w  ww. j  av  a2s.com
    stockSelect.setNullSelectionAllowed(false);
}