Merge branch 'Jalview-JS/jim/JAL-3253-JAL-3418' into Jalview-JS/JAL-3253-applet
[jalview.git] / unused / net / miginfocom / swing / SwingComponentWrapper.java
1 package net.miginfocom.swing;
2 /*
3  * License (BSD):
4  * ==============
5  *
6  * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without modification,
10  * are permitted provided that the following conditions are met:
11  * Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  * Redistributions in binary form must reproduce the above copyright notice, this
14  * list of conditions and the following disclaimer in the documentation and/or other
15  * materials provided with the distribution.
16  * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
17  * used to endorse or promote products derived from this software without specific
18  * prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
26  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
29  * OF SUCH DAMAGE.
30  *
31  * @version 1.0
32  * @author Mikael Grev, MiG InfoCom AB
33  *         Date: 2006-sep-08
34  */
35
36 import net.miginfocom.layout.ComponentWrapper;
37 import net.miginfocom.layout.ContainerWrapper;
38 import net.miginfocom.layout.LayoutUtil;
39 import net.miginfocom.layout.PlatformDefaults;
40
41 import javax.swing.*;
42 import javax.swing.border.Border;
43 import javax.swing.text.JTextComponent;
44 import java.awt.*;
45 import java.awt.geom.Rectangle2D;
46 import java.util.IdentityHashMap;
47 import java.util.StringTokenizer;
48
49 /**
50  */
51 public class SwingComponentWrapper implements ComponentWrapper
52 {
53         private static boolean maxSet = false;
54
55         private static boolean vp = true;
56
57         /** Debug color for component bounds outline.
58          */
59         private static final Color DB_COMP_OUTLINE = new Color(0, 0, 200);
60
61         /** Property to use in LAF settings and as JComponent client property
62          * to specify the visual padding.
63          * <p>
64          */
65         private static final String VISUAL_PADDING_PROPERTY = net.miginfocom.layout.PlatformDefaults.VISUAL_PADDING_PROPERTY;
66
67         private final Component c;
68         private int compType = TYPE_UNSET;
69         private Boolean bl = null;
70         private boolean prefCalled = false;
71
72         public SwingComponentWrapper(Component c)
73         {
74                 this.c = c;
75         }
76
77         @Override
78         public final int getBaseline(int width, int height)
79         {
80                 int h = height;
81                 int[] visPad = getVisualPadding();
82                 if (h < 0) {
83                         h = c.getHeight();
84                 } else if (visPad != null) {
85                         h = height + visPad[0] + visPad[2];
86                 }
87                 int baseLine = c.getBaseline(width < 0 ? c.getWidth() : width, h);
88                 if (baseLine != -1 && visPad != null)
89                         baseLine -= visPad[0];
90
91                 return baseLine;
92         }
93
94         @Override
95         public final Object getComponent()
96         {
97                 return c;
98         }
99
100         /** Cache.
101          */
102         private final static IdentityHashMap<FontMetrics, Point.Float> FM_MAP = new IdentityHashMap<FontMetrics, Point.Float>(4);
103         private final static Font SUBST_FONT = new Font("sansserif", Font.PLAIN, 11);
104
105         @Override
106         public final float getPixelUnitFactor(boolean isHor)
107         {
108                 switch (PlatformDefaults.getLogicalPixelBase()) {
109                         case PlatformDefaults.BASE_FONT_SIZE:
110                                 Font font = c.getFont();
111                                 FontMetrics fm = c.getFontMetrics(font != null ? font : SUBST_FONT);
112                                 Point.Float p = FM_MAP.get(fm);
113                                 if (p == null) {
114                                         Rectangle2D r = fm.getStringBounds("X", c.getGraphics());
115                                         p = new Point.Float(((float) r.getWidth()) / 6f, ((float) r.getHeight()) / 13.27734375f);
116                                         FM_MAP.put(fm, p);
117                                 }
118                                 return isHor ? p.x : p.y;
119
120                         case PlatformDefaults.BASE_SCALE_FACTOR:
121
122                                 Float s = isHor ? PlatformDefaults.getHorizontalScaleFactor() : PlatformDefaults.getVerticalScaleFactor();
123                                 float scaleFactor = (s != null) ? s : 1f;
124
125                                 // Swing in Java 9 scales automatically using the system scale factor(s) that the
126                                 // user can change in the system settings (Windows: Control Panel; Mac: System Preferences).
127                                 // Each connected screen may use its own scale factor
128                                 // (e.g. 1.5 for primary 4K 40inch screen and 1.0 for secondary HD screen).
129                                 float screenScale = isJava9orLater
130                                         ? 1f // use system scale factor(s)
131                                         : (float) (isHor ? getHorizontalScreenDPI() : getVerticalScreenDPI()) / (float) PlatformDefaults.getDefaultDPI();
132                                 return scaleFactor * screenScale;
133
134                         default:
135                                 return 1f;
136                 }
137         }
138
139         private static boolean isJava9orLater = true;
140 //      static {
141 //              try {
142 //                      // Java 9 version-String Scheme: http://openjdk.java.net/jeps/223
143 //                      StringTokenizer st = new StringTokenizer(System.getProperty("java.version"), "._-+");
144 //                      int majorVersion = Integer.parseInt(st.nextToken());
145 //                      isJava9orLater = majorVersion >= 9;
146 //              } catch (Exception e) {
147 //                      // Java 8 or older
148 //              }
149 //      }
150
151 //      /** Cache.
152 //       */
153 //      private final static IdentityHashMap<FontMetrics, Point.Float> FM_MAP2 = new IdentityHashMap<FontMetrics, Point.Float>(4);
154 //      private final static Font SUBST_FONT2 = new Font("sansserif", Font.PLAIN, 11);
155 //
156 //      public float getDialogUnit(boolean isHor)
157 //      {
158 //              Font font = c.getFont();
159 //              FontMetrics fm = c.getFontMetrics(font != null ? font : SUBST_FONT2);
160 //              Point.Float dluP = FM_MAP2.get(fm);
161 //              if (dluP == null) {
162 //                      float w = fm.charWidth('X') / 4f;
163 //                      int ascent = fm.getAscent();
164 //                      float h = (ascent > 14 ? ascent : ascent + (15 - ascent) / 3) / 8f;
165 //
166 //                      dluP = new Point.Float(w, h);
167 //                      FM_MAP2.put(fm, dluP);
168 //              }
169 //              return isHor ? dluP.x : dluP.y;
170 //      }
171
172         @Override
173         public final int getX()
174         {
175                 return c.getX();
176         }
177
178         @Override
179         public final int getY()
180         {
181                 return c.getY();
182         }
183
184         @Override
185         public final int getHeight()
186         {
187                 return c.getHeight();
188         }
189
190         @Override
191         public final int getWidth()
192         {
193                 return c.getWidth();
194         }
195
196         @Override
197         public final int getScreenLocationX()
198         {
199                 Point p = new Point();
200                 SwingUtilities.convertPointToScreen(p, c);
201                 return p.x;
202         }
203
204         @Override
205         public final int getScreenLocationY()
206         {
207                 Point p = new Point();
208                 SwingUtilities.convertPointToScreen(p, c);
209                 return p.y;
210         }
211
212         @Override
213         public final int getMinimumHeight(int sz)
214         {
215                 if (prefCalled == false) {
216                         c.getPreferredSize(); // To defeat a bug where the minimum size is different before and after the first call to getPreferredSize();
217                         prefCalled = true;
218                 }
219                 return c.getMinimumSize().height;
220         }
221
222         @Override
223         public final int getMinimumWidth(int sz)
224         {
225                 System.out.println("SCW " + c.getName() + " " + c.getClass().getName() + " " + c.getMinimumSize() + " " + c.getPreferredSize() + " " + c.getMinimumSize());
226                 if (prefCalled == false) {
227                         c.getPreferredSize(); // To defeat a bug where the minimum size is different before and after the first call to getPreferredSize();
228                         prefCalled = true;
229                 }
230                 
231                 return c.getMinimumSize().width;
232         }
233         @Override
234         public final int getPreferredHeight(int sz)
235         {
236                 // If the component has not gotten size yet and there is a size hint, trick Swing to return a better height.
237                 if (c.getWidth() == 0 && c.getHeight() == 0 && sz != -1)
238                         c.setBounds(c.getX(), c.getY(), sz, 1);
239
240                 return c.getPreferredSize().height;
241         }
242
243         @Override
244         public final int getPreferredWidth(int sz)
245         {
246                 // If the component has not gotten size yet and there is a size hint, trick Swing to return a better height.
247                 if (c.getWidth() == 0 && c.getHeight() == 0 && sz != -1)
248                         c.setBounds(c.getX(), c.getY(), 1, sz);
249
250                 return c.getPreferredSize().width;
251         }
252
253         @Override
254         public final int getMaximumHeight(int sz)
255         {
256                 if (!isMaxSet(c))
257                         return Integer.MAX_VALUE;
258
259                 return c.getMaximumSize().height;
260         }
261
262         @Override
263         public final int getMaximumWidth(int sz)
264         {
265                 if (!isMaxSet(c))
266                         return Integer.MAX_VALUE;
267
268                 return c.getMaximumSize().width;
269         }
270
271
272         private boolean isMaxSet(Component c)
273         {
274                 return c.isMaximumSizeSet();
275         }
276
277         @Override
278         public final ContainerWrapper getParent()
279         {
280                 Container p = c.getParent();
281                 return p != null ? new SwingContainerWrapper(p) : null;
282         }
283
284     @Override
285     public final int getHorizontalScreenDPI() {
286         try {
287             return c.getToolkit().getScreenResolution();
288         } catch (HeadlessException ex) {
289             return PlatformDefaults.getDefaultDPI();
290         }
291     }
292
293         @Override
294         public final int getVerticalScreenDPI()
295         {
296         try {
297             return c.getToolkit().getScreenResolution();
298         } catch (HeadlessException ex) {
299             return PlatformDefaults.getDefaultDPI();
300         }
301         }
302
303         @Override
304         public final int getScreenWidth()
305         {
306                 try {
307                         return c.getToolkit().getScreenSize().width;
308                 } catch (HeadlessException ex) {
309                         return 1024;
310                 }
311         }
312
313         @Override
314         public final int getScreenHeight()
315         {
316                 try {
317                         return c.getToolkit().getScreenSize().height;
318                 } catch (HeadlessException ex) {
319                         return 768;
320                 }
321         }
322
323         @Override
324         public final boolean hasBaseline()
325         {
326                 if (bl == null) {
327                         try {
328                                 // Removed since OTHER is sometimes returned even though there is a valid baseline (e.g. an empty JComboBox)
329 //                              if (c.getBaselineResizeBehavior() == Component.BaselineResizeBehavior.OTHER) {
330 //                                      bl = Boolean.FALSE;
331 //                              } else {
332                                         // Removed since it made some components layout themselves to the minimum size and that stuck after that. E.g. JLabel with HTML content and white spaces would be very tall.
333 //                                      Dimension d = c.getPreferredSize();
334 //                                      bl = getBaseline(d.width, d.height) > -1;
335                                         bl = getBaseline(8192, 8192) > -1;  // Use large number but don't risk overflow or exposing size bugs with Integer.MAX_VALUE
336 //                              }
337                         } catch (Throwable ex) {
338                                 bl = Boolean.FALSE;
339                         }
340                 }
341                 return bl;
342         }
343
344         @Override
345         public final String getLinkId()
346         {
347                 return c.getName();
348         }
349
350         @Override
351         public final void setBounds(int x, int y, int width, int height)
352         {
353                 c.setBounds(x, y, width, height);
354         }
355
356         @Override
357         public boolean isVisible()
358         {
359                 return c.isVisible();
360         }
361
362         @Override
363         public final int[] getVisualPadding()
364         {
365                 int[] padding = null;
366                 if (isVisualPaddingEnabled()) {
367                         //First try "visualPadding" client property
368                         if (c instanceof JComponent) {
369                                 JComponent component = (JComponent) c;
370                                 Object padValue = component.getClientProperty(VISUAL_PADDING_PROPERTY);
371
372                                 if (padValue instanceof int[] ) {
373                                         //client property value could be an int[]
374                                         padding = (int[]) padValue;
375                                 } else if (padValue instanceof Insets) {
376                                         //OR client property value could be an Insets
377                                         Insets padInsets = (Insets) padValue;
378                                         padding = new int[] { padInsets.top, padInsets.left, padInsets.bottom, padInsets.right };
379                                 }
380
381                                 if (padding == null) {
382                                         //No client property set on the individual JComponent,
383                                         //      so check for a LAF setting for the component type.
384                                         String classID;
385                                         switch (getComponentType(false)) {
386                                                 case TYPE_BUTTON:
387                                                         Border border = component.getBorder();
388                                                         if (border != null && border.getClass().getName().startsWith("com.apple.laf.AquaButtonBorder")) {
389                                                                 if (PlatformDefaults.getPlatform() == PlatformDefaults.MAC_OSX) {
390                                                                         Object buttonType = component.getClientProperty("JButton.buttonType");
391                                                                         if (buttonType == null) {
392                                                                                 classID = component.getHeight() < 33 ? "Button" : "Button.bevel";
393                                                                         } else {
394                                                                                 classID = "Button." + buttonType;
395                                                                         }
396                                                                         if (((AbstractButton) component).getIcon() != null)
397                                                                                 classID += ".icon";
398                                                                 } else {
399                                                                         classID = "Button";
400                                                                 }
401                                                         } else {
402                                                                 classID = "";
403                                                         }
404                                                         break;
405
406                                                 case TYPE_CHECK_BOX:
407                                                         border = component.getBorder();
408                                                         if (border != null && border.getClass().getName().startsWith("com.apple.laf.AquaButtonBorder")) {
409                                                                 Object size = component.getClientProperty("JComponent.sizeVariant");
410                                                                 if (size != null && size.toString().equals("regular") == false) {
411                                                                         size = "." + size;
412                                                                 } else {
413                                                                         size = "";
414                                                                 }
415
416                                                                 if (component instanceof JRadioButton) {
417                                                                         classID = "RadioButton" + size;
418                                                                 } else if (component instanceof JCheckBox) {
419                                                                         classID = "CheckBox" + size;
420                                                                 } else {
421                                                                         classID = "ToggleButton" + size;
422                                                                 }
423                                                         } else {
424                                                                 classID = "";
425                                                         }
426                                                         break;
427
428                                                 case TYPE_COMBO_BOX:
429                                                         if (PlatformDefaults.getPlatform() == PlatformDefaults.MAC_OSX) {
430                                                                 if (((JComboBox) component).isEditable()) {
431                                                                         Object isSquare = component.getClientProperty("JComboBox.isSquare");
432                                                                         if (isSquare != null && isSquare.toString().equals("true")) {
433                                                                                 classID = "ComboBox.editable.isSquare";
434                                                                         } else {
435                                                                                 classID = "ComboBox.editable";
436                                                                         }
437
438                                                                 } else {
439                                                                         Object isSquare = component.getClientProperty("JComboBox.isSquare");
440                                                                         Object isPopDown = component.getClientProperty("JComboBox.isPopDown");
441
442                                                                         if (isSquare != null && isSquare.toString().equals("true")) {
443                                                                                 classID = "ComboBox.isSquare";
444                                                                         } else if (isPopDown != null && isPopDown.toString().equals("true")) {
445                                                                                 classID = "ComboBox.isPopDown";
446                                                                         } else {
447                                                                                 classID = "ComboBox";
448                                                                         }
449                                                                 }
450                                                         } else {
451                                                                 classID = "ComboBox";
452                                                         }
453                                                         break;
454                                                 case TYPE_CONTAINER:
455                                                         classID = "Container";
456                                                         break;
457                                                 case TYPE_IMAGE:
458                                                         classID = "Image";
459                                                         break;
460                                                 case TYPE_LABEL:
461                                                         classID = "Label";
462                                                         break;
463                                                 case TYPE_LIST:
464                                                         classID = "List";
465                                                         break;
466                                                 case TYPE_PANEL:
467                                                         classID = "Panel";
468                                                         break;
469                                                 case TYPE_PROGRESS_BAR:
470                                                         classID = "ProgressBar";
471                                                         break;
472                                                 case TYPE_SCROLL_BAR:
473                                                         classID = "ScrollBar";
474                                                         break;
475                                                 case TYPE_SCROLL_PANE:
476                                                         classID = "ScrollPane";
477                                                         break;
478                                                 case TYPE_SEPARATOR:
479                                                         classID = "Separator";
480                                                         break;
481                                                 case TYPE_SLIDER:
482                                                         classID = "Slider";
483                                                         break;
484                                                 case TYPE_SPINNER:
485                                                         classID = "Spinner";
486                                                         break;
487                                                 case TYPE_TABLE:
488                                                         classID = "Table";
489                                                         break;
490                                                 case TYPE_TABBED_PANE:
491                                                         classID = "TabbedPane";
492                                                         break;
493                                                 case TYPE_TEXT_AREA:
494                                                         classID = "TextArea";
495                                                         break;
496                                                 case TYPE_TEXT_FIELD:
497                                                         border = component.getBorder();
498                                                         if (!component.isOpaque() && border != null && border.getClass().getSimpleName().equals("AquaTextFieldBorder")) {
499                                                                 classID = "TextField";
500                                                         } else {
501                                                                 classID = "";
502                                                         }
503                                                         break;
504                                                 case TYPE_TREE:
505                                                         classID = "Tree";
506                                                         break;
507                                                 case TYPE_UNKNOWN:
508                                                         classID = "Other";
509                                                         break;
510                                                 case TYPE_UNSET:
511                                                 default:
512                                                         classID = "";
513                                                         break;
514                                         }
515
516                                         padValue = PlatformDefaults.getDefaultVisualPadding(classID + "." + VISUAL_PADDING_PROPERTY);
517                                         if (padValue instanceof int[]) {
518                                                 //client property value could be an int[]
519                                                 padding = (int[]) padValue;
520                                         } else if (padValue instanceof Insets) {
521                                                 //OR client property value could be an Insets
522                                                 Insets padInsets = (Insets) padValue;
523                                                 padding = new int[] { padInsets.top, padInsets.left, padInsets.bottom, padInsets.right };
524                                         }
525                                 }
526                         }
527                 }
528                 return padding;
529         }
530
531         /**
532          * @deprecated Java 1.4 is not supported anymore
533          */
534         public static boolean isMaxSizeSetOn1_4()
535         {
536                 return maxSet;
537         }
538
539         /**
540          * @deprecated Java 1.4 is not supported anymore
541          */
542         public static void setMaxSizeSetOn1_4(boolean b)
543         {
544                 maxSet = b;
545         }
546
547         public static boolean isVisualPaddingEnabled()
548         {
549                 return vp;
550         }
551
552         public static void setVisualPaddingEnabled(boolean b)
553         {
554                 vp = b;
555         }
556
557         @Override
558         public final void paintDebugOutline(boolean showVisualPadding)
559         {
560                 if (c.isShowing() == false)
561                         return;
562
563                 Graphics2D g = (Graphics2D) c.getGraphics();
564                 if (g == null)
565                         return;
566
567                 g.setPaint(DB_COMP_OUTLINE);
568                 g.setStroke(new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10f, new float[] {2f, 4f}, 0));
569                 g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
570
571                 if (showVisualPadding && isVisualPaddingEnabled()) {
572                         int[] padding = getVisualPadding();
573                         if (padding != null) {
574                                 g.setColor(Color.GREEN);
575                                 g.drawRect(padding[1], padding[0], (getWidth() - 1) - (padding[1] + padding[3]), (getHeight() - 1) - (padding[0] + padding[2]));
576                         }
577                 }
578         }
579
580         @Override
581         public int getComponentType(boolean disregardScrollPane)
582         {
583                 if (compType == TYPE_UNSET)
584                         compType = checkType(disregardScrollPane);
585
586                 return compType;
587         }
588
589         @Override
590         public int getLayoutHashCode()
591         {
592                 Dimension d = c.getMaximumSize();
593                 int hash = d.width + (d.height << 5);
594
595                 d = c.getPreferredSize();
596                 hash += (d.width << 10) + (d.height << 15);
597
598                 d = c.getMinimumSize();
599                 hash += (d.width << 20) + (d.height << 25);
600
601                 if (c.isVisible())
602                         hash += 1324511;
603
604                 String id = getLinkId();
605                 if (id != null)
606                         hash += id.hashCode();
607
608                 return hash;
609         }
610
611         private int checkType(boolean disregardScrollPane)
612         {
613                 Component c = this.c;
614
615                 if (disregardScrollPane) {
616                         if (c instanceof JScrollPane) {
617                                 c = ((JScrollPane) c).getViewport().getView();
618                         } else if (c instanceof ScrollPane) {
619                                 c = ((ScrollPane) c).getComponent(0);
620                         }
621                 }
622
623                 if (c instanceof JTextField || c instanceof TextField) {
624                         return TYPE_TEXT_FIELD;
625                 } else if (c instanceof JLabel || c instanceof Label) {
626                         return TYPE_LABEL;
627                 } else if (c instanceof JCheckBox || c instanceof JRadioButton || c instanceof Checkbox) {
628                         return TYPE_CHECK_BOX;
629                 } else if (c instanceof AbstractButton || c instanceof Button) {
630                         return TYPE_BUTTON;
631                 } else if (c instanceof JComboBox || c instanceof Choice) {
632                         return TYPE_COMBO_BOX;
633                 } else if (c instanceof JTextComponent || c instanceof TextComponent) {
634                         return TYPE_TEXT_AREA;
635                 } else if (c instanceof JPanel || c instanceof Canvas) {
636                         return TYPE_PANEL;
637                 } else if (c instanceof JList || c instanceof List) {
638                         return TYPE_LIST;
639                 } else if (c instanceof JTable) {
640                         return TYPE_TABLE;
641                 } else if (c instanceof JSeparator) {
642                         return TYPE_SEPARATOR;
643                 } else if (c instanceof JSpinner) {
644                         return TYPE_SPINNER;
645                 } else if (c instanceof JTabbedPane) {
646                         return TYPE_TABBED_PANE;
647                 } else if (c instanceof JProgressBar) {
648                         return TYPE_PROGRESS_BAR;
649                 } else if (c instanceof JSlider) {
650                         return TYPE_SLIDER;
651                 } else if (c instanceof JScrollPane) {
652                         return TYPE_SCROLL_PANE;
653                 } else if (c instanceof JScrollBar || c instanceof Scrollbar) {
654                         return TYPE_SCROLL_BAR;
655                 } else if (c instanceof Container) {    // only AWT components is not containers.
656                         return TYPE_CONTAINER;
657                 }
658                 return TYPE_UNKNOWN;
659         }
660
661         @Override
662         public final int hashCode()
663         {
664                 return getComponent().hashCode();
665         }
666
667         @Override
668         public final boolean equals(Object o)
669         {
670                 if (o instanceof ComponentWrapper == false)
671                         return false;
672
673                 return c.equals(((ComponentWrapper) o).getComponent());
674         }
675
676         @Override
677         public int getContentBias()
678         {
679                 return c instanceof JTextArea || c instanceof JEditorPane || (c instanceof JComponent && Boolean.TRUE.equals(((JComponent)c).getClientProperty("migLayout.dynamicAspectRatio"))) ? LayoutUtil.HORIZONTAL : -1;
680         }
681 }