Normand Briere
2019-10-20 49d9c15d375942997692f7fccfb697665d0cb59e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
 
class BezierEditor extends ObjEditor // implements ActionListener
{
   BezierEditor(Object3D inBezier, GroupEditor callee)
   {
            super(inBezier, callee);
            bezier = (BezierElement) inBezier;
 
            objEditor = callee.GetEditor();
            
            SetupUI2(objEditor);
        }
   
   BezierEditor(Object3D inBezier, Object3D copy, GroupEditor callee)
   {
       super(inBezier, copy, callee); // false);
       bezier = (BezierElement) copy;
 
                objEditor = this;
                
       SetupWindow();
       SetupUI2(this);
   }
   
   void SetupUI2(ObjEditor oe)
   {
                super.SetupUI2(oe);
                
        oe.ctrlPanel.add(depthLabel = new JLabel("Depth")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
        oe.ctrlPanel.Return();
        oe.ctrlPanel.add(depthField = new NumberSlider(0, 5)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
 
        depthField.setInteger(bezier.GetDepth());
       depthField.addChangeListener(this);
   }
   
   void refreshContents()
   {
       objEditor.refreshContents();
   }
   
   void Clear()
   {
       super.Clear();
       
       bezier = null;
   }
   
   public void closeUI()
   {
       ObjEditor oe = GetEditor();
       
       depthField.removeChangeListener(this);
       oe.ctrlPanel.remove(depthLabel);
       oe.ctrlPanel.remove(depthField);
       
       super.closeUI();
   }
   
   public void stateChanged(ChangeEvent e)
   {
       if (e.getSource() == depthField)
       {
           applySelf();
       // june 2013    super.applySelf();
           refreshContents();
       }
       else
           super.stateChanged(e);
   }
   
   /*
   public void actionPerformed(ActionEvent e)
   {
       if (e.getSource() == depthField)
       {
           System.out.println(e);
           applySelf();
           //refreshContents();
           client.refreshEditWindow();
       }
       else
           super.actionPerformed(e);
   }
   */
   
   /*
   public void doLayout()
   {
       super.doLayout();
       labelAndField(typeLabel, typeMenu);
       prompt.setBounds(5, widgetPos, 190, textHeight);
   }
   */
   
   public boolean action(Event event, Object obj)
   {
       return super.action(event, obj);
   }
   
   public void applySelf()
   {
// june 2013        super.applySelf();
       
        bezier.SetDepth(depthField.getInteger());
       bezier.recalculate();
   }
   
   BezierElement bezier;
   JLabel depthLabel;
    NumberSlider depthField;
}