View Javadoc
1   /*
2    * Copyright 2014 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id$
17   *  $HeadURL$
18  */
19  package com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl;
20  
21  import org.springframework.stereotype.Service;
22  
23  import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.UserHomeMenuItemFactory;
24  import com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand;
25  import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
26  import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserHomePageMode;
27  import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
28  import com.vaadin.server.FontAwesome;
29  import com.vaadin.ui.MenuBar;
30  
31  /**
32   * The Class UserHomeMenuItemFactoryImpl.
33   */
34  @Service
35  public final class UserHomeMenuItemFactoryImpl extends AbstractMenuItemFactoryImpl implements UserHomeMenuItemFactory {
36  
37  	/** The Constant OVERVIEW_TEXT. */
38  	private static final String OVERVIEW_TEXT = "Overview";
39  
40  	/** The Constant PAGE_VISIT_HISTORY_TEXT. */
41  	private static final String PAGE_VISIT_HISTORY_TEXT = "Page Visit History";
42  
43  	/** The Constant SECURITY_SETTING_TEXT. */
44  	private static final String SECURITY_SETTING_TEXT = "Security settings";
45  
46  
47  	/**
48  	 * Instantiates a new user home menu item factory impl.
49  	 */
50  	public UserHomeMenuItemFactoryImpl() {
51  		super();
52  	}
53  
54  
55  	@Override
56  	public void createUserHomeMenuBar(final MenuBar menuBar, final String pageId) {
57  		initApplicationMenuBar(menuBar);
58  
59  		menuBar.addItem(OVERVIEW_TEXT, FontAwesome.USER,
60  				new PageModeMenuCommand(UserViews.USERHOME_VIEW_NAME, PageMode.OVERVIEW, pageId));
61  
62  		menuBar.addItem(SECURITY_SETTING_TEXT, FontAwesome.USER,
63  				new PageModeMenuCommand(UserViews.USERHOME_VIEW_NAME, UserHomePageMode.SECURITY_SETTINGS.toString(), pageId));
64  
65  
66  		menuBar.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.LINE_CHART,
67  				new PageModeMenuCommand(UserViews.USERHOME_VIEW_NAME, PageMode.PAGEVISITHISTORY,pageId));
68  
69  	}
70  
71  }