Example usage for com.vaadin.ui Alignment TOP_LEFT

List of usage examples for com.vaadin.ui Alignment TOP_LEFT

Introduction

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

Prototype

Alignment TOP_LEFT

To view the source code for com.vaadin.ui Alignment TOP_LEFT.

Click Source Link

Usage

From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java

License:Open Source License

private VerticalLayout buildVlContentPanel() {
    VerticalLayout contentPanel = new VerticalLayout();
    contentPanel.setImmediate(false);/* w ww  .  j a  v a  2  s.c o  m*/
    contentPanel.setWidth("100.0%");

    contentPanel.setMargin(false, true, false, true);
    // breadCrumpPanel
    breadCrump = buildBreadCrumpPanel();
    contentPanel.addComponent(breadCrump);
    // resourcePropertiesPanel
    Panel resourcePropertiesPanel = buildResourcePropertiesPanel();
    contentPanel.addComponent(resourcePropertiesPanel);
    contentPanel.setComponentAlignment(resourcePropertiesPanel, Alignment.TOP_LEFT);

    // metaViewsPanel contains Panel for the DirectMembers & for the Metas
    Panel metaViewsPanel = buildMetaViewsPanel();
    contentPanel.addComponent(metaViewsPanel);
    contentPanel.setComponentAlignment(metaViewsPanel, Alignment.TOP_LEFT);

    return contentPanel;
}

From source file:org.hip.vif.skin.dflt.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout outLayout = new HorizontalLayout();
    outLayout.setStyleName("vif-head");
    outLayout.setMargin(false);/*from   w ww.  j av a2 s.  c om*/
    outLayout.setWidth("100%");
    outLayout.setHeight(80, Unit.PIXELS);

    final Embedded lImage = new Embedded();
    lImage.setSource(new ThemeResource("images/vifLogo.gif"));
    outLayout.addComponent(lImage);
    outLayout.setComponentAlignment(lImage, Alignment.TOP_LEFT);
    outLayout.setExpandRatio(lImage, 0.42f);

    final Label lTitle = LabelHelper.createLabel("VIF Forum", "vif-head-title");
    lTitle.setSizeUndefined();
    outLayout.addComponent(lTitle);
    outLayout.setComponentAlignment(lTitle, Alignment.MIDDLE_LEFT);
    outLayout.setExpandRatio(lTitle, 0.58f);

    return outLayout;
}

From source file:org.hip.vif.skin.green.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout outLayout = new HorizontalLayout();
    outLayout.setWidth("100%");
    outLayout.setHeight(115, Unit.PIXELS);
    outLayout.setStyleName("vif-green-head");

    final Embedded lImage = new Embedded();
    lImage.setSource(new ThemeResource("images/head.jpg"));
    outLayout.addComponent(lImage);//from w w  w  .  j  av a 2  s  .c  om
    outLayout.setComponentAlignment(lImage, Alignment.TOP_LEFT);

    final Label lTitle = new Label("VIF - Virtual Discussion Forum");
    lTitle.setStyleName("vif-head-title");
    lTitle.setWidth(700, Unit.PIXELS);
    outLayout.addComponent(lTitle);

    return outLayout;
}

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

License:BSD License

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

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

    Label label = new Label("Platform Configuration");
    label.addStyleName(ValoTheme.LABEL_HUGE);
    label.setSizeUndefined();
    paramLayout.addComponent(label, 0, 0, 1, 0);
    paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT);

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

    final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1);
    mapLayout.setColumnExpandRatio(0, .05f);
    mapLayout.setColumnExpandRatio(1, .425f);
    mapLayout.setColumnExpandRatio(2, .05f);
    mapLayout.setColumnExpandRatio(3, .425f);
    mapLayout.setColumnExpandRatio(4, .05f);

    mapLayout.setMargin(true);
    mapLayout.setSpacing(true);
    mapLayout.setWidth("100%");

    int i = 0;

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

        final TextField keyField = new TextField();
        keyField.setValue(key);
        keyField.setWidth("100%");
        keyField.setNullSettingAllowed(false);
        keyField.addValidator(
                new NonZeroLengthStringValidator("Then configuration value name cannot be empty!"));
        keyField.setValidationVisible(false);

        final TextField valueField = new TextField();
        valueField.setWidth("100%");
        valueField.setValue(valueMap.get(key));
        valueField.setNullSettingAllowed(false);
        valueField.addValidator(new NonZeroLengthStringValidator("Then configuration value cannot be empty!"));
        valueField.setValidationVisible(false);

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

        this.mapTextFields.put(mapKey, pair);

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

                mapTextFields.remove(mapKey);
            }
        });

        mapLayout.addComponent(removeButton, 4, i);

        i++;
    }

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

            final TextField keyField = new TextField();
            keyField.setWidth("100%");
            keyField.setNullSettingAllowed(false);
            keyField.addValidator(
                    new NonZeroLengthStringValidator("Then configuration value name cannot be empty!"));
            keyField.setValidationVisible(false);

            final TextField valueField = new TextField();
            valueField.setWidth("100%");
            valueField.setNullSettingAllowed(false);
            valueField.addValidator(
                    new NonZeroLengthStringValidator("Then configuration value cannot be empty!"));
            valueField.setValidationVisible(false);

            mapLayout.insertRow(mapLayout.getRows());

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

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

            mapTextFields.put(mapKey, pair);

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

                    mapLayout.removeComponent(removeButton);

                    mapTextFields.remove(mapKey);
                }
            });

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

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

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

    Panel mapPanel = new Panel();
    mapPanel.setStyleName(ValoTheme.PANEL_BORDERLESS);
    mapPanel.setContent(mapLayout);

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

                Notification.show("Validation errors have occurred!", Type.ERROR_MESSAGE);

                return;
            }

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

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

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

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

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

            parameter.setValue(map);

            PlatformConfigurationPanel.this.configurationManagement.saveConfiguration(platformConfiguration);

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

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

    return paramPanel;
}

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

License:BSD License

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    paramPanel.setContent(paramLayout);

    return paramPanel;
}

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

License:BSD License

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

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

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

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

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

    int i = 0;

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

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

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

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

        this.mapTextFields.put(mapKey, pair);

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

                mapTextFields.remove(mapKey);
            }
        });

        mapLayout.addComponent(removeButton, 4, i);

        i++;
    }

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

            final TextField keyField = new TextField();

            final TextField valueField = new TextField();

            mapLayout.insertRow(mapLayout.getRows());

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

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

            mapTextFields.put(mapKey, pair);

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

                    mapLayout.removeComponent(removeButton);

                    mapTextFields.remove(mapKey);
                }
            });

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

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

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

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

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

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

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

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

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

    return paramPanel;
}

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

License:BSD License

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

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

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

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

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

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

    int i = 0;

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

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

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

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

        this.valueTextFields.put(mapKey, valueField);

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

                valueTextFields.remove(mapKey);
            }
        });

        listLayout.addComponent(removeButton, 2, i);

        i++;
    }

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

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

            listLayout.insertRow(listLayout.getRows());

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

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

            valueTextFields.put(mapKey, valueField);

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

                    listLayout.removeComponent(removeButton);

                    valueTextFields.remove(mapKey);
                }
            });

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

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

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

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

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

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

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

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

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

    return paramPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.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();//w  w w.  j  av  a  2  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.jdal.vaadin.auth.LoginView.java

License:Apache License

@Override
protected Component buildPanel() {
    Label greeting = new Label(getMessage("loginView.greeting"));
    greeting.addStyleName("jd-login-greeting");
    greeting.addStyleName(Reindeer.LABEL_H2);
    Label applicationNameLabel = new Label(getMessage(applicationName));
    applicationNameLabel.addStyleName("jd-login-appname");
    applicationNameLabel.addStyleName(Reindeer.LABEL_H2);
    applicationNameLabel.setSizeUndefined();

    loginButton.addClickListener(this);
    loginButton.setCaption(getMessage("loginView.loginButtonCaption"));
    loginButton.addStyleName("jd-login-button");

    // add shortcut listener for enter key
    loginButton.addShortcutListener(new ShortcutListener("Sign In", KeyCode.ENTER, null) {
        @Override/*from   w ww .  ja v  a2  s  . c o  m*/
        public void handleAction(Object sender, Object target) {
            loginButton.click();
        }
    });

    Image image = null;
    HorizontalLayout imageWrapper = null;

    if (applicationIcon != null) {
        image = new Image(null, applicationIcon);
        image.setSizeUndefined();
        image.setStyleName("jd-login-icon");
        imageWrapper = new HorizontalLayout();
        imageWrapper.setMargin(false);
        imageWrapper.addComponent(image);
        imageWrapper.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
    }

    BoxFormBuilder fb = new BoxFormBuilder();
    fb.setDefaultWidth(BoxFormBuilder.SIZE_FULL);
    fb.row();
    fb.startBox();
    fb.setFixedHeight();
    fb.row(false);
    fb.add(greeting, Alignment.TOP_LEFT);
    fb.add(applicationNameLabel, Alignment.TOP_RIGHT);
    fb.endBox();
    // add application icon
    if (image != null) {
        fb.row(BoxFormBuilder.SIZE_FULL);
        fb.add(imageWrapper, BoxFormBuilder.SIZE_FULL, Alignment.MIDDLE_CENTER);
    }
    fb.row();
    fb.startBox();
    fb.row(30);
    fb.add(errorLabel, BoxFormBuilder.SIZE_FULL, Alignment.BOTTOM_CENTER);
    fb.endBox();
    fb.row();
    fb.startBox();
    fb.setFixedHeight();
    fb.row();
    fb.add(username, getMessage("loginView.username"), Alignment.BOTTOM_CENTER);
    fb.add(password, getMessage("loginView.password"), Alignment.BOTTOM_CENTER);
    fb.add(loginButton, 100, Alignment.BOTTOM_CENTER);
    fb.endBox();

    Component form = fb.getForm();
    form.setWidth(this.getWidth(), Unit.PIXELS);
    form.setHeight(getHeight(), Unit.PIXELS);
    form.setStyleName("jd-login");

    return form;
}

From source file:org.jumpmind.vaadin.ui.common.ReadOnlyTextAreaDialog.java

License:Open Source License

private void buildUploadButton(String title, final String value) {
    final Button uploadButton = new Button("Upload");
    final Button viewTextButton = new Button("View Text");

    LobUploader lobUploader = new LobUploader();
    final Upload upload = new Upload("Upload new " + table.getColumnWithName(title).getMappedType(),
            lobUploader);//  www.  j a va2  s.  c o  m
    upload.addSucceededListener(lobUploader);

    uploadButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            wrapper.replaceComponent(textField, upload);
            wrapper.setComponentAlignment(upload, Alignment.MIDDLE_CENTER);
            buttonLayout.replaceComponent(uploadButton, viewTextButton);
        }
    });

    viewTextButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            wrapper.replaceComponent(upload, textField);
            wrapper.setComponentAlignment(textField, Alignment.TOP_LEFT);
            buttonLayout.replaceComponent(viewTextButton, uploadButton);
        }
    });

    if (value != null) {
        buttonLayout.addComponent(uploadButton);
        buttonLayout.setComponentAlignment(uploadButton, Alignment.BOTTOM_CENTER);
    } else {
        wrapper.replaceComponent(textField, upload);
        wrapper.setComponentAlignment(upload, Alignment.MIDDLE_CENTER);
    }
}