[cp-patches] FYI: Clone parameter Dimension in JComponent setters.
Our setMaximumSize, setMinimumSize, setPreferredSize do not clone the passed parameter, assigning it directly. If the user program reuses the passed object (for instance, to set the same property with different values for another component), the modifications both in Classpath and the user code cause the improper work. Despite the current version produces less garbage, and very simple workaround is possible, Sun seems cloning the values (later changes on parameter have no effect). This patch makes our behaviour consistent with Sun's. 2005-11-08 Audrius Meskauskas [EMAIL PROTECTED] * javax/swing/JComponent.java (setMaximumSize, setMinimumSize, setPreferredSize): Clone the passed parameter. Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.75 diff -u -r1.75 JComponent.java --- javax/swing/JComponent.java 2 Nov 2005 19:26:33 - 1.75 +++ javax/swing/JComponent.java 8 Nov 2005 10:18:42 - @@ -2435,38 +2435,44 @@ } /** - * Set the value of the [EMAIL PROTECTED] #maximumSize} property. + * Set the value of the [EMAIL PROTECTED] #maximumSize} property. The passed value is + * copied, the later direct changes on the argument have no effect on the + * property value. * * @param max The new value of the property */ public void setMaximumSize(Dimension max) { Dimension oldMaximumSize = maximumSize; -maximumSize = max; +maximumSize = new Dimension(max); firePropertyChange(maximumSize, oldMaximumSize, maximumSize); } /** - * Set the value of the [EMAIL PROTECTED] #minimumSize} property. + * Set the value of the [EMAIL PROTECTED] #minimumSize} property. The passed value is + * copied, the later direct changes on the argument have no effect on the + * property value. * * @param min The new value of the property */ public void setMinimumSize(Dimension min) { Dimension oldMinimumSize = minimumSize; -minimumSize = min; +minimumSize = new Dimension(min); firePropertyChange(minimumSize, oldMinimumSize, minimumSize); } /** - * Set the value of the [EMAIL PROTECTED] #preferredSize} property. + * Set the value of the [EMAIL PROTECTED] #preferredSize} property. The passed value is + * copied, the later direct changes on the argument have no effect on the + * property value. * * @param pref The new value of the property */ public void setPreferredSize(Dimension pref) { Dimension oldPreferredSize = preferredSize; -preferredSize = pref; +preferredSize = new Dimension(pref); firePropertyChange(preferredSize, oldPreferredSize, preferredSize); } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: Component invalidate() fix
Hi again, Yesterday I checked in a change to java.awt.Component. Today I wrote a testcase for that (bad me, I should really do that before starting to code) that shows that this fix was wrong. I revert that. 2005-11-08 Roman Kennke [EMAIL PROTECTED] * java/awt/Component.java (invalidate): Don't invalidate invalid parents. /Roman Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.85 diff -u -r1.85 Component.java --- java/awt/Component.java 7 Nov 2005 22:31:25 - 1.85 +++ java/awt/Component.java 8 Nov 2005 11:46:05 - @@ -1720,7 +1720,7 @@ valid = false; prefSize = null; minSize = null; -if (parent != null) +if (parent != null parent.isValid()) parent.invalidate(); } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JLayeredPane fix
Hi, A testcase that I committed to Mauve showed a bug in JLayeredPane.getComponentsInLayer. This method should return an empty array for unknown layers instead of throwing an exception. This is fixed. 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/JLayeredPane.java (layerToRange): Return empty array for unknown layer instead of throwing an exception. /Roman Index: javax/swing/JLayeredPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JLayeredPane.java,v retrieving revision 1.31 diff -u -r1.31 JLayeredPane.java --- javax/swing/JLayeredPane.java 25 Oct 2005 13:49:47 - 1.31 +++ javax/swing/JLayeredPane.java 8 Nov 2005 12:17:49 - @@ -250,22 +250,30 @@ ret[1] = getComponents ().length; Iterator i = layers.entrySet ().iterator (); while (i.hasNext()) - { + { Map.Entry pair = (Map.Entry) i.next(); Integer layerNum = (Integer) pair.getKey (); Integer layerSz = (Integer) pair.getValue (); -if (layerNum.intValue() == layer.intValue()) +int layerInt = layerNum.intValue(); +if (layerInt == layer.intValue()) { ret[0] = ret[1] - layerSz.intValue (); -return ret; +break; + } +// In the following case there exists no layer with the specified +// number, so we return an empty interval here with the index at which +// such a layer would be inserted +else if (layerInt layer.intValue()) + { +ret[1] = ret[0]; +break; } else { ret[1] -= layerSz.intValue (); } - } -// should have found the layer during iteration -throw new IllegalArgumentException (); + } +return ret; } /** @@ -629,7 +637,7 @@ * @param index an ignored parameter, for compatibility. */ protected void addImpl(Component comp, Object layerConstraint, int index) - { + { Integer layer; if (layerConstraint != null layerConstraint instanceof Integer) layer = (Integer) layerConstraint; @@ -643,8 +651,8 @@ componentToLayer.put (comp, layer); incrLayer (layer); -super.addImpl(comp, null, newIdx); - } +super.addImpl(comp, null, newIdx); + } /** * Sets the layer property for a JComponent. ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: BorderLayout fix
My previous fixes for all the alignment stuff showed up an error in the BorderLayout. This is fixed and backed by a mauve test. 2005-11-08 Roman Kennke [EMAIL PROTECTED] * java/awt/BorderLayout.java (getAlignmentX): Return 0.5F here. (getAlignmentY): Return 0.5F here. /Roman Index: java/awt/BorderLayout.java === RCS file: /cvsroot/classpath/classpath/java/awt/BorderLayout.java,v retrieving revision 1.20 diff -u -r1.20 BorderLayout.java --- java/awt/BorderLayout.java 21 Sep 2005 19:13:57 - 1.20 +++ java/awt/BorderLayout.java 8 Nov 2005 14:28:56 - @@ -430,7 +430,7 @@ */ public float getLayoutAlignmentX(Container parent) { -return(parent.getAlignmentX()); +return 0.5F; } /** @@ -445,7 +445,7 @@ */ public float getLayoutAlignmentY(Container parent) { -return(parent.getAlignmentY()); +return 0.5F; } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: BasicTextUI fix
This fixes BasicTextUI so that the colors in the textfield demo are correctly set when enabling/disabling. 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTextUI.java (installDefaults): Initialize background field correctly. /Roman Index: javax/swing/plaf/basic/BasicTextUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.51 diff -u -r1.51 BasicTextUI.java --- javax/swing/plaf/basic/BasicTextUI.java 4 Nov 2005 11:32:05 - 1.51 +++ javax/swing/plaf/basic/BasicTextUI.java 8 Nov 2005 15:02:01 - @@ -552,6 +552,7 @@ caret.setBlinkRate(UIManager.getInt(prefix + .caretBlinkRate)); // Fetch the colors for enabled/disabled text components. +background = UIManager.getColor(prefix + .background); inactiveBackground = UIManager.getColor(prefix + .inactiveBackground); textComponent.setDisabledTextColor (UIManager.getColor(prefix + .inactiveForeground)); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: Component invalidate() fix
On Tue, 2005-11-08 at 11:53 +, Roman Kennke wrote: Hi again, Yesterday I checked in a change to java.awt.Component. Today I wrote a testcase for that (bad me, I should really do that before starting to code) that shows that this fix was wrong. I revert that. Hi all, can we please mention which test cases (if they are Mauve tests) we're referring to in our messages to classpath-patches? Thanks! Tony ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: 2 API methods implemented in java.lang.String
On Mon, 2005-11-07 at 13:52 -0800, David Daney wrote: Try StringBuilder instead of StringBuffer. Done. This is faster than StringBuffer but doesn't provide thread-safety, which we didn't need in this case anyway. 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * java/lang/String.java: (replace): Use a StringBuilder instead of a StringBuffer because this is faster and we don't need thread-safety. --Tony Index: java/lang/String.java === RCS file: /cvsroot/classpath/classpath/java/lang/String.java,v retrieving revision 1.75 diff -u -r1.75 String.java --- java/lang/String.java 7 Nov 2005 20:50:56 - 1.75 +++ java/lang/String.java 8 Nov 2005 16:03:11 - @@ -1901,7 +1901,7 @@ int replaceLength = replacement.length(); int startPos = this.indexOf(targetString); -StringBuffer result = new StringBuffer(this); +StringBuilder result = new StringBuilder(this); while (startPos != -1) { // Replace the target with the replacement ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: Component invalidate() fix
Am Dienstag, den 08.11.2005, 10:46 -0500 schrieb Anthony Balkissoon: On Tue, 2005-11-08 at 11:53 +, Roman Kennke wrote: Hi again, Yesterday I checked in a change to java.awt.Component. Today I wrote a testcase for that (bad me, I should really do that before starting to code) that shows that this fix was wrong. I revert that. Hi all, can we please mention which test cases (if they are Mauve tests) we're referring to in our messages to classpath-patches? Good idea. Although I try to make this easy. I always write testcases that mirror the method name of the tested method in the classname and the classname of the tested class in the package name. So when I want to test java.awt.Component.invalidate() I write a test with the class name gnu.testlet.java.awt.Component.invalidate. /Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Implemented method in DefaultStyledDocument
I implemented the method ElementBuffer.clone in DefaultStyledDocument, one of the remaining missing methods in javax.swing.text. 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * javax/swing/text/DefaultStyledDocument.java: (ElementBuffer.clone): New API method. --Tony Index: javax/swing/text/DefaultStyledDocument.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultStyledDocument.java,v retrieving revision 1.16 diff -u -r1.16 DefaultStyledDocument.java --- javax/swing/text/DefaultStyledDocument.java 4 Nov 2005 22:50:03 - 1.16 +++ javax/swing/text/DefaultStyledDocument.java 8 Nov 2005 16:40:02 - @@ -772,6 +772,34 @@ } offset += len; } + +/** + * Creates a copy of the element codeclonee/code that has the parent + * codeparent/code. + * @param parent the parent of the newly created Element + * @param clonee the Element to clone + * @return the cloned Element + */ +public Element clone (Element parent, Element clonee) +{ + // If the Element we want to clone is a leaf, then simply copy it + if (clonee.isLeaf()) +return createLeafElement(parent, clonee.getAttributes(), + clonee.getStartOffset(), clonee.getEndOffset()); + + // Otherwise create a new BranchElement with the desired parent and + // the clonee's attributes + BranchElement result = (BranchElement) createBranchElement(parent, clonee.getAttributes()); + + // And clone all the of clonee's children + Element[] children = new Element[clonee.getElementCount()]; + for (int i = 0; i children.length; i++) +children[i] = clone(result, clonee.getElement(i)); + + // Make the cloned children the children of the BranchElement + result.replace(0, 0, children); + return result; +} } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
Hi Tony, On Mon, 2005-11-07 at 13:29 -0500, Anthony Balkissoon wrote: JAPI pointed out that InvocationEvent.getThrowable was missing. I wrote it, which involved a slight tweak of dispatch() as well. [...] + /** + * Returns a throwable caught while executing the Runnable's run() method. + * Null if none was thrown or if this InvocationEvent doesn't catch + * throwables. + * @return the caught Throwable + */ + public Throwable getThrowable() + { +return throwable; + } Please add @since 1.5 to such new methods. Now we have both a throwable and a exception private field. Unless we need them for serialization it is probably better to collapse them into one and let getException() do an instanceof Exception. Cheers, Mark signature.asc Description: This is a digitally signed message part ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: SwingUtilities.replaceUIActionMap fixed
As I reported in bug 24742: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24742 SwingUtilities.replaceUIActionMap wasn't working properly. This patch fixes it and also fixes BasicListUI, BasicTableUI, and BasicTreeUI to use ActionMapUIResource for their ActionMaps as they should. 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * javax/swing/SwingUtilities.java: (replaceUIActionMap): Stop climbing hierarchy once we've found an ActionMapUIResource, don't keep looking until parent is null. No need to check if child is null. (replaceUIInputMap): Use a local variable for the parent rather than 3 calls to get parent. No need to check if child is null. * javax/swing/plaf/basic/BasicListUI.java: * javax/swing/plaf/basic/BasicTableUI.java: * javax/swing/plaf/basic/BasicTreeUI.java: (installKeyboardActions): UI ActionMap should be of type ActionMapUIResource, not just ActionMap. --Tony Index: javax/swing/SwingUtilities.java === RCS file: /cvsroot/classpath/classpath/javax/swing/SwingUtilities.java,v retrieving revision 1.38 diff -u -r1.38 SwingUtilities.java --- javax/swing/SwingUtilities.java 19 Oct 2005 15:45:05 - 1.38 +++ javax/swing/SwingUtilities.java 8 Nov 2005 20:30:20 - @@ -1138,14 +1138,12 @@ else { ActionMap parent = child.getParent(); -while(parent != null) +while (parent != null !(parent instanceof ActionMapUIResource)) { child = parent; parent = child.getParent(); } - -if (child != null) - child.setParent(uiActionMap); +child.setParent(uiActionMap); } } @@ -1181,11 +1179,13 @@ component.setInputMap(condition, uiInputMap); else { -while(child.getParent() != null - !(child.getParent() instanceof InputMapUIResource)) - child = child.getParent(); -if (child != null) - child.setParent(uiInputMap); +InputMap parent = child.getParent(); +while (parent != null !(parent instanceof InputMapUIResource)) + { +child = parent; +parent = parent.getParent(); + } +child.setParent(uiInputMap); } } Index: javax/swing/plaf/basic/BasicListUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v retrieving revision 1.36 diff -u -r1.36 BasicListUI.java --- javax/swing/plaf/basic/BasicListUI.java 20 Oct 2005 18:58:47 - 1.36 +++ javax/swing/plaf/basic/BasicListUI.java 8 Nov 2005 20:30:20 - @@ -51,7 +51,6 @@ import java.awt.event.ComponentListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; -import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -76,6 +75,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.MouseInputListener; +import javax.swing.plaf.ActionMapUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.InputMapUIResource; import javax.swing.plaf.ListUI; @@ -940,7 +940,7 @@ InputMap focusInputMap = (InputMap)defaults.get(List.focusInputMap); InputMapUIResource parentInputMap = new InputMapUIResource(); // FIXME: The JDK uses a LazyActionMap for parentActionMap -ActionMap parentActionMap = new ActionMap(); +ActionMap parentActionMap = new ActionMapUIResource(); action = new ListAction(); Object keys[] = focusInputMap.allKeys(); // Register key bindings in the UI InputMap-ActionMap pair Index: javax/swing/plaf/basic/BasicTableUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTableUI.java,v retrieving revision 1.35 diff -u -r1.35 BasicTableUI.java --- javax/swing/plaf/basic/BasicTableUI.java 28 Oct 2005 14:46:10 - 1.35 +++ javax/swing/plaf/basic/BasicTableUI.java 8 Nov 2005 20:30:20 - @@ -71,6 +71,7 @@ import javax.swing.border.Border; import javax.swing.event.ChangeEvent; import javax.swing.event.MouseInputListener; +import javax.swing.plaf.ActionMapUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.InputMapUIResource; import javax.swing.plaf.TableUI; @@ -401,7 +402,7 @@ InputMap ancestorMap = (InputMap)defaults.get(Table.ancestorInputMap); InputMapUIResource parentInputMap = new InputMapUIResource(); // FIXME: The JDK uses a LazyActionMap for parentActionMap -ActionMap parentActionMap = new ActionMap(); +ActionMap parentActionMap = new ActionMapUIResource(); action = new TableAction(); Object keys[] = ancestorMap.allKeys(); // Register key bindings in the UI
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
Thanks for the advice Mark, I fixed this up and committed it. 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * java/awt/event/InvocationEvent.java: (exception): Removed unnecessary field. (dispatch): Removed reference to field exception. (getException): If throwable is an Exception, return a casted version, otherwise return null. (getThrowable): Improved docs. --Tony On Tue, 2005-11-08 at 19:22 +0100, Mark Wielaard wrote: Hi Tony, On Mon, 2005-11-07 at 13:29 -0500, Anthony Balkissoon wrote: JAPI pointed out that InvocationEvent.getThrowable was missing. I wrote it, which involved a slight tweak of dispatch() as well. [...] + /** + * Returns a throwable caught while executing the Runnable's run() method. + * Null if none was thrown or if this InvocationEvent doesn't catch + * throwables. + * @return the caught Throwable + */ + public Throwable getThrowable() + { +return throwable; + } Please add @since 1.5 to such new methods. Now we have both a throwable and a exception private field. Unless we need them for serialization it is probably better to collapse them into one and let getException() do an instanceof Exception. Cheers, Mark ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches Index: java/awt/event/InvocationEvent.java === RCS file: /cvsroot/classpath/classpath/java/awt/event/InvocationEvent.java,v retrieving revision 1.10 diff -u -r1.10 InvocationEvent.java --- java/awt/event/InvocationEvent.java 7 Nov 2005 18:28:03 - 1.10 +++ java/awt/event/InvocationEvent.java 8 Nov 2005 20:49:01 - @@ -98,16 +98,9 @@ protected boolean catchExceptions; /** - * This is the caught exception thrown in the coderun()/code method. It - * is null if exceptions are ignored, the run method hasn't completed, or - * there were no exceptions. - * - * @serial the caught exception, if any - */ - private Exception exception; - - /** * This is the caught Throwable thrown in the coderun()/code method. + * It is null if throwables are ignored, the run method hasn't completed, + * or there were no throwables thrown. */ private Throwable throwable; @@ -191,8 +184,6 @@ catch (Throwable t) { throwable = t; - if (t instanceof Exception) -exception = (Exception)t; } else runnable.run(); @@ -214,7 +205,9 @@ */ public Exception getException() { -return exception; +if (throwable == null || !(throwable instanceof Exception)) + return null; +return (Exception) throwable; } /** @@ -222,6 +215,7 @@ * Null if none was thrown or if this InvocationEvent doesn't catch * throwables. * @return the caught Throwable + * @since 1.5 */ public Throwable getThrowable() { ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] RFC: ObjectInputStream fix for readResolve invocations
Hi all, readResolve can throw ObjectStreamException's. In our implementation currently all Errors and Exceptions are ignored. As a mauve test posted to mauve-patches shows SUN passes Error, RuntimeException and ObjectStreamExceptions through to the caller. The mauve test also shows (test number 1) that readResolve is actually called by the ObjectInputStream implementation. Therefore I would say that bug 22854 (readResolve isn't called) can be closed. 2005-11-08 Wolfgang Baer [EMAIL PROTECTED] * java/io/ObjectInputStream.java: (processResolution) Pass Error, RuntimeException and ObjectStreamException through to the caller. Regards, Wolfgang Index: java/io/ObjectInputStream.java === RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v retrieving revision 1.71 diff -u -r1.71 ObjectInputStream.java --- java/io/ObjectInputStream.java 1 Nov 2005 23:32:21 - 1.71 +++ java/io/ObjectInputStream.java 8 Nov 2005 20:43:56 - @@ -1567,6 +1567,15 @@ } catch (InvocationTargetException ignore) { + // SUN passes Errors, RuntimeExceptions and + // ObjectStreamExceptions through to caller + Throwable cause = ignore.getCause(); + if (cause instanceof ObjectStreamException) + throw (ObjectStreamException) cause; + else if (cause instanceof RuntimeException) + throw (RuntimeException) cause; + else if (cause instanceof Error) + throw (Error) cause; } } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: JOptionPane, Window and JTree fix
ChangeLog explains it all :) 2005-11-08 Lillian Angel [EMAIL PROTECTED] * java/awt/Window.java (setLocationRelativeTo): Changed x and y to use getLocationOnScreen and moved setLocation call outside of check. * javax/swing/JOptionPane.java (createDialog): Moved pack call and setLocationRelativeTo call here and removed these calls from all other functions that call createDialog. Also, removed FIXME, since call to setLocationRelativeTo fixes this. (showConfirmDialog): Removed pack and setLocationRelativeTo calls. (showConfirmDialog): Likewise. (showConfirmDialog): Likewise. (showConfirmDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showMessageDialog): Likewise. (showMessageDialog): Likewise. (showOptionDialog): Likewise. * javax/swing/JTree.java (JTree): Should not use a shared instance of the selection model. It is a problem when one application has two different trees. * javax/swing/plaf/basic/BasicTreeUI.java (paintRow): Changed parameter to be the focus of the tree. (updateCurrentVisiblePath): Adjusted root path incase the root is hidden. Index: java/awt/Window.java === RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v retrieving revision 1.62 diff -u -r1.62 Window.java --- java/awt/Window.java 4 Nov 2005 22:46:45 - 1.62 +++ java/awt/Window.java 8 Nov 2005 20:47:25 - @@ -805,26 +805,25 @@ public void setLocationRelativeTo(Component c) { +int x = 0; +int y = 0; + if (c == null || !c.isShowing()) { -int x = 0; -int y = 0; - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Point center = ge.getCenterPoint(); x = center.x - (width / 2); y = center.y - (height / 2); -setLocation(x, y); } else { -int x = c.getX(); -int y = c.getY(); - int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); +x = c.getLocationOnScreen().x; +y = c.getLocationOnScreen().y; + // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) screenSize.height) @@ -866,16 +865,19 @@ if ((x + width) screenSize.width) x = screenSize.width - width; // If left side of component is cut off -else if (x 0) +else if (x 0 || (x - (width - cWidth) / 2) 0) x = 0; else x -= (width - cWidth) / 2; - -y -= (height - cHeight) / 2; - } -setLocation(x, y); +if ((y - (height - cHeight) / 2) 0) + y -= (height - cHeight) / 2; +else + y = 0; + } } + +setLocation(x, y); } /** Index: javax/swing/JOptionPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JOptionPane.java,v retrieving revision 1.22 diff -u -r1.22 JOptionPane.java --- javax/swing/JOptionPane.java 7 Nov 2005 15:41:09 - 1.22 +++ javax/swing/JOptionPane.java 8 Nov 2005 20:47:26 - @@ -369,14 +369,11 @@ inputValue = UNINITIALIZED_VALUE; value = UNINITIALIZED_VALUE; -// FIXME: This dialog should be centered on the parent -// or at the center of the screen (if the parent is null) -// Need getGraphicsConfiguration to return non-null in -// order for that to work so we know how large the -// screen is. dialog.getContentPane().add(this); dialog.setModal(true); dialog.setResizable(false); +dialog.pack(); +dialog.setLocationRelativeTo(parentComponent); return dialog; } @@ -860,9 +857,6 @@ { JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE); JDialog dialog = pane.createDialog(parentComponent, Select an Option); - -dialog.pack(); -dialog.setLocationRelativeTo(parentComponent); dialog.show(); if (pane.getValue() instanceof Integer) @@ -889,8 +883,6 @@ { JOptionPane pane = new JOptionPane(message, PLAIN_MESSAGE, optionType); JDialog dialog = pane.createDialog(parentComponent, title); -dialog.pack(); -dialog.setLocationRelativeTo(parentComponent); dialog.show(); if (pane.getValue() instanceof Integer) @@ -918,8 +910,6 @@ { JOptionPane pane = new JOptionPane(message, messageType, optionType); JDialog dialog =
[cp-patches] Patch: FYI: remove gnu.java.awt.FocusManager property
I'm checking this in. This removes the last mention of the old gnu.java.awt.FocusManager property. Tom 2005-11-08 Tom Tromey [EMAIL PROTECTED] * gnu/classpath/SystemProperties.java: Don't mention gnu.java.awt.FocusManager. Index: gnu/classpath/SystemProperties.java === RCS file: /cvsroot/classpath/classpath/gnu/classpath/SystemProperties.java,v retrieving revision 1.9 diff -u -r1.9 SystemProperties.java --- gnu/classpath/SystemProperties.java 7 Jul 2005 12:37:04 - 1.9 +++ gnu/classpath/SystemProperties.java 8 Nov 2005 21:48:15 - @@ -106,12 +106,6 @@ if (defaultProperties.get(file.encoding) == null) defaultProperties.put(file.encoding, 8859_1); -// Default to the Swing FocusManager so that the old-style Swing API -// for FocusManager can be supported without hardcoding it in AWT. -if (defaultProperties.get(gnu.java.awt.FocusManager) == null) - defaultProperties.put(gnu.java.awt.FocusManager, -gnu.java.awt.FocusManager); - // XXX FIXME - Temp hack for old systems that set the wrong property if (defaultProperties.get(java.io.tmpdir) == null) defaultProperties.put(java.io.tmpdir, ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: SwingUtilities.replaceUIActionMap fixed
Am Dienstag, den 08.11.2005, 15:39 -0500 schrieb Anthony Balkissoon: As I reported in bug 24742: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24742 SwingUtilities.replaceUIActionMap wasn't working properly. This patch fixes it and also fixes BasicListUI, BasicTableUI, and BasicTreeUI to use ActionMapUIResource for their ActionMaps as they should. I see you attached a testcase for that. Could you please turn this into a Mauve test and commit that too? For bugs I now nearly completely follow this pattern: - analyze bug - think out a possible reason for the bug - build a testcase that proves the above theory (often it is proven wrong), helping to figure out the real reason for the bug - fix the code, so the testcase PASSes - commit both the fix and the testcase This approach has some overhead, however it has advantages that are really worth it: - it forces you to think about the problem before you start coding - very often I find that my first idea on how to fix a bug is wrong. An example is my discussion with Lillian on IRC lately, where she and I had several ideas how to fix the bug, and none was completely right. The right fix first showed up when I hacked together some testcases - it makes sure that nobody comes and fixes another bug which will revert your fix. This would cause a regression which will be recognized fast with Tromey's new regression checker or through manual regression runs (like before a release). - you have hard arguments when arguing about your fix ;-) - it helps to build a complete testsuite for GNU Classpath which can be used for compatibility checking. Cheers, /Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] RFC: ObjectInputStream fix for readResolve invocations
Hi Wolfgang, On Tue, 2005-11-08 at 21:55 +0100, Wolfgang Baer wrote: The mauve test also shows (test number 1) that readResolve is actually called by the ObjectInputStream implementation. Therefore I would say that bug 22854 (readResolve isn't called) can be closed. Yep, you are right. I added the ChangeLog messages that fixed this to the bug and closed it. 2005-11-08 Wolfgang Baer [EMAIL PROTECTED] * java/io/ObjectInputStream.java: (processResolution) Pass Error, RuntimeException and ObjectStreamException through to the caller. Yes, this makes sense. Index: java/io/ObjectInputStream.java === RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v retrieving revision 1.71 diff -u -r1.71 ObjectInputStream.java --- java/io/ObjectInputStream.java 1 Nov 2005 23:32:21 - 1.71 +++ java/io/ObjectInputStream.java 8 Nov 2005 20:43:56 - @@ -1567,6 +1567,15 @@ } catch (InvocationTargetException ignore) { + // SUN passes Errors, RuntimeExceptions and + // ObjectStreamExceptions through to caller + Throwable cause = ignore.getCause(); + if (cause instanceof ObjectStreamException) + throw (ObjectStreamException) cause; + else if (cause instanceof RuntimeException) + throw (RuntimeException) cause; + else if (cause instanceof Error) + throw (Error) cause; Multiple nitpicks here. The comment Can throw Errors and RuntimeExceptions if caused by the readResolve() user code should not be here, but a comment of public Object readObject() method. (The fact that SUN also does this is not really that relevant imho.) The name 'ignore' is really a misnomer now. Maybe it isn't really confusing, but it looks funny. Feel free to commit this with or without these nitpicks fixed. Thanks, Mark signature.asc Description: This is a digitally signed message part ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: GNULookAndFeel
I added the icons for CheckBoxes and RadioButtons. This should not be added to the BasicIconFactory, because they don't appear in the JDK. This fixes bug #24678 2005-11-08 Lillian Angel [EMAIL PROTECTED] * examples/gnu/classpath/examples/swing/GNULookAndFeel.java (getDefaults): Added icons for checkboxes and radiobutton. (CheckBoxIcon): New class, implemented. (RadioButtonIcon): New class, implemented. Index: examples/gnu/classpath/examples/swing/GNULookAndFeel.java === RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java,v retrieving revision 1.3 diff -u -r1.3 GNULookAndFeel.java --- examples/gnu/classpath/examples/swing/GNULookAndFeel.java 15 Jul 2005 11:17:45 - 1.3 +++ examples/gnu/classpath/examples/swing/GNULookAndFeel.java 8 Nov 2005 22:40:00 - @@ -22,8 +22,13 @@ package gnu.classpath.examples.swing; import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import javax.swing.Icon; import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JRadioButton; import javax.swing.UIDefaults; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.IconUIResource; @@ -64,8 +69,10 @@ MenuBar.background, new ColorUIResource(blueGray), MenuItem.background, new ColorUIResource(blueGray), ScrollBar.background, new ColorUIResource(blueGray), - - Tree.closedIcon, + CheckBox.icon, new CheckBoxIcon(), + RadioButton.icon, new RadioButtonIcon(), + + Tree.closedIcon, new IconUIResource(new ImageIcon (getClass().getResource (iconspath + TreeClosed.png))), @@ -81,5 +88,178 @@ LAF_defaults.putDefaults(myDefaults); } return LAF_defaults; + } + + /** + * The icon used for CheckBoxes in the BasicLookAndFeel. This is an empty + * icon with a size of 13x13 pixels. + */ + static class CheckBoxIcon +implements Icon + { +/** + * Returns the height of the icon. The BasicLookAndFeel CheckBox icon + * has a height of 13 pixels. + * + * @return the height of the icon + */ +public int getIconHeight() +{ + return 13; +} + +/** + * Returns the width of the icon. The BasicLookAndFeel CheckBox icon + * has a width of 13 pixels. + * + * @return the height of the icon + */ +public int getIconWidth() +{ + return 13; +} + +/** + * Paints the icon. The BasicLookAndFeel CheckBox icon is empty and does + * not need to be painted. + * + * @param c the component to be painted + * @param g the Graphics context to be painted with + * @param x the x position of the icon + * @param y the y position of the icon + */ +public void paintIcon(Component c, Graphics g, int x, int y) +{ + Color save = g.getColor(); + g.setColor(c.getForeground()); + g.drawRect(x, y, getIconWidth(), getIconHeight()); + + JCheckBox item = (JCheckBox) c; + if (item.isSelected()) +{ + g.drawLine(3 + x, 5 + y, 3 + x, 9 + y); + g.drawLine(4 + x, 5 + y, 4 + x, 9 + y); + g.drawLine(5 + x, 7 + y, 9 + x, 3 + y); + g.drawLine(5 + x, 8 + y, 9 + x, 4 + y); +} + + g.setColor(save); +} + } + + /** + * The icon used for RadioButtons in the GNULookAndFeel. This is an empty + * icon with a size of 13x13 pixels. + */ + static class RadioButtonIcon +implements Icon + { +/** + * Returns the height of the icon. The GNULookAndFeel RadioButton icon + * has a height of 13 pixels. + * + * @return the height of the icon + */ +public int getIconHeight() +{ + return 13; +} + +/** + * Returns the width of the icon. The GNULookAndFeel RadioButton icon + * has a width of 13 pixels. + * + * @return the height of the icon + */ +public int getIconWidth() +{ + return 13; +} + +/** + * Paints the icon. The GNULookAndFeel RadioButton icon is empty and does + * not need to be painted. + * + * @param c the component to be painted + * @param g the Graphics context to be painted with + * @param x the x position of the icon + * @param y the y position of the icon + */ +public void paintIcon(Component c, Graphics g, int x, int y) +{ + Color savedColor = g.getColor(); + JRadioButton b = (JRadioButton) c; + + // draw outer circle + if (b.isEnabled()) +g.setColor(Color.GRAY); + else +g.setColor(Color.GRAY); + g.drawLine(x + 2, y + 1, x + 3, y + 1); + g.drawLine(x + 4, y, x + 7, y); + g.drawLine(x + 8, y + 1, x + 9, y + 1); + g.drawLine(x + 10, y + 2, x + 10, y + 3); + g.drawLine(x + 11, y + 4, x + 11, y + 7); + g.drawLine(x + 10, y + 8, x + 10, y + 9); +
[cp-patches] FYI: Fix for 24730 (Phlegmatic work)
This patch implements the caret blinking behavior that is usually observed in the most of applications: after any change of the caret position it immediately reappears and do no go down again earlier than the full timer blinking interval. Under very intensive work, the caret does not blink. The text selection (shift+arrow keys) is also working better, despite the default selection color is black for some strange reason. 2005-11-08 Audrius Meskauskas [EMAIL PROTECTED] * javax/swing/DefaultCaret.java (BlinkTimerListener): added ignoreNextEvent flag and its handling. (blinkListener): New field. (initBlinkTimer): Initialise blinkListener field. (setDot, moveDot): Call appear() instead of repaint(). (appear): new method. Index: javax/swing/text/DefaultCaret.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v retrieving revision 1.22 diff -u -r1.22 DefaultCaret.java --- javax/swing/text/DefaultCaret.java 3 Nov 2005 23:19:34 - 1.22 +++ javax/swing/text/DefaultCaret.java 8 Nov 2005 23:38:08 - @@ -74,19 +74,33 @@ * Controls the blinking of the caret. * * @author Roman Kennke ([EMAIL PROTECTED]) + * @author Audrius Meskauskas ([EMAIL PROTECTED]) */ private class BlinkTimerListener implements ActionListener { /** + * Forces the next event to be ignored. The next event should be ignored + * if we force the caret to appear. We do not know how long will it take + * to fire the comming event; this may be near immediately. Better to leave + * the caret visible one iteration longer. + */ +boolean ignoreNextEvent; + +/** * Receives notification when the blink timer fires and updates the visible * state of the caret. - * + * * @param event the action event */ public void actionPerformed(ActionEvent event) { - visible = !visible; - repaint(); + if (ignoreNextEvent) +ignoreNextEvent = false; + else +{ + visible = !visible; + repaint(); +} } } @@ -274,6 +288,8 @@ private Object highlightEntry; private Timer blinkTimer; + + private BlinkTimerListener blinkListener; /** * Creates a new codeDefaultCaret/code instance. @@ -768,7 +784,7 @@ this.dot = dot; handleHighlight(); adjustVisibility(this); -repaint(); +appear(); } /** @@ -786,8 +802,44 @@ this.mark = dot; handleHighlight(); adjustVisibility(this); -repaint(); +appear(); } + + /** + * Show the caret (may be hidden due blinking) and adjust the timer not to + * hide it (possibly immediately). + * + * @author Audrius Meskauskas ([EMAIL PROTECTED]) + */ + void appear() + { +// All machinery is only required if the carret is blinking. +if (blinkListener != null) + { +blinkListener.ignoreNextEvent = true; + +// If the caret is visible, erase the current position by repainting +// over. +if (visible) + repaint(); + +// Draw the caret in the new position. +visible = true; + +Rectangle area = null; +try + { +area = getComponent().modelToView(getDot()); + } +catch (BadLocationException ex) + { +assert false : Unexpected bad caret location: + getDot(); + } +if (area != null) + damage(area); + } +repaint(); + } /** * Returns codetrue/code if this codeCaret/code is currently visible, @@ -888,7 +940,8 @@ private void initBlinkTimer() { // Setup the blink timer. -blinkTimer = new Timer(getBlinkRate(), new BlinkTimerListener()); +blinkListener = new BlinkTimerListener(); +blinkTimer = new Timer(getBlinkRate(), blinkListener); blinkTimer.setRepeats(true); } } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
Tony == Anthony Balkissoon [EMAIL PROTECTED] writes: Tony Thanks for the advice Mark, I fixed this up and committed it. Tony 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] Tony * java/awt/event/InvocationEvent.java: Tony (exception): Removed unnecessary field. Actually, this field is still required for serialization. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: Comment to 0.19 - Correction
I have written But I think, it is not a problem of Swing. The problem begins already with AWT. If you using Applet instead of Frame, you have the same problem, if you draws something and want to change it with a click on a button or so. But now I have tried again Suns Demo-program ArcTest.java, which runs as Applet and as StandAlone-Program. And it runs under GNU Classpath correct. So it seems, that only JApplet habve the error, not Applet. Or in Applet in other areas as I have it tested. What I mean with this: I am now not sure, if the error begins in JApplet or if it is already in Applet. Greatings theuserbl ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
[Bug swing/24733] New: JTextField.paste() does not work.
It is not possible to paste text from the clipboard into our JTextField. Ctrl-V does not work, and shift-ins does not work either and the direct call of the .paste method also returs without doing the work. Experimenting, I wrote the new Mauve test calling .copy() and .paste() on the JTextField. This test passes. However if I copy some text into clipboard from, for instance, Eclipse editor, it is not possible to paste it into JTextField even by the direct call of the .paste() method, leave alone the keyboard shortcuts. Try to paste using the provided test case example. -- Summary: JTextField.paste() does not work. Product: classpath Version: 0.19 Status: UNCONFIRMED Severity: normal Priority: P3 Component: swing AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: audriusa at bluewin dot ch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24733 ___ Bug-classpath mailing list Bug-classpath@gnu.org http://lists.gnu.org/mailman/listinfo/bug-classpath
Alpha and free java
Hi, you old alpha users! If you have waited for free java on the old Alpha with a (quite fast) JIT, there you go: http://www.complang.tuwien.ac.at/cacaojvm//screenshots/eclipse-3.2M3-alpha-linux.png It's really usable :-) TWISTI ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: [commit-cp] classpath daily snapshot 20051108 FAILED
Hi Michael, On Tue, 2005-11-08 at 05:47 +0100, Michael Koch wrote: update cvs source tree 24372: Connection closed by 199.232.41.3 cvs [update aborted]: end of file from server (consult above messages if any) I am not sure what exactly went wrong here. But I saw this message on commit-classpath. Now that we have classpath-testresults it is probably better to send build failure messages to that list. Cheers, Mark -- Escape the Java Trap with GNU Classpath! http://www.gnu.org/philosophy/java-trap.html Join the community at http://planet.classpath.org/ signature.asc Description: This is a digitally signed message part ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
gnu_java_awt_peer_gtk_GdkFontPeer.c (initStaticState): missing NewGlobalRef?
Hi! We are currently developing a JNI source code analyzer, which scans for missing NewGlobalRef calls (this is for popl06). And it seems that it has found a bug in GNU classpath's gtk peers. In Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState the global variable glyphVector_class is not registered and is used afterwards in getGlyphVector to instantiate a new object. I think this should be something like: Index: gnu_java_awt_peer_gtk_GdkFontPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,v retrieving revision 1.10 diff -u -3 -p -r1.10 gnu_java_awt_peer_gtk_GdkFontPeer.c --- gnu_java_awt_peer_gtk_GdkFontPeer.c 19 Sep 2005 05:47:09 - 1.10 +++ gnu_java_awt_peer_gtk_GdkFontPeer.c 8 Nov 2005 15:37:39 - @@ -65,6 +65,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_i glyphVector_class = (*env)-FindClass (env, gnu/java/awt/peer/gtk/GdkGlyphVector); + glyphVector_class = (*env)-NewGlobalRef +(env, glyphVector_class); + glyphVector_ctor = (*env)-GetMethodID (env, glyphVector_class, init, ([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V); Comments? TWISTI ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: Alpha and free java
On Tue, Nov 08, 2005 at 12:28:41PM -0400, Martin Cordova wrote: Nice, when are you going to ship a new version of Cacao incoporating Classpath 0.19? Is it possible to replace Cacao's classpath with latest 0.19? A release is scheduled in 1-2 weeks and CACAO does not have anymore a own version of GNU classpath. It uses upstream releases or cvs heads, as you like :-) CACAO 0.93 will work for 0.19+. TWISTI ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: gnu_java_awt_peer_gtk_GdkFontPeer.c (initStaticState): missing NewGlobalRef?
Hi Christian, On Tue, 2005-11-08 at 16:42 +0100, Christian Thalinger wrote: We are currently developing a JNI source code analyzer, which scans for missing NewGlobalRef calls (this is for popl06). And it seems that it has found a bug in GNU classpath's gtk peers. In Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState the global variable glyphVector_class is not registered and is used afterwards in getGlyphVector to instantiate a new object. Yes, nice catch. Now that I have seen this I am surprised we don't have more bugs like this one. it is easy to miss. Cool to know you have a code analyzer for this. Please let us know when the paper is published. Could you post this patch plus ChangeLog entry to classpath-patches and commit it? Thanks, Mark -- Escape the Java Trap with GNU Classpath! http://www.gnu.org/philosophy/java-trap.html Join the community at http://planet.classpath.org/ signature.asc Description: This is a digitally signed message part ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: gnu_java_awt_peer_gtk_GdkFontPeer.c (initStaticState): missing NewGlobalRef?
Twisti == Christian Thalinger [EMAIL PROTECTED] writes: Twisti We are currently developing a JNI source code analyzer, which scans for Twisti missing NewGlobalRef calls (this is for popl06). And it seems that it Twisti has found a bug in GNU classpath's gtk peers. Very cool. Perhaps when it is ready we could integrate it into the build, so that errors here are unavoidable? Tom ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Japi vs JEditorPaneAccessibleHypertextSupport
The current japi results show that the only non-minor error in the top-level javax.swing package against 1.2 is that the constructor of JEditorPaneAccessibleHypertextSupport (which I'm going to call JEPAHS from now on because I can't be bothered to type all that) is protected in classpath but public in the JDK. I thought that would be a nice easy bit of green to add, but when I went to create a patch I realized the problem: there *is* no constructor of JEPAHS. Basically, JEPAHS is a protected non-static inner class of JEditorPane so the compiler translates the usual default no-argument constructor into a constructor that takes a JEditorPane argument[1]. However, it looks like javac makes that constructor public where gcj(?) is making it protected. What I'm wondering is whether this is a compiler bug or whether it's simply undefined behavior that japi should account for and ignore. My guess is that the compiler is wrong. It seems to me that a subclass of JEditorPane (that's not in the same package) wouldn't be able to access the constructor if it were protected, because protected would mean accessible to subclasses of JEPAHS, not of JEditorPane. Anyone have any ideas whether I'm right or wrong about this? If I'm right, I suspect we could work around the compiler bug by explicitly declaring a no-argument public constructor in the class, but it would probably be better to fix the compiler. On the other hand, that would mean a japi error we can't eliminate until the next gcc release... Thoughts? Stuart. [1] Which raises another japi question: Should Japi automatically remove these implicit arguments from nonstatic inner class constructors so that its output matches what you'd actually put in Java source? My gut feeling is yes, but I'm not sure exactly how to detect them... -- http://sab39.dev.netreach.com/ ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: Japi vs JEditorPaneAccessibleHypertextSupport
Stuart The current japi results show that the only non-minor error in the Stuart top-level javax.swing package against 1.2 is that the constructor of Stuart JEditorPaneAccessibleHypertextSupport I love the description of this constructor in the online javadoc. Stuart Basically, JEPAHS is a protected non-static inner class of JEditorPane Stuart so the compiler translates the usual default no-argument constructor Stuart into a constructor that takes a JEditorPane argument[1]. However, it Stuart looks like javac makes that constructor public where gcj(?) is making Stuart it protected. The rule is, a default constructor inherits the access of its class. I.E., 'protected' is correct here. So, we should just define our own public no-argument constructor here. Stuart [1] Which raises another japi question: Should Japi automatically Stuart remove these implicit arguments from nonstatic inner class Stuart constructors so that its output matches what you'd actually put in Stuart Java source? My gut feeling is yes, but I'm not sure exactly how to Stuart detect them... Perhaps you can do it by noticing if the class has a synthetic 'this$0' field. This is the usual name for an 'outer this' reference, meaning that the class is not static. Tom ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: Japi vs JEditorPaneAccessibleHypertextSupport
On 08 Nov 2005 19:23:14 -0700, Tom Tromey [EMAIL PROTECTED] wrote: I love the description of this constructor in the online javadoc. Lol, classic. The rule is, a default constructor inherits the access of its class. I.E., 'protected' is correct here. Doesn't that mean that a class that inherits from JEditorPane can see the class but not the constructor? And isn't that a little weird? (Not disputing your JLS expertise, mind you :) ) Perhaps you can do it by noticing if the class has a synthetic 'this$0' field. This is the usual name for an 'outer this' reference, meaning that the class is not static. Does every nonstatic inner class get its outer this prepended to every constructor? (It's easy enough to detect that the class isn't static, we already flag a japi error if the staticness is wrong) What about a doubly-nested inner class, does it get two or just the innermost? Stuart. -- http://sab39.dev.netreach.com/ ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: Japi vs JEditorPaneAccessibleHypertextSupport
Stuart == Stuart Ballard [EMAIL PROTECTED] writes: The rule is, a default constructor inherits the access of its class. I.E., 'protected' is correct here. Stuart Doesn't that mean that a class that inherits from JEditorPane can see Stuart the class but not the constructor? And isn't that a little weird? (Not Stuart disputing your JLS expertise, mind you :) ) Oh, no... access control quiz! I think you are right, the access is disallowed. It is a bit weird but the default constructor access rule is pretty definitive: http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#16823 The inherited member class can still be used in this case by making a subclass of it. Perhaps you can do it by noticing if the class has a synthetic 'this$0' field. This is the usual name for an 'outer this' reference, meaning that the class is not static. Stuart Does every nonstatic inner class get its outer this prepended to every Stuart constructor? (It's easy enough to detect that the class isn't static, Stuart we already flag a japi error if the staticness is wrong) Stuart What about a doubly-nested inner class, does it get two or Stuart just the innermost? Just the immediate outer instance is passed in. Suppose you're making an instance of a doubly-nested inner class: class Outer { class Middle { class Inner { } } } You have to write something like middle.new Inner(). The middle instance here, however it was made, already has its own 'this$0' pointing at the instance of Outer. Hmm, actually there is a weird case, I think, where both the instantiated class and its superclass have outer instances. I forget what happens in this situation. Tom ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: Japi vs JEditorPaneAccessibleHypertextSupport
Stuart == Stuart Ballard [EMAIL PROTECTED] writes: Stuart [1] Which raises another japi question: Should Japi automatically Stuart remove these implicit arguments from nonstatic inner class Stuart constructors so that its output matches what you'd actually put in Stuart Java source? My gut feeling is yes, but I'm not sure exactly how to Stuart detect them... It occurs to me that the official way is to look at the InnerClasses attribute and see whether the class is static. Though... I think some versions of gcj (maybe even the current one?) emit this incorrectly. Tom ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
[commit-cp] classpath ./ChangeLog javax/swing/JComponent.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Audrius MeÂkauskas [EMAIL PROTECTED] 05/11/08 10:37:21 Modified files: . : ChangeLog javax/swing: JComponent.java Log message: 2005-11-08 Audrius Meskauskas [EMAIL PROTECTED] * javax/swing/JComponent.java (setMaximumSize, setMinimumSize, setPreferredSize): Clone the passed parameter. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5503tr2=1.5504r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JComponent.java.diff?tr1=1.75tr2=1.76r1=textr2=text
[commit-cp] classpath ./ChangeLog java/awt/Component.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 11:50:46 Modified files: . : ChangeLog java/awt : Component.java Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * java/awt/Component.java (invalidate): Don't invalidate invalid parents. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5505tr2=1.5506r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/awt/Component.java.diff?tr1=1.85tr2=1.86r1=textr2=text
[commit-cp] classpath ./ChangeLog java/awt/Container.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 13:25:32 Modified files: . : ChangeLog java/awt : Container.java Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * java/awt/Container.java (getAlignmentX): Refer to the layout managers layoutAlignmentX property if layout manager is a LayoutManager2. (getAlignmentY): Refer to the layout managers layoutAlignmentY property if layout manager is a CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5507tr2=1.5508r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/awt/Container.java.diff?tr1=1.66tr2=1.67r1=textr2=text
[commit-cp] classpath ./ChangeLog javax/swing/JComponent.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 13:53:59 Modified files: . : ChangeLog javax/swing: JComponent.java Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/JComponent.java (alignmentX): Changed default value to -1.0. (alignmentY): Changed default value to -1.0. (getAlignmentX): If no value has been set, refer to the superclass behaviour. (getAlignmentY): If no value has been set, refer to the superclass behaviour. (setAlignmentX): Catch invalid values and adjust them to the nearest valid value. (setAlignmentY): Catch invalid values and adjust them to the nearest valid value. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5508tr2=1.5509r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JComponent.java.diff?tr1=1.76tr2=1.77r1=textr2=text
[commit-cp] classpath ./ChangeLog javax/swing/JRootPane.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 14:12:45 Modified files: . : ChangeLog javax/swing: JRootPane.java Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/JRootPane.java (RootLayout.glassPaneBounds): New field. (RootLayout.layeredPaneBounds): New field. (RootLayout.contentPaneBounds): New field. (RootLayout.menuBarBounds): New field. (RootLayout.prefSize): New field. (getLayoutAlignmentX): Return 0.0F here. (getLayoutAlignmentY): Return 0.0F here. (invalidateLayout): Throw away cached layout information. (layoutContainer): Simplified and fixed the layout. Use cache if possible. (preferredLayoutSize): Simplified and fixed the layout. Use cache if possible. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5509tr2=1.5510r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JRootPane.java.diff?tr1=1.31tr2=1.32r1=textr2=text
[commit-cp] classpath java/awt/BorderLayout.java ./ChangeLog
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 14:29:55 Modified files: java/awt : BorderLayout.java . : ChangeLog Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * java/awt/BorderLayout.java (getAlignmentX): Return 0.5F here. (getAlignmentY): Return 0.5F here. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/awt/BorderLayout.java.diff?tr1=1.20tr2=1.21r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5510tr2=1.5511r1=textr2=text
[commit-cp] classpath ./ChangeLog javax/swing/plaf/basic/Ba...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 15:03:11 Modified files: . : ChangeLog javax/swing/plaf/basic: BasicTextUI.java Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTextUI.java (installDefaults): Initialize background field correctly. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5511tr2=1.5512r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java.diff?tr1=1.51tr2=1.52r1=textr2=text
[commit-cp] classpath ./ChangeLog java/lang/String.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Anthony Balkissoon [EMAIL PROTECTED] 05/11/08 16:04:49 Modified files: . : ChangeLog java/lang : String.java Log message: 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * java/lang/String.java: (replace): Use a StringBuilder instead of a StringBuffer because this is faster and we don't need thread-safety. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5512tr2=1.5513r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/lang/String.java.diff?tr1=1.75tr2=1.76r1=textr2=text
[commit-cp] classpath ./ChangeLog javax/swing/text/DefaultS...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Anthony Balkissoon [EMAIL PROTECTED] 05/11/08 16:43:29 Modified files: . : ChangeLog javax/swing/text: DefaultStyledDocument.java Log message: 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * javax/swing/text/DefaultStyledDocument.java: (ElementBuffer.clone): New API method. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5513tr2=1.5514r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/text/DefaultStyledDocument.java.diff?tr1=1.16tr2=1.17r1=textr2=text
[commit-cp] classpath ./ChangeLog java/awt/event/Invocation...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Anthony Balkissoon [EMAIL PROTECTED] 05/11/08 20:51:39 Modified files: . : ChangeLog java/awt/event : InvocationEvent.java Log message: 2005-11-08 Anthony Balkissoon [EMAIL PROTECTED] * java/awt/event/InvocationEvent.java: (exception): Removed unnecessary field. (dispatch): Removed reference to field exception. (getException): If throwable is an Exception, return a casted version, otherwise return null. (getThrowable): Improved docs. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5515tr2=1.5516r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/awt/event/InvocationEvent.java.diff?tr1=1.10tr2=1.11r1=textr2=text
[commit-cp] classpath ./ChangeLog javax/swing/plaf/basic/Ba...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Lillian Angel [EMAIL PROTECTED] 05/11/08 20:59:05 Modified files: . : ChangeLog javax/swing/plaf/basic: BasicTreeUI.java javax/swing: JTree.java JOptionPane.java java/awt : Window.java Log message: 2005-11-08 Lillian Angel [EMAIL PROTECTED] * java/awt/Window.java (setLocationRelativeTo): Changed x and y to use getLocationOnScreen and moved setLocation call outside of check. * javax/swing/JOptionPane.java (createDialog): Moved pack call and setLocationRelativeTo call here and removed these calls from all other functions that call createDialog. Also, removed FIXME, since call to setLocationRelativeTo fixes this. (showConfirmDialog): Removed pack and setLocationRelativeTo calls. (showConfirmDialog): Likewise. (showConfirmDialog): Likewise. (showConfirmDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showInputDialog): Likewise. (showMessageDialog): Likewise. (showMessageDialog): Likewise. (showOptionDialog): Likewise. * javax/swing/JTree.java (JTree): Should not use a shared instance of the selection model. It is a problem when one application has two different trees. * javax/swing/plaf/basic/BasicTreeUI.java (paintRow): Changed parameter to be the focus of the tree. (updateCurrentVisiblePath): Adjusted root path incase the root is hidden. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5516tr2=1.5517r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java.diff?tr1=1.108tr2=1.109r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JTree.java.diff?tr1=1.50tr2=1.51r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JOptionPane.java.diff?tr1=1.22tr2=1.23r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/awt/Window.java.diff?tr1=1.62tr2=1.63r1=textr2=text
[commit-cp] classpath ./ChangeLog javax/swing/plaf/basic/Ba...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 21:13:39 Modified files: . : ChangeLog javax/swing/plaf/basic: BasicInternalFrameUI.java Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicInternalFrameUI.java (GlassPaneDispatcher.acquireComponentForMouseEvent): Use the frame's layeredPane as parent instead of the content pane when searching for the event target. This way a possibly set menubar is also included in the search. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5517tr2=1.5518r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java.diff?tr1=1.22tr2=1.23r1=textr2=text
[commit-cp] classpath javax/swing/text/CompositeView.java ....
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Roman Kennke [EMAIL PROTECTED]05/11/08 21:19:33 Modified files: javax/swing/text: CompositeView.java . : ChangeLog Log message: 2005-11-08 Roman Kennke [EMAIL PROTECTED] * javax/swing/text/CompositeView.java (modelToView): Adjust the allocation to the child allocation before forwarding to the child's modelToView. Replaced AssertionError by BadLocationException, because that is the right thing to do here. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/text/CompositeView.java.diff?tr1=1.10tr2=1.11r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5518tr2=1.5519r1=textr2=text
[commit-cp] classpath gnu/classpath/SystemProperties.java ....
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Tom Tromey [EMAIL PROTECTED] 05/11/08 21:53:23 Modified files: gnu/classpath : SystemProperties.java . : ChangeLog Log message: * gnu/classpath/SystemProperties.java: Don't mention gnu.java.awt.FocusManager. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/gnu/classpath/SystemProperties.java.diff?tr1=1.9tr2=1.10r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5519tr2=1.5520r1=textr2=text
[commit-cp] classpath ./ChangeLog examples/gnu/classpath/ex...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Lillian Angel [EMAIL PROTECTED] 05/11/08 22:42:45 Modified files: . : ChangeLog examples/gnu/classpath/examples/swing: GNULookAndFeel.java Log message: 2005-11-08 Lillian Angel [EMAIL PROTECTED] * examples/gnu/classpath/examples/swing/GNULookAndFeel.java (getDefaults): Added icons for checkboxes and radiobutton. (CheckBoxIcon): New class, implemented. (RadioButtonIcon): New class, implemented. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5520tr2=1.5521r1=textr2=text http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java.diff?tr1=1.3tr2=1.4r1=textr2=text