Example usage for com.vaadin.ui VerticalLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.ow2.sirocco.cloudmanager.MachineView.java

License:Open Source License

public MachineView() {
    this.setSizeFull();

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();

    HorizontalLayout actionButtonHeader = new HorizontalLayout();
    actionButtonHeader.setMargin(true);/*from   w  w w. j  a  v  a 2 s . c o  m*/
    actionButtonHeader.setSpacing(true);
    actionButtonHeader.setWidth("100%");
    actionButtonHeader.setHeight("50px");

    Button button = new Button("Launch Instance...");
    button.setIcon(new ThemeResource("img/add.png"));
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            if (MachineView.this.machineCreationWizard.init(MachineView.this)) {
                UI.getCurrent().addWindow(MachineView.this.machineCreationWizard);
            }
        }
    });
    actionButtonHeader.addComponent(button);

    this.startMachineButton = new Button("Start");
    this.startMachineButton.setIcon(new ThemeResource("img/poweron.png"));
    this.startMachineButton.setEnabled(false);
    this.startMachineButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            Set<?> selectedMachineIds = (Set<?>) MachineView.this.machineTable.getValue();
            String id = (String) selectedMachineIds.iterator().next();
            try {
                MachineView.this.machineManager.startMachine(id);
            } catch (CloudProviderException e) {
                Util.diplayErrorMessageBox("Cannot start instance", e);
            }
        }
    });
    actionButtonHeader.addComponent(this.startMachineButton);

    this.stopMachineButton = new Button("Stop");
    this.stopMachineButton.setIcon(new ThemeResource("img/poweroff.png"));
    this.stopMachineButton.setEnabled(false);
    this.stopMachineButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            Set<?> selectedMachineIds = (Set<?>) MachineView.this.machineTable.getValue();
            String id = (String) selectedMachineIds.iterator().next();
            try {
                MachineView.this.machineManager.stopMachine(id);
            } catch (CloudProviderException e) {
                Util.diplayErrorMessageBox("Cannot stop instance", e);
            }
        }
    });
    actionButtonHeader.addComponent(this.stopMachineButton);

    this.restartMachineButton = new Button("Reboot");
    this.restartMachineButton.setIcon(new ThemeResource("img/restart.png"));
    this.restartMachineButton.setEnabled(false);
    this.restartMachineButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            Set<?> selectedMachineIds = (Set<?>) MachineView.this.machineTable.getValue();
            String id = (String) selectedMachineIds.iterator().next();
            try {
                MachineView.this.machineManager.restartMachine(id, false);
            } catch (CloudProviderException e) {
                Util.diplayErrorMessageBox("Cannot reboot instance", e);
            }
        }
    });
    actionButtonHeader.addComponent(this.restartMachineButton);

    this.deleteMachineButton = new Button("Delete");
    this.deleteMachineButton.setIcon(new ThemeResource("img/delete.png"));
    this.deleteMachineButton.setEnabled(false);
    this.deleteMachineButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            final Set<?> selectedMachineIds = (Set<?>) MachineView.this.machineTable.getValue();
            StringBuilder sb = new StringBuilder();
            sb.append("Are you sure you want to delete ");
            if (selectedMachineIds.size() == 1) {
                Object id = selectedMachineIds.iterator().next();
                sb.append("instance " + MachineView.this.machines.getItem(id).getBean().getName() + " ?");
            } else {
                sb.append(" these " + selectedMachineIds.size() + " instances ?");
            }
            ConfirmDialog confirmDialog = ConfirmDialog.newConfirmDialog("Delete Machine", sb.toString(),
                    new ConfirmDialog.ConfirmationDialogCallback() {

                        @Override
                        public void response(final boolean ok, final boolean ignored) {
                            if (ok) {
                                for (Object id : selectedMachineIds) {
                                    try {
                                        MachineView.this.machineManager.deleteMachine(id.toString());
                                    } catch (CloudProviderException e) {
                                        Util.diplayErrorMessageBox("Cannot delete instance", e);
                                    }
                                }
                                MachineView.this.valueChange(null);
                            }
                        }
                    });
            MachineView.this.getUI().addWindow(confirmDialog);
        }
    });
    actionButtonHeader.addComponent(this.deleteMachineButton);

    Label spacer = new Label();
    spacer.setWidth("100%");
    actionButtonHeader.addComponent(spacer);
    actionButtonHeader.setExpandRatio(spacer, 1.0f);

    button = new Button("Refresh", new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            MachineView.this.refresh();
        }
    });
    button.setIcon(new ThemeResource("img/refresh.png"));
    actionButtonHeader.addComponent(button);

    verticalLayout.addComponent(actionButtonHeader);
    verticalLayout.addComponent(this.machineTable = this.createMachineTable());
    verticalLayout.setExpandRatio(this.machineTable, 1.0f);

    this.setFirstComponent(verticalLayout);
    this.setSecondComponent(this.detailView = new MachineDetailView(this));
    this.setSplitPosition(60.0f);

}

From source file:org.ow2.sirocco.cloudmanager.MyUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest request) {
    this.userName = request.getUserPrincipal().getName();
    this.identityContext.setUserName(this.userName);

    this.getPage().setTitle("Sirocco Dashboard");
    final VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    this.setContent(layout);

    // Top header *********************
    HorizontalLayout header = new HorizontalLayout();
    header.setMargin(true);//from w  w w . j av a2s . c  o m
    header.setWidth("100%");
    header.setHeight("70px");
    header.setStyleName("topHeader");

    // logo
    Image image = new Image(null, new ThemeResource("img/sirocco_small_logo.png"));
    header.addComponent(image);

    // spacer
    Label spacer = new Label();
    spacer.setWidth("100%");
    header.addComponent(spacer);
    header.setExpandRatio(spacer, 1.0f);

    HorizontalLayout rightButtons = new HorizontalLayout();
    rightButtons.setStyleName("topHeader");
    rightButtons.setSpacing(true);

    this.userName = request.getUserPrincipal().getName();
    User user = null;
    try {
        user = this.userManager.getUserByUsername(this.userName);
    } catch (CloudProviderException e) {
        e.printStackTrace();
    }

    Label label = new Label("Tenant:");
    label.setStyleName("topHeaderLabel");
    rightButtons.addComponent(label);
    final ComboBox tenantSelect = new ComboBox();
    tenantSelect.setTextInputAllowed(false);
    tenantSelect.setNullSelectionAllowed(false);
    for (Tenant tenant : user.getTenants()) {
        tenantSelect.addItem(tenant.getName());
    }
    tenantSelect.setValue(user.getTenants().iterator().next().getName());
    tenantSelect.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(final ValueChangeEvent event) {
            Notification.show("Switching to tenant " + tenantSelect.getValue());

        }
    });
    tenantSelect.setImmediate(true);
    rightButtons.addComponent(tenantSelect);

    this.tenantId = user.getTenants().iterator().next().getUuid();
    this.identityContext.setTenantId(this.tenantId);

    // logged user name

    label = new Label("Logged in as: " + this.userName);
    label.setStyleName("topHeaderLabel");
    rightButtons.addComponent(label);

    // sign out button
    Button button = new Button("Sign Out");
    // button.setStyleName(BaseTheme.BUTTON_LINK);
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(final ClickEvent event) {
            MyUI.this.logout();
        }
    });
    rightButtons.addComponent(button);

    header.addComponent(rightButtons);
    layout.addComponent(header);

    // Split view
    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    splitPanel.setFirstComponent(this.createLeftMenu());

    this.inventoryContainer = new VerticalLayout();
    this.inventoryContainer.setSizeFull();

    this.inventoryContainer.addComponent(this.machineView);

    splitPanel.setSecondComponent(this.inventoryContainer);
    splitPanel.setSplitPosition(15);

    layout.addComponent(splitPanel);
    layout.setExpandRatio(splitPanel, 1.0f);

    this.listenToNotifications();

}

From source file:org.ow2.sirocco.cloudmanager.ProviderAccountDetailView.java

License:Open Source License

public ProviderAccountDetailView(final CloudProviderView providerView) {
    this.providerView = providerView;
    this.setSizeFull();
    this.setSpacing(true);
    this.setMargin(true);
    this.addStyleName("detailmargins");
    this.setVisible(false);
    this.title = new Label();
    this.title.setStyleName("detailTitle");
    this.addComponent(this.title);
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*w  ww  .  ja  va  2 s. co m*/

    VerticalLayout attributeTab = new VerticalLayout();
    attributeTab.setSizeFull();
    this.attributeTable = new Table();
    attributeTab.addComponent(this.attributeTable);
    this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    this.attributeTable.setSizeFull();
    this.attributeTable.setPageLength(0);
    this.attributeTable.setSelectable(false);
    this.attributeTable.addContainerProperty("attribute", String.class, null);
    this.attributeTable.addContainerProperty("value", String.class, null);
    this.attributeTable.addContainerProperty("edit", Button.class, null);
    this.attributeTable.setColumnWidth("edit", 400);

    tabSheet.addTab(attributeTab, "Attributes");

    this.metadataView = new MetadataView(this);

    tabSheet.addTab(this.metadataView, "Metadata");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1.0f);
}

From source file:org.ow2.sirocco.cloudmanager.SecurityGroupDetailView.java

License:Open Source License

public SecurityGroupDetailView(final SecurityGroupView securityGroupView) {
    this.securityGroupView = securityGroupView;
    this.setSizeFull();
    this.setSpacing(true);
    this.setMargin(true);
    this.addStyleName("detailmargins");
    this.setVisible(false);
    this.title = new Label();
    this.title.setStyleName("detailTitle");
    this.addComponent(this.title);
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*from   w  w  w.j  ava  2  s.c o  m*/

    VerticalLayout attributeTab = new VerticalLayout();
    attributeTab.setSizeFull();
    this.attributeTable = new Table();
    attributeTab.addComponent(this.attributeTable);
    this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    this.attributeTable.setSizeFull();
    this.attributeTable.setPageLength(0);
    this.attributeTable.setSelectable(false);
    this.attributeTable.addContainerProperty("attribute", String.class, null);
    this.attributeTable.addContainerProperty("value", String.class, null);
    this.attributeTable.addContainerProperty("edit", Button.class, null);
    this.attributeTable.setColumnWidth("edit", 400);

    tabSheet.addTab(attributeTab, "Attributes");

    this.ruleView = new SecurityGroupRuleView();
    tabSheet.addTab(this.ruleView, "Rules");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1.0f);
}

From source file:org.ow2.sirocco.cloudmanager.SecurityGroupView.java

License:Open Source License

public SecurityGroupView() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();

    HorizontalLayout actionButtonHeader = new HorizontalLayout();
    actionButtonHeader.setMargin(true);/*from  w  w  w  .jav a  2 s .c om*/
    actionButtonHeader.setSpacing(true);
    actionButtonHeader.setWidth("100%");
    actionButtonHeader.setHeight("50px");

    Button button = new Button("Create SecurityGroup...");
    button.setIcon(new ThemeResource("img/add.png"));
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            if (SecurityGroupView.this.securityGroupCreationWizard.init(SecurityGroupView.this)) {
                UI.getCurrent().addWindow(SecurityGroupView.this.securityGroupCreationWizard);
            }
        }
    });
    actionButtonHeader.addComponent(button);

    this.deleteSecurityGroupButton = new Button("Delete");
    this.deleteSecurityGroupButton.setIcon(new ThemeResource("img/delete.png"));
    this.deleteSecurityGroupButton.setEnabled(false);
    this.deleteSecurityGroupButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            final Set<?> selectedSecurityGroupIds = (Set<?>) SecurityGroupView.this.securityGroupTable
                    .getValue();
            String name = SecurityGroupView.this.securityGroups
                    .getItem(selectedSecurityGroupIds.iterator().next()).getBean().getName();
            ConfirmDialog confirmDialog = ConfirmDialog.newConfirmDialog("Delete SecurityGroup",
                    "Are you sure you want to delete securityGroup " + name + " ?",
                    new ConfirmDialog.ConfirmationDialogCallback() {

                        @Override
                        public void response(final boolean ok, final boolean ignored) {
                            if (ok) {
                                for (Object id : selectedSecurityGroupIds) {
                                    try {
                                        SecurityGroupView.this.networkManager
                                                .deleteSecurityGroup(id.toString());
                                    } catch (CloudProviderException e) {
                                        Util.diplayErrorMessageBox("Cannot delete security group "
                                                + SecurityGroupView.this.securityGroups.getItem(id).getBean()
                                                        .getName(),
                                                e);
                                    }
                                }
                                SecurityGroupView.this.valueChange(null);
                            }
                        }
                    });
            SecurityGroupView.this.getUI().addWindow(confirmDialog);
        }
    });
    actionButtonHeader.addComponent(this.deleteSecurityGroupButton);

    Label spacer = new Label();
    spacer.setWidth("100%");
    actionButtonHeader.addComponent(spacer);
    actionButtonHeader.setExpandRatio(spacer, 1.0f);

    button = new Button("Refresh", new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            SecurityGroupView.this.refresh();
        }
    });
    button.setIcon(new ThemeResource("img/refresh.png"));
    actionButtonHeader.addComponent(button);

    verticalLayout.addComponent(actionButtonHeader);
    verticalLayout.addComponent(this.securityGroupTable = this.createSecurityGroupTable());
    verticalLayout.setExpandRatio(this.securityGroupTable, 1.0f);

    this.setFirstComponent(verticalLayout);
    this.setSecondComponent(this.detailView = new SecurityGroupDetailView(this));
    this.setSplitPosition(60.0f);

}

From source file:org.ozkar.vaadinBootstrapp.login.LoginPage.java

public LoginPage() {

    final VerticalLayout root = new VerticalLayout();
    final FormLayout loginForm = new FormLayout();

    txtUsername.setRequired(true);// www . j a  v a  2 s. c  o m
    txtPassword.setRequired(true);
    btnOk.setClickShortcut(KeyCode.ENTER);

    root.addComponent(loginForm);
    root.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER);
    root.setSizeFull();

    loginForm.addComponent(txtUsername);
    loginForm.addComponent(txtPassword);
    loginForm.addComponent(btnOk);

    loginForm.setSpacing(true);
    loginForm.setMargin(new MarginInfo(true, true, true, false));
    loginForm.setCaption(":::LOGIN:::");
    loginForm.setSizeUndefined();

    this.setSizeFull();
    this.setCompositionRoot(root);

    /* Event Handling */
    btnOk.addClickListener((Button.ClickEvent event) -> {

        User user = User.getUser(txtUsername.getValue());

        if (AuthUtils.validUser(user, txtPassword.getValue())) {
            Notification.show("Bienvenido...");
            AuthUtils.logIn(getUI(), user);
            getUI().getNavigator().navigateTo(HomePage.URL);
        } else {
            Notification.show("Usuario o Contrasea Incorrecto.");
        }
    });

}

From source file:org.plukh.fluffymeow.ui.FluffyUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    //Create and set root layout
    VerticalLayout root = new VerticalLayout();
    root.setSizeFull();
    setContent(root);//from   w w  w  . j  av  a  2  s.c  o m

    //Create and add header
    Header header = injector.getInstance(Header.class);
    root.addComponent(header);

    //Add navigable part
    navigableContent.setSizeFull();
    root.addComponent(navigableContent);
    root.setExpandRatio(navigableContent, 1.0f);

    //Create and add footer
    Footer footer = injector.getInstance(Footer.class);
    root.addComponent(footer);

    //Set locale as the last init action, after all components/views have been created
    setLocale(getPage().getWebBrowser().getLocale());
}

From source file:org.processbase.ui.bpm.admin.UserWindow.java

License:Open Source License

public void initUI() {
    try {//w w w .  j  ava  2 s. c  om
        if (user == null) {
            setCaption(ProcessbaseApplication.getString("newUser"));
        } else {
            setCaption(ProcessbaseApplication.getString("user"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);
        layout.setSizeFull();

        addBtn = new Button(ProcessbaseApplication.getString("btnAdd"), this);
        closeBtn = new Button(ProcessbaseApplication.getString("btnClose"), this);
        saveBtn = new Button(ProcessbaseApplication.getString("btnSave"), this);
        userFirstName = new TextField(ProcessbaseApplication.getString("userFirstName"));
        userLastName = new TextField(ProcessbaseApplication.getString("userLastName"));
        userName = new TextField(ProcessbaseApplication.getString("userName"));
        userEmail = new TextField(ProcessbaseApplication.getString("userEmail"));
        userJobTitle = new TextField(ProcessbaseApplication.getString("userJobTitle"));
        password = new PasswordField(ProcessbaseApplication.getString("password"));

        // prepare user information
        userInfofmation.setMargin(true);
        userInfofmation.setSpacing(true);
        userName.setWidth("270px");
        userInfofmation.addComponent(userName);
        password.setWidth("270px");
        userInfofmation.addComponent(password);
        userFirstName.setWidth("270px");
        userInfofmation.addComponent(userFirstName);
        userLastName.setWidth("270px");
        userInfofmation.addComponent(userLastName);
        userEmail.setWidth("270px");
        userInfofmation.addComponent(userEmail);
        userJobTitle.setWidth("270px");
        userInfofmation.addComponent(userJobTitle);

        // prepare user membership
        userMembership.setMargin(true);
        userMembership.setSpacing(true);
        userMembership.setSizeFull();
        prepareTableMembership();
        userMembership.addComponent(tableMembership);

        // prepare user metadata
        userMetadata.setMargin(true);
        userMetadata.setSpacing(true);
        userMetadata.setSizeFull();
        prepareTableMetadata();
        userMetadata.addComponent(tableMetadata);

        // prepare tabSheet
        tabSheet.addTab(userInfofmation, ProcessbaseApplication.getString("userInfofmation"), null);
        tabSheet.addTab(userMembership, ProcessbaseApplication.getString("userMembership"), null);
        tabSheet.addTab(userMetadata, ProcessbaseApplication.getString("userMetadata"), null);
        tabSheet.addListener((TabSheet.SelectedTabChangeListener) this);
        tabSheet.setImmediate(true);
        tabSheet.setSizeFull();
        layout.addComponent(tabSheet);
        layout.setExpandRatio(tabSheet, 1);

        addBtn.setVisible(false);
        buttons.addButton(addBtn);
        buttons.setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT);
        buttons.addButton(saveBtn);
        buttons.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(saveBtn, 1);
        buttons.addButton(closeBtn);
        buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);

        if (user != null) {
            userFirstName.setValue(user.getFirstName());
            userLastName.setValue(user.getLastName());
            userName.setValue(user.getUsername());
            userEmail.setValue(
                    user.getProfessionalContactInfo() != null ? user.getProfessionalContactInfo().getEmail()
                            : "");
            userJobTitle.setValue(user.getJobTitle());
            password.setValue(user.getPassword());
            refreshTableMembership();
            refreshTableMetadata();
            userName.setReadOnly(true);
        }
        setWidth("800px");
        setHeight("500px");
        setResizable(false);
        setModal(true);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
        throw new RuntimeException(ex);
    }
}

From source file:org.processbase.ui.bpm.identity.UserWindow.java

License:Open Source License

public void initUI() {
    try {/*ww w . j a v a  2s.c o m*/
        if (user == null) {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("newUser"));
        } else {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("user"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);
        layout.setSizeFull();

        addBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this);
        closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this);
        saveBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
        userFirstName = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userFirstName"));
        userLastName = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userLastName"));
        userName = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("userName"));
        userEmail = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("userEmail"));
        userJobTitle = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userJobTitle"));
        password = new PasswordField(ProcessbaseApplication.getCurrent().getPbMessages().getString("password"));

        // prepare user information
        userInfofmation.setMargin(true);
        userInfofmation.setSpacing(true);
        userName.setWidth("270px");
        userInfofmation.addComponent(userName);
        password.setWidth("270px");
        userInfofmation.addComponent(password);
        userFirstName.setWidth("270px");
        userInfofmation.addComponent(userFirstName);
        userLastName.setWidth("270px");
        userInfofmation.addComponent(userLastName);
        userEmail.setWidth("270px");
        userInfofmation.addComponent(userEmail);
        userJobTitle.setWidth("270px");
        userInfofmation.addComponent(userJobTitle);

        // prepare user membership
        userMembership.setMargin(true);
        userMembership.setSpacing(true);
        userMembership.setSizeFull();
        prepareTableMembership();
        userMembership.addComponent(tableMembership);

        // prepare user metadata
        userMetadata.setMargin(true);
        userMetadata.setSpacing(true);
        userMetadata.setSizeFull();
        prepareTableMetadata();
        userMetadata.addComponent(tableMetadata);

        // prepare tabSheet
        tabSheet.addTab(userInfofmation,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userInfofmation"), null);
        tabSheet.addTab(userMembership,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userMembership"), null);
        tabSheet.addTab(userMetadata,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userMetadata"), null);
        tabSheet.addListener((TabSheet.SelectedTabChangeListener) this);
        tabSheet.setImmediate(true);
        tabSheet.setSizeFull();
        layout.addComponent(tabSheet);
        layout.setExpandRatio(tabSheet, 1);

        addBtn.setVisible(false);
        buttons.addButton(addBtn);
        buttons.setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT);
        buttons.addButton(saveBtn);
        buttons.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(saveBtn, 1);
        buttons.addButton(closeBtn);
        buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);

        if (user != null) {
            userFirstName.setValue(user.getFirstName());
            userLastName.setValue(user.getLastName());
            userName.setValue(user.getUsername());
            userEmail.setValue(
                    user.getProfessionalContactInfo() != null ? user.getProfessionalContactInfo().getEmail()
                            : "");
            userJobTitle.setValue(user.getJobTitle());
            password.setValue(user.getPassword());
            refreshTableMembership();
            refreshTableMetadata();
            userName.setReadOnly(true);
        }
        setWidth("800px");
        setHeight("500px");
        setResizable(false);
        setModal(true);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.processbase.ui.core.template.DefaultConfirmDialogFactory.java

License:Open Source License

public ConfirmDialog create(final String caption, final String message, final String okCaption,
        final String cancelCaption) {

    // Create a confirm dialog
    final ConfirmDialog confirm = new ConfirmDialog();
    confirm.setCaption(caption != null ? caption : DEFAULT_CAPTION);

    // Close listener implementation
    confirm.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1971800928047045825L;

        public void windowClose(CloseEvent ce) {
            confirm.setConfirmed(false);
            if (confirm.getListener() != null) {
                confirm.getListener().onClose(confirm);
            }/*from   w ww . jav  a 2 s. com*/
        }
    });

    // Create content
    VerticalLayout c = (VerticalLayout) confirm.getContent();
    c.setSizeFull();
    c.setSpacing(true);

    // Panel for scrolling lengthty messages.
    Panel scroll = new Panel(new VerticalLayout());
    scroll.setScrollable(true);
    c.addComponent(scroll);
    scroll.setWidth("100%");
    scroll.setHeight("100%");
    scroll.setStyleName(Reindeer.PANEL_LIGHT);
    c.setExpandRatio(scroll, 1f);

    // Always HTML, but escape
    Label text = new Label("", Label.CONTENT_RAW);
    scroll.addComponent(text);
    confirm.setMessageLabel(text);
    confirm.setMessage(message);

    HorizontalLayout buttons = new HorizontalLayout();
    c.addComponent(buttons);
    buttons.setSpacing(true);

    buttons.setHeight(format(BUTTON_HEIGHT) + "em");
    buttons.setWidth("100%");
    Label spacer = new Label("");
    buttons.addComponent(spacer);
    spacer.setWidth("100%");
    buttons.setExpandRatio(spacer, 1f);

    final Button cancel = new Button(cancelCaption != null ? cancelCaption : DEFAULT_CANCEL_CAPTION);
    cancel.setData(false);
    cancel.setClickShortcut(KeyCode.ESCAPE, null);
    buttons.addComponent(cancel);
    buttons.setComponentAlignment(cancel, Alignment.MIDDLE_RIGHT);
    confirm.setCancelButton(cancel);

    final Button ok = new Button(okCaption != null ? okCaption : DEFAULT_OK_CAPTION);
    ok.setData(true);
    ok.setClickShortcut(KeyCode.ENTER, null);
    ok.setStyleName(Reindeer.BUTTON_DEFAULT);
    ok.focus();
    buttons.addComponent(ok);
    buttons.setComponentAlignment(ok, Alignment.MIDDLE_RIGHT);
    confirm.setOkButton(ok);

    // Create a listener for buttons
    Button.ClickListener cb = new Button.ClickListener() {
        private static final long serialVersionUID = 3525060915814334881L;

        public void buttonClick(ClickEvent event) {
            // Copy the button date to window for passing through either
            // "OK" or "CANCEL"
            confirm.setConfirmed(event.getButton() == ok);

            // This has to be invoked as the window.close
            // event is not fired when removed.
            if (confirm.getListener() != null) {
                confirm.getListener().onClose(confirm);
            }
            confirm.close();

        }

    };
    cancel.addListener(cb);
    ok.addListener(cb);

    // Approximate the size of the dialog
    double[] dim = getDialogDimensions(message, ConfirmDialog.CONTENT_TEXT_WITH_NEWLINES);
    confirm.setWidth(format(dim[0]) + "em");
    confirm.setHeight(format(dim[1]) + "em");
    confirm.setResizable(false);

    return confirm;
}