Example usage for com.vaadin.ui VerticalLayout VerticalLayout

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

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

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

public CellCaseItemWindow(int cellCaseId) {
    this.cellCaseId = cellCaseId;

    setCaption("CELL CASE ITEM");
    setWidth("800px");
    setHeight("100%");
    setModal(true);//from  w ww. java2  s  .com
    center();

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

    setContent(v);
}

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

Table populateDataTable() {
    table.removeAllItems();/*from  w  w w  .ja v  a 2 s  .com*/
    int i = 0;
    for (CellItem ci : cis.getCellItemByCase(getCellCaseId())) {
        VerticalLayout v = new VerticalLayout();
        v.setSizeFull();

        Button edit = new Button("modify");
        edit.setWidth("100%");
        edit.setData(ci.getCellItemId());
        edit.setIcon(FontAwesome.PENCIL);
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName(ValoTheme.BUTTON_QUIET);
        edit.addClickListener(modifyBtnClickListener);
        v.addComponent(edit);
        v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT);

        Button approve = new Button("status");
        approve.setWidth("100%");
        approve.setData(ci.getCellItemId());
        approve.addStyleName(ValoTheme.BUTTON_LINK);
        approve.addStyleName(ValoTheme.BUTTON_TINY);
        approve.addStyleName(ValoTheme.BUTTON_QUIET);
        v.addComponent(approve);
        v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);

        Button view = new Button("view");
        view.setWidth("100%");
        view.setData(ci.getCellItemId());
        view.setIcon(FontAwesome.PLAY_CIRCLE);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addClickListener(modifyBtnClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        if (ci.getApproveItemStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
        }

        Label label = new Label(ci.getItem());
        label.setStyleName("label-padding");

        table.addItem(new Object[] { ci.getCellItemId(), label, v }, i);
        i++;
    }
    table.setPageLength(table.size());

    return table;
}

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 ww w.  j av  a 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;
        }

        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);/*from   w w  w  . ja v a2s  . 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;
        }

        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);// w w  w  .  j  a va  2s. c om
    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.charts.GraphicalInventoryBarChart.java

public GraphicalInventoryBarChart() {
    setModal(true);//from  w w  w. j a  v a2s .c o m

    VerticalLayout v = new VerticalLayout();
    v.setMargin(true);

    //        Panel panel = new Panel();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (Curriculum c : cs.getAllCurriculum()) {
        for (int i = 0; i < 2; i++) {
            if (i == 0) {
                dataset.addValue(rs.getTotalCasesBySubject(c.getCurriculumId()), "Cases", c.getSubject());
            } else {
                dataset.addValue(rs.getTotalItemsBySubject(c.getCurriculumId()), "Items", c.getSubject());
            }
        }
    }

    JFreeChart chart = ChartFactory.createBarChart("Inventory of Items and Cases", "Subjects", "", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    CategoryPlot plot = chart.getCategoryPlot();
    BarRenderer renderer = (BarRenderer) plot.getRenderer();

    Color color;

    for (int i = 0; i < dataset.getRowCount(); i++) {
        if (i % 2 == 0) {
            renderer.setSeriesPaint(i, new Color(0, 0, 255));
        } else {
            renderer.setSeriesPaint(i, new Color(255, 0, 0));
        }
    }

    //        JFreeChartWrapper wrapper = new JFreeChartWrapper(chart){
    //            
    //            @Override
    //            public void attach(){
    //                super.attach();
    //                setResource("src", getSource());
    //            }
    //            
    //        };

    v.addComponent(new ReportChartWrapper(chart, null, null));
    v.setWidthUndefined();
    v.setHeightUndefined();

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

From source file:com.etest.view.tq.charts.GraphicalInventoryPieChart.java

public GraphicalInventoryPieChart(int curriculumId) {
    this.curriculumId = curriculumId;
    setModal(true);//from  w w w .j a  va  2  s .  c o  m

    int percentage = 0;
    VerticalLayout v = new VerticalLayout();
    DefaultPieDataset dataset = new DefaultPieDataset();

    for (BloomsClass b : BloomsClass.values()) {
        percentage = (int) calculatePercentageOfItemsPerBloomsClass(
                rs.getTotalItemsBySubject(getCurriculumId()),
                rs.getTotalItemsByBloomsCass(getCurriculumId(), tq.getBloomsClassId(b.toString())));

        dataset.setValue(b + " " + percentage + "%", percentage);
    }

    JFreeChart chart = ChartFactory.createPieChart(
            "Inventory of Items for " + cs.getCurriculumById(getCurriculumId()).getSubject(), dataset, true,
            true, false);

    //        JFreeChartWrapper wrapper = new JFreeChartWrapper(chart){
    //            
    //            @Override
    //            public void attach(){
    //                super.attach();
    //                setResource("src", getSource());
    //            }
    //            
    //        };

    v.addComponent(new ReportChartWrapper(chart, null, null));
    v.setWidthUndefined();
    v.setHeightUndefined();

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

From source file:com.etest.view.tq.charts.ItemAnalysisGraphicalViewAll.java

public ItemAnalysisGraphicalViewAll(int curriculumId) {
    this.curriculumId = curriculumId;

    setModal(true);/*w  w w .  j  a va2  s  .c om*/
    setHeight("100%");

    VerticalLayout v = new VerticalLayout();
    v.setMargin(true);
    v.setSpacing(true);

    Label title = new Label();
    title.setCaption("Item Analysis of " + cs.getCurriculumById(getCurriculumId()).getSubject());
    title.setWidthUndefined();
    v.addComponent(title);
    v.setComponentAlignment(title, Alignment.TOP_CENTER);

    HorizontalLayout h = new HorizontalLayout();
    h.setSpacing(true);

    h.addComponent(getDiscriminationIndexChart());
    h.addComponent(getDifficultIndexChart());

    h.setWidthUndefined();
    h.setHeightUndefined();

    v.addComponent(h);
    v.setWidthUndefined();

    setContent(v);
    getContent().setWidthUndefined();
    //        getContent().setHeightUndefined();
    center();
}

From source file:com.etest.view.tq.charts.SubjectLineChartWindow.java

public SubjectLineChartWindow(int tqCoverageId, String lineChartType) {
    this.tqCoverageId = tqCoverageId;
    setModal(true);/*w  ww. j  a v  a 2s  .c o m*/
    //        setHeight("100%");

    VerticalLayout v = new VerticalLayout();
    v.setMargin(true);
    v.setSpacing(true);

    if (lineChartType.equals("discrimination")) {
        v.addComponent(new ReportChartWrapper(SubjectTestLineChart.discriminationIndex(getTqCoverageId()), null,
                null));
    } else {
        v.addComponent(
                new ReportChartWrapper(SubjectTestLineChart.difficultIndex(getTqCoverageId()), null, null));
    }
    v.setWidthUndefined();

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

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   www . j a v a 2 s.  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();
}