Example usage for com.vaadin.ui Panel Panel

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

Introduction

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

Prototype

public Panel() 

Source Link

Document

Creates a new empty panel.

Usage

From source file:org.apache.tamaya.ui.TamayaUI.java

License:Apache License

/**
 * Not an instantiable class.
 */
public TamayaUI() {
    super(new Panel());
    super.setPollInterval(2000);
}

From source file:org.bubblecloud.ilves.component.flow.BlankFlowlet.java

License:Apache License

@Override
protected void initialize() {
    this.setSizeFull();
    final Panel panel = new Panel();
    panel.setSizeFull();//from   www.  j av  a2s .  c o m
    setCompositionRoot(panel);
}

From source file:org.bubblecloud.ilves.ui.anonymous.login.LoginFlowlet.java

License:Apache License

@SuppressWarnings("serial")
@Override/*from   w w  w.j av  a2  s.com*/
public void initialize() {

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    final Company company = getSite().getSiteContext().getObject(Company.class);
    if (company.isOpenIdLogin()) {
        final VerticalLayout mainPanel = new VerticalLayout();
        mainPanel.setCaption(getSite().localize("header-open-id-login"));
        layout.addComponent(mainPanel);
        final HorizontalLayout openIdLayout = new HorizontalLayout();
        mainPanel.addComponent(openIdLayout);
        openIdLayout.setMargin(new MarginInfo(false, false, true, false));
        openIdLayout.setSpacing(true);
        final String returnViewName = "openidlogin";
        final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap();
        for (final String url : urlIconMap.keySet()) {
            openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName));
        }
    }

    try {
        final CustomLayout loginFormLayout = new CustomLayout(
                JadeUtil.parse("/VAADIN/themes/ilves/layouts/login.jade"));
        Responsive.makeResponsive(loginFormLayout);
        loginFormLayout.setCaption(getSite().localize("header-email-and-password-login"));
        layout.addComponent(loginFormLayout);
    } catch (final IOException e) {
        throw new SiteException("Error loading login form.", e);
    }

    if (company.isSelfRegistration()) {
        final Button registerButton = new Button(getSite().localize("button-register") + " >>");
        registerButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                getFlow().forward(RegisterFlowlet.class);
            }
        });
        layout.addComponent(registerButton);
    }

    if (company.isEmailPasswordReset()) {
        final Button forgotPasswordButton = new Button(getSite().localize("button-forgot-password") + " >>");
        forgotPasswordButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                getFlow().forward(ForgotPasswordFlowlet.class);
            }
        });
        layout.addComponent(forgotPasswordButton);
    }

    final Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(layout);

    setViewContent(panel);

}

From source file:org.bubblecloud.ilves.ui.anonymous.login.RegisterFlowlet.java

License:Apache License

@Override
public void initialize() {
    originalPasswordProperty = new ObjectProperty<String>(null, String.class);
    verifiedPasswordProperty = new ObjectProperty<String>(null, String.class);

    final List<FieldDescriptor> fieldDescriptors = new ArrayList<FieldDescriptor>();

    final PasswordValidator passwordValidator = new PasswordValidator(getSite(), originalPasswordProperty,
            "password2");

    //fieldDescriptors.addAll(SiteFields.getFieldDescriptors(Customer.class));

    for (final FieldDescriptor fieldDescriptor : SiteFields.getFieldDescriptors(Customer.class)) {
        if (fieldDescriptor.getId().equals("adminGroup")) {
            continue;
        }/*w  w w.ja  v  a 2  s  . c o  m*/
        if (fieldDescriptor.getId().equals("memberGroup")) {
            continue;
        }
        if (fieldDescriptor.getId().equals("created")) {
            continue;
        }
        if (fieldDescriptor.getId().equals("modified")) {
            continue;
        }
        fieldDescriptors.add(fieldDescriptor);
    }

    //fieldDescriptors.remove(fieldDescriptors.size() - 1);
    //fieldDescriptors.remove(fieldDescriptors.size() - 1);
    fieldDescriptors
            .add(new FieldDescriptor("password1", getSite().localize("input-password"), PasswordField.class,
                    null, 150, null, String.class, null, false, true, true).addValidator(passwordValidator));
    fieldDescriptors.add(new FieldDescriptor("password2", getSite().localize("input-password-verification"),
            PasswordField.class, null, 150, null, String.class, null, false, true, true)
                    .addValidator(new PasswordVerificationValidator(getSite(), originalPasswordProperty)));

    editor = new ValidatingEditor(fieldDescriptors);
    passwordValidator.setEditor(editor);

    final Button registerButton = new Button(getSite().localize("button-register"));
    registerButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    registerButton.addClickListener(new ClickListener() {
        /** The default serial version ID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            editor.commit();
            customer.setCreated(new Date());
            customer.setModified(customer.getCreated());
            final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class);
            final Company company = getSite().getSiteContext().getObject(Company.class);

            final PostalAddress invoicingAddress = new PostalAddress();
            invoicingAddress.setAddressLineOne("?");
            invoicingAddress.setAddressLineTwo("?");
            invoicingAddress.setAddressLineThree("?");
            invoicingAddress.setCity("?");
            invoicingAddress.setPostalCode("?");
            invoicingAddress.setCountry("?");
            final PostalAddress deliveryAddress = new PostalAddress();
            deliveryAddress.setAddressLineOne("?");
            deliveryAddress.setAddressLineTwo("?");
            deliveryAddress.setAddressLineThree("?");
            deliveryAddress.setCity("?");
            deliveryAddress.setPostalCode("?");
            deliveryAddress.setCountry("?");
            customer.setInvoicingAddress(invoicingAddress);
            customer.setDeliveryAddress(deliveryAddress);

            if (UserDao.getUser(entityManager, company, customer.getEmailAddress()) != null) {
                Notification.show(getSite().localize("message-user-email-address-registered"),
                        Notification.Type.WARNING_MESSAGE);
                return;
            }

            final HttpServletRequest request = ((VaadinServletRequest) VaadinService.getCurrentRequest())
                    .getHttpServletRequest();

            try {
                final byte[] passwordAndSaltBytes = (customer.getEmailAddress() + ":"
                        + ((String) originalPasswordProperty.getValue())).getBytes("UTF-8");
                final MessageDigest md = MessageDigest.getInstance("SHA-256");
                final byte[] passwordAndSaltDigest = md.digest(passwordAndSaltBytes);

                customer.setOwner(company);
                final User user = new User(company, customer.getFirstName(), customer.getLastName(),
                        customer.getEmailAddress(), customer.getPhoneNumber(),
                        StringUtil.toHexString(passwordAndSaltDigest));

                SecurityService.addUser(getSite().getSiteContext(), user,
                        UserDao.getGroup(entityManager, company, "user"));

                if (SiteModuleManager.isModuleInitialized(CustomerModule.class)) {
                    SecurityService.addCustomer(getSite().getSiteContext(), customer, user);
                }

                final String url = company.getUrl() + "#!validate/" + user.getUserId();

                final Thread emailThread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        EmailUtil.send(PropertiesUtil.getProperty("site", "smtp-host"), user.getEmailAddress(),
                                company.getSupportEmailAddress(), "Email Validation",
                                "Please validate your email by browsing to this URL: " + url);
                    }
                });
                emailThread.start();

                LOGGER.info("User registered " + user.getEmailAddress() + " (IP: " + request.getRemoteHost()
                        + ":" + request.getRemotePort() + ")");
                Notification.show(getSite().localize("message-registration-success"),
                        Notification.Type.HUMANIZED_MESSAGE);

                getFlow().back();
            } catch (final Exception e) {
                LOGGER.error("Error adding user. (IP: " + request.getRemoteHost() + ":"
                        + request.getRemotePort() + ")", e);
                Notification.show(getSite().localize("message-registration-error"),
                        Notification.Type.WARNING_MESSAGE);
            }
            reset();
        }
    });

    editor.addListener(new ValidatingEditorStateListener() {
        @Override
        public void editorStateChanged(final ValidatingEditor source) {
            if (source.isValid()) {
                registerButton.setEnabled(true);
            } else {
                registerButton.setEnabled(false);
            }
        }
    });

    reset();

    final VerticalLayout panel = new VerticalLayout();
    panel.addComponent(editor);
    panel.addComponent(registerButton);
    panel.setSpacing(true);

    final HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setMargin(true);
    mainLayout.addComponent(panel);

    final Panel mainPanel = new Panel();
    mainPanel.setSizeUndefined();
    mainPanel.setContent(mainLayout);

    setViewContent(mainPanel);
}

From source file:org.dressdiscover.gui.components.RightsLayout.java

public RightsLayout(final String entity, final RightsSetBean model) {
    int rightsRowCount = 0;
    for (final RightsBean rights_ : model.getElements()) {
        rightsRowCount++;/*ww w  . jav  a  2 s .c  om*/
        if (rights_.getRightsHolder() != null) {
            rightsRowCount++;
        }
    }
    if (rightsRowCount == 0) {
        empty = true;
        return;
    }

    final Table table = new Table();
    table.addContainerProperty("caption", String.class, null);
    table.addContainerProperty("text", String.class, null);
    table.setCellStyleGenerator(new CellStyleGenerator() {
        @Override
        public String getStyle(final Table source, final Object itemId, final Object propertyId) {
            return propertyId != null ? "rights-" + propertyId.toString() : null;
        }
    });
    // rootTable.addGeneratedColumn("text", new ColumnGenerator() {
    // @Override
    // public Object generateCell(final Table source, final Object itemId,
    // final Object columnId) {
    // final Object value =
    // source.getItem(itemId).getItemProperty(columnId).getValue();
    // if (value == null) {
    // return null;
    // }
    // return value;
    // }
    // });
    table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
    table.setPageLength(rightsRowCount);
    table.setStyleName("rights-table");

    boolean empty = true;
    for (final RightsBean rights_ : model.getElements()) {
        String typeCaption;
        String typeText;
        switch (rights_.getType()) {
        case COPYRIGHTED:
            typeCaption = "Copyright";
            typeText = rights_.getText().trim();
            break;
        case LICENSED:
            typeCaption = "License";
            // if (rights_.getLicenseVocabRef() != null &&
            // rights_.getLicenseVocabRef().getUri() instanceof Url) {
            // typeText = new Link(rights_.getText().trim(),
            // new
            // ExternalResource(rights_.getLicenseVocabRef().getUri().toString()));
            // } else {
            typeText = rights_.getText().trim();
            // }
            break;
        case OTHER:
            continue;
        case PUBLIC_DOMAIN:
            typeCaption = "License";
            typeText = "public domain";
            break;
        case UNDETERMINED:
            continue;
        default:
            throw new UnsupportedOperationException();
        }

        table.addItem(new Object[] { typeCaption, typeText }, null);
        empty = false;

        if (rights_.getRightsHolder() != null) {
            table.addItem(new Object[] { "Rights holder", rights_.getRightsHolder() }, null);
        }
    }
    this.empty = empty;
    if (empty) {
        return;
    }

    final Panel panel = new Panel();
    panel.setCaption(entity + " rights");
    panel.setContent(table);

    setCompositionRoot(panel);
    addStyleName("rights-layout");
}

From source file:org.eclipse.hawkbit.simulator.ui.SimulatorUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest request) {

    rootLayout.setSizeFull();//from  w  w  w  .  ja va 2  s.c om

    final Panel viewContainer = new Panel();
    viewContainer.setSizeFull();
    rootLayout.addComponent(viewContainer);
    rootLayout.setExpandRatio(viewContainer, 1.0F);

    final Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);

    setContent(rootLayout);
}

From source file:org.eclipse.hawkbit.ui.AbstractHawkbitUI.java

License:Open Source License

private Panel buildContent() {
    final Panel content = new Panel();
    content.setSizeFull();/*from  w ww .  j av a 2  s  .  com*/
    content.setStyleName("view-content");
    return content;
}

From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableLayout.java

License:Open Source License

private void buildLayout() {
    setSizeFull();/*w  w  w . ja va2  s  .  c  o m*/
    setSpacing(true);
    setMargin(false);
    setStyleName("group");
    final VerticalLayout tableHeaderLayout = new VerticalLayout();
    tableHeaderLayout.setSizeFull();
    tableHeaderLayout.setSpacing(false);
    tableHeaderLayout.setMargin(false);

    tableHeaderLayout.setStyleName("table-layout");
    tableHeaderLayout.addComponent(tableHeader);

    tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER);
    if (isShortCutKeysRequired()) {
        final Panel tablePanel = new Panel();
        tablePanel.setStyleName("table-panel");
        tablePanel.setHeight(100.0F, Unit.PERCENTAGE);
        tablePanel.setContent(table);
        tablePanel.addActionHandler(getShortCutKeysHandler(i18n));
        tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
        tableHeaderLayout.addComponent(tablePanel);
        tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(tablePanel, 1.0F);
    } else {
        tableHeaderLayout.addComponent(table);
        tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(table, 1.0F);
    }

    addComponent(tableHeaderLayout);
    addComponent(detailsLayout);
    setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
    setComponentAlignment(detailsLayout, Alignment.TOP_CENTER);
    setExpandRatio(tableHeaderLayout, 1.0F);
}

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.AuthenticationConfigurationView.java

License:Open Source License

private void init() {

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();//w  ww  .j  a  va2  s.  co m

    rootPanel.addStyleName("config-panel");

    final VerticalLayout vLayout = new VerticalLayout();
    vLayout.setMargin(true);
    vLayout.setSizeFull();

    final Label header = new Label(i18n.getMessage("configuration.authentication.title"));
    header.addStyleName("config-panel-header");
    vLayout.addComponent(header);

    final GridLayout gridLayout = new GridLayout(3, 4);
    gridLayout.setSpacing(true);
    gridLayout.setImmediate(true);
    gridLayout.setSizeFull();
    gridLayout.setColumnExpandRatio(1, 1.0F);

    certificateAuthCheckbox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
    certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
    certificateAuthCheckbox.addValueChangeListener(this);
    certificateAuthenticationConfigurationItem.addChangeListener(this);
    gridLayout.addComponent(certificateAuthCheckbox, 0, 0);
    gridLayout.addComponent(certificateAuthenticationConfigurationItem, 1, 0);

    targetSecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
    targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
    targetSecTokenCheckBox.addValueChangeListener(this);
    targetSecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
    gridLayout.addComponent(targetSecTokenCheckBox, 0, 1);
    gridLayout.addComponent(targetSecurityTokenAuthenticationConfigurationItem, 1, 1);

    gatewaySecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
    gatewaySecTokenCheckBox.setId("gatewaysecuritycheckbox");
    gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
    gatewaySecTokenCheckBox.addValueChangeListener(this);
    gatewaySecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
    gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
    gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);

    downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
    downloadAnonymousCheckBox.setId(UIComponentIdProvider.DOWNLOAD_ANONYMOUS_CHECKBOX);
    downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled());
    downloadAnonymousCheckBox.addValueChangeListener(this);
    anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this);
    gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3);
    gridLayout.addComponent(anonymousDownloadAuthenticationConfigurationItem, 1, 3);

    final Link linkToSecurityHelp = SPUIComponentProvider.getHelpLink(i18n,
            uiProperties.getLinks().getDocumentation().getSecurity());
    gridLayout.addComponent(linkToSecurityHelp, 2, 3);
    gridLayout.setComponentAlignment(linkToSecurityHelp, Alignment.BOTTOM_RIGHT);

    vLayout.addComponent(gridLayout);
    rootPanel.setContent(vLayout);
    setCompositionRoot(rootPanel);
}

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.DefaultDistributionSetTypeLayout.java

License:Open Source License

DefaultDistributionSetTypeLayout(final SystemManagement systemManagement,
        final DistributionSetTypeManagement distributionSetTypeManagement, final VaadinMessageSource i18n,
        final SpPermissionChecker permChecker) {
    this.systemManagement = systemManagement;
    combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
    changeIcon = new Label();

    if (!permChecker.hasReadRepositoryPermission()) {
        return;//from  w  w  w  .  j a va 2  s  .  c om
    }

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();
    rootPanel.addStyleName("config-panel");
    final VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSizeFull();

    final Label header = new Label(i18n.getMessage("configuration.defaultdistributionset.title"));
    header.addStyleName("config-panel-header");
    vlayout.addComponent(header);

    final DistributionSetType currentDistributionSetType = getCurrentDistributionSetType();
    currentDefaultDisSetType = currentDistributionSetType.getId();

    final HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setSpacing(true);
    hlayout.setImmediate(true);

    final Label configurationLabel = new LabelBuilder()
            .name(i18n.getMessage("configuration.defaultdistributionset.select.label")).buildLabel();
    hlayout.addComponent(configurationLabel);

    final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
            .findAll(PageRequest.of(0, 100));

    combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
    combobox.setNullSelectionAllowed(false);
    for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {
        combobox.addItem(distributionSetType.getId());
        combobox.setItemCaption(distributionSetType.getId(),
                distributionSetType.getKey() + " (" + distributionSetType.getName() + ")");

        if (distributionSetType.getId().equals(currentDistributionSetType.getId())) {
            combobox.select(distributionSetType.getId());
        }
    }
    combobox.setImmediate(true);
    combobox.addValueChangeListener(event -> selectDistributionSetValue());
    hlayout.addComponent(combobox);

    changeIcon.setIcon(FontAwesome.CHECK);
    hlayout.addComponent(changeIcon);
    changeIcon.setVisible(false);

    vlayout.addComponent(hlayout);
    rootPanel.setContent(vlayout);
    setCompositionRoot(rootPanel);
}