Example usage for com.vaadin.ui HorizontalLayout setExpandRatio

List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio

Introduction

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

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:org.hip.vif.web.util.ConfigViewHelper.java

License:Open Source License

/** Creates an input field on a horizontal layout.
 *
 * @param inField Field<?> the field to place
 * @param inMsgKey String the message key for the field label
 * @param inMessages {@link IMessages}/* w  w w.  j av a 2 s . c om*/
 * @return {@link HorizontalLayout} */
public HorizontalLayout createInput(final Field<?> inField, final String inMsgKey, final IMessages inMessages) {
    final HorizontalLayout out = new HorizontalLayout();
    out.setSizeFull();
    out.addComponent(inField);

    final Label lDescription = new Label(
            String.format(VIFViewHelper.TMPL_TITLE, "vif-contribution-date", inMessages.getMessage(inMsgKey)), //$NON-NLS-1$
            ContentMode.HTML);
    out.addComponent(lDescription);
    out.setExpandRatio(lDescription, 1);
    return out;
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

VerticalLayout buildWelcomeScreen() {
    VerticalLayout layoutForWelcomeTab = new VerticalLayout();
    layoutForWelcomeTab.setMargin(true);
    layoutForWelcomeTab.setSpacing(true);
    layoutForWelcomeTab.setCaption("Welcome");
    layoutForWelcomeTab.setStyleName(Reindeer.LAYOUT_WHITE);

    CssLayout cssLayout = new CssLayout();
    cssLayout.setMargin(true);/*from ww  w  . jav  a 2s . c o m*/
    cssLayout.setWidth("100%");
    layoutForWelcomeTab.addComponent(cssLayout);

    HeadingOne title = new HeadingOne("Welcome to Genotyping Data Management");
    cssLayout.addComponent(title);

    HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout();

    horizLayoutForIntroPara.setSpacing(true);
    horizLayoutForIntroPara.setWidth("100%");
    horizLayoutForIntroPara.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayoutForIntroPara);

    String strIntroPara1 = "<p>The Genotyping Data Management System aims to provide a comprehensive public repository "
            + "for genotype, linkage map and QTL data from crop species relevant in the semi-arid tropics.</p>";

    String strIntroPara2 = "<p>This system is developed in Java and the database is MySQL. The initial release record "
            + "details of current genotype datasets generated for GCP mandate crops along with details of "
            + "molecular markers and related metadata. The Retrieve tab is a good starting point to browse "
            + "or query the database contents. The datasets available for each crop species can be queried. "
            + "Access to data sets requires a login.</p>";

    String strIntroPara3 = "<p>Data may be currently exported to the following formats: 2x2 matrix and flapjack software formats. "
            + "Data submission is through templates; upload templates are available for genotype, QTL and "
            + "map data(type of markers - SSR, SNP and DArt). The templates are in the form of excel sheets with built-in "
            + "validation functions.</p>";

    Label lblPara = new Label(strIntroPara1 + strIntroPara2 + strIntroPara3, Label.CONTENT_XHTML);
    horizLayoutForIntroPara.addComponent(lblPara);
    horizLayoutForIntroPara.setExpandRatio(lblPara, 1);

    //Spacer
    lblPara = new Label("");
    lblPara.setWidth("20px");
    horizLayoutForIntroPara.addComponent(lblPara);

    ThemeResource themeResource = new ThemeResource("images/FlowChart.jpg");
    Embedded headerImage = new Embedded("", themeResource);

    headerImage.setWidth("500px");
    headerImage.setHeight("400px");
    horizLayoutForIntroPara.addComponent(headerImage);

    return layoutForWelcomeTab;
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

VerticalLayout buildAboutScreen() {
    VerticalLayout layoutForAboutTab = new VerticalLayout();
    layoutForAboutTab.setMargin(true);/*from   ww w. j  a v  a2s  . c  o m*/
    layoutForAboutTab.setSpacing(true);
    layoutForAboutTab.setCaption("About");
    layoutForAboutTab.setStyleName(Reindeer.LAYOUT_WHITE);

    CssLayout cssLayout = new CssLayout();
    cssLayout.setMargin(true);
    cssLayout.setWidth("100%");
    layoutForAboutTab.addComponent(cssLayout);

    HeadingOne title = new HeadingOne("About GDMS Version");
    cssLayout.addComponent(title);

    HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout();

    horizLayoutForIntroPara.setSpacing(true);
    //horizLayoutForIntroPara.setWidth("100%");
    horizLayoutForIntroPara.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayoutForIntroPara);
    //_main.getApplication().getContext().getBaseDirectory();
    WebApplicationContext ctx = (WebApplicationContext) _main.getApplication().getContext();
    //System.out.println(ctx.getHttpSession().getServletContext().getRealPath("\\"));

    final String strTemplateFolderPath = ctx.getHttpSession().getServletContext().getRealPath("\\");
    final String strFileName = "License Agreement for software rev.doc";

    final String licensePath = strTemplateFolderPath + "\\" + strFileName;
    final String strApplicationVersion = "<p>Application Version : 2.1.10</p>";
    final String strLicense = "";

    String strDBVersion = "<p>Database Verison : IBDBv2</p>";
    String strContact = "<p>Contact : <a href='mailto:bioinformatics@cgiar.org'>bioinformatics@cgiar.org </a></p>";
    Label lblPara = new Label(strApplicationVersion + strDBVersion + strContact, Label.CONTENT_XHTML);
    horizLayoutForIntroPara.addComponent(lblPara);
    horizLayoutForIntroPara.setExpandRatio(lblPara, 1);

    HorizontalLayout horizLayout = new HorizontalLayout();
    horizLayout.setSpacing(true);
    //horizLayout.setWidth("50%");
    horizLayout.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayout);
    //cssLayout.setWidth("600px");

    btnDownloadMarker = new Button("License Information");
    btnDownloadMarker.setImmediate(true);
    btnDownloadMarker.setStyleName(Reindeer.BUTTON_LINK);
    btnDownloadMarker.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            //strLicense = "License Information";

            File strFileLoc = new File(strTemplateFolderPath + "\\" + strFileName);
            FileResource fileResource = new FileResource(strFileLoc, _main.getApplication());
            if (strFileName.endsWith(".doc")) {
                _main.getWindow().open(fileResource, "", true);
            }
        }

    });
    //Spacer
    lblPara = new Label("");
    //lblPara.setWidth("20px");
    horizLayout.addComponent(lblPara);
    horizLayout.addComponent(btnDownloadMarker);
    horizLayout.setComponentAlignment(btnDownloadMarker, Alignment.MIDDLE_LEFT);

    return layoutForAboutTab;
}

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

License:Open Source License

public void attach() {
    app = (AttendancemanagerApplication) getApplication();

    loginForm.setDescription(app.locale.getString("LOGINLAYOUT_LOGINFORM_DESCRIPTION"));

    BeanItem<LoginInfo> loginBean = new BeanItem<LoginInfo>(loginInfo);
    loginForm.setItemDataSource(loginBean);

    loginForm.getField("login").setRequired(true);
    loginForm.getField("login").setCaption(app.locale.getString("LOGINLAYOUT_LOGINFORM_LOGINCAPTION"));
    loginForm.getField("login")
            .setRequiredError(app.locale.getString("LOGINLAYOUT_LOGINFORM_LOGINREQUIREDERROR"));
    //loginForm.getField("login").setWidth("15em");
    TextField passwordTextField = (TextField) loginForm.getField("password");
    passwordTextField.setSecret(true);/*from w  w  w  . ja v  a2  s.c om*/
    loginForm.getField("password").setRequired(true);
    loginForm.getField("password").setCaption(app.locale.getString("LOGINLAYOUT_LOGINFORM_PASSWORDCAPTION"));
    loginForm.getField("password")
            .setRequiredError(app.locale.getString("LOGINLAYOUT_LOGINFORM_PASSWORDREQUIREDERROR"));
    loginForm.getField("password").addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            // Password text field value change
            commit();
            System.out.println("event.hashCode() " + event.hashCode());
            System.out.println();
        }
    });
    loginForm.setImmediate(true);

    Button okButton = new Button(app.locale.getString("LOGINLAYOUT_LOGINFORM_OKBUTTON"), this, "commit");
    okButton.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    loginForm.getFooter().addComponent(okButton);

    Panel loginPanel = new Panel(app.locale.getString("LOGINLAYOUT_LOGINPANEL_CAPTION"));
    loginPanel.addComponent(loginForm);

    Panel infoPanel = new Panel(app.locale.getString("LOGINLAYOUT_INFOPANEL_CAPTION"));
    infoPanel.addComponent(new LoginInfoLayout());

    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setWidth("100%");
    loginPanel.setWidth("25em");
    hLayout.addComponent(loginPanel);
    hLayout.addComponent(infoPanel);
    hLayout.setExpandRatio(infoPanel, 1.0f);
    hLayout.setSpacing(true);

    addComponent(hLayout);

    loginForm.getField("login").focus();
}

From source file:org.ikasan.dashboard.ui.administration.panel.PolicyManagementPanel.java

License:BSD License

/**
 * // w w w.ja  v a2  s. c  om
 */
protected Layout initControlLayout() {
    this.cancelButton.setVisible(false);
    this.deleteButton.setVisible(false);

    this.newButton.setIcon(VaadinIcons.PLUS);
    this.newButton.setDescription("Create a New Policy");
    this.newButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.newButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.newButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final NewPolicyWindow newPolicyWindow = new NewPolicyWindow(userService, securityService,
                    policyAssociationMappingSearchWindow, policyAssociationFlowSearchWindow,
                    policyAssociationModuleSearchWindow, policyAssociationBusinessStreamSearchWindow);
            UI.getCurrent().addWindow(newPolicyWindow);

            newPolicyWindow.addCloseListener(new Window.CloseListener() {
                // inline close-listener
                public void windowClose(CloseEvent e) {
                    PolicyManagementPanel.this.policy = newPolicyWindow.getPolicy();

                    PolicyManagementPanel.this.policyItem = new BeanItem<Policy>(
                            PolicyManagementPanel.this.policy);
                    PolicyManagementPanel.this.policyNameField
                            .setText(PolicyManagementPanel.this.policy.getName());
                    PolicyManagementPanel.this.policyNameField
                            .setPropertyDataSource(policyItem.getItemProperty("name"));
                    PolicyManagementPanel.this.descriptionField
                            .setPropertyDataSource(policyItem.getItemProperty("description"));

                    if (PolicyManagementPanel.this.policy.getPolicyLink() != null) {
                        PolicyManagementPanel.this.linkType.setValue(PolicyManagementPanel.this.policy
                                .getPolicyLink().getPolicyLinkType().getName());
                        PolicyManagementPanel.this.linkedEntity
                                .setValue(PolicyManagementPanel.this.policy.getPolicyLink().getName());

                        PolicyManagementPanel.this.linkedEntity.setVisible(true);
                        PolicyManagementPanel.this.linkType.setVisible(true);
                    } else {
                        PolicyManagementPanel.this.linkedEntity.setVisible(false);
                        PolicyManagementPanel.this.linkType.setVisible(false);
                    }

                    PolicyManagementPanel.this.roleTable.removeAllItems();

                    PolicyManagementPanel.this.newButton.setVisible(true);
                    PolicyManagementPanel.this.deleteButton.setVisible(false);
                }
            });
        }
    });

    this.deleteButton.setIcon(VaadinIcons.TRASH);
    this.deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.deleteButton.setDescription("Delete the Current Policy");
    this.deleteButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                PolicyManagementPanel.this.securityService.deletePolicy(policy);

                PolicyManagementPanel.this.policyNameField.setText("");
                PolicyManagementPanel.this.descriptionField.setValue("");
                PolicyManagementPanel.this.linkType.setValue(null);
                PolicyManagementPanel.this.linkedEntity.setValue("");

                PolicyManagementPanel.this.linkedEntity.setVisible(false);

                Notification.show("Deleted");

                PolicyManagementPanel.this.cancelButton.setVisible(false);
                PolicyManagementPanel.this.newButton.setVisible(true);
                PolicyManagementPanel.this.deleteButton.setVisible(false);
            } catch (RuntimeException e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

                Notification.show("Cauget exception trying to delete a Policy!", sw.toString(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    this.cancelButton.setStyleName(ValoTheme.BUTTON_LINK);
    this.cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            PolicyManagementPanel.this.policyNameField.setText("");
            PolicyManagementPanel.this.descriptionField.setValue("");
            PolicyManagementPanel.this.linkType.setValue(null);
            PolicyManagementPanel.this.linkedEntity.setValue("");
            PolicyManagementPanel.this.linkedEntity.setVisible(false);

            PolicyManagementPanel.this.cancelButton.setVisible(false);
            PolicyManagementPanel.this.newButton.setVisible(true);
            PolicyManagementPanel.this.deleteButton.setVisible(false);
        }
    });

    HorizontalLayout controlLayout = new HorizontalLayout();
    controlLayout.setWidth("100%");
    Label spacerLabel = new Label("");
    controlLayout.addComponent(spacerLabel);
    controlLayout.setExpandRatio(spacerLabel, 0.865f);
    controlLayout.addComponent(newButton);
    controlLayout.setExpandRatio(newButton, 0.045f);
    controlLayout.addComponent(deleteButton);
    controlLayout.setExpandRatio(deleteButton, 0.045f);
    controlLayout.addComponent(cancelButton);
    controlLayout.setExpandRatio(cancelButton, 0.045f);

    return controlLayout;
}

From source file:org.ikasan.dashboard.ui.administration.panel.RoleManagementPanel.java

License:BSD License

/**
 * //  w  w  w .  j  a v  a2  s .  co  m
 */
protected Layout initControlLayout() {
    this.newButton.setIcon(VaadinIcons.PLUS);
    this.newButton.setDescription("Create a New Role");
    this.newButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.newButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.newButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final NewRoleWindow newRoleWindow = new NewRoleWindow(securityService);
            UI.getCurrent().addWindow(newRoleWindow);

            newRoleWindow.addCloseListener(new Window.CloseListener() {
                // inline close-listener
                public void windowClose(CloseEvent e) {
                    RoleManagementPanel.this.role = newRoleWindow.getRole();

                    RoleManagementPanel.this.roleItem = new BeanItem<Role>(RoleManagementPanel.this.role);
                    RoleManagementPanel.this.roleNameField.setText(RoleManagementPanel.this.role.getName());
                    RoleManagementPanel.this.roleNameField
                            .setPropertyDataSource(roleItem.getItemProperty("name"));
                    RoleManagementPanel.this.descriptionField
                            .setPropertyDataSource(roleItem.getItemProperty("description"));
                }
            });
        }
    });

    this.saveButton.setStyleName(ValoTheme.BUTTON_LINK);
    this.saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                RoleManagementPanel.this.save();

                Notification.show("Saved");
            } catch (RuntimeException e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

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

    this.deleteButton.setIcon(VaadinIcons.TRASH);
    this.deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.deleteButton.setDescription("Delete the Current Role");
    this.deleteButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                RoleManagementPanel.this.securityService.deleteRole(role);

                RoleManagementPanel.this.roleNameField.setText("");
                RoleManagementPanel.this.descriptionField.setValue("");

                RoleManagementPanel.this.policyTable.removeAllItems();

                Notification.show("Deleted");
            } catch (RuntimeException e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

                Notification.show("Cauget exception trying to delete a Policy!", sw.toString(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    HorizontalLayout controlLayout = new HorizontalLayout();
    controlLayout.setWidth("100%");
    controlLayout.setHeight("20px");
    Label spacerLabel = new Label("");
    controlLayout.addComponent(spacerLabel);
    controlLayout.setExpandRatio(spacerLabel, 0.91f);
    controlLayout.addComponent(newButton);
    controlLayout.setExpandRatio(newButton, 0.045f);

    controlLayout.addComponent(deleteButton);
    controlLayout.setExpandRatio(deleteButton, 0.045f);

    return controlLayout;
}

From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java

License:BSD License

private Component createContentWrapper(final Component content) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("dashboard-panel-slot");

    CssLayout card = new CssLayout();
    card.setWidth("100%");
    card.addStyleName(ValoTheme.LAYOUT_CARD);

    HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addStyleName("dashboard-panel-toolbar");
    toolbar.setWidth("100%");

    Label caption = new Label(content.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    content.setCaption(null);/* w ww.  ja  v a2 s  .c  o  m*/

    MenuBar tools = new MenuBar();
    tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() {

        @Override
        public void menuSelected(final MenuItem selectedItem) {
            if (!slot.getStyleName().contains("max")) {
                selectedItem.setIcon(FontAwesome.COMPRESS);
                toggleMaximized(slot, true);
            } else {
                slot.removeStyleName("max");
                selectedItem.setIcon(FontAwesome.EXPAND);
                toggleMaximized(slot, false);
            }
        }
    });
    max.setStyleName("icon-only");
    MenuItem root = tools.addItem("", VaadinIcons.COG, null);
    root.addItem("Configure", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });
    root.addSeparator();
    root.addItem("Close", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });

    toolbar.addComponents(caption, tools);
    toolbar.setExpandRatio(caption, 1);
    toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);

    card.addComponents(toolbar, content);
    slot.addComponent(card);
    return slot;
}

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

License:BSD License

/**
 * Helper method to create the layout of the table.
 * //from w  ww  .j a  v  a  2s  .  c o m
 * @param buttonsVisible are the buttons visible?
 * 
 * @return the Layout associated with the table.
 */
protected Layout createTableLayout(boolean buttonsVisible) {
    VerticalLayout tableLayout = new VerticalLayout();

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    this.addNewRecordButton.setIcon(VaadinIcons.PLUS);
    this.addNewRecordButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.addNewRecordButton.setDescription("Add a mapping configuration value to the table below");
    this.addNewRecordButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.addNewRecordButton.setVisible(buttonsVisible);
    this.addNewRecordButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            saveRequiredMonitor.setSaveRequired(true);
            try {
                mappingConfigurationFunctionalGroup.editButtonPressed();
                mappingConfigurationConfigurationValuesTable.addNewRecord();
            } catch (MappingConfigurationServiceException e) {
                e.printStackTrace();
            }
        }
    });

    final RemoveAllItemsAction removeAllItemsAction = new RemoveAllItemsAction(
            this.mappingConfigurationConfigurationValuesTable);

    this.deleteAllRecordsButton.setIcon(VaadinIcons.TRASH);
    this.deleteAllRecordsButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.deleteAllRecordsButton.setDescription("Delete all values from the table below");
    this.deleteAllRecordsButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.deleteAllRecordsButton.setVisible(buttonsVisible);
    this.deleteAllRecordsButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            IkasanMessageDialog dialog = new IkasanMessageDialog("Delete all records!",
                    "This action will delete all source and target mapping configurations "
                            + "from the database. Are you sure you would like to proceed?",
                    removeAllItemsAction);

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

    this.importMappingConfigurationButton.setIcon(VaadinIcons.UPLOAD_ALT);
    this.importMappingConfigurationButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.importMappingConfigurationButton.setDescription("Import mapping configuration values");
    this.importMappingConfigurationButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.importMappingConfigurationButton.setVisible(buttonsVisible);
    this.importMappingConfigurationButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            MappingConfigurationValuesImportWindow dialog = new MappingConfigurationValuesImportWindow(
                    mappingConfigurationService, mappingConfiguration,
                    mappingConfigurationConfigurationValuesTable, systemEventService);

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

    this.exportMappingConfigurationValuesButton.setIcon(VaadinIcons.DOWNLOAD_ALT);
    this.exportMappingConfigurationValuesButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.exportMappingConfigurationValuesButton.setDescription("Export mapping configuration values");
    this.exportMappingConfigurationValuesButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.exportMappingConfigurationValuesButton.setVisible(buttonsVisible);

    FileDownloader fd = new FileDownloader(this.getMappingConfigurationValuesExportStream());
    fd.extend(exportMappingConfigurationValuesButton);

    Label spacer = new Label("&nbsp;", ContentMode.HTML);
    controlsLayout.addComponent(spacer);
    controlsLayout.setExpandRatio(spacer, 0.84f);
    controlsLayout.addComponent(this.addNewRecordButton);
    controlsLayout.setExpandRatio(this.addNewRecordButton, 0.04f);
    controlsLayout.addComponent(this.deleteAllRecordsButton);
    controlsLayout.setExpandRatio(this.deleteAllRecordsButton, 0.04f);
    controlsLayout.addComponent(this.importMappingConfigurationButton);
    controlsLayout.setExpandRatio(this.importMappingConfigurationButton, 0.04f);
    controlsLayout.addComponent(this.exportMappingConfigurationValuesButton);
    controlsLayout.setExpandRatio(this.exportMappingConfigurationValuesButton, 0.04f);

    tableLayout.addComponent(controlsLayout);
    tableLayout.addComponent(this.mappingConfigurationConfigurationValuesTable);

    return tableLayout;
}

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

License:BSD License

/**
 * Helper method to initialise this object.
 *//*w  ww .  j  a v a  2s .co  m*/
@SuppressWarnings("serial")
protected void init() {
    layout = new GridLayout(5, 6);
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setWidth("100%");

    this.addStyleName(ValoTheme.PANEL_BORDERLESS);

    this.parameterQueryTextFields = new ArrayList<TextField>();

    this.typeComboBox.setReadOnly(false);
    this.clientComboBox.setReadOnly(false);
    this.sourceContextComboBox.setReadOnly(false);
    this.targetContextComboBox.setReadOnly(false);
    super.clientComboBox.unselect(super.clientComboBox.getValue());
    super.sourceContextComboBox.unselect(super.sourceContextComboBox.getValue());
    super.targetContextComboBox.unselect(super.targetContextComboBox.getValue());
    super.typeComboBox.unselect(super.typeComboBox.getValue());

    super.mappingConfigurationFunctionalGroup.editButtonPressed();

    super.mappingConfiguration = new MappingConfiguration();
    this.mappingConfigurationConfigurationValuesTable.populateTable(mappingConfiguration);

    HorizontalLayout toolBarLayout = new HorizontalLayout();
    toolBarLayout.setWidth("100%");

    Label spacerLabel = new Label("");
    toolBarLayout.addComponent(spacerLabel);
    toolBarLayout.setExpandRatio(spacerLabel, 0.865f);

    this.editButton.setIcon(VaadinIcons.EDIT);
    this.editButton.setDescription("Edit the mapping configuration");
    this.editButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.editButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    toolBarLayout.addComponent(editButton);
    toolBarLayout.setExpandRatio(editButton, 0.045f);

    this.saveButton.setIcon(VaadinIcons.HARDDRIVE);
    this.saveButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.saveButton.setDescription("Save the mapping configuration");
    this.saveButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    toolBarLayout.addComponent(saveButton);
    toolBarLayout.setExpandRatio(saveButton, 0.045f);

    this.cancelButton.setIcon(VaadinIcons.CLOSE_CIRCLE);
    this.cancelButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.cancelButton.setDescription("Cancel the current edit");
    this.cancelButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    toolBarLayout.addComponent(this.cancelButton);
    toolBarLayout.setExpandRatio(this.cancelButton, 0.045f);

    final VerticalLayout contentLayout = new VerticalLayout();

    contentLayout.addComponent(toolBarLayout);
    contentLayout.addComponent(createMappingConfigurationForm());

    VerticalSplitPanel vpanel = new VerticalSplitPanel(contentLayout, createTableLayout(false));
    vpanel.setStyleName(ValoTheme.SPLITPANEL_LARGE);

    Button addParametersButton = new Button();
    addParametersButton.setIcon(VaadinIcons.FORM);
    addParametersButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    addParametersButton.setDescription(
            "Add new key location queries. The number of fields created corresponds to the number of query parameters.");
    addParametersButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    addParametersButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            addParamQueryFields();
        }
    });

    paramQueriesLayout.removeAllComponents();
    //        paramQueriesLayout.addComponent(addParametersButton);
    paramQueriesLayout.setSpacing(true);

    Label configValueLabels = new Label("Source Configuration Value Queries:");
    layout.addComponent(configValueLabels, 2, 2);
    layout.addComponent(addParametersButton, 3, 2);

    Panel queryParamsPanel = new Panel();
    queryParamsPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    queryParamsPanel.setHeight(140, Unit.PIXELS);
    queryParamsPanel.setWidth(100, Unit.PERCENTAGE);
    queryParamsPanel.setContent(paramQueriesLayout);
    this.layout.addComponent(queryParamsPanel, 2, 3, 3, 5);

    vpanel.setSplitPosition(325, Unit.PIXELS);
    this.setContent(vpanel);
    this.setSizeFull();

}

From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java

License:BSD License

protected Component createContentWrapper(final Component small, final Component large) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("monitor-panel-slot");

    final CssLayout card1 = new CssLayout();
    card1.setWidth("100%");
    card1.addStyleName(ValoTheme.LAYOUT_CARD);

    final CssLayout card2 = new CssLayout();
    card2.setWidth("100%");
    card2.addStyleName(ValoTheme.LAYOUT_CARD);

    final HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addStyleName("dashboard-panel-toolbar");
    toolbar.setWidth("100%");

    Label caption = new Label(large.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    large.setCaption(null);//from w  w w .ja va 2s.c o  m

    MenuBar tools = new MenuBar();
    tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() {

        @Override
        public void menuSelected(final MenuItem selectedItem) {
            if (!slot.getStyleName().contains("max")) {
                selectedItem.setIcon(FontAwesome.COMPRESS);
                slot.removeAllComponents();
                card2.removeAllComponents();
                card2.addComponents(toolbar, large);
                slot.addComponents(card2);
                toggleMaximized(slot, true);
            } else {
                slot.removeStyleName("max");
                selectedItem.setIcon(FontAwesome.EXPAND);
                toggleMaximized(slot, false);
                card1.removeAllComponents();
                card1.addComponents(toolbar, small);
                slot.removeAllComponents();
                slot.addComponents(card1);
            }
        }
    });
    max.setStyleName("icon-only");
    MenuItem root = tools.addItem("", VaadinIcons.COG, null);
    root.addItem("Configure", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });
    root.addSeparator();
    root.addItem("Close", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });

    toolbar.addComponents(caption, tools);
    toolbar.setExpandRatio(caption, 1);
    toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);

    card1.addComponents(toolbar, small);
    //        card2.addComponents(toolbar, large);
    slot.addComponent(card1);
    return slot;
}