rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
public FSEntry addFile(String name) throws IOException { | public synchronized FSEntry addFile(String name) throws IOException { | public FSEntry addFile(String name) throws IOException { if(isReadOnly()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); //TODO: add synchronization newINode.setLinksCount( newINode.getLinksCount()+1 ); // update the directory inode iNode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this.entry); } |
public FSEntry getEntry(String name) throws IOException{ | public synchronized FSEntry getEntry(String name) throws IOException{ | public FSEntry getEntry(String name) throws IOException{ //parse the directory and search for the file FSEntryIterator iterator=iterator(); while(iterator.hasNext()) { FSEntry entry = iterator.next(); if(entry.getName().equals(name)) return entry; } return null; } |
protected Rectangle modelToView(int position, Shape a, Position.Bias bias) | public Shape modelToView(int position, Shape a, Position.Bias bias) | protected Rectangle modelToView(int position, Shape a, Position.Bias bias) throws BadLocationException { return ((PlainView) view).modelToView(position, a, bias).getBounds(); } |
if (view == null) return null; | protected Rectangle modelToView(int position, Shape a, Position.Bias bias) throws BadLocationException { return ((PlainView) view).modelToView(position, a, bias).getBounds(); } |
|
textComponent = null; | public void uninstallUI(final JComponent component) { super.uninstallUI(component); rootView.setView(null); textComponent.removePropertyChangeListener(updateHandler); textComponent = null; uninstallDefaults(); uninstallListeners(); uninstallKeyboardActions(); } |
|
textComponent = null; | public void uninstallUI(final JComponent component) { super.uninstallUI(component); rootView.setView(null); textComponent.removePropertyChangeListener(updateHandler); textComponent = null; uninstallDefaults(); uninstallListeners(); uninstallKeyboardActions(); } |
|
g.setColor(Color.black); | if (c.isEnabled()) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDisabled()); | public void paintIcon(Component c, Graphics g, int x, int y) { // TODO: work out whether/how the icon changes with different component // states (and also different metal themes) Color savedColor = g.getColor(); g.setColor(Color.black); for (int i = 0; i < 5; i++) g.drawLine(x + i, y + i, x + 9 - i, y + i); g.setColor(savedColor); } |
if (c > Byte.MAX_VALUE) | if (c > 0x7f) | protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out) { // TODO: Optimize this in the case in.hasArray() / out.hasArray() while (in.hasRemaining ()) { char c = in.get (); if (c > Byte.MAX_VALUE) { in.position (in.position () - 1); return CoderResult.unmappableForLength (1); } if (!out.hasRemaining ()) { in.position (in.position () - 1); return CoderResult.OVERFLOW; } out.put ((byte) c); } return CoderResult.UNDERFLOW; } |
if (highlighter != null && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) | if (highlighter != null) { Color oldColor = g.getColor(); | 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); } |
g.setColor(oldColor); } | 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); } |
|
view.setParent(rootView); | protected final void setView(View view) { rootView.setView(view); view.setParent(rootView); textComponent.revalidate(); textComponent.repaint(); } |
|
public static void main(String[] args) { | public static void main(String[] args) throws SyntaxErrorException { | 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); } |
jComponent.setLayout(new SwingContainerLayout(this)); | public SwingPanelPeer(SwingToolkit toolkit, Panel panel) { super(toolkit, panel, new SwingPanel(panel)); final SwingPanel jPanel = (SwingPanel) jComponent; SwingToolkit.add(panel, jPanel); SwingToolkit.copyAwtProperties(panel, jPanel); } |
|
fireIntervalAdded(this, list.size(), list.size()); | fireIntervalAdded(this, list.size() - 1, list.size()); | public void addElement(Object object) { list.add(object); fireIntervalAdded(this, list.size(), list.size()); } |
list.clear(); fireIntervalAdded(this, 0, listSize - 1); | fireIntervalAdded(this, 0, listSize); | public void removeAllElements() { int listSize = getSize(); list.clear(); fireIntervalAdded(this, 0, listSize - 1); } |
bad.minor = Minor.Any; | public static InvalidPolicy extract(Any any) { try { return ((InvalidPolicyHolder) any.extract_Streamable()).value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("InvalidPolicy expected"); bad.initCause(cex); throw bad; } } |
|
int location = e.getKeyLocation(); | 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); } |
|
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; } | locString = "location = (UNKNOWN)"; | 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); } |
dispatchThread.interrupt (); | ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue(); setShutdown(true); | 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; } } } |
this.notifyAll(); | 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; } } } |
|
updateChildRequirements(axis); updateRequirements(axis); | int totalAscent = (int) (span * getAlignment(axis)); int totalDescent = span - totalAscent; | 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); } |
SizeRequirements.calculateAlignedPositions(span, requirements[axis], childReqs[axis], offsets, spans); | int count = getViewCount(); for (int i = 0; i < count; i++) { View v = getView(i); float align = v.getAlignment(axis); int viewSpan; if (v.getResizeWeight(axis) > 0) { int min = (int) v.getMinimumSpan(axis); int max = (int) v.getMaximumSpan(axis); if (align == 0.0F) viewSpan = Math.max(Math.min(max, totalDescent), min); else if (align == 1.0F) viewSpan = Math.max(Math.min(max, totalAscent), min); else { int fit = (int) Math.min(totalAscent / align, totalDescent / (1.0F - align)); viewSpan = Math.max(Math.min(max, fit), min); } } else viewSpan = (int) v.getPreferredSpan(axis); offsets[i] = totalAscent - (int) (viewSpan * align); spans[i] = viewSpan; } | 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); } |
updateChildRequirements(axis); | if (sr == null) sr = new SizeRequirements(); sr.alignment = 0.5F; | 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; } |
SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); | int totalAscentMin = 0; int totalAscentPref = 0; int totalAscentMax = 0; int totalDescentMin = 0; int totalDescentPref = 0; int totalDescentMax = 0; | 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; } |
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++) | int count = getViewCount(); for (int i = 0; i < count; i++) | 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; } |
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); | View v = getView(i); float align = v.getAlignment(axis); int span = (int) v.getPreferredSpan(axis); int ascent = (int) (align * span); int descent = span - ascent; totalAscentPref = Math.max(ascent, totalAscentPref); totalDescentPref = Math.max(descent, totalDescentPref); if (v.getResizeWeight(axis) > 0) { span = (int) v.getMinimumSpan(axis); ascent = (int) (align * span); descent = span - ascent; totalAscentMin = Math.max(ascent, totalAscentMin); totalDescentMin = Math.max(descent, totalDescentMin); span = (int) v.getMaximumSpan(axis); ascent = (int) (align * span); descent = span - ascent; totalAscentMax = Math.max(ascent, totalAscentMax); totalDescentMax = Math.max(descent, totalDescentMax); } else { totalAscentMin = Math.max(ascent, totalAscentMin); totalDescentMin = Math.max(descent, totalDescentMin); totalAscentMax = Math.max(ascent, totalAscentMax); totalDescentMax = Math.max(descent, totalDescentMax); } | 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; } |
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; | 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; } |
|
res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res; | sr.preferred = (int) Math.min((long) totalAscentPref + (long) totalDescentPref, Integer.MAX_VALUE); if (sr.preferred > 0) sr.alignment = (float) totalAscentPref / sr.preferred; if (sr.alignment == 0) { sr.minimum = totalDescentMin; sr.maximum = totalDescentMax; } else if (sr.alignment == 1.0F) { sr.minimum = totalAscentMin; sr.maximum = totalAscentMax; } else { sr.minimum = Math.max((int) (totalAscentMin / sr.alignment), (int) (totalDescentMin / (1.0F - sr.alignment))); sr.maximum = Math.min((int) (totalAscentMax / sr.alignment), (int) (totalDescentMax / (1.0F - sr.alignment))); } return sr; | 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; } |
updateChildRequirements(axis); | SizeRequirements res = sr; if (res == null) res = new SizeRequirements(); | 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; } |
SizeRequirements result = sr; if (result == null) result = new SizeRequirements(); | float min = 0; float pref = 0; float max = 0; | 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; } |
long minimum = 0; long preferred = 0; long maximum = 0; for (int i = 0; i < children.length; i++) | int n = getViewCount(); for (int i = 0; i < n; i++) | 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; } |
minimum += childReqs[axis][i].minimum; preferred += childReqs[axis][i].preferred; maximum += childReqs[axis][i].maximum; | View child = getView(i); min += child.getMinimumSpan(axis); pref += child.getPreferredSpan(axis); max += child.getMaximumSpan(axis); | 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; } |
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; | 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; } |
|
result.minimum = (int) minimum; result.preferred = (int) preferred; result.maximum = (int) maximum; result.alignment = 0.5F; return result; | res.minimum = (int) min; res.preferred = (int) pref; res.maximum = (int) max; res.alignment = 0.5F; return res; | 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; } |
updateChildRequirements(axis); | 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; } |
|
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++) | res.minimum = 0; res.preferred = 0; res.maximum = 0; res.alignment = 0.5F; int n = getViewCount(); for (int i = 0; i < n; i++) | 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; } |
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); | View child = getView(i); res.minimum = Math.max((int) child.getMinimumSpan(axis), res.minimum); res.preferred = Math.max((int) child.getPreferredSpan(axis), res.preferred); res.maximum = Math.max((int) child.getMaximumSpan(axis), res.maximum); | 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; } |
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; | 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; } |
|
res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; | 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; } |
|
if (! isAllocationValid()) layout(a.width, a.height); | 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]; } |
|
float align; if (axis == myAxis) align = 0.5F; else { | public float getAlignment(int axis) { float align; if (axis == myAxis) align = 0.5F; else { updateRequirements(axis); align = requirements[axis].alignment; } return align; } |
|
align = requirements[axis].alignment; } return align; | return requirements[axis].alignment; | public float getAlignment(int axis) { float align; if (axis == myAxis) align = 0.5F; else { updateRequirements(axis); align = requirements[axis].alignment; } return align; } |
return span[Y_AXIS]; | return span[Y_AXIS] + getTopInset() - getBottomInset(); | public int getHeight() { return span[Y_AXIS]; } |
float max; if (axis == myAxis) max = getPreferredSpan(axis); | updateRequirements(axis); float margin; if (axis == X_AXIS) margin = getLeftInset() + getRightInset(); | public float getMaximumSpan(int axis) { float max; if (axis == myAxis) max = getPreferredSpan(axis); else max = Integer.MAX_VALUE; return max; } |
max = Integer.MAX_VALUE; return max; | margin = getTopInset() + getBottomInset(); return requirements[axis].maximum + margin; | public float getMaximumSpan(int axis) { float max; if (axis == myAxis) max = getPreferredSpan(axis); else max = Integer.MAX_VALUE; return max; } |
return requirements[axis].minimum; | float margin; if (axis == X_AXIS) margin = getLeftInset() + getRightInset(); else margin = getTopInset() + getBottomInset(); return requirements[axis].minimum + margin; | public float getMinimumSpan(int axis) { updateRequirements(axis); return requirements[axis].minimum; } |
return requirements[axis].preferred; | float margin; if (axis == X_AXIS) margin = getLeftInset() + getRightInset(); else margin = getTopInset() + getBottomInset(); return requirements[axis].preferred + margin; | public float getPreferredSpan(int axis) { updateRequirements(axis); return requirements[axis].preferred; } |
return span[X_AXIS]; | return span[X_AXIS] + getLeftInset() - getRightInset(); | public int getWidth() { return span[X_AXIS]; } |
result = x > r.x; | result = x > r.x + r.width; | 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; } |
result = y > r.y; | result = y > r.y + r.height; | 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; } |
updateChildRequirements(axis); updateRequirements(axis); | long sumPref = 0; int n = getViewCount(); for (int i = 0; i < n; i++) { View child = getView(i); spans[i] = (int) child.getPreferredSpan(axis); sumPref = spans[i]; } | 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); } |
SizeRequirements.calculateTiledPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); | long diff = targetSpan - sumPref; float factor = 0.0F; int[] diffs = null; if (diff != 0) { long total = 0; diffs = new int[n]; for (int i = 0; i < n; i++) { View child = getView(i); int span; if (diff < 0) { span = (int) child.getMinimumSpan(axis); diffs[i] = spans[i] - span; } else { span = (int) child.getMaximumSpan(axis); diffs[i] = span - spans[i]; } total += span; } | 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); } |
float maxAdjust = Math.abs(total - sumPref); factor = diff / maxAdjust; factor = Math.min(factor, 1.0F); factor = Math.max(factor, -1.0F); } int totalOffs = 0; for (int i = 0; i < n; i++) { offsets[i] = totalOffs; if (diff != 0) { float adjust = factor * diffs[i]; spans[i] += Math.round(adjust); } totalOffs = (int) Math.min((long) totalOffs + (long) spans[i], Integer.MAX_VALUE); } | 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); } |
|
updateChildRequirements(axis); updateRequirements(axis); SizeRequirements.calculateAlignedPositions(targetSpan, requirements[axis], childReqs[axis], offsets, spans); | int count = getViewCount(); for (int i = 0; i < count; i++) { View child = getView(i); int max = (int) child.getMaximumSpan(axis); if (max < targetSpan) { float align = child.getAlignment(axis); offsets[i] = (int) ((targetSpan - max) * align); spans[i] = max; } else { int min = (int) child.getMinimumSpan(axis); offsets[i] = 0; spans[i] = Math.max(min, targetSpan); } } | 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); } |
layout(bounds.width, bounds.height); | setSize(bounds.width, bounds.height); | 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); } |
Rectangle inside = getInsideAllocation(a); | Rectangle alloc; if (a instanceof Rectangle) alloc = (Rectangle) a; else alloc = a.getBounds(); | 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); } } |
Rectangle copy = new Rectangle(inside); | int x = alloc.x + getLeftInset(); int y = alloc.y + getTopInset(); Rectangle clip = g.getClipBounds(); Rectangle tmp = new Rectangle(); | 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); } } |
copy.setBounds(inside); childAllocation(i, copy); if (!copy.isEmpty() && g.hitClip(copy.x, copy.y, copy.width, copy.height)) paintChild(g, copy, i); | tmp.x = x + getOffset(X_AXIS, i); tmp.y = y + getOffset(Y_AXIS, i); tmp.width = getSpan(X_AXIS, i); tmp.height = getSpan(Y_AXIS, i); if (tmp.intersects(clip)) paintChild(g, tmp, 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); } } |
requirementsValid[Y_AXIS] = false; } | public void preferenceChanged(View child, boolean width, boolean height) { if (width) layoutValid[X_AXIS] = false; if (height) layoutValid[Y_AXIS] = false; super.preferenceChanged(child, width, height); } |
|
layoutChanged(X_AXIS); layoutChanged(Y_AXIS); | layoutValid[X_AXIS] = false; requirementsValid[X_AXIS] = false; layoutValid[Y_AXIS] = false; requirementsValid[Y_AXIS] = false; | 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); } |
layout((int) width, (int) height); | layout((int) (width - getLeftInset() - getRightInset()), (int) (height - getTopInset() - getBottomInset())); | public void setSize(float width, float height) { layout((int) width, (int) height); } |
if (! layoutValid[axis]) | if (axis != Y_AXIS && axis != X_AXIS) throw new IllegalArgumentException("Illegal axis: " + axis); if (! requirementsValid[axis]) | private void updateRequirements(int axis) { if (! layoutValid[axis]) { if (axis == myAxis) requirements[axis] = calculateMajorAxisRequirements(axis, requirements[axis]); else requirements[axis] = calculateMinorAxisRequirements(axis, requirements[axis]); } } |
requirementsValid[axis] = true; | private void updateRequirements(int axis) { if (! layoutValid[axis]) { if (axis == myAxis) requirements[axis] = calculateMajorAxisRequirements(axis, requirements[axis]); else requirements[axis] = calculateMinorAxisRequirements(axis, requirements[axis]); } } |
|
AttributedString(String str) { | public AttributedString(String str) { | AttributedString(String str){ sci = new StringCharacterIterator(str); attribs = new AttributeRange[0];} |
addAttribute(AttributedCharacterIterator.Attribute attrib, Object value) { | public void addAttribute(AttributedCharacterIterator.Attribute attrib, Object value) { | addAttribute(AttributedCharacterIterator.Attribute attrib, Object value){ addAttribute(attrib, value, 0, sci.getEndIndex());} |
addAttributes(Map attributes, int begin_index, int end_index) { | public void addAttributes(Map attributes, int begin_index, int 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);} |
getIterator() { return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null)); } | public AttributedCharacterIterator getIterator() { return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null)); } | getIterator(){ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null));} |
final int alignedObjectSize = alignInstanceFields(ftable, slotSize); objectSize = alignedObjectSize; | objectSize = alignInstanceFields(ftable, slotSize); | 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); } } |
final VmType cls = decodeClass(data, rejectNatives, clc, protectionDomain); return cls; | return decodeClass(data, rejectNatives, clc, protectionDomain); | 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; } |
set(index, new Integer(data)); | set(index, new VmConstInt(data)); | protected void setInt(int index, int data) { set(index, new Integer(data)); } |
set(index, new Float(data)); | set(index, new VmConstFloat(data)); | protected void setFloat(int index, float data) { set(index, new Float(data)); } |
set(index, new Long(data)); | set(index, new VmConstLong(data)); | protected void setLong(int index, long data) { set(index, new Long(data)); } |
set(index, new Double(data)); | set(index, new VmConstDouble(data)); | protected void setDouble(int index, double data) { set(index, new Double(data)); } |
return ((Integer) get(index)).intValue(); | return ((VmConstInt) get(index)).intValue(); | public int getInt(int index) { if (index == 0) return 0; else return ((Integer) get(index)).intValue(); } |
return ((Double) get(index)).doubleValue(); | return ((VmConstDouble) get(index)).doubleValue(); | public double getDouble(int index) { return ((Double) get(index)).doubleValue(); } |
return ((Float) get(index)).floatValue(); | return ((VmConstFloat) get(index)).floatValue(); | public float getFloat(int index) { return ((Float) get(index)).floatValue(); } |
return ((Long) get(index)).longValue(); | return ((VmConstLong) get(index)).longValue(); | public long getLong(int index) { return ((Long) get(index)).longValue(); } |
setBorder(null); | public PaneButton(Action a) { super(a); setMargin(new Insets(0, 0, 0, 0)); setBorder(null); } |
|
enableActions(); | 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); } | 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(); } |
enableActions(); | Dimension size = c.getSize(); | 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); } |
int width = c.getBounds().width - insets.left - insets.right; int height = c.getBounds().height - insets.top - insets.bottom; | int width = size.width - insets.left - insets.right; int height = size.height - insets.top - insets.bottom; | 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); } |
int loc = width + insets.left; | 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); } | 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); } |
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()) | if (maxButton.isVisible()) | 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); } |
loc -= prefs.width; closeButton.setVisible(true); closeButton.setBounds(loc, top, prefs.width, prefs.height); | loc -= buttonWidth + 2; maxButton.setBounds(loc, top, buttonWidth, buttonHeight); | 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); } |
else closeButton.setVisible(false); | 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); } |
|
if (maximizeAction.isEnabled()) | if (iconButton.isVisible()) | 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); } |
loc -= prefs.width; maxButton.setVisible(true); maxButton.setBounds(loc, top, prefs.width, prefs.height); | loc -= buttonWidth + 2; iconButton.setBounds(loc, top, buttonWidth, buttonHeight); | 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); } |
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); | 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); } |
|
Insets frameInsets = frame.getInsets(); 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); | return new Dimension(22, 18); | 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); } |
setOpaque(true); | public BasicInternalFrameTitlePane(JInternalFrame f) { frame = f; setLayout(createLayout()); title = new JLabel(); title.setHorizontalAlignment(SwingConstants.LEFT); title.setHorizontalTextPosition(SwingConstants.LEFT); title.setOpaque(false); setOpaque(true); setBackground(Color.LIGHT_GRAY); installTitlePane(); } |
|
closeButton.setOpaque(false); | if (!frame.isClosable()) closeButton.setVisible(false); | protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); } |
iconButton.setOpaque(false); | if (!frame.isIconifiable()) iconButton.setVisible(false); | protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); } |
maxButton.setOpaque(false); | if (!frame.isMaximizable()) maxButton.setVisible(false); | protected void createButtons() { closeButton = new PaneButton(closeAction); closeButton.setOpaque(false); iconButton = new PaneButton(iconifyAction); iconButton.setOpaque(false); maxButton = new PaneButton(maximizeAction); maxButton.setOpaque(false); } |
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); } |
|
Object source = e.getSource(); if (source == panel ) tabPane.requestFocus(); else if (source == tabPane) tabPane.repaint(); | public void focusGained(FocusEvent e) { // FIXME: Implement. } |
|
if (e.getOppositeComponent() == tabPane.getSelectedComponent()) tabPane.requestFocus(); else if (e.getSource() == tabPane) tabPane.repaint(); | public void focusLost(FocusEvent e) { // FIXME: Implement. } |
|
public void mouseEntered(MouseEvent ev) | public void mouseEntered(MouseEvent e) | public void mouseEntered(MouseEvent ev) { int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); setRolloverTab(tabIndex); } |
int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); | Object s = e.getSource(); if (tabPane != e.getSource()) { redispatchEvent(e); e.setSource(s); } int tabIndex = tabForCoordinate(tabPane, e.getX(), e.getY()); | public void mouseEntered(MouseEvent ev) { int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); setRolloverTab(tabIndex); } |
public void mouseExited(MouseEvent ev) | public void mouseExited(MouseEvent e) | public void mouseExited(MouseEvent ev) { setRolloverTab(-1); } |
Object s = e.getSource(); if (tabPane != e.getSource()) { redispatchEvent(e); e.setSource(s); } | public void mouseExited(MouseEvent ev) { setRolloverTab(-1); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.