[cp-patches] FYI: java/io/ObjectInputStream.java
Hi, I committed the attached patch to fix proxy deserialization (bug 24422). Regards, Jeroen 2005-10-18 Jeroen Frijters [EMAIL PROTECTED] * java/io/ObjectInputStream.java (parseContent): Removed bogus println and fixed bug #24422. Index: java/io/ObjectInputStream.java === RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v retrieving revision 1.69 diff -u -r1.69 ObjectInputStream.java --- java/io/ObjectInputStream.java 12 Oct 2005 19:41:42 - 1.69 +++ java/io/ObjectInputStream.java 18 Oct 2005 07:17:29 - @@ -221,7 +221,6 @@ for (int i = 0; i n_intf; i++) { intfs[i] = this.realInputStream.readUTF(); - System.out.println(intfs[i]); } boolean oldmode = setBlockDataMode(true); @@ -229,6 +228,21 @@ setBlockDataMode(oldmode); ObjectStreamClass osc = lookupClass(cl); + if (osc.firstNonSerializableParentConstructor == null) +{ + osc.realClassIsSerializable = true; + osc.fields = osc.fieldMapping = new ObjectStreamField[0]; + try +{ + osc.firstNonSerializableParentConstructor = +Object.class.getConstructor(new Class[0]); +} + catch (NoSuchMethodException x) +{ + throw (InternalError) +new InternalError(Object ctor missing).initCause(x); +} +} assignNewHandle(osc); if (!is_consumed) ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: ScrollPaneLayout fixes
Hi, The following patch solves a small but significant layout problem with JScrollPanes. The layout manager has to respect the insets of the JScrollPane properly. This is checked in. 2005-10-18 Roman Kennke [EMAIL PROTECTED] * javax/swing/ScrollPaneLayout.java (preferredLayoutSize): Removed check for JScrollPane argument. Added code to respect the insets of the JScrollPane. (minimumLayoutSize): Likewise. (layoutContainer): Removed check for JScrollPane argument. /Roman Index: javax/swing/ScrollPaneLayout.java === RCS file: /cvsroot/classpath/classpath/javax/swing/ScrollPaneLayout.java,v retrieving revision 1.18 diff -u -r1.18 ScrollPaneLayout.java --- javax/swing/ScrollPaneLayout.java 13 Oct 2005 18:33:05 - 1.18 +++ javax/swing/ScrollPaneLayout.java 18 Oct 2005 09:46:24 - @@ -43,12 +43,9 @@ import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager; -import java.awt.Point; import java.awt.Rectangle; import java.io.Serializable; -import javax.swing.border.Border; - /** * ScrollPaneLayout * @author Andrew Selkirk @@ -64,6 +61,7 @@ { public UIResource() { + super(); } } @@ -79,8 +77,9 @@ protected int vsbPolicy; protected int hsbPolicy; - public ScrollPaneLayout() { - + public ScrollPaneLayout() + { + // Nothing to do here. } public void syncWithScrollPane(JScrollPane scrollPane) { @@ -255,46 +254,44 @@ public Dimension preferredLayoutSize(Container parent) { -if (parent != null parent instanceof JScrollPane) - { -JScrollPane sc = (JScrollPane) parent; -Dimension viewportSize = viewport.getPreferredSize(); -int width = viewportSize.width; -int height = viewportSize.height; -if (hsb != null hsb.isVisible()) - height += hsb.getPreferredSize().height; -if (vsb != null vsb.isVisible()) - width += vsb.getPreferredSize().width; -if (rowHead != null rowHead.isVisible()) - width += rowHead.getPreferredSize().width; -if (colHead != null colHead.isVisible()) - height += colHead.getPreferredSize().height; -return new Dimension(width, height); - } -// TODO: Probably throw an exception here. Check this. -return new Dimension(0, 0); +// Sun's implementation simply throws a ClassCastException if +// parent is no JScrollPane, so do we. +JScrollPane sc = (JScrollPane) parent; +Dimension viewportSize = viewport.getPreferredSize(); +int width = viewportSize.width; +int height = viewportSize.height; +if (hsb != null hsb.isVisible()) + height += hsb.getPreferredSize().height; +if (vsb != null vsb.isVisible()) + width += vsb.getPreferredSize().width; +if (rowHead != null rowHead.isVisible()) + width += rowHead.getPreferredSize().width; +if (colHead != null colHead.isVisible()) + height += colHead.getPreferredSize().height; +Insets i = sc.getInsets(); +return new Dimension(width + i.left + i.right, + height + i.left + i.right); } public Dimension minimumLayoutSize(Container parent) { -if (parent != null parent instanceof JScrollPane) - { -JScrollPane sc = (JScrollPane) parent; -Dimension viewportSize = viewport.getMinimumSize(); -int width = viewportSize.width; -int height = viewportSize.height; -if (hsb != null hsb.isVisible()) - height += hsb.getMinimumSize().height; -if (vsb != null vsb.isVisible()) - width += vsb.getMinimumSize().width; -if (rowHead != null rowHead.isVisible()) - width += rowHead.getMinimumSize().width; -if (colHead != null colHead.isVisible()) - height += colHead.getMinimumSize().height; -return new Dimension(width, height); - } -// TODO: Probably throw an exception here. Check this. -return new Dimension(0, 0); +// Sun's implementation simply throws a ClassCastException if +// parent is no JScrollPane, so do we. +JScrollPane sc = (JScrollPane) parent; +Dimension viewportSize = viewport.getMinimumSize(); +int width = viewportSize.width; +int height = viewportSize.height; +if (hsb != null hsb.isVisible()) + height += hsb.getMinimumSize().height; +if (vsb != null vsb.isVisible()) + width += vsb.getMinimumSize().width; +if (rowHead != null rowHead.isVisible()) + width += rowHead.getMinimumSize().width; +if (colHead != null colHead.isVisible()) + height += colHead.getMinimumSize().height; +Insets i = sc.getInsets(); +return new Dimension(width + i.left + i.right, + height + i.top + i.bottom); } /** @@ -320,94 +317,91 @@ */ public void layoutContainer(Container parent) { -if (parent instanceof JScrollPane) - { -
[cp-patches] FYI: Some JViewport fixes
Hi, This fixes some issues with JViewport. 2005-10-18 Roman Kennke [EMAIL PROTECTED] * javax/swing/JViewport.java (setView): Added repaint() call. (revalidate): Removed unnecessary and unspecified method. (reshape): Fire stateChanged if only the size changes. Do not fire stateChanged if only the location changes. (scrollRectToVisible): Reworked most of this method to correctly determine the scroll offsets. Added validation of view as specified. /Roman Index: javax/swing/JViewport.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v retrieving revision 1.32 diff -u -r1.32 JViewport.java --- javax/swing/JViewport.java 17 Oct 2005 19:08:22 - 1.32 +++ javax/swing/JViewport.java 18 Oct 2005 10:02:28 - @@ -411,35 +411,24 @@ fireStateChanged(); } revalidate(); - } - - public void revalidate() - { -damaged = true; -fireStateChanged(); -super.revalidate(); +repaint(); } public void reshape(int x, int y, int w, int h) { -boolean changed = - (x != getX()) - || (y != getY()) - || (w != getWidth()) - || (h != getHeight()); if (w != getWidth() || h != getHeight()) sizeChanged = true; super.reshape(x, y, w, h); -if (changed) +if (sizeChanged) { damaged = true; fireStateChanged(); } } - - public final Insets getInsets() + + public final Insets getInsets() { -return new Insets(0,0,0,0); +return new Insets(0, 0, 0, 0); } public final Insets getInsets(Insets insets) @@ -574,36 +563,26 @@ Rectangle viewBounds = getView().getBounds(); Rectangle portBounds = getBounds(); -// FIXME: should validate the view if it is not valid, however -// this may cause excessive validation when the containment -// hierarchy is being created. - -// Y-DIRECTION - -// if contentRect is larger than the portBounds, center the view -if (contentRect.height portBounds.height) - setViewPosition(new Point(pos.x, contentRect.y)); - -if (contentRect.y -viewBounds.y) - setViewPosition(new Point(pos.x, contentRect.y)); -else if (contentRect.y + contentRect.height - -viewBounds.y + portBounds.height) - setViewPosition (new Point(pos.x, contentRect.y - - (portBounds.height - contentRect.height))); - -// X-DIRECTION -pos = getViewPosition(); - -// if contentRect is larger than the portBounds, center the view -if (contentRect.width portBounds.width) -setViewPosition(new Point(contentRect.x, pos.y)); - -if (contentRect.x -viewBounds.x) - setViewPosition(new Point(contentRect.x, pos.y)); -else if (contentRect.x + contentRect.width - -viewBounds.x + portBounds.width) - setViewPosition (new Point(contentRect.x - - (portBounds.width - contentRect.width), pos.y)); +if (isShowing()) + getView().validate(); + +// If the bottom boundary of contentRect is below the port +// boundaries, scroll up as necessary. +if (contentRect.y + contentRect.height + viewBounds.y portBounds.height) + pos.y = contentRect.y + contentRect.height - viewBounds.height; +// If contentRect.y is above the port boundaries, scroll down to +// contentRect.y. +if (contentRect.y + viewBounds.y 0) + pos.y = contentRect.y; +// If the right boundary of contentRect is right from the port +// boundaries, scroll left as necessary. +if (contentRect.x + contentRect.width + viewBounds.x portBounds.width) + pos.x = contentRect.x + contentRect.width - viewBounds.width; +// If contentRect.x is left from the port boundaries, scroll right to +// contentRect.x. +if (contentRect.x + viewBounds.x 0) + pos.x = contentRect.x; +setViewPosition(pos); } /** @@ -617,6 +596,25 @@ if (accessibleContext == null) accessibleContext = new AccessibleJViewport(); return accessibleContext; + } + + /** + * Forward repaint to parent to make sure only one paint is performed by the + * RepaintManager. + * + * @param tm number of milliseconds to defer the repaint request + * @param x the X coordinate of the upper left corner of the dirty area + * @param y the Y coordinate of the upper left corner of the dirty area + * @param w the width of the dirty area + * @param h the height of the dirty area + */ + public void repaint(long tm, int x, int y, int w, int h) + { +Component parent = getParent(); +if (parent != null) + { +parent.repaint(tm, x + getX(), y + getY(), w, h); + } } protected void addImpl(Component comp, Object constraints, int index) ___ Classpath-patches mailing list
[cp-patches] FYI: BasicComboBoxUI fixlets
I committed this patch to fix a couple of very minor issues in the BasicComboBoxUI class: the button colors are now fetched from the UIDefaults, and the createEditor() method returns an editor that implements UIResource: 2005-10-18 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicComboBoxUI.java (buttonBackground): new field, (shadow): renamed buttonShadow, (darkShadow): renamed buttonDarkShadow, (highlight): renamed buttonHighlight, (installDefaults): initialise buttonBackground, plus updates for renamed fields, (uninstallDefaults): clear buttonBackground, plus updates for renamed fields, (createEditor): return subclass that implements UIResource, (createArrowButton): use constructor that accepts colors, (getMaximumSize): fix API doc error, * javax/swing/plaf/basic/BasicLookAndFeel.java (initComponentDefaults): correct 'ComboBox.buttonDarkShadow' default. Regards, Dave Index: javax/swing/plaf/basic/BasicComboBoxUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v retrieving revision 1.23 diff -u -r1.23 BasicComboBoxUI.java --- javax/swing/plaf/basic/BasicComboBoxUI.java 17 Oct 2005 16:17:45 - 1.23 +++ javax/swing/plaf/basic/BasicComboBoxUI.java 18 Oct 2005 11:03:31 - @@ -157,12 +157,29 @@ */ protected PropertyChangeListener propertyChangeListener; + /** + * The button background. + * @see #installDefaults() + */ + private Color buttonBackground; + + /** + * The button shadow. + * @see #installDefaults() + */ + private Color buttonShadow; + /** - * Colors that are used to render selected item in the combo box. + * The button dark shadow. + * @see #installDefaults() */ - private Color shadow; - private Color darkShadow; - private Color highlight; + private Color buttonDarkShadow; + + /** + * The button highlight. + * @see #installDefaults() + */ + private Color buttonHighlight; /* Size of the largest item in the comboBox * This is package-private to avoid an accessor method. @@ -244,10 +261,12 @@ { LookAndFeel.installColorsAndFont(comboBox, ComboBox.background, ComboBox.foreground, ComboBox.font); + // fetch the button color scheme -shadow = UIManager.getColor(ComboBox.buttonShadow); -darkShadow = UIManager.getColor(ComboBox.buttonDarkShadow); -highlight = UIManager.getColor(ComboBox.buttonHighlight); +buttonBackground = UIManager.getColor(ComboBox.buttonBackground); +buttonShadow = UIManager.getColor(ComboBox.buttonShadow); +buttonDarkShadow = UIManager.getColor(ComboBox.buttonDarkShadow); +buttonHighlight = UIManager.getColor(ComboBox.buttonHighlight); } /** @@ -295,9 +314,10 @@ if (comboBox.getBackground() instanceof UIResource) comboBox.setBackground(null); -shadow = null; -darkShadow = null; -highlight = null; +buttonBackground = null; +buttonShadow = null; +buttonDarkShadow = null; +buttonHighlight = null; } /** @@ -432,7 +452,7 @@ */ protected ComboBoxEditor createEditor() { -return new BasicComboBoxEditor(); +return new BasicComboBoxEditor.UIResource(); } /** @@ -551,7 +571,8 @@ */ protected JButton createArrowButton() { -return new BasicArrowButton(BasicArrowButton.SOUTH); +return new BasicArrowButton(BasicArrowButton.SOUTH, buttonBackground, +buttonShadow, buttonDarkShadow, buttonHighlight); } /** @@ -649,7 +670,7 @@ * * @param c The [EMAIL PROTECTED] JComponent} to find the maximum size for * - * @return The dimensions of the minimum size. + * @return The maximum size (codeDimension(32767, 32767)/code). */ public Dimension getMaximumSize(JComponent c) { Index: javax/swing/plaf/basic/BasicLookAndFeel.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v retrieving revision 1.61 diff -u -r1.61 BasicLookAndFeel.java --- javax/swing/plaf/basic/BasicLookAndFeel.java17 Oct 2005 19:08:23 - 1.61 +++ javax/swing/plaf/basic/BasicLookAndFeel.java18 Oct 2005 11:03:34 - @@ -364,7 +364,7 @@ }), ComboBox.background, new ColorUIResource(Color.white), ComboBox.buttonBackground, new ColorUIResource(light), - ComboBox.buttonDarkShadow, new ColorUIResource(shadow), + ComboBox.buttonDarkShadow, new ColorUIResource(darkShadow), ComboBox.buttonHighlight, new ColorUIResource(highLight), ComboBox.buttonShadow, new ColorUIResource(shadow), ComboBox.disabledBackground, new ColorUIResource(light), ___ Classpath-patches mailing list
[cp-patches] FYI: AbstractButton fixlet
This prevents setEnabled() from getting active, if the actual value does not change. 2005-10-18 Roman Kennke [EMAIL PROTECTED] * javax/swing/AbstractButton.java Filled empty blocks with comments. (ButtonChangeListener.stateChanged): Moved implementation from inner class in createChangeListener to this protected class. (setEnabled): Do nothing if actual state does not change. (createChangeListener): Return instance of ButtonChangeListener here. /Roman Index: javax/swing/AbstractButton.java === RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractButton.java,v retrieving revision 1.47 diff -u -r1.47 AbstractButton.java --- javax/swing/AbstractButton.java 12 Oct 2005 13:27:32 - 1.47 +++ javax/swing/AbstractButton.java 18 Oct 2005 13:35:55 - @@ -165,6 +165,8 @@ */ public void stateChanged(ChangeEvent ev) { + AbstractButton.this.fireStateChanged(); + repaint(); } } @@ -375,6 +377,7 @@ protected AccessibleAbstractButton() { + // Nothing to do here yet. } public AccessibleStateSet getAccessibleStateSet() @@ -519,7 +522,7 @@ * The [EMAIL PROTECTED] #init(String, Icon)} method is not called automatically by this * constructor. * - * @see [EMAIL PROTECTED] #init(String, Icon)} + * @see #init(String, Icon) */ public AbstractButton() { @@ -949,6 +952,9 @@ */ public void setEnabled(boolean b) { +// Do nothing if state does not change. +if (b == isEnabled()) + return; super.setEnabled(b); ButtonModel mod = getModel(); if (mod != null) @@ -1630,16 +1636,9 @@ * * @return The new ChangeListener */ - protected ChangeListener createChangeListener() + protected ChangeListener createChangeListener() { -return new ChangeListener() - { -public void stateChanged(ChangeEvent e) -{ - AbstractButton.this.fireStateChanged(); - AbstractButton.this.repaint(); -} - }; +return new ButtonChangeListener(); } /** @@ -2005,6 +2004,7 @@ */ public void updateUI() { +// TODO: What to do here? } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: JTree scrollPathToVisible fix
Fixes bug #24218 2005-10-18 Lillian Angel [EMAIL PROTECTED] * javax/swing/JTree.java (scrollPathToVisible): Reimplemented to make the path visible if its parent is not expanded. * javax/swing/plaf/basic/BasicTreeUI.java (installDefaults): Initialized row height for the tree. (updateCurrentVisiblePath): Updated the visible row count. * javax/swing/plaf/metal/MetalTreeUI.java (installUI): Initialized row height for the tree. Index: javax/swing/JTree.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTree.java,v retrieving revision 1.47 diff -u -r1.47 JTree.java --- javax/swing/JTree.java 14 Oct 2005 17:30:31 - 1.47 +++ javax/swing/JTree.java 18 Oct 2005 14:58:46 - @@ -2046,13 +2046,26 @@ { if (path == null) return; - + +Object[] oPath = path.getPath(); +TreePath temp = new TreePath(oPath[0]); +boolean stop = false; +int i = 1; +while (!stop) + { +while (isVisible(temp)) + if (i oPath.length) +temp = temp.pathByAddingChild(oPath[i++]); + else +{ + stop = true; + break; +} +makeVisible(temp); + } Rectangle rect = getPathBounds(path); - -if (rect == null) - return; - scrollRectToVisible(rect); +setSelectionPath(temp); } public void scrollRowToVisible(int row) Index: javax/swing/plaf/basic/BasicTreeUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v retrieving revision 1.100 diff -u -r1.100 BasicTreeUI.java --- javax/swing/plaf/basic/BasicTreeUI.java 17 Oct 2005 18:47:17 - 1.100 +++ javax/swing/plaf/basic/BasicTreeUI.java 18 Oct 2005 14:58:46 - @@ -1230,6 +1230,7 @@ rightChildIndent = UIManager.getInt(Tree.rightChildIndent); leftChildIndent = UIManager.getInt(Tree.leftChildIndent); setRowHeight(UIManager.getInt(Tree.rowHeight)); +tree.setRowHeight(UIManager.getInt(Tree.rowHeight)); tree.requestFocusInWindow(false); tree.setScrollsOnExpand(UIManager.getBoolean(Tree.scrollsOnExpand)); setExpandedIcon(UIManager.getIcon(Tree.openIcon)); @@ -3778,6 +3779,7 @@ !tree.isVisible(new TreePath(getPathToRoot(next, 0; } currentVisiblePath = current; +tree.setVisibleRowCount(getRowCount(tree)); } /** Index: javax/swing/plaf/metal/MetalTreeUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalTreeUI.java,v retrieving revision 1.10 diff -u -r1.10 MetalTreeUI.java --- javax/swing/plaf/metal/MetalTreeUI.java 17 Oct 2005 18:47:17 - 1.10 +++ javax/swing/plaf/metal/MetalTreeUI.java 18 Oct 2005 14:58:46 - @@ -140,6 +140,7 @@ rightChildIndent = defaults.getInt(Tree.rightChildIndent); leftChildIndent = defaults.getInt(Tree.leftChildIndent); setRowHeight(defaults.getInt(Tree.rowHeight)); +tree.setRowHeight(defaults.getInt(Tree.rowHeight)); tree.requestFocusInWindow(false); setExpandedIcon(defaults.getIcon(Tree.openIcon)); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: BasicTextUI fix
Fixes bug #24338 2005-10-18 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTextUI.java (installDefaults): Set the selected text color for the text component. Index: javax/swing/plaf/basic/BasicTextUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.46 diff -u -r1.46 BasicTextUI.java --- javax/swing/plaf/basic/BasicTextUI.java 13 Oct 2005 12:51:00 - 1.46 +++ javax/swing/plaf/basic/BasicTextUI.java 18 Oct 2005 15:13:37 - @@ -523,6 +523,7 @@ inactiveBackground = UIManager.getColor(prefix + .inactiveBackground); textComponent.setDisabledTextColor (UIManager.getColor(prefix + .inactiveForeground)); +textComponent.setSelectedTextColor(UIManager.getColor(prefix + .selectionForeground)); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: BasicComboBoxUI fixlet
I commited this patch to fix a failing Mauve test: 2005-10-18 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicComboBoxUI.java (installComponents): only set default editor if the current editor is null or implements UIResource, (uninstallComponents): only clear editor if it implements UIResource. Regards, Dave Index: javax/swing/plaf/basic/BasicComboBoxUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v retrieving revision 1.24 diff -u -r1.24 BasicComboBoxUI.java --- javax/swing/plaf/basic/BasicComboBoxUI.java 18 Oct 2005 11:05:10 - 1.24 +++ javax/swing/plaf/basic/BasicComboBoxUI.java 18 Oct 2005 15:12:59 - @@ -476,8 +476,12 @@ configureArrowButton(); comboBox.add(arrowButton); -comboBox.setEditor(createEditor()); -editor = comboBox.getEditor().getEditorComponent(); +ComboBoxEditor currentEditor = comboBox.getEditor(); +if (currentEditor == null || currentEditor instanceof UIResource) + { +comboBox.setEditor(createEditor()); +editor = comboBox.getEditor().getEditorComponent(); + } comboBox.revalidate(); } @@ -499,8 +503,14 @@ comboBox.setRenderer(null); -comboBox.setEditor(null); -editor = null; +// if the editor is not an instanceof UIResource, it was not set by the +// UI delegate, so don't clear it... +ComboBoxEditor currentEditor = comboBox.getEditor(); +if (currentEditor instanceof UIResource) + { +comboBox.setEditor(null); +editor = null; + } } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JComboBox fixes
This patch fixes some failing Mauve tests: 2005-10-18 David Gilbert [EMAIL PROTECTED] * javax/swing/JComboBox.java (setModel): update the selectedItemReminder field, (selectedItemChanged): only send ItemEvent.SELECTED event if the new selection is non-null. Regards, Dave Index: javax/swing/JComboBox.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComboBox.java,v retrieving revision 1.21 diff -u -r1.21 JComboBox.java --- javax/swing/JComboBox.java 12 Oct 2005 12:38:20 - 1.21 +++ javax/swing/JComboBox.java 18 Oct 2005 16:36:35 - @@ -311,7 +311,8 @@ // Stores old data model for event notification. ComboBoxModel oldDataModel = dataModel; dataModel = newDataModel; - +selectedItemReminder = newDataModel.getSelectedItem(); + // Notifies the listeners of the model change. firePropertyChange(model, oldDataModel, dataModel); } @@ -901,8 +902,9 @@ // Fire ItemEvent to indicate that new item is selected Object newSelection = getSelectedItem(); -fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, - newSelection, ItemEvent.SELECTED)); +if (newSelection != null) + fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, + newSelection, ItemEvent.SELECTED)); // Fire Action Event to JComboBox's registered listeners fireActionEvent(); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: BasicTreeUI fix
Noticed the expanded and collapsed icon defaults were set to the wrong icons. Fixed this and reworked mousePressed to work with these changes. 2005-10-18 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTreeUI.java: Removed leafIcon field. (BasicTreeUI): Removed leafIcon initialization. (installDefaults): Icon defaults were wrong, fixed. (isLocationInExpandControl): Fixed to incorporated gap. (mousePressed): Fixed to include correct icon widths. Sometimes the labels icon is different from what the tree's default icon is set to. Added a check for this. (getCellBounds): No need to include gap here. (getCurrentControlIcon): Fixed to use expandedIcon and collapsedIcon. (paintRow): No need paint beyond preferred width of tree here. (updateCurrentVisiblePath): If nothing is selected, the root should be selected without focus. * javax/swing/plaf/metal/MetalTreeUI.java (installDefaults): Fixed defaults for the expanded/collapsed icons. On Mon, 2005-10-17 at 14:46 -0400, Lillian Angel wrote: Now this is completely fixed. 2005-10-17 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTreeUI.java (installUI): Moved call to installKeyboardActions and Listeners to before expansion of root. (paint): Added check to make sure the cached visible path is updated. (treeExpanded): Added call to update visible path. (treeCollapsed): Likewise. (treeNodesChanged): Likewise. (treeNodesInserted): Likewise. (treeNodesRemoved): Likewise. (treeStructureChanged): Likewise. (paintRecursive): Moved code to paintRow. (paintControlIcons): Fixed to paint custom control icons properly. (paintExpandControl): Removed unneeded parameter. (paintRow): Added code to paint the row with the correct width. * javax/swing/plaf/metal/MetalTreeUI.java (installUI): Moved code to expand the root after all the listeners have been initialized. On Fri, 2005-10-14 at 17:42 -0400, Lillian Angel wrote: After testing some new apps, I noticed that there was a slight problem with some custom icons. I almost have it fixed completely. 2005-10-14 Lillian Angel [EMAIL PROTECTED] * javax/swing/LookAndFeel.java (makeIcon): Implemented. * javax/swing/plaf/basic/BasicTreeUI.java (updateCachedPreferredSize): Should only add with of control icon if not a leaf. (mousePressed): Fixed to use new gap field. (paintRecursive): Likewise. (paintRow): Likewise. (updateCurrentVisiblePath): Shouldn't include root if it is not of a valid size to be painted. ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches Index: javax/swing/plaf/basic/BasicTreeUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v retrieving revision 1.101 diff -u -r1.101 BasicTreeUI.java --- javax/swing/plaf/basic/BasicTreeUI.java 18 Oct 2005 15:02:42 - 1.101 +++ javax/swing/plaf/basic/BasicTreeUI.java 18 Oct 2005 17:38:54 - @@ -225,9 +225,6 @@ /** Set to true if the editor has a different size than the renderer. */ protected boolean editorHasDifferentSize; - - /** Leaf icon for the tree. */ - Icon leafIcon; /** The action listener for the editor's Timer. */ Timer editorTimer = new EditorUpdateTimer(); @@ -285,7 +282,6 @@ editingRow = -1; lastSelectedRow = -1; -leafIcon = UIManager.getIcon(Tree.leafIcon); } /** @@ -1233,8 +1229,8 @@ tree.setRowHeight(UIManager.getInt(Tree.rowHeight)); tree.requestFocusInWindow(false); tree.setScrollsOnExpand(UIManager.getBoolean(Tree.scrollsOnExpand)); -setExpandedIcon(UIManager.getIcon(Tree.openIcon)); -setCollapsedIcon(UIManager.getIcon(Tree.closedIcon)); +setExpandedIcon(UIManager.getIcon(Tree.expandedIcon)); +setCollapsedIcon(UIManager.getIcon(Tree.collapsedIcon)); } /** @@ -1673,11 +1669,10 @@ if (!isLeaf(row)) { -if (bounds == null) - bounds = getPathBounds(tree, path); +bounds = getPathBounds(tree, path); if (hasControlIcons() (mouseX bounds.x) - (mouseX (bounds.x - getCurrentControlIcon(path).getIconWidth( + (mouseX (bounds.x - getCurrentControlIcon(path).getIconWidth() - gap))) cntlClick = true; } return cntlClick; @@ -2310,13 +2305,29 @@
Re: [cp-patches] FYI: BasicScrollBarUI fixlet
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Roman, For all Swing hackers: As a general rule, do not put repaint and revalidate calls in event handlers. When a property change must trigger a repaint and/or revalidate, then this should happen in the corresponding setter method. This makes the code more clear and avoids ugly eventqueue loops. Would you mind putting such findings in the Wiki[0]? Maybe you could open a new page and just put all hints and infos in it. I will come to clean it up later. That way I think we could preserve such useful information for future hackers in a better way. cu Robert [0] - developer.classpath.org/mediation -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDVUxaG9cfwmwwEtoRAv0bAJ9/2Iy9ko8Tqs6AB3fK0iNwrZgMwwCbB1a4 1WPiNw80xwCIWfJrVJdQyzs= =gLhP -END PGP SIGNATURE- ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: JTable fixlet
After running some apps that work fine with Sun and IBM, I got several NPEs with JTable. 2005-10-18 Lillian Angel [EMAIL PROTECTED] * javax/swing/JTable.java (JTable): Moved code around so all models are set before any other function is called. Prevents all NPEs with models. Index: javax/swing/JTable.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v retrieving revision 1.52 diff -u -r1.52 JTable.java --- javax/swing/JTable.java 12 Oct 2005 19:57:28 - 1.52 +++ javax/swing/JTable.java 18 Oct 2005 19:21:37 - @@ -671,19 +671,17 @@ */ public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm) { -setModel(dm == null ? createDefaultDataModel() : dm); -setSelectionModel(sm == null ? createDefaultSelectionModel() : sm); - +boolean autoCreate = false; if (cm != null) - { setColumnModel(cm); -setAutoCreateColumnsFromModel(false); - } else { setColumnModel(createDefaultColumnModel()); -setAutoCreateColumnsFromModel(true); +autoCreate = true; } +setModel(dm == null ? createDefaultDataModel() : dm); +setSelectionModel(sm == null ? createDefaultSelectionModel() : sm); +setAutoCreateColumnsFromModel(autoCreate); initializeLocalVars(); // The next two lines are for compliance with the JDK which starts // the JLists associated with a JTable with both lead selection ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: GridBagLayout fixlet
Fixed a NullPointerException 2005-10-18 Lillian Angel [EMAIL PROTECTED] * java/awt/GridBagLayout.java (GetLayoutInfo): Added a null check for lastComponent. Prevents NPE. Index: java/awt/GridBagLayout.java === RCS file: /cvsroot/classpath/classpath/java/awt/GridBagLayout.java,v retrieving revision 1.21 diff -u -r1.21 GridBagLayout.java --- java/awt/GridBagLayout.java 5 Aug 2005 17:16:52 - 1.21 +++ java/awt/GridBagLayout.java 18 Oct 2005 20:02:35 - @@ -705,17 +705,20 @@ if (lastInCol.containsKey(new Integer(x))) { Component lastComponent = (Component) lastInRow.get(new Integer(x)); - GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent); - - if (lastConstraints.gridheight == GridBagConstraints.RELATIVE) + if (lastComponent != null) { - constraints.gridy = max_y - 1; - break; -} - else -{ - constraints.gridy = Math.max (constraints.gridy, -lastConstraints.gridy + Math.max (1, lastConstraints.gridheight)); + GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent); + + if (lastConstraints.gridheight == GridBagConstraints.RELATIVE) +{ + constraints.gridy = max_y - 1; + break; +} + else +{ + constraints.gridy = Math.max (constraints.gridy, +lastConstraints.gridy + Math.max (1, lastConstraints.gridheight)); +} } } } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: filled empty blocks in javax.swing.colorchooser
I filled empty blocks (like method bodies) in javax.swing.colorchoosers with comments either stating that this does nothing or needs to be implemented. 2005-10-18 Roman Kennke [EMAIL PROTECTED] * javax/swing/colorchooser/AbstractColorChooserPanel.java: * javax/swing/colorchooser/ColorChooserComponentFactory.java: * javax/swing/colorchooser/DefaultSwatchChooserPanel.java: Filled empty blocks with comments. /Roman Index: javax/swing/colorchooser/AbstractColorChooserPanel.java === RCS file: /cvsroot/classpath/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java,v retrieving revision 1.6 diff -u -r1.6 AbstractColorChooserPanel.java --- javax/swing/colorchooser/AbstractColorChooserPanel.java 2 Jul 2005 20:32:49 - 1.6 +++ javax/swing/colorchooser/AbstractColorChooserPanel.java 18 Oct 2005 20:28:28 - @@ -64,7 +64,8 @@ */ public AbstractColorChooserPanel() { - } // AbstractColorChooserPanel() +// Nothing to do here. + } /** * This method returns the name displayed in the tab for this chooser panel. Index: javax/swing/colorchooser/ColorChooserComponentFactory.java === RCS file: /cvsroot/classpath/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java,v retrieving revision 1.4 diff -u -r1.4 ColorChooserComponentFactory.java --- javax/swing/colorchooser/ColorChooserComponentFactory.java 2 Jul 2005 20:32:49 - 1.4 +++ javax/swing/colorchooser/ColorChooserComponentFactory.java 18 Oct 2005 20:28:28 - @@ -53,7 +53,8 @@ */ private ColorChooserComponentFactory() { - } // ColorChooserComponentFactory() +// Nothing to do here. + } /** * This method returns the three default chooser panels to be used in Index: javax/swing/colorchooser/DefaultSwatchChooserPanel.java === RCS file: /cvsroot/classpath/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java,v retrieving revision 1.5 diff -u -r1.5 DefaultSwatchChooserPanel.java --- javax/swing/colorchooser/DefaultSwatchChooserPanel.java 2 Jul 2005 20:32:49 - 1.5 +++ javax/swing/colorchooser/DefaultSwatchChooserPanel.java 18 Oct 2005 20:28:28 - @@ -587,6 +587,7 @@ */ public void addLayoutComponent(String name, Component comp) { + // Nothing to do here. } /** @@ -634,6 +635,7 @@ */ public void removeLayoutComponent(Component comp) { + // Nothing to do here. } /** @@ -786,6 +788,7 @@ */ public void updateChooser() { +// Nothing to do here yet. } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: javax.swing.filechooser empty blocks
I filled two empty blocks in javax.swing.filechooser. 2005-10-18 Roman Kennke [EMAIL PROTECTED] * javax/swing/filechooser/FileFilter.java: * javax/swing/filechooser/FileView.java: Filled empty blocks with comments. /Roman Index: javax/swing/filechooser/FileFilter.java === RCS file: /cvsroot/classpath/classpath/javax/swing/filechooser/FileFilter.java,v retrieving revision 1.4 diff -u -r1.4 FileFilter.java --- javax/swing/filechooser/FileFilter.java 22 Sep 2005 13:15:38 - 1.4 +++ javax/swing/filechooser/FileFilter.java 18 Oct 2005 20:40:57 - @@ -56,7 +56,9 @@ /** * Default constructor. */ - public FileFilter() { + public FileFilter() + { +// Nothing to do here. } /** Index: javax/swing/filechooser/FileView.java === RCS file: /cvsroot/classpath/classpath/javax/swing/filechooser/FileView.java,v retrieving revision 1.5 diff -u -r1.5 FileView.java --- javax/swing/filechooser/FileView.java 19 Sep 2005 20:11:37 - 1.5 +++ javax/swing/filechooser/FileView.java 18 Oct 2005 20:40:57 - @@ -56,6 +56,7 @@ */ public FileView() { +// Nothing to do here. } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: filled empty blocks in javax.swing.colorchooser
Hi Roman, Index: javax/swing/colorchooser/DefaultSwatchChooserPanel.java === RCS file: /cvsroot/classpath/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java,v retrieving revision 1.5 diff -u -r1.5 DefaultSwatchChooserPanel.java --- javax/swing/colorchooser/DefaultSwatchChooserPanel.java 2 Jul 2005 20:32:49 - 1.5 +++ javax/swing/colorchooser/DefaultSwatchChooserPanel.java 18 Oct 2005 20:28:28 - @@ -587,6 +587,7 @@ */ public void addLayoutComponent(String name, Component comp) { + // Nothing to do here. } /** @@ -634,6 +635,7 @@ */ public void removeLayoutComponent(Component comp) { + // Nothing to do here. } /** @@ -786,6 +788,7 @@ */ public void updateChooser() { +// Nothing to do here yet. } I dont understand this. Does this mean // TODO: implement this or not? If so, it would be nice to have a PR about them. Regards Robert ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches