Re: [cp-patches] FYI: JTable fixlet:Mail Message possibly broken?
On Tue, Jul 25, 2006 at 08:42:58AM +0200, Audrius Meskauskas wrote: The Thunderbird cannot open the attached patch which should be even not compressed. I can easily open all other patches, including the patch on LightweightDispatcher form Roman today. I would suggest to resend for the peace of mind. Its a 0-byte diff. This just means no changes. :-) Michael -- http://www.worldforge.org/
[cp-patches] FYI: TabSet.equals() and hashCode() - new method overrides
This patch (committed) adds new method overrides introduced in JDK1.5 and fixes a minor bug in the toString() method: 2006-07-25 David Gilbert [EMAIL PROTECTED] * javax/swing/text/TabSet.java (equals): New method override for 1.5, (hashCode): Likewise, (toString): Added spaces to match reference implementation. Regards, Dave Index: javax/swing/text/TabSet.java === RCS file: /sources/classpath/classpath/javax/swing/text/TabSet.java,v retrieving revision 1.4 diff -u -r1.4 TabSet.java --- javax/swing/text/TabSet.java24 Jul 2006 17:14:51 - 1.4 +++ javax/swing/text/TabSet.java25 Jul 2006 09:09:26 - @@ -1,5 +1,5 @@ /* TabSet.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -80,6 +80,13 @@ return tabs[i]; } + /** + * Returns the tab following the specified location. + * + * @param location the location. + * + * @return The tab following the specified location (or codenull/code). + */ public TabStop getTabAfter(float location) { int idx = getTabIndexAfter(location); @@ -130,6 +137,55 @@ } return -1; } + + /** + * Tests this codeTabSet/code for equality with an arbitrary object. + * + * @param obj the object (codenull/code permitted). + * + * @return codetrue/code if this codeTabSet/code is equal to + * codeobj/code, and codefalse/code otherwise. + * + * @since 1.5 + */ + public boolean equals(Object obj) + { +if (obj == this) + return true; +if (!(obj instanceof TabSet)) + return false; +TabSet that = (TabSet) obj; +int tabCount = getTabCount(); +if (tabCount != that.getTabCount()) + return false; +for (int i = 0; i tabCount; i++) + { +if (!this.getTab(i).equals(that.getTab(i))) + return false; + } +return true; + } + + /** + * Returns a hash code for this codeTabSet/code. + * + * @return A hash code. + * + * @since 1.5 + */ + public int hashCode() + { +// this hash code won't match Sun's, but that shouldn't matter... +int result = 193; +int tabs = getTabCount(); +for (int i = 0; i tabs; i++) + { +TabStop t = getTab(i); +if (t != null) + result = 37 * result + t.hashCode(); + } +return result; + } /** * Returns a string representation of this codeTabSet/code. @@ -139,14 +195,14 @@ public String toString() { StringBuffer sb = new StringBuffer(); -sb.append([); +sb.append([ ); for (int i = 0; i tabs.length; ++i) { if (i != 0) sb.append( - ); sb.append(tabs[i].toString()); } -sb.append(]); +sb.append( ]); return sb.toString(); } }
[cp-patches] FYI: BasicInternalFrameUI fixes
The glasspane in JInternalFrames should be visible when the frame is deselected but invisible when the frame gets selected. The whole point of this glasspane is to catch MouseEvents and select the frame as soon as the mouse is pressed on it. I have also rewritten parts of the GlassPane, it's been overly complicated before (maybe due to some previous problems with the LightweightDispatcher). 2006-07-25 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicInternalFrameUI.java (GlassPaneDispatcher.dragTarget): New field. (GlassPaneDispatcher.isDragging): New field. (GlassPaneDispatcher.pressedComponent): Removed field. (GlassPaneDispatcher.tempComponent): Removed field. (GlassPaneDispatcher.pressCount): Removed field. (GlassPaneDispatcher.mousePressed): Call borderListener.mousePressed() to activate the frame. (acquireComponentForMouseEvent): Removed method. (handleEvent): Rewritten. (redispatch): New method. (InternalFramePropertyChangeListener.propertyChange): Make glasspane invisible when frame is selected, and visible if it gets deselected. /Roman Index: javax/swing/plaf/basic/BasicInternalFrameUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,v retrieving revision 1.39 diff -u -1 -2 -r1.39 BasicInternalFrameUI.java --- javax/swing/plaf/basic/BasicInternalFrameUI.java 23 Jun 2006 12:28:32 - 1.39 +++ javax/swing/plaf/basic/BasicInternalFrameUI.java 25 Jul 2006 09:55:26 - @@ -29,25 +29,24 @@ modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package javax.swing.plaf.basic; -import java.awt.AWTEvent; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.LayoutManager2; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; @@ -683,35 +682,30 @@ } /** * This helper class is used to listen to the JDesktopPane's glassPane for * MouseEvents. The JInternalFrame can then be selected if a click is * detected on its children. */ protected class GlassPaneDispatcher implements MouseInputListener { /** The MouseEvent target. */ private transient Component mouseEventTarget; -/** The component pressed. */ -private transient Component pressedComponent; +private Component dragTarget; -/** The last component entered. */ -private transient Component lastComponentEntered; - -/** Used to store/reset lastComponentEntered. */ -private transient Component tempComponent; - -/** The number of presses. */ -private transient int pressCount; +/** + * Indicates if we are currently in a dragging operation or not. + */ +private boolean isDragging; /** * This method is called when the mouse enters the glass pane. * * @param e * The MouseEvent. */ public void mouseEntered(MouseEvent e) { handleEvent(e); } @@ -758,184 +752,142 @@ { handleEvent(e); } /** * This method is called when the mouse is pressed in the glass pane. * * @param e * The MouseEvent. */ public void mousePressed(MouseEvent e) { - activateFrame(frame); + // Experiments show that this seems to call the + // borderListener.mousePressed() method to activate the frame. + if (borderListener != null) +borderListener.mousePressed(e); handleEvent(e); } /** * This method is called when the mouse is released in the glass pane. * * @param e * The MouseEvent. */ public void mouseReleased(MouseEvent e) { handleEvent(e); } /** - * This method acquires a candidate component to dispatch the MouseEvent to. + * This is a helper method that dispatches the GlassPane MouseEvents to the + * proper component. * - * @param me - * The MouseEvent to acquire a component for. + * @param e the mouse event to be dispatched */ -private void acquireComponentForMouseEvent(MouseEvent me) +private void handleEvent(MouseEvent e) { - int x = me.getX(); - int y =
[cp-patches] FYI: BasicLookAndFeel in Swing Demo
Hi, this patch makes it possible to see the basic look and feel in action in our Swing demo. In the future this may help to get customs LaFs working which directly build upon the Basic Look And Feel. 2006-07-25 Robert Schuster [EMAIL PROTECTED] * examples/gnu/classpath/examples/swing/Demo.java: (mkMenuBar): Install instantiable basic look and feel. (InstantiableBasicLookAndFeel): New inner class. cya Robert Index: examples/gnu/classpath/examples/swing/Demo.java === RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v retrieving revision 1.48 diff -u -r1.48 Demo.java --- examples/gnu/classpath/examples/swing/Demo.java 16 Jun 2006 20:46:54 - 1.48 +++ examples/gnu/classpath/examples/swing/Demo.java 25 Jul 2006 10:46:40 - @@ -30,6 +30,7 @@ import javax.swing.*; import javax.swing.tree.*; +import javax.swing.plaf.basic.BasicLookAndFeel; import javax.swing.plaf.metal.DefaultMetalTheme; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalTheme; @@ -192,6 +193,10 @@ } }); +// Installs the BasicLookAndFeel. +UIManager.installLookAndFeel((Basic Look And Feel), + InstantiableBasicLookAndFeel.class.getName()); + // Create LF menu. JMenu lafMenu = new JMenu(Look and Feel); ButtonGroup lafGroup = new ButtonGroup(); @@ -662,10 +667,45 @@ { ex.printStackTrace(); } + SwingUtilities.updateComponentTreeUI(frame); themesMenu.setEnabled(laf.getClassName() .equals(javax.swing.plaf.metal.MetalLookAndFeel)); } + } + /** + * An implementation of BasicLookAndFeel which can be instantiated. + * + * @author Robert Schuster ([EMAIL PROTECTED]) + * + */ + public static class InstantiableBasicLookAndFeel extends BasicLookAndFeel + { +public String getDescription() +{ + return An instantiable implementation of BasicLookAndFeel; +} + +public String getID() +{ + return instantiableBasicLookAndFeel; +} + +public String getName() +{ + return Instantiable Basic Look And Feel; +} + +public boolean isNativeLookAndFeel() +{ + return false; +} + +public boolean isSupportedLookAndFeel() +{ + return true; +} } + } signature.asc Description: OpenPGP digital signature
[cp-patches] FYI: BasicMenuBarUI
I implemented the missing keyboard actions for BasicMenuBarUI. Now it should be possible to bring up the menu using F10. Unfortunately keyboard input seems broken for me so I can't test. 2006-07-25 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicMenuBarUI.java (FocusAction): New inner class. Used to grab focus. (installKeyboardActions): Implemented. (uninstallKeyboardActions): Implemented. (getActionMap): New helper method. (createDefaultActions): New helper method. /Roman Index: javax/swing/plaf/basic/BasicMenuBarUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java,v retrieving revision 1.16 diff -u -1 -2 -r1.16 BasicMenuBarUI.java --- javax/swing/plaf/basic/BasicMenuBarUI.java 17 Apr 2006 07:41:05 - 1.16 +++ javax/swing/plaf/basic/BasicMenuBarUI.java 25 Jul 2006 11:07:53 - @@ -29,50 +29,98 @@ modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package javax.swing.plaf.basic; -import gnu.classpath.NotImplementedException; - import java.awt.Dimension; +import java.awt.event.ActionEvent; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ActionMap; import javax.swing.BoxLayout; +import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.LookAndFeel; import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.MouseInputListener; +import javax.swing.plaf.ActionMapUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.MenuBarUI; /** * UI Delegate for JMenuBar. */ public class BasicMenuBarUI extends MenuBarUI { + + /** + * This action is performed for the action command 'takeFocus'. + */ + private class FocusAction +extends AbstractAction + { + +/** + * Creates a new FocusAction. + */ +FocusAction() +{ + super(takeFocus); +} + +/** + * Performs the action. + */ +public void actionPerformed(ActionEvent event) +{ + // In the JDK this action seems to pop up the first menu of the + // menu bar. + JMenuBar menuBar = (JMenuBar) event.getSource(); + MenuSelectionManager defaultManager = +MenuSelectionManager.defaultManager(); + MenuElement me[]; + MenuElement subElements[]; + JMenu menu = menuBar.getMenu(0); + if (menu != null) +{ + me = new MenuElement[3]; + me[0] = (MenuElement) menuBar; + me[1] = (MenuElement) menu; + me[2] = (MenuElement) menu.getPopupMenu(); + defaultManager.setSelectedPath(me); +} +} + + } + protected ChangeListener changeListener; /*ContainerListener that listens to the ContainerEvents fired from menu bar*/ protected ContainerListener containerListener; /*Property change listeners that listener to PropertyChangeEvent from menu bar*/ private PropertyChangeListener propertyChangeListener; /* menu bar for which this UI delegate is for*/ protected JMenuBar menuBar; /* MouseListener that listens to the mouseEvents fired from menu bar*/ @@ -169,27 +217,64 @@ protected void installDefaults() { LookAndFeel.installBorder(menuBar, MenuBar.border); LookAndFeel.installColorsAndFont(menuBar, MenuBar.background, MenuBar.foreground, MenuBar.font); menuBar.setOpaque(true); } /** * This method installs the keyboard actions for the JMenuBar. */ protected void installKeyboardActions() -throws NotImplementedException { -// FIXME: implement +// Install InputMap. +Object[] bindings = + (Object[]) SharedUIDefaults.get(MenuBar.windowBindings); +InputMap inputMap = LookAndFeel.makeComponentInputMap(menuBar, bindings); +SwingUtilities.replaceUIInputMap(menuBar, + JComponent.WHEN_IN_FOCUSED_WINDOW, + inputMap); + +// Install ActionMap. +
[cp-patches] FYI: Focus fixes
This fixes the initial focus after a Window is made visible. It lets the FocusTraversalPolicy find the initial focused component and requests focus on it. This patch also implements to JDK5 methods in Container. 2006-07-25 Roman Kennke [EMAIL PROTECTED] * java/awt/Container.java (focusTraversalPolicyProvider): New field. (isFocusTraversalPolicyProvider): New method. (setFocusTraversalPolicyProvider): New method. * java/awt/ContainerOrderFocusTraversalPolicy.java (getFirstComponent): Use accept() instead of lengthy checks. Don't fetch getComponents() to avoid copying of array. Traverse down the hierarchy to find the first focused component. * java/awt/DefaultKeyboardFocusManager.java (dispatchEvent): Let the initial component request focus. /Roman Index: java/awt/Container.java === RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v retrieving revision 1.100 diff -u -1 -2 -r1.100 Container.java --- java/awt/Container.java 14 Jul 2006 11:50:53 - 1.100 +++ java/awt/Container.java 25 Jul 2006 13:20:05 - @@ -89,24 +89,31 @@ Dimension maxSize; /** * Keeps track if the Container was cleared during a paint/update. */ private boolean backCleared; /** * @since 1.4 */ boolean focusCycleRoot; + /** + * Indicates if this container provides a focus traversal policy. + * + * @since 1.5 + */ + private boolean focusTraversalPolicyProvider; + int containerSerializedDataVersion; /* Anything else is non-serializable, and should be declared transient. */ transient ContainerListener containerListener; /** The focus traversal policy that determines how focus is transferred between this Container and its children. */ private FocusTraversalPolicy focusTraversalPolicy; /** * The focus traversal keys, if not inherited from the parent or default * keyboard manager. These sets will contain only AWTKeyStrokes that @@ -1601,24 +1608,60 @@ * supports implicit down-cycle traversal operations. * * @param focusCycleRoot true if this is a focus cycle root, false otherwise * * @since 1.4 */ public void setFocusCycleRoot (boolean focusCycleRoot) { this.focusCycleRoot = focusCycleRoot; } /** + * Set to codetrue/code if this container provides a focus traversal + * policy, codefalse/code when the root container's focus + * traversal policy should be used. + * + * @return codetrue/code if this container provides a focus traversal + *policy, codefalse/code when the root container's focus + *traversal policy should be used + * + * @see #setFocusTraversalPolicyProvider(boolean) + * + * @since 1.5 + */ + public final boolean isFocusTraversalPolicyProvider() + { +return focusTraversalPolicyProvider; + } + + /** + * Set to codetrue/code if this container provides a focus traversal + * policy, codefalse/code when the root container's focus + * traversal policy should be used. + * + * @param b codetrue/code if this container provides a focus traversal + *policy, codefalse/code when the root container's focus + *traversal policy should be used + * + * @see #isFocusTraversalPolicyProvider() + * + * @since 1.5 + */ + public final void setFocusTraversalPolicyProvider(boolean b) + { +focusTraversalPolicyProvider = b; + } + + /** * Check whether this Container is a focus cycle root. * * @return true if this is a focus cycle root, false otherwise * * @since 1.4 */ public boolean isFocusCycleRoot () { return focusCycleRoot; } /** Index: java/awt/ContainerOrderFocusTraversalPolicy.java === RCS file: /cvsroot/classpath/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java,v retrieving revision 1.9 diff -u -1 -2 -r1.9 ContainerOrderFocusTraversalPolicy.java --- java/awt/ContainerOrderFocusTraversalPolicy.java 11 May 2006 20:31:13 - 1.9 +++ java/awt/ContainerOrderFocusTraversalPolicy.java 25 Jul 2006 13:20:05 - @@ -337,46 +337,48 @@ * * @exception IllegalArgumentException If root is null. */ public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; -if (root.visible root.isDisplayable() root.enabled - root.focusable) +if (accept(root)) return root; -Component[] componentArray = root.getComponents (); - -for (int i = 0; i componentArray.length; i++) +int ncomponents = root.getComponentCount(); +for (int i = 0; i ncomponents; i++) { -Component component = componentArray [i]; - - if (component.visible component.isDisplayable()
Re: [cp-patches] FYI: BasicMenuBarUI
Works on my computer. Cheers, Francis On Tue, 2006-07-25 at 13:11 +0200, Roman Kennke wrote: I implemented the missing keyboard actions for BasicMenuBarUI. Now it should be possible to bring up the menu using F10. Unfortunately keyboard input seems broken for me so I can't test. 2006-07-25 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicMenuBarUI.java (FocusAction): New inner class. Used to grab focus. (installKeyboardActions): Implemented. (uninstallKeyboardActions): Implemented. (getActionMap): New helper method. (createDefaultActions): New helper method. /Roman
Re: [cp-patches] RFC: StrictMath.expm1 and cosh implemented
Carsten == Carsten Neumann [EMAIL PROTECTED] writes: Carsten this implements java.lang.StrictMath.expm1 and cosh functions. Carsten Corresponding mauve tests are underway. Carsten Please comment/commit. Carsten PS: on 2005-07-22 i already sent the expm1 part of the patch, Carsten but this mail never made it to the list appearently; in case Carsten it shows up at some point, it should be discarded. I'm sure I saw this. I didn't comment since I thought it would be better to wait until you had commit access. Anyway I think these StrictMath additions are good, especially seeing as you've written test cases. Great work! Tom
[cp-patches] FYI: Minor Font, GtkVolatileImage stuff
Just some random minor fixes from my tree. 2006-07-25 Sven de Marothy [EMAIL PROTECTED] * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c (init): Default to the actual depth in the worst case. * java/awt/Font.java (createFont(int, File)): New method. Index: java/awt/Font.java === RCS file: /sources/classpath/classpath/java/awt/Font.java,v retrieving revision 1.36 diff -U3 -r1.36 Font.java --- java/awt/Font.java 16 Jun 2006 16:10:22 - 1.36 +++ java/awt/Font.java 25 Jul 2006 17:51:21 - @@ -48,6 +48,8 @@ import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.peer.FontPeer; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; @@ -583,6 +585,34 @@ } /** + * Creates a new font from a File object. + * + * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int) + * + * @param fontFormat - Integer code indicating the format the font data is + * in.Currently this can only be [EMAIL PROTECTED] #TRUETYPE_FONT}. + * @param file - a [EMAIL PROTECTED] File} from which font data will be read. + * + * @return A new [EMAIL PROTECTED] Font} of the format indicated. + * + * @throws IllegalArgumentException if codefontType/code is not + * recognized. + * @throws NullPointerException if codefile/code is codenull/code. + * @throws FontFormatException if data in the file is invalid or cannot be read.. + * @throws SecurityException if the caller has no read permission for the file. + * @throws IOException if the file cannot be read + * + * @since 1.5 + */ + public static Font createFont (int fontFormat, File file) +throws FontFormatException, IOException + { +if( file == null ) + throw new NullPointerException(Null file argument); +return tk().createFont(fontFormat, new FileInputStream( file )); + } + + /** * Maps characters to glyphs in a one-to-one relationship, returning a new * [EMAIL PROTECTED] GlyphVector} with a mapped glyph for each input character. This * sort of mapping is often sufficient for some scripts such as Roman, but Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c === RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,v retrieving revision 1.5 diff -U3 -r1.5 gnu_java_awt_peer_gtk_GtkVolatileImage.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c 10 Jun 2006 14:16:09 - 1.5 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c 25 Jul 2006 17:51:23 - @@ -73,7 +73,8 @@ pixmap = gdk_pixmap_new( widget-window, width, height, -1 ); } else -pixmap = gdk_pixmap_new( NULL, width, height, 16 ); +pixmap = gdk_pixmap_new( NULL, width, height, + gdk_rgb_get_visual()-depth ); gdk_threads_leave();
[cp-patches] FYI: JTabbedPane fixes
Hi, this patch fixes some minor JTabbedPane issues. 2006-07-25 Robert Schuster [EMAIL PROTECTED] * javax/swing/JTabbedPane.java: (remove(Component)): Rewritten. (setSelectedIndex): Implemented updating of component visibility state. cya Robert Index: javax/swing/JTabbedPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTabbedPane.java,v retrieving revision 1.41 diff -u -r1.41 JTabbedPane.java --- javax/swing/JTabbedPane.java 9 Jun 2006 23:34:34 - 1.41 +++ javax/swing/JTabbedPane.java 25 Jul 2006 19:17:46 - @@ -990,7 +990,17 @@ checkIndex(index, -1, tabs.size()); if (index != getSelectedIndex()) { +// Hiding and showing the involved components +// is important for the focus traversal mechanism +// to report the correct source and destination +// components. +Component c = getSelectedComponent(); +if (c != null) + c.setVisible(false); + model.setSelectedIndex(index); + +getSelectedComponent().setVisible(true); } } @@ -1247,7 +1257,25 @@ */ public void remove(Component component) { -super.remove(component); +// Container.remove(Component) is implemented in a +// way that it calls Container.remove(int). Since +// JTabbedPane's remove(int) is overridden to +// remove tabs and this in turn should not happen +// with components implementing UIResource +// we find out the component's index and +// call the superclass' remove(int) method +// directly. +// For non-UIResource implementing components +// the normal implementation is suitable. +if (component instanceof UIResource) + { +Component[] cs = getComponents(); +for (int i = 0; i cs.length; i++) + if (cs[i] == component) +super.remove(i); + } +else + super.remove(component); } /** @@ -1257,7 +1285,6 @@ */ public void remove(int index) { -super.remove(index); removeTabAt(index); } signature.asc Description: OpenPGP digital signature
[cp-patches] FYI: Fix for PR27844
Hi, the attached patch fixes the drawing problem for one pixel sized lines. ChangeLog: 2006-07-25 Robert Schuster [EMAIL PROTECTED] Fixes PR27844. * java/awt/peer/gtk/CairoGraphics.java: (drawLine): Removed calls to shifted(). cya Robert Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.31 diff -u -r1.31 CairoGraphics2D.java --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 24 Jul 2006 11:01:12 - 1.31 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 25 Jul 2006 20:12:59 - @@ -1038,9 +1038,7 @@ public void drawLine(int x1, int y1, int x2, int y2) { -cairoDrawLine(nativePointer, shifted(x1, shiftDrawCalls), - shifted(y1, shiftDrawCalls), shifted(x2, shiftDrawCalls), - shifted(y2, shiftDrawCalls)); +cairoDrawLine(nativePointer, x1, y1, x2 + 0.5, y2 + 0.5); } public void drawRect(int x, int y, int width, int height) signature.asc Description: OpenPGP digital signature
Re: [cp-patches] FYI: Component.setName() fix
Mark == Mark Wielaard [EMAIL PROTECTED] writes: Mark Yes that would be very nice. This is really one of the issues that hold Mark up the creation of the release branch. I want to make sure that we don't Mark have (bad) mauve regressions. But I didn't have a full comparison Mark between a 0.91 run and a current CVS run. I do manual runs now and I am Mark going through them slowly (as you can see from these emails). But it is Mark a bit hard to keep up with you people committing 10 till 20 patches a Mark day :) Andrew Hughes set this up on builder but when I look now I see that the baseline files are empty. It sort of doesn't matter since you would have to re-run Mauve anyway, given that the test names have all changed. If you had a build of 0.91 + the corresponding jamvm you could make a Mauve baseline and run a comparison quite easily. Ideally we would do this after each release and simply reset the baseline file on builder. Then we could see regression reports versus the previous release automatically. Tom
[cp-patches] FYI: Focus fixlet
Hey, A tiny path (already committed) for the focus work done recently, fixing the null pointer exceptions. Cheers, Francis 2006-07-25 Francis Kung [EMAIL PROTECTED] * java/awt/DefaultKeyboardFocusManager.java (dispatchEvent): Add check for valid component. Index: java/awt/DefaultKeyboardFocusManager.java === RCS file: /cvsroot/classpath/classpath/java/awt/DefaultKeyboardFocusManager.java,v retrieving revision 1.19 diff -u -r1.19 DefaultKeyboardFocusManager.java --- java/awt/DefaultKeyboardFocusManager.java 25 Jul 2006 13:21:04 - 1.19 +++ java/awt/DefaultKeyboardFocusManager.java 25 Jul 2006 22:00:36 - @@ -167,7 +167,8 @@ setGlobalFocusedWindow (target); FocusTraversalPolicy p = target.getFocusTraversalPolicy(); Component toFocus = p.getInitialComponent(target); -toFocus.requestFocusInWindow(); +if (toFocus != null) + toFocus.requestFocusInWindow(); } else if (e.id != WindowEvent.WINDOW_LOST_FOCUS e.id != WindowEvent.WINDOW_DEACTIVATED)
[cp-patches] FYI: BasicPopupMenuUI keyboard actions
I implemented the keyboard actions for BasicPopupMenuUI. Now you can navigate through menus using the arrow keys and activate an item using ENTER, or cancel using ESC. (with the latest fixes you can also activate the menubar with F10, so you can use menus compeletely without mouse now :-D) It has been quite tricky to implement this. The keyboard actions have to be installed as WHEN_IN_FOCUSED_WINDOW. However, since more than one JPopupMenu can be opened in one window, the mappings would mess up, because the mappings are stored in a window-keystroke mapping. I implemented it so that the keyboard actions for a popup are installed when a JPopupMenu opens, and are deinstalled when it is closed. This way, only the currently active PopupMenu can receive keyboard actions. 2006-07-25 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicPopupMenuUI.java (NavigateAction): New inner class. This is responsible for keyboard navigation through menus. (KeyboardHelper): New inner class. This manages the keyboard mappings and focus when a popup opens or closes. (keyboardHelper): New static field. (numPopups): New static field. (installUI): Create KeyboardHelper for first popup. Call installKeyboardActions(). (installKeyboardActions): Removed NotImplementedException. This method is a no-op. (installKeyboardActionsImpl): New method. Installs keyboard mapping when a popup is opened. (getActionMap): New helper method. (createDefaultActions): New helper method. (uninstallUI): Uninstall KeyboardHelper when last Popup is uninstalled. Call uninstallKeyboardActions(). (uninstallKeyboardActions): Removed NotImplementedException. This method is a no-op. (uninstallKeyboardActionsImpl): New method. Uninstalls keyboard mapping when a popup is closed. /Roman Index: javax/swing/plaf/basic/BasicPopupMenuUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java,v retrieving revision 1.19 diff -u -1 -2 -r1.19 BasicPopupMenuUI.java --- javax/swing/plaf/basic/BasicPopupMenuUI.java 21 Jun 2006 16:10:20 - 1.19 +++ javax/swing/plaf/basic/BasicPopupMenuUI.java 25 Jul 2006 22:52:15 - @@ -28,62 +28,616 @@ executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package javax.swing.plaf.basic; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.Dimension; +import java.awt.KeyboardFocusManager; +import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.MouseEvent; +import java.util.EventListener; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ActionMap; import javax.swing.BoxLayout; +import javax.swing.InputMap; +import javax.swing.JApplet; import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import javax.swing.JRootPane; import javax.swing.LookAndFeel; import javax.swing.MenuElement; import javax.swing.MenuSelectionManager; import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; +import javax.swing.plaf.ActionMapUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.PopupMenuUI; - /** * UI Delegate for JPopupMenu */ public class BasicPopupMenuUI extends PopupMenuUI { + /** + * Handles keyboard navigation through menus. + */ + private static class NavigateAction +extends AbstractAction + { + +/** + * Creates a new NavigateAction instance. + * + * @param name the name of the action + */ +NavigateAction(String name) +{ + super(name); +} + +/** + * Actually performs the action. + */ +public void actionPerformed(ActionEvent event) +{ + String name = (String) getValue(Action.NAME); + if (name.equals(selectNext)) +navigateNextPrevious(true); + else if (name.equals(selectPrevious)) +navigateNextPrevious(false); + else if
Re: [cp-patches] FYI: JTabbedPane fixes
Hi Robert, On Tue, 2006-07-25 at 21:21 +0200, Robert Schuster wrote: Hi, this patch fixes some minor JTabbedPane issues. 2006-07-25 Robert Schuster [EMAIL PROTECTED] * javax/swing/JTabbedPane.java: (remove(Component)): Rewritten. (setSelectedIndex): Implemented updating of component visibility state. This seems to revert part of a patch from Roman: 2006-06-09 Roman Kennke [EMAIL PROTECTED] * javax/swing/JTabbedPane.java (setSelectedIndex): Don't change the visibility of the components, this is done by the UI class. * javax/swing/plaf/basic/BasicTabbedPaneUI.java (TabbedPaneLayout.layoutContainer): Change visibility of component here, depending on the selected index. Only do this if the new selected component is not null. Some programs seem to expect this. (visibleComponent): New field. (getVisibleComponent): Changed to return visibleComponent field. (setVisibleComponent): Changed to set the visibility of the old and new visible component. And it does indeed seem to break the showcase application Roman posted about: http://kennke.org/blog/?p=9 Could you coordinate on a correct fix? Thanks, Mark