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(String caption) 

Source Link

Document

Creates a new empty panel with caption.

Usage

From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java

License:Apache License

@Override
public Component getContent() {
    Panel form = new Panel(TRANSLATOR.translate("step.detail"));
    if (getExecutionStep().getExecutionStart() == null) {
        //Set the start date.
        getExecutionStep().setExecutionStart(new Date());
    }//from w  w  w  .j  a va2  s .  c o m
    FormLayout layout = new FormLayout();
    form.setContent(layout);
    form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    BeanFieldGroup binder = new BeanFieldGroup(getExecutionStep().getStep().getClass());
    binder.setItemDataSource(getExecutionStep().getStep());
    TextArea text = new TextArea(TRANSLATOR.translate("general.text"));
    text.setConverter(new ByteToStringConverter());
    binder.bind(text, "text");
    text.setSizeFull();
    layout.addComponent(text);
    Field notes = binder.buildAndBind(TRANSLATOR.translate("general.notes"), "notes", TextArea.class);
    notes.setSizeFull();
    layout.addComponent(notes);
    if (getExecutionStep().getExecutionStart() != null) {
        start = new DateField(TRANSLATOR.translate("start.date"));
        start.setResolution(Resolution.SECOND);
        start.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
        start.setValue(getExecutionStep().getExecutionStart());
        start.setReadOnly(true);
        layout.addComponent(start);
    }
    if (getExecutionStep().getExecutionEnd() != null) {
        end = new DateField(TRANSLATOR.translate("end.date"));
        end.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
        end.setResolution(Resolution.SECOND);
        end.setValue(getExecutionStep().getExecutionEnd());
        end.setReadOnly(true);
        layout.addComponent(end);
    }
    binder.setReadOnly(true);
    //Space to record result
    if (getExecutionStep().getResultId() != null) {
        result.setValue(getExecutionStep().getResultId().getResultName());
    }
    layout.addComponent(result);
    if (reviewer) {//Space to record review
        if (getExecutionStep().getReviewResultId() != null) {
            review.setValue(getExecutionStep().getReviewResultId().getReviewName());
        }
        layout.addComponent(review);
    }
    //Add Reviewer name
    if (getExecutionStep().getReviewer() != null) {
        TextField reviewerField = new TextField(TRANSLATOR.translate("general.reviewer"));
        reviewerField.setValue(getExecutionStep().getReviewer().getFirstName() + " "
                + getExecutionStep().getReviewer().getLastName());
        reviewerField.setReadOnly(true);
        layout.addComponent(reviewerField);
    }
    if (getExecutionStep().getReviewDate() != null) {
        reviewDate = new DateField(TRANSLATOR.translate("review.date"));
        reviewDate.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
        reviewDate.setResolution(Resolution.SECOND);
        reviewDate.setValue(getExecutionStep().getReviewDate());
        reviewDate.setReadOnly(true);
        layout.addComponent(reviewDate);
    }
    if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) {
        TextArea expectedResult = new TextArea(TRANSLATOR.translate("expected.result"));
        expectedResult.setConverter(new ByteToStringConverter());
        binder.bind(expectedResult, "expectedResult");
        expectedResult.setSizeFull();
        layout.addComponent(expectedResult);
    }
    //Add the fields
    fields.clear();
    getExecutionStep().getStep().getDataEntryList().forEach(de -> {
        switch (de.getDataEntryType().getId()) {
        case 1://String
            TextField tf = new TextField(TRANSLATOR.translate(de.getEntryName()));
            tf.setRequired(true);
            tf.setData(de.getEntryName());
            if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) {
                //Add expected result
                DataEntryProperty stringCase = DataEntryServer.getProperty(de, "property.match.case");
                DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result");
                if (r != null && !r.getPropertyValue().equals("null")) {
                    String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue();
                    tf.setRequiredError(error);
                    tf.setRequired(DataEntryServer.getProperty(de, "property.required").getPropertyValue()
                            .equals("true"));
                    tf.addValidator((Object val) -> {
                        //We have an expected result and a match case requirement
                        if (stringCase != null && stringCase.getPropertyValue().equals("true")
                                ? !((String) val).equals(r.getPropertyValue())
                                : !((String) val).equalsIgnoreCase(r.getPropertyValue())) {
                            throw new InvalidValueException(error);
                        }
                    });
                }
            }
            fields.add(tf);
            //Set value if already recorded
            updateValue(tf);
            layout.addComponent(tf);
            break;
        case 2://Numeric
            NumberField field = new NumberField(TRANSLATOR.translate(de.getEntryName()));
            field.setSigned(true);
            field.setUseGrouping(true);
            field.setGroupingSeparator(',');
            field.setDecimalSeparator('.');
            field.setConverter(new StringToDoubleConverter());
            field.setRequired(
                    DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true"));
            field.setData(de.getEntryName());
            Double min = null, max = null;
            for (DataEntryProperty prop : de.getDataEntryPropertyList()) {
                String value = prop.getPropertyValue();
                if (prop.getPropertyName().equals("property.max")) {
                    try {
                        max = Double.parseDouble(value);
                    } catch (NumberFormatException ex) {
                        //Leave as null
                    }
                } else if (prop.getPropertyName().equals("property.min")) {
                    try {
                        min = Double.parseDouble(value);
                    } catch (NumberFormatException ex) {
                        //Leave as null
                    }
                }
            }
            //Add expected result
            if (VMSettingServer.getSetting("show.expected.result").getBoolVal()
                    && (min != null || max != null)) {
                String error = TRANSLATOR.translate("error.out.of.range") + " "
                        + (min == null ? " " : (TRANSLATOR.translate("property.min") + ": " + min)) + " "
                        + (max == null ? "" : (TRANSLATOR.translate("property.max") + ": " + max));
                field.setRequiredError(error);
                field.addValidator(new DoubleRangeValidator(error, min, max));
            }
            fields.add(field);
            //Set value if already recorded
            updateValue(field);
            layout.addComponent(field);
            break;
        case 3://Boolean
            CheckBox cb = new CheckBox(TRANSLATOR.translate(de.getEntryName()));
            cb.setData(de.getEntryName());
            cb.setRequired(
                    DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true"));
            if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) {
                DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result");
                if (r != null) {
                    //Add expected result
                    String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue();
                    cb.addValidator((Object val) -> {
                        if (!val.toString().equals(r.getPropertyValue())) {
                            throw new InvalidValueException(error);
                        }
                    });
                }
            }
            fields.add(cb);
            //Set value if already recorded
            updateValue(cb);
            layout.addComponent(cb);
            break;
        case 4://Attachment
            Label l = new Label(TRANSLATOR.translate(de.getEntryName()));
            layout.addComponent(l);
            break;
        default:
            LOG.log(Level.SEVERE, "Unexpected field type: {0}", de.getDataEntryType().getId());
        }
    });
    //Add the Attachments
    HorizontalLayout attachments = new HorizontalLayout();
    attachments.setCaption(TRANSLATOR.translate("general.attachment"));
    HorizontalLayout comments = new HorizontalLayout();
    comments.setCaption(TRANSLATOR.translate("general.comments"));
    HorizontalLayout issues = new HorizontalLayout();
    issues.setCaption(TRANSLATOR.translate("general.issue"));
    int commentCounter = 0;
    int issueCounter = 0;
    for (ExecutionStepHasIssue ei : getExecutionStep().getExecutionStepHasIssueList()) {
        issueCounter++;
        Button a = new Button("Issue #" + issueCounter);
        a.setIcon(VaadinIcons.BUG);
        a.addClickListener((Button.ClickEvent event) -> {
            displayIssue(new IssueServer(ei.getIssue()));
        });
        a.setEnabled(!step.getLocked());
        issues.addComponent(a);
    }
    for (ExecutionStepHasAttachment attachment : getExecutionStep().getExecutionStepHasAttachmentList()) {
        switch (attachment.getAttachment().getAttachmentType().getType()) {
        case "comment": {
            //Comments go in a different section
            commentCounter++;
            Button a = new Button("Comment #" + commentCounter);
            a.setIcon(VaadinIcons.CLIPBOARD_TEXT);
            a.addClickListener((Button.ClickEvent event) -> {
                if (!step.getLocked()) {
                    //Prompt if user wants this removed
                    MessageBox mb = getDeletionPrompt(attachment);
                    mb.open();
                } else {
                    displayComment(new AttachmentServer(attachment.getAttachment().getAttachmentPK()));
                }
            });
            a.setEnabled(!step.getLocked());
            comments.addComponent(a);
            break;
        }
        default: {
            Button a = new Button(attachment.getAttachment().getFileName());
            a.setEnabled(!step.getLocked());
            a.setIcon(VaadinIcons.PAPERCLIP);
            a.addClickListener((Button.ClickEvent event) -> {
                if (!step.getLocked()) {
                    //Prompt if user wants this removed
                    MessageBox mb = getDeletionPrompt(attachment);
                    mb.open();
                } else {
                    displayAttachment(new AttachmentServer(attachment.getAttachment().getAttachmentPK()));
                }
            });
            attachments.addComponent(a);
            break;
        }
        }
    }
    if (attachments.getComponentCount() > 0) {
        layout.addComponent(attachments);
    }
    if (comments.getComponentCount() > 0) {
        layout.addComponent(comments);
    }
    if (issues.getComponentCount() > 0) {
        layout.addComponent(issues);
    }
    //Add the menu
    HorizontalLayout hl = new HorizontalLayout();
    attach = new Button(TRANSLATOR.translate("add.attachment"));
    attach.setIcon(VaadinIcons.PAPERCLIP);
    attach.addClickListener((Button.ClickEvent event) -> {
        //Show dialog to upload file.
        Window dialog = new VMWindow(TRANSLATOR.translate("attach.file"));
        VerticalLayout vl = new VerticalLayout();
        MultiFileUpload multiFileUpload = new MultiFileUpload() {
            @Override
            protected void handleFile(File file, String fileName, String mimeType, long length) {
                try {
                    LOG.log(Level.FINE, "Received file {1} at: {0}",
                            new Object[] { file.getAbsolutePath(), fileName });
                    //Process the file
                    //Create the attachment
                    AttachmentServer a = new AttachmentServer();
                    a.addFile(file, fileName);
                    //Overwrite the default file name set in addFile. It'll be a temporary file name
                    a.setFileName(fileName);
                    a.write2DB();
                    //Now add it to this Execution Step
                    if (getExecutionStep().getExecutionStepHasAttachmentList() == null) {
                        getExecutionStep().setExecutionStepHasAttachmentList(new ArrayList<>());
                    }
                    getExecutionStep().addAttachment(a);
                    getExecutionStep().write2DB();
                    w.updateCurrentStep();
                } catch (Exception ex) {
                    LOG.log(Level.SEVERE, "Error creating attachment!", ex);
                }
            }
        };
        multiFileUpload.setCaption(TRANSLATOR.translate("select.files.attach"));
        vl.addComponent(multiFileUpload);
        dialog.setContent(vl);
        dialog.setHeight(25, Sizeable.Unit.PERCENTAGE);
        dialog.setWidth(25, Sizeable.Unit.PERCENTAGE);
        ValidationManagerUI.getInstance().addWindow(dialog);
    });
    hl.addComponent(attach);
    bug = new Button(TRANSLATOR.translate("create.issue"));
    bug.setIcon(VaadinIcons.BUG);
    bug.addClickListener((Button.ClickEvent event) -> {
        displayIssue(new IssueServer());
    });
    hl.addComponent(bug);
    comment = new Button(TRANSLATOR.translate("add.comment"));
    comment.setIcon(VaadinIcons.CLIPBOARD_TEXT);
    comment.addClickListener((Button.ClickEvent event) -> {
        AttachmentServer as = new AttachmentServer();
        //Get comment type
        AttachmentType type = AttachmentTypeServer.getTypeForExtension("comment");
        as.setAttachmentType(type);
        displayComment(as);
    });
    hl.addComponent(comment);
    step.update();
    attach.setEnabled(!step.getLocked());
    bug.setEnabled(!step.getLocked());
    comment.setEnabled(!step.getLocked());
    result.setEnabled(!step.getLocked());
    layout.addComponent(hl);
    return layout;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java

License:Apache License

private void displayIssue(IssueServer is) {
    Panel form = new Panel(TRANSLATOR.translate("general.issue"));
    FormLayout layout = new FormLayout();
    form.setContent(layout);//from w  w  w .  ja v  a 2  s.  c  o m
    if (is.getIssuePK() == null) {
        //Set creation date
        is.setCreationTime(new Date());
    }
    BeanFieldGroup binder = new BeanFieldGroup(is.getClass());
    binder.setItemDataSource(is);
    Field title = binder.buildAndBind(TRANSLATOR.translate("general.summary"), "title", TextField.class);
    title.setSizeFull();
    layout.addComponent(title);
    Field desc = binder.buildAndBind(TRANSLATOR.translate("general.description"), "description",
            TextArea.class);
    desc.setSizeFull();
    layout.addComponent(desc);
    DateField creation = (DateField) binder.buildAndBind(TRANSLATOR.translate("creation.time"), "creationTime",
            DateField.class);
    creation.setReadOnly(true);
    creation.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
    creation.setResolution(Resolution.SECOND);
    layout.addComponent(creation);
    //Add the result
    layout.addComponent(issueType);
    if (is.getIssueType() != null) {
        issueType.setValue(is.getIssueType().getTypeName());
    }
    //Lock if being created
    issueType.setReadOnly(is.getIssueType() == null);
    MessageBox mb = MessageBox.create();
    mb.setData(is);
    mb.asModal(true).withMessage(layout).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> {
        try {
            //Create the attachment
            IssueServer issue = (IssueServer) mb.getData();
            issue.setDescription(((TextArea) desc).getValue().trim());
            issue.setIssueType((IssueType) issueType.getValue());
            issue.setCreationTime(creation.getValue());
            issue.setTitle((String) title.getValue());
            boolean toAdd = issue.getIssuePK() == null;
            issue.write2DB();
            if (toAdd) {
                //Now add it to this Execution Step
                if (getExecutionStep().getExecutionStepHasIssueList() == null) {
                    getExecutionStep().setExecutionStepHasIssueList(new ArrayList<>());
                }
                getExecutionStep().addIssue(issue, ValidationManagerUI.getInstance().getUser());
                getExecutionStep().write2DB();
            }
            w.updateCurrentStep();
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK), ButtonOption.disable())
            .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE));
    mb.getWindow().setCaption(TRANSLATOR.translate("issue.detail"));
    mb.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
    ((TextArea) desc).addTextChangeListener((TextChangeEvent event1) -> {
        //Enable if there is a description change.
        mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty());
    });
    ((TextField) title).addTextChangeListener((TextChangeEvent event1) -> {
        //Enable if there is a title change.
        mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty());
    });
    mb.open();
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java

License:Apache License

private void displayComment(AttachmentServer as) {
    Panel form = new Panel(TRANSLATOR.translate("general.comment"));
    FormLayout layout = new FormLayout();
    form.setContent(layout);/*  w  ww  . j a va 2s  .  c  om*/
    BeanFieldGroup binder = new BeanFieldGroup(as.getClass());
    binder.setItemDataSource(as);
    Field desc = binder.buildAndBind(TRANSLATOR.translate("general.text"), "textValue", TextArea.class);
    desc.setSizeFull();
    layout.addComponent(desc);
    MessageBox mb = MessageBox.create();
    mb.setData(as);
    mb.asModal(true).withMessage(desc).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> {
        try {
            //Create the attachment
            AttachmentServer a = (AttachmentServer) mb.getData();
            a.setTextValue(((TextArea) desc).getValue().trim());
            boolean toAdd = a.getAttachmentPK() == null;
            a.write2DB();
            if (toAdd) {
                //Now add it to this Execution Step
                if (getExecutionStep().getExecutionStepHasAttachmentList() == null) {
                    getExecutionStep().setExecutionStepHasAttachmentList(new ArrayList<>());
                }
                getExecutionStep().addAttachment(a);
                getExecutionStep().write2DB();
            }
            w.updateCurrentStep();
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK), ButtonOption.disable())
            .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE));
    mb.getWindow().setCaption(TRANSLATOR.translate("enter.comment"));
    mb.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
    ((TextArea) desc).addTextChangeListener((TextChangeEvent event1) -> {
        //Enable only when there is a comment.
        mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty());
    });
    mb.open();
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java

License:Apache License

private Component getContentComponent() {
    HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
    hsplit.setLocked(true);//from  www.  java 2  s  . co  m
    if (left != null) {
        if (!(left instanceof Panel)) {
            left = new Panel(left);
        }
        if (user != null) {
            hsplit.setFirstComponent(left);
        }
    }
    tabSheet.removeAllComponents();
    //Build the right component
    main = tabSheet.addTab(new VerticalLayout(), TRANSLATOR.translate("general.main"));
    Lookup.getDefault().lookupAll(IMainContentProvider.class).forEach((provider) -> {
        Iterator<Component> it = tabSheet.iterator();
        Component me = findMainProvider(provider.getComponentCaption());
        if (me == null) {
            if (provider.shouldDisplay()) {
                LOG.log(Level.FINE, "Loading: {0}", TRANSLATOR.translate(provider.getComponentCaption()));
                tabSheet.addTab(provider.getContent(), TRANSLATOR.translate(provider.getComponentCaption()));
            }
        } else {
            provider.update();
        }
        //Hide if needed
        if (me != null && !provider.shouldDisplay()) {
            tabSheet.removeComponent(me);
        }
    });
    hsplit.setSecondComponent(tabSheet);
    //This is a tabbed pane. Enable/Disable the panes based on role
    if (getUser() != null) {
        roles.clear();
        user.update();//Get any recent changes
        user.getRoleList().forEach((r) -> {
            roles.add(r.getRoleName());
        });
    }
    hsplit.setSplitPosition(25, Unit.PERCENTAGE);
    return hsplit;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.plan.DetailStep.java

License:Apache License

@Override
public Component getContent() {
    Panel form = new Panel("execution.detail");
    FormLayout layout = new FormLayout();
    form.setContent(layout);//w w w  .  j a v a2s. com
    form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    BeanFieldGroup binder = new BeanFieldGroup(TestCaseExecution.class);
    binder.setItemDataSource(tce);
    TextArea name = new TextArea("general.name");
    name.setConverter(new ByteToStringConverter());
    binder.bind(name, "name");
    layout.addComponent(name);
    TextArea scope = new TextArea("general.scope");
    scope.setConverter(new ByteToStringConverter());
    binder.bind(scope, "scope");
    layout.addComponent(scope);
    if (tce.getId() != null) {
        TextArea conclusion = new TextArea("general.conclusion");
        conclusion.setConverter(new ByteToStringConverter());
        binder.bind(conclusion, "conclusion");
        layout.addComponent(conclusion);
        conclusion.setSizeFull();
        layout.addComponent(conclusion);
    }
    binder.setBuffered(false);
    binder.bindMemberFields(form);
    form.setSizeFull();
    return form;
}

From source file:nl.kpmg.lcm.ui.view.administration.AuthorizedLcmPanel.java

License:Apache License

private HorizontalLayout initDataLayout() throws UnsupportedOperationException {
    VerticalLayout tableLayout = new VerticalLayout();

    authorizedLcmsTable = createAuthorizedLcmTable();
    tableLayout.addComponent(authorizedLcmsTable);
    tableLayout.addStyleName("padding-right-20");

    authorizedLcmPanel = new Panel("Authorized LCM details");
    authorizedLcmPanel.setWidth(DETAILS_PANEL_WIDTH);
    authorizedLcmPanel.setHeight("100%");

    HorizontalLayout dataLayout = new HorizontalLayout();
    dataLayout.addComponent(tableLayout);
    dataLayout.addComponent(authorizedLcmPanel);
    dataLayout.setWidth("100%");
    dataLayout.setExpandRatio(tableLayout, 1f);

    return dataLayout;
}

From source file:nl.kpmg.lcm.ui.view.administration.RemoteLcmPanel.java

License:Apache License

private HorizontalLayout initDataLayout() throws UnsupportedOperationException {

    remoteLcmTable = constructTable();/* w w w.jav a  2  s. c  o  m*/
    VerticalLayout tableLayout = new VerticalLayout();
    tableLayout.addComponent(remoteLcmTable);
    tableLayout.addStyleName("padding-right-20");

    detailsPanel = new Panel("Remote LCM details");
    detailsPanel.setWidth(PANEL_SIZE);
    detailsPanel.setHeight("100%");

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.addComponent(tableLayout);
    horizontalLayout.addComponent(detailsPanel);
    horizontalLayout.setWidth("100%");
    horizontalLayout.setExpandRatio(tableLayout, 1f);

    return horizontalLayout;
}

From source file:nl.kpmg.lcm.ui.view.administration.StoragePanel.java

License:Apache License

private HorizontalLayout initDataLayout() throws UnsupportedOperationException {
    VerticalLayout tableLayout = new VerticalLayout();

    storageTable = createStorageTable();
    tableLayout.addComponent(storageTable);
    tableLayout.addStyleName("padding-right-20");

    storageDetailsPanel = new Panel("Storage details");
    storageDetailsPanel.setWidth(DETAILS_PANEL_WIDTH);
    storageDetailsPanel.setHeight("100%");

    HorizontalLayout dataLayout = new HorizontalLayout();
    dataLayout.addComponent(tableLayout);
    dataLayout.addComponent(storageDetailsPanel);
    dataLayout.setWidth("100%");
    dataLayout.setExpandRatio(tableLayout, 1f);

    return dataLayout;
}

From source file:nl.kpmg.lcm.ui.view.administration.UserGroupPanel.java

License:Apache License

private HorizontalLayout initDataLayout() throws UnsupportedOperationException {
    VerticalLayout tableLayout = new VerticalLayout();

    userGroupTable = createUserTable();// ww w  . j av  a2  s.c  o  m
    tableLayout.addComponent(userGroupTable);
    tableLayout.addStyleName("padding-right-20");

    userGroupDetailsPanel = new Panel("User details");
    userGroupDetailsPanel.setWidth(DETAILS_PANEL_WIDTH);
    userGroupDetailsPanel.setHeight("100%");

    HorizontalLayout dataLayout = new HorizontalLayout();
    dataLayout.addComponent(tableLayout);
    dataLayout.addComponent(userGroupDetailsPanel);
    dataLayout.setWidth("100%");
    dataLayout.setExpandRatio(tableLayout, 1f);

    return dataLayout;
}

From source file:nl.kpmg.lcm.ui.view.administration.UserPanel.java

License:Apache License

private HorizontalLayout initDataLayout() throws UnsupportedOperationException {
    VerticalLayout tableLayout = new VerticalLayout();

    userTable = createUserTable();/*from  ww w . ja  v a  2  s . c o m*/
    tableLayout.addComponent(userTable);
    tableLayout.addStyleName("padding-right-20");

    userDetailsPanel = new Panel("User details");
    userDetailsPanel.setWidth(DETAILS_PANEL_WIDTH);
    userDetailsPanel.setHeight("100%");

    HorizontalLayout dataLayout = new HorizontalLayout();
    dataLayout.addComponent(tableLayout);
    dataLayout.addComponent(userDetailsPanel);
    dataLayout.setWidth("100%");
    dataLayout.setExpandRatio(tableLayout, 1f);

    return dataLayout;
}