List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:com.mycollab.vaadin.web.ui.StyleCalendarExp.java
License:Open Source License
public StyleCalendarExp() { this.setWidth("230px"); this.setHeightUndefined(); this.setSpacing(false); this.setStyleName("stylecalendar-ext"); this.setMargin(new MarginInfo(true, false, false, false)); styleCalendar.setRenderHeader(false); styleCalendar.setRenderWeekNumbers(false); styleCalendar.setImmediate(true);/* w ww .ja v a 2 s . c o m*/ styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_next.png"))); btnShowNextYear.setStyleName(WebThemes.BUTTON_LINK); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_next.png"))); btnShowNextMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_pre.png"))); btnShowPreviousMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_pre.png"))); btnShowPreviousYear.setStyleName(WebThemes.BUTTON_LINK); lbSelectedDate.setValue(UserUIContext.formatDate(new Date())); lbSelectedDate.addStyleName("calendarDateLabel"); lbSelectedDate.setWidth("80"); HorizontalLayout layoutControl = new HorizontalLayout(); layoutControl.setStyleName("calendarHeader"); layoutControl.setWidth("100%"); layoutControl.setHeight("35px"); HorizontalLayout layoutButtonPrevious = new HorizontalLayout(); layoutButtonPrevious.setSpacing(true); layoutButtonPrevious.addComponent(btnShowPreviousYear); layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT); layoutButtonPrevious.addComponent(btnShowPreviousMonth); layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT); layoutControl.addComponent(layoutButtonPrevious); layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT); layoutControl.addComponent(lbSelectedDate); layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER); MHorizontalLayout layoutButtonNext = new MHorizontalLayout(); layoutButtonNext.addComponent(btnShowNextMonth); layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT); layoutButtonNext.addComponent(btnShowNextYear); layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT); layoutControl.addComponent(layoutButtonNext); layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT); this.addComponent(layoutControl); this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER); this.addComponent(styleCalendar); this.setExpandRatio(styleCalendar, 1.0f); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createCenterPiece() { HorizontalLayout centerpieceLayout = new HorizontalLayout(); centerpieceLayout.setWidth("100%"); centerpieceLayout.setSpacing(true);/*w w w . j a v a 2 s. com*/ VerticalLayout centerpieceSettings = new VerticalLayout(); centerpieceSettings.setWidth("100%"); centerpieceSettings.setSpacing(true); Field richTextField = listener.createRichTextField(); richTextField.setCaption("Teaser"); richTextField.setWidth("100%"); richTextField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { try { articleItem.removeItemProperty("siteAlert"); articleItem.addItemProperty("siteAlert", DefaultPropertyUtil.newDefaultProperty(String.class, event.getProperty().getValue().toString())); articleItem.applyChanges(); } catch (RepositoryException e) { e.printStackTrace(); } } }); centerpieceSettings.addComponent(richTextField); Label placementLabel = new Label("", ContentMode.HTML); placementLabel.setCaption("Placement"); centerpieceSettings.addComponent(placementLabel); CheckBox home = listener.createCheckBox("Home Page"); centerpieceSettings.addComponent(home); CheckBox news = listener.createCheckBox("News Landing"); centerpieceSettings.addComponent(news); CheckBox comm = listener.createCheckBox("Community Landing"); centerpieceSettings.addComponent(comm); CheckBox team = listener.createCheckBox("Team Landing"); centerpieceSettings.addComponent(team); CheckBox cheer = listener.createCheckBox("Cheerleader Landing"); centerpieceSettings.addComponent(cheer); centerpieceLayout.addComponent(centerpieceSettings); Label previewLabel = new Label("", ContentMode.HTML); previewLabel.setCaption("Centerpiece preview"); centerpieceLayout.addComponent(previewLabel); centerPiece.setContent(centerpieceLayout); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createAlert() { VerticalLayout alertTextLayout = new VerticalLayout(); alertTextLayout.setSpacing(true);//w w w . ja v a 2s . c o m alertTextLayout.setCaption("Alert Text"); MagnoliaRichTextField textField = (MagnoliaRichTextField) listener.createRichTextField(); textField.setSizeFull(); HorizontalLayout periodLayout = new HorizontalLayout(); periodLayout.setSpacing(true); // periodLayout.setWidth("100%"); DateField startDate = new DateField(); // startDate.setWidth("100%"); DateField endDate = new DateField(); // endDate.setWidth("100%"); periodLayout.addComponent(new Label("START")); periodLayout.addComponent(startDate); periodLayout.addComponent(new Label("END")); periodLayout.addComponent(endDate); alertTextLayout.addComponent(textField); alertTextLayout.addComponent(periodLayout); HorizontalLayout alertLayout = new HorizontalLayout(); alertLayout.setSpacing(true); alertLayout.setWidth("100%"); alertLayout.addComponent(alertTextLayout); final Label alertPreview = new Label("", ContentMode.HTML); alertPreview.setCaption("Alert Preview"); alertPreview.addStyleName("preview-label"); textField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { alertPreview.setValue(String.valueOf(event.getProperty().getValue())); } }); alertPreview.setSizeUndefined(); alertLayout.addComponent(alertPreview); alert.setContent(alertLayout); textField.setValue( "<b>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</b>"); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.umbrellacontent.UmbrellaContentPreview.java
License:Open Source License
public UmbrellaContentPreview() { titleLabel.setCaption("TITLE"); authorLabel.setCaption("AUTHOR"); seriesLabel.setCaption("SERIES"); setSizeFull();//w w w . j a v a 2s .c o m addComponent(titleLabel); HorizontalLayout authorAndSeries = new HorizontalLayout(); authorAndSeries.setWidth("100%"); authorAndSeries.addComponent(authorLabel); authorAndSeries.addComponent(seriesLabel); addComponent(authorAndSeries); setMargin(true); setSpacing(true); }
From source file:com.oodrive.nuage.webui.component.VvrOperationComponent.java
License:Apache License
@Override public final AbstractComponent createComponent(final VvrModel model, final ModelCreator handler) { final HorizontalLayout operationLayout = new HorizontalLayout(); operationLayout.setMargin(true);/*from w ww . ja va 2s. c om*/ operationLayout.setSpacing(true); operationLayout.setWidth("100%"); // Start and description buttons // START/STOP final Button startStop = new Button(); startStop.setWidth(BUTTON_WIDTH); startStop.addStyleName(Runo.BUTTON_BIG); final Resource iconStartStop; final String description; if (!model.isVvrStarted()) { iconStartStop = WebUiResources.getStartIcon(); description = "Start"; } else { iconStartStop = WebUiResources.getStopIcon(); description = "Stop"; } startStop.setIcon(iconStartStop); startStop.setDescription(description); operationLayout.addComponent(startStop); operationLayout.setExpandRatio(startStop, 1f); operationLayout.setComponentAlignment(startStop, Alignment.MIDDLE_LEFT); final UUID vvrUuid = model.getItemUuid(); startStop.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { final boolean started = model.isVvrStarted(); // Start/Stop are done in background if (!started) { WaitingComponent.executeBackground(model, new Background() { @Override public void processing() { model.startVvr(); } @Override public void postProcessing() { startStop.setIcon(WebUiResources.getStopIcon()); startStop.setDescription("Stop"); Notification.show("VVR started ", vvrUuid.toString(), Notification.Type.TRAY_NOTIFICATION); } }); } else { WaitingComponent.executeBackground(model, new Background() { @Override public void processing() { model.stopVvr(); } @Override public void postProcessing() { startStop.setIcon(WebUiResources.getStartIcon()); startStop.setDescription("Start"); Notification.show("VVR stopped ", vvrUuid.toString(), Notification.Type.TRAY_NOTIFICATION); } }); } } }); // ATTRIBUTES final Button attributes = new Button(); attributes.addStyleName(Runo.BUTTON_BIG); attributes.setWidth(BUTTON_WIDTH); operationLayout.addComponent(attributes); operationLayout.setExpandRatio(attributes, 1f); operationLayout.setComponentAlignment(attributes, Alignment.MIDDLE_LEFT); attributes.setIcon(WebUiResources.getSettingsIcon()); attributes.setDescription("Settings"); attributes.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final VvrAttributesWindow attributesWindow = new VvrAttributesWindow(vvrUuid); attributesWindow.add(model); } catch (final Exception e) { LOGGER.error("Can not get VVR attributes: ", e); final ErrorWindow err = new ErrorWindow("Can not display VVR Attributes: " + e.getMessage()); err.add(model); } } }); // DELETE final Button delete = new Button(); delete.addStyleName(Runo.BUTTON_BIG); delete.setWidth(BUTTON_WIDTH); delete.setIcon(WebUiResources.getTrashIcon()); delete.setDescription("Delete"); operationLayout.addComponent(delete); operationLayout.setExpandRatio(delete, 12f); operationLayout.setComponentAlignment(delete, Alignment.MIDDLE_RIGHT); delete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final VvrDeleteWindow deleteWindow = new VvrDeleteWindow(vvrUuid); deleteWindow.add(vvrManagerModel); } catch (final Exception e) { LOGGER.error("Can not delete VVR: ", e); final ErrorWindow err = new ErrorWindow("Can not delete VVR: " + e.getMessage()); err.add(model); } } }); return operationLayout; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
VerticalLayout scheduleLayout() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);// w w w .j a v a 2 s . c om layout.setSpacing(true); eventType = createEventTypelect(); layout.addComponent(eventType); startDate = createDateField("Start Date: "); layout.addComponent(startDate); endDate = createDateField("End Date: "); layout.addComponent(endDate); caption = createTextField("Caption: "); layout.addComponent(caption); location = createTextField("Where: "); layout.addComponent(location); description = new TextArea("Description: "); description.setWidth("100%"); description.setRows(3); layout.addComponent(description); color = createStyleNameSelect(); layout.addComponent(color); saveEventButton = new Button("SAVE", saveEventBtnListener); saveEventButton.setWidth("100%"); deleteEventButton = new Button("DELETE", deleteEventBtnListener); deleteEventButton.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setWidth("100%"); buttons.addComponent(deleteEventButton); buttons.addComponent(saveEventButton); // buttons.addComponent(editEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); return layout; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
VerticalLayout populateSchedule(CalendarComponentEvents.EventClick event) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);// w ww . ja v a2s.c o m layout.setSpacing(true); eventType = createEventTypelect(); eventType.setValue(basicEvent.getEventType()); layout.addComponent(eventType); startDate = createDateField("Start Date: "); startDate.setValue(event.getCalendarEvent().getStart()); layout.addComponent(startDate); endDate = createDateField("End Date: "); endDate.setValue(event.getCalendarEvent().getEnd()); layout.addComponent(endDate); caption = createTextField("Caption: "); caption.setValue(event.getCalendarEvent().getCaption()); layout.addComponent(caption); location = createTextField("Where: "); location.setValue(getBasicEvent().getLocation()); layout.addComponent(location); description = new TextArea("Description: "); description.setWidth("100%"); description.setRows(3); description.setValue(event.getCalendarEvent().getDescription()); layout.addComponent(description); color = createStyleNameSelect(); color.setValue(basicEvent.getStyleName()); layout.addComponent(color); eventDataId = createTextField("id: "); eventDataId.setValue(getBasicEvent().getEventId()); eventDataId.setVisible(false); layout.addComponent(eventDataId); editEventButton = new Button("EDIT", editEventBtnListener); editEventButton.setWidth("100%"); deleteEventButton = new Button("DELETE", deleteEventBtnListener); deleteEventButton.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setWidth("100%"); buttons.addComponent(deleteEventButton); buttons.addComponent(editEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); return layout; }
From source file:com.openhris.employee.EmployeeSummaryUI.java
public EmployeeSummaryUI(int branchId) { this.branchId = branchId; setSizeFull();//from w w w .java 2 s .c om setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final ComboBox employeeStatus = new ComboBox("Status: "); employeeStatus.setWidth("150px"); employeeStatus.setNullSelectionAllowed(false); employeeStatus.addItem("employed"); employeeStatus.addItem("resigned"); h.addComponent(employeeStatus); Button generateBtn = new Button("GENERATE EMPLOYEE SUMMARY"); generateBtn.setWidth("250px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeStatus.getValue() == null) { getWindow().showNotification("Employee Status!", Window.Notification.TYPE_WARNING_MESSAGE); return; } tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); summary.setContainerDataSource( new EmployeeSummaryDataContainer(corporateId, employeeStatus.getValue().toString())); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("250px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(summary, "EMPLOYEE SUMMARY"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " Employee Summary"); excelExport.setExportFileName(cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-Employee-Summary-" + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 3); addComponent(h); addComponent(summary); setExpandRatio(summary, 2); }
From source file:com.openhris.employee.PostEmploymentInfomation.java
public ComponentContainer layout2() { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true);// w ww.ja v a2 s . c om hlayout.setWidth("100%"); GridLayout glayout2 = new GridLayout(2, 2); glayout2.setSpacing(true); final PopupDateField endDate = new HRISPopupDateField("Exit Date: "); endDate.setWidth("250px"); endDate.setDateFormat("MM/dd/yyyy"); glayout2.addComponent(endDate, 0, 0); glayout2.setComponentAlignment(endDate, Alignment.BOTTOM_LEFT); Button endDateBtn = new Button("RESIGN"); endDateBtn.setWidth("150px"); endDateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (endDate.getValue() == null || endDate.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter End Date.", Window.Notification.TYPE_ERROR_MESSAGE); return; } Window window = new ConfirmResignWindow(getEmployeeId(), utilities.convertDateFormat(endDate.getValue().toString().trim().toLowerCase())); if (window.getParent() == null) { getWindow().addWindow(window); } } }); glayout2.addComponent(endDateBtn, 1, 0); glayout2.setComponentAlignment(endDateBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { endDateBtn.setEnabled(true); } else { endDateBtn.setEnabled(false); } hlayout.addComponent(glayout2); hlayout.setComponentAlignment(glayout2, Alignment.MIDDLE_RIGHT); final PopupDateField entryDateFromEmp = new HRISPopupDateField("Entry Date from Employment: "); entryDateFromEmp.setWidth("250px"); entryDateFromEmp.setDateFormat("MM/dd/yyyy"); entryDateFromEmp.setValue(utilities.parsingDate(employeeService.getEmploymentEntryDate(getEmployeeId()))); glayout2.addComponent(entryDateFromEmp, 0, 1); glayout2.setComponentAlignment(entryDateFromEmp, Alignment.BOTTOM_LEFT); Button entryDateFromEmpBtn = new Button("EDIT"); entryDateFromEmpBtn.setWidth("150px"); entryDateFromEmpBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (!GlobalVariables.getUserRole().equals("administrator")) { getWindow().showNotification( "You need to be an ADMINISTRATOR to EDIT date entry of employment.", Window.Notification.TYPE_ERROR_MESSAGE); return; } Window sub = new EditEmploymentDateEntryWindow(getEmployeeId(), utilities.convertDateFormat(entryDateFromEmp.getValue().toString())); if (sub.getParent() == null) { getWindow().addWindow(sub); } } }); glayout2.addComponent(entryDateFromEmpBtn, 1, 1); glayout2.setComponentAlignment(entryDateFromEmpBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { entryDateFromEmpBtn.setEnabled(true); } else { entryDateFromEmpBtn.setEnabled(false); } return hlayout; }
From source file:com.openhris.payroll.contributions.AFLUI.java
public AFLUI(int branchId) { this.branchId = branchId; setSizeFull();// w ww . j av a 2 s. c om setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE AFL"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); afl.setContainerDataSource(new AFLContainer(corporateId, util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(afl, "AFL Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " AFL Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-AFL-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(afl); setExpandRatio(afl, 2); }