source: src/main/java/genius/gui/panels/DoubleModel.java@ 346

Last change on this file since 346 was 227, checked in by Tim Baarslag, 5 years ago

Added elicitationCost GUI, using DoubleModel

File size: 745 bytes
Line 
1package genius.gui.panels;
2
3import genius.core.listener.DefaultListenable;
4
5/**
6 * Model behind a double value (from a text field). Listeners receive the new string value as object.
7 *
8 */
9public class DoubleModel extends DefaultListenable<Double> implements Lockable
10{
11 private Double value;
12 private boolean isLocked = false;
13
14 public DoubleModel(Double initial) {
15 this.value = initial;
16 }
17
18 public void setText(Double newvalue)
19 {
20 if (!value.equals(newvalue)) {
21 value = newvalue;
22 notifyChange(value);
23 }
24 }
25
26 public Double getValue()
27 {
28 return value;
29 }
30
31 @Override
32 public void setLock(boolean isLock)
33 {
34 this.isLocked = isLock;
35 notifyChange(value);
36 }
37
38 @Override
39 public boolean isLocked() {
40 return isLocked;
41 }
42
43}
Note: See TracBrowser for help on using the repository browser.