Example usage for com.vaadin.ui VerticalLayout setSizeUndefined

List of usage examples for com.vaadin.ui VerticalLayout setSizeUndefined

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropLayoutDraggingDemo.java

License:Apache License

@Override
public Component getLayout() {
    // start-source
    final DDAbsoluteLayout layout = new DDAbsoluteLayout();
    layout.setSizeFull();/*from   w w  w.  j a v a  2  s.  c om*/

    // Enable dragging components
    layout.setDragMode(LayoutDragMode.CLONE);

    // Enable dropping components
    layout.setDropHandler(new DefaultAbsoluteLayoutDropHandler());

    // Add some components
    layout.addComponent(new Label(
            "This demo shows how you can drag a layout with buttons in it. Try to drag the button group to see what happens"),
            "left:5px;top:5px");

    // A vertical layout which has dragging turned off by default
    VerticalLayout buttons = new VerticalLayout();
    buttons.setSizeUndefined();
    buttons.setCaption("Button group");
    buttons.setSpacing(true);
    buttons.addComponent(new Button("Button1"));
    buttons.addComponent(new Button("Button2"));
    buttons.addComponent(new Button("Button3"));
    buttons.addComponent(new Button("Button4"));

    layout.addComponent(buttons, "left:50px;top:50px");
    // end-source
    return layout;
}

From source file:gms.demo.service.presentation.ui.MainUI.java

License:Open Source License

private void initDefaultContent() {

    // add buttons to the main layout
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);//from   w w w . ja  v  a  2s .  com
    refreshButton.addListener(this);
    removeButton.addListener(this);
    clearAllButton.addListener(this);
    createNewButton.addListener(this);
    buttonLayout.addComponent(refreshButton);
    buttonLayout.addComponent(removeButton);
    buttonLayout.addComponent(clearAllButton);
    buttonLayout.addComponent(createNewButton);
    buttonLayout.setMargin(true);

    // add form for creating new entries, hidden at first
    cmiPanel = new CreateMemberInfoPanel(this);
    cmiPanel.setVisible(false);

    // add table that shows all the group masters
    mlPanel = new MasterListPanel(this);

    // set up logout button
    logoutButton.addListener(this);

    // add everything to main layout
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSizeUndefined();
    mainLayout.addComponent(buttonLayout);
    mainLayout.addComponent(cmiPanel);
    mainLayout.addComponent(mlPanel);
    mainLayout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER);
    mainLayout.addComponent(logoutButton);
    mainLayout.setComponentAlignment(logoutButton, Alignment.BOTTOM_RIGHT);

    // add the main layout to a root layout and center it
    defaultLayout = new VerticalLayout();
    defaultLayout.addComponent(mainLayout);
    defaultLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER);
}

From source file:gov.osti.doecode.RepositoryForm.java

/**
 * Create a basic form UI for editing software metadata information.
 * //from w ww.ja va2 s.c o m
 * @param ui link to the MyUI parent UI
 */
public RepositoryForm(MyUI ui) {
    this.ui = ui;

    setSizeUndefined();

    agentGrid.setColumns("firstName", "lastName", "email");
    agentGrid.setHeightMode(HeightMode.ROW);
    agentGrid.setHeightByRows(8);

    idGrid.setColumns("relationType", "identifierType", "value");
    idGrid.setHeightMode(HeightMode.ROW);
    idGrid.setHeightByRows(8);

    idForm = new IdentifierForm(this);
    agentForm = new AgentForm(this);

    TabSheet tabs = new TabSheet();
    tabs.addStyleName(ValoTheme.TABSHEET_FRAMED);
    tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);

    addComponent(tabs);

    HorizontalLayout main = new HorizontalLayout();
    main.setSpacing(true);
    main.setMargin(true);

    FormLayout left = new FormLayout();
    FormLayout right = new FormLayout();

    countryCode.addItems(countryCodes);

    left.addComponents(url, loadButton, name, openSource, siteOwnershipCode, acronym, doi, countryCode);
    right.addComponents(keywords, rights, license, operatingSystem, siteAccessionNumber, otherRequirements);

    loadButton.addClickListener(e -> {
        try {
            SoftwareRepository repo = Reader.loadRepository("doecode");

            setSoftwareRepository(repo);

        } catch (IOException ex) {
            setComponentError(new UserError("Unable to load: " + ex.getMessage()));
        }
    });

    main.addComponents(left, right);

    tabs.addTab(main, "Metadata");

    Button agentAddButton = new Button("New");
    agentAddButton.setStyleName(BaseTheme.BUTTON_LINK);
    agentAddButton.setIcon(FontAwesome.PLUS);

    agentAddButton.addClickListener(e -> {
        agentForm.setAgent(new Agent());
    });

    VerticalLayout innerAgent = new VerticalLayout(agentAddButton, agentGrid);
    innerAgent.setSizeUndefined();
    HorizontalLayout agentLayout = new HorizontalLayout(innerAgent, agentForm);
    agentLayout.setSpacing(true);
    agentLayout.setMargin(true);

    tabs.addTab(agentLayout, "Agents");

    Button idAddButton = new Button("New");
    idAddButton.setIcon(FontAwesome.PLUS);
    idAddButton.setStyleName(BaseTheme.BUTTON_LINK);
    idAddButton.setSizeUndefined();

    idAddButton.addClickListener(e -> {
        idForm.setIdentifier(new Identifier());
    });

    VerticalLayout innerId = new VerticalLayout(idAddButton, idGrid);
    HorizontalLayout idTab = new HorizontalLayout(innerId, idForm);
    idTab.setSpacing(true);
    idTab.setMargin(true);

    tabs.addTab(idTab, "Identifiers");

    agentGrid.addSelectionListener(e -> {
        if (!e.getSelected().isEmpty()) {
            Agent agent = (Agent) e.getSelected().iterator().next();
            agentForm.setAgent(agent);
            System.out.println("Selected " + agent.getFirstName());
        }
    });
    idGrid.addSelectionListener(e -> {
        if (!e.getSelected().isEmpty()) {
            Identifier identifier = (Identifier) e.getSelected().iterator().next();
            idForm.setIdentifier(identifier);
        }
    });

}

From source file:gq.vaccum121.ui.LoginScreen.java

License:Apache License

private void initLayout() {
    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();/*from  w  w w. ja va2  s. c  o m*/
    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    login = new Button("Login");
    loginForm.addComponent(userName);
    loginForm.addComponent(passwordField);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSizeUndefined();

    loginFailedLabel = new Label();
    loginLayout.addComponent(loginFailedLabel);
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loggedOutLabel = new Label("Good bye!");
    loginLayout.addComponent(loggedOutLabel);
    loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    loggedOutLabel.setSizeUndefined();
    loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
    loggedOutLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setCompositionRoot(rootLayout);
    setSizeFull();
}

From source file:lifetime.component.welcome.contact.ContactView.java

License:Apache License

public ContactView(String language) {
    super(language);
    VerticalLayout contactView = new VerticalLayout();
    contactView.setSizeUndefined();
    contactView.setCaption("Contact");
    contactView.addComponent(new Label("Contact"));
}

From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminLoginView.java

License:Open Source License

public AdminLoginView() {

    actAdmin.setActorUI(UI.getCurrent());
    env.setActAdministrator(actAdmin.getName(), actAdmin);
    IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctAdmin, actAdmin);

    log.debug("CHECK: ADMIN UI is " + actAdmin.getActorUI());

    welcomeText = new Label("Please login to access iCrash Administrator Console");
    hintText = new Label("(icrashadmin/7WXC1359)");
    welcomeText.setSizeUndefined();//from  w  w  w. j  a  va  2  s .co m
    hintText.setSizeUndefined();

    // create the username input field
    username = new TextField("Login:");
    username.setWidth("120px");
    username.setInputPrompt("Admin login");
    username.setImmediate(true);

    // create the password input field
    password = new PasswordField("Password:");
    password.setWidth("120px");
    password.setValue("");
    password.setNullRepresentation("");
    password.setImmediate(true);

    // create the login button
    loginButton = new Button("Login", this);
    loginButton.setClickShortcut(KeyCode.ENTER);
    loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    loginButton.setImmediate(true);

    /*********************************************************************************************/
    Table adminMessagesTable = new Table();
    adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource());
    adminMessagesTable.setCaption("Administrator messages");
    //   adminMessagesTable.setVisibleColumns("inputEvent", "message");
    /*********************************************************************************************/

    FormLayout FL = new FormLayout(username, password, loginButton);

    VerticalLayout welcomeLayout = new VerticalLayout(welcomeText, /*hintText,*/ FL);
    VerticalLayout leftVL = new VerticalLayout(welcomeLayout);
    VerticalLayout rightVL = new VerticalLayout(adminMessagesTable);

    welcomeLayout.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER);
    // welcomeLayout.setComponentAlignment(hintText, Alignment.MIDDLE_CENTER);
    welcomeLayout.setComponentAlignment(FL, Alignment.MIDDLE_CENTER);

    setSizeFull();
    FL.setSizeUndefined();
    welcomeLayout.setSizeUndefined();
    leftVL.setSizeFull();
    rightVL.setSizeFull();

    leftVL.setComponentAlignment(welcomeLayout, Alignment.MIDDLE_CENTER);
    rightVL.setComponentAlignment(adminMessagesTable, Alignment.MIDDLE_CENTER);

    addComponent(leftVL);
    addComponent(rightVL);

    setMargin(true);
    setExpandRatio(leftVL, 6);
    setExpandRatio(rightVL, 4);
}

From source file:management.limbr.ui.login.LogInViewImpl.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();/*from w  w w.j  a  v a2  s .c  o  m*/

    usernameField = new TextField(messages.get("usernameFieldLabel"));
    usernameField.setWidth(20.0f, Unit.EM);
    usernameField.setRequired(true);
    usernameField.setInputPrompt(messages.get("usernameFieldPrompt"));
    usernameField
            .addValidator(new StringLengthValidator(messages.get("usernameFieldValidation"), 3, 256, false));
    usernameField.setImmediate(true);
    usernameField.setInvalidAllowed(false);

    passwordField = new PasswordField(messages.get("passwordFieldLabel"));
    passwordField.setWidth(20.0f, Unit.EM);
    passwordField.setInputPrompt(messages.get("passwordFieldPrompt"));
    passwordField
            .addValidator(new StringLengthValidator(messages.get("passwordFieldValidation"), 8, 256, false));
    passwordField.setImmediate(true);
    passwordField.setRequired(true);
    passwordField.setNullRepresentation("");

    Button logInButton = new Button(messages.get("logInButtonLabel"));
    logInButton.addClickListener(event -> {
        usernameField.setValidationVisible(false);
        passwordField.setValidationVisible(false);
        try {
            usernameField.commit();
            passwordField.commit();
        } catch (Validator.InvalidValueException e) {
            Notification.show(e.getMessage());
            usernameField.setValidationVisible(true);
            passwordField.setValidationVisible(true);
            LOG.debug("Validation of log in fields failed.", e);
        }
        listeners.forEach(LogInViewListener::logInClicked);
    });

    VerticalLayout fields = new VerticalLayout(usernameField, passwordField, logInButton);
    fields.setCaption(messages.get("logInCaption", LimbrApplication.getApplicationName()));
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    VerticalLayout mainLayout = new VerticalLayout(fields);
    mainLayout.setSizeFull();
    mainLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    mainLayout.setStyleName(ValoTheme.FORMLAYOUT_LIGHT);

    setCompositionRoot(mainLayout);

    listeners.forEach(listener -> listener.viewInitialized(this));
}

From source file:net.sf.gazpachoquest.questionnaires.views.login.OldLoginView.java

License:Open Source License

public OldLoginView() {
    setSizeFull();//from ww w .ja v  a  2s .  c  o  m

    // Language bar in the top-right corner for selecting
    // invitation interface language
    final HorizontalLayout languageBar = new HorizontalLayout();
    languageBar.setHeight("50px");
    // addComponent(languageBar);
    // setComponentAlignment(languageBar, Alignment.TOP_RIGHT);

    // Allow selecting a language. We are in a constructor of a
    // CustomComponent, so preselecting the current
    // language of the application can not be done before
    // this (and the selection) component are attached to
    // the application.
    final ComboBox languageSelector = new ComboBox("Select a language") {
        @Override
        public void attach() {
            super.attach();
            // setValue(getLocale());
        }
    };

    // for (int i=0; i<locales.length; i++) {
    String locale = "es";
    languageSelector.addItem(locale);
    languageSelector.setItemCaption(locale, "espaol");

    // Automatically select the current locale
    // if (locales[i].equals(getLocale()))
    languageSelector.setValue(locale);

    // }

    // Create the invitation input field
    invitationTextField = new TextField("Invitation key:");
    invitationTextField.setWidth("300px");
    invitationTextField.setRequired(true);
    invitationTextField.setInputPrompt("Your questionnair invitation key (eg. 12345678)");
    invitationTextField.setInvalidAllowed(false);

    // Create login button
    enterButton = new Button("Enter", this);

    // Add both to a panel
    VerticalLayout fields = new VerticalLayout(languageSelector, invitationTextField, enterButton);
    fields.setCaption("Please enter your invitation key to access the questionnair");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
    setCompositionRoot(viewLayout);
}

From source file:org.activiti.explorer.ui.content.file.ImageAttachmentRenderer.java

License:Apache License

@Override
public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeUndefined();
    verticalLayout.setSpacing(true);//from  www.  j a v  a2s  . co  m
    verticalLayout.setMargin(true);

    Label description = new Label(attachment.getDescription());
    description.setSizeUndefined();
    verticalLayout.addComponent(description);

    // Image
    TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();

    String mimeType = extractMineType(attachment.getType());

    InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()),
            mimeType, 900, 550);
    Resource resource = new StreamResource(new InputStreamStreamSource(imageStream),
            attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get());
    Embedded image = new Embedded(null, resource);
    verticalLayout.addComponent(image);

    // Linke
    HorizontalLayout LinkLayout = new HorizontalLayout();
    LinkLayout.setSpacing(true);
    verticalLayout.addComponent(LinkLayout);
    verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER);

    Label fullSizeLabel = new Label(
            ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE));
    LinkLayout.addComponent(fullSizeLabel);

    Link link = null;
    if (attachment.getUrl() != null) {
        link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
    } else {
        taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
        Resource res = new StreamResource(
                new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())),
                attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get());

        link = new Link(attachment.getName(), res);
    }

    link.setIcon(Images.RELATED_CONTENT_PICTURE);
    link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
    LinkLayout.addComponent(link);

    return verticalLayout;
}

From source file:org.activiti.explorer.ui.content.GenericAttachmentRenderer.java

License:Apache License

public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeUndefined();
    verticalLayout.setSpacing(true);//ww w  .  j  av a2  s  .  c  om
    verticalLayout.setMargin(true);

    Label description = new Label(attachment.getDescription());
    description.setSizeUndefined();
    verticalLayout.addComponent(description);

    HorizontalLayout linkLayout = new HorizontalLayout();
    linkLayout.setSpacing(true);
    verticalLayout.addComponent(linkLayout);

    // Image
    linkLayout.addComponent(new Embedded(null, getImage(attachment)));

    // Link
    Link link = null;
    if (attachment.getUrl() != null) {
        link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
    } else {
        TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
        Resource res = new StreamResource(
                new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())),
                attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get());

        link = new Link(attachment.getName(), res);
    }

    // Set generic image and external window 
    link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
    linkLayout.addComponent(link);

    return verticalLayout;
}