Salome HOME
NewStudyAction is improved. Specific business method for creation of a new study...
[tools/siman.git] / Workspace / Siman / src / org / splat / wapp / MenuItem.java
1 package org.splat.wapp;
2
3
4 public class MenuItem extends Item {
5
6     private static final long serialVersionUID = 1002251657309138413L;
7
8         protected static class Group extends MenuItem {
9 //  ---------------------------------------------
10       private boolean open = false;
11         /**
12          * Serial version ID.
13          */
14       private static final long serialVersionUID = 8319750643667219000L;
15
16       protected Group (String label)                            { super(label); }
17       protected Group (String label, String icon, String url)   { super(label, icon, url); }
18
19       public boolean isOpen ()                                  { return open; }
20       public void    open ()                                    { open = true; }
21     }
22     protected static class SubItem extends MenuItem {
23 //  -----------------------------------------------
24         /**
25          * Serial version ID.
26          */
27       private static final long serialVersionUID = -4793172296421132566L;
28
29       protected SubItem (String label)                          { super(label); }
30       protected SubItem (String label, String icon, String url) { super(label, icon, url); }
31     }
32
33 //  ==============================================================================================================================
34 //  Construction
35 //  ==============================================================================================================================
36
37     public MenuItem (String label) {
38 //  ------------------------------
39       super(label);
40     }
41     public MenuItem (String label, String icon, String url) {
42 //  -------------------------------------------------------
43       super(label, url);
44       this.icon(icon);
45     }
46     public MenuItem action (String url) {
47 //  -----------------------------------
48       super.action(url);
49       return this;
50     }
51     public MenuItem icon (String icon) {
52 //  ----------------------------------
53       super.icon(icon);
54       return this;
55     }
56
57 //  ==============================================================================================================================
58 //  Member functions
59 //  ==============================================================================================================================
60
61     public boolean isGroup () {
62 //  -------------------------
63       return (this instanceof Group);
64     }
65
66     public boolean isOpen () {
67 //  ------------------------
68       return false;                // Redefined in the Group subclass
69     }
70
71     public boolean isSubItem () {
72 //  ---------------------------
73       return (this instanceof SubItem);
74     }
75 }