List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:com.github.tempora.view.MainView.java
License:Apache License
public MainView() { VerticalLayout vlayout = new VerticalLayout(); vlayout.addStyleName("outlined"); vlayout.addStyleName("bg"); vlayout.setSizeFull();/*from www .j av a 2 s .c o m*/ vlayout.setMargin(true); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.addStyleName("outlined"); hlayout.setSizeFull(); setContent(vlayout); // Title Label caption = new Label("Tempora"); caption.setStyleName("logo-label", true); caption.setWidth(null); vlayout.addComponent(caption); vlayout.setExpandRatio(caption, 0.2f); vlayout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER); vlayout.addComponent(hlayout); vlayout.setExpandRatio(hlayout, 0.7f); // // General information about the User's mailbox // final Panel generalInfoPanel = new Panel("<center>General Information</center>"); generalInfoPanel.addStyleName("frame-bg-general-info"); generalInfoPanel.setSizeFull(); this.currentHistoryId = new Label("0"); currentHistoryId.setStyleName("general-info-count", true); currentHistoryId.setCaption("History ID"); this.messagesTotal = new Label("0"); messagesTotal.setStyleName("general-info-count", true); messagesTotal.setCaption("Messages Total"); this.threadsTotal = new Label("0"); threadsTotal.setCaption("Threads Total"); threadsTotal.setStyleName("general-info-count", true); FormLayout mailboxInfoLayout = new FormLayout(messagesTotal, currentHistoryId, threadsTotal); VerticalLayout mailboxInfoMainLayout = new VerticalLayout(mailboxInfoLayout); mailboxInfoMainLayout.setSizeFull(); mailboxInfoMainLayout.setMargin(true); generalInfoPanel.setContent(mailboxInfoMainLayout); // // Stats // final Panel statsPanel = new Panel("<center>Statistics</center>"); statsPanel.addStyleName("frame-bg-stats"); statsPanel.setSizeFull(); this.bodyAvgSize = new Label("0"); bodyAvgSize.setCaption("Body Avg. Size"); bodyAvgSize.setStyleName("stats-count", true); FormLayout statsLayout = new FormLayout(bodyAvgSize); VerticalLayout statsMainLayout = new VerticalLayout(statsLayout); statsMainLayout.setSizeFull(); statsMainLayout.setMargin(true); statsPanel.setContent(statsMainLayout); // // Top 5 // Panel top5Panel = new Panel("<center>Top 5</center>"); top5Panel.addStyleName("frame-bg-top5"); // Top 5 Senders Panel top5SendersPanel = new Panel("<center>Senders</center>"); top5SendersPanel.addStyleName("frame-bg-top5"); top5SendersPanel.setSizeFull(); this.top5Senders = new Label("NO DATA", ContentMode.PREFORMATTED); top5Senders.setSizeUndefined(); top5SendersPanel.setContent(top5Senders); // Top 5 Title Tags Panel top5TitleTagsPanel = new Panel("<center>Title Tags</center>"); top5TitleTagsPanel.addStyleName("frame-bg-top5"); top5TitleTagsPanel.setSizeFull(); this.top5TitleTags = new Label("NO DATA", ContentMode.PREFORMATTED); top5TitleTags.setSizeUndefined(); top5TitleTagsPanel.setContent(top5TitleTags); top5Panel.setSizeFull(); VerticalLayout top5MainLayout = new VerticalLayout(top5SendersPanel, top5TitleTagsPanel); top5MainLayout.setMargin(true); top5MainLayout.setSpacing(true); top5MainLayout.setSizeFull(); top5MainLayout.setComponentAlignment(top5SendersPanel, Alignment.MIDDLE_CENTER); top5MainLayout.setComponentAlignment(top5TitleTagsPanel, Alignment.MIDDLE_CENTER); top5Panel.setContent(top5MainLayout); hlayout.setSpacing(true); hlayout.addComponent(generalInfoPanel); hlayout.addComponent(statsPanel); hlayout.addComponent(top5Panel); this.currentUserEmail = new Label("-"); currentUserEmail.setCaption("Email"); Button reloadButton = new Button("\u27F3 Reload"); reloadButton.addClickListener(e -> { getSession().getSession().invalidate(); getUI().getPage().reload(); }); HorizontalLayout infoHLayout = new HorizontalLayout(); infoHLayout.addStyleName("outlined"); infoHLayout.setSizeFull(); infoHLayout.setSpacing(true); infoHLayout.setMargin(true); infoHLayout.addComponent(reloadButton); reloadButton.setWidth(null); infoHLayout.setComponentAlignment(reloadButton, Alignment.BOTTOM_LEFT); infoHLayout.addComponent(currentUserEmail); currentUserEmail.setWidth(null); infoHLayout.setComponentAlignment(currentUserEmail, Alignment.BOTTOM_RIGHT); vlayout.addComponent(infoHLayout); vlayout.setExpandRatio(infoHLayout, 0.5f); }
From source file:com.hack23.cia.web.impl.ui.application.views.common.formfactory.impl.FormFactoryImpl.java
License:Apache License
@Override public <T extends Serializable> void addRequestInputFormFields(final FormLayout panelContent, final BeanItem<T> item, final Class<T> beanType, final List<String> displayProperties, final String buttonLabel, final ClickListener buttonListener) { final BeanFieldGroup<T> fieldGroup = new BeanFieldGroup<>(beanType); fieldGroup.setItemDataSource(item);// w w w.j av a 2 s . co m fieldGroup.setReadOnly(true); for (final String property : displayProperties) { final Field<?> buildAndBind; if (property.contains(HIDDEN_FIELD_NAME)) { buildAndBind = fieldGroup.buildAndBind(property, property, PasswordField.class); } else { buildAndBind = fieldGroup.buildAndBind(property); } buildAndBind.setId(MessageFormat.format("{0}.{1}", buttonLabel, property)); buildAndBind.setReadOnly(false); buildAndBind.setWidth(ContentSize.HALF_SIZE); panelContent.addComponent(buildAndBind); } final Collection<Object> unboundPropertyIds = fieldGroup.getUnboundPropertyIds(); for (final Object property : unboundPropertyIds) { LOGGER.debug(LOG_MSG_PROPERTY, property); } final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth("50%"); final Button button = new Button(buttonLabel, new CommitFormWrapperClickListener(fieldGroup, buttonListener)); button.setId(buttonLabel); button.setWidth("25%"); button.setIcon(FontAwesome.PAW); verticalLayout.addComponent(button); verticalLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT); panelContent.addComponent(verticalLayout); }
From source file:com.hris.payroll.thirteenthmonth.ThirteenthMonth.java
private Button generate13thMonth() { Button button = new Button("13th MONTH"); button.setWidth("200px"); button.setIcon(FontAwesome.SPINNER); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { status.setValue(" Loading..."); current = 1.0;/* w w w. j a va2s. co m*/ dataSize = es.findEmployeeByBranch(getBranchId(), employmentStatus.getValue().toString(), CommonUtil.convertStringToInteger(year.getValue().toString())).size(); populateDataGrid(); }); return button; }
From source file:com.hybridbpm.ui.component.chart.color.GaugeBandLayout.java
License:Apache License
public GaugeBandLayout(final BeanFieldGroup<DiagrammePreference> preferences) { super(preferences); setCaption("Gauge Band Colors"); setSizeFull();//from ww w. ja v a 2 s . c om setSpacing(true); setMargin(false); addBandButton.setIcon(FontAwesome.PLUS); addBandButton.setStyleName(ValoTheme.BUTTON_BORDERLESS); addBandButton.addStyleName(ValoTheme.BUTTON_SMALL); bandAdditionButtonFrame.setSpacing(true); bandAdditionButtonFrame.addComponent(addBandButton); bandAdditionButtonFrame.setComponentAlignment(addBandButton, Alignment.MIDDLE_RIGHT); addComponent(bandAdditionButtonFrame); addBandButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addBand(); } }); colorTable.setHeight("100%"); colorTable.setWidth("100%"); colorTable.addStyleName(ValoTheme.TABLE_COMPACT); colorTable.addStyleName(ValoTheme.TABLE_SMALL); colorTable.addStyleName("color-table"); colorTable.addContainerProperty(Translate.getMessage("colour"), ColorPicker.class, null); colorTable.addContainerProperty(Translate.getMessage("start"), TextField.class, null); colorTable.addContainerProperty(Translate.getMessage("end"), TextField.class, null); colorTable.addContainerProperty("remove", Button.class, null); // COLOR COLUMN colorTable.addGeneratedColumn(Translate.getMessage("colour"), new Table.ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { final Property<String> colorProp = tableContainer.getItem(itemId).getItemProperty("color"); int[] col = ColourUtil.decode(colorProp.getValue()); ColorPicker picker = new ColorPicker(); picker.addStyleName("diagramme"); picker.setPosition(Page.getCurrent().getBrowserWindowWidth() / 2 - 246 / 2, Page.getCurrent().getBrowserWindowHeight() / 2 - 507 / 2); picker.setColor(new com.vaadin.shared.ui.colorpicker.Color(col[0], col[1], col[2])); picker.addColorChangeListener(new ColorChangeListener() { @Override public void colorChanged(ColorChangeEvent event) { colorProp.setValue(event.getColor().getCSS()); updateDiagramme(); } }); picker.setWidth("25px"); return picker; } }); // BAND START COLUMN colorTable.addGeneratedColumn(Translate.getMessage("start"), new Table.ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { final Property<Double> startProp = tableContainer.getContainerProperty(itemId, "startValue"); final ObjectProperty<Double> startValue = new ObjectProperty<Double>(0.0); TextField startField = new TextField(startValue); //startField.setWidth("60px"); startField.setSizeFull(); startField.setNullRepresentation("0"); startField.addStyleName("tfwb"); startField.setConvertedValue(startProp.getValue()); startField.setImmediate(true); startValue.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { startProp.setValue((Double) event.getProperty().getValue()); updateDiagramme(); } }); return startField; } }); // BAND END COLUMN colorTable.addGeneratedColumn(Translate.getMessage("end"), new Table.ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { final Property<Double> endProp = tableContainer.getContainerProperty(itemId, "endValue"); final ObjectProperty<Double> endValue = new ObjectProperty<Double>(0.0); TextField endField = new TextField(endValue); //endField.setWidth("60px"); endField.setSizeFull(); endField.setNullRepresentation("0"); endField.addStyleName("tfwb"); endField.setConvertedValue(endProp.getValue()); endField.setImmediate(true); endValue.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { endProp.setValue((Double) valueChangeEvent.getProperty().getValue()); updateDiagramme(); } }); return endField; } }); // DELETE BAND COLUMN colorTable.addGeneratedColumn("remove", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { Button delete = new Button(FontAwesome.TIMES); delete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { removeBand(itemId); } }); delete.setWidth("43px"); return delete; } }); colorTable.setColumnWidth(Translate.getMessage("colour"), 33); colorTable.setColumnWidth("remove", 48); colorTable.setColumnExpandRatio(Translate.getMessage("start"), 0.5f); colorTable.setColumnExpandRatio(Translate.getMessage("end"), 0.5f); colorTable.setSortEnabled(false); colorTable.setPageLength(0); colorTable.setEditable(true); colorTable.setImmediate(true); addComponent(colorTable); setExpandRatio(colorTable, 1f); setComponentAlignment(colorTable, Alignment.TOP_LEFT); }
From source file:com.invient.vaadin.InvientChartsDemoWin.java
License:Apache License
private void showChartInstancesForSeriesType(final String demoSeriesTypeName) { rightLayout.removeAllComponents();//from w ww .j a v a 2 s. co m List<ChartName> demoCharts = getDemoCharts(getDemoSeriesType(demoSeriesTypeName)); for (ChartName chartName : demoCharts) { Button btn = null; rightLayout.addComponent(btn = new Button(chartName.getName(), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { navTree.select(demoSeriesTypeName + SEPARATOR + event.getButton().getCaption()); } })); btn.setWidth("200px"); } }
From source file:com.liferay.mail.vaadin.Folders.java
License:Open Source License
private Button createComposeButton() { Button compose = new NativeButton("Compose new message"); compose.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Controller.get().getApplication().switchToCompose(new Composer(), null); }/*from w ww .j ava 2s. c o m*/ }); compose.setStyleName("compose"); compose.setWidth("100%"); return compose; }
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 . java 2 s . c o m*/ 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.MyAppWidgetSet.core.UserDetailsWidget.java
public UserDetailsWidget() { HorizontalLayout h = new HorizontalLayout(); addComponent(h);/*from w ww. jav a 2s .co m*/ h.setSizeFull(); //h.setSpacing(true); Button userPhoto = new Button(); userPhoto.setIcon(FontAwesome.USER); userPhoto.setHeight("100px"); userPhoto.setWidth("100px"); h.addComponent(userPhoto); //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT); VerticalLayout v = new VerticalLayout(); //v.setStyleName("backColorBlack"); h.addComponent(v); v.setStyleName("v-layout-padding-left"); //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT); v.setHeight("106px"); v.setWidth("100px"); // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); Button editProfile = new Button("Profile"); editProfile.setStyleName("v-button-type3"); editProfile.setIcon(FontAwesome.USER); editProfile.setWidth("100px"); editProfile.setWidth("102px"); v.addComponent(editProfile); //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT); Button settings = new Button("Settings"); settings.setStyleName("v-button-type3"); settings.setIcon(FontAwesome.WRENCH); settings.setWidth("100px"); settings.setWidth("102px"); v.addComponent(settings); //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT); Button logOut = new Button("Log Out"); logOut.setStyleName("v-button-type3"); logOut.setIcon(FontAwesome.KEY); logOut.setWidth("100px"); logOut.setWidth("102px"); v.addComponent(logOut); //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT); //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.MenuWidget.java
public MenuWidget(String Width) { Panel iPanel = new Panel(); iPanel.setWidth(Width);/*from www .ja va2 s . com*/ iPanel.setStyleName("backColorWhite"); addComponent(iPanel); VerticalLayout iVerticalLayout = new VerticalLayout(); for (int i = 1; i <= 8; i++) { Button iButton = new Button(); iButton.setWidth(Width); iButton.setHeight("50px"); iVerticalLayout.addComponent(iButton); } iPanel.setContent(iVerticalLayout); }
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);//from w w w . j av a2 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); }