Normand Briere
2019-09-06 9cc83b97378c48bae3792064f2d01b2f954c0e01
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
117
118
119
120
121
122
123
124
// Decompiled by Jad v1.5.7b. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SphereEditor.java
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
 
class SphereEditor extends BiparamEditor implements ActionListener, ObjectUI
{
    SphereEditor(Sphere inSph, GroupEditor callee)
    {
        super(inSph, callee); // false);
        //objEditor = new BiparamEditor(inSph, this, callee); // false);
        objEditor = callee.GetEditor();
       //parent = this;
        sphere = inSph;
        
   SetupUI2(objEditor);
    }
   
    SphereEditor(Sphere inSph, Object3D copy, GroupEditor callee)
    {
        super(inSph, copy, null, callee); // false);
        //objEditor = new BiparamEditor(inSph, copy, this, callee); // false);
       //parent = this;
        objEditor = this;
        sphere = (Sphere) copy;
       
       //SetupUI(objEditor);
    }
   
    /*
   void SetupUI(ObjEditor oe)
   {
//            super.SetupUI(oe);
        oe.ctrlPanel.add(centerLabel = new JLabel("Center"), oe.aConstraints);
   oe.aConstraints.gridx += 1;
   oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
   oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
        oe.ctrlPanel.add(centerField = new NumberField(), oe.aConstraints);
        centerField.setVector(sphere.center);
   centerField.addActionListener(this);
   oe.aConstraints.gridwidth = 1;
   oe.aConstraints.gridx = 0;
   oe.aConstraints.gridy += 1;
   oe.aConstraints.fill = GridBagConstraints.NONE;
        oe.ctrlPanel.add(radiusLabel = new JLabel("Radius"), oe.aConstraints);
   oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
   oe.aConstraints.gridx += 1;
   oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
        oe.ctrlPanel.add(radiusField = new NumberField(), oe.aConstraints);
        //radiusField.setFloat(sphere.radius);
   radiusField.addActionListener(this);
   oe.aConstraints.fill = GridBagConstraints.NONE;
   oe.aConstraints.gridwidth = 1;
   oe.aConstraints.gridx = 0;
   oe.aConstraints.gridy += 1;
    }
    */
   void Clear()
   {
       objEditor.Clear();
       
       sphere = null;
   }
   
    /*
    public void doLayout()
    {
        super.doLayout();
        labelAndField(centerLabel, centerField);
        labelAndField(radiusLabel, radiusField);
        widgetPos += 5;
    }
    */
 
   /**/    
    public void actionPerformed(ActionEvent e)
    {
       if (e.getSource() == centerField ||
           e.getSource() == radiusField)
       {
           applySelf();
           refreshContents();
       }
       else
           super.actionPerformed(e);
    }
   /**/
    
    public void applySelf()
    {
        super.applySelf();
        //centerField.getVector(sphere.center);
        //sphere.radius = radiusField.getFloat(1, 10000);
        sphere.recalculate();
    }
 
    Sphere sphere;
    JLabel centerLabel;
    JLabel radiusLabel;
    NumberField centerField;
    NumberField radiusField;
 
   public ObjEditor GetEditor()
   {
            //new Exception().printStackTrace();
       return objEditor; // .GetEditor();
   }
   
   public void closeUI2()
   {
       objEditor.closeUI();
   }
 
   void refreshContents2()
   {
       objEditor.refreshContents();
   }
   
   //BiparamEditor objEditor;
}