List of usage examples for com.vaadin.ui Label setStyleName
@Override public void setStyleName(String style)
From source file:com.etest.view.testbank.CellCaseMainUI.java
Table populateDataTable() { table.removeAllItems();/*from ww w. j a v a 2 s . co m*/ int i = 0; for (CellCase cc : ccs.getCellCaseByTopic(getSyllabusId())) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button edit = new Button("modify"); edit.setSizeFull(); edit.setData(cc.getCellCaseId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName(ValoTheme.BUTTON_QUIET); edit.addStyleName("button-container"); edit.addClickListener(modifyBtnClickListener); v.addComponent(edit); v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT); Button approve = new Button("status"); approve.setSizeFull(); approve.setData(cc.getCellCaseId()); 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 (cc.getApprovalStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); } else { approve.setIcon(FontAwesome.THUMBS_UP); } Button stem = new Button("stems"); stem.setSizeFull(); stem.setData(cc.getCellCaseId()); stem.setIcon(FontAwesome.BRIEFCASE); stem.addStyleName(ValoTheme.BUTTON_LINK); stem.addStyleName(ValoTheme.BUTTON_TINY); stem.addStyleName(ValoTheme.BUTTON_QUIET); stem.addStyleName("button-container"); stem.addClickListener(stemBtnClickListener); v.addComponent(stem); v.setComponentAlignment(stem, Alignment.MIDDLE_LEFT); Label label = new Label(cc.getCaseTopic(), ContentMode.HTML); label.setStyleName("label-padding"); table.addItem(new Object[] { cc.getCellCaseId(), label, cc.getUsername_(), cc.getDateCreated(), v }, i); i++; } table.setPageLength(table.size()); return table; }
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.CellCaseItemWindow.java
Table populateDataTable() { table.removeAllItems();// ww w .j a va2 s. c o m int i = 0; for (CellItem ci : cis.getCellItemByCase(getCellCaseId())) { VerticalLayout v = new VerticalLayout(); v.setSizeFull(); Button edit = new Button("modify"); edit.setWidth("100%"); edit.setData(ci.getCellItemId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName(ValoTheme.BUTTON_QUIET); edit.addClickListener(modifyBtnClickListener); v.addComponent(edit); v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT); Button approve = new Button("status"); approve.setWidth("100%"); approve.setData(ci.getCellItemId()); approve.addStyleName(ValoTheme.BUTTON_LINK); approve.addStyleName(ValoTheme.BUTTON_TINY); approve.addStyleName(ValoTheme.BUTTON_QUIET); v.addComponent(approve); v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT); Button view = new Button("view"); view.setWidth("100%"); view.setData(ci.getCellItemId()); view.setIcon(FontAwesome.PLAY_CIRCLE); view.addStyleName(ValoTheme.BUTTON_LINK); view.addStyleName(ValoTheme.BUTTON_TINY); view.addStyleName(ValoTheme.BUTTON_QUIET); view.addClickListener(modifyBtnClickListener); v.addComponent(view); v.setComponentAlignment(view, Alignment.MIDDLE_LEFT); if (ci.getApproveItemStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); } else { approve.setIcon(FontAwesome.THUMBS_UP); } Label label = new Label(ci.getItem()); label.setStyleName("label-padding"); table.addItem(new Object[] { ci.getCellItemId(), label, v }, i); i++; } table.setPageLength(table.size()); return table; }
From source file:com.etest.view.tq.reports.OnlineQueriesUI.java
public OnlineQueriesUI() { setWidth("100%"); setMargin(true);/*from www . ja v a2 s. c o 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.reports.ReportGeneratorUI.java
public ReportGeneratorUI() { setWidth("100%"); setMargin(true);/* w w w .j a va 2 s.com*/ 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"); Label lineSeparator3 = new Label(); lineSeparator3.setContentMode(ContentMode.HTML); lineSeparator3.setStyleName("line-separator"); searchSubject1.addValueChangeListener(dropDownChangeListener); searchSubject1.setEnabled(false); searchApproveTq1.setWidth("100%"); searchApproveTq1.setInputPrompt("Search Approved TQ"); searchApproveTq1.setEnabled(false); searchApproveTq1.addStyleName(ValoTheme.COMBOBOX_SMALL); searchSubject2.addValueChangeListener(dropDownChangeListener); searchSubject2.setEnabled(false); searchApproveTq2.setWidth("100%"); searchApproveTq2.setInputPrompt("Search TQ Ticket No."); searchApproveTq2.setEnabled(false); searchApproveTq2.addStyleName(ValoTheme.COMBOBOX_SMALL); GridLayout g1 = new GridLayout(3, 1); g1.setWidth("70%"); g1.setSpacing(true); VerticalLayout v1 = new VerticalLayout(); v1.setWidth("5px"); reportType1.addItem("Test Questionnaire"); reportType1.setWidth("200px"); reportType1.addValueChangeListener(optionChangeListener); reportType1.setImmediate(true); v1.addComponent(reportType1); v1.setExpandRatio(reportType1, 1); g1.addComponent(v1, 0, 0); g1.addComponent(searchSubject1, 1, 0); g1.addComponent(searchApproveTq1, 2, 0); addComponent(g1); addComponent(lineSeparator1); GridLayout g2 = new GridLayout(3, 1); g2.setWidth("70%"); g2.setSpacing(true); VerticalLayout v2 = new VerticalLayout(); v2.setWidth("5px"); reportType2.addItem("Item Analysis"); reportType2.setWidth("200px"); reportType2.addValueChangeListener(optionChangeListener); reportType2.setImmediate(true); v2.addComponent(reportType2); v2.setExpandRatio(reportType2, 1); g2.addComponent(v2, 0, 0); g2.addComponent(searchSubject2, 1, 0); g2.addComponent(searchApproveTq2, 2, 0); addComponent(g2); addComponent(lineSeparator2); GridLayout g3 = new GridLayout(3, 1); g3.setWidth("70%"); g3.setSpacing(true); VerticalLayout v3 = new VerticalLayout(); v3.setWidth("5px"); reportType3.addItem("Test Bank Inventory"); reportType3.setWidth("200px"); reportType3.addValueChangeListener(optionChangeListener); reportType3.setImmediate(true); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setSpacing(true); testBankInventory.addItem("Summary: Case vs Items"); testBankInventory.addItem("Summary: Items Group according to the Revised Blooms Taxonomy"); testBankInventory.setImmediate(true); testBankInventory.select("Summary: Case vs Items"); testBankInventory.setEnabled(false); v.addComponent(testBankInventory); v3.addComponent(reportType3); v3.setExpandRatio(reportType3, 1); g3.addComponent(v3, 0, 0); g3.setComponentAlignment(v3, Alignment.TOP_LEFT); g3.addComponent(v, 1, 0); addComponent(g3); // addComponent(new Label("<HR>", ContentMode.HTML)); addComponent(lineSeparator3); Button button = new Button("Calculate & Generate"); button.addClickListener(reportBtnClickListener); button.setWidth("300px"); addComponent(button); setComponentAlignment(button, Alignment.MIDDLE_LEFT); }
From source file:com.foc.vaadin.FocWebVaadinWindow.java
License:Apache License
public Label newMidleTitleLabel(String companyName) { Label companyNameLabel = new Label(companyName); companyNameLabel.setStyleName("focBannerButton"); if (!Globals.isValo() || ConfigInfo.isGuiRTL()) { companyNameLabel.addStyleName("foc-f16"); }//from w ww . j a va 2s .c o m companyNameLabel.addStyleName("foc-bold"); companyNameLabel.addStyleName("foc-text-center"); companyNameLabel.addStyleName("foc-text-middle"); companyNameLabel.addStyleName("foc-CompanyTitle"); return companyNameLabel; }
From source file:com.foo01.ui.ReservationDetailView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setStyleName("buttonToolBarLayout"); buttonsLayout.setWidth("100%"); Button deleteButton = new Button(); deleteButton.setCaption("SMAZAT"); deleteButton.setWidth(null);//from w w w . java 2s . co m buttonsLayout.addComponent(deleteButton); Label plug = new Label(); buttonsLayout.addComponent(plug); Button saveButton = new Button(); saveButton.setCaption("ULOIT"); saveButton.setWidth(null); buttonsLayout.addComponent(saveButton); buttonsLayout.setExpandRatio(plug, 1.0f); List<Source> sourcesList = MockSource.mockSources(); //combobox na zdroje a jmeno uzivatele HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.setStyleName(width); content.addComponent(buttonsLayout); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.foo01.ui.ReservationView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem // HorizontalLayout buttonsLayout = new HorizontalLayout(); // buttonsLayout.setStyleName("buttonToolBarLayout"); // buttonsLayout.setWidth("100%"); ////w ww . j a v a 2 s. co m // Button deleteButton = new Button(); // deleteButton.setCaption("SMAZAT"); // deleteButton.setWidth(null); // buttonsLayout.addComponent(deleteButton); // // Label plug = new Label(); // buttonsLayout.addComponent(plug); // // Button saveButton = new Button(); // saveButton.setCaption("ULOIT"); // saveButton.setWidth(null); // buttonsLayout.addComponent(saveButton); // buttonsLayout.setExpandRatio(plug, 1.0f); //combobox na zdroje a jmeno uzivatele List<Source> sourcesList = MockSource.mockSources(); HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.addComponent(new ButtonToolBarLayout(this)); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.freebox.engeneering.application.web.layout.FooterController.java
License:Apache License
/** * Loads data into the form while entering 'loadData' state. * * @param stateEvent the state event./*ww w . ja v a2s . c o m*/ */ @OnEnterState(EventConstants.LOAD_DATA) public void buildFooterView(StateEvent stateEvent) { clearView(stateEvent); final Label htmlLabel = new Label( "© " + Calendar.getInstance().get(Calendar.YEAR) + " Lexaden.com All rights reserved", ContentMode.HTML); htmlLabel.setStyleName(Reindeer.LABEL_SMALL); htmlLabel.setSizeUndefined(); final VerticalLayout view = getView(); view.addComponent(htmlLabel); view.setComponentAlignment(htmlLabel, Alignment.MIDDLE_CENTER); view.setMargin(new MarginInfo(false, false, true, false)); }
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
private void buildNotifications(Button.ClickEvent event) { VerticalLayout l = new VerticalLayout(); l.setMargin(true);/*from w w w.ja v a 2 s . c o m*/ l.setSpacing(true); notifications.setContent(l); notifications.setWidth("1000px"); notifications.setHeight("500px"); notifications.addStyleName("notifications"); notifications.setClosable(false); notifications.setResizable(true); notifications.setDraggable(false); notifications.setPositionX(event.getClientX() - event.getRelativeX() - 40); /* magic number used to adjust right edge of window so that it draws within the browser window. This number is related to css values in dashboard.scss and relative positioning of the bell icon in topLayout */ notifications.setPositionY(event.getClientY() - event.getRelativeY()); notifications.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null); synchronized (scriptErrorsLock) { log.debug("checking for new policy errors {}", scriptErrors.size()); Label messageLabel; if (scriptErrors.size() > 0) { for (String absolutePath : scriptErrors.keySet()) { Throwable scriptException = scriptErrors.get(absolutePath); String message = scriptException.getMessage(); if (message != null) { String formattedMessage = MessageHelper.scrubMessage(message); messageLabel = new Label("<hr>" + formattedMessage, ContentMode.HTML); } else { StringWriter errors = new StringWriter(); scriptException.printStackTrace(new PrintWriter(errors)); String stackTrace = errors.toString(); stackTrace = MessageHelper.scrubMessage(stackTrace); messageLabel = new Label("<hr>" + stackTrace, ContentMode.HTML); } messageLabel.setStyleName(Runo.LABEL_SMALL); l.addComponent(messageLabel); } } else { messageLabel = new Label("<hr>none<br>", ContentMode.HTML); messageLabel.setStyleName(Runo.LABEL_SMALL); l.addComponent(messageLabel); } } }