bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected void paintSafely(Graphics g) { Caret caret = textComponent.getCaret(); Highlighter highlighter = textComponent.getHighlighter(); if (textComponent.isOpaque()) paintBackground(g); if (highlighter != null && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) highlighter.paint(g); rootView.paint(g, getVisibleEditorRect()); if (caret != null && textComponent.hasFocus()) caret.paint(g); }
|
protected void paintSafely(Graphics g) { Caret caret = textComponent.getCaret(); Highlighter highlighter = textComponent.getHighlighter(); if (textComponent.isOpaque()) paintBackground(g); if (highlighter != null && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) highlighter.paint(g); rootView.paint(g, getVisibleEditorRect()); if (caret != null && textComponent.hasFocus()) caret.paint(g); }
| 7,408
|
protected final void setView(View view) { rootView.setView(view); view.setParent(rootView); textComponent.revalidate(); textComponent.repaint(); }
|
protected final void setView(View view) { rootView.setView(view); textComponent.revalidate(); textComponent.repaint(); }
| 7,410
|
public static void main(String[] args) { ParsedArguments cmdLine = HELP_INFO.parse(args); String key = ARG_KEY.getValue(cmdLine); String value = ARG_VALUE.getValue(cmdLine); System.getProperties().setProperty(key, value); }
|
public static void main(String[] args) throws SyntaxErrorException { ParsedArguments cmdLine = HELP_INFO.parse(args); String key = ARG_KEY.getValue(cmdLine); String value = ARG_VALUE.getValue(cmdLine); System.getProperties().setProperty(key, value); }
| 7,411
|
public void addElement(Object object) { list.add(object); fireIntervalAdded(this, list.size(), list.size()); }
|
public void addElement(Object object) { list.add(object); fireIntervalAdded(this, list.size() - 1, list.size()); }
| 7,413
|
public void removeAllElements() { int listSize = getSize(); list.clear(); fireIntervalAdded(this, 0, listSize - 1); }
|
public void removeAllElements() { int listSize = getSize(); list.clear(); fireIntervalAdded(this, 0, listSize - 1); }
| 7,414
|
protected void displayInfo(KeyEvent e, String s){ String charString, keyCodeString, modString, tmpString,isString,locString; char c = e.getKeyChar(); int keyCode = e.getKeyCode(); int modifiers = e.getModifiers(); int location = e.getKeyLocation(); if (Character.isISOControl(c)) { charString = "key character = " + "(an unprintable control character)"; } else { charString = "key character = '" + c + "'"; } keyCodeString = "key code = " + keyCode + " (" + KeyEvent.getKeyText(keyCode) + ")"; if(keyCode == KeyEvent.VK_PREVIOUS_CANDIDATE) { keyCodeString += " previous candidate "; } if(keyCode == KeyEvent.VK_DEAD_ABOVEDOT || keyCode == KeyEvent.VK_DEAD_ABOVERING || keyCode == KeyEvent.VK_DEAD_ACUTE || keyCode == KeyEvent.VK_DEAD_BREVE || keyCode == KeyEvent.VK_DEAD_CIRCUMFLEX ) { keyCodeString += " dead key "; } modString = "modifiers = " + modifiers; tmpString = KeyEvent.getKeyModifiersText(modifiers); if (tmpString.length() > 0) { modString += " (" + tmpString + ")"; } else { modString += " (no modifiers)"; } switch (location) { case KeyEvent.KEY_LOCATION_LEFT: locString = "location = " + location + " (LEFT)"; break; case KeyEvent.KEY_LOCATION_NUMPAD: locString = "location = " + location + " (NUM_PAD)"; break; case KeyEvent.KEY_LOCATION_RIGHT: locString = "location = " + location + " (RIGHT)"; break; case KeyEvent.KEY_LOCATION_STANDARD: locString = "location = " + location + " (STANDARD)"; break; default: locString = "location = " + location + " (UNKNOWN)"; break; } isString = "isKeys = isActionKey (" + e.isActionKey() + ")" + " isAltDown (" + e.isAltDown() + ")" + " isAltGraphDown (" + e.isAltGraphDown() + ")" + " isAltGraphDownLinux (" + isAltGr + ")" + " isControlDown (" + e.isControlDown() + ")" + " isMetaDown (" + e.isMetaDown() + ")" + " isShiftDown (" + e.isShiftDown() + ")"; String newline = "\n"; System.out.println(s + newline + " " + charString + newline + " " + keyCodeString + newline + " " + modString + newline + " " + locString + newline + " " + isString + newline); }
|
protected void displayInfo(KeyEvent e, String s){ String charString, keyCodeString, modString, tmpString,isString,locString; char c = e.getKeyChar(); int keyCode = e.getKeyCode(); int modifiers = e.getModifiers(); if (Character.isISOControl(c)) { charString = "key character = " + "(an unprintable control character)"; } else { charString = "key character = '" + c + "'"; } keyCodeString = "key code = " + keyCode + " (" + KeyEvent.getKeyText(keyCode) + ")"; if(keyCode == KeyEvent.VK_PREVIOUS_CANDIDATE) { keyCodeString += " previous candidate "; } if(keyCode == KeyEvent.VK_DEAD_ABOVEDOT || keyCode == KeyEvent.VK_DEAD_ABOVERING || keyCode == KeyEvent.VK_DEAD_ACUTE || keyCode == KeyEvent.VK_DEAD_BREVE || keyCode == KeyEvent.VK_DEAD_CIRCUMFLEX ) { keyCodeString += " dead key "; } modString = "modifiers = " + modifiers; tmpString = KeyEvent.getKeyModifiersText(modifiers); if (tmpString.length() > 0) { modString += " (" + tmpString + ")"; } else { modString += " (no modifiers)"; } switch (location) { case KeyEvent.KEY_LOCATION_LEFT: locString = "location = " + location + " (LEFT)"; break; case KeyEvent.KEY_LOCATION_NUMPAD: locString = "location = " + location + " (NUM_PAD)"; break; case KeyEvent.KEY_LOCATION_RIGHT: locString = "location = " + location + " (RIGHT)"; break; case KeyEvent.KEY_LOCATION_STANDARD: locString = "location = " + location + " (STANDARD)"; break; default: locString = "location = " + location + " (UNKNOWN)"; break; } isString = "isKeys = isActionKey (" + e.isActionKey() + ")" + " isAltDown (" + e.isAltDown() + ")" + " isAltGraphDown (" + e.isAltGraphDown() + ")" + " isAltGraphDownLinux (" + isAltGr + ")" + " isControlDown (" + e.isControlDown() + ")" + " isMetaDown (" + e.isMetaDown() + ")" + " isShiftDown (" + e.isShiftDown() + ")"; String newline = "\n"; System.out.println(s + newline + " " + charString + newline + " " + keyCodeString + newline + " " + modString + newline + " " + locString + newline + " " + isString + newline); }
| 7,416
|
protected void displayInfo(KeyEvent e, String s){ String charString, keyCodeString, modString, tmpString,isString,locString; char c = e.getKeyChar(); int keyCode = e.getKeyCode(); int modifiers = e.getModifiers(); int location = e.getKeyLocation(); if (Character.isISOControl(c)) { charString = "key character = " + "(an unprintable control character)"; } else { charString = "key character = '" + c + "'"; } keyCodeString = "key code = " + keyCode + " (" + KeyEvent.getKeyText(keyCode) + ")"; if(keyCode == KeyEvent.VK_PREVIOUS_CANDIDATE) { keyCodeString += " previous candidate "; } if(keyCode == KeyEvent.VK_DEAD_ABOVEDOT || keyCode == KeyEvent.VK_DEAD_ABOVERING || keyCode == KeyEvent.VK_DEAD_ACUTE || keyCode == KeyEvent.VK_DEAD_BREVE || keyCode == KeyEvent.VK_DEAD_CIRCUMFLEX ) { keyCodeString += " dead key "; } modString = "modifiers = " + modifiers; tmpString = KeyEvent.getKeyModifiersText(modifiers); if (tmpString.length() > 0) { modString += " (" + tmpString + ")"; } else { modString += " (no modifiers)"; } switch (location) { case KeyEvent.KEY_LOCATION_LEFT: locString = "location = " + location + " (LEFT)"; break; case KeyEvent.KEY_LOCATION_NUMPAD: locString = "location = " + location + " (NUM_PAD)"; break; case KeyEvent.KEY_LOCATION_RIGHT: locString = "location = " + location + " (RIGHT)"; break; case KeyEvent.KEY_LOCATION_STANDARD: locString = "location = " + location + " (STANDARD)"; break; default: locString = "location = " + location + " (UNKNOWN)"; break; } isString = "isKeys = isActionKey (" + e.isActionKey() + ")" + " isAltDown (" + e.isAltDown() + ")" + " isAltGraphDown (" + e.isAltGraphDown() + ")" + " isAltGraphDownLinux (" + isAltGr + ")" + " isControlDown (" + e.isControlDown() + ")" + " isMetaDown (" + e.isMetaDown() + ")" + " isShiftDown (" + e.isShiftDown() + ")"; String newline = "\n"; System.out.println(s + newline + " " + charString + newline + " " + keyCodeString + newline + " " + modString + newline + " " + locString + newline + " " + isString + newline); }
|
protected void displayInfo(KeyEvent e, String s){ String charString, keyCodeString, modString, tmpString,isString,locString; char c = e.getKeyChar(); int keyCode = e.getKeyCode(); int modifiers = e.getModifiers(); int location = e.getKeyLocation(); if (Character.isISOControl(c)) { charString = "key character = " + "(an unprintable control character)"; } else { charString = "key character = '" + c + "'"; } keyCodeString = "key code = " + keyCode + " (" + KeyEvent.getKeyText(keyCode) + ")"; if(keyCode == KeyEvent.VK_PREVIOUS_CANDIDATE) { keyCodeString += " previous candidate "; } if(keyCode == KeyEvent.VK_DEAD_ABOVEDOT || keyCode == KeyEvent.VK_DEAD_ABOVERING || keyCode == KeyEvent.VK_DEAD_ACUTE || keyCode == KeyEvent.VK_DEAD_BREVE || keyCode == KeyEvent.VK_DEAD_CIRCUMFLEX ) { keyCodeString += " dead key "; } modString = "modifiers = " + modifiers; tmpString = KeyEvent.getKeyModifiersText(modifiers); if (tmpString.length() > 0) { modString += " (" + tmpString + ")"; } else { modString += " (no modifiers)"; } switch (location) { case KeyEvent.KEY_LOCATION_LEFT: locString = "location = " + location + " (LEFT)"; break; case KeyEvent.KEY_LOCATION_NUMPAD: locString = "location = " + location + " (NUM_PAD)"; break; case KeyEvent.KEY_LOCATION_RIGHT: locString = "location = " + location + " (RIGHT)"; break; case KeyEvent.KEY_LOCATION_STANDARD: locString = "location = " + location + " (STANDARD)"; break; default: locString = "location = " + location + " (UNKNOWN)"; break; } isString = "isKeys = isActionKey (" + e.isActionKey() + ")" + " isAltDown (" + e.isAltDown() + ")" + " isAltGraphDown (" + e.isAltGraphDown() + ")" + " isAltGraphDownLinux (" + isAltGr + ")" + " isControlDown (" + e.isControlDown() + ")" + " isMetaDown (" + e.isMetaDown() + ")" + " isShiftDown (" + e.isShiftDown() + ")"; String newline = "\n"; System.out.println(s + newline + " " + charString + newline + " " + keyCodeString + newline + " " + modString + newline + " " + locString + newline + " " + isString + newline); }
| 7,417
|
protected void pop() throws EmptyStackException { if (prev == null) throw new EmptyStackException(); /* The order is important here, we must get the prev lock first, or deadlock could occur as callers usually get here following prev's next pointer, and thus obtain prev's lock before trying to get this lock. */ synchronized (prev) { prev.next = next; if (next != null) next.prev = prev; synchronized (this) { int i = next_out; while (i != next_in) { prev.postEvent(queue[i]); next_out = i; if (++i == queue.length) i = 0; } // Empty the queue so it can be reused next_in = 0; next_out = 0; // Tell our EventDispatchThread that it can end execution dispatchThread.interrupt (); dispatchThread = null; } } }
|
protected void pop() throws EmptyStackException { if (prev == null) throw new EmptyStackException(); /* The order is important here, we must get the prev lock first, or deadlock could occur as callers usually get here following prev's next pointer, and thus obtain prev's lock before trying to get this lock. */ synchronized (prev) { prev.next = next; if (next != null) next.prev = prev; synchronized (this) { int i = next_out; while (i != next_in) { prev.postEvent(queue[i]); next_out = i; if (++i == queue.length) i = 0; } // Empty the queue so it can be reused next_in = 0; next_out = 0; // Tell our EventDispatchThread that it can end execution ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue(); setShutdown(true); dispatchThread = null; } } }
| 7,418
|
protected void baselineLayout(int span, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(span, requirements[axis], childReqs[axis], offsets, spans); }
|
protected void baselineLayout(int span, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(span, requirements[axis], childReqs[axis], offsets, spans); }
| 7,420
|
protected void baselineLayout(int span, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(span, requirements[axis], childReqs[axis], offsets, spans); }
|
protected void baselineLayout(int span, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(span, requirements[axis], childReqs[axis], offsets, spans); }
| 7,421
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { if (sr == null) sr = new SizeRequirements(); sr.alignment = 0.5F; SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,422
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,423
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,424
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,425
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,426
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements baselineRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,427
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
| 7,428
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
| 7,429
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
| 7,430
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
| 7,431
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
| 7,432
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
|
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) { minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; } // Overflow check. if (minimum > Integer.MAX_VALUE) minimum = Integer.MAX_VALUE; if (preferred > Integer.MAX_VALUE) preferred = Integer.MAX_VALUE; if (maximum > Integer.MAX_VALUE) maximum = Integer.MAX_VALUE; result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; }
| 7,433
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,434
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,435
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,436
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,437
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements sr) { updateChildRequirements(axis); SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); float minLeft = 0; float minRight = 0; float prefLeft = 0; float prefRight = 0; float maxLeft = 0; float maxRight = 0; for (int i = 0; i < childReqs[axis].length; i++) { float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment; float myMinRight = childReqs[axis][i].minimum - myMinLeft; minLeft = Math.max(myMinLeft, minLeft); minRight = Math.max(myMinRight, minRight); float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment; float myPrefRight = childReqs[axis][i].preferred - myPrefLeft; prefLeft = Math.max(myPrefLeft, prefLeft); prefRight = Math.max(myPrefRight, prefRight); float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment; float myMaxRight = childReqs[axis][i].maximum - myMaxLeft; maxLeft = Math.max(myMaxLeft, maxLeft); maxRight = Math.max(myMaxRight, maxRight); } int minSize = (int) (minLeft + minRight); int prefSize = (int) (prefLeft + prefRight); int maxSize = (int) (maxLeft + maxRight); float align = prefLeft / (prefRight + prefLeft); if (Float.isNaN(align)) align = 0; res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; }
| 7,438
|
protected void childAllocation(int index, Rectangle a) { if (! isAllocationValid()) layout(a.width, a.height); a.x += offsets[X_AXIS][index]; a.y += offsets[Y_AXIS][index]; a.width = spans[X_AXIS][index]; a.height = spans[Y_AXIS][index]; }
|
protected void childAllocation(int index, Rectangle a) { if (! isAllocationValid()) layout(a.width, a.height); a.x += offsets[X_AXIS][index]; a.y += offsets[Y_AXIS][index]; a.width = spans[X_AXIS][index]; a.height = spans[Y_AXIS][index]; }
| 7,439
|
public float getAlignment(int axis) { float align; if (axis == myAxis) align = 0.5F; else { updateRequirements(axis); align = requirements[axis].alignment; } return align; }
|
public float getAlignment(int axis) { float align; if (axis == myAxis) align = 0.5F; else { updateRequirements(axis); align = requirements[axis].alignment; } return align; }
| 7,440
|
public float getAlignment(int axis) { float align; if (axis == myAxis) align = 0.5F; else { updateRequirements(axis); align = requirements[axis].alignment; } return align; }
|
public float getAlignment(int axis) { float align; if (axis == myAxis) align = 0.5F; else { updateRequirements(axis); align = requirements[axis].alignment; } return align; }
| 7,441
|
public int getHeight() { return span[Y_AXIS]; }
|
public int getHeight() { return span[Y_AXIS] + getTopInset() - getBottomInset(); }
| 7,442
|
public float getMaximumSpan(int axis) { float max; if (axis == myAxis) max = getPreferredSpan(axis); else max = Integer.MAX_VALUE; return max; }
|
public float getMaximumSpan(int axis) { float max; if (axis == myAxis) max = getPreferredSpan(axis); else max = Integer.MAX_VALUE; return max; }
| 7,443
|
public float getMaximumSpan(int axis) { float max; if (axis == myAxis) max = getPreferredSpan(axis); else max = Integer.MAX_VALUE; return max; }
|
public float getMaximumSpan(int axis) { float max; if (axis == myAxis) max = getPreferredSpan(axis); else max = Integer.MAX_VALUE; return max; }
| 7,444
|
public float getMinimumSpan(int axis) { updateRequirements(axis); return requirements[axis].minimum; }
|
public float getMinimumSpan(int axis) { updateRequirements(axis); float margin; if (axis == X_AXIS) margin = getLeftInset() + getRightInset(); else margin = getTopInset() + getBottomInset(); return requirements[axis].minimum + margin; }
| 7,445
|
public float getPreferredSpan(int axis) { updateRequirements(axis); return requirements[axis].preferred; }
|
public float getPreferredSpan(int axis) { updateRequirements(axis); float margin; if (axis == X_AXIS) margin = getLeftInset() + getRightInset(); else margin = getTopInset() + getBottomInset(); return requirements[axis].preferred + margin; }
| 7,446
|
public int getWidth() { return span[X_AXIS]; }
|
public int getWidth() { return span[X_AXIS] + getLeftInset() - getRightInset(); }
| 7,447
|
protected boolean isAfter(int x, int y, Rectangle r) { boolean result = false; if (myAxis == X_AXIS) result = x > r.x; else result = y > r.y; return result; }
|
protected boolean isAfter(int x, int y, Rectangle r) { boolean result = false; if (myAxis == X_AXIS) result = x > r.x + r.width; else result = y > r.y; return result; }
| 7,448
|
protected boolean isAfter(int x, int y, Rectangle r) { boolean result = false; if (myAxis == X_AXIS) result = x > r.x; else result = y > r.y; return result; }
|
protected boolean isAfter(int x, int y, Rectangle r) { boolean result = false; if (myAxis == X_AXIS) result = x > r.x; else result = y > r.y + r.height; return result; }
| 7,449
|
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateTiledPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); }
|
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateTiledPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); }
| 7,450
|
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateTiledPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); }
|
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateTiledPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); }
| 7,451
|
protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); }
|
protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateChildRequirements(axis); updateRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); }
| 7,453
|
public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { // Make sure everything is allocated properly and then call super if (! isAllocationValid()) { Rectangle bounds = a.getBounds(); layout(bounds.width, bounds.height); } return super.modelToView(pos, a, bias); }
|
public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { // Make sure everything is allocated properly and then call super if (! isAllocationValid()) { Rectangle bounds = a.getBounds(); setSize(bounds.width, bounds.height); } return super.modelToView(pos, a, bias); }
| 7,454
|
public void paint(Graphics g, Shape a) { Rectangle inside = getInsideAllocation(a); // TODO: Used for debugging. //g.drawRect(inside.x, inside.y, inside.width, inside.height); Rectangle copy = new Rectangle(inside); int count = getViewCount(); for (int i = 0; i < count; ++i) { copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); } }
|
public void paint(Graphics g, Shape a) { Rectangle alloc; if (a instanceof Rectangle) alloc = (Rectangle) a; else alloc = a.getBounds(); // TODO: Used for debugging. //g.drawRect(inside.x, inside.y, inside.width, inside.height); Rectangle copy = new Rectangle(inside); int count = getViewCount(); for (int i = 0; i < count; ++i) { copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); } }
| 7,455
|
public void paint(Graphics g, Shape a) { Rectangle inside = getInsideAllocation(a); // TODO: Used for debugging. //g.drawRect(inside.x, inside.y, inside.width, inside.height); Rectangle copy = new Rectangle(inside); int count = getViewCount(); for (int i = 0; i < count; ++i) { copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); } }
|
public void paint(Graphics g, Shape a) { Rectangle inside = getInsideAllocation(a); // TODO: Used for debugging. //g.drawRect(inside.x, inside.y, inside.width, inside.height); int x = alloc.x + getLeftInset(); int y = alloc.y + getTopInset(); Rectangle clip = g.getClipBounds(); Rectangle tmp = new Rectangle(); int count = getViewCount(); for (int i = 0; i < count; ++i) { copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); } }
| 7,456
|
public void paint(Graphics g, Shape a) { Rectangle inside = getInsideAllocation(a); // TODO: Used for debugging. //g.drawRect(inside.x, inside.y, inside.width, inside.height); Rectangle copy = new Rectangle(inside); int count = getViewCount(); for (int i = 0; i < count; ++i) { copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); } }
|
public void paint(Graphics g, Shape a) { Rectangle inside = getInsideAllocation(a); // TODO: Used for debugging. //g.drawRect(inside.x, inside.y, inside.width, inside.height); Rectangle copy = new Rectangle(inside); int count = getViewCount(); for (int i = 0; i < count; ++i) { copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); } }
| 7,457
|
public void replace(int offset, int length, View[] views) { int numViews = 0; if (views != null) numViews = views.length; // Resize and copy data for cache arrays. // The spansX cache. int oldSize = getViewCount(); int[] newSpansX = new int[oldSize - length + numViews]; System.arraycopy(spans[X_AXIS], 0, newSpansX, 0, offset); System.arraycopy(spans[X_AXIS], offset + length, newSpansX, offset + numViews, oldSize - (offset + length)); spans[X_AXIS] = newSpansX; // The spansY cache. int[] newSpansY = new int[oldSize - length + numViews]; System.arraycopy(spans[Y_AXIS], 0, newSpansY, 0, offset); System.arraycopy(spans[Y_AXIS], offset + length, newSpansY, offset + numViews, oldSize - (offset + length)); spans[Y_AXIS] = newSpansY; // The offsetsX cache. int[] newOffsetsX = new int[oldSize - length + numViews]; System.arraycopy(offsets[X_AXIS], 0, newOffsetsX, 0, offset); System.arraycopy(offsets[X_AXIS], offset + length, newOffsetsX, offset + numViews, oldSize - (offset + length)); offsets[X_AXIS] = newOffsetsX; // The offsetsY cache. int[] newOffsetsY = new int[oldSize - length + numViews]; System.arraycopy(offsets[Y_AXIS], 0, newOffsetsY, 0, offset); System.arraycopy(offsets[Y_AXIS], offset + length, newOffsetsY, offset + numViews, oldSize - (offset + length)); offsets[Y_AXIS] = newOffsetsY; // Actually perform the replace. super.replace(offset, length, views); // Invalidate layout information. layoutChanged(X_AXIS); layoutChanged(Y_AXIS); }
|
public void replace(int offset, int length, View[] views) { int numViews = 0; if (views != null) numViews = views.length; // Resize and copy data for cache arrays. // The spansX cache. int oldSize = getViewCount(); int[] newSpansX = new int[oldSize - length + numViews]; System.arraycopy(spans[X_AXIS], 0, newSpansX, 0, offset); System.arraycopy(spans[X_AXIS], offset + length, newSpansX, offset + numViews, oldSize - (offset + length)); spans[X_AXIS] = newSpansX; // The spansY cache. int[] newSpansY = new int[oldSize - length + numViews]; System.arraycopy(spans[Y_AXIS], 0, newSpansY, 0, offset); System.arraycopy(spans[Y_AXIS], offset + length, newSpansY, offset + numViews, oldSize - (offset + length)); spans[Y_AXIS] = newSpansY; // The offsetsX cache. int[] newOffsetsX = new int[oldSize - length + numViews]; System.arraycopy(offsets[X_AXIS], 0, newOffsetsX, 0, offset); System.arraycopy(offsets[X_AXIS], offset + length, newOffsetsX, offset + numViews, oldSize - (offset + length)); offsets[X_AXIS] = newOffsetsX; // The offsetsY cache. int[] newOffsetsY = new int[oldSize - length + numViews]; System.arraycopy(offsets[Y_AXIS], 0, newOffsetsY, 0, offset); System.arraycopy(offsets[Y_AXIS], offset + length, newOffsetsY, offset + numViews, oldSize - (offset + length)); offsets[Y_AXIS] = newOffsetsY; // Actually perform the replace. super.replace(offset, length, views); // Invalidate layout information. layoutChanged(X_AXIS); layoutChanged(Y_AXIS); }
| 7,459
|
public void setSize(float width, float height) { layout((int) width, (int) height); }
|
public void setSize(float width, float height) { layout((int) (width - getLeftInset() - getRightInset()), (int) (height - getTopInset() - getBottomInset())); }
| 7,460
|
private void updateRequirements(int axis) { if (! layoutValid[axis]) { if (axis == myAxis) requirements[axis] = calculateMajorAxisRequirements(axis, requirements[axis]); else requirements[axis] = calculateMinorAxisRequirements(axis, requirements[axis]); } }
|
private void updateRequirements(int axis) { if (axis != Y_AXIS && axis != X_AXIS) throw new IllegalArgumentException("Illegal axis: " + axis); if (! requirementsValid[axis]) { if (axis == myAxis) requirements[axis] = calculateMajorAxisRequirements(axis, requirements[axis]); else requirements[axis] = calculateMinorAxisRequirements(axis, requirements[axis]); } }
| 7,461
|
AttributedString(String str){ sci = new StringCharacterIterator(str); attribs = new AttributeRange[0];}
|
AttributedString(String str){ sci = new StringCharacterIterator(str); attribs = new AttributeRange[0];}
| 7,463
|
addAttribute(AttributedCharacterIterator.Attribute attrib, Object value){ addAttribute(attrib, value, 0, sci.getEndIndex());}
|
addAttribute(AttributedCharacterIterator.Attribute attrib, Object value){ addAttribute(attrib, value, 0, sci.getEndIndex());}
| 7,464
|
addAttributes(Map attributes, int begin_index, int end_index){ if (attributes == null) throw new IllegalArgumentException("null attribute"); if ((begin_index < 0) || (end_index > sci.getEndIndex()) || (end_index < begin_index)) throw new IllegalArgumentException("bad range"); AttributeRange[] new_list = new AttributeRange[attribs.length + 1]; System.arraycopy(attribs, 0, new_list, 0, attribs.length); attribs = new_list; attribs[attribs.length - 1] = new AttributeRange(attributes, begin_index, end_index);}
|
addAttributes(Map attributes, int begin_index, int end_index){ if (attributes == null) throw new IllegalArgumentException("null attribute"); if ((begin_index < 0) || (end_index > sci.getEndIndex()) || (end_index < begin_index)) throw new IllegalArgumentException("bad range"); AttributeRange[] new_list = new AttributeRange[attribs.length + 1]; System.arraycopy(attribs, 0, new_list, 0, attribs.length); attribs = new_list; attribs[attribs.length - 1] = new AttributeRange(attributes, begin_index, end_index);}
| 7,465
|
getIterator(){ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null));}
|
getIterator(){ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null));}
| 7,466
|
private static void createFields(VmType< ? > cls, FieldData[] fieldDatas, VmSharedStatics sharedStatics, VmIsolatedStatics isolatedStatics, int slotSize, int pragmaFlags) { final int fcount = fieldDatas.length; final VmField[] ftable = new VmField[fcount]; int objectSize = 0; for (int i = 0; i < fcount; i++) { final FieldData fd = fieldDatas[i]; final boolean wide; int modifiers = fd.modifiers; final String name = fd.name; final String signature = fd.signature; switch (signature.charAt(0)) { case 'J': case 'D': modifiers = modifiers | Modifier.ACC_WIDE; wide = true; break; default: wide = false; } final boolean isstatic = (modifiers & Modifier.ACC_STATIC) != 0; final int staticsIdx; final VmField fs; final VmStatics statics; if (isstatic) { // Determine if the static field should be shared. final boolean shared = cls.isSharedStatics(); if (shared) { statics = sharedStatics; } else { statics = isolatedStatics; } // If static allocate space for it. switch (signature.charAt(0)) { case 'B': staticsIdx = statics.allocIntField(); break; case 'C': staticsIdx = statics.allocIntField(); break; case 'D': staticsIdx = statics.allocLongField(); break; case 'F': staticsIdx = statics.allocIntField(); break; case 'I': staticsIdx = statics.allocIntField(); break; case 'J': staticsIdx = statics.allocLongField(); break; case 'S': staticsIdx = statics.allocIntField(); break; case 'Z': staticsIdx = statics.allocIntField(); break; default: { if (Modifier.isAddressType(signature)) { staticsIdx = statics.allocAddressField(); } else { staticsIdx = statics.allocObjectField(); // System.out.println(NumberUtils.hex(staticsIdx) // + "\t" + cls.getName() + "." + name); } } break; } fs = new VmStaticField(name, signature, modifiers, staticsIdx, cls, slotSize, shared); } else { staticsIdx = -1; statics = null; final int fieldOffset; // Set the offset (keep in mind that this will be fixed // by ClassResolver with respect to the objectsize of the // super-class. fieldOffset = objectSize; // Increment the objectSize if (wide) objectSize += 8; else if (Modifier.isPrimitive(signature)) { objectSize += 4; } else { objectSize += slotSize; } fs = new VmInstanceField(name, signature, modifiers, fieldOffset, cls, slotSize); } ftable[i] = fs; // Read field attributes final VmAnnotation[] rVisAnn = fd.rVisAnn; if (isstatic && (fd.constantValue != null)) { switch (signature.charAt(0)) { case 'B': case 'C': case 'I': case 'S': case 'Z': statics.setInt(staticsIdx, ((VmConstInt) fd.constantValue) .intValue()); break; case 'D': final long lval = Double .doubleToRawLongBits(((VmConstDouble) fd.constantValue) .doubleValue()); statics.setLong(staticsIdx, lval); break; case 'F': final int ival = Float .floatToRawIntBits(((VmConstFloat) fd.constantValue) .floatValue()); statics.setInt(staticsIdx, ival); break; case 'J': statics.setLong(staticsIdx, ((VmConstLong) fd.constantValue).longValue()); break; default: // throw new IllegalArgumentException("signature " // + signature); statics.setObject(staticsIdx, (VmConstString) fd.constantValue); break; } } fs.setRuntimeAnnotations(rVisAnn); } // Align the instance fields for minimal object size. if ((pragmaFlags & TypePragmaFlags.NO_FIELD_ALIGNMENT) == 0) { final int alignedObjectSize = alignInstanceFields(ftable, slotSize); objectSize = alignedObjectSize; } cls.setFieldTable(ftable); if (objectSize > 0) { ((VmNormalClass< ? >) cls).setObjectSize(objectSize); } }
|
private static void createFields(VmType< ? > cls, FieldData[] fieldDatas, VmSharedStatics sharedStatics, VmIsolatedStatics isolatedStatics, int slotSize, int pragmaFlags) { final int fcount = fieldDatas.length; final VmField[] ftable = new VmField[fcount]; int objectSize = 0; for (int i = 0; i < fcount; i++) { final FieldData fd = fieldDatas[i]; final boolean wide; int modifiers = fd.modifiers; final String name = fd.name; final String signature = fd.signature; switch (signature.charAt(0)) { case 'J': case 'D': modifiers = modifiers | Modifier.ACC_WIDE; wide = true; break; default: wide = false; } final boolean isstatic = (modifiers & Modifier.ACC_STATIC) != 0; final int staticsIdx; final VmField fs; final VmStatics statics; if (isstatic) { // Determine if the static field should be shared. final boolean shared = cls.isSharedStatics(); if (shared) { statics = sharedStatics; } else { statics = isolatedStatics; } // If static allocate space for it. switch (signature.charAt(0)) { case 'B': staticsIdx = statics.allocIntField(); break; case 'C': staticsIdx = statics.allocIntField(); break; case 'D': staticsIdx = statics.allocLongField(); break; case 'F': staticsIdx = statics.allocIntField(); break; case 'I': staticsIdx = statics.allocIntField(); break; case 'J': staticsIdx = statics.allocLongField(); break; case 'S': staticsIdx = statics.allocIntField(); break; case 'Z': staticsIdx = statics.allocIntField(); break; default: { if (Modifier.isAddressType(signature)) { staticsIdx = statics.allocAddressField(); } else { staticsIdx = statics.allocObjectField(); // System.out.println(NumberUtils.hex(staticsIdx) // + "\t" + cls.getName() + "." + name); } } break; } fs = new VmStaticField(name, signature, modifiers, staticsIdx, cls, slotSize, shared); } else { staticsIdx = -1; statics = null; final int fieldOffset; // Set the offset (keep in mind that this will be fixed // by ClassResolver with respect to the objectsize of the // super-class. fieldOffset = objectSize; // Increment the objectSize if (wide) objectSize += 8; else if (Modifier.isPrimitive(signature)) { objectSize += 4; } else { objectSize += slotSize; } fs = new VmInstanceField(name, signature, modifiers, fieldOffset, cls, slotSize); } ftable[i] = fs; // Read field attributes final VmAnnotation[] rVisAnn = fd.rVisAnn; if (isstatic && (fd.constantValue != null)) { switch (signature.charAt(0)) { case 'B': case 'C': case 'I': case 'S': case 'Z': statics.setInt(staticsIdx, ((VmConstInt) fd.constantValue) .intValue()); break; case 'D': final long lval = Double .doubleToRawLongBits(((VmConstDouble) fd.constantValue) .doubleValue()); statics.setLong(staticsIdx, lval); break; case 'F': final int ival = Float .floatToRawIntBits(((VmConstFloat) fd.constantValue) .floatValue()); statics.setInt(staticsIdx, ival); break; case 'J': statics.setLong(staticsIdx, ((VmConstLong) fd.constantValue).longValue()); break; default: // throw new IllegalArgumentException("signature " // + signature); statics.setObject(staticsIdx, (VmConstString) fd.constantValue); break; } } fs.setRuntimeAnnotations(rVisAnn); } // Align the instance fields for minimal object size. if ((pragmaFlags & TypePragmaFlags.NO_FIELD_ALIGNMENT) == 0) { final int alignedObjectSize = alignInstanceFields(ftable, slotSize); objectSize = alignedObjectSize; } cls.setFieldTable(ftable); if (objectSize > 0) { ((VmNormalClass< ? >) cls).setObjectSize(objectSize); } }
| 7,467
|
public static final VmType defineClass(String className, ByteBuffer data, boolean rejectNatives, VmClassLoader clc, ProtectionDomain protectionDomain) { cl_init(); final VmType cls = decodeClass(data, rejectNatives, clc, protectionDomain); return cls; }
|
public static final VmType defineClass(String className, ByteBuffer data, boolean rejectNatives, VmClassLoader clc, ProtectionDomain protectionDomain) { cl_init(); final VmType cls = decodeClass(data, rejectNatives, clc, protectionDomain); return cls; }
| 7,468
|
protected void setInt(int index, int data) { set(index, new Integer(data)); }
|
protected void setInt(int index, int data) { set(index, new VmConstInt(data)); }
| 7,469
|
protected void setFloat(int index, float data) { set(index, new Float(data)); }
|
protected void setFloat(int index, float data) { set(index, new VmConstFloat(data)); }
| 7,470
|
protected void setLong(int index, long data) { set(index, new Long(data)); }
|
protected void setLong(int index, long data) { set(index, new VmConstLong(data)); }
| 7,471
|
protected void setDouble(int index, double data) { set(index, new Double(data)); }
|
protected void setDouble(int index, double data) { set(index, new VmConstDouble(data)); }
| 7,472
|
public int getInt(int index) { if (index == 0) return 0; else return ((Integer) get(index)).intValue(); }
|
public int getInt(int index) { if (index == 0) return 0; else return ((VmConstInt) get(index)).intValue(); }
| 7,473
|
public double getDouble(int index) { return ((Double) get(index)).doubleValue(); }
|
public double getDouble(int index) { return ((VmConstDouble) get(index)).doubleValue(); }
| 7,474
|
public float getFloat(int index) { return ((Float) get(index)).floatValue(); }
|
public float getFloat(int index) { return ((VmConstFloat) get(index)).floatValue(); }
| 7,475
|
public long getLong(int index) { return ((Long) get(index)).longValue(); }
|
public long getLong(int index) { return ((VmConstLong) get(index)).longValue(); }
| 7,476
|
public PaneButton(Action a) { super(a); setMargin(new Insets(0, 0, 0, 0)); setBorder(null); }
|
public PaneButton(Action a) { super(a); setMargin(new Insets(0, 0, 0, 0)); }
| 7,477
|
public void propertyChange(PropertyChangeEvent evt) { // The title and frameIcon are taken care of during painting time. // The only other thing this will care about are the "is----izable" // properties. So we call enable actions to properly handle the // buttons and menu items for us. enableActions(); }
|
public void propertyChange(PropertyChangeEvent evt) { // The title and frameIcon are taken care of during painting time. // The only other thing this will care about are the "is----izable" // properties. So we call enable actions to properly handle the // buttons and menu items for us. String propName = evt.getPropertyName(); if (propName.equals("closable")) { if (evt.getNewValue().equals(Boolean.TRUE)) closeButton.setVisible(true); else closeButton.setVisible(false); } else if (propName.equals("iconifiable")) { if (evt.getNewValue().equals(Boolean.TRUE)) iconButton.setVisible(true); else iconButton.setVisible(false); } else if (propName.equals("maximizable")) { if (evt.getNewValue().equals(Boolean.TRUE)) maxButton.setVisible(true); else maxButton.setVisible(false); } }
| 7,478
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { Dimension size = c.getSize(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,479
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,480
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left - 1; int top = insets.top + 1; int buttonWidth = height - 2; int buttonHeight = height - 4; if (closeButton.isVisible()) { loc -= buttonWidth + 2; closeButton.setBounds(loc, top, buttonWidth, buttonHeight); } Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,481
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,482
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,483
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,484
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (iconButton.isVisible()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,485
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,486
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
|
public void layoutContainer(Container c) { enableActions(); Insets insets = c.getInsets(); int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; // MenuBar is always present and located at the top left corner. Dimension menupref = menuBar.getPreferredSize(); menuBar.setBounds(insets.left, insets.top, menupref.width, height); int loc = width + insets.left; Insets i = closeButton.getInsets(); Dimension prefs = new Dimension(iconSize + i.left + i.right, iconSize + i.top + i.bottom); int top = insets.top + (height - prefs.height) / 2; if (closeAction.isEnabled()) { loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); } else closeButton.setVisible(false); if (maximizeAction.isEnabled()) { loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); } else maxButton.setVisible(false); if (iconifyAction.isEnabled()) { loc -= prefs.width; iconButton.setVisible(true); iconButton.setBounds(loc, top, prefs.width, prefs.height); } else iconButton.setVisible(false); if (title != null) title.setBounds(insets.left + menupref.width, insets.top, loc - menupref.width - insets.left, height); }
| 7,487
|
public Dimension preferredLayoutSize(Container c) { Insets frameInsets = frame.getInsets(); // Height is the max of the preferredHeights of all components // inside the pane int height = 0; int width = 0; Dimension d; Component[] components = BasicInternalFrameTitlePane.this.getComponents(); for (int i = 0; i < components.length; i++) { d = components[i].getPreferredSize(); height = Math.max(height, d.height); width += d.width; } Insets insets = BasicInternalFrameTitlePane.this.getInsets(); height += insets.top + insets.bottom; return new Dimension(width, height); }
|
public Dimension preferredLayoutSize(Container c) { Insets frameInsets = frame.getInsets(); // Height is the max of the preferredHeights of all components // inside the pane int height = 0; int width = 0; Dimension d; Component[] components = BasicInternalFrameTitlePane.this.getComponents(); for (int i = 0; i < components.length; i++) { d = components[i].getPreferredSize(); height = Math.max(height, d.height); width += d.width; } Insets insets = BasicInternalFrameTitlePane.this.getInsets(); height += insets.top + insets.bottom; return new Dimension(width, height); }
| 7,488
|
protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); }
|
protected void createButtons() { closeButton = new PaneButton(closeAction); if (!frame.isClosable()) closeButton.setVisible(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); }
| 7,490
|
protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); }
|
protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); if (!frame.isIconifiable()) iconButton.setVisible(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); }
| 7,491
|
protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); }
|
protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); if (!frame.isMaximizable()) maxButton.setVisible(false); }
| 7,492
|
protected void setButtonIcons() { if (closeButton != null) closeButton.setIcon(closeIcon); if (iconButton != null) iconButton.setIcon(iconIcon); if (maxButton != null) maxButton.setIcon(maxIcon); }
|
protected void setButtonIcons() { if (closeButton != null) closeButton.setIcon(closeIcon); if (iconButton != null) iconButton.setIcon(iconIcon); if (maxButton != null) maxButton.setIcon(maxIcon); }
| 7,493
|
public void mouseEntered(MouseEvent ev) { int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); setRolloverTab(tabIndex); }
|
public void mouseEntered(MouseEvent e) { int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); setRolloverTab(tabIndex); }
| 7,496
|
public void mouseEntered(MouseEvent ev) { int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); setRolloverTab(tabIndex); }
|
public void mouseEntered(MouseEvent ev) { Object s = e.getSource(); if (tabPane != e.getSource()) { redispatchEvent(e); e.setSource(s); } int tabIndex = tabForCoordinate(tabPane, e.getX(), e.getY()); setRolloverTab(tabIndex); }
| 7,497
|
public void mouseExited(MouseEvent ev) { setRolloverTab(-1); }
|
public void mouseExited(MouseEvent e) { setRolloverTab(-1); }
| 7,498
|
public void mousePressed(MouseEvent e) { if (tabPane.isEnabled()) { int index = tabForCoordinate(tabPane, e.getX(), e.getY()); if (index >= 0 && tabPane.isEnabledAt(index)) { tabPane.setSelectedIndex(index); } } }
|
public void mousePressed(MouseEvent e) { Object s = e.getSource(); if (tabPane != e.getSource()) { redispatchEvent(e); e.setSource(s); } int placement = tabPane.getTabPlacement(); if (s == incrButton) { if(!incrButton.isEnabled()) return; currentScrollLocation++; switch (placement) { case JTabbedPane.TOP: case JTabbedPane.BOTTOM: currentScrollOffset = getTabAreaInsets(placement).left; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].width; break; default: currentScrollOffset = getTabAreaInsets(placement).top; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].height; break; } updateViewPosition(); updateButtons(); tabPane.repaint(); } else if (s == decrButton) { if(!decrButton.isEnabled()) return; if (currentScrollLocation > 0) currentScrollLocation--; currentScrollOffset = 0; switch (placement) { case JTabbedPane.TOP: case JTabbedPane.BOTTOM: if (currentScrollLocation > 0) currentScrollOffset = getTabAreaInsets(placement).left; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].width; break; default: if (currentScrollLocation > 0) currentScrollOffset = getTabAreaInsets(placement).top; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].height; } updateViewPosition(); updateButtons(); tabPane.repaint(); } else if (tabPane.isEnabled()) { int index = tabForCoordinate(tabPane, e.getX(), e.getY()); if (index >= 0 && tabPane.isEnabledAt(index)) { tabPane.setSelectedIndex(index); } } }
| 7,501
|
public void mousePressed(MouseEvent e) { if (tabPane.isEnabled()) { int index = tabForCoordinate(tabPane, e.getX(), e.getY()); if (index >= 0 && tabPane.isEnabledAt(index)) { tabPane.setSelectedIndex(index); } } }
|
public void mousePressed(MouseEvent e) { if (tabPane.isEnabled()) { int index = tabForCoordinate(tabPane, e.getX(), e.getY()); if (!tabPane.isEnabledAt(index)) return; if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT && s == panel) { scrollTab(index, placement); tabPane.setSelectedIndex(index); tabPane.repaint(); } else { tabPane.setSelectedIndex(index); } } }
| 7,502
|
public void paint(Graphics g, JComponent c) { paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex()); }
|
public void paint(Graphics g, JComponent c) { int placement = tabPane.getTabPlacement(); g.setColor(highlight); if (placement == SwingUtilities.TOP || placement == SwingUtilities.BOTTOM) g.fillRect(currentScrollOffset, 0, tabAreaRect.width, tabAreaRect.height); else g.fillRect(0, currentScrollOffset, tabAreaRect.width, tabAreaRect.height); paintTabArea(g, placement, tabPane.getSelectedIndex()); }
| 7,503
|
public void updateUI() { setUI((PanelUI) new ScrollingPanelUI()); }
|
public void updateUI() { setUI(new ScrollingPanelUI()); }
| 7,504
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. int count = tabPane.getTabCount(); for (int i = 0; i < count; i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
| 7,506
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
| 7,507
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
| 7,508
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
| 7,509
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); width += tabAreaWidth; } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
|
protected Dimension calculateSize(boolean minimum) { int tabPlacement = tabPane.getTabPlacement(); int width = 0; int height = 0; Component c; Dimension dims; // Find out the minimum/preferred size to display the largest child // of the tabbed pane. for (int i = 0; i < tabPane.getTabCount(); i++) { c = tabPane.getComponentAt(i); if (c == null) continue; dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); width = Math.max(width, dims.width); } } Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int min = calculateMaxTabWidth(tabPlacement); width = Math.max(min, width); int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); height += tabAreaHeight; } else { int min = calculateMaxTabHeight(tabPlacement); height = Math.max(min, height); int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); } Insets tabPaneInsets = tabPane.getInsets(); return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right, height + tabPaneInsets.top + tabPaneInsets.bottom); }
| 7,510
|
protected void calculateTabRects(int tabPlacement, int tabCount) { Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); // The coordinates of the upper left corner of the tab area. int x; int y; // The location at which the runs must be broken. int breakAt; // Calculate the bounds for the tab area. switch (tabPlacement) { case LEFT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case RIGHT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = size.width - (insets.right + tabAreaInsets.right) - maxTabWidth; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case BOTTOM: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = size.height - (insets.bottom + tabAreaInsets.bottom) - maxTabHeight; breakAt = size.width - (insets.right + tabAreaInsets.right); break; case TOP: default: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.width - (insets.right + tabAreaInsets.right); break; } if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); runCount = 0; selectedRun = -1; int selectedIndex = tabPane.getSelectedIndex(); Rectangle rect; // Go through all the tabs and build the tab runs. if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.x = rects[i - 1].x + rects[i - 1].width; } else { tabRuns[0] = 0; runCount = 1; maxTabWidth = 0; rect.x = x; } rect.width = calculateTabWidth(tabPlacement, i, fm); maxTabWidth = Math.max(maxTabWidth, rect.width); if (rect.x != 2 + insets.left && rect.x + rect.width > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.x = x; } rect.y = y; rect.height = maxTabHeight; if (i == selectedIndex) selectedRun = runCount - 1; } } else { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.y = rects[i - 1].y + rects[i - 1].height; } else { tabRuns[0] = 0; runCount = 1; maxTabHeight = 0; rect.y = y; } rect.height = calculateTabHeight(tabPlacement, i, fm.getHeight()); maxTabHeight = Math.max(maxTabHeight, rect.height); if (rect.y != 2 + insets.top && rect.y + rect.height > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.y = y; } rect.x = x; rect.width = maxTabWidth; if (i == selectedIndex) selectedRun = runCount - 1; } } if (runCount > 1) { int start; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) start = y; else start = x; normalizeTabRuns(tabPlacement, tabCount, start, breakAt); selectedRun = getRunForTab(tabCount, selectedIndex); if (shouldRotateTabRuns(tabPlacement)) { rotateTabRuns(tabPlacement, selectedRun); } } // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) { int start = tabRuns[i]; int nextIndex; if (i == runCount - 1) nextIndex = 0; else nextIndex = i + 1; int next = tabRuns[nextIndex]; int end = next != 0 ? next - 1 : tabCount - 1; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.y = y; rect.x += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == BOTTOM) y -= maxTabHeight - tabRunOverlay; else y += maxTabHeight - tabRunOverlay; } else { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.x = x; rect.y += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == RIGHT) x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; } } padSelectedTab(tabPlacement, selectedIndex); }
|
protected void calculateTabRects(int tabPlacement, int tabCount) { Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); // The coordinates of the upper left corner of the tab area. int x; int y; // The location at which the runs must be broken. int breakAt; // Calculate the bounds for the tab area. switch (tabPlacement) { case LEFT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case RIGHT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = size.width - (insets.right + tabAreaInsets.right) - maxTabWidth - 1; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case BOTTOM: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = size.height - (insets.bottom + tabAreaInsets.bottom) - maxTabHeight; breakAt = size.width - (insets.right + tabAreaInsets.right); break; case TOP: default: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.width - (insets.right + tabAreaInsets.right); break; } if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); runCount = 0; selectedRun = -1; int selectedIndex = tabPane.getSelectedIndex(); Rectangle rect; // Go through all the tabs and build the tab runs. if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.x = rects[i - 1].x + rects[i - 1].width; } else { tabRuns[0] = 0; runCount = 1; maxTabWidth = 0; rect.x = x; } rect.width = calculateTabWidth(tabPlacement, i, fm); maxTabWidth = Math.max(maxTabWidth, rect.width); if (rect.x != 2 + insets.left && rect.x + rect.width > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.x = x; } rect.y = y; rect.height = maxTabHeight; if (i == selectedIndex) selectedRun = runCount - 1; } } else { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.y = rects[i - 1].y + rects[i - 1].height; } else { tabRuns[0] = 0; runCount = 1; maxTabHeight = 0; rect.y = y; } rect.height = calculateTabHeight(tabPlacement, i, fm.getHeight()); maxTabHeight = Math.max(maxTabHeight, rect.height); if (rect.y != 2 + insets.top && rect.y + rect.height > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.y = y; } rect.x = x; rect.width = maxTabWidth; if (i == selectedIndex) selectedRun = runCount - 1; } } if (runCount > 1) { int start; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) start = y; else start = x; normalizeTabRuns(tabPlacement, tabCount, start, breakAt); selectedRun = getRunForTab(tabCount, selectedIndex); if (shouldRotateTabRuns(tabPlacement)) { rotateTabRuns(tabPlacement, selectedRun); } } // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) { int start = tabRuns[i]; int nextIndex; if (i == runCount - 1) nextIndex = 0; else nextIndex = i + 1; int next = tabRuns[nextIndex]; int end = next != 0 ? next - 1 : tabCount - 1; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.y = y; rect.x += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == BOTTOM) y -= maxTabHeight - tabRunOverlay; else y += maxTabHeight - tabRunOverlay; } else { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.x = x; rect.y += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == RIGHT) x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; } } padSelectedTab(tabPlacement, selectedIndex); }
| 7,511
|
protected void calculateTabRects(int tabPlacement, int tabCount) { Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); // The coordinates of the upper left corner of the tab area. int x; int y; // The location at which the runs must be broken. int breakAt; // Calculate the bounds for the tab area. switch (tabPlacement) { case LEFT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case RIGHT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = size.width - (insets.right + tabAreaInsets.right) - maxTabWidth; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case BOTTOM: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = size.height - (insets.bottom + tabAreaInsets.bottom) - maxTabHeight; breakAt = size.width - (insets.right + tabAreaInsets.right); break; case TOP: default: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.width - (insets.right + tabAreaInsets.right); break; } if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); runCount = 0; selectedRun = -1; int selectedIndex = tabPane.getSelectedIndex(); Rectangle rect; // Go through all the tabs and build the tab runs. if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.x = rects[i - 1].x + rects[i - 1].width; } else { tabRuns[0] = 0; runCount = 1; maxTabWidth = 0; rect.x = x; } rect.width = calculateTabWidth(tabPlacement, i, fm); maxTabWidth = Math.max(maxTabWidth, rect.width); if (rect.x != 2 + insets.left && rect.x + rect.width > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.x = x; } rect.y = y; rect.height = maxTabHeight; if (i == selectedIndex) selectedRun = runCount - 1; } } else { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.y = rects[i - 1].y + rects[i - 1].height; } else { tabRuns[0] = 0; runCount = 1; maxTabHeight = 0; rect.y = y; } rect.height = calculateTabHeight(tabPlacement, i, fm.getHeight()); maxTabHeight = Math.max(maxTabHeight, rect.height); if (rect.y != 2 + insets.top && rect.y + rect.height > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.y = y; } rect.x = x; rect.width = maxTabWidth; if (i == selectedIndex) selectedRun = runCount - 1; } } if (runCount > 1) { int start; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) start = y; else start = x; normalizeTabRuns(tabPlacement, tabCount, start, breakAt); selectedRun = getRunForTab(tabCount, selectedIndex); if (shouldRotateTabRuns(tabPlacement)) { rotateTabRuns(tabPlacement, selectedRun); } } // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) { int start = tabRuns[i]; int nextIndex; if (i == runCount - 1) nextIndex = 0; else nextIndex = i + 1; int next = tabRuns[nextIndex]; int end = next != 0 ? next - 1 : tabCount - 1; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.y = y; rect.x += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == BOTTOM) y -= maxTabHeight - tabRunOverlay; else y += maxTabHeight - tabRunOverlay; } else { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.x = x; rect.y += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == RIGHT) x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; } } padSelectedTab(tabPlacement, selectedIndex); }
|
protected void calculateTabRects(int tabPlacement, int tabCount) { Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); // The coordinates of the upper left corner of the tab area. int x; int y; // The location at which the runs must be broken. int breakAt; // Calculate the bounds for the tab area. switch (tabPlacement) { case LEFT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case RIGHT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = size.width - (insets.right + tabAreaInsets.right) - maxTabWidth; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case BOTTOM: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = size.height - (insets.bottom + tabAreaInsets.bottom) - maxTabHeight - 1; breakAt = size.width - (insets.right + tabAreaInsets.right); break; case TOP: default: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.width - (insets.right + tabAreaInsets.right); break; } if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); runCount = 0; selectedRun = -1; int selectedIndex = tabPane.getSelectedIndex(); Rectangle rect; // Go through all the tabs and build the tab runs. if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.x = rects[i - 1].x + rects[i - 1].width; } else { tabRuns[0] = 0; runCount = 1; maxTabWidth = 0; rect.x = x; } rect.width = calculateTabWidth(tabPlacement, i, fm); maxTabWidth = Math.max(maxTabWidth, rect.width); if (rect.x != 2 + insets.left && rect.x + rect.width > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.x = x; } rect.y = y; rect.height = maxTabHeight; if (i == selectedIndex) selectedRun = runCount - 1; } } else { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.y = rects[i - 1].y + rects[i - 1].height; } else { tabRuns[0] = 0; runCount = 1; maxTabHeight = 0; rect.y = y; } rect.height = calculateTabHeight(tabPlacement, i, fm.getHeight()); maxTabHeight = Math.max(maxTabHeight, rect.height); if (rect.y != 2 + insets.top && rect.y + rect.height > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.y = y; } rect.x = x; rect.width = maxTabWidth; if (i == selectedIndex) selectedRun = runCount - 1; } } if (runCount > 1) { int start; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) start = y; else start = x; normalizeTabRuns(tabPlacement, tabCount, start, breakAt); selectedRun = getRunForTab(tabCount, selectedIndex); if (shouldRotateTabRuns(tabPlacement)) { rotateTabRuns(tabPlacement, selectedRun); } } // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) { int start = tabRuns[i]; int nextIndex; if (i == runCount - 1) nextIndex = 0; else nextIndex = i + 1; int next = tabRuns[nextIndex]; int end = next != 0 ? next - 1 : tabCount - 1; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.y = y; rect.x += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == BOTTOM) y -= maxTabHeight - tabRunOverlay; else y += maxTabHeight - tabRunOverlay; } else { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.x = x; rect.y += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == RIGHT) x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; } } padSelectedTab(tabPlacement, selectedIndex); }
| 7,512
|
protected void calculateTabRects(int tabPlacement, int tabCount) { Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); // The coordinates of the upper left corner of the tab area. int x; int y; // The location at which the runs must be broken. int breakAt; // Calculate the bounds for the tab area. switch (tabPlacement) { case LEFT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case RIGHT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = size.width - (insets.right + tabAreaInsets.right) - maxTabWidth; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case BOTTOM: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = size.height - (insets.bottom + tabAreaInsets.bottom) - maxTabHeight; breakAt = size.width - (insets.right + tabAreaInsets.right); break; case TOP: default: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.width - (insets.right + tabAreaInsets.right); break; } if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); runCount = 0; selectedRun = -1; int selectedIndex = tabPane.getSelectedIndex(); Rectangle rect; // Go through all the tabs and build the tab runs. if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.x = rects[i - 1].x + rects[i - 1].width; } else { tabRuns[0] = 0; runCount = 1; maxTabWidth = 0; rect.x = x; } rect.width = calculateTabWidth(tabPlacement, i, fm); maxTabWidth = Math.max(maxTabWidth, rect.width); if (rect.x != 2 + insets.left && rect.x + rect.width > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.x = x; } rect.y = y; rect.height = maxTabHeight; if (i == selectedIndex) selectedRun = runCount - 1; } } else { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.y = rects[i - 1].y + rects[i - 1].height; } else { tabRuns[0] = 0; runCount = 1; maxTabHeight = 0; rect.y = y; } rect.height = calculateTabHeight(tabPlacement, i, fm.getHeight()); maxTabHeight = Math.max(maxTabHeight, rect.height); if (rect.y != 2 + insets.top && rect.y + rect.height > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.y = y; } rect.x = x; rect.width = maxTabWidth; if (i == selectedIndex) selectedRun = runCount - 1; } } if (runCount > 1) { int start; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) start = y; else start = x; normalizeTabRuns(tabPlacement, tabCount, start, breakAt); selectedRun = getRunForTab(tabCount, selectedIndex); if (shouldRotateTabRuns(tabPlacement)) { rotateTabRuns(tabPlacement, selectedRun); } } // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) { int start = tabRuns[i]; int nextIndex; if (i == runCount - 1) nextIndex = 0; else nextIndex = i + 1; int next = tabRuns[nextIndex]; int end = next != 0 ? next - 1 : tabCount - 1; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.y = y; rect.x += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == BOTTOM) y -= maxTabHeight - tabRunOverlay; else y += maxTabHeight - tabRunOverlay; } else { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.x = x; rect.y += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == RIGHT) x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; } } padSelectedTab(tabPlacement, selectedIndex); }
|
protected void calculateTabRects(int tabPlacement, int tabCount) { Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); // The coordinates of the upper left corner of the tab area. int x; int y; // The location at which the runs must be broken. int breakAt; // Calculate the bounds for the tab area. switch (tabPlacement) { case LEFT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case RIGHT: maxTabWidth = calculateMaxTabWidth(tabPlacement); x = size.width - (insets.right + tabAreaInsets.right) - maxTabWidth; y = insets.top + tabAreaInsets.top; breakAt = size.height - (insets.bottom + tabAreaInsets.bottom); break; case BOTTOM: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = size.height - (insets.bottom + tabAreaInsets.bottom) - maxTabHeight; breakAt = size.width - (insets.right + tabAreaInsets.right); break; case TOP: default: maxTabHeight = calculateMaxTabHeight(tabPlacement); x = insets.left + tabAreaInsets.left; y = insets.top + tabAreaInsets.top; breakAt = size.width - (insets.right + tabAreaInsets.right); break; } if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); runCount = 0; selectedRun = -1; int selectedIndex = tabPane.getSelectedIndex(); Rectangle rect; // Go through all the tabs and build the tab runs. if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.x = rects[i - 1].x + rects[i - 1].width; } else { tabRuns[0] = 0; runCount = 1; maxTabWidth = 0; rect.x = x; } rect.width = calculateTabWidth(tabPlacement, i, fm); maxTabWidth = Math.max(maxTabWidth, rect.width); if (rect.x != 2 + insets.left && rect.x + rect.width > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.x = x; } rect.y = y; rect.height = maxTabHeight; if (i == selectedIndex) selectedRun = runCount - 1; } } else { for (int i = 0; i < tabCount; i++) { rect = rects[i]; if (i > 0) { rect.y = rects[i - 1].y + rects[i - 1].height; } else { tabRuns[0] = 0; runCount = 1; maxTabHeight = 0; rect.y = y; } rect.height = calculateTabHeight(tabPlacement, i, fm.getHeight()); maxTabHeight = Math.max(maxTabHeight, rect.height); if (rect.y != 2 + insets.top && rect.y + rect.height > breakAt) { if (runCount > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runCount] = i; runCount++; rect.y = y; } rect.x = x; rect.width = maxTabWidth; if (i == selectedIndex) selectedRun = runCount - 1; } } if (runCount > 1) { int start; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) start = y; else start = x; normalizeTabRuns(tabPlacement, tabCount, start, breakAt); selectedRun = getRunForTab(tabCount, selectedIndex); if (shouldRotateTabRuns(tabPlacement)) { rotateTabRuns(tabPlacement, selectedRun); } } // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) { int start = tabRuns[i]; int nextIndex; if (i == runCount - 1) nextIndex = 0; else nextIndex = i + 1; int next = tabRuns[nextIndex]; int end = next != 0 ? next - 1 : tabCount - 1; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.y = y; rect.x += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == BOTTOM) y -= maxTabHeight - tabRunOverlay; else y += maxTabHeight - tabRunOverlay; } else { for (int j = start; j <= end; ++j) { rect = rects[j]; rect.x = x; rect.y += getTabRunIndent(tabPlacement, i); } if (shouldPadTabRun(tabPlacement, i)) { padTabRun(tabPlacement, start, end, breakAt); } if (tabPlacement == RIGHT) x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; } } padSelectedTab(tabPlacement, selectedIndex); }
| 7,513
|
public void layoutContainer(Container parent) { calculateLayoutInfo(); int tabPlacement = tabPane.getTabPlacement(); Insets insets = tabPane.getInsets(); int selectedIndex = tabPane.getSelectedIndex(); Component selectedComponent = tabPane.getComponentAt(selectedIndex); // The RI doesn't seem to change the component if the new selected // component == null. This is probably so that applications can add // one single component for every tab. if (selectedComponent != null) { setVisibleComponent(selectedComponent); } int childCount = tabPane.getComponentCount(); if (childCount > 0) { int compX; int compY; int tabAreaWidth = 0; int tabAreaHeight = 0; switch (tabPlacement) { case LEFT: tabAreaWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); compX = tabAreaWidth + insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case RIGHT: tabAreaWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case BOTTOM: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case TOP: default: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; compY = tabAreaHeight + insets.top + contentBorderInsets.top; } Rectangle bounds = tabPane.getBounds(); int compWidth = bounds.width - tabAreaWidth - insets.left - insets.right - contentBorderInsets.left - contentBorderInsets.right; int compHeight = bounds.height - tabAreaHeight - insets.top - insets.bottom - contentBorderInsets.top - contentBorderInsets.bottom; for (int i = 0; i < childCount; ++i) { Component c = tabPane.getComponent(i); c.setBounds(compX, compY, compWidth, compHeight); } } }
|
public void layoutContainer(Container parent) { calculateLayoutInfo(); int tabPlacement = tabPane.getTabPlacement(); Insets insets = tabPane.getInsets(); int selectedIndex = tabPane.getSelectedIndex(); Component selectedComponent = null; if (selectedIndex >= 0) selectedComponent = tabPane.getComponentAt(selectedIndex); // The RI doesn't seem to change the component if the new selected // component == null. This is probably so that applications can add // one single component for every tab. if (selectedComponent != null) { setVisibleComponent(selectedComponent); } int childCount = tabPane.getComponentCount(); if (childCount > 0) { int compX; int compY; int tabAreaWidth = 0; int tabAreaHeight = 0; switch (tabPlacement) { case LEFT: tabAreaWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); compX = tabAreaWidth + insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case RIGHT: tabAreaWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case BOTTOM: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case TOP: default: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; compY = tabAreaHeight + insets.top + contentBorderInsets.top; } Rectangle bounds = tabPane.getBounds(); int compWidth = bounds.width - tabAreaWidth - insets.left - insets.right - contentBorderInsets.left - contentBorderInsets.right; int compHeight = bounds.height - tabAreaHeight - insets.top - insets.bottom - contentBorderInsets.top - contentBorderInsets.bottom; for (int i = 0; i < childCount; ++i) { Component c = tabPane.getComponent(i); c.setBounds(compX, compY, compWidth, compHeight); } } }
| 7,515
|
public Dimension minimumLayoutSize(Container parent) { return calculateSize(false); }
|
public Dimension minimumLayoutSize(Container parent) { return calculateSize(true); }
| 7,516
|
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max) { Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingUtilities.TOP || tabPlacement == SwingUtilities.BOTTOM) { // We should only do this for runCount - 1, cause we can only shift that many times between // runs. for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.x + currRun.width; int spaceInNext = nextRun.x + nextRun.width; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.width < max) { tabRuns[i]--; spaceInNext += currRun.width; spaceInCurr -= currRun.width; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); } // Fix the bounds. int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currX = tabAreaInsets.left; for (int j = first; j <= last; j++) { rects[j].x = currX; currX += rects[j].width; } } } else { for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.y + currRun.height; int spaceInNext = nextRun.y + nextRun.height; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.height < max) { tabRuns[i]--; spaceInNext += currRun.height; spaceInCurr -= currRun.height; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); } int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currY = tabAreaInsets.top; for (int j = first; j <= last; j++) { rects[j].y = currY; currY += rects[j].height; } } } }
|
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max) { if (tabPlacement == SwingUtilities.TOP || tabPlacement == SwingUtilities.BOTTOM) { // We should only do this for runCount - 1, cause we can only shift that many times between // runs. for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.x + currRun.width; int spaceInNext = nextRun.x + nextRun.width; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.width < max) { tabRuns[i]--; spaceInNext += currRun.width; spaceInCurr -= currRun.width; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); } // Fix the bounds. int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currX = tabAreaInsets.left; for (int j = first; j <= last; j++) { rects[j].x = currX; currX += rects[j].width; } } } else { for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.y + currRun.height; int spaceInNext = nextRun.y + nextRun.height; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.height < max) { tabRuns[i]--; spaceInNext += currRun.height; spaceInCurr -= currRun.height; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); } int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currY = tabAreaInsets.top; for (int j = first; j <= last; j++) { rects[j].y = currY; currY += rects[j].height; } } } }
| 7,517
|
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max) { Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingUtilities.TOP || tabPlacement == SwingUtilities.BOTTOM) { // We should only do this for runCount - 1, cause we can only shift that many times between // runs. for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.x + currRun.width; int spaceInNext = nextRun.x + nextRun.width; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.width < max) { tabRuns[i]--; spaceInNext += currRun.width; spaceInCurr -= currRun.width; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); } // Fix the bounds. int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currX = tabAreaInsets.left; for (int j = first; j <= last; j++) { rects[j].x = currX; currX += rects[j].width; } } } else { for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.y + currRun.height; int spaceInNext = nextRun.y + nextRun.height; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.height < max) { tabRuns[i]--; spaceInNext += currRun.height; spaceInCurr -= currRun.height; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); } int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currY = tabAreaInsets.top; for (int j = first; j <= last; j++) { rects[j].y = currY; currY += rects[j].height; } } } }
|
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max) { Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingUtilities.TOP || tabPlacement == SwingUtilities.BOTTOM) { // We should only do this for runCount - 1, cause we can only shift that many times between // runs. for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.x + currRun.width; int spaceInNext = nextRun.x + nextRun.width; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.width < max) { tabRuns[i]--; spaceInNext += currRun.width; spaceInCurr -= currRun.width; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); } // Fix the bounds. int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currX = tabAreaInsets.left; for (int j = first; j <= last; j++) { rects[j].x = currX; currX += rects[j].width; } } } else { for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.y + currRun.height; int spaceInNext = nextRun.y + nextRun.height; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.height < max) { tabRuns[i]--; spaceInNext += currRun.height; spaceInCurr -= currRun.height; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); } int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currY = tabAreaInsets.top; for (int j = first; j <= last; j++) { rects[j].y = currY; currY += rects[j].height; } } } }
| 7,518
|
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max) { Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingUtilities.TOP || tabPlacement == SwingUtilities.BOTTOM) { // We should only do this for runCount - 1, cause we can only shift that many times between // runs. for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.x + currRun.width; int spaceInNext = nextRun.x + nextRun.width; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.width < max) { tabRuns[i]--; spaceInNext += currRun.width; spaceInCurr -= currRun.width; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); } // Fix the bounds. int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currX = tabAreaInsets.left; for (int j = first; j <= last; j++) { rects[j].x = currX; currX += rects[j].width; } } } else { for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.y + currRun.height; int spaceInNext = nextRun.y + nextRun.height; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.height < max) { tabRuns[i]--; spaceInNext += currRun.height; spaceInCurr -= currRun.height; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); } int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currY = tabAreaInsets.top; for (int j = first; j <= last; j++) { rects[j].y = currY; currY += rects[j].height; } } } }
|
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max) { Insets tabAreaInsets = getTabAreaInsets(tabPlacement); if (tabPlacement == SwingUtilities.TOP || tabPlacement == SwingUtilities.BOTTOM) { // We should only do this for runCount - 1, cause we can only shift that many times between // runs. for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.x + currRun.width; int spaceInNext = nextRun.x + nextRun.width; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.width < max) { tabRuns[i]--; spaceInNext += currRun.width; spaceInCurr -= currRun.width; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.width) - (spaceInNext + currRun.width); } // Fix the bounds. int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currX = tabAreaInsets.left; for (int j = first; j <= last; j++) { rects[j].x = currX; currX += rects[j].width; } } } else { for (int i = 1; i < runCount; i++) { Rectangle currRun = rects[lastTabInRun(tabCount, i)]; Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))]; int spaceInCurr = currRun.y + currRun.height; int spaceInNext = nextRun.y + nextRun.height; int diffNow = spaceInCurr - spaceInNext; int diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); while (Math.abs(diffLater) < Math.abs(diffNow) && spaceInNext + currRun.height < max) { tabRuns[i]--; spaceInNext += currRun.height; spaceInCurr -= currRun.height; currRun = rects[lastTabInRun(tabCount, i)]; diffNow = spaceInCurr - spaceInNext; diffLater = (spaceInCurr - currRun.height) - (spaceInNext + currRun.height); } int first = lastTabInRun(tabCount, i) + 1; int last = lastTabInRun(tabCount, getNextTabRun(i)); int currY = tabAreaInsets.top; for (int j = first; j <= last; j++) { rects[j].y = currY; currY += rects[j].height; } } } }
| 7,519
|
protected void rotateTabRuns(int tabPlacement, int selectedRun) { if (runCount == 1 || selectedRun == 1 || selectedRun == -1) return; int[] newTabRuns = new int[tabRuns.length]; int currentRun = selectedRun; int i = 1; do { newTabRuns[i] = tabRuns[currentRun]; currentRun = getNextTabRun(currentRun); i++; } while (i < runCount); if (runCount > 1) newTabRuns[0] = tabRuns[currentRun]; tabRuns = newTabRuns; BasicTabbedPaneUI.this.selectedRun = 1; }
|
protected void rotateTabRuns(int tabPlacement, int selectedRun) { if (runCount == 1 || selectedRun == 0 || selectedRun == -1) return; int[] newTabRuns = new int[tabRuns.length]; int currentRun = selectedRun; int i = 1; do { newTabRuns[i] = tabRuns[currentRun]; currentRun = getNextTabRun(currentRun); i++; } while (i < runCount); if (runCount > 1) newTabRuns[0] = tabRuns[currentRun]; tabRuns = newTabRuns; BasicTabbedPaneUI.this.selectedRun = 1; }
| 7,520
|
protected void rotateTabRuns(int tabPlacement, int selectedRun) { if (runCount == 1 || selectedRun == 1 || selectedRun == -1) return; int[] newTabRuns = new int[tabRuns.length]; int currentRun = selectedRun; int i = 1; do { newTabRuns[i] = tabRuns[currentRun]; currentRun = getNextTabRun(currentRun); i++; } while (i < runCount); if (runCount > 1) newTabRuns[0] = tabRuns[currentRun]; tabRuns = newTabRuns; BasicTabbedPaneUI.this.selectedRun = 1; }
|
protected void rotateTabRuns(int tabPlacement, int selectedRun) { if (runCount == 1 || selectedRun == 1 || selectedRun == -1) return; int[] newTabRuns = new int[tabRuns.length]; int currentRun = selectedRun; int i = 0; do { newTabRuns[i] = tabRuns[currentRun]; currentRun = getNextTabRun(currentRun); i++; } while (i < runCount); if (runCount > 1) newTabRuns[0] = tabRuns[currentRun]; tabRuns = newTabRuns; BasicTabbedPaneUI.this.selectedRun = 1; }
| 7,521
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.