List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:com.esspl.datagen.ui.SettingsView.java
License:Open Source License
private Component createBottomBar(final DataGenApplication dataGenApplication) { HorizontalLayout bottom = new HorizontalLayout(); bottom.setWidth("100%"); bottom.setSpacing(true);/*w w w . j a va 2 s. co m*/ Button addButton = new Button("Add", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ConnectionProfile profile = new ConnectionProfile("New Profile", "", "", "", ""); SettingsManager.get().getConfiguration().addProfile(profile); list.getContainerDataSource().addItem(profile); list.select(profile); } }); Button saveProfilesButton = new Button("Save Profiles", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { SettingsManager.get().persistConfiguration(); } }); Button closeButton = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { dataGenApplication.toolbar.reloadConnectionProfile(); close(); } }); bottom.addComponent(addButton); bottom.addComponent(saveProfilesButton); bottom.addComponent(closeButton); bottom.setComponentAlignment(closeButton, Alignment.MIDDLE_RIGHT); bottom.setExpandRatio(closeButton, 1); return bottom; }
From source file:com.esspl.datagen.ui.TableDataView.java
License:Open Source License
public TableDataView(final JdbcTable table, final Connection connection, final DataGenApplication dataApp) { log.debug("TableDataView - constructor start"); setCaption("Data"); dataGenApplication = dataApp;//from w w w .ja v a2 s. co m VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); setCompositionRoot(vl); HorizontalLayout hBar = new HorizontalLayout(); hBar.setWidth("98%"); hBar.setHeight("40px"); rows = new TextField(); rows.setWidth("50px"); rows.setImmediate(true); rows.addValidator(new IntegerValidator("Rows must be an Integer")); Label lbl = new Label("Generate "); content = new HorizontalLayout(); content.setHeight("40px"); content.setMargin(false, false, false, true); content.setSpacing(true); content.addComponent(lbl); content.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); content.addComponent(rows); content.setComponentAlignment(rows, Alignment.MIDDLE_CENTER); Button addDataButton = new Button("Row(S) Data", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { log.debug("TableDataView - Generate Data Button clicked"); populateGenerator(table); } }); addDataButton.addStyleName("small"); addDataButton.setIcon(DataGenConstant.ADD_SMALL); content.addComponent(addDataButton); content.setComponentAlignment(addDataButton, Alignment.MIDDLE_CENTER); Button refreshButton = new Button("Refresh", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { log.debug("TableDataView - Refresh Button clicked"); refreshDataView(table, connection); } }); refreshButton.addStyleName("small"); refreshButton.setIcon(DataGenConstant.RESET); content.addComponent(refreshButton); content.setComponentAlignment(refreshButton, Alignment.MIDDLE_CENTER); //Tapas:10/08/2012 - Export feature implementation started HorizontalLayout expContainer = new HorizontalLayout(); expContainer.setSpacing(true); PopupButton exportButton = new PopupButton("Export"); exportButton.setComponent(new DataExportView()); exportButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //dataApp.getMainWindow().showNotification("Export Button clicked!"); } }); exportButton.setIcon(DataGenConstant.DATAEXPORT_ICON); expContainer.addComponent(exportButton); expContainer.setComponentAlignment(exportButton, Alignment.MIDDLE_LEFT); //Tapas:10/08/2012 - Import feature implementation started PopupButton importButton = new PopupButton("Import"); importButton.setComponent(new DataImportView()); importButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //dataApp.getMainWindow().showNotification("Import Button clicked!"); } }); importButton.setIcon(DataGenConstant.DATAIMPORT_ICON); expContainer.addComponent(importButton); expContainer.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT); tableContainer = new VerticalLayout(); tableContainer.setSizeFull(); hBar.addComponent(content); hBar.setComponentAlignment(content, Alignment.MIDDLE_LEFT); hBar.addComponent(expContainer); hBar.setComponentAlignment(expContainer, Alignment.MIDDLE_RIGHT); vl.addComponent(hBar); vl.addComponent(tableContainer); vl.setExpandRatio(tableContainer, 1f); refreshDataView(table, connection); log.debug("TableDataView - constructor end"); }
From source file:com.etest.view.notification.NotificationMainUI.java
public NotificationMainUI() { setSizeFull();//w w w .j av a 2 s . c om setSpacing(true); if (VaadinSession.getCurrent().getAttribute("userId") == null) { Page.getCurrent().setLocation("http://localhost:8080/"); } else { addComponent(populateNoficationTable()); } HorizontalLayout h = new HorizontalLayout(); h.setWidth("950px"); Button sendMsgBtn = new Button("Send Message"); sendMsgBtn.setWidthUndefined(); sendMsgBtn.addStyleName(ValoTheme.BUTTON_SMALL); sendMsgBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); sendMsgBtn.addClickListener((Button.ClickEvent event) -> { Notification.show("Send Message!"); }); h.addComponent(sendMsgBtn); h.setComponentAlignment(sendMsgBtn, Alignment.MIDDLE_RIGHT); addComponent(h); }
From source file:com.etest.view.notification.ViewCaseNotificationWindow.java
VerticalLayout buildForms() { VerticalLayout v = new VerticalLayout(); v.setWidth("700px"); v.setMargin(true);//from w ww . 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.curriculum.CurriculumFormWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setMargin(true);//from www . j a va2 s.com yearLevel.setWidth("75%"); form.addComponent(yearLevel); subjectField.setWidth("75%"); form.addComponent(subjectField); normCourseOffering.setWidth("75%"); form.addComponent(normCourseOffering); descriptiveTitleField.setWidth("100%"); descriptiveTitleField.setRows(3); descriptiveTitleField.setInputPrompt("Descriptive Title.."); form.addComponent(descriptiveTitleField); Button save = new Button("SAVE"); save.setWidth("100%"); save.setIcon(FontAwesome.SAVE); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addStyleName(ValoTheme.BUTTON_SMALL); save.addClickListener(buttonClickListener); Button update = new Button("UPDATE"); update.setWidth("100%"); update.setIcon(FontAwesome.ADJUST); update.addStyleName(ValoTheme.BUTTON_PRIMARY); update.addStyleName(ValoTheme.BUTTON_SMALL); update.addClickListener(buttonClickListener); Button delete = new Button("DELETE"); delete.setWidth("100%"); delete.setIcon(FontAwesome.ERASER); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener(buttonClickListener); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); hlayout.setSpacing(true); if (getCurriculumId() != 0) { hlayout.addComponent(update); hlayout.addComponent(delete); Curriculum c = cs.getCurriculumById(getCurriculumId()); yearLevel.setValue(c.getYearLevel()); subjectField.setValue(c.getSubject()); normCourseOffering.setValue(c.getNormCourseOffering()); descriptiveTitleField.setValue(c.getDescriptiveTitle()); if (getButtonCaption().equals("edit")) { delete.setVisible(false); } else { update.setVisible(false); } } else { hlayout.addComponent(save); } form.addComponent(hlayout); return form; }
From source file:com.etest.view.systemadministration.CurriculumMainUI.java
Table populateDataTable() { table.removeAllItems();/*from www . j av a 2 s. co m*/ int i = 0; for (Curriculum c : cs.getAllCurriculum()) { HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button edit = new Button("edit"); edit.setSizeFull(); edit.setIcon(FontAwesome.PENCIL); edit.setData(c.getCurriculumId()); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(buttonClickListener); h.addComponent(edit); Button delete = new Button("del"); delete.setSizeFull(); delete.setIcon(FontAwesome.TRASH_O); delete.setData(c.getCurriculumId()); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(buttonClickListener); h.addComponent(delete); table.addItem(new Object[] { // c.getCurriculumId(), CommonVariableMap.getYearLevel(c.getYearLevel()), c.getSubject(), c.getDescriptiveTitle(), CommonVariableMap.getNormCourseOffering(c.getNormCourseOffering()), h }, 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("id"); // // Window sub = new CurriculumFormWindow(CommonUtilities.convertStringToInt(itemProperty.getValue().toString())); // if(sub.getParent() == null){ // UI.getCurrent().addWindow(sub); // } // sub.addCloseListener((Window.CloseEvent e) -> { // populateDataTable(); // }); // }); return table; }
From source file:com.etest.view.systemadministration.FacultyMainUI.java
Table populateDataTable() { table.removeAllItems();// w w w. j a va 2s. c om 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.SemestralTeam.AddSemestralTeamMembersWindow.java
Table populateDataTable() { table.removeAllItems();//w w w.j a v a 2 s .c om 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.SemestralTeamUI.java
void populateDataTable() { table.removeAllItems();/*w w 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.testbank.CellCaseWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);// ww w.ja va 2s . c om 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; }