1515import javax .swing .JSpinner ;
1616import javax .swing .JTextField ;
1717import javax .swing .SpinnerNumberModel ;
18- import javax .swing .SwingConstants ;
1918import javax .swing .event .DocumentEvent ;
2019import javax .swing .event .DocumentListener ;
2120
22- import org .magic .composer .layer .FrameLayer ;
2321import org .magic .composer .layer .IllustrationLayer ;
2422import org .magic .composer .layer .Layer ;
2523
@@ -28,141 +26,48 @@ public class LayerDetailPanel extends JPanel {
2826 private static final long serialVersionUID = 1L ;
2927
3028 private final JTextField nameField = new JTextField ();
31-
3229 private final JLabel typeValue = new JLabel ("-" );
33-
34- private final JSpinner xSpinner =
35- new JSpinner (new SpinnerNumberModel (0 , -10000 , 10000 , 1 ));
36-
37- private final JSpinner ySpinner =
38- new JSpinner (new SpinnerNumberModel (0 , -10000 , 10000 , 1 ));
39-
40- private final JSpinner widthSpinner =
41- new JSpinner (new SpinnerNumberModel (0 , 0 , 10000 , 1 ));
42-
43- private final JSpinner heightSpinner =
44- new JSpinner (new SpinnerNumberModel (0 , 0 , 10000 , 1 ));
45-
46- private final JCheckBox visibleCheckBox =
47- new JCheckBox ();
30+ private final JSpinner xSpinner = new JSpinner (new SpinnerNumberModel (0 , 0 , 10000 , 1 ));
31+ private final JSpinner ySpinner = new JSpinner (new SpinnerNumberModel (0 , 0 , 10000 , 1 ));
32+ private final JSpinner widthSpinner = new JSpinner (new SpinnerNumberModel (0 , 0 , 10000 , 1 ));
33+ private final JSpinner heightSpinner = new JSpinner (new SpinnerNumberModel (0 , 0 , 10000 , 1 ));
34+ private final JCheckBox visibleCheckBox = new JCheckBox ("Visible" );
4835
4936 private Layer layer ;
50-
51- /*
52- * Permet d'éviter que les listeners soient déclenchés
53- * pendant un refresh().
54- */
5537 private boolean updating = false ;
5638
5739 public LayerDetailPanel () {
5840
5941 setLayout (new BorderLayout ());
6042
6143 var content = new JPanel ();
62-
63- content .setLayout (
64- new BoxLayout (content , BoxLayout .Y_AXIS )
65- );
66-
67- content .setBorder (
68- BorderFactory .createEmptyBorder (
69- 10 , 10 , 10 , 10
70- )
71- );
72-
73- /*
74- * -------------------------------------------------------------
75- * Layer
76- * -------------------------------------------------------------
77- */
44+ content .setLayout (new BoxLayout (content , BoxLayout .Y_AXIS ));
45+ content .setBorder (BorderFactory .createEmptyBorder (10 , 10 , 10 , 10 ));
7846
7947 content .add (createSectionTitle ("Layer" ));
80-
81- content .add (
82- createProperty ("Name" , nameField )
83- );
84-
85- content .add (
86- createProperty ("Type" , typeValue )
87- );
48+ content .add (createProperty ("Name" , nameField ));
49+ content .add (createProperty ("Type" , typeValue ));
8850
8951 content .add (Box .createVerticalStrut (10 ));
9052
91- /*
92- * -------------------------------------------------------------
93- * Transform
94- * -------------------------------------------------------------
95- */
96-
9753 content .add (createSectionTitle ("Transform" ));
98-
99- content .add (
100- createProperty ("X" , xSpinner )
101- );
102-
103- content .add (
104- createProperty ("Y" , ySpinner )
105- );
106-
107- content .add (
108- createProperty ("Width" , widthSpinner )
109- );
110-
111- content .add (
112- createProperty ("Height" , heightSpinner )
113- );
54+ content .add (createProperty ("X" , xSpinner ));
55+ content .add (createProperty ("Y" , ySpinner ));
56+ content .add (createProperty ("Width" , widthSpinner ));
57+ content .add (createProperty ("Height" , heightSpinner ));
11458
11559 content .add (Box .createVerticalStrut (10 ));
11660
117- /*
118- * -------------------------------------------------------------
119- * Properties
120- * -------------------------------------------------------------
121- */
122-
12361 content .add (createSectionTitle ("Properties" ));
124-
125- JPanel visiblePanel =
126- new JPanel (new BorderLayout (5 , 0 ));
127-
128- visiblePanel .setAlignmentX (
129- Component .LEFT_ALIGNMENT
130- );
131-
132- JLabel visibleLabel =
133- new JLabel ("Visible" );
134-
135- visiblePanel .add (
136- visibleLabel ,
137- BorderLayout .WEST
138- );
139-
140- visiblePanel .add (
141- visibleCheckBox ,
142- BorderLayout .EAST
143- );
144-
145- content .add (visiblePanel );
62+ content .add (visibleCheckBox ,BorderLayout .WEST );
14663
14764 content .add (Box .createVerticalStrut (10 ));
14865
149- /*
150- * -------------------------------------------------------------
151- * Source
152- * -------------------------------------------------------------
153- */
154-
15566 content .add (createSectionTitle ("Source" ));
15667
157- var scrollPane =
158- new JScrollPane (content );
159-
68+ var scrollPane = new JScrollPane (content );
16069 scrollPane .setBorder (null );
161-
162- add (
163- scrollPane ,
164- BorderLayout .CENTER
165- );
70+ add (scrollPane ,BorderLayout .CENTER );
16671
16772 /*
16873 * -------------------------------------------------------------
@@ -237,11 +142,6 @@ private JPanel createProperty(
237142 // =================================================================
238143
239144 private void installListeners () {
240-
241- /*
242- * Name
243- */
244-
245145 nameField .getDocument ()
246146 .addDocumentListener (
247147 new DocumentListener () {
@@ -269,10 +169,6 @@ public void changedUpdate(
269169 }
270170 );
271171
272- /*
273- * Position / dimensions
274- */
275-
276172 xSpinner .addChangeListener (
277173 _ -> updateX ()
278174 );
@@ -289,19 +185,11 @@ public void changedUpdate(
289185 _ -> updateHeight ()
290186 );
291187
292- /*
293- * Visibility
294- */
295-
296188 visibleCheckBox .addActionListener (
297189 _ -> updateVisibility ()
298190 );
299191 }
300192
301- // =================================================================
302- // Editing
303- // =================================================================
304-
305193 private void updateName () {
306194
307195 if (updating || layer == null ) {
@@ -384,18 +272,10 @@ private void updateVisibility() {
384272 notifyLayerChanged ();
385273 }
386274
387- // =================================================================
388- // Layer notification
389- // =================================================================
390-
391275 private void notifyLayerChanged () {
392276 repaint ();
393277 }
394278
395- // =================================================================
396- // Layer
397- // =================================================================
398-
399279 public Layer getLayer () {
400280 return layer ;
401281 }
0 commit comments