List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:com.etest.view.systemadministration.FacultyMainUI.java
Table populateDataTable() { table.removeAllItems();/* w ww. j a v a 2 s . c o m*/ int i = 0; for (Users u : fs.getAllFaculty()) { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button edit = new Button("edit"); edit.setWidth("100%"); edit.setData(u.getFacultyId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(modifyBtnClickListener); hlayout.addComponent(edit); Button delete = new Button("del"); delete.setWidth("100%"); delete.setData(u.getFacultyId()); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(modifyBtnClickListener); hlayout.addComponent(delete); table.addItem(new Object[] { u.getName().toUpperCase(), u.getUsername_(), u.getUserType(), hlayout }, new Integer(i)); i++; } table.setPageLength(table.size()); // table.getListeners(ItemClickEvent.class).stream().forEach((listener) -> { // table.removeListener(ItemClickEvent.class, listener); // }); // table.addItemClickListener((ItemClickEvent event) -> { // Property itemProperty = event.getItem().getItemProperty("name"); // facultyId = fs.getFacultyIdByName(itemProperty.getValue().toString()); // // Window sub = new FacultyFormWindow(facultyId); // if(sub.getParent() == null){ // UI.getCurrent().addWindow(sub); // } // }); return table; }
From source file:com.etest.view.systemadministration.HousekeepingMainUI.java
Table populateDataTable() { table.removeAllItems();//from w w w . j a v a 2 s. c o m int i = 0; for (CellItem ci : hs.getAllItemsFromArchive()) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button recycle = new Button("recycle"); recycle.setWidthUndefined(); recycle.setData(ci.getCellItemId()); recycle.setIcon(FontAwesome.RECYCLE); recycle.addStyleName(ValoTheme.BUTTON_LINK); recycle.addStyleName(ValoTheme.BUTTON_TINY); recycle.addStyleName(ValoTheme.BUTTON_QUIET); recycle.addStyleName("button-container"); v.addComponent(recycle); v.setComponentAlignment(recycle, Alignment.MIDDLE_LEFT); Button view = new Button("view"); view.setWidthUndefined(); view.setData(ci.getCellItemId()); view.setIcon(FontAwesome.COFFEE); view.addStyleName(ValoTheme.BUTTON_LINK); view.addStyleName(ValoTheme.BUTTON_TINY); view.addStyleName(ValoTheme.BUTTON_QUIET); view.addStyleName("button-container"); view.addClickListener(buttonClickListener); v.addComponent(view); v.setComponentAlignment(view, Alignment.MIDDLE_LEFT); table.addItem(new Object[] { ci.getCellItemId(), ci.getItem(), v }, i); i++; } table.setPageLength(table.size()); return table; }
From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java
Table populateDataTable() { table.removeAllItems();//from w w w . jav a 2 s . c o m int i = 0; for (TeamTeach tt : tts.getAllMembersFromTeam(getTeamTeachId())) { String position; boolean isFacultyTeamLeader = tts.isFacultyTeamLeader(getTeamTeachId(), tt.getFacultyId()); if (isFacultyTeamLeader) { position = "Team Leader"; } else { position = "Member"; } HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button editPositionBtn = new Button("edit"); editPositionBtn.setWidthUndefined(); editPositionBtn.setData(tt.getFacultyId()); editPositionBtn.setIcon(FontAwesome.EDIT); editPositionBtn.addStyleName(ValoTheme.BUTTON_LINK); editPositionBtn.addStyleName(ValoTheme.BUTTON_TINY); editPositionBtn.addClickListener(modifyBtnClickListener); hlayout.addComponent(editPositionBtn); Button removeMemberBtn = new Button("del"); removeMemberBtn.setWidthUndefined(); removeMemberBtn.setData(tt.getFacultyId()); removeMemberBtn.setIcon(FontAwesome.TRASH_O); removeMemberBtn.addStyleName(ValoTheme.BUTTON_LINK); removeMemberBtn.addStyleName(ValoTheme.BUTTON_TINY); removeMemberBtn.addClickListener(modifyBtnClickListener); hlayout.addComponent(removeMemberBtn); if (!position.equals("Member")) { editPositionBtn.setEnabled(false); removeMemberBtn.setEnabled(false); } table.addItem(new Object[] { tt.getFacultyId(), tt.getName(), position, hlayout }, i); i++; } table.setPageLength(table.size()); return table; }
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);/* w ww . j ava2s . com*/ 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 w w. jav a 2 s . co 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);// www. j a v a2 s . c o m 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 av a2 s .co 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();/*from w w w . j av a2 s . c om*/ 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);/*from w w w. ja va2 s .c om*/ 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();//from w w w.ja va2s. co 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()); }