From f9d7e75101d7959bff17fcb7d76280362ef7fb8b Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Mon, 9 Jul 2018 17:00:06 +0300 Subject: [PATCH] cleanup --- .../com/intellij/uiDesigner/core/Util.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/platform/forms_rt/src/com/intellij/uiDesigner/core/Util.java b/platform/forms_rt/src/com/intellij/uiDesigner/core/Util.java index 819bc1564a6d..f8272486ca4e 100644 --- a/platform/forms_rt/src/com/intellij/uiDesigner/core/Util.java +++ b/platform/forms_rt/src/com/intellij/uiDesigner/core/Util.java @@ -22,19 +22,20 @@ public final class Util { private static final Dimension MAX_SIZE = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); public static final int DEFAULT_INDENT = 10; - public static Dimension getMinimumSize(final Component component, final GridConstraints constraints, final boolean addIndent){ + public static Dimension getMinimumSize(final Component component, final GridConstraints constraints, final boolean addIndent) { try { final Dimension size = getSize(constraints.myMinimumSize, component.getMinimumSize()); if (addIndent) { size.width += DEFAULT_INDENT * constraints.getIndent(); } return size; - } catch (NullPointerException npe) { //IDEA-80722 - return new Dimension(0,0); + } + catch (NullPointerException npe) { //IDEA-80722 + return new Dimension(0, 0); } } - public static Dimension getMaximumSize(final Component component, final GridConstraints constraints, final boolean addIndent){ + public static Dimension getMaximumSize(final GridConstraints constraints, final boolean addIndent) { try { //[anton] we use only our property for maximum size. // JButton reports that its max size = pref size, so it is impossible to make a column of same sized buttons. @@ -46,7 +47,7 @@ public final class Util { return size; } catch (NullPointerException e) {//IDEA-80722 - return new Dimension(0,0); + return new Dimension(0, 0); } } @@ -59,11 +60,11 @@ public final class Util { return size; } catch (NullPointerException e) {//IDEA-80722 - return new Dimension(0,0); + return new Dimension(0, 0); } } - private static Dimension getSize(final Dimension overridenSize, final Dimension ownSize){ + private static Dimension getSize(final Dimension overridenSize, final Dimension ownSize) { final int overridenWidth = overridenSize.width >= 0 ? overridenSize.width : ownSize.width; final int overridenHeight = overridenSize.height >= 0 ? overridenSize.height : ownSize.height; return new Dimension(overridenWidth, overridenHeight); @@ -71,7 +72,7 @@ public final class Util { public static void adjustSize(final Component component, final GridConstraints constraints, final Dimension size) { final Dimension minimumSize = getMinimumSize(component, constraints, false); - final Dimension maximumSize = getMaximumSize(component, constraints, false); + final Dimension maximumSize = getMaximumSize(constraints, false); size.width = Math.max(size.width, minimumSize.width); size.height = Math.max(size.height, minimumSize.height); @@ -81,25 +82,24 @@ public final class Util { } /** - * - * @param elimitated output parameter; will be filled indices (Integers) of eliminated cells. May be null. + * @param elimitated output parameter; will be filled indices (Integers) of eliminated cells. May be null. * @return - */ + */ public static int eliminate(final int[] cellIndices, final int[] spans, final ArrayList elimitated) { final int size = cellIndices.length; - if (size != spans.length){ + if (size != spans.length) { throw new IllegalArgumentException("size mismatch: " + size + ", " + spans.length); } if (elimitated != null && elimitated.size() != 0) { throw new IllegalArgumentException("eliminated must be empty"); } - + int cellCount = 0; for (int i = 0; i < size; i++) { cellCount = Math.max(cellCount, cellIndices[i] + spans[i]); } - outer: for (int cell=cellCount - 1; cell >= 0; cell--) { + for (int cell = cellCount - 1; cell >= 0; cell--) { // check if we should eliminate cell boolean starts = false; @@ -118,10 +118,10 @@ public final class Util { continue; } - if (elimitated != null){ + if (elimitated != null) { elimitated.add(new Integer(cell)); } - + // eliminate cell for (int i = 0; i < size; i++) { final boolean decreaseSpan = cellIndices[i] <= cell && cell < cellIndices[i] + spans[i];