Example usage for com.vaadin.ui Panel setSizeUndefined

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

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:ch.bfh.ti.soed.hs16.srs.black.view.loginView.LoginView.java

License:Open Source License

public LoginView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    loginButton = new Button("Login");
    loginButton.setWidth(5, Unit.EM);//from  w w  w. j a v a  2  s  . c  o m
    loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signUpButton = new Button("Sign Up");
    signUpButton.setWidth(6, Unit.EM);

    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout layoutButtons = new HorizontalLayout(loginButton, signUpButton);
    layoutButtons.setSpacing(true);
    Panel panel = new Panel("Login - Smart ReservationEntity System");
    panel.setSizeUndefined();
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, layoutButtons);
    content.setSizeFull();
    content.setMargin(true);
    panel.setContent(content);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java

License:Open Source License

public SignUpView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    passwordFieldRepeat = new PasswordField("Repeat Password");
    passwordFieldRepeat.setIcon(FontAwesome.KEY);
    passwordFieldRepeat.setWidth(12, Unit.EM);
    addUserButton = new Button("Add New User");
    addUserButton.setWidth(12, Unit.EM);
    goBackButton = new Button("Back");

    VerticalLayout layout = new VerticalLayout();
    Panel panel = new Panel("Sign Up - Smart ReservationEntity System");
    panel.setSizeUndefined();
    layout.addComponent(panel);/*from w w  w  .  ja  v  a  2  s.  c  om*/

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndBack = new VerticalLayout(content, goBackButton);
    formAndBack.setMargin(true);
    panel.setContent(formAndBack);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java

License:Open Source License

/**
 * Method which actually creates the whole UI.
 *//*from   w  w  w  .  ja  v a 2 s .  c  o  m*/
@Override
protected void init(VaadinRequest vaadinRequest) {

    VerticalLayout layout = new VerticalLayout();

    Panel panel = new Panel("Login");
    panel.setSizeUndefined();

    FormLayout content = new FormLayout();
    userName = new TextField("Username");
    content.addComponent(userName);

    PasswordField password = new PasswordField("Password");
    content.addComponent(password);

    Button login = new Button("Login");
    register = new Button("Register");
    CheckBox askBox = new CheckBox("Are you a Roommanager?");

    login.setStyleName(Reindeer.BUTTON_SMALL);
    login.setWidth("86px");

    register.setStyleName(Reindeer.BUTTON_SMALL);
    register.setWidth("86px");
    askBox.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.addComponent(login);
    hl.addComponent(register);
    hl.addComponent(askBox);

    content.addComponent(hl);
    content.setSizeUndefined();
    content.setMargin(true);

    panel.setContent(content);

    login.addClickListener(e -> {
        System.out.println(userName.getValue());
        System.out.println(password.getValue());
        try {
            if (controller.login(userName.getValue(), password.getValue())
                    || userName.equals(userName.getValue()) && password.equals(password.getValue())) {
                setContent(new ReservationUI());
            }
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    register.addClickListener(e -> {
        try {
            Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER;
            controller.register(userName.getValue(), password.getValue(), x);
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(panel);
    setContent(layout);
}

From source file:com.expressui.core.view.page.DashboardPage.java

License:Open Source License

/**
 * Adds a component to the dashboard.//www  .j  a v  a 2 s .c  o  m
 *
 * @param component   component to add
 * @param caption     caption to display above component
 * @param startRow    start row coordinate in Dashboard grid
 * @param startColumn start column coordinate in Dashboard grid
 * @param endRow      end row coordinate in Dashboard grid
 * @param endColumn   end column coordinate in Dashboard grid
 */
public void addComponent(Component component, String caption, int startRow, int startColumn, int endRow,
        int endColumn) {
    if (component instanceof TypedComponent && !((TypedComponent) component).isViewAllowed())
        return;

    Panel panel = new Panel(caption);
    panel.addStyleName(ChameleonTheme.PANEL_BUBBLE);
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSizeUndefined();
    panel.setSizeUndefined();

    setWidthAndHeightIfNotNull(component);

    panel.setContent(panelLayout);
    panelLayout.setMargin(true);
    panelLayout.setSpacing(true);
    panelLayout.addComponent(component);
    int rows = Math.max(rootLayout.getRows() - 1, endRow);
    int columns = Math.max(rootLayout.getColumns() - 1, endColumn);

    if (rootLayout.getRows() < rows) {
        rootLayout.setRows(rows);
    }
    if (rootLayout.getColumns() < columns) {
        rootLayout.setColumns(columns);
    }

    removeComponent(startRow, startColumn);
    rootLayout.addComponent(panel, startColumn - 1, startRow - 1, endColumn - 1, endRow - 1);
}

From source file:com.expressui.sample.view.LoginPage.java

License:Open Source License

@PostConstruct
@Override//from  ww  w  .j  a  v a 2s  .c o m
public void postConstruct() {
    super.postConstruct();

    setSizeFull();

    LoginForm loginForm = new LoginForm();
    loginForm.addStyleName("border");
    loginForm.setSizeUndefined();
    loginForm.setLoginButtonCaption(uiMessageSource.getMessage("loginPage.button"));
    loginForm.setUsernameCaption(uiMessageSource.getMessage("loginPage.username"));
    loginForm.setPasswordCaption(uiMessageSource.getMessage("loginPage.password"));
    loginForm.addListener(new LoginHandler());

    Panel panel = new Panel();
    panel.addStyleName("loginPage");
    panel.addStyleName("border");
    panel.setSizeUndefined();
    panel.setCaption(uiMessageSource.getMessage("loginPage.caption"));
    panel.addComponent(loginForm);
    panel.addComponent(new Label(uiMessageSource.getMessage("loginPage.tip")));

    addComponent(panel);
    setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
}

From source file:com.liferay.mail.vaadin.MessageToolbar.java

License:Open Source License

protected void selectMoveTarget() {

    // Ensure a mail is selected
    List<Message> message = mainMailView.getSelectedMessages();
    if (message.isEmpty()) {
        Controller.get().showInfo(Lang.get("no-messages-selected"));
        return;//from   w  w  w . jav  a  2 s . co  m
    }

    Account account;
    try {
        account = MessageUtil.getAccountForMessage(message.get(0));
    } catch (Exception e) {
        Controller.get().showError(Lang.get("unable-to-move-messages"), e);
        return;
    }

    VerticalLayout panelLayout = new VerticalLayout();
    panelLayout.setMargin(false, true, true, false);
    panelLayout.setSizeUndefined();

    Panel p = new Panel(panelLayout);
    p.setSizeUndefined();

    final PopupView popupView = new PopupView("", p);

    FolderTree destinationTree = new FolderTree(new FolderChangeListener() {

        public void selectedFolderChanged(Folder folder) {

            if (folder != null) {
                popupView.setPopupVisible(false);
                Controller controller = Controller.get();
                try {
                    MessageUtil.moveMessagesTo(mainMailView.getSelectedMessages(), folder);

                    controller.showInfo(Lang.get("messages-have-been-moved"));
                } catch (MailException me) {
                    if (me.getType() == MailException.FOLDER_INVALID_DESTINATION) {
                        controller.showError(Lang.get("cannot-move-messages-to-this-folder"));
                    }
                } catch (PortalException e) {
                    controller.showError(Lang.get("unable-to-move-messages"), e);
                } catch (SystemException e) {
                    controller.showError(Lang.get("unable-to-move-messages"), e);
                }

            }
        }
    }, null);

    p.addComponent(destinationTree);

    popupView.setPopupVisible(true);
    popupView.addListener(new PopupVisibilityListener() {

        public void popupVisibilityChange(PopupVisibilityEvent event) {

            // Remove popupview from layout when it has been closed
            if (!event.isPopupVisible()) {
                removeComponent(event.getPopupView());

            }
        }
    });

    // Set tree properties
    List<Account> accounts = new ArrayList<Account>();
    accounts.add(account);
    final FolderContainer folderContainer = new FolderContainer(accounts);

    destinationTree.setContainerDataSource(folderContainer);
    destinationTree.expandItemsRecursively(destinationTree.rootItemIds().iterator().next());

    addComponent(popupView, moveToIndex);

}

From source file:com.logicbomb.newschool.MyAppWidgetSet.LoginWidget.java

public LoginWidget() {
    setMargin(true);/*from   w ww.  j av a2s . co  m*/
    setSpacing(true);

    Panel iPanel = new Panel();
    iPanel.addStyleName("backColorWhite");
    iPanel.setSizeUndefined();

    addComponent(iPanel);

    TextField iTextField = new TextField("Username");
    iTextField.setWidth("300px");
    iTextField.setRequired(true);
    iTextField.setInputPrompt("Your username (eg. joe@email.com)");
    iTextField.setIcon(FontAwesome.USER);
    iTextField.addValidator(new EmailValidator("Username must be an email address"));
    iTextField.setInvalidAllowed(true);
    iTextField.focus();

    PasswordField iPasswordField = new PasswordField("Password");
    iPasswordField.setIcon(FontAwesome.KEY);
    iPasswordField.setWidth("300px");
    iPasswordField.setRequired(true);
    iPasswordField.setValue("");
    iPasswordField.setNullRepresentation("");

    Button iButton = new Button("Login");
    iButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            addComponent(new Label("Login Successfully"));
        }
    });

    FormLayout iFormLayout = new FormLayout();
    iFormLayout.setSpacing(true);
    iFormLayout.setMargin(true);
    iFormLayout.addComponent(iTextField);
    iFormLayout.addComponent(iPasswordField);
    iFormLayout.addComponent(iButton);
    iPanel.setContent(iFormLayout);

}

From source file:de.gedoplan.webclients.vaadin.LoginUi.java

@Override
protected void init(VaadinRequest request) {
    TextField name = new TextField(Messages.login_name.value());
    name.focus();/* ww w.  j a  va  2s.  c om*/
    PasswordField password = new PasswordField(Messages.login_password.value());
    Button login = new Button(Messages.login_submit.value(), e -> {
        try {
            JaasAccessControl.login(name.getValue(), password.getValue());
            Page.getCurrent().setLocation(Konstanten.VAADIN_UI_PATH);
        } catch (ServletException ex) {
            Notification.show(Messages.login_invalid.value(), Notification.Type.ERROR_MESSAGE);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    FormLayout fieldLayout = new FormLayout(name, password, login);
    fieldLayout.setMargin(true);
    fieldLayout.setSpacing(true);
    Panel loginPanel = new Panel(Messages.login_title.value(), fieldLayout);
    loginPanel.setSizeUndefined();
    VerticalLayout page = new VerticalLayout();
    page.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    page.addComponent(loginPanel);
    page.setSizeFull();
    setContent(page);
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabSuperActive.java

License:Open Source License

@Override
public void initGui() {
    Label leftLabel = new Label("Super-active chains are sets of cards that have two or more authors "
            + "and four or more follow-on cards at two levels.");
    this.getLeftLayout().addComponent(leftLabel, "top:0px;left:0px");

    Panel pan = new Panel();
    getRightLayout().addComponent(pan, "top:0px;left:0px");
    pan.setSizeUndefined();
    pan.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout tableLay = new VerticalLayout();
    pan.setContent(tableLay);/*ww  w .  j  a v  a2 s  .c  o  m*/
    tableLay.setMargin(false); // default comes back from panel w/ margins
    tableLay.setSizeUndefined();

    tree = new CardChainTree(null, true); // no cards at first
    tree.setWidth("680px");
    tree.setHeight("730px");
    tree.addStyleName("m-greyborder");
    tableLay.addComponent(tree);
}

From source file:edu.vserver.exercises.videoMcq.QuestionForm.java

License:Apache License

/**
 * Builds UI components and the layout for them.
 *//*w ww. j a v  a  2  s  .  com*/
private void doLayout() {

    VerticalLayout questionUI = new VerticalLayout();

    HorizontalLayout mainButtons = new HorizontalLayout();
    //mainButtons.setMargin(true);
    mainButtons.setSpacing(true);
    this.newQuestionBtn.setWidth(100, Unit.PIXELS);
    this.cancelButton.setWidth(100, Unit.PIXELS);
    this.saveButton.setWidth(100, Unit.PIXELS);
    mainButtons.addComponents(this.newQuestionBtn, this.cancelButton, this.saveButton);
    questionUI.addComponent(mainButtons);
    this.initTextFields();
    this.inputLayout.setSpacing(true);
    this.inputLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    VerticalLayout questionLayout = new VerticalLayout();

    this.timeLayout.setMargin(new MarginInfo(true, false, true, false));
    this.timeLayout.addComponents(new Label("<strong>Time:</strong>", ContentMode.HTML), this.timeLabel,
            new Label("<strong> / </strong>", ContentMode.HTML), this.durationLabel);
    this.timeLayout.setSpacing(true);
    questionLayout.addComponents(this.timeLayout, this.questionField);

    VerticalLayout correctAnswers = new VerticalLayout();
    correctAnswers.addComponents(this.answerField, this.answerDescriptionField);

    VerticalLayout wrongAnswers = new VerticalLayout();
    wrongAnswers.setCaption("Incorrect answer choices");
    HorizontalLayout wrongAnswerButtons = new HorizontalLayout();
    wrongAnswerButtons.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    wrongAnswerButtons.setSpacing(true);
    wrongAnswerButtons.setMargin(true);
    wrongAnswerButtons.addComponents(this.addIncorrectAnswer, this.clearIncorrectAnswers);

    Panel wrongAswersScroller = new Panel();
    wrongAswersScroller.setSizeUndefined();
    wrongAswersScroller.setHeight(100, Unit.PIXELS);
    wrongAswersScroller.setWidth(215, Unit.PIXELS);
    wrongAswersScroller.addStyleName("borderless");

    wrongAswersScroller.setContent(this.wrongAnswersLayout);
    wrongAnswers.addComponents(wrongAnswerButtons, wrongAswersScroller);

    this.inputLayout.addComponents(questionLayout, correctAnswers, wrongAnswers);
    questionUI.addComponent(this.inputLayout);
    this.setCompositionRoot(questionUI);
}