/*
 * Copyright 2015 Ryan Gilera.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.daytron.revworks.ui.dashboard;

import com.github.daytron.revworks.MainUI;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.VerticalLayout;

/**
 *
 * @author Ryan Gilera
 */
public class DashboardScreen extends VerticalLayout {

    private final NavigationMenu menu;

    public DashboardScreen(MainUI mainUI) {

        setMargin(true);
        HorizontalLayout headerLayout = new DashboardHeader();

        CssLayout viewContainer = new CssLayout();
        viewContainer.addStyleName("valo-content");
        viewContainer.setSizeFull();

        final Navigator navigator = new Navigator(mainUI, viewContainer);
        navigator.setErrorView(ErrorView.class);
        menu = new NavigationMenu(navigator);

        if (mainUI.getAccessControl().isUserAStudent()) {
            menu.addView(HomeView.class,
                    "",
                    HomeView.VIEW_NAME, FontAwesome.HOME);
        } else if (mainUI.getAccessControl().isUserALecturer()) {
            menu.addView(HomeView.class,
                    "",
                    HomeView.VIEW_NAME, FontAwesome.HOME);
        } else {

        }

        navigator.addViewChangeListener(viewChangeListener);

        addComponent(headerLayout);
        addComponent(menu);
        addComponent(viewContainer);
        setExpandRatio(viewContainer, 1);
        setSizeFull();

    }

    // notify the view menu about view changes so that it can display which view
    // is currently active
    ViewChangeListener viewChangeListener = new ViewChangeListener() {

        @Override
        public boolean beforeViewChange(ViewChangeListener.ViewChangeEvent event) {
            return true;
        }

        @Override
        public void afterViewChange(ViewChangeListener.ViewChangeEvent event) {
        }

    };

}

@@ -684,16 +684,179 @@
 MainUI;%0A
+import com.github.daytron.revworks.ui.dashboard.lecturer.NewAnnouncementView;%0Aimport com.github.daytron.revworks.ui.dashboard.student.StudentCourseworkModuleView;%0A
 import c
@@ -1766,34 +1766,50 @@
                 
-%22%22
+HomeView.VIEW_NAME
 ,%0A              
@@ -1820,36 +1820,241 @@
   HomeView.VIEW_
-NAME
+CAPTION, FontAwesome.HOME);%0A            menu.addView(StudentCourseworkModuleView.class, %0A                    StudentCourseworkModuleView.VIEW_NAME, %0A                    StudentCourseworkModuleView.VIEW_CAPTION
 , FontAwesome.HO
@@ -2043,36 +2043,38 @@
 ON, FontAwesome.
-HOME
+FOLDER
 );%0A        %7D els
@@ -2191,10 +2191,26 @@
     
-%22%22
+HomeView.VIEW_NAME
 ,%0A  
@@ -2241,20 +2241,201 @@
 ew.VIEW_
-NAME
+CAPTION, FontAwesome.HOME);%0A            menu.addView(NewAnnouncementView.class, %0A                    NewAnnouncementView.VIEW_NAME, %0A                    NewAnnouncementView.VIEW_CAPTION
 , FontAw
@@ -2432,36 +2432,40 @@
 ON, FontAwesome.
-HOME
+BULLHORN
 );%0A        %7D els
@@ -2472,32 +2472,50 @@
 e %7B%0A%0A        %7D%0A%0A
+        %0A        %0A
         navigato
@@ -2714,28 +2714,80 @@
      set
-SizeFull();%0A
+Width(%22100%25%22);%0A        navigator.navigateTo(HomeView.VIEW_NAME);
 %0A    %7D%0A%0A

Add more views, replace setSizeFull to only width to allow scrolling and set default view when initially launch