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 thinwire.ui.Application;
8   import thinwire.ui.Menu;
9   import thinwire.ui.Panel;
10  
11  /***
12   * The Class ActiveUserView.
13   */
14  public class ActiveUserView
15  {
16  
17      /*** The Constant activeContentView. */
18      public final static Application.Local<Panel> activeContentView = new Application.Local<Panel>();
19  
20      /*** The Constant activeHeaderPanel. */
21      public final static Application.Local<Panel> activeHeaderPanel = new Application.Local<Panel>();
22  
23      /*** The Constant activeRightHeaderPanel. */
24      public final static Application.Local<Panel> activeRightHeaderPanel = new Application.Local<Panel>();
25  
26      /***
27       * Change content view.
28       *
29       * @param view the view
30       */
31      public static void changeContentView(Panel view) {
32          Panel oldView = activeContentView.get();
33          view.setLimit(oldView.getLimit());
34          Application.current().getFrame().getChildren().remove(oldView);
35          Application.current().getFrame().getChildren().add(view);
36          activeContentView.set(view);
37      }
38  
39      /***
40       * Change right header panel.
41       *
42       * @param view the view
43       */
44      public static void changeRightHeaderPanel(Panel view) {
45          Panel oldView = activeRightHeaderPanel.get();
46          view.setLimit(oldView.getLimit());
47          activeHeaderPanel.get().getChildren().remove(oldView);
48          activeHeaderPanel.get().getChildren().add(view);
49          activeRightHeaderPanel.set(view);
50      }
51  
52      /***
53       * Change active menu.
54       *
55       * @param menu the menu
56       */
57      public static void changeActiveMenu(Menu menu) {
58          Application.current().getFrame().setMenu(menu);
59      }
60  }