]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/wapp/Item.java
Salome HOME
Update copyrights 2014.
[tools/siman.git] / Workspace / Siman / src / org / splat / wapp / Item.java
1 package org.splat.wapp;
2
3 import java.io.Serializable;
4
5
6 public class Item implements Serializable {
7
8         private transient final String  _mylabel;
9     private transient String  _myicon;
10     private transient String  _action;
11     private transient boolean _selected = false;
12
13         /**
14          * Serial version ID.
15          */
16         private static final long serialVersionUID = -3505572710372809913L;
17
18 //  ==============================================================================================================================
19 //  Construction
20 //  ==============================================================================================================================
21
22     public Item (final String label) {
23       _mylabel = label;
24       _myicon  = null;
25       _action   = null;
26     }
27     public Item (final String label, final String url) {
28       _mylabel = label;
29       _myicon  = null;
30       _action   = url;
31     }
32     public Item (final String label, final String icon, final String url) {
33       _mylabel = label;
34       _myicon  = icon;
35       _action   = url;
36     }
37     public Item action (final String url) {
38       _action  = url;
39       return this;
40     }
41     public Item icon (final String icon) {
42       _myicon = icon;
43       return this;
44     }
45
46 //  ==============================================================================================================================
47 //  Member functions
48 //  ==============================================================================================================================
49
50     public String getAction () {
51       return _action;                // Null if not enabled
52     }
53
54     public String getIcon () {
55       return _myicon;
56     }
57
58         public String getLabel () {
59       return _mylabel;
60     }
61
62     public boolean isEnabled () {
63       return (_action != null);
64     }
65
66     public boolean isSelected () {
67       return _selected;
68     }
69
70     protected void select () {
71       _selected = true;
72     }
73
74     protected void unselect () {
75       _selected = false;
76     }
77 }