Example usage for com.vaadin.ui CssLayout setStyleName

List of usage examples for com.vaadin.ui CssLayout setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui CssLayout setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityCalendarViewImpl.java

License:Open Source License

private void initContent() {
    MHorizontalLayout contentWrapper = new MHorizontalLayout().withSpacing(false).withWidth("100%");
    this.addComponent(contentWrapper);

    /* Content cheat */
    MVerticalLayout mainContent = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true))
            .withWidth("100%").withStyleName("readview-layout");
    contentWrapper.with(mainContent).expand(mainContent);

    MVerticalLayout rightColumn = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("250px");
    rightColumn.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    contentWrapper.addComponent(rightColumn);

    MHorizontalLayout actionPanel = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW);
    actionPanel.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label headerText = new CrmViewHeader(CrmTypeConstants.ACTIVITY, "Calendar");
    headerText.setStyleName(UIConstants.HEADER_TEXT);
    actionPanel.with(headerText).expand(headerText);

    mainContent.addComponent(actionPanel);

    this.dateHdr = new Label();
    this.dateHdr.setSizeUndefined();
    this.dateHdr.setStyleName("h2");
    mainContent.addComponent(this.dateHdr);
    mainContent.setComponentAlignment(this.dateHdr, Alignment.MIDDLE_CENTER);

    toggleViewBtn = new PopupButton("Monthly");
    toggleViewBtn.setWidth("200px");
    toggleViewBtn.addStyleName("calendar-view-switcher");
    MVerticalLayout popupLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withWidth("190px");

    monthViewBtn = new Button("Monthly", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from  ww  w . j a v  a 2  s.co m
        public void buttonClick(ClickEvent event) {
            toggleViewBtn.setPopupVisible(false);
            toggleViewBtn.setCaption(monthViewBtn.getCaption());
            calendarComponent.switchToMonthView(new Date(), true);
            datePicker.selectDate(new Date());
            monthViewBtn.addStyleName("selected-style");
            initLabelCaption();
        }
    });
    monthViewBtn.setStyleName("link");
    popupLayout.addComponent(monthViewBtn);

    weekViewBtn = new Button("Weekly", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            toggleViewBtn.setPopupVisible(false);
            toggleViewBtn.setCaption(weekViewBtn.getCaption());
            calendarComponent.switchToWeekView(new Date());
            datePicker.selectWeek(new Date());
        }
    });
    weekViewBtn.setStyleName("link");
    popupLayout.addComponent(weekViewBtn);

    dailyViewBtn = new Button("Daily", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            toggleViewBtn.setPopupVisible(false);
            toggleViewBtn.setCaption(dailyViewBtn.getCaption());
            Date currentDate = new Date();
            datePicker.selectDate(currentDate);
            calendarComponent.switchToDateView(currentDate);
        }
    });
    dailyViewBtn.setStyleName("link");
    popupLayout.addComponent(dailyViewBtn);

    toggleViewBtn.setContent(popupLayout);
    CssLayout toggleBtnWrap = new CssLayout();
    toggleBtnWrap.setStyleName("switcher-wrap");
    toggleBtnWrap.addComponent(toggleViewBtn);

    rightColumn.addComponent(toggleBtnWrap);
    rightColumn.setComponentAlignment(toggleBtnWrap, Alignment.MIDDLE_CENTER);

    rightColumn.addComponent(this.datePicker);
    initLabelCaption();
    addCalendarEvent();

    actionPanel.addComponent(calendarActionBtn);
    actionPanel.setComponentAlignment(calendarActionBtn, Alignment.MIDDLE_RIGHT);

    VerticalLayout actionBtnLayout = new VerticalLayout();
    actionBtnLayout.setMargin(true);
    actionBtnLayout.setSpacing(true);
    actionBtnLayout.setWidth("150px");

    Button.ClickListener listener = new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            calendarActionBtn.setPopupVisible(false);
            String caption = event.getButton().getCaption();
            if (caption.equals("New Task")) {
                EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null));
            } else if (caption.equals("New Call")) {
                EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null));
            } else if (caption.equals("New Event")) {
                EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null));
            }
        }
    };

    ButtonLink todoBtn = new ButtonLink("New Task", listener);
    actionBtnLayout.addComponent(todoBtn);
    todoBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK));
    todoBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK));

    Button callBtn = new ButtonLink("New Call", listener);
    actionBtnLayout.addComponent(callBtn);
    callBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL));
    callBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL));

    ButtonLink meetingBtn = new ButtonLink("New Meeting", listener);
    actionBtnLayout.addComponent(meetingBtn);
    meetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING));
    meetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING));

    calendarActionBtn.setContent(actionBtnLayout);

    ButtonGroup viewSwitcher = new ButtonGroup();

    Button calendarViewBtn = new Button("Calendar");
    calendarViewBtn.setStyleName("selected");
    calendarViewBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    viewSwitcher.addButton(calendarViewBtn);

    Button activityListBtn = new Button("Activities", new Button.ClickListener() {
        private static final long serialVersionUID = 2156576556541398934L;

        @Override
        public void buttonClick(ClickEvent evt) {
            ActivitySearchCriteria criteria = new ActivitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            EventBusFactory.getInstance().post(new ActivityEvent.GotoTodoList(this, null));
        }
    });
    activityListBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    viewSwitcher.addButton(activityListBtn);

    actionPanel.addComponent(viewSwitcher);
    actionPanel.setComponentAlignment(viewSwitcher, Alignment.MIDDLE_RIGHT);

    calendarComponent = new CalendarDisplay();
    mainContent.addComponent(calendarComponent);
    mainContent.setExpandRatio(calendarComponent, 1);
    mainContent.setComponentAlignment(calendarComponent, Alignment.MIDDLE_CENTER);

    HorizontalLayout spacing = new HorizontalLayout();
    spacing.setHeight("30px");
    mainContent.addComponent(spacing);

    HorizontalLayout noteInfoLayout = new HorizontalLayout();
    noteInfoLayout.setSpacing(true);

    HorizontalLayout noteWapper = new HorizontalLayout();
    noteWapper.setHeight("30px");
    Label noteLbl = new Label("Note:");
    noteWapper.addComponent(noteLbl);
    noteWapper.setComponentAlignment(noteLbl, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(noteWapper);

    HorizontalLayout completeWapper = new HorizontalLayout();
    completeWapper.setWidth("100px");
    completeWapper.setHeight("30px");
    completeWapper.addStyleName("eventLblcompleted");
    Label completeLabel = new Label("Completed");
    completeWapper.addComponent(completeLabel);
    completeWapper.setComponentAlignment(completeLabel, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(completeWapper);

    HorizontalLayout overdueWapper = new HorizontalLayout();
    overdueWapper.setWidth("100px");
    overdueWapper.setHeight("30px");
    overdueWapper.addStyleName("eventLbloverdue");
    Label overdueLabel = new Label("Overdue");
    overdueWapper.addComponent(overdueLabel);
    overdueWapper.setComponentAlignment(overdueLabel, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(overdueWapper);

    HorizontalLayout futureWapper = new HorizontalLayout();
    futureWapper.setWidth("100px");
    futureWapper.setHeight("30px");
    futureWapper.addStyleName("eventLblfuture");
    Label futureLabel = new Label("Future");
    futureWapper.addComponent(futureLabel);
    futureWapper.setComponentAlignment(futureLabel, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(futureWapper);

    mainContent.addComponent(noteInfoLayout);
    mainContent.setComponentAlignment(noteInfoLayout, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityRootView.java

License:Open Source License

public ActivityRootView() {
    super();/*from   w  w w.  j  av a2  s .  c o  m*/
    this.setSizeFull();

    final CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("verticalTabView");
    contentWrapper.setWidth("100%");
    this.addComponent(contentWrapper);

    root = new HorizontalLayout();
    root.setStyleName("menuContent");

    activityTabs = new VerticalTabsheet();
    activityTabs.setSizeFull();
    activityTabs.setNavigatorWidth("170px");
    activityTabs.setNavigatorStyleName("sidebar-menu");
    activityTabs.setContainerStyleName("tab-content");
    activityTabs.setHeight(null);

    root.addComponent(activityTabs);
    root.setWidth("100%");
    buildComponents();
    contentWrapper.addComponent(root);
}

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java

License:Open Source License

public Layout initContent() {

    CssLayout contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    contentLayout.setStyleName("lead-convert-window");

    contentLayout.addComponent(createBody());
    ComponentContainer buttonControls = createButtonControls();
    if (buttonControls != null) {
        final HorizontalLayout controlPanel = new HorizontalLayout();
        buttonControls.setSizeUndefined();
        controlPanel.addComponent(buttonControls);
        controlPanel.setWidth("100%");
        controlPanel.setMargin(true);/*from  ww  w  .j ava 2  s  .co m*/
        controlPanel.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER);
        contentLayout.addComponent(controlPanel);
    }

    return contentLayout;
}

From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityContactListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    HorizontalLayout controlsBtnWrap = new HorizontalLayout();
    controlsBtnWrap.setWidth("100%");

    HorizontalLayout notesWrap = new HorizontalLayout();
    notesWrap.setWidth("100%");
    notesWrap.setSpacing(true);/* ww w .  j  av  a2 s.  c  o  m*/
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (int i = 0; i < CrmDataTypeFactory.getOpportunityContactRoleList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getOpportunityContactRoleList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunityContactRoleList()[i]));
        note.setSizeUndefined();

        noteBlock.addComponent(note);
    }
    notesWrap.addComponent(noteBlock);
    notesWrap.setExpandRatio(noteBlock, 1.0f);

    controlsBtnWrap.addComponent(notesWrap);

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption("Add/Edit Contacts' Role");
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            EventBusFactory.getInstance().post(new OpportunityEvent.GotoContactRoleEdit(this, opportunity));
        }
    });
    final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow(
                    OpportunityContactListComp.this);
            final ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp.java

License:Open Source License

private void initContent() {
    previewForm = initPreviewForm();// w ww  .jav  a  2s  . co  m
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        actionControls.addStyleName("control-buttons");
        addHeaderRightContent(actionControls);
    }

    CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");

    if (previewLayout == null)
        previewLayout = new DefaultReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    RightSidebarLayout bodyContainer = new RightSidebarLayout();
    bodyContainer.setSizeFull();
    bodyContainer.addStyleName("readview-body-wrap");

    bodyContent = new MVerticalLayout().withSpacing(false).withMargin(false).with(previewForm);
    bodyContainer.setContent(bodyContent);

    sidebarContent = new MVerticalLayout().withWidth("250px").withSpacing(true)
            .withStyleName("readview-sidebar");
    bodyContainer.setSidebar(sidebarContent);

    FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent);
    floatSidebar.setContainerId("main-body");

    previewLayout.addBody(bodyContainer);

    this.addComponent(contentWrapper);
}

From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp2.java

License:Open Source License

public AbstractPreviewItemComp2(String headerText, Resource iconResource) {
    if (iconResource != null)
        this.titleIcon = new Image(null, iconResource);
    this.addComponent(constructHeader(headerText));

    previewForm = initPreviewForm();/*  w ww  .java  2s.c  o  m*/
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        actionControls.addStyleName("control-buttons");
        addHeaderRightContent(actionControls);
    }

    CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");

    previewLayout = new ReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    bodyContainer = new HorizontalLayout();
    bodyContainer.setSizeFull();
    bodyContainer.setStyleName("readview-body-wrap");

    bodyContent = new VerticalLayout();
    bodyContent.addComponent(previewForm);
    bodyContainer.addComponent(bodyContent);
    bodyContainer.setExpandRatio(bodyContent, 1);

    sidebarContent = new VerticalLayout();
    sidebarContent.setWidth("250px");
    sidebarContent.setSpacing(true);
    sidebarContent.setStyleName("readview-sidebar");
    bodyContainer.addComponent(sidebarContent);

    FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent);
    floatSidebar.setContainerId("main-body");

    previewLayout.addBody(bodyContainer);

    this.addComponent(contentWrapper);
}

From source file:com.esofthead.mycollab.module.project.ui.components.CommentRowDisplayHandler.java

License:Open Source License

@Override
public Component generateRow(final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%").withStyleName("message");

    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(),
            comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);//from   w w w.  j  a v a  2 s .  com

    CssLayout rowLayout = new CssLayout();
    rowLayout.setStyleName("message-container");
    rowLayout.setWidth("100%");

    MHorizontalLayout messageHeader = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%")
            .withStyleName("message-header");
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT,
            comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())),
            ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime()));

    timePostLbl.setSizeUndefined();
    timePostLbl.setStyleName("time-post");
    messageHeader.with(timePostLbl).expand(timePostLbl);

    // Message delete button
    Button msgDeleteBtn = new Button();
    msgDeleteBtn.setIcon(FontAwesome.TRASH_O);
    msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);
    messageHeader.addComponent(msgDeleteBtn);

    if (hasDeletePermission(comment)) {
        msgDeleteBtn.setVisible(true);
        msgDeleteBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                SiteConfiguration.getSiteName()),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                        AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClose(ConfirmDialog dialog) {
                                if (dialog.isConfirmed()) {
                                    CommentService commentService = ApplicationContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment.getId(), AppContext.getUsername(),
                                            AppContext.getAccountId());
                                    CommentRowDisplayHandler.this.owner.removeRow(layout);
                                }
                            }
                        });
            }
        });
    } else {
        msgDeleteBtn.setVisible(false);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new SafeHtmlLabel(comment.getComment());
    messageContent.setStyleName("message-body");
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withWidth("100%")
                .withStyleName("message-footer");
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }

    layout.with(rowLayout).expand(rowLayout);
    return layout;
}

From source file:com.esofthead.mycollab.module.project.ui.components.ProjectSubscribersComp.java

License:Open Source License

@Override
protected Component initContent() {
    ProjectMemberService projectMemberService = ApplicationContextUtil
            .getSpringBean(ProjectMemberService.class);
    List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId,
            AppContext.getAccountId());//from   w  ww  .  java 2  s  .co  m
    CssLayout container = new CssLayout();
    container.setStyleName("followers-container");
    final CheckBox selectAllCheckbox = new CheckBox("All", defaultSelectAll);
    selectAllCheckbox.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            boolean val = selectAllCheckbox.getValue();
            for (FollowerCheckbox followerCheckbox : memberSelections) {
                followerCheckbox.setValue(val);
            }
        }
    });
    container.addComponent(selectAllCheckbox);
    for (SimpleUser user : members) {
        final FollowerCheckbox memberCheckbox = new FollowerCheckbox(user);
        memberCheckbox.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
                if (!memberCheckbox.getValue()) {
                    selectAllCheckbox.setValue(false);
                }
            }
        });
        if (defaultSelectAll || selectedUsers.contains(user.getUsername())) {
            memberCheckbox.setValue(true);
        }
        memberSelections.add(memberCheckbox);
        container.addComponent(memberCheckbox);
    }
    return container;
}

From source file:com.esofthead.mycollab.module.project.view.settings.ProjectRoleReadViewImpl.java

License:Open Source License

public ProjectRoleReadViewImpl() {
    this.headerText = new Label();
    headerText.setCaption(AppContext.getMessage(ProjectRoleI18nEnum.FORM_READ_TITLE));
    headerText.setIcon(FontAwesome.USERS);
    headerText.addStyleName("header-text");

    this.headerText.setSizeUndefined();
    this.addComponent(constructHeader());

    previewForm = initPreviewForm();/*from   w w w .jav  a 2  s .  co  m*/
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        actionControls.addStyleName("control-buttons");
    }

    addHeaderRightContent(actionControls);

    CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");

    previewLayout = new DefaultReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    previewLayout.addBody(previewForm);

    this.addComponent(contentWrapper);
}

From source file:com.esofthead.mycollab.module.project.view.TimeTrackingSummaryViewImpl.java

License:Open Source License

@Override
public void display() {
    projects = ApplicationContextUtil.getSpringBean(ProjectService.class)
            .getProjectsUserInvolved(AppContext.getUsername(), AppContext.getAccountId());
    if (CollectionUtils.isNotEmpty(projects)) {
        itemTimeLoggingService = ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class);

        final CssLayout headerWrapper = new CssLayout();
        headerWrapper.setWidth("100%");
        headerWrapper.setStyleName("projectfeed-hdr-wrapper");

        HorizontalLayout loggingPanel = new HorizontalLayout();

        HorizontalLayout controlBtns = new HorizontalLayout();
        controlBtns.setMargin(new MarginInfo(true, false, true, false));

        final Label layoutHeader = new Label(
                ProjectAssetsManager.getAsset(ProjectTypeConstants.TIME).getHtml() + " Time Tracking",
                ContentMode.HTML);
        layoutHeader.addStyleName("h2");

        final MHorizontalLayout header = new MHorizontalLayout().withWidth("100%");
        header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader);

        final CssLayout contentWrapper = new CssLayout();
        contentWrapper.setWidth("100%");
        contentWrapper.addStyleName(UIConstants.CONTENT_WRAPPER);

        headerWrapper.addComponent(header);
        this.addComponent(headerWrapper);
        contentWrapper.addComponent(controlBtns);

        MHorizontalLayout controlsPanel = new MHorizontalLayout().withWidth("100%");

        contentWrapper.addComponent(controlsPanel);
        contentWrapper.addComponent(loggingPanel);
        this.addComponent(contentWrapper);

        final Button backBtn = new Button("Back to Workboard");
        backBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override/*  ww w .j a  va  2  s. c o  m*/
            public void buttonClick(final ClickEvent event) {
                EventBusFactory.getInstance()
                        .post(new ShellEvent.GotoProjectModule(TimeTrackingSummaryViewImpl.this, null));

            }
        });

        backBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
        backBtn.setIcon(FontAwesome.ARROW_LEFT);

        controlBtns.addComponent(backBtn);

        VerticalLayout selectionLayoutWrapper = new VerticalLayout();
        selectionLayoutWrapper.setWidth("100%");
        selectionLayoutWrapper.addStyleName("time-tracking-summary-search-panel");
        controlsPanel.addComponent(selectionLayoutWrapper);

        final GridLayout selectionLayout = new GridLayout(9, 2);
        selectionLayout.setSpacing(true);
        selectionLayout.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        selectionLayout.setMargin(true);
        selectionLayoutWrapper.addComponent(selectionLayout);

        Label fromLb = new Label("From:");
        fromLb.setWidthUndefined();
        selectionLayout.addComponent(fromLb, 0, 0);

        this.fromDateField = new PopupDateFieldExt();
        this.fromDateField.setResolution(Resolution.DAY);
        this.fromDateField.setDateFormat(AppContext.getUserDateFormat());
        this.fromDateField.setWidth("100px");
        selectionLayout.addComponent(this.fromDateField, 1, 0);

        Label toLb = new Label("To:");
        toLb.setWidthUndefined();
        selectionLayout.addComponent(toLb, 2, 0);

        this.toDateField = new PopupDateFieldExt();
        this.toDateField.setResolution(Resolution.DAY);
        this.toDateField.setDateFormat(AppContext.getUserDateFormat());
        this.toDateField.setWidth("100px");
        selectionLayout.addComponent(this.toDateField, 3, 0);

        Label groupLb = new Label("Group:");
        groupLb.setWidthUndefined();
        selectionLayout.addComponent(groupLb, 0, 1);

        this.groupField = new ValueComboBox(false, GROUPBY_PROJECT, GROUPBY_DATE, GROUPBY_USER);
        this.groupField.setWidth("100px");
        selectionLayout.addComponent(this.groupField, 1, 1);

        Label sortLb = new Label("Sort:");
        sortLb.setWidthUndefined();
        selectionLayout.addComponent(sortLb, 2, 1);

        this.orderField = new ItemOrderComboBox();
        this.orderField.setWidth("100px");
        selectionLayout.addComponent(this.orderField, 3, 1);

        Label projectLb = new Label("Project:");
        projectLb.setWidthUndefined();
        selectionLayout.addComponent(projectLb, 4, 0);

        this.projectField = new UserInvolvedProjectsListSelect();
        initListSelectStyle(this.projectField);
        selectionLayout.addComponent(this.projectField, 5, 0, 5, 1);

        Label userLb = new Label("User:");
        userLb.setWidthUndefined();
        selectionLayout.addComponent(userLb, 6, 0);

        this.userField = new UserInvolvedProjectsMemberListSelect(getProjectIds());
        initListSelectStyle(this.userField);
        selectionLayout.addComponent(this.userField, 7, 0, 7, 1);

        final Button queryBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUBMIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        fromDate = fromDateField.getValue();
                        toDate = toDateField.getValue();
                        searchCriteria.setRangeDate(new RangeDateSearchField(fromDate, toDate));
                        searchTimeReporting();
                    }
                });
        queryBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

        selectionLayout.addComponent(queryBtn, 8, 0);

        loggingPanel.setWidth("100%");
        loggingPanel.setHeight("80px");
        loggingPanel.setSpacing(true);

        totalHoursLoggingLabel = new Label("Total Hours Logging: 0 Hrs", ContentMode.HTML);
        totalHoursLoggingLabel.addStyleName(UIConstants.LAYOUT_LOG);
        totalHoursLoggingLabel.addStyleName(UIConstants.TEXT_LOG_DATE_FULL);
        loggingPanel.addComponent(totalHoursLoggingLabel);
        loggingPanel.setExpandRatio(totalHoursLoggingLabel, 1.0f);
        loggingPanel.setComponentAlignment(totalHoursLoggingLabel, Alignment.MIDDLE_LEFT);

        Button exportBtn = new Button("Export", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                exportButtonControl.setPopupVisible(true);

            }
        });
        exportButtonControl = new SplitButton(exportBtn);
        exportButtonControl.setWidthUndefined();
        exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK);
        exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);

        VerticalLayout popupButtonsControl = new VerticalLayout();
        exportButtonControl.setContent(popupButtonsControl);

        Button exportPdfBtn = new Button("Pdf");
        FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
        pdfDownloader.extend(exportPdfBtn);
        exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
        exportPdfBtn.setStyleName("link");
        popupButtonsControl.addComponent(exportPdfBtn);

        Button exportExcelBtn = new Button("Excel");
        FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
        excelDownloader.extend(exportExcelBtn);
        exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
        exportExcelBtn.setStyleName("link");
        popupButtonsControl.addComponent(exportExcelBtn);

        controlBtns.addComponent(exportButtonControl);
        controlBtns.setComponentAlignment(exportButtonControl, Alignment.TOP_RIGHT);
        controlBtns.setComponentAlignment(backBtn, Alignment.TOP_LEFT);
        controlBtns.setSizeFull();

        this.timeTrackingWrapper = new VerticalLayout();
        this.timeTrackingWrapper.setWidth("100%");
        contentWrapper.addComponent(this.timeTrackingWrapper);

        Calendar date = new GregorianCalendar();
        date.set(Calendar.DAY_OF_MONTH, 1);

        fromDate = date.getTime();
        date.add(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
        toDate = date.getTime();

        fromDateField.setValue(fromDate);
        toDateField.setValue(toDate);

        searchCriteria = new ItemTimeLoggingSearchCriteria();

        searchCriteria.setRangeDate(new RangeDateSearchField(fromDate, toDate));
    } else {
        final Button backBtn = new Button("Back to Workboard");
        backBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                EventBusFactory.getInstance()
                        .post(new ShellEvent.GotoProjectModule(TimeTrackingSummaryViewImpl.this, null));

            }
        });

        backBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
        backBtn.setIcon(FontAwesome.ARROW_LEFT);

        VerticalLayout contentWrapper = new VerticalLayout();
        contentWrapper.setSpacing(true);

        Label infoLbl = new Label("You are not involved in any project yet to track time working");
        infoLbl.setWidthUndefined();
        contentWrapper.setMargin(true);
        contentWrapper.addComponent(infoLbl);
        contentWrapper.setComponentAlignment(infoLbl, Alignment.MIDDLE_CENTER);

        contentWrapper.addComponent(backBtn);
        contentWrapper.setComponentAlignment(backBtn, Alignment.MIDDLE_CENTER);
        this.addComponent(contentWrapper);
        this.setComponentAlignment(contentWrapper, Alignment.MIDDLE_CENTER);
    }
}