List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:com.etest.view.testbank.cellitem.CellCaseItemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);//from w ww. j a v a 2 s.c om form.setSpacing(true); CellCase cc = ccs.getCellCaseById(getCellCaseId()); Panel panel = new Panel(); panel.setWidth("100%"); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); Label caseLabel = new Label(); caseLabel.setCaption("CASE: "); caseLabel.setStyleName("bold-font-style"); caseLabel.setWidth("80px"); Label caseTopic = new Label(); caseTopic.setValue(caseLabel.getCaption() + cc.getCaseTopic()); caseTopic.setContentMode(ContentMode.RAW); caseTopic.addStyleName("wrapline"); panel.setContent(caseTopic); form.addComponent(panel); form.addComponent(table); HorizontalLayout v = new HorizontalLayout(); v.setWidth("100%"); Button create = new Button("CREATE NEW STEM"); create.setWidthUndefined(); create.addStyleName(ValoTheme.BUTTON_LINK); create.addStyleName(ValoTheme.BUTTON_TINY); create.addStyleName(ValoTheme.BUTTON_QUIET); create.addClickListener(modifyBtnClickListener); v.addComponent(create); v.setComponentAlignment(create, Alignment.MIDDLE_RIGHT); form.addComponent(v); return form; }
From source file:com.etest.view.testbank.cellitem.CellItemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/*from www .j a va 2 s . com*/ form.setSpacing(true); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button helpBtn = new Button("HELP"); helpBtn.setWidthUndefined(); helpBtn.setIcon(FontAwesome.TASKS); helpBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); helpBtn.addStyleName(ValoTheme.BUTTON_SMALL); helpBtn.addClickListener((Button.ClickEvent event) -> { Window sub = new MultipleChoiceHelpViewer(); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } }); hlayout.addComponent(helpBtn); hlayout.setComponentAlignment(helpBtn, Alignment.MIDDLE_RIGHT); form.addComponent(hlayout); bloomsTaxonomy.setCaption("Blooms Class: "); bloomsTaxonomy.setWidth("30%"); form.addComponent(bloomsTaxonomy); stem = new TextArea("Stem: "); stem.setWidth("100%"); stem.setRows(5); stem.setWordwrap(true); form.addComponent(stem); HorizontalLayout h1 = new HorizontalLayout(); h1.setCaption("Option A:"); h1.setWidth("100%"); h1.setSpacing(true); optionA = new CommonTextField("add option A", null); optionA.setWidth("500px"); h1.addComponent(optionA); Button optionABtn = new CommonButton("OPTION A"); optionABtn.setWidth("120px"); optionABtn.addClickListener(updateOptionAndKeyListerner); h1.addComponent(optionABtn); h1.setComponentAlignment(optionABtn, Alignment.MIDDLE_RIGHT); optionABtn.setVisible(isEdit()); form.addComponent(h1); HorizontalLayout h2 = new HorizontalLayout(); h2.setCaption("Key A:"); h2.setWidth("100%"); h2.setSpacing(true); keyA = new CommonTextField("Enter a Key for Option A", null); keyA.setWidth("500px"); h2.addComponent(keyA); Button keyABtn = new CommonButton("KEY A"); keyABtn.setWidth("120px"); keyABtn.addClickListener(updateOptionAndKeyListerner); h2.addComponent(keyABtn); h2.setComponentAlignment(keyABtn, Alignment.MIDDLE_RIGHT); keyABtn.setVisible(isEdit()); form.addComponent(h2); HorizontalLayout h3 = new HorizontalLayout(); h3.setCaption("Option B:"); h3.setWidth("100%"); h3.setSpacing(true); optionB = new CommonTextField("add option B", null); optionB.setWidth("500px"); h3.addComponent(optionB); Button optionBBtn = new CommonButton("OPTION B"); optionBBtn.setWidth("120px"); optionBBtn.addClickListener(updateOptionAndKeyListerner); h3.addComponent(optionBBtn); h3.setComponentAlignment(optionBBtn, Alignment.MIDDLE_RIGHT); optionBBtn.setVisible(isEdit()); form.addComponent(h3); HorizontalLayout h4 = new HorizontalLayout(); h4.setCaption("Key B:"); h4.setWidth("100%"); h4.setSpacing(true); keyB = new CommonTextField("Enter a Key for Option B", null); keyB.setWidth("500px"); h4.addComponent(keyB); Button keyBBtn = new CommonButton("KEY B"); keyBBtn.setWidth("120px"); keyBBtn.addClickListener(updateOptionAndKeyListerner); h4.addComponent(keyBBtn); h4.setComponentAlignment(keyBBtn, Alignment.MIDDLE_RIGHT); keyBBtn.setVisible(isEdit()); form.addComponent(h4); HorizontalLayout h5 = new HorizontalLayout(); h5.setCaption("Option C:"); h5.setWidth("100%"); h5.setSpacing(true); optionC = new CommonTextField("add option C", null); optionC.setWidth("500px"); h5.addComponent(optionC); Button optionCBtn = new CommonButton("OPTION C"); optionCBtn.setWidth("120px"); optionCBtn.addClickListener(updateOptionAndKeyListerner); h5.addComponent(optionCBtn); h5.setComponentAlignment(optionCBtn, Alignment.TOP_RIGHT); optionCBtn.setVisible(isEdit()); form.addComponent(h5); HorizontalLayout h6 = new HorizontalLayout(); h6.setCaption("Key C:"); h6.setWidth("100%"); h6.setSpacing(true); keyC = new CommonTextField("Enter a Key for Option C", null); keyC.setWidth("500px"); h6.addComponent(keyC); Button keyCBtn = new CommonButton("KEY C"); keyCBtn.setWidth("120px"); keyCBtn.addClickListener(updateOptionAndKeyListerner); h6.addComponent(keyCBtn); h6.setComponentAlignment(keyCBtn, Alignment.MIDDLE_RIGHT); keyCBtn.setVisible(isEdit()); form.addComponent(h6); HorizontalLayout h7 = new HorizontalLayout(); h7.setCaption("Option D:"); h7.setWidth("100%"); h7.setSpacing(true); optionD = new CommonTextField("add option D", null); optionD.setWidth("500px"); h7.addComponent(optionD); Button optionDBtn = new CommonButton("OPTION D"); optionDBtn.setWidth("120px"); optionDBtn.addClickListener(updateOptionAndKeyListerner); h7.addComponent(optionDBtn); h7.setComponentAlignment(optionDBtn, Alignment.MIDDLE_RIGHT); optionDBtn.setVisible(isEdit()); form.addComponent(h7); HorizontalLayout h8 = new HorizontalLayout(); h8.setCaption("Key D:"); h8.setWidth("100%"); h8.setSpacing(true); keyD = new CommonTextField("Enter a Key for Option D", null); keyD.setWidth("500px"); h8.addComponent(keyD); Button keyDBtn = new CommonButton("KEY D"); keyDBtn.setWidth("120px"); keyDBtn.addClickListener(updateOptionAndKeyListerner); h8.addComponent(keyDBtn); h8.setComponentAlignment(keyDBtn, Alignment.MIDDLE_RIGHT); keyDBtn.setVisible(isEdit()); form.addComponent(h8); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); 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 remove = new Button("ARCHIVE/REMOVE ITEM?"); remove.setWidth("200px"); remove.setIcon(FontAwesome.ARCHIVE); remove.addStyleName(ValoTheme.BUTTON_PRIMARY); remove.addStyleName(ValoTheme.BUTTON_SMALL); remove.addClickListener(buttonClickListener); Button approve = new Button("APPROVE ITEM?"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_O_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); Button edit = new Button("UPDATE"); edit.setWidth("200px"); edit.setIcon(FontAwesome.SAVE); edit.addStyleName(ValoTheme.BUTTON_PRIMARY); edit.addStyleName(ValoTheme.BUTTON_SMALL); edit.addClickListener(buttonClickListener); if (getCellItemId() != 0) { CellItem ci = cis.getCellItemById(getCellItemId()); bloomsTaxonomy.setValue(ci.getBloomsClassId()); bloomsTaxonomy.addValueChangeListener((Property.ValueChangeEvent event) -> { isBloomsChanged = true; }); stem.setValue(ci.getItem()); stem.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { if (!stem.getValue().trim().equals(event.getText().trim())) { isStemChanged = true; } }); /** * OPTION A */ optionA.setValue(ci.getOptionA()); isOptionAKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionA()); if (isOptionAKeyExist) { keyA.setValue(k.getItemKey(getCellItemId(), ci.getOptionA())); } keyA.setData(k.getItemKeyId(getCellItemId(), ci.getOptionA())); /** * OPTION B */ optionB.setValue(ci.getOptionB()); isOptionBKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionB()); if (isOptionBKeyExist) { keyB.setValue(k.getItemKey(getCellItemId(), ci.getOptionB())); } keyB.setData(k.getItemKeyId(getCellItemId(), ci.getOptionB())); /** * OPTION C */ optionC.setValue(ci.getOptionC()); isOptionCKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionC()); if (isOptionCKeyExist) { keyC.setValue(k.getItemKey(getCellItemId(), ci.getOptionC())); } keyC.setData(k.getItemKeyId(getCellItemId(), ci.getOptionC())); /** * OPTION D */ optionD.setValue(ci.getOptionD()); isOptionDKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionD()); if (isOptionDKeyExist) { keyD.setValue(k.getItemKey(getCellItemId(), ci.getOptionD())); } keyD.setData(k.getItemKeyId(getCellItemId(), ci.getOptionD())); h.addComponent(remove); h.setComponentAlignment(remove, Alignment.MIDDLE_RIGHT); h.addComponent(approve); h.setComponentAlignment(approve, Alignment.MIDDLE_RIGHT); h.addComponent(edit); h.setComponentAlignment(edit, Alignment.MIDDLE_RIGHT); form.addComponent(h); } else { h.addComponent(save); h.setComponentAlignment(save, Alignment.MIDDLE_RIGHT); form.addComponent(h); } return form; }
From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/*from w ww . ja v a 2 s .co m*/ form.setSpacing(true); CellItem ci = cis.getCellItemById(getCellItemId()); if (ci.getCellItemId() == 0) { ci = hs.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>"); label.setValue("<b>STEM</b>: " + getStem()); label.setContentMode(ContentMode.HTML); form.addComponent(label); HorizontalLayout h1 = new HorizontalLayout(); h1.setWidth("100%"); OptionGroup options = new OptionGroup(); options.addItems(ci.getOptionA(), ci.getOptionB(), ci.getOptionC(), ci.getOptionD()); options.addValueChangeListener((Property.ValueChangeEvent event) -> { boolean result = k.isAnswerCorrect(getCellItemId(), getItemKey(), CommonUtilities.escapeSingleQuote(event.getProperty().getValue())); if (result) { Notification.show("Correct Answer!", Notification.Type.TRAY_NOTIFICATION); } else { Notification.show("Wrong Answer", Notification.Type.TRAY_NOTIFICATION); } }); h1.addComponent(options); h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER); form.addComponent(h1); GridLayout g = new GridLayout(2, 2); g.setWidth("100%"); g.setSpacing(true); prev = new Button(); prev.setWidth("50px"); prev.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); prev.addStyleName(ValoTheme.BUTTON_PRIMARY); prev.addStyleName(ValoTheme.BUTTON_SMALL); prev.addClickListener(prevBtnClickListener); g.addComponent(prev, 0, 0); g.setComponentAlignment(prev, Alignment.MIDDLE_LEFT); next = new Button(); next.setWidth("50px"); next.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); next.addStyleName(ValoTheme.BUTTON_PRIMARY); next.addStyleName(ValoTheme.BUTTON_SMALL); next.addClickListener(nextBtnClickListener); g.addComponent(next, 1, 0); g.setComponentAlignment(next, Alignment.MIDDLE_RIGHT); if (getKeyIndexSize() == 1) { prev.setEnabled(false); next.setEnabled(false); } populateDataTable(); g.addComponent(table, 0, 1, 1, 1); g.setComponentAlignment(table, Alignment.MIDDLE_CENTER); form.addComponent(g); return form; }
From source file:com.etest.view.tq.itemanalysis.FileUploadWindow.java
void readContentFromExcelFile(File excelFile) { try {//from w w w . ja v a2 s . c om POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(excelFile)); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheetAt(wb.getActiveSheetIndex()); HSSFRow row; HSSFCell cell; boolean stop = false; boolean nonBlankRowFound; int s; HSSFRow lastRow = null; while (stop == false) { nonBlankRowFound = false; lastRow = sheet.getRow(sheet.getLastRowNum()); for (s = lastRow.getFirstCellNum(); s <= lastRow.getLastCellNum(); s++) { cell = lastRow.getCell(s); if (cell != null && lastRow.getCell(s).getCellType() != HSSFCell.CELL_TYPE_BLANK) { nonBlankRowFound = true; } } if (nonBlankRowFound == true) { stop = true; } else { sheet.removeRow(lastRow); } } int rows; // No of rows rows = sheet.getPhysicalNumberOfRows(); int cols = 0; // No of columns int tmp = 0; // This trick ensures that we get the data properly even if it doesn't start from first few rows for (int i = 0; i < 10 || i < rows; i++) { row = sheet.getRow(i); if (row != null) { tmp = sheet.getRow(i).getPhysicalNumberOfCells(); if (tmp > cols) cols = tmp; } } List<ItemAnalysis> itemAnalysisList = new ArrayList<>(); List<Character> answer; ItemAnalysis itemAnalysis = null; for (int c = 0; c < cols; c++) { itemAnalysis = new ItemAnalysis(); answer = new ArrayList<>(); for (int r = 0; r < rows; r++) { row = sheet.getRow(r); if (row == null || row.toString().isEmpty()) { ShowErrorNotification.error("Remove all blank/empty rows after the last Item!"); return; } else { // if(row != null){ cell = row.getCell(c); if (cell == null || cell.toString().isEmpty()) { ShowErrorNotification.error("Remove all blank/empty columns after the last student!"); return; } else { // if(cell != null){ if (c != 0) { if (r == 0) { itemAnalysis.setStudentNumber(cell.toString().trim()); } else { answer.add(cell.toString().trim().charAt(0)); } } else { if (r != 0) { totalItems++; } } } } } if (c != 0) { itemAnalysis.setAnswer(answer); itemAnalysisList.add(itemAnalysis); } } if (tq.getCellItemIdByTQCoverageId(getTqCoverageId()).size() != totalItems) { ShowErrorNotification.error("Total Items do not MATCH!"); totalItems = 0; return; } studentNoAndTotalScore = new HashMap<>(); studentNoAndAnswer = new HashMap<>(); totalItems = 1; new Thread() { @Override public void run() { totalData = itemAnalysisList.size(); for (ItemAnalysis i : itemAnalysisList) { try { Thread.sleep(50); studentNoAndTotalScore.put(i.getStudentNumber(), ItemAnalysisInterpretation .getTotalScoresOfAllStudent(tqCoverageId, i.getAnswer())); studentNoAndAnswer.put(i.getStudentNumber(), i.getAnswer()); getUI().access(new Runnable() { @Override public void run() { if (totalItems < itemAnalysisList.size()) { analyze.setValue("Analyzing data.. " + CommonUtilities.roundOffToTwoDecimal((current / totalData) * 100) + "%"); current++; } else { analyze.setValue("Data analyzed... 100%"); getLowerAndUpperGroupStudent(studentNoAndTotalScore); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.addComponent(viewTableProportion()); h.addComponent(viewStudentsTotalScore()); h.addComponent(approveItemAnalysis()); v.addComponent(h); v.addComponent(itemAnalysisGridPanel()); } } }); totalItems++; } catch (InterruptedException ex) { Logger.getLogger(FileUploadWindow.class.getName()).log(Level.SEVERE, null, ex); } } } }.start(); UI.getCurrent().setPollInterval(500); } catch (IOException ex) { Logger.getLogger(TQItemAnalysisUI.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.etest.view.tq.reports.OnlineQueriesUI.java
public OnlineQueriesUI() { setWidth("100%"); setMargin(true);//from w ww. j a v a2s .co m setSpacing(true); Label lineSeparator1 = new Label(); lineSeparator1.setContentMode(ContentMode.HTML); lineSeparator1.setStyleName("line-separator"); Label lineSeparator2 = new Label(); lineSeparator2.setContentMode(ContentMode.HTML); lineSeparator2.setStyleName("line-separator"); disableAllComponents(false); GridLayout topGrid = new GridLayout(3, 2); topGrid.setWidth("800px"); topGrid.setSpacing(true); VerticalLayout top = new VerticalLayout(); top.setWidth("166px"); graphicalInventory.addItem("Graphical Inventory"); graphicalInventory.setWidth("300px"); top.addComponent(graphicalInventory); graphicalInventory.addValueChangeListener(firstLevelOptionListener); graphicalInventory.setImmediate(true); graphicalInventoryGroup.addItem("All Subjects"); Label subjectProportionedCaption = new Label(); subjectProportionedCaption.setWidth("500px"); subjectProportionedCaption .setCaption("A Subject's No. of Items Proportioned " + "According to the Revised Bloom's Taxonomy"); subjectProportionedCaption.setContentMode(ContentMode.HTML); subjectProportionedCaption.setHeightUndefined(); graphicalInventoryGroup.addItem(subjectProportionedCaption.getCaption()); graphicalInventoryGroup.setWidth("400px"); graphicalInventoryGroup.addValueChangeListener(secondLevelTopOptionListener); graphicalInventoryGroup.setImmediate(true); topGrid.addComponent(top, 0, 0); topGrid.addComponent(graphicalInventoryGroup, 1, 0, 2, 0); addComponent(topGrid); searchSubject1.setInputPrompt("Search Subject"); searchSubject1.setWidth("225px"); searchSubject1.addValueChangeListener(dropDownChangeListener); searchSubject1.setEnabled(false); topGrid.addComponent(searchSubject1, 1, 1); addComponent(lineSeparator1); GridLayout bottomGrid = new GridLayout(3, 3); bottomGrid.setWidth("800px"); bottomGrid.setSpacing(true); VerticalLayout bottom = new VerticalLayout(); bottom.setWidth("235px"); itemAnalysis.addItem("Item Analysis"); itemAnalysis.setWidth("310px"); bottom.addComponent(itemAnalysis); itemAnalysis.addValueChangeListener(firstLevelOptionListener); itemAnalysis.setImmediate(true); graphicalView.addItem("Graphical View"); graphicalView.setWidth("210px"); graphicalView.addValueChangeListener(secondLevelBottomOptionListener); graphicalView.setImmediate(true); tabularView.addItem("Tabular View"); tabularView.addValueChangeListener(secondLevelBottomOptionListener); tabularView.setImmediate(true); graphicalViewGroup.addItem("Summary: All Tests of a Subject"); graphicalViewGroup.addItem("Difficulty Index of a Subject's Test"); graphicalViewGroup.addItem("Discrimination Index of a Subject's Test"); graphicalViewGroup.setWidth("300px"); graphicalViewGroup.addValueChangeListener(thirdLevelBottomOptionListener); graphicalViewGroup.setImmediate(true); tabularViewGroup.addItem("Summary: All Tests of a Subject"); tabularViewGroup.addItem("Critical values of a test"); tabularViewGroup.addValueChangeListener(thirdLevelBottomOptionListener); tabularViewGroup.setImmediate(true); searchSubject2.setInputPrompt("Search Subject"); searchSubject2.setWidth("225px"); searchSubject2.addValueChangeListener(dropDownChangeListener); searchSubject2.setEnabled(false); searchTest.setWidth("225px"); searchTest.setInputPrompt("Search Test"); searchTest.setEnabled(false); searchTest.addStyleName(ValoTheme.COMBOBOX_SMALL); bottomGrid.addComponent(bottom, 0, 0); bottomGrid.addComponent(graphicalView, 1, 0); bottomGrid.addComponent(tabularView, 1, 1); bottomGrid.addComponent(graphicalViewGroup, 2, 0); bottomGrid.addComponent(tabularViewGroup, 2, 1); bottomGrid.addComponent(searchSubject2, 1, 2); bottomGrid.addComponent(searchTest, 2, 2); addComponent(bottomGrid); addComponent(lineSeparator2); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); Button calculateAndViewBtn = new Button("Calculate & View"); calculateAndViewBtn.setWidth("300px"); calculateAndViewBtn.addClickListener(buttonClickListener); h.addComponent(calculateAndViewBtn); h.setComponentAlignment(calculateAndViewBtn, Alignment.MIDDLE_LEFT); addComponent(calculateAndViewBtn); }
From source file:com.etest.view.tq.TQCoverageWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);//from w w w . ja va 2s. co m int itemNo = 1; Label caseTopic; Label stem; Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId()); for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) { Integer tqCaseId = tqCases.getKey(); caseTopic = new Label(); caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic()); caseTopic.setContentMode(ContentMode.HTML); form.addComponent(caseTopic); Map<Integer, Integer> value = tqCases.getValue(); for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) { Integer itemId = itemIds.getKey(); Integer itemKeyId = itemIds.getValue(); List<String> keyList = k.getAllItemKey(itemId); if (keyList.isEmpty()) { ShowErrorNotification .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem()); return null; } stem = new Label(); // stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0))); stem.setValue(itemNo + ". " + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId))); stem.setContentMode(ContentMode.HTML); form.addComponent(stem); GridLayout glayout = new GridLayout(2, 2); glayout.setWidth("100%"); glayout.setSpacing(true); glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML), 0, 0); glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML), 0, 1); glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML), 1, 0); glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML), 1, 1); form.addComponent(glayout); itemNo++; } } HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button delete = new Button("DELETE"); delete.setWidth("200px"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener(buttonClickListener); h.addComponent(delete); Button approve = new Button("APPROVE"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); h.addComponent(approve); if (tq.isTQCoverageApproved(getTQCoverageId())) { approve.setVisible(false); } else { approve.setVisible(true); } form.addComponent(h); return form; }
From source file:com.example.bbs.vaadin.view.Labels.java
License:Apache License
public Labels() { setMargin(true);//from w w w .j a v a 2s . c o m addStyleName("content-labels"); Label h1 = new Label("Labels"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout split = new HorizontalLayout(); split.setWidth("100%"); addComponent(split); VerticalLayout left = new VerticalLayout(); left.setMargin(new MarginInfo(false, true, false, false)); split.addComponent(left); Label huge = new Label("Huge type for display text."); huge.addStyleName(ValoTheme.LABEL_HUGE); left.addComponent(huge); Label large = new Label( "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); large.addStyleName(ValoTheme.LABEL_LARGE); left.addComponent(large); Label h2 = new Label("Subtitle"); h2.addStyleName(ValoTheme.LABEL_H2); left.addComponent(h2); Label normal = new Label( "Normal type for plain text, with a <a href=\"https://vaadin.com\">regular link</a>. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.", ContentMode.HTML); left.addComponent(normal); Label h3 = new Label("Small Title"); h3.addStyleName(ValoTheme.LABEL_H3); left.addComponent(h3); Label small = new Label( "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); small.addStyleName(ValoTheme.LABEL_SMALL); left.addComponent(small); Label tiny = new Label("Tiny type for minor text."); tiny.addStyleName(ValoTheme.LABEL_TINY); left.addComponent(tiny); Label h4 = new Label("Section Title"); h4.addStyleName(ValoTheme.LABEL_H4); left.addComponent(h4); normal = new Label( "Normal type for plain text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); left.addComponent(normal); Panel p = new Panel("Additional Label Styles"); split.addComponent(p); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setMargin(true); p.setContent(right); Label label = new Label( "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName(ValoTheme.LABEL_BOLD); right.addComponent(label); label = new Label( "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName(ValoTheme.LABEL_LIGHT); right.addComponent(label); label = new Label( "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName(ValoTheme.LABEL_COLORED); right.addComponent(label); label = new Label("A label for success"); label.addStyleName(ValoTheme.LABEL_SUCCESS); right.addComponent(label); label = new Label("A label for failure"); label.addStyleName(ValoTheme.LABEL_FAILURE); right.addComponent(label); }
From source file:com.example.EditingWindow.java
License:Apache License
protected HorizontalLayout makeFooter() { HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true);//from w w w. j av a 2 s . c om footer.addStyleName("v-window-bottom-toolbar"); Label footerText = new Label("Footer text"); footerText.setSizeUndefined(); btnOK.addStyleName(ValoTheme.BUTTON_PRIMARY); btnOK.setClickShortcut(ShortcutAction.KeyCode.ENTER); btnCancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE); footer.addComponents(footerText, btnOK, btnCancel); footer.setExpandRatio(footerText, 1); return footer; }
From source file:com.fnc.view.ui.AlphaListMainUI.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("50%"); corporation.setCaption("Corporation: "); corporation.addStyleName(ValoTheme.COMBOBOX_SMALL); trade.setCaption("Trade: "); trade.addStyleName(ValoTheme.COMBOBOX_SMALL); branch.setCaption("Branch: "); branch.addStyleName(ValoTheme.COMBOBOX_SMALL); corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption())); form.addComponent(corporation);/*from ww w .j a v a 2s.c o m*/ trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption())); form.addComponent(trade); branch.addValueChangeListener(branchPropertyChangeListener); form.addComponent(branch); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Year: "); h.setWidth("100%"); h.setSpacing(true); h.addComponent(selectYear()); h.addComponent(alphaListButton()); form.addComponent(h); return form; }
From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("50%"); corporation.setCaption("Corporation: "); corporation.addStyleName(ValoTheme.COMBOBOX_SMALL); trade.setCaption("Trade: "); trade.addStyleName(ValoTheme.COMBOBOX_SMALL); branch.setCaption("Branch: "); branch.addStyleName(ValoTheme.COMBOBOX_SMALL); corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption())); form.addComponent(corporation);//from www. j a v a 2 s.co m trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption())); form.addComponent(trade); branch.addValueChangeListener(branchPropertyChangeListener); form.addComponent(branch); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Year: "); h.setWidth("100%"); h.setSpacing(true); h.addComponent(selectYear()); h.addComponent(button()); form.addComponent(h); return form; }