Example usage for com.vaadin.ui VerticalLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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

Window modifyCellItemWindow(CellItem ci) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);//from  w ww .  j a v a2 s . co m
    v.setSpacing(true);

    Window sub = new Window("MODIFY");
    sub.setWidth("400px");
    sub.setModal(true);
    sub.center();

    ComboBox actionDone = new ComboBox("Action: ");
    actionDone.setWidth("70%");
    actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    actionDone.setNullSelectionAllowed(false);
    actionDone.addItem("resolved");
    actionDone.addItem("clarified");
    actionDone.addItem("modified");
    actionDone.setImmediate(true);
    v.addComponent(actionDone);

    TextArea remarks = new TextArea("Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    v.addComponent(remarks);

    Button modify = new Button("UPDATE");
    modify.setWidth("70%");
    modify.setIcon(FontAwesome.EDIT);
    modify.addStyleName(ValoTheme.BUTTON_PRIMARY);
    modify.addStyleName(ValoTheme.BUTTON_SMALL);
    modify.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (actionDone.getValue() == null) {
            Notification.show("Add action!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        ci.setRemarks(remarks.getValue().trim());
        ci.setActionDone(actionDone.getValue().toString());
        boolean result = cis.modifyCellItem(ci);
        if (result) {
            sub.close();
            close();
        }
    });
    v.addComponent(modify);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

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

Window modifyKeyWindow(int itemKeyId, int cellItemId, String keyValue, String optionValue,
        boolean isOptionKeyExist) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);/*  ww w.j  ava  2  s. c  o m*/
    v.setSpacing(true);

    Window sub = new Window("MODIFY");
    sub.setWidth("400px");
    sub.setModal(true);
    sub.center();

    ComboBox actionDone = new ComboBox("Action: ");
    actionDone.setWidth("70%");
    actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    actionDone.setNullSelectionAllowed(false);
    actionDone.addItem("resolved");
    actionDone.addItem("clarified");
    actionDone.addItem("modified");
    actionDone.setImmediate(true);
    v.addComponent(actionDone);

    TextArea remarks = new TextArea("Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    v.addComponent(remarks);

    Button modify = new Button("UPDATE");
    modify.setWidth("70%");
    modify.setIcon(FontAwesome.EDIT);
    modify.addStyleName(ValoTheme.BUTTON_PRIMARY);
    modify.addStyleName(ValoTheme.BUTTON_SMALL);
    modify.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (actionDone.getValue() == null) {
            Notification.show("Add action!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        boolean result = k.modifyItemKey(itemKeyId, cellItemId, keyValue, optionValue, isOptionKeyExist,
                remarks.getValue().trim(), actionDone.getValue().toString());
        if (result) {
            Notification.show("Key SUCCESSFULLY modified", Notification.Type.TRAY_NOTIFICATION);
            sub.close();
        }
    });
    v.addComponent(modify);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

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

Window removeKeyWindow(int itemKeyId) {
    Window sub = new Window("REMOVE KEY");
    sub.setWidth("300px");
    sub.setModal(true);//from   www  . j a  v  a  2 s  . c  o m
    sub.center();

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

    Button remove = new Button("CONFIRM REMOVE KEY?");
    remove.setWidth("100%");
    remove.setIcon(FontAwesome.TRASH_O);
    remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
    remove.addStyleName(ValoTheme.BUTTON_SMALL);
    remove.addClickListener((Button.ClickEvent event) -> {
        boolean result = k.removeItemKey(itemKeyId);
        if (result) {
            sub.close();
            close();
        }
    });
    v.addComponent(remove);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.tq.itemanalysis.ProportionDataTable.java

public ProportionDataTable(Map<String, List<Character>> studentNoAndAnswer, List<String> upperGroupStudentNo,
        List<String> lowerGroupStudentNo, List<Integer> itemIds, int tqCoverageId,
        double groupTotalForProportion) {
    this.studentNoAndAnswer = studentNoAndAnswer;
    this.upperGroupStudentNo = upperGroupStudentNo;
    this.lowerGroupStudentNo = lowerGroupStudentNo;
    this.itemIds = itemIds;
    this.tqCoverageId = tqCoverageId;
    this.groupTotalForProportion = groupTotalForProportion;

    setCaption("PROPORTION");
    setHeight("100%");
    setModal(true);/*from ww w  .  j  a  v  a 2s . c  o  m*/
    center();

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

    upperGroupTable.addContainerProperty("Item No.", Integer.class, null);
    upperGroupTable.setSelectable(true);
    upperGroupTable.setWidthUndefined();
    v.addComponent(upperGroupStudentPanel());

    lowerGroupTable.addContainerProperty("Item No.", Integer.class, null);
    lowerGroupTable.setSelectable(true);
    lowerGroupTable.setWidthUndefined();
    v.addComponent(lowerGroupStudentPanel());

    upperGroupTable.setWidthUndefined();
    lowerGroupTable.setWidthUndefined();

    getUpperGroupStudentTable();
    getLowerGroupStudentTable();

    setContent(v);
    getContent().setWidthUndefined();
}

From source file:com.etest.view.tq.itemanalysis.TQItemAnalysisUI.java

public Table populateDataTable() {
    removeAllItems();//from www. j a va 2  s.  c  o m
    int i = 0;
    for (TQCoverage t : tq.getAllTQCoverage()) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button analyze = new Button();
        analyze.setWidthUndefined();
        analyze.setData(t.getTqCoverageId());
        analyze.setCaption((t.getAnalyzed() == 0) ? "Unanalyze" : "Analyzed");
        analyze.setIcon(FontAwesome.BULLSEYE);
        analyze.addStyleName(ValoTheme.BUTTON_LINK);
        analyze.addStyleName(ValoTheme.BUTTON_TINY);
        analyze.addStyleName(ValoTheme.BUTTON_QUIET);
        analyze.addStyleName("button-container");
        analyze.setEnabled(t.getAnalyzed() == 0);
        analyze.addClickListener(buttonClickListener);
        v.addComponent(analyze);
        v.setComponentAlignment(analyze, Alignment.MIDDLE_LEFT);

        Button view = new Button("View");
        view.setWidthUndefined();
        view.setData(t.getTqCoverageId());
        view.setIcon(FontAwesome.VIDEO_CAMERA);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addStyleName("button-container");
        view.setVisible((t.getAnalyzed() != 0));
        view.addClickListener(buttonClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        addItem(new Object[] { t.getExamTitle(), cs.getCurriculumById(t.getCurriculumId()).getSubject(),
                t.getDateCreated(), t.getTotalHoursCoverage(), t.getTotalItems(), v }, i);
        i++;
    }
    setPageLength(size());

    return this;
}

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

public OnlineQueriesUI() {
    setWidth("100%");
    setMargin(true);// w  w  w.ja va2s  .  co  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);/* w ww  . j  a  v a  2 s  .  co 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");

    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.reports.ReportMainUI.java

public ReportMainUI() {
    setWidth("100%");
    addStyleName("bar");

    VerticalLayout v = new VerticalLayout();
    v.setCaption("Online Queries");
    v.setWidth("100%");
    v.setMargin(true);//  w w w  .j a  v  a2  s .  c om
    v.addComponent(new OnlineQueriesUI());
    addComponent(v);

    v = new VerticalLayout();
    v.setCaption("Report Generator");
    v.setWidth("100%");
    v.setMargin(true);
    v.addComponent(new ReportGeneratorUI());
    addComponent(v);
}

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

Window getTopicWindow(Item item) {
    Window sub = new Window("TOPIC: ");
    sub.setWidth("500px");
    sub.setModal(true);//  ww w  . j  a  va  2 s  . com
    sub.center();
    sub.setResizable(false);

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

    topic.setInputPrompt("Select a Topic..");
    topic.addStyleName(ValoTheme.COMBOBOX_SMALL);
    topic.setWidth("100%");
    topic.addValueChangeListener((Property.ValueChangeEvent event) -> {
        if (event.getProperty().getValue() == null) {
        } else {
            syllabusId = (int) event.getProperty().getValue();
            topicStr = topic.getItem(topic.getValue()).toString();
        }
    });
    v.addComponent(topic);

    Button button = new Button("CLOSE");
    button.setWidth("50%");
    button.setIcon(FontAwesome.TASKS);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        if (topic.getValue() == null) {
            Notification.show("Select a Topic!", Notification.Type.WARNING_MESSAGE);
        } else {
            populateGridRow(item);
            populateGridFooter();
        }
        sub.close();
    });
    v.addComponent(button);
    v.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

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

Window getPickWindow(Item item, String propertyId) {
    Window sub = new Window("Field Value: ");
    sub.setWidth("150px");
    sub.setModal(true);//from w  w w  .  j av a  2  s .c o  m
    sub.center();
    sub.setResizable(false);

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

    TextField field = new CommonTextField("Enter Value..", "Enter a Value: ");
    v.addComponent(field);

    Button button = new Button("CLOSE");
    button.setWidth("100%");
    button.setIcon(FontAwesome.TASKS);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim());
        if (!isNumeric) {
            return;
        }

        boolean isGreaterThanInTB = tq.isGreaterThanInTB(item, propertyId, field.getValue().trim());
        if (isGreaterThanInTB) {
            Notification.show("Not allowed to exceed in total Items in Test Bank!",
                    Notification.Type.ERROR_MESSAGE);
            return;
        } else {
            item.getItemProperty(CommonUtilities.replaceStringTBToPick(propertyId))
                    .setValue(CommonUtilities.convertStringToInt(field.getValue()));
            footer.getCell(CommonUtilities.replaceStringTBToPick(propertyId)).setText(String.valueOf(
                    tq.calculateTotalPickItems(grid, CommonUtilities.replaceStringTBToPick(propertyId))));
        }
        sub.close();
    });
    v.addComponent(button);
    v.setComponentAlignment(button, Alignment.BOTTOM_CENTER);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}