Example usage for com.vaadin.ui Panel setWidth

List of usage examples for com.vaadin.ui Panel setWidth

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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

License:Open Source License

private Panel buildDirectMembersPanel() {
    // common part: create layout
    Panel directMembersPanel = new Panel();
    directMembersPanel.setImmediate(false);
    directMembersPanel.setWidth("100.0%");
    directMembersPanel.setHeight("100.0%");
    directMembersPanel.setStyleName(Runo.PANEL_LIGHT);

    // vlDirectMember
    final VerticalLayout vlDirectMember = new ItemContent(repositories, resourceProxy, router, controller);
    vlDirectMember.setImmediate(false);/*from  w  ww. ja va  2  s.  c o  m*/
    vlDirectMember.setWidth("100.0%");
    vlDirectMember.setMargin(false);
    directMembersPanel.setContent(vlDirectMember);

    return directMembersPanel;
}

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

License:Open Source License

private Panel buildMetaViewsPanel() {
    Panel mdView = new Panel();
    mdView.setImmediate(false);//from  w w w  . j a v a2 s. co  m
    mdView.setWidth("100.0%");
    // mdView.setHeight("300px");
    mdView.setStyleName(Runo.PANEL_LIGHT);

    mdView.setContent(buildHlMetaViews());

    return mdView;
}

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

License:Open Source License

private Panel buildRightPanel() {
    // common part: create layout
    Panel rightPanel = new Panel();
    rightPanel.setImmediate(false);/*from  w  w w  . java 2s . co m*/
    rightPanel.setWidth("100.0%");
    rightPanel.setHeight("100.0%");

    // vlRightPanel
    rightPanel.setContent(buildVlRightPanel());

    return rightPanel;
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private Panel buildContentPanel() {
    // common part: create layout
    final Panel contentPanel = new Panel();
    contentPanel.setImmediate(false);//from   w ww  .  ja v  a  2 s. com
    contentPanel.setWidth("100.0%");
    contentPanel.setHeight("100.0%");

    // vlContentPanel
    final VerticalLayout vlContentPanel = buildVlContentPanel();
    contentPanel.setContent(vlContentPanel);

    return contentPanel;
}

From source file:org.escidoc.browser.ui.useraccount.UserAccountView.java

License:Open Source License

private static Panel createContentPanel() {
    Panel contentPanel = new Panel();
    contentPanel.setStyleName(Runo.PANEL_LIGHT);
    contentPanel.setImmediate(false);//w w  w .  j  a  v  a  2  s .c o  m
    contentPanel.setWidth("100.0%");
    contentPanel.setHeight("100.0%");
    return contentPanel;
}

From source file:org.escidoc.browser.ui.useraccount.UserAccountView.java

License:Open Source License

private Panel buildPanel() {
    // common part: create layout
    Panel panel = new Panel();
    panel.setImmediate(false);//www  .j  a v  a2s  . c o m
    panel.setWidth("100.0%");
    panel.setHeight("100.0%");

    try {
        VerticalLayout verticalLayout = buildVerticalLayout();
        buildEditUserForm(verticalLayout);
        panel.addComponent(verticalLayout);
    } catch (EscidocClientException e) {
        router.getMainWindow().showNotification(ViewConstants.ERROR_CREATING_RESOURCE + e.getMessage(),
                Window.Notification.TYPE_ERROR_MESSAGE);
    } catch (URISyntaxException e) {
        router.getMainWindow().showNotification(ViewConstants.ERROR_CREATING_RESOURCE + e.getMessage(),
                Window.Notification.TYPE_ERROR_MESSAGE);
    }

    return panel;
}

From source file:org.escidoc.browser.ui.view.helpers.ItemPropertiesVH.java

License:Open Source License

private Panel buildLeftPropertiesPnl() {
    final Panel pnlPropertiesLeft = new Panel();
    pnlPropertiesLeft.setWidth("40%");
    pnlPropertiesLeft.setHeight("60px");
    pnlPropertiesLeft.setStyleName(ViewConstants.FLOAT_LEFT);
    pnlPropertiesLeft.addStyleName(Runo.PANEL_LIGHT);
    pnlPropertiesLeft.getLayout().setMargin(false);
    return pnlPropertiesLeft;
}

From source file:org.escidoc.browser.ui.view.helpers.ItemPropertiesVH.java

License:Open Source License

private Panel buildRightPnlProperties() {
    final Panel pnlPropertiesRight = new Panel();
    pnlPropertiesRight.setWidth("60%");
    pnlPropertiesRight.setHeight("60px");
    pnlPropertiesRight.setStyleName(ViewConstants.FLOAT_RIGHT);
    pnlPropertiesRight.addStyleName(Runo.PANEL_LIGHT);
    pnlPropertiesRight.getLayout().setMargin(false);
    return pnlPropertiesRight;
}

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);//  www . j  a  v a  2s.  c  o  m
    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.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);/*  w w w  . j av  a  2s.c om*/
    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;
}