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.header;
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.LoginAction;
11  import org.directdemocracyportal.democracy.web.action.RegisterAction;
12  
13  import thinwire.ui.Button;
14  import thinwire.ui.Panel;
15  import thinwire.ui.layout.TableLayout;
16  import thinwire.ui.style.Color;
17  
18  /***
19   * The Class WelcomePanel.
20   */
21  public class WelcomePanel extends Panel
22  {
23  
24      /***
25       * Instantiates a new welcome panel.
26       */
27      public WelcomePanel() {
28          super();
29          getStyle().getBackground().setColor(Color.valueOf("rgb(0,51,153)"));
30          setLayout(new TableLayout(new double[][] { { 0, 0 }, // Column Widths
31                  { 0 } }, // Row Heights
32                  1, // Margin around edge of container
33                  5)); // Spacing between cells
34  
35          Button registerButton = new Button();
36          registerButton.setText(ApplicationMessageHolder
37                  .getMessage(MessageConstans.BUTTON_REGISTER));
38          registerButton.setUserObject(new RegisterAction());
39          registerButton.addActionListener(ACTION_CLICK, BeanLocator
40                  .getApplicationActionListener());
41          registerButton.setSize(90, 30);
42          registerButton.setLimit("0,0,c,c");
43          getChildren().add(registerButton);
44  
45          Button loginButton = new Button();
46          loginButton.setText(ApplicationMessageHolder
47                  .getMessage(MessageConstans.BUTTON_LOGIN));
48          loginButton.setUserObject(new LoginAction());
49          loginButton.addActionListener(ACTION_CLICK, BeanLocator
50                  .getApplicationActionListener());
51          loginButton.setSize(90, 30);
52          loginButton.setLimit("1,0,c,c");
53          getChildren().add(loginButton);
54      }
55  }