1 | package de.uka.ipd.sdq.sensorframework.adapter; |
2 | |
3 | import java.util.Observable; |
4 | import java.util.Properties; |
5 | |
6 | /**Superclass for all DataAdapter in the SensorFramework. |
7 | * All Adapters can have property setting and changes need to be observed to |
8 | * allow changes on the GUI. |
9 | * @author Henning Groenda |
10 | */ |
11 | public abstract class DataAdapter extends Observable implements IAdapter { |
12 | public static final String SETTINGS_CHANGED = "Settings have changed"; |
13 | |
14 | /** The properties settings for this adapter */ |
15 | protected Properties adapterProperties; |
16 | |
17 | /**Initializes a new DataAdapter without properties. */ |
18 | public DataAdapter() { |
19 | super(); |
20 | this.adapterProperties = new Properties(); |
21 | } |
22 | |
23 | /**Initializes a new DataAdapter with the given properties. |
24 | * @param adapterProperties The associated properties. |
25 | */ |
26 | public DataAdapter(Properties adapterProperties) { |
27 | super(); |
28 | this.adapterProperties = adapterProperties; |
29 | } |
30 | |
31 | /** {@inheritDoc} |
32 | */ |
33 | public Properties getProperties() { |
34 | return adapterProperties; |
35 | } |
36 | |
37 | /** {@inheritDoc} |
38 | */ |
39 | public void setProperties(Properties newProperties) { |
40 | this.adapterProperties = newProperties; |
41 | // notify observers that settings have changed. |
42 | setChanged(); |
43 | notifyObservers(SETTINGS_CHANGED); |
44 | } |
45 | |
46 | } |