Example usage for com.vaadin.ui VerticalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java

Window removeTeamMemberWindow(int facultyRowId) {
    Window sub = new Window();
    sub.setCaption("REMOVE TEAM MEMBER");
    sub.setWidth("250px");
    sub.setModal(true);//from w w  w .  j av a 2 s.c  o m
    sub.center();

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSizeFull();
    vlayout.setMargin(true);

    Button removeBtn = new Button("REMOVE");
    removeBtn.setWidth("100%");
    removeBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    removeBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = tts.removeTeamMember(getTeamTeachId(), facultyRowId);
        if (result) {
            populateDataTable();
            sub.close();
        }
    });
    vlayout.addComponent(removeBtn);

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

    return sub;
}

From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java

Window editTeamMemberPositionWindow(int facultyRowId) {
    Window sub = new Window();
    sub.setCaption("REMOVE TEAM MEMBER");
    sub.setWidth("250px");
    sub.setModal(true);//from w ww  .j av a2  s  .  com
    sub.center();

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSizeFull();
    vlayout.setSpacing(true);
    vlayout.setMargin(true);

    String name = fs.getFacultyNameById(facultyRowId);
    vlayout.addComponent(new Label("Set " + name.toUpperCase() + " as Team Leader."));

    Button updateBtn = new Button("UPDATE");
    updateBtn.setWidth("100%");
    updateBtn.setIcon(FontAwesome.USER);
    updateBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    updateBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    updateBtn.addClickListener((Button.ClickEvent event) -> {
        int userId = us.getUserIdByFacultyId(facultyRowId);
        boolean result = tts.updateTeamTeach(getTeamTeachId(), userId);
        if (result) {
            sub.close();
            populateDataTable();
            close();
        }
    });
    vlayout.addComponent(updateBtn);

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

    return sub;
}

From source file:com.etest.view.systemadministration.SemestralTeam.RemoveSemestralTeamWindow.java

public RemoveSemestralTeamWindow(int teamTeachId) {
    this.teamTeachId = teamTeachId;

    setCaption("DELETE WINDOW");
    setWidth("270px");
    setModal(true);/*from   www .  j av a 2s .com*/
    center();

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSizeFull();
    vlayout.setMargin(true);

    Button removeBtn = new Button("REMOVE SEMESTRAL TEAM?");
    removeBtn.setWidth("100%");
    removeBtn.setIcon(FontAwesome.TRASH_O);
    removeBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    removeBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = tts.removeSemestralTeam(getTeamTeachId());
        if (result) {
            close();
        }
    });
    removeBtn.setImmediate(true);
    vlayout.addComponent(removeBtn);

    setContent(vlayout);
    getContent().setHeightUndefined();
}

From source file:com.etest.view.testbank.CellCaseWindow.java

Window modifyCaseWindow(CellCase cellCase) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);/*from ww w.j  av a 2  s  . com*/

    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;
        }

        cellCase.setActionDone(actionDone.getValue().toString());
        cellCase.setRemarks(remarks.getValue().trim());
        boolean result = ccs.modifyCellCase(cellCase);
        if (result) {
            Notification.show("Case has been Modified!", Notification.Type.TRAY_NOTIFICATION);
            sub.close();
            close();
        }
    });
    v.addComponent(modify);

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

    return sub;
}

From source file:com.etest.view.testbank.CellCaseWindow.java

Window deleteCaseWindow() {
    Window sub = new Window("DELETE");
    sub.setWidth("250px");
    sub.setModal(true);//from  www.  j  ava  2 s  .c  o  m
    sub.center();

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

    Button delete = new Button("DELETE CASE?");
    delete.setWidth("100%");
    delete.setImmediate(true);
    delete.addClickListener((Button.ClickEvent event) -> {
        boolean result = ccs.removeCellCase(getCellCaseId());
        if (result) {
            sub.close();
            close();
        }
    });

    v.addComponent(delete);

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

    return sub;
}

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 www.  ja  va2s . 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.CellItemWindow.java

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

    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);
    v.setSpacing(true);//from   ww  w .  j a  v  a 2  s. co  m

    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 ww  .  j  av  a 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);/*  w  w  w  . j  av  a  2  s .  com*/

    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();
}