1
2 package hoplugins.transfers.ui.controller;
3
4 import hoplugins.transfers.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:nethyperon@users.sourceforge.net>Boy van der Werf</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 Key value
27 */
28 public DividerListener(String key) {
29 this.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 Event
38 */
39 public final void propertyChange(PropertyChangeEvent e) {
40 final Number value = (Number) e.getNewValue();
41 final int newDivLoc = value.intValue();
42 DividerDAO.setDividerPosition(key, newDivLoc);
43 }
44 }