View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling 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. 
3   	$Id
4   */
5   package org.directdemocracyportal.democracy.web.views;
6   
7   import org.directdemocracyportal.democracy.web.ApplicationMessageHolder;
8   import org.directdemocracyportal.democracy.web.BeanLocator;
9   import org.directdemocracyportal.democracy.web.ApplicationMessageHolder.MessageConstans;
10  import org.directdemocracyportal.democracy.web.action.ShowApplicationHome;
11  import org.directdemocracyportal.democracy.web.views.header.WelcomePanel;
12  
13  import thinwire.ui.Hyperlink;
14  import thinwire.ui.Panel;
15  import thinwire.ui.layout.TableLayout;
16  import thinwire.ui.style.Color;
17  
18  /***
19   * The Class HeaderPanel.
20   */
21  public class HeaderPanel extends Panel
22  {
23  
24      /***
25       * Instantiates a new header panel.
26       */
27      public HeaderPanel() {
28          ActiveUserView.activeHeaderPanel.set(this);
29  
30          setLayout(new TableLayout(new double[][] { { 0.3, 0.4, 0.3 }, // Column
31                  // Widths
32                  { 0 } }, // Row Heights
33                  1, // Margin around edge of container
34                  5)); // Spacing between cells
35  
36          getStyle().getBackground().setColor(Color.valueOf("rgb(0,51,153)"));
37  
38          Hyperlink homelink = new Hyperlink(ApplicationMessageHolder
39                  .getMessage(MessageConstans.APPLICATION_NAME));
40          homelink.setLimit("0,0");
41          homelink.getStyle().getFont().setColor(Color.WHITE);
42          homelink.setUserObject(new ShowApplicationHome());
43          homelink.addActionListener(ACTION_CLICK, BeanLocator
44                  .getApplicationActionListener());
45          getChildren().add(homelink);
46  
47          WelcomePanel welcomePanel = new WelcomePanel();
48          welcomePanel.setLimit("2,0");
49          ActiveUserView.activeRightHeaderPanel.set(welcomePanel);
50          getChildren().add(welcomePanel);
51      }
52  
53  }