List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.etest.pdfviewer.TQCriticalIndexReportViewer.java
public TQCriticalIndexReportViewer(int tqCoverageId) { this.tqCoverageId = tqCoverageId; setWidth("900px"); setHeight("600px"); center();/*from w ww . jav a2 s .c om*/ StreamResource resource = new StreamResource(new TQCriticalIndexValuesReportPDF(getTQCoverageId()), "TQCriticalIndexValues.pdf"); resource.setMIMEType("application/pdf"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); Embedded e = new Embedded(); e.setSource(resource); e.setSizeFull(); e.setType(Embedded.TYPE_BROWSER); v.addComponent(e); setContent(v); }
From source file:com.etest.valo.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);//w w w. java 2 s.c o m content.setSpacing(true); content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for"); group.addStyleName("v-component-group"); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(800); } catch (InterruptedException e) { } } }); group.addComponent(loading); Button delay = new Button("3"); delay.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(3000); } catch (InterruptedException e) { } } }); group.addComponent(delay); Button wait = new Button("15"); wait.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(15000); } catch (InterruptedException e) { } } }); wait.addStyleName("last"); group.addComponent(wait); Label label = new Label(" seconds", ContentMode.HTML); label.setSizeUndefined(); group.addComponent(label); Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added."); spinnerDesc.addStyleName("small"); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!MainUI.isTestMode()) { final Label spinner = new Label(); spinner.addStyleName("spinner"); Button showSpinnerButton = new Button("Show spinner", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { content.replaceComponent(event.getComponent(), spinner); } }); content.addComponent(showSpinnerButton); } return p; }
From source file:com.etest.view.notification.NotificationMainUI.java
Table populateNoficationTable() { notificationTable.removeAllItems();// w w w .jav a 2 s .c o m int i = 0; for (EtestNotification en : ns.getAllNotificationByUser( CommonUtilities.convertStringToInt(VaadinSession.getCurrent().getAttribute("userId").toString()))) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button read = new Button(); read.setWidthUndefined(); read.setCaption((en.getStatus() == 0) ? "unread" : "read"); read.setData(en.getNotificationId()); read.setIcon(FontAwesome.VIDEO_CAMERA); read.addStyleName(ValoTheme.BUTTON_LINK); read.addStyleName(ValoTheme.BUTTON_TINY); read.addStyleName(ValoTheme.BUTTON_QUIET); read.addStyleName("button-container"); read.addClickListener(buttonClickListener); v.addComponent(read); v.setComponentAlignment(read, Alignment.MIDDLE_LEFT); message.setContentMode(ContentMode.HTML); String[] split = en.getNotice().split(" "); int cellCaseId; if (split[0].equals("CellCaseID")) { message.setCaption(en.getRemarks() + en.getNotice()); cellCaseId = CommonUtilities.convertStringToInt(split[1].replace("#", "")); } else { cellCaseId = cis.getCellItemById(CommonUtilities.convertStringToInt(split[1].replace("#", ""))) .getCellCaseId(); message.setCaption(en.getRemarks() + en.getNotice() + " from CellCaseID #" + cellCaseId); } Button approve = new Button("status"); approve.setSizeFull(); approve.addStyleName(ValoTheme.BUTTON_LINK); approve.addStyleName(ValoTheme.BUTTON_TINY); approve.addStyleName(ValoTheme.BUTTON_QUIET); approve.addStyleName("button-container"); v.addComponent(approve); v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT); if (ccs.getCellCaseById(cellCaseId).getApprovalStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); } else { approve.setIcon(FontAwesome.THUMBS_UP); } notificationTable.addItem(new Object[] { message.getCaption().toString(), ss.getUsernameById(en.getSenderId()), en.getNoteDate(), v }, i); i++; } notificationTable.setPageLength(0); notificationTable.setHeight("100%"); return notificationTable; }
From source file:com.etest.view.notification.ViewCaseNotificationWindow.java
VerticalLayout buildForms() { VerticalLayout v = new VerticalLayout(); v.setWidth("700px"); v.setMargin(true);/*from w w w. j av a 2s .c o m*/ v.setSpacing(true); Label cellCase = new Label(); cellCase.setValue("<b>Case</b>: " + ccs.getCellCaseById(getCellCaseId()).getCaseTopic()); cellCase.setContentMode(ContentMode.HTML); v.addComponent(cellCase); Label cellItem = new Label(); cellItem.setContentMode(ContentMode.HTML); Button approvalBtn = new Button(); approvalBtn.setCaption("Approve CASE"); approvalBtn.setWidthUndefined(); approvalBtn.addStyleName(ValoTheme.BUTTON_TINY); approvalBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); approvalBtn.addClickListener(buttonClickListener); if (ccs.getCellCaseById(getCellCaseId()).getApprovalStatus() == 0) { approvalBtn.setVisible(true); } else { approvalBtn.setVisible(false); } v.addComponent(approvalBtn); HorizontalLayout h1 = new HorizontalLayout(); h1.setWidth("100%"); approvalItemBtn.setVisible(false); approvalItemBtn.setWidthUndefined(); approvalItemBtn.addStyleName(ValoTheme.BUTTON_TINY); approvalItemBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); if (getCellItemId() != 0) { approvalBtn.setCaption("Approve ITEM"); CellItem ci = cis.getCellItemById(getCellItemId()); keyList = k.getAllItemKey(getCellItemId()); keyIndexSize = keyList.size(); if (keyList.isEmpty()) { ShowErrorNotification.error("No Item Key was found for STEM: \n" + ci.getItem()); return null; } stem = ci.getItem().replace("{key}", "<u>" + keyList.get(getKeyIndex()) + "</u>"); cellItem.setValue("<b>STEM</b>: " + getStem()); OptionGroup options = new OptionGroup(); options.addItems(cis.getCellItemById(getCellItemId()).getOptionA(), cis.getCellItemById(getCellItemId()).getOptionB(), cis.getCellItemById(getCellItemId()).getOptionC(), cis.getCellItemById(getCellItemId()).getOptionD()); h1.addComponent(options); h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER); if (cis.getCellItemById(getCellItemId()).getCellItemStatus() == 0) { approvalItemBtn.setVisible(true); } else { approvalItemBtn.setVisible(false); } approvalItemBtn.addClickListener(buttonClickListener); approvalItemBtn.setVisible(true); } v.addComponent(approvalBtn); v.addComponent(cellItem); v.addComponent(h1); v.addComponent(approvalItemBtn); Label separator = new Label("<HR>"); separator.setContentMode(ContentMode.HTML); v.addComponent(separator); return v; }
From source file:com.etest.view.systemadministration.HousekeepingMainUI.java
Table populateDataTable() { table.removeAllItems();/*from ww w . j ava 2 s . com*/ 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
public AddSemestralTeamMembersWindow(int teamTeachId) { this.teamTeachId = teamTeachId; setCaption("ADD TEAM MEMBERS"); setWidth("600px"); setModal(true);/*from w w w .j a va 2s .c om*/ center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); facultyId = tts.getFacultyIdByTeamTeachId(teamTeachId); v.addComponent(buildForms()); setContent(v); getContent().setHeightUndefined(); }
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 www . j ava 2s .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 w w .j a va 2s .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);//from w w w .java 2 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.syllabus.SyllabusMainUI.java
Table populateDataTable() { table.removeAllItems();/*from w w w . j a v a 2s .c om*/ int i = 0; for (Syllabus s : ss.getAllSyllabus()) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button edit = new Button("edit"); edit.setWidthUndefined(); edit.setData(s.getSyllabusId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(buttonClickListener); v.addComponent(edit); Button delete = new Button("del"); delete.setWidthUndefined(); delete.setData(s.getSyllabusId()); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(buttonClickListener); v.addComponent(delete); Label descriptiveTitle = new Label(s.getTopic(), ContentMode.HTML); descriptiveTitle.setStyleName("label-padding"); Label topic = new Label(s.getTopic(), ContentMode.HTML); topic.setStyleName("label-padding"); table.addItem(new Object[] { // s.getSyllabusId(), s.getSubject(), descriptiveTitle, s.getTopicNo(), topic, s.getEstimatedTime(), v }, i); i++; } table.setPageLength(table.size()); return table; }