01: package vicazh.hyperpool.stream;
02:
03: import javax.swing.*;
04: import vicazh.hyperpool.*;
05:
06: /**
07: * The graphic default selector
08: *
09: * @author Victor Zhigunov
10: * @version 0.4.0
11: */
12: public class IDefSelector extends IValSelector implements
13: DefSelectorMBean {
14:
15: private JComboBox defBox;
16:
17: private ISelectorListModel defModel;
18:
19: private IPrioritiesModel pmodel;
20:
21: /**
22: * @param name
23: * selector name
24: * @param valModel
25: * combo box model for values
26: * @param model
27: * selector table model
28: * @param defBox
29: * combo box for default value
30: * @param pmodel
31: * priorities table model
32: */
33: public IDefSelector(String name, ISelectorListModel valModel,
34: ISelectorModel model, JComboBox defBox,
35: IPrioritiesModel pmodel) {
36: super (name, valModel, model);
37: this .defBox = defBox;
38: this .defModel = (ISelectorListModel) defBox.getModel();
39: this .pmodel = pmodel;
40: }
41:
42: public void added(int index) {
43: super .added(index);
44: defModel.insert(index);
45: pmodel.insert(index);
46: }
47:
48: public void removed(int index) {
49: super .removed(index);
50: defModel.remove(index);
51: pmodel.remove(index);
52: }
53:
54: protected void otherNotification(String type, Object value) {
55: if (type.equals(SelectorMBean.DEF))
56: defBox.repaint();
57: else if (type.equals(ListSelectorMBean.LIST))
58: pmodel.fireTableDataChanged();
59: super.otherNotification(type, value);
60: }
61: }
|