Example usage for com.vaadin.ui Button setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

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 ww.  jav  a  2  s. c  om*/
    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);// w  w  w  .ja v  a2 s . c o m
    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);//  w  w  w  . j  a v a  2 s  .  c om
    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.systemadministration.SemestralTeamUI.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("400px");
    form.setSpacing(true);/*w w  w.  j  ava2s  .  c o m*/

    subjects = CommonComboBox.getSubjectFromCurriculum("Subject..");
    subjects.setCaption("Curriculum: ");
    subjects.setIcon(FontAwesome.SEARCH);
    form.addComponent(subjects);

    schoolYear = CommonComboBox.getSchoolYear("School Year..");
    schoolYear.setCaption("School Year: ");
    schoolYear.setIcon(FontAwesome.SEARCH);
    form.addComponent(schoolYear);

    semester = CommonComboBox.getNormCourseOfferingComboBox("Semester..");
    semester.setCaption("Semester: ");
    semester.setIcon(FontAwesome.SEARCH);
    form.addComponent(semester);

    faculty = CommonComboBox.getAllFaculty("Select Faculty..");
    faculty.setCaption("Team Leader: ");
    faculty.setIcon(FontAwesome.USER);
    form.addComponent(faculty);

    Button saveBtn = new Button("Enroll Semestral Team");
    saveBtn.setWidth("100%");
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    saveBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    saveBtn.addClickListener(saveBtnClickListener);
    saveBtn.setImmediate(true);
    form.addComponent(saveBtn);

    return form;
}

From source file:com.etest.view.systemadministration.SemestralTeamUI.java

void populateDataTable() {
    table.removeAllItems();/*  ww w.  j a v a 2  s. c  o  m*/
    int i = 0;
    for (TeamTeach tt : tts.getAllSemestralTeamTeach()) {
        HorizontalLayout hlayout = new HorizontalLayout();
        hlayout.setWidth("100%");

        Button membersBtn = new Button();
        membersBtn.setWidth("100%");
        membersBtn.setData(tt.getTeamTeachId());
        if (tts.countTeamMembers(tt.getTeamTeachId()) < 2) {
            membersBtn.setCaption("add");
            membersBtn.setIcon(FontAwesome.USER);
        } else {
            membersBtn.setCaption("view");
            membersBtn.setIcon(FontAwesome.USERS);
        }

        Button removeTLBtn = new Button("del");
        removeTLBtn.setWidth("100%");
        removeTLBtn.setIcon(FontAwesome.TRASH_O);
        removeTLBtn.setData(tt.getTeamTeachId());

        hlayout.addComponent(membersBtn);
        hlayout.addComponent(removeTLBtn);

        table.addItem(new Object[] { tt.getSchoolYear(),
                CommonVariableMap.getNormCourseOffering(tt.getNormCourseOffering()),
                CommonVariableMap.getYearLevel(tt.getYearLevel()), tt.getSubject(), tt.getTeamLeader(),
                hlayout }, i);
        i++;

        membersBtn.addStyleName(ValoTheme.BUTTON_LINK);
        membersBtn.addStyleName(ValoTheme.BUTTON_TINY);
        membersBtn.addClickListener(modifyBtnListener);

        removeTLBtn.addStyleName(ValoTheme.BUTTON_LINK);
        removeTLBtn.addStyleName(ValoTheme.BUTTON_TINY);
        removeTLBtn.addClickListener(modifyBtnListener);
    }
    table.setPageLength(table.size());
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusFormWindow.java

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

    subjects.setCaption("Subject: ");
    subjects.setWidth("50%");
    subjects.setIcon(FontAwesome.BOOK);
    subjects.addStyleName(ValoTheme.COMBOBOX_SMALL);
    form.addComponent(subjects);

    topicNo.setCaption("Topic No: ");
    topicNo.setWidth("50%");
    topicNo.setIcon(FontAwesome.TAG);
    topicNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(topicNo);

    topic.setCaption("Topic: ");
    topic.setWidth("100%");
    topic.setIcon(FontAwesome.TAG);
    topic.setInputPrompt("Enter Topic..");
    topic.setRows(3);
    topic.addStyleName(ValoTheme.TEXTAREA_SMALL);
    form.addComponent(topic);

    estimatedTime.setCaption("Estimated Time: ");
    estimatedTime.setWidth("50%");
    estimatedTime.setIcon(FontAwesome.TAG);
    estimatedTime.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(estimatedTime);

    Button save = new Button("SAVE");
    save.setWidth("50%");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button update = new Button("UPDATE");
    update.setWidth("60%");
    update.setIcon(FontAwesome.PENCIL);
    update.addStyleName(ValoTheme.BUTTON_PRIMARY);
    update.addStyleName(ValoTheme.BUTTON_SMALL);
    update.addClickListener(buttonClickListener);

    Button remove = new Button("REMOVE");
    remove.setWidth("60%");
    remove.setIcon(FontAwesome.TRASH_O);
    remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
    remove.addStyleName(ValoTheme.BUTTON_SMALL);
    remove.addClickListener(buttonClickListener);

    if (getSyllabusId() != 0) {
        s = ss.getSyllabusById(syllabusId);
        subjects.setValue(s.getCurriculumId());
        topicNo.setValue(String.valueOf(s.getTopicNo()));
        estimatedTime.setValue(String.valueOf(s.getEstimatedTime()));
        topic.setValue(s.getTopic());

        if (getButtonCaption().equals("edit")) {
            form.addComponent(update);
        } else {
            form.addComponent(remove);
        }
    } else {
        form.addComponent(save);
    }

    return form;
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusMainUI.java

public SyllabusMainUI() {
    setSizeFull();//  ww  w  . j  a  v  a2 s  . c o  m
    setMargin(true);
    setSpacing(true);

    Button addNew = new Button("ADD NEW SYLLABUS");
    addNew.setWidth("220px");
    addNew.setIcon(FontAwesome.OPENID);
    addNew.addStyleName(ValoTheme.BUTTON_LINK);
    addNew.addStyleName(ValoTheme.BUTTON_SMALL);
    addNew.addClickListener(buttonClickListener);

    addComponent(addNew);
    addComponent(dataGridPanel());
}

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

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//from ww  w.  ja  v a  2s  . com

    subject.setCaption("Subject: ");
    subject.setWidth("50%");
    subject.addValueChangeListener((new CurriculumPropertyChangeListener(topic)));
    form.addComponent(subject);

    topic.setCaption("Topic: ");
    topic.setWidth("80%");
    topic.setInputPrompt("Select a Topic..");
    topic.addStyleName(ValoTheme.COMBOBOX_SMALL);
    form.addComponent(topic);

    caseTopic = new TextArea();
    caseTopic.setCaption("Case: ");
    caseTopic.setWidth("100%");
    caseTopic.setRows(5);
    form.addComponent(caseTopic);

    HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setWidth("100%");
    hlayout.setSpacing(true);

    Button save = new Button("SAVE");
    save.setWidth("200px");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button modify = new Button("MODIFY");
    modify.setWidth("200px");
    modify.setIcon(FontAwesome.EDIT);
    modify.addStyleName(ValoTheme.BUTTON_PRIMARY);
    modify.addStyleName(ValoTheme.BUTTON_SMALL);
    modify.addClickListener(buttonClickListener);

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

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

    if (getCellCaseId() != 0) {
        CellCase cc = ccs.getCellCaseById(getCellCaseId());
        subject.setValue(cc.getCurriculumId());
        topic.setValue(cc.getSyllabusId());
        caseTopic.setValue(cc.getCaseTopic());

        approve.setVisible(cc.getApprovalStatus() == 0);
        hlayout.addComponent(approve);
        hlayout.setComponentAlignment(approve, Alignment.MIDDLE_RIGHT);

        hlayout.addComponent(modify);
        hlayout.setComponentAlignment(modify, Alignment.MIDDLE_RIGHT);

        hlayout.addComponent(delete);
        hlayout.setComponentAlignment(delete, Alignment.MIDDLE_RIGHT);
    } else {
        hlayout.addComponent(save);
        hlayout.setComponentAlignment(save, Alignment.MIDDLE_RIGHT);
    }

    form.addComponent(hlayout);
    form.setComponentAlignment(hlayout, Alignment.MIDDLE_RIGHT);

    return form;
}

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

Window modifyCaseWindow(CellCase cellCase) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);//from   w  ww .j  av  a2  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;
        }

        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 w  ww .  j a v a 2s .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;
}