List of usage examples for com.vaadin.ui Label setStyleName
@Override public void setStyleName(String style)
From source file:com.invient.vaadin.InvientChartsDemoWin.java
License:Apache License
public InvientChartsDemoWin() { VerticalLayout mainLayout = new VerticalLayout(); setContent(mainLayout);/*from ww w . jav a 2 s. c o m*/ setSizeFull(); mainLayout.setSizeFull(); setCaption("Invient Charts"); HorizontalLayout infoBar = new HorizontalLayout(); mainLayout.addComponent(infoBar); infoBar.setHeight("50px"); infoBar.setWidth("100%"); Label lblAppTitle = new Label("Demo Gallery for Invient Charts"); lblAppTitle.setSizeFull(); lblAppTitle.setStyleName("v-label-app-title"); infoBar.addComponent(lblAppTitle); mainSplit = new HorizontalSplitPanel(); mainSplit.setSizeFull(); mainLayout.addComponent(mainSplit); mainLayout.setExpandRatio(mainSplit, 1); leftLayout = new VerticalLayout(); leftLayout.setSpacing(true); mainSplit.setFirstComponent(leftLayout); rightLayout = new VerticalLayout(); rightLayout.setSpacing(true); rightLayout.setMargin(true); mainSplit.setSecondComponent(rightLayout); mainSplit.setSplitPosition(200, Sizeable.UNITS_PIXELS); navTree = createChartsTree(); leftLayout.addComponent(navTree); eventLog.setReadOnly(true); eventLog.setStyleName("v-textarea-chart-events-log"); eventLog.setSizeFull(); eventLog.setHeight("200px"); setTheme("chartdemo"); }
From source file:com.kohmiho.mpsr.MPSRUI.java
private void initLayout() { setContent(splitPanel1);//from ww w . j a v a 2s.c o m VerticalLayout tableLayout = new VerticalLayout(); splitPanel1.setFirstComponent(tableLayout); splitPanel1.setSecondComponent(splitPanel2); splitPanel1.setSplitPosition(30); // percentage VerticalLayout treeLayout = new VerticalLayout(); splitPanel2.setFirstComponent(treeLayout); splitPanel2.setSecondComponent(welcomePage); splitPanel2.setSplitPosition(30); Label labelPrototype = new Label("Prototype"); labelPrototype.setStyleName("prototype2"); tree.setSizeFull(); treeLayout.addComponent(labelPrototype); treeLayout.addComponent(tree); treeLayout.setSizeFull(); treeLayout.setExpandRatio(tree, 1); // ***************************************************// HorizontalLayout tableLayoutTop = new HorizontalLayout(); tableLayout.addComponent(tableLayoutTop); tableLayoutTop.addComponent(pdflink); // tableLayoutTop.addComponent(wordLink); tableLayoutTop.addComponent(saveMPSRButton); tableLayoutTop.addComponent(removeMPSRButton); pdflink.setTargetName("_blank"); // wordLink.setTargetName("_blank"); tableLayout.addComponent(mpsrTable); HorizontalLayout bottomLeftLayout = new HorizontalLayout(); tableLayout.addComponent(bottomLeftLayout); bottomLeftLayout.addComponent(searchField); bottomLeftLayout.addComponent(addNewMPSRButton); tableLayout.setSizeFull(); tableLayout.setExpandRatio(mpsrTable, 1); tableLayoutTop.setWidth("100%"); mpsrTable.setSizeFull(); bottomLeftLayout.setWidth("100%"); searchField.setWidth("100%"); bottomLeftLayout.setExpandRatio(searchField, 1); }
From source file:com.liferay.mail.vaadin.MessageView.java
License:Open Source License
public void showMessage(Message msg) { if (msg == null) { messageLabel.setVisible(false);/*from w w w . jav a2s.co m*/ headersAndAttachmentLayout.setVisible(false); return; } else { messageLabel.setVisible(true); headersAndAttachmentLayout.setVisible(true); } // Body String text = ""; if (msg != null) { text = msg.getBody(); } messageLabel.setValue(text); // Headers headersLayout = new FormLayout(); headersLayout.setSpacing(false); headersLayout.setMargin(false); if (msg != null) { String to = msg.getTo(); String cc = msg.getCc(); // String replyTo = msg.get(); Label subject = new Label(msg.getSubject()); subject.setCaption(Lang.get("subject")); headersLayout.addComponent(subject); Label from = new Label(msg.getSender()); from.setCaption(Lang.get("from")); headersLayout.addComponent(from); if (to != null && !to.equals("")) { Label toLabel = new Label(to); toLabel.setCaption(Lang.get("to")); headersLayout.addComponent(toLabel); } if (cc != null && !cc.equals("")) { Label ccLabel = new Label(cc); ccLabel.setCaption(Lang.get("cc")); headersLayout.addComponent(ccLabel); } Label date = new Label(formatDate(msg.getSentDate())); date.setCaption(Lang.get("date")); headersLayout.addComponent(date); if (MessageUtil.isImportant(msg)) { Label flag = new Label(Lang.get("important")); flag.setStyleName(MessageList.STYLE_IMPORTANT); flag.setCaption(Lang.get("flag")); headersLayout.addComponent(flag); } } // Attachments try { headersAndAttachmentLayout.removeAllComponents(); headersAndAttachmentLayout.addComponent(headersLayout); Controller controller = Controller.get(); List<Attachment> attachments = AttachmentLocalServiceUtil.getAttachments(msg.getMessageId()); if (attachments != null && !attachments.isEmpty()) { for (Attachment attachment : attachments) { Button attachmentDownload = new Button(); attachmentDownload.setStyleName(BaseTheme.BUTTON_LINK); attachmentDownload.setCaption(attachment.getFileName() + " " + MessageUtil.formatSize(attachment.getSize(), controller.getUserLocale())); attachmentDownload.setData(attachment); attachmentDownload.addListener(this); headersAndAttachmentLayout.addComponent(attachmentDownload); } } } catch (SystemException e) { _log.debug(e); } }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.HourWidget.java
public HourWidget(int aHourNumber, int aTotalHourNumber) { setWidth("500px"); setHeight("500px"); //setStyleName("backColorGrey"); String[] classes = { "VI", "VII", "VIII", "IX", "X" }; int index1 = new Random().nextInt(classes.length); String selectedClass = (classes[index1]); String[] sections = { "A", "B", "C", "D", "E" }; int index2 = new Random().nextInt(classes.length); String selectedSection = (sections[index2]); String[] content = { "Gravitation", "Lab", "Electricity", "Force", "Motion" }; int index3 = new Random().nextInt(classes.length); String selectedContent = (content[index3]); //Button b= new Button("2"); //addComponent(b); //c.setSizeFull(); Button iMinorText = new Button(selectedContent); double redOrGreen = Math.random(); if (Math.random() > 0.5) { iMinorText.setStyleName("v-button-type1-red"); } else {//from w w w . ja v a 2s . com iMinorText.setStyleName("v-button-type1-green"); } iMinorText.setHeight("40px"); iMinorText.setWidth("125px"); //c.setCaptionAsHtml(true); kkk addComponent(iMinorText);//,"top:10px;left:10px"); Label iMajorText = new Label(selectedClass + " - " + selectedSection); iMajorText.setStyleName("v-label-type1"); iMajorText.setHeight("15px"); iMajorText.setWidth("50px"); addComponent(iMajorText, "top:2px;left:1px"); double numberOfMemos = Math.floor(Math.random() * 5); //Diplay if any memo present NativeButton memoButton; if (numberOfMemos > 0) { memoButton = new NativeButton();//String.valueOf(numberOfMemos).replace(".0", "")); memoButton.setStyleName("v-button-type2"); //memoButton.setHeight("15px"); //memoButton.setWidth("30px"); memoButton.setIcon(FontAwesome.PENCIL); addComponent(memoButton, "top:2px;left:85px"); } double numberOfNotifications = Math.floor(Math.random() * 5); NativeButton notificationButton; if (numberOfNotifications > 0) { notificationButton = new NativeButton();//String.valueOf(numberOfNotifications).replace(".0", "")); notificationButton.setStyleName("v-button-type2"); //notificationButton.setHeight("15px"); //notificationButton.setWidth("30px"); notificationButton.setIcon(FontAwesome.BELL); addComponent(notificationButton, "top:2px;left:100px"); } }
From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java
public PrimaryMasterPage() { //ContextWidget c= new ContextWidget(); HorizontalLayout iHorizontalLayout = new HorizontalLayout(); //addComponent(iHorizontalLayout,"top:0px;left:0px"); iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth())); iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight())); iHorizontalLayout.setStyleName("backColorBlack"); //String[] captions1 = {"Logo Here", "My Cool School", "Third"}; //Layout A and its sub components Panel AP = new Panel(); iHorizontalLayout.addComponent(AP);//www. jav a 2 s. c o m AP.setSizeFull(); AP.setStyleName("backColorBlack"); VerticalLayout A1 = new VerticalLayout(); AP.setContent(A1); //A.setSizeFull(); A1.setSpacing(true); iHorizontalLayout.setExpandRatio(AP, 1); A1.setStyleName("backColorBlack"); A1.setMargin(new MarginInfo(true, true, true, true)); Button logoImage = new Button(); logoImage.setIcon(FontAwesome.PICTURE_O); logoImage.setWidth("80px"); logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS); //logoImage.setWidth("100px"); A1.addComponent(logoImage); A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER); Label schoolName = new Label("The School Of Future"); schoolName.setStyleName("v-label-big"); A1.addComponent(schoolName); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); Label schoolMinorName = new Label("Random Branch"); schoolMinorName.setStyleName("v-label-small"); A1.addComponent(schoolMinorName); VerticalLayout A2 = new VerticalLayout(); A1.addComponent(A2); MainMenuWidget iMainMenuWidget = new MainMenuWidget(); A2.addComponent(iMainMenuWidget); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); //Layout B ContextWidgetTop c = new ContextWidgetTop(); c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP, SliderPanelStyles.COLOR_RED); VerticalLayout B = new VerticalLayout(); B.setSizeFull(); //B.setSpacing(true); iHorizontalLayout.addComponent(c); c.addComponent(B); iHorizontalLayout.setExpandRatio(c, 7); //Layout B1 and its sub Components HorizontalLayout B1 = new HorizontalLayout(); B.addComponent(B1); //B.setExpandRatio(B1, 1); //B1.setHeight("70px"); B1.setSizeFull(); //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED); HorizontalLayout B11 = new HorizontalLayout(); B1.addComponent(B11); B1.setStyleName("backColorBlack"); B11.setSizeFull(); B1.setHeight("45px"); //B1.setStyleName("backColorWhite"); //B1.setMargin(new MarginInfo(false, true, false, true)); TextField iTextField = new TextField(); iTextField.setWidth("200px"); iTextField.setInputPrompt("Search!"); iTextField.setStyleName("v-text-type-search"); iTextField.focus(); B11.addComponent(iTextField); B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT); //Layout B2 and its Sub Components ContextWidget B2 = new ContextWidget(); B2.setSizeFull(); B.addComponent(B2); B.setExpandRatio(B2, 10); B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT, SliderPanelStyles.COLOR_BLUE); //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED); VerticalLayout v = new VerticalLayout(); B2.addComponent(v); Button b1111 = new Button( "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this"); v.addComponent(b1111); Button b1112 = new Button("Put all the inner components like this"); v.addComponent(b1112); /* Panel p = new Panel(); VerticalLayout v= new VerticalLayout(); v.addComponent(new TextField("Name")); v.addComponent(new TextField("Street address")); v.addComponent(new TextField("Postal code")); p.setContent(v); B2.addComponent(p); v.setWidth(String.valueOf(B2.getWidth()*10)+"px"); //v.setSizeFull();// <- This will cause issues. Don't do this p.setSizeFull(); */ //ContextWidget iContextPanel= new ContextWidget(p); //B2.addComponent(iContextPanel); //setPosition(p, iComponentPositionPanel); addComponent(iHorizontalLayout); }
From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java
License:Open Source License
private VerticalLayout createSubstitutionSection(LspsUI ui, Person user) { VerticalLayout substitution = new VerticalLayout(); substitution.setSpacing(true);// w w w . ja va 2 s .co m Label substitutionHeader = new Label("<h2>" + ui.getMessage("settings.substitutionSection") + "</h2>", ContentMode.HTML); substitution.addComponent(substitutionHeader); Label substitutionHelp = new Label(ui.getMessage("settings.substitutionHelp")); substitutionHelp.setStyleName("form-help"); substitution.addComponent(substitutionHelp); this.substitutionActive = new CheckBox(ui.getMessage("settings.substitutionActive")); substitutionActive.addStyleName("ui-spacing"); substitutionActive.setValue(user.isSubstitutionActive()); substitution.addComponent(substitutionActive); //substitutes Set<Person> selectedPersons = user.getDirectSubstitutes(); //all persons except the user himself Collection<Person> persons = new ArrayList<Person>( personService.findPersons(new PersonCriteria()).getData()); this.substitutes = new OptionGroup(ui.getMessage("settings.substitutes")); substitutes.setMultiSelect(true); substitutes.addStyleName("ui-spacing"); for (Person substitute : persons) { if (!substitute.equals(user)) { substitutes.addItem(substitute); substitutes.setItemCaption(substitute, substitute.getFullName()); } } substitutes.setValue(selectedPersons); substitution.addComponent(substitutes); return substitution; }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoAnnotation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();/* w w w . ja va 2s.c om*/ setCaption(ui.getMessage("todo.annotationTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.annotationHelp")); help.setStyleName("form-help"); layout.addComponent(help); priorityField = new TextField(ui.getMessage("todo.priority"), priority); //TODO forbid negative priorities priorityField.setConverter(Integer.class); priorityField.setConversionError(ui.getMessage("app.invalidValueMessage")); priorityField.setNullRepresentation(""); priorityField.setNullSettingAllowed(true); layout.addComponent(priorityField); TextArea notesField = new TextArea(ui.getMessage("todo.notes"), notes); notesField.setMaxLength(1024); notesField.setNullRepresentation(""); priorityField.setNullSettingAllowed(true); notesField.setSizeFull(); layout.addComponent(notesField); layout.setExpandRatio(notesField, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button submitButton = new Button(ui.getMessage("action.annotate"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { annotate(); } }); buttons.addComponent(submitButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoDelegation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();//from w w w. j av a2 s . c o m setCaption(ui.getMessage("todo.delegationTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.delegationHelp")); help.setStyleName("form-help"); layout.addComponent(help); Collection<Person> allUsers = new ArrayList<Person>( personService.findPersons(new PersonCriteria()).getData()); Set<Person> substitutes = ui.getUser().getPerson().getDirectSubstitutes(); Set<String> substitutesIds = new HashSet<String>(); for (Person p : substitutes) { substitutesIds.add(p.getId()); } delegates = new OptionGroup(ui.getMessage("todo.delegates")); delegates.setMultiSelect(true); delegates.addStyleName("ui-spacing"); delegates.setRequired(true); delegates.setSizeFull(); for (Person p : allUsers) { delegates.addItem(p.getId()); delegates.setItemCaption(p.getId(), p.getFullName()); } delegates.setValue(substitutesIds); layout.addComponent(delegates); layout.setExpandRatio(delegates, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button delegateButton = new Button(ui.getMessage("action.delegate"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { delegate(); } }); buttons.addComponent(delegateButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoEscalation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();// www . j av a 2s .c o m setCaption(ui.getMessage("todo.escalationTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.escalationHelp")); help.setStyleName("form-help"); layout.addComponent(help); reason = new TextArea(ui.getMessage("todo.escalationReason")); reason.setMaxLength(1024); reason.setRequired(true); reason.setSizeFull(); layout.addComponent(reason); layout.setExpandRatio(reason, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button submitButton = new Button(ui.getMessage("action.escalate"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { escalate(); } }); buttons.addComponent(submitButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoRejection.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();/* ww w .j a va2 s . c om*/ setCaption(ui.getMessage("todo.rejectionTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.rejectionHelp")); help.setStyleName("form-help"); layout.addComponent(help); reason = new TextArea(ui.getMessage("todo.rejectionReason")); reason.setMaxLength(1024); reason.setRequired(true); reason.setSizeFull(); layout.addComponent(reason); layout.setExpandRatio(reason, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button rejectButton = new Button(ui.getMessage("action.reject"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { reject(); } }); buttons.addComponent(rejectButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }