Revision b66bc2e5
Added by Andreas Müller about 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CheckboxElement.java | ||
---|---|---|
23 | 23 |
* |
24 | 24 |
* @author n.hoffmann |
25 | 25 |
* @created Nov 5, 2009 |
26 |
* @version 1.0 |
|
27 | 26 |
*/ |
28 | 27 |
public class CheckboxElement extends AbstractCdmFormElement implements SelectionListener, IEnableableFormElement, ISelectable { |
29 | 28 |
|
... | ... | |
60 | 59 |
|
61 | 60 |
/** |
62 | 61 |
* <p>setSelection</p> |
63 |
* |
|
64 |
* @param selected a boolean. |
|
65 | 62 |
*/ |
66 | 63 |
public void setSelection(boolean selected){ |
67 | 64 |
checkbox.removeSelectionListener(this); |
68 | 65 |
checkbox.setSelection(selected); |
69 | 66 |
checkbox.addSelectionListener(this); |
70 | 67 |
} |
71 |
|
|
72 | 68 |
/** |
73 | 69 |
* <p>getSelection</p> |
74 |
* |
|
75 |
* @return a boolean. |
|
76 | 70 |
*/ |
77 | 71 |
public boolean getSelection(){ |
78 | 72 |
return checkbox.getSelection(); |
79 | 73 |
} |
80 | 74 |
|
81 |
/* (non-Javadoc) |
|
82 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
|
83 |
*/ |
|
84 |
/** {@inheritDoc} */ |
|
85 | 75 |
@Override |
86 | 76 |
public void widgetSelected(SelectionEvent e) { |
87 | 77 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)); |
... | ... | |
91 | 81 |
return checkbox; |
92 | 82 |
} |
93 | 83 |
|
94 |
/** {@inheritDoc} */ |
|
95 | 84 |
@Override |
96 | 85 |
public void widgetDefaultSelected(SelectionEvent e) {} |
97 | 86 |
|
98 |
/** {@inheritDoc} */ |
|
99 | 87 |
@Override |
100 | 88 |
public void setSelected(boolean selected) { |
101 | 89 |
setBackground(selected ? SELECTED : getPersistentBackground()); |
102 | 90 |
} |
103 | 91 |
|
104 |
/** {@inheritDoc} */ |
|
105 | 92 |
@Override |
106 | 93 |
public void setEnabled(boolean enabled) { |
107 | 94 |
checkbox.setEnabled(enabled); |
108 | 95 |
label.setEnabled(enabled); |
109 | 96 |
} |
110 | 97 |
|
111 |
/* (non-Javadoc) |
|
112 |
* @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled() |
|
113 |
*/ |
|
114 | 98 |
@Override |
115 | 99 |
public boolean isEnabled() { |
116 | 100 |
return checkbox.isEnabled(); |
117 | 101 |
} |
118 | 102 |
|
119 |
/** {@inheritDoc} */ |
|
120 | 103 |
@Override |
121 | 104 |
public void setIrrelevant(boolean irrelevant) { |
122 | 105 |
String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND; |
... | ... | |
125 | 108 |
setBackground(color); |
126 | 109 |
} |
127 | 110 |
|
128 |
/* (non-Javadoc) |
|
129 |
* @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setBackground(org.eclipse.swt.graphics.Color) |
|
130 |
*/ |
|
131 |
/** {@inheritDoc} */ |
|
132 | 111 |
@Override |
133 | 112 |
public void setBackground(Color color) { |
134 | 113 |
if (checkbox.isDisposed()){ |
... | ... | |
150 | 129 |
getLayoutComposite().layout(); |
151 | 130 |
|
152 | 131 |
} |
153 |
} |
|
132 |
} |
Also available in: Unified diff
cleanup