List of usage examples for com.vaadin.ui HorizontalLayout setStyleName
@Override public void setStyleName(String style)
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectNotificationSettingViewComponent.java
License:Open Source License
public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) { super(AppContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE)); VerticalLayout bodyWrapper = new VerticalLayout(); bodyWrapper.setSpacing(true);//from w w w . j av a 2 s .c o m bodyWrapper.setMargin(true); bodyWrapper.setSizeFull(); HorizontalLayout notificationLabelWrapper = new HorizontalLayout(); notificationLabelWrapper.setSizeFull(); notificationLabelWrapper.setMargin(true); notificationLabelWrapper.setStyleName("notification-label"); Label notificationLabel = new Label(AppContext.getMessage(ProjectSettingI18nEnum.EXT_LEVEL)); notificationLabel.addStyleName("h2"); notificationLabel.setHeightUndefined(); notificationLabelWrapper.addComponent(notificationLabel); bodyWrapper.addComponent(notificationLabelWrapper); VerticalLayout body = new VerticalLayout(); body.setSpacing(true); body.setMargin(new MarginInfo(true, false, false, false)); final OptionGroup optionGroup = new OptionGroup(null); optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT); optionGroup.addItem(NotificationType.Default.name()); optionGroup.setItemCaption(NotificationType.Default.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setHeight("100%"); body.addComponent(optionGroup); body.setExpandRatio(optionGroup, 1.0f); body.setComponentAlignment(optionGroup, Alignment.MIDDLE_LEFT); String levelVal = bean.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else { optionGroup.select(levelVal); } Button updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { bean.setLevel((String) optionGroup.getValue()); ProjectNotificationSettingService projectNotificationSettingService = ApplicationContextUtil .getSpringBean(ProjectNotificationSettingService.class); if (bean.getId() == null) { projectNotificationSettingService.saveWithSession(bean, AppContext.getUsername()); } else { projectNotificationSettingService.updateWithSession(bean, AppContext.getUsername()); } NotificationUtil.showNotification( AppContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); } catch (Exception e) { throw new MyCollabException(e); } } }); updateBtn.addStyleName(UIConstants.THEME_GREEN_LINK); updateBtn.setIcon(FontAwesome.REFRESH); body.addComponent(updateBtn); body.setComponentAlignment(updateBtn, Alignment.BOTTOM_LEFT); bodyWrapper.addComponent(body); this.addComponent(bodyWrapper); }
From source file:com.esofthead.mycollab.module.project.view.task.FilterTaskViewImpl.java
License:Open Source License
public FilterTaskViewImpl() { this.setMargin(new MarginInfo(false, true, true, true)); final HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/*w w w . java 2s . co m*/ header.setMargin(new MarginInfo(true, false, true, false)); header.setStyleName(UIConstants.HEADER_VIEW); header.setWidth("100%"); Image titleIcon = new Image(null, MyCollabResource.newResource("icons/24/project/task.png")); headerText = new Label(); headerText.setSizeUndefined(); headerText.setStyleName(UIConstants.HEADER_TEXT); Button backtoTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_BACK_TO_DASHBOARD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backtoTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); UiUtils.addComponent(header, titleIcon, Alignment.TOP_LEFT); UiUtils.addComponent(header, headerText, Alignment.MIDDLE_LEFT); UiUtils.addComponent(header, backtoTaskListBtn, Alignment.MIDDLE_RIGHT); header.setExpandRatio(headerText, 1.0f); this.addComponent(header); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setWidth("100%"); contentLayout.setSpacing(true); this.addComponent(contentLayout); this.taskTableDisplay = new TaskTableDisplay(Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.percentagecomplete)); this.taskTableDisplay.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleTask task = (SimpleTask) event.getData(); if ("taskname".equals(event.getFieldName())) { EventBusFactory.getInstance() .post(new TaskEvent.GotoRead(FilterTaskViewImpl.this, task.getId())); } } }); taskTableDisplay.setWidth("100%"); taskTableDisplay.setStyleName("filter-task-table"); leftColumn = new VerticalLayout(); leftColumn.addComponent(taskTableDisplay); leftColumn.setStyleName("depotComp"); leftColumn.setMargin(new MarginInfo(true, true, false, false)); rightColumn = new VerticalLayout(); rightColumn.setWidth("300px"); contentLayout.addComponent(leftColumn); contentLayout.addComponent(rightColumn); contentLayout.setExpandRatio(leftColumn, 1.0f); unresolvedTaskByAssigneeWidget = new UnresolvedTaskByAssigneeWidget(); rightColumn.addComponent(unresolvedTaskByAssigneeWidget); unresolvedTaskByPriorityWidget = new UnresolvedTaskByPriorityWidget(); rightColumn.addComponent(unresolvedTaskByPriorityWidget); }
From source file:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java
License:Open Source License
public GanttChartTaskContainer() { taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); constructGanttChart();// w w w. j ava2 s . c o m Panel controls = createControls(); this.setStyleName("gantt-view"); this.addComponent(controls); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setWidth("100%"); mainLayout.setStyleName("gantt-wrap"); mainLayout.addComponent(taskTable); mainLayout.addComponent(gantt); this.addComponent(mainLayout); }
From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*from w w w. j a v a 2s. com*/ public void setSearchCriteria(UserSearchCriteria searchCriteria) { UserService userService = ApplicationContextUtil.getSpringBean(UserService.class); List<SimpleUser> userAccountList = userService .findPagableListByCriteria(new SearchRequest<>(searchCriteria, 0, Integer.MAX_VALUE)); this.removeAllComponents(); this.setSpacing(true); HorizontalLayout header = new HorizontalLayout(); header.setStyleName(UIConstants.HEADER_VIEW); header.setWidth("100%"); header.setMargin(new MarginInfo(true, false, true, false)); Button createBtn = new Button("Invite user", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null)); } }); createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setIcon(FontAwesome.PLUS); header.addComponent(createBtn); header.setComponentAlignment(createBtn, Alignment.MIDDLE_RIGHT); this.addComponent(header); CssLayout contentLayout = new CssLayout(); contentLayout.setWidth("100%"); for (SimpleUser userAccount : userAccountList) { contentLayout.addComponent(generateMemberBlock(userAccount)); } this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.vaadin.ui.Depot.java
License:Open Source License
public Depot(final Label titleLbl, final AbstractOrderedLayout headerElement, final ComponentContainer component, final String headerWidth, final String headerLeftWidth) { this.setStyleName("depotComp"); this.setMargin(new MarginInfo(true, false, false, false)); this.header = new HorizontalLayout(); this.header.setStyleName("depotHeader"); this.header.setWidth(headerWidth); this.bodyContent = component; if (headerElement != null) { this.headerContent = headerElement; } else {//from w ww. j a v a2 s.c o m this.headerContent = new HorizontalLayout(); this.headerContent.setSpacing(true); this.headerContent.setMargin(true); this.headerContent.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.headerContent.setVisible(false); } this.headerContent.setStyleName("header-elements"); this.headerContent.setWidthUndefined(); this.headerContent.setSizeUndefined(); this.addComponent(this.header); final HorizontalLayout headerLeft = new HorizontalLayout(); headerLeft.setMargin(false); this.headerLbl = titleLbl; this.headerLbl.setStyleName("h2"); this.headerLbl.setWidth("100%"); headerLeft.addComponent(this.headerLbl); headerLeft.setStyleName("depot-title"); headerLeft.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(final LayoutClickEvent event) { Depot.this.isOpenned = !Depot.this.isOpenned; if (Depot.this.isOpenned) { Depot.this.bodyContent.setVisible(true); Depot.this.removeStyleName("collapsed"); } else { Depot.this.bodyContent.setVisible(false); Depot.this.addStyleName("collapsed"); } } }); final CssLayout headerWrapper = new CssLayout(); headerWrapper.addComponent(headerLeft); headerWrapper.setStyleName("header-wrapper"); headerWrapper.setWidth(headerLeftWidth); this.header.addComponent(headerWrapper); this.header.setComponentAlignment(headerWrapper, Alignment.MIDDLE_LEFT); this.header.addComponent(this.headerContent); this.header.setComponentAlignment(this.headerContent, Alignment.TOP_RIGHT); this.header.setExpandRatio(headerWrapper, 1.0f); final CustomComponent customComp = new CustomComponent(this.bodyContent); customComp.setWidth("100%"); this.bodyContent.addStyleName("depotContent"); this.addComponent(customComp); this.setComponentAlignment(customComp, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.vaadin.ui.EditFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(final boolean isSaveBtnVisible, final boolean isSaveAndNewBtnVisible, final boolean isCancelBtnVisible) { final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/* w w w .java2s . c o m*/ layout.setSizeUndefined(); layout.setStyleName("addNewControl"); if (isSaveBtnVisible) { final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (EditFormControlsGenerator.this.editForm.validateForm()) { EditFormControlsGenerator.this.editForm.fireSaveForm(); } } }); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); layout.addComponent(saveBtn); layout.setComponentAlignment(saveBtn, Alignment.MIDDLE_CENTER); } if (isSaveAndNewBtnVisible) { final Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (EditFormControlsGenerator.this.editForm.validateForm()) { EditFormControlsGenerator.this.editForm.fireSaveAndNewForm(); } } }); saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT); saveAndNewBtn.setStyleName(UIConstants.THEME_GREEN_LINK); layout.addComponent(saveAndNewBtn); layout.setComponentAlignment(saveAndNewBtn, Alignment.MIDDLE_CENTER); } if (isCancelBtnVisible) { final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EditFormControlsGenerator.this.editForm.fireCancelForm(); } }); cancelBtn.setIcon(FontAwesome.MINUS); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); layout.addComponent(cancelBtn); layout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_CENTER); } return layout; }
From source file:com.esofthead.mycollab.vaadin.ui.SplitButton.java
License:Open Source License
public SplitButton(Button parentButton) { this.setImmediate(true); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setStyleName("splitbutton"); this.parentButton = parentButton; this.parentButton.addStyleName("parent-button"); this.parentButton.setImmediate(true); this.parentButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override//from w ww . java2 s . c o m public void buttonClick(ClickEvent event) { SplitButton.this.fireEvent(new SplitButtonClickEvent(SplitButton.this)); } }); popupButton = new PopupButton(); popupButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { SplitButton.this.isPopupVisible = !SplitButton.this.isPopupVisible; SplitButton.this.fireEvent( new SplitButtonPopupVisibilityEvent(SplitButton.this, SplitButton.this.isPopupVisible)); } }); contentLayout.addComponent(parentButton); contentLayout.addComponent(popupButton); this.setCompositionRoot(contentLayout); }
From source file:com.esofthead.mycollab.vaadin.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 .j ava 2s .com styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon(MyCollabResource.newResource("icons/16/cal_year_next.png")); btnShowNextYear.setStyleName("link"); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon(MyCollabResource.newResource("icons/16/cal_month_next.png")); btnShowNextMonth.setStyleName("link"); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon(MyCollabResource.newResource("icons/16/cal_month_pre.png")); btnShowPreviousMonth.setStyleName("link"); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon(MyCollabResource.newResource("icons/16/cal_year_pre.png")); btnShowPreviousYear.setStyleName("link"); lbSelectedDate.setValue(AppContext.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); HorizontalLayout layoutButtonNext = new HorizontalLayout(); layoutButtonNext.setSpacing(true); 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.esofthead.mycollab.vaadin.web.ui.SplitButton.java
License:Open Source License
public SplitButton(Button parentButton) { this.setImmediate(true); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setStyleName("splitbutton"); this.parentButton = parentButton; parentButton.addStyleName("parent-button"); parentButton.setImmediate(true);/*from w w w .ja va 2 s . com*/ parentButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { fireEvent(new SplitButtonClickEvent(SplitButton.this)); } }); popupButton = new PopupButton(); popupButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { isPopupVisible = !isPopupVisible; fireEvent(new SplitButtonPopupVisibilityEvent(SplitButton.this, isPopupVisible)); } }); contentLayout.addComponent(parentButton); contentLayout.addComponent(popupButton); this.setCompositionRoot(contentLayout); }
From source file:com.esofthead.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);/*from w w w .j a v a2s.co m*/ styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon(new AssetResource("icons/16/cal_year_next.png")); btnShowNextYear.setStyleName(UIConstants.BUTTON_LINK); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon(new AssetResource("icons/16/cal_month_next.png")); btnShowNextMonth.setStyleName(UIConstants.BUTTON_LINK); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon(new AssetResource("icons/16/cal_month_pre.png")); btnShowPreviousMonth.setStyleName(UIConstants.BUTTON_LINK); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon(new AssetResource("icons/16/cal_year_pre.png")); btnShowPreviousYear.setStyleName(UIConstants.BUTTON_LINK); lbSelectedDate.setValue(AppContext.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); }