List of usage examples for com.vaadin.ui Label Label
public Label()
From source file:com.esofthead.mycollab.vaadin.web.ui.field.DateViewField.java
License:Open Source License
public DateViewField(Date date) { this.date = date; dateLbl = new Label(); dateLbl.setWidth("100%"); }
From source file:com.esofthead.mycollab.vaadin.web.ui.field.I18nFormViewField.java
License:Open Source License
public I18nFormViewField(final String key, Class<? extends Enum> enumCls) { String key1 = key;//from w w w . ja v a 2s. c om Class<? extends Enum> enumClass = enumCls; label = new Label(); label.setContentMode(ContentMode.TEXT); label.setWidthUndefined(); label.addStyleName("wordWrap"); if (StringUtils.isNotBlank(key)) { try { String value = AppContext.getMessage(enumClass, key); label.setValue(value); } catch (Exception e) { label.setValue(""); } } else { label.setValue(""); } }
From source file:com.esofthead.mycollab.vaadin.web.ui.MassUpdateWindow.java
License:Open Source License
protected ComponentContainer buildButtonControls() { MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withFullWidth(); updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w ww .j ava 2s .c o m public void buttonClick(ClickEvent event) { updateForm.commit(); massUpdateCommand.massUpdate(beanItem); MassUpdateWindow.this.close(); } }); updateBtn.setStyleName(UIConstants.BUTTON_ACTION); updateBtn.setIcon(FontAwesome.SAVE); closeBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { MassUpdateWindow.this.close(); } }); closeBtn.setStyleName(UIConstants.BUTTON_OPTION); Label spacing = new Label(); controlsLayout.with(spacing, closeBtn, updateBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing); return controlsLayout; }
From source file:com.esofthead.mycollab.vaadin.web.ui.ProgressBarIndicator.java
License:Open Source License
public ProgressBarIndicator() { super("progressBar"); this.progressIndicator = new ProgressBar(); this.progressIndicator.setWidth("100%"); this.progressStatusLabel = new Label(); this.progressStatusLabel.setWidth("100%"); this.progressStatusLabel.setHeight("100%"); this.addComponent(this.progressIndicator, "progressbar-container"); this.addComponent(this.progressStatusLabel, "progressbar-status"); }
From source file:com.esspl.datagen.ui.ExecutorView.java
License:Open Source License
public ExecutorView(DataGenApplication application) { log.debug("ExecutorView - constructor start"); dataGenApplication = application;// www . jav a 2 s . c om setSizeFull(); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); setCompositionRoot(vl); splitPanel = new VerticalSplitPanel(); splitPanel.setSizeFull(); //Script TextArea sqlScript = new TextArea(); sqlScript.setSizeFull(); sqlScript.setWordwrap(false); sqlScript.setStyleName("noResizeTextArea"); HorizontalLayout queryOptions = new HorizontalLayout(); queryOptions.setMargin(false, false, false, true); queryOptions.setSpacing(true); queryOptions.setWidth("100%"); queryOptions.setHeight("40px"); Button executeButton = new Button("Execute", new ClickListener() { @Override public void buttonClick(ClickEvent event) { log.info("ExecutorView - Execute Button clicked"); executeScript(sqlScript.getValue().toString()); } }); executeButton.addStyleName("small"); executeButton.setIcon(DataGenConstant.EXECUTOR_ICON); executeButton.setDescription("Press Ctrl+Enter to execute the query"); Button clearQueryButton = new Button("Clear SQL", new ClickListener() { @Override public void buttonClick(ClickEvent event) { log.info("ExecutorView - Clear SQL Button clicked"); sqlScript.setValue(""); } }); clearQueryButton.addStyleName("small"); clearQueryButton.setIcon(DataGenConstant.CLEAR_SMALL); clearQueryButton.setDescription("Clears the Sql"); Button clearConsoleButton = new Button("Clear Console", new ClickListener() { @Override public void buttonClick(ClickEvent event) { log.info("ExecutorView - Clear Console Button clicked"); logText.setValue(""); } }); clearConsoleButton.addStyleName("small"); clearConsoleButton.setIcon(DataGenConstant.CLEAR_SMALL); clearConsoleButton.setDescription("Clears the Console"); maxRowsBox = new ComboBox(null, Arrays.asList(10, 100, 500, 1000, 5000, 10000)); maxRowsBox.setDescription("Max number of rows to retrieve"); maxRowsBox.setWidth(100, UNITS_PIXELS); maxRowsBox.setNewItemsAllowed(false); maxRowsBox.setNullSelectionAllowed(false); maxRowsBox.setValue(100); //Bottom section components resultSheet = new TabSheet(); resultSheet.setSizeFull(); resultSheet.addStyleName(Runo.TABSHEET_SMALL); logText = new Label(); logText.setContentMode(Label.CONTENT_XHTML); logText.setSizeFull(); //Panel to add refresher logPanel = new Panel(); logPanel.setSizeFull(); logPanel.setScrollable(true); logPanel.setStyleName(Runo.PANEL_LIGHT); logPanel.addComponent(logText); //Refresher added to show instant log messages refresher = new Refresher(); logPanel.addComponent(refresher); //Loading image loadingImg = new Embedded("", DataGenConstant.LOADING_ICON); loadingImg.setVisible(false); logPanel.addComponent(loadingImg); resultSheet.addTab(logPanel, "Console"); resultTab = resultSheet.addTab(new Label(), "Results"); queryOptions.addComponent(executeButton); queryOptions.setComponentAlignment(executeButton, Alignment.MIDDLE_LEFT); queryOptions.addComponent(clearQueryButton); queryOptions.setComponentAlignment(clearQueryButton, Alignment.MIDDLE_LEFT); queryOptions.addComponent(clearConsoleButton); queryOptions.setComponentAlignment(clearConsoleButton, Alignment.MIDDLE_LEFT); queryOptions.setExpandRatio(clearConsoleButton, 1); queryOptions.addComponent(maxRowsBox); queryOptions.setComponentAlignment(maxRowsBox, Alignment.MIDDLE_RIGHT); splitPanel.setFirstComponent(sqlScript); splitPanel.setSecondComponent(resultSheet); vl.addComponent(queryOptions); vl.addComponent(splitPanel); vl.setExpandRatio(splitPanel, 1); sqlScript.addShortcutListener(new ShortcutListener("Execute Script", null, ShortcutAction.KeyCode.ENTER, ShortcutAction.ModifierKey.CTRL) { @Override public void handleAction(Object sender, Object target) { executeScript(sqlScript.getValue().toString()); } }); log.debug("ExecutorView - constructor end"); }
From source file:com.etest.connection.ShowErrorNotification.java
public static void error(String error) { Label label = new Label(); label.setWidth("400px"); label.setValue(error);/*from ww w . j ava 2 s .c om*/ label.setContentMode(ContentMode.HTML); Notification.show(label.getValue(), Notification.Type.ERROR_MESSAGE); }
From source file:com.etest.pdfgenerator.TQCoveragePDF.java
public TQCoveragePDF(int tqCoverageId) { this.tqCoverageId = tqCoverageId; Document document = null;//w w w . ja v a 2 s . c om try { document = new Document(PageSize.A4, 50, 50, 50, 50); PdfWriter.getInstance(document, outputStream); document.open(); Font header1 = FontFactory.getFont("Times-Roman", 14, Font.BOLD); Font header2 = FontFactory.getFont("Times-Roman", 12, Font.BOLD); Font content = FontFactory.getFont("Times-Roman", 10); Image img = null; try { img = Image.getInstance("C:\\eTest-images\\SUCN_seal.png"); img.scaleToFit(60, 60); img.setAbsolutePosition(100, 720); } catch (BadElementException | IOException ex) { Logger.getLogger(TQCoveragePDF.class.getName()).log(Level.SEVERE, null, ex); } document.add(img); Paragraph title = new Paragraph(); title.setAlignment(Element.ALIGN_CENTER); title.add(new Phrase("COLLEGE OF NURSING", header2)); document.add(title); Paragraph school = new Paragraph(); school.setAlignment(Element.ALIGN_CENTER); school.add(new Phrase("Siliman University", header2)); document.add(school); Paragraph location = new Paragraph(); location.setSpacingAfter(10f); location.setAlignment(Element.ALIGN_CENTER); location.add(new Phrase("Dumaguete City", header2)); document.add(location); Paragraph examTitle = new Paragraph(); examTitle.setSpacingAfter(20f); examTitle.setAlignment(Element.ALIGN_CENTER); examTitle .add(new Phrase( cs.getCurriculumById(tq.getTQCoverageById(getTQCoverageId()).getCurriculumId()) .getSubject() + " " + tq.getTQCoverageById(getTQCoverageId()).getExamTitle(), header2)); document.add(examTitle); Paragraph instruction = new Paragraph(); instruction.setSpacingAfter(5f); instruction.setAlignment(Element.ALIGN_LEFT); instruction.add( new Phrase("INSTRUCTIONS: Read the cases carefully. Choose the letter of the correct answer. " + "Use an answer sheet and follow instruction for its use.", content)); document.add(instruction); int itemNo = 1; Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId()); for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) { Integer tqCaseId = tqCases.getKey(); Label caseTopic = new Label(); caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic()); caseTopic.setContentMode(ContentMode.HTML); document.add(new Paragraph(caseTopic.getValue().replaceAll("(?i)<p.*?>.*?</p>", ""), content)); 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; } Label 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); document.add(new Paragraph(stem.getValue(), content)); PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100); table.setSpacingBefore(10f); table.setSpacingAfter(10f); //Set Column widths float[] columnWidths = { 1f, 1f }; table.setWidths(columnWidths); PdfPCell cell1 = new PdfPCell( new Paragraph("A) " + cis.getCellItemById(itemId).getOptionA(), content)); // cell1.setBorderColor(BaseColor.BLUE); cell1.setBorder(0); cell1.setPaddingLeft(10); cell1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell1.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell2 = new PdfPCell( new Paragraph("C) " + cis.getCellItemById(itemId).getOptionC(), content)); // cell2.setBorderColor(BaseColor.GREEN); cell2.setBorder(0); cell2.setPaddingLeft(10); cell2.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell2.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell3 = new PdfPCell( new Paragraph("B) " + cis.getCellItemById(itemId).getOptionB(), content)); // cell3.setBorderColor(BaseColor.RED); cell3.setBorder(0); cell3.setPaddingLeft(10); cell3.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell4 = new PdfPCell( new Paragraph("D) " + cis.getCellItemById(itemId).getOptionD(), content)); // cell4.setBorderColor(BaseColor.RED); cell4.setBorder(0); cell4.setPaddingLeft(10); cell4.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell4.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); document.add(table); itemNo++; } } document.newPage(); Paragraph ticketNo = new Paragraph(); ticketNo.setSpacingAfter(30f); ticketNo.setAlignment(Element.ALIGN_LEFT); ticketNo.add(new Phrase("TQ Ticket #: " + tq.getTqCoverageTicketNo(getTQCoverageId()), content)); document.add(ticketNo); document.add(new Paragraph("Answer Key: ")); itemNo = 1; List<TQAnswerKey> answerKey = tq.getTQCoverageAnswerKey(getTQCoverageId()); for (TQAnswerKey t : answerKey) { document.add(new Paragraph( t.getItemNo() + ": " + cis.getOptionAnswer(t.getCellItemId()).get(t.getAnswer()))); } } catch (DocumentException ex) { Logger.getLogger(TQCoveragePDF.class.getName()).log(Level.SEVERE, null, ex); } finally { if (document != null) { document.close(); } } }
From source file:com.etest.view.notification.ViewCaseNotificationWindow.java
VerticalLayout buildForms() { VerticalLayout v = new VerticalLayout(); v.setWidth("700px"); v.setMargin(true);/*from www. ja v a 2 s. co 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; }