1
2 package hoplugins.trainingExperience.ui.component;
3
4 import hoplugins.trainingExperience.dao.DividerDAO;
5
6 import java.beans.PropertyChangeEvent;
7 import java.beans.PropertyChangeListener;
8
9
10 /***
11 * Dividend Listener that store in the Database the position of the varous SplitPane
12 *
13 * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
14 */
15 public class DividerListener implements PropertyChangeListener {
16
17
18 /*** Key to be used for access the DB */
19 private String key = "";
20
21
22
23 /***
24 * Creates a new DividerListener object.
25 *
26 * @param _key
27 */
28 public DividerListener(String _key) {
29 key = _key;
30 }
31
32
33
34 /***
35 * Method invoked when the splitpane divisor is moved Store the new position value in the DB
36 *
37 * @param e
38 */
39 public void propertyChange(PropertyChangeEvent e) {
40 Number value = (Number) e.getNewValue();
41 int newDivLoc = value.intValue();
42
43 DividerDAO.setDividerPosition(key, newDivLoc);
44 }
45 }