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   
6   package com.hack23.cia.web.views.common;
7   
8   import thinwire.ui.Application;
9   import thinwire.ui.Menu;
10  import thinwire.ui.Panel;
11  
12  /***
13   * The Class ActiveUserView.
14   */
15  public class ActiveUserView {
16  
17      /*** The active content view. */
18      private static Application.Local<Panel> activeContentView = new Application.Local<Panel>();
19  
20      /*** The current position and history view. */
21      private static Application.Local<Panel> currentPositionAndHistoryView = new Application.Local<Panel>();
22  
23      /***
24       * Change active menu.
25       *
26       * @param menu the menu
27       */
28      public static void changeActiveMenu(final Menu menu) {
29          Application.current().getFrame().setMenu(menu);
30      }
31  
32      /***
33       * Change content view.
34       *
35       * @param view the view
36       */
37      public static void changeContentView(final Panel view) {
38          final Panel oldView = activeContentView.get();
39          view.setLimit(oldView.getLimit());
40          Application.current().getFrame().getChildren().remove(oldView);
41          Application.current().getFrame().getChildren().add(view);
42          activeContentView.set(view);
43      }
44  
45      /***
46       * Gets the active content view.
47       *
48       * @return the active content view
49       */
50      public static Application.Local<Panel> getActiveContentView() {
51          return activeContentView;
52      }
53  
54      /***
55       * Gets the current position and history view.
56       *
57       * @return the current position and history view
58       */
59      public static Application.Local<Panel> getCurrentPositionAndHistoryView() {
60          return currentPositionAndHistoryView;
61      }
62  
63      /***
64       * Instantiates a new active user view.
65       */
66      protected ActiveUserView() {
67          super();
68      }
69  }