]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/wapp/MenuItem.java
Salome HOME
0a78e878e5498cde3d793c00a112480949fea0f4
[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       private static final long serialVersionUID = 8319750643667219000L;
12
13       protected Group (String label)                            { super(label); }
14       protected Group (String label, String icon, String url)   { super(label, icon, url); }
15
16       public boolean isOpen ()                                  { return open; }
17       public void    open ()                                    { open = true; }
18     }
19     protected static class SubItem extends MenuItem {
20 //  -----------------------------------------------
21       private static final long serialVersionUID = -4793172296421132566L;
22
23       protected SubItem (String label)                          { super(label); }
24       protected SubItem (String label, String icon, String url) { super(label, icon, url); }
25     }
26
27 //  ==============================================================================================================================
28 //  Construction
29 //  ==============================================================================================================================
30
31     public MenuItem (String label) {
32 //  ------------------------------
33       super(label);
34     }
35     public MenuItem (String label, String icon, String url) {
36 //  -------------------------------------------------------
37       super(label, url);
38       this.icon(icon);
39     }
40     public MenuItem action (String url) {
41 //  -----------------------------------
42       super.action(url);
43       return this;
44     }
45     public MenuItem icon (String icon) {
46 //  ----------------------------------
47       super.icon(icon);
48       return this;
49     }
50
51 //  ==============================================================================================================================
52 //  Member functions
53 //  ==============================================================================================================================
54
55     public boolean isGroup () {
56 //  -------------------------
57       return (this instanceof Group);
58     }
59
60     public boolean isOpen () {
61 //  ------------------------
62       return false;                // Redefined in the Group subclass
63     }
64
65     public boolean isSubItem () {
66 //  ---------------------------
67       return (this instanceof SubItem);
68     }
69 }