Salome HOME
951a8371c3598b26256f6cd57f9cc1289a873183
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / MenuAction.java
1 package org.splat.simer;
2
3 import org.splat.wapp.SimpleMenu;
4
5
6 public class MenuAction extends Action {
7
8     private String menuname;
9         private String selection;
10
11         private static final long serialVersionUID = 5904292225286579036L;
12
13 //  ==============================================================================================================================
14 //  Action methods
15 //  ==============================================================================================================================
16
17     public String doSelectItem () {
18 //  -----------------------------
19       SimpleMenu  menu = ApplicationSettings.getMenu(menuname);
20         
21       if (selection == null) {                 // Switch back to the menu, keeping the last selection
22                 getSession().put("menu.open", menu);   // Activates the menu
23         selection = menu.getSelection();
24         if (selection == null) selection = "none";
25       } else {                                     // Selection of another menu item
26         menu.selects(selection);
27       }
28       return selection;
29     }
30
31 //  ==============================================================================================================================
32 //  Getters and setters
33 //  ==============================================================================================================================
34
35     public String getItem () {
36 //  ------------------------
37       return selection;
38     }
39     public String getMenu () {
40 //  ------------------------
41       return menuname;
42     }
43
44     public void setMenu (String name) {
45 //  ---------------------------------
46       this.menuname = name;
47     }
48     public void setItem (String item) {
49 //  ---------------------------------
50       this.selection = item;
51     }
52 }