Example usage for com.vaadin.ui GridLayout setWidth

List of usage examples for com.vaadin.ui GridLayout setWidth

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.esofthead.mycollab.vaadin.web.ui.MailFormWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);//  w w  w  .jav a 2  s  . c o  m
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
        for (String mail : lstMail) {
            if (StringUtils.isNotBlank(mail)) {
                if (mail.indexOf("<") > -1) {
                    String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
                    if (strMail != null && !strMail.equalsIgnoreCase("null")) {

                    }
                } else {

                }
            }
        }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    controlsLayout.addComponent(uploadExt);
    controlsLayout.setExpandRatio(uploadExt, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    MailFormWindow.this.close();
                }
            });

    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn = new Button("Send", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) {
                NotificationUtil.showErrorNotification(
                        "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
                return;
            }
            if (AppContext.getUser().getEmail() != null && AppContext.getUser().getEmail().length() > 0) {
                ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class);

                List<File> listFile = attachments.files();
                List<EmailAttachmentSource> emailAttachmentSource = null;
                if (listFile != null && listFile.size() > 0) {
                    emailAttachmentSource = new ArrayList<>();
                    for (File file : listFile) {
                        emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                }

                systemMailService.sendHTMLMail(AppContext.getUser().getEmail(),
                        AppContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(),
                        tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(),
                        subject.getValue(), noteArea.getValue(), emailAttachmentSource);
                MailFormWindow.this.close();
            } else {
                NotificationUtil.showErrorNotification(
                        "Your email is empty value, please fulfil it before sending email!");
            }
        }
    });
    sendBtn.setIcon(FontAwesome.SEND);
    sendBtn.setStyleName(UIConstants.BUTTON_ACTION);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 2);

    this.setContent(mainLayout);
}

From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//  w  w  w. ja  va  2  s.  c  o m
    form.setSpacing(true);

    CellItem ci = cis.getCellItemById(getCellItemId());
    if (ci.getCellItemId() == 0) {
        ci = hs.getCellItemById(getCellItemId());
    }

    keyList = k.getAllItemKey(getCellItemId());
    keyIndexSize = keyList.size();
    if (keyList.isEmpty()) {
        ShowErrorNotification.error("No Item Key was found for STEM: \n" + ci.getItem());
        return null;
    }
    stem = ci.getItem().replace("{key}", "<u>" + keyList.get(getKeyIndex()) + "</u>");

    label.setValue("<b>STEM</b>: " + getStem());
    label.setContentMode(ContentMode.HTML);
    form.addComponent(label);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setWidth("100%");

    OptionGroup options = new OptionGroup();
    options.addItems(ci.getOptionA(), ci.getOptionB(), ci.getOptionC(), ci.getOptionD());
    options.addValueChangeListener((Property.ValueChangeEvent event) -> {
        boolean result = k.isAnswerCorrect(getCellItemId(), getItemKey(),
                CommonUtilities.escapeSingleQuote(event.getProperty().getValue()));
        if (result) {
            Notification.show("Correct Answer!", Notification.Type.TRAY_NOTIFICATION);
        } else {
            Notification.show("Wrong Answer", Notification.Type.TRAY_NOTIFICATION);
        }
    });
    h1.addComponent(options);
    h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER);
    form.addComponent(h1);

    GridLayout g = new GridLayout(2, 2);
    g.setWidth("100%");
    g.setSpacing(true);

    prev = new Button();
    prev.setWidth("50px");
    prev.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT);
    prev.addStyleName(ValoTheme.BUTTON_PRIMARY);
    prev.addStyleName(ValoTheme.BUTTON_SMALL);
    prev.addClickListener(prevBtnClickListener);
    g.addComponent(prev, 0, 0);
    g.setComponentAlignment(prev, Alignment.MIDDLE_LEFT);

    next = new Button();
    next.setWidth("50px");
    next.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT);
    next.addStyleName(ValoTheme.BUTTON_PRIMARY);
    next.addStyleName(ValoTheme.BUTTON_SMALL);
    next.addClickListener(nextBtnClickListener);
    g.addComponent(next, 1, 0);
    g.setComponentAlignment(next, Alignment.MIDDLE_RIGHT);

    if (getKeyIndexSize() == 1) {
        prev.setEnabled(false);
        next.setEnabled(false);
    }

    populateDataTable();
    g.addComponent(table, 0, 1, 1, 1);
    g.setComponentAlignment(table, Alignment.MIDDLE_CENTER);
    form.addComponent(g);

    return form;
}

From source file:com.etest.view.tq.reports.OnlineQueriesUI.java

public OnlineQueriesUI() {
    setWidth("100%");
    setMargin(true);/*  www .  ja v  a2 s.  c o m*/
    setSpacing(true);

    Label lineSeparator1 = new Label();
    lineSeparator1.setContentMode(ContentMode.HTML);
    lineSeparator1.setStyleName("line-separator");

    Label lineSeparator2 = new Label();
    lineSeparator2.setContentMode(ContentMode.HTML);
    lineSeparator2.setStyleName("line-separator");

    disableAllComponents(false);

    GridLayout topGrid = new GridLayout(3, 2);
    topGrid.setWidth("800px");
    topGrid.setSpacing(true);

    VerticalLayout top = new VerticalLayout();
    top.setWidth("166px");

    graphicalInventory.addItem("Graphical Inventory");
    graphicalInventory.setWidth("300px");
    top.addComponent(graphicalInventory);
    graphicalInventory.addValueChangeListener(firstLevelOptionListener);
    graphicalInventory.setImmediate(true);

    graphicalInventoryGroup.addItem("All Subjects");

    Label subjectProportionedCaption = new Label();
    subjectProportionedCaption.setWidth("500px");
    subjectProportionedCaption
            .setCaption("A Subject's No. of Items Proportioned " + "According to the Revised Bloom's Taxonomy");
    subjectProportionedCaption.setContentMode(ContentMode.HTML);
    subjectProportionedCaption.setHeightUndefined();

    graphicalInventoryGroup.addItem(subjectProportionedCaption.getCaption());
    graphicalInventoryGroup.setWidth("400px");
    graphicalInventoryGroup.addValueChangeListener(secondLevelTopOptionListener);
    graphicalInventoryGroup.setImmediate(true);

    topGrid.addComponent(top, 0, 0);
    topGrid.addComponent(graphicalInventoryGroup, 1, 0, 2, 0);
    addComponent(topGrid);

    searchSubject1.setInputPrompt("Search Subject");
    searchSubject1.setWidth("225px");
    searchSubject1.addValueChangeListener(dropDownChangeListener);
    searchSubject1.setEnabled(false);
    topGrid.addComponent(searchSubject1, 1, 1);

    addComponent(lineSeparator1);

    GridLayout bottomGrid = new GridLayout(3, 3);
    bottomGrid.setWidth("800px");
    bottomGrid.setSpacing(true);

    VerticalLayout bottom = new VerticalLayout();
    bottom.setWidth("235px");

    itemAnalysis.addItem("Item Analysis");
    itemAnalysis.setWidth("310px");
    bottom.addComponent(itemAnalysis);
    itemAnalysis.addValueChangeListener(firstLevelOptionListener);
    itemAnalysis.setImmediate(true);

    graphicalView.addItem("Graphical View");
    graphicalView.setWidth("210px");
    graphicalView.addValueChangeListener(secondLevelBottomOptionListener);
    graphicalView.setImmediate(true);

    tabularView.addItem("Tabular View");
    tabularView.addValueChangeListener(secondLevelBottomOptionListener);
    tabularView.setImmediate(true);

    graphicalViewGroup.addItem("Summary: All Tests of a Subject");
    graphicalViewGroup.addItem("Difficulty Index of a Subject's Test");
    graphicalViewGroup.addItem("Discrimination Index of a Subject's Test");
    graphicalViewGroup.setWidth("300px");
    graphicalViewGroup.addValueChangeListener(thirdLevelBottomOptionListener);
    graphicalViewGroup.setImmediate(true);

    tabularViewGroup.addItem("Summary: All Tests of a Subject");
    tabularViewGroup.addItem("Critical values of a test");
    tabularViewGroup.addValueChangeListener(thirdLevelBottomOptionListener);
    tabularViewGroup.setImmediate(true);

    searchSubject2.setInputPrompt("Search Subject");
    searchSubject2.setWidth("225px");
    searchSubject2.addValueChangeListener(dropDownChangeListener);
    searchSubject2.setEnabled(false);
    searchTest.setWidth("225px");
    searchTest.setInputPrompt("Search Test");
    searchTest.setEnabled(false);
    searchTest.addStyleName(ValoTheme.COMBOBOX_SMALL);

    bottomGrid.addComponent(bottom, 0, 0);
    bottomGrid.addComponent(graphicalView, 1, 0);
    bottomGrid.addComponent(tabularView, 1, 1);
    bottomGrid.addComponent(graphicalViewGroup, 2, 0);
    bottomGrid.addComponent(tabularViewGroup, 2, 1);
    bottomGrid.addComponent(searchSubject2, 1, 2);
    bottomGrid.addComponent(searchTest, 2, 2);
    addComponent(bottomGrid);

    addComponent(lineSeparator2);

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");
    h.setMargin(true);

    Button calculateAndViewBtn = new Button("Calculate & View");
    calculateAndViewBtn.setWidth("300px");
    calculateAndViewBtn.addClickListener(buttonClickListener);
    h.addComponent(calculateAndViewBtn);
    h.setComponentAlignment(calculateAndViewBtn, Alignment.MIDDLE_LEFT);
    addComponent(calculateAndViewBtn);

}

From source file:com.etest.view.tq.reports.ReportGeneratorUI.java

public ReportGeneratorUI() {
    setWidth("100%");
    setMargin(true);//from w w  w. j  av a 2s.  c om
    setSpacing(true);

    Label lineSeparator1 = new Label();
    lineSeparator1.setContentMode(ContentMode.HTML);
    lineSeparator1.setStyleName("line-separator");

    Label lineSeparator2 = new Label();
    lineSeparator2.setContentMode(ContentMode.HTML);
    lineSeparator2.setStyleName("line-separator");

    Label lineSeparator3 = new Label();
    lineSeparator3.setContentMode(ContentMode.HTML);
    lineSeparator3.setStyleName("line-separator");

    searchSubject1.addValueChangeListener(dropDownChangeListener);
    searchSubject1.setEnabled(false);
    searchApproveTq1.setWidth("100%");
    searchApproveTq1.setInputPrompt("Search Approved TQ");
    searchApproveTq1.setEnabled(false);
    searchApproveTq1.addStyleName(ValoTheme.COMBOBOX_SMALL);

    searchSubject2.addValueChangeListener(dropDownChangeListener);
    searchSubject2.setEnabled(false);
    searchApproveTq2.setWidth("100%");
    searchApproveTq2.setInputPrompt("Search TQ Ticket No.");
    searchApproveTq2.setEnabled(false);
    searchApproveTq2.addStyleName(ValoTheme.COMBOBOX_SMALL);

    GridLayout g1 = new GridLayout(3, 1);
    g1.setWidth("70%");
    g1.setSpacing(true);

    VerticalLayout v1 = new VerticalLayout();
    v1.setWidth("5px");

    reportType1.addItem("Test Questionnaire");
    reportType1.setWidth("200px");
    reportType1.addValueChangeListener(optionChangeListener);
    reportType1.setImmediate(true);
    v1.addComponent(reportType1);
    v1.setExpandRatio(reportType1, 1);
    g1.addComponent(v1, 0, 0);
    g1.addComponent(searchSubject1, 1, 0);
    g1.addComponent(searchApproveTq1, 2, 0);

    addComponent(g1);

    addComponent(lineSeparator1);

    GridLayout g2 = new GridLayout(3, 1);
    g2.setWidth("70%");
    g2.setSpacing(true);

    VerticalLayout v2 = new VerticalLayout();
    v2.setWidth("5px");

    reportType2.addItem("Item Analysis");
    reportType2.setWidth("200px");
    reportType2.addValueChangeListener(optionChangeListener);
    reportType2.setImmediate(true);
    v2.addComponent(reportType2);
    v2.setExpandRatio(reportType2, 1);
    g2.addComponent(v2, 0, 0);
    g2.addComponent(searchSubject2, 1, 0);
    g2.addComponent(searchApproveTq2, 2, 0);

    addComponent(g2);

    addComponent(lineSeparator2);

    GridLayout g3 = new GridLayout(3, 1);
    g3.setWidth("70%");
    g3.setSpacing(true);

    VerticalLayout v3 = new VerticalLayout();
    v3.setWidth("5px");

    reportType3.addItem("Test Bank Inventory");
    reportType3.setWidth("200px");
    reportType3.addValueChangeListener(optionChangeListener);
    reportType3.setImmediate(true);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setSpacing(true);

    testBankInventory.addItem("Summary: Case vs Items");
    testBankInventory.addItem("Summary: Items Group according to the Revised Blooms Taxonomy");
    testBankInventory.setImmediate(true);
    testBankInventory.select("Summary: Case vs Items");

    testBankInventory.setEnabled(false);
    v.addComponent(testBankInventory);

    v3.addComponent(reportType3);
    v3.setExpandRatio(reportType3, 1);
    g3.addComponent(v3, 0, 0);
    g3.setComponentAlignment(v3, Alignment.TOP_LEFT);
    g3.addComponent(v, 1, 0);
    addComponent(g3);

    //        addComponent(new Label("<HR>", ContentMode.HTML));
    addComponent(lineSeparator3);

    Button button = new Button("Calculate & Generate");
    button.addClickListener(reportBtnClickListener);
    button.setWidth("300px");

    addComponent(button);
    setComponentAlignment(button, Alignment.MIDDLE_LEFT);
}

From source file:com.etest.view.tq.TQCoverageWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);/*  w  w  w .j a v  a 2s.  c  o  m*/

    int itemNo = 1;
    Label caseTopic;
    Label stem;
    Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId());
    for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) {
        Integer tqCaseId = tqCases.getKey();

        caseTopic = new Label();
        caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic());
        caseTopic.setContentMode(ContentMode.HTML);
        form.addComponent(caseTopic);

        Map<Integer, Integer> value = tqCases.getValue();
        for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) {
            Integer itemId = itemIds.getKey();
            Integer itemKeyId = itemIds.getValue();

            List<String> keyList = k.getAllItemKey(itemId);
            if (keyList.isEmpty()) {
                ShowErrorNotification
                        .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem());
                return null;
            }

            stem = new Label();
            //                stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0)));
            stem.setValue(itemNo + ". "
                    + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId)));
            stem.setContentMode(ContentMode.HTML);
            form.addComponent(stem);

            GridLayout glayout = new GridLayout(2, 2);
            glayout.setWidth("100%");
            glayout.setSpacing(true);

            glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML),
                    0, 0);
            glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML),
                    0, 1);
            glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML),
                    1, 0);
            glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML),
                    1, 1);
            form.addComponent(glayout);

            itemNo++;
        }
    }

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");

    Button delete = new Button("DELETE");
    delete.setWidth("200px");
    delete.setIcon(FontAwesome.TRASH_O);
    delete.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delete.addStyleName(ValoTheme.BUTTON_SMALL);
    delete.addClickListener(buttonClickListener);
    h.addComponent(delete);

    Button approve = new Button("APPROVE");
    approve.setWidth("200px");
    approve.setIcon(FontAwesome.THUMBS_UP);
    approve.addStyleName(ValoTheme.BUTTON_PRIMARY);
    approve.addStyleName(ValoTheme.BUTTON_SMALL);
    approve.addClickListener(buttonClickListener);
    h.addComponent(approve);

    if (tq.isTQCoverageApproved(getTQCoverageId())) {
        approve.setVisible(false);
    } else {
        approve.setVisible(true);
    }

    form.addComponent(h);

    return form;
}

From source file:com.invient.vaadin.InvientChartsDemoWin.java

License:Apache License

private void registerSVGAndPrintEvent(final InvientCharts chart) {
    GridLayout gridLayout = new GridLayout(2, 1);
    gridLayout.setWidth("100%");
    gridLayout.setSpacing(true);/* w  w w. j  av a2 s. c om*/
    Button svgBtn;
    gridLayout.addComponent(svgBtn = new Button("Get SVG"));
    gridLayout.setComponentAlignment(svgBtn, Alignment.MIDDLE_RIGHT);
    Button printBtn;
    gridLayout.addComponent(printBtn = new Button("Print"));
    gridLayout.setComponentAlignment(printBtn, Alignment.MIDDLE_LEFT);
    rightLayout.addComponent(gridLayout);
    svgBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            chart.addListener(new InvientCharts.ChartSVGAvailableListener() {

                @Override
                public void svgAvailable(ChartSVGAvailableEvent chartSVGAvailableEvent) {
                    logEventInfo("[svgAvailable]" + " svg -> " + chartSVGAvailableEvent.getSVG());
                }
            });
        }
    });
    printBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            chart.print();
        }
    });
}

From source file:com.logicbomb.newschool.MyAppWidgetSet.core.DayWidget.java

public DayWidget() {

    //Creating Panel
    Panel iPanel = new Panel();
    iPanel.addStyleName("backColorWhite");
    iPanel.setWidth("876px");
    iPanel.setHeight("41px");

    ProgressBar iDayProgressBar = new ProgressBar();
    iDayProgressBar.setCaption("Period 3, 10th October");
    iDayProgressBar.setWidth("875px");
    iDayProgressBar.setValue(0.3f);/*from  ww  w .ja va 2 s . c om*/
    addComponent(iDayProgressBar);

    //Adding Panel to Vertical Layout
    addComponent(iPanel);
    VerticalLayout iVerticalLayout = new VerticalLayout();

    GridLayout iGridLayout = new GridLayout(9, 1);
    iGridLayout.setWidth("1000px");
    iGridLayout.setHeight("40px");

    for (int i = 1; i <= 8; i++) {

        HourWidget iHourAtAGlanceWidget = new HourWidget(i, 8);
        iHourAtAGlanceWidget.setSizeFull();
        iGridLayout.addComponent(iHourAtAGlanceWidget);
        iGridLayout.setColumnExpandRatio(i, 1);
    }

    iVerticalLayout.addComponent(iGridLayout);
    iPanel.setContent(iVerticalLayout);

}

From source file:com.lst.deploymentautomation.vaadin.popup.TodoDetails.java

License:Open Source License

private Component createProcessInfo(LspsUI ui) {
    ModelInstanceInfo instance = processService.getModelInstanceInfo(todo.getModelInstanceId());

    GridLayout grid = new GridLayout(2, 10);
    grid.setMargin(true);//from   w  w  w  . j  a  v  a  2  s  .c om
    grid.setSpacing(true);
    grid.setWidth("100%");
    grid.setColumnExpandRatio(0, 1);
    grid.setColumnExpandRatio(1, 2);

    grid.addComponent(new Label(ui.getMessage("process.id")));
    grid.addComponent(new Label(String.valueOf(instance.getId())));

    grid.addComponent(new Label(ui.getMessage("process.model")));
    grid.addComponent(new Label(instance.getModelName() + " - " + instance.getModelVersion()));

    grid.addComponent(new Label(ui.getMessage("process.started")));
    grid.addComponent(new Label(
            new SimpleDateFormat(ui.getMessage("app.dateTimeFormat")).format(instance.getStartedDate())));

    grid.addComponent(new Label(ui.getMessage("process.finished")));
    grid.addComponent(new Label(instance.getFinishedDate() == null ? ""
            : new SimpleDateFormat(ui.getMessage("app.dateTimeFormat")).format(instance.getFinishedDate())));

    String status = "???";
    switch (instance.getState()) {
    case CREATED:
        status = ui.getMessage("process.statusCreated");
        break;
    case FINISHED:
        status = ui.getMessage("process.statusFinished");
        break;
    case RUNNING:
        status = ui.getMessage("process.statusRunning");
        break;
    case SUSPENDED:
        status = ui.getMessage("process.statusSuspended");
        break;
    case MODEL_UPDATE_PREPROCESSING:
        status = ui.getMessage("process.statusPreprocessing");
        break;
    case MODEL_UPDATE_PREPROCESSED:
        status = ui.getMessage("process.statusPreprocessed");
        break;
    case MODEL_UPDATE_TRANSFORMED:
        status = ui.getMessage("process.statusTransformed");
        break;
    case MODEL_UPDATE_POSTPROCESSING:
        status = ui.getMessage("process.statusPostprocessing");
        break;
    case MODEL_UPDATE_UPDATED:
        status = ui.getMessage("process.statusUpdated");
        break;
    case MODEL_UPDATE_ABORTED:
        status = ui.getMessage("process.statusUpdateAborted");
        break;
    }
    grid.addComponent(new Label(ui.getMessage("process.status")));
    grid.addComponent(new Label(status));

    return grid;
}

From source file:com.lst.deploymentautomation.vaadin.popup.TodoDetails.java

License:Open Source License

private Component createTodoInfo(LspsUI ui) {
    GridLayout grid = new GridLayout(2, 10);
    grid.setMargin(true);/* www.j  a v  a  2s  . com*/
    grid.setSpacing(true);
    grid.setWidth("100%");
    grid.setColumnExpandRatio(0, 1);
    grid.setColumnExpandRatio(1, 2);

    grid.addComponent(new Label(ui.getMessage("todo.id")));
    grid.addComponent(new Label(String.valueOf(todo.getId())));

    //      grid.addComponent(new Label(ui.getMessage("todo.process")));
    //      grid.addComponent(new Label(String.valueOf(todo.getModelInstanceId())));

    //      grid.addComponent(new Label(ui.getMessage("todo.title")));
    //      grid.addComponent(new Label(ui.localizeEngineText(todo.getTitle())));

    grid.addComponent(new Label(ui.getMessage("todo.task")));
    grid.addComponent(new Label(todo.getTaskNamespace()));

    grid.addComponent(new Label(ui.getMessage("todo.issued")));
    grid.addComponent(
            new Label(new SimpleDateFormat(ui.getMessage("app.dateTimeFormat")).format(todo.getIssuedDate())));

    String status = "???";
    switch (todo.getStatus()) {
    case ALIVE:
        status = ui.getMessage("todo.statusAlive");
        break;
    case ACCOMPLISHED:
        status = ui.getMessage("todo.statusAccomplished", todo.getSubmittedDate());
        break;
    case INTERRUPTED:
        status = ui.getMessage("todo.statusInterrupted", todo.getSubmittedDate(), todo.getInterruptionReason());
        break;
    case SUSPENDED:
        status = ui.getMessage("todo.statusSuspended");
        break;
    }
    grid.addComponent(new Label(ui.getMessage("todo.status")));
    grid.addComponent(new Label(status));

    try {
        TodoAuthorization authorization = todoService.getAuthorization(todo.getId(),
                ui.getUser().getPerson().getId());
        String authMsg;
        switch (authorization) {
        case INITIAL_PERFORMER:
            authMsg = ui.getMessage("todo.authorizationPerformer");
            break;
        case DELEGATE:
            authMsg = ui.getMessage("todo.authorizationDelegate");
            break;
        case SUBSTITUTE:
            authMsg = ui.getMessage("todo.authorizationSubstitute");
            break;
        case NOT_PERMITTED:
        default:
            authMsg = ui.getMessage("todo.authorizationUnknown");
            break;
        }
        grid.addComponent(new Label(ui.getMessage("todo.authorization")));
        grid.addComponent(new Label(authMsg));
    } catch (Exception e) {
        Utils.rethrow(e, "could not get authorization for " + todo.getId(), log);
    }

    //currently it's always the current user; no need to show him
    //      grid.addComponent(new Label(ui.getMessage("todo.responsible")));
    //      grid.addComponent(new Label(todo.getAllocatedToFullName()));

    return grid;
}

From source file:com.m4gik.views.component.LibraryScreen.java

/**
 * This method builds library screen. This method overrides an existing
 * method./* w  w w. j a v a  2 s  .c  o  m*/
 * 
 * @see com.m4gik.views.component.ViewScreen#build()
 */
@Override
public Layout build() {
    HorizontalLayout root = new HorizontalLayout();
    root.setSizeFull();
    root.setCaption("Media Library");
    root.setHeight("200%");
    root.setWidth("100%");

    this.content = new VerticalLayout();
    content.setSizeFull();
    root.addComponent(content);

    final GridLayout grid = new GridLayout(4, 1);
    Panel top = new Panel("Music Collection", grid);
    top.setSizeFull();
    top.addStyleName(Runo.PANEL_LIGHT);
    grid.setWidth("100%");
    grid.setMargin(true);
    grid.addStyleName(Runo.LAYOUT_DARKER);
    content.addComponent(top);
    content.setExpandRatio(top, 1);

    grid.addLayoutClickListener(new LayoutClickListener() {

        private static final long serialVersionUID = -1864555729437118182L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            for (Iterator<Component> it = grid.iterator(); it.hasNext();) {
                Component c = it.next();
                c.removeStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED);

            }

            if (event.getChildComponent() != null) {
                event.getChildComponent().addStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED);
            }
        }
    });

    buildAudioLibrary(grid, null);

    return root;

}