PatchSet 6633 Date: 2005/06/11 21:43:13 Author: robilad Branch: HEAD Tag: (none) Log: Resynced with GNU Classpath: awt and swing fixes
Members: ChangeLog:1.4159->1.4160 libraries/javalib/java/awt/image/BandedSampleModel.java:1.3->1.4 libraries/javalib/javax/swing/JComponent.java:1.20->1.21 libraries/javalib/javax/swing/JFormattedTextField.java:1.9->1.10 libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java:1.6->1.7 libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.14->1.15 libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.10->1.11 Index: kaffe/ChangeLog diff -u kaffe/ChangeLog:1.4159 kaffe/ChangeLog:1.4160 --- kaffe/ChangeLog:1.4159 Sat Jun 11 21:37:10 2005 +++ kaffe/ChangeLog Sat Jun 11 21:43:13 2005 @@ -2,6 +2,71 @@ Resynced with GNU Classpath. + 2005-06-08 David Gilbert <[EMAIL PROTECTED]> + + * java/awt/image/BandedSampleModel.java + (createBankArray): New method. + (BandedSampleModel(int, int, int, int)): reimplemented. + (BandedSampleModel(int, int, int, int, int[], int[]): + RasterFormatException nearer to start of constructor. + (getPixel): Use band index, not zero. + (getPixels): Fixed loop indices. + (getSamples): Fixed loop indices. + (setDataElements): Use band index, not zero. + + 2005-06-08 Roman Kennke <[EMAIL PROTECTED]> + + * javax/swing/text/DefaultFormatter.java + (FormatterDocumentFilter.remove): Added check for valid input. + (FormatterDocumentFilter.insertString): Added check for valid input. + Added support for overwriteMode property. + (FormatterDocumentFilter.replace): Added check for valid input. + (checkValidInput): New helper method to check for valid input + and roll it back if necessary. + + 2005-06-08 Roman Kennke <[EMAIL PROTECTED]> + + * javax/swing/JFormattedTextField.java + (getActions): Call super.getActions instead of throwing an exception. + This is safe here. + (processFocusEvent): Likewise. + * javax/swing/plaf/basic/BasicTextUI.java + (createKeymap): Construct new bindings array if UIDefaults does return + a null object for this. + + 2005-06-08 Roman Kennke <[EMAIL PROTECTED]> + + * javax/swing/plaf/basic/BasicSplitPaneUI.java + (installDefaults): Call resetLayoutManager() _after_ the divider + is created to prevent NPE. + (paint): Removed check for valid divider location. This is done + in resetComponentAt(index). + (resetLayoutManager): Call layout.updateComponents _after_ the + layout has been installed. Otherwise it has no effect. + + 2005-06-08 Roman Kennke <[EMAIL PROTECTED]> + + * javax/swing/JComponent.java + (setMinimumSize): Adjust preferredSize and maximumSize when + minimumSize is greater than preferred or maximumSize. + + 2005-06-08 Roman Kennke <[EMAIL PROTECTED]> + + * javax/swing/text/DefaultEditorKit.java: + Added some API documentation. + + 2005-06-08 Roman Kennke <[EMAIL PROTECTED]> + + * javax/swing/text/DefaultEditorKit.java + (DefaultKeyTypedAction.actionPerformed): This action + has to filter control characters here. + (InsertBreakAction.actionPerformed): This action inserts + a newline character here. + +2005-06-11 Dalibor Topic <[EMAIL PROTECTED]> + + Resynced with GNU Classpath. + 2005-06-06 Sven de Marothy <[EMAIL PROTECTED]> * javax/swing/JLabel.java Index: kaffe/libraries/javalib/java/awt/image/BandedSampleModel.java diff -u kaffe/libraries/javalib/java/awt/image/BandedSampleModel.java:1.3 kaffe/libraries/javalib/java/awt/image/BandedSampleModel.java:1.4 --- kaffe/libraries/javalib/java/awt/image/BandedSampleModel.java:1.3 Fri Feb 18 15:13:48 2005 +++ kaffe/libraries/javalib/java/awt/image/BandedSampleModel.java Sat Jun 11 21:43:17 2005 @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation +/* Copyright (C) 2004, 2005, Free Software Foundation This file is part of GNU Classpath. @@ -53,9 +53,17 @@ private int numberOfBits; private int numElems; + private static int[] createBankArray(int size) + { + int[] result = new int[size]; + for (int i = 0; i < size; i++) + result[i] = i; + return result; + } + public BandedSampleModel(int dataType, int w, int h, int numBands) { - super(dataType, w, h, 1, w, new int[numBands]); + this(dataType, w, h, w, createBankArray(numBands), new int[numBands]); } public BandedSampleModel(int dataType, int w, int h, int scanlineStride, @@ -103,6 +111,10 @@ public SampleModel createSubsetSampleModel(int[] bands) { + if (bands.length > bankIndices.length) + throw new + RasterFormatException("BandedSampleModel createSubsetSampleModel too" + +" many bands"); int[] newoff = new int[bands.length]; int[] newbanks = new int[bands.length]; for (int i=0; i < bands.length; i++) @@ -112,11 +124,6 @@ newbanks[i] = bankIndices[b]; } - if (bands.length > bankIndices.length) - throw new - RasterFormatException("BandedSampleModel createSubsetSampleModel too" - +" many bands"); - return new BandedSampleModel(dataType, width, height, scanlineStride, newbanks, newoff); } @@ -192,7 +199,7 @@ { if (iArray == null) iArray = new int[numBands]; for (int i=0; i < numBands; i++) - iArray[i] = getSample(x, y, 0, data); + iArray[i] = getSample(x, y, i, data); return iArray; } @@ -223,13 +230,15 @@ { if (iArray == null) iArray = new int[w*h*numBands]; int outOffset = 0; - for (y=0; y<h; y++) + int maxX = x + w; + int maxY = y + h; + for (int yy = x; yy < maxY; yy++) { - for (x=0; x<w;) + for (int xx = x; xx < maxX; xx++) { - for (int b=0; b < numBands; b++) + for (int b = 0; b < numBands; b++) { - int offset = bandOffsets[b] + y * scanlineStride + x; + int offset = bandOffsets[b] + yy * scanlineStride + xx; iArray[outOffset++] = data.getElem(bankIndices[b], offset); } @@ -281,11 +290,13 @@ { if (iArray == null) iArray = new int[w*h]; int outOffset = 0; - for (y=0; y<h; y++) + int maxX = x + w; + int maxY = y + h; + for (int yy = y; yy < maxY; yy++) { - for (x=0; x<w;) + for (int xx = x; xx < maxX; xx++) { - int offset = bandOffsets[b] + y * scanlineStride + x; + int offset = bandOffsets[b] + yy * scanlineStride + xx; iArray[outOffset++] = data.getElem(bankIndices[b], offset); } @@ -328,7 +339,7 @@ DataBufferByte out = (DataBufferByte) data; byte[] in = (byte[]) obj; for (int i=0; i < numBands; i++) - out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0]; + out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i]; return; } case DataBuffer.TYPE_SHORT: @@ -336,7 +347,7 @@ DataBufferShort out = (DataBufferShort) data; short[] in = (short[]) obj; for (int i=0; i < numBands; i++) - out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0]; + out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i]; return; } case DataBuffer.TYPE_USHORT: @@ -344,7 +355,7 @@ DataBufferUShort out = (DataBufferUShort) data; short[] in = (short[]) obj; for (int i=0; i < numBands; i++) - out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0]; + out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i]; return; } case DataBuffer.TYPE_INT: @@ -352,7 +363,7 @@ DataBufferInt out = (DataBufferInt) data; int[] in = (int[]) obj; for (int i=0; i < numBands; i++) - out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0]; + out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i]; return; } case DataBuffer.TYPE_FLOAT: @@ -360,7 +371,7 @@ DataBufferFloat out = (DataBufferFloat) data; float[] in = (float[]) obj; for (int i=0; i < numBands; i++) - out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0]; + out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i]; return; } case DataBuffer.TYPE_DOUBLE: @@ -368,7 +379,7 @@ DataBufferDouble out = (DataBufferDouble) data; double[] in = (double[]) obj; for (int i=0; i < numBands; i++) - out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0]; + out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i]; return; } default: Index: kaffe/libraries/javalib/javax/swing/JComponent.java diff -u kaffe/libraries/javalib/javax/swing/JComponent.java:1.20 kaffe/libraries/javalib/javax/swing/JComponent.java:1.21 --- kaffe/libraries/javalib/javax/swing/JComponent.java:1.20 Sat Jun 11 19:11:36 2005 +++ kaffe/libraries/javalib/javax/swing/JComponent.java Sat Jun 11 21:43:17 2005 @@ -2063,6 +2063,16 @@ firePropertyChange("minimumSize", oldMinimumSize, minimumSize); revalidate(); repaint(); + + // adjust preferred and maximum size accordingly + Dimension prefSize = getPreferredSize(); + prefSize.width = Math.max(prefSize.width, minimumSize.width); + prefSize.height = Math.max(prefSize.height, minimumSize.height); + setPreferredSize(prefSize); + Dimension maxSize = getMaximumSize(); + maxSize.width = Math.max(maxSize.width, minimumSize.width); + maxSize.height = Math.max(maxSize.height, minimumSize.height); + setMaximumSize(maxSize); } /** Index: kaffe/libraries/javalib/javax/swing/JFormattedTextField.java diff -u kaffe/libraries/javalib/javax/swing/JFormattedTextField.java:1.9 kaffe/libraries/javalib/javax/swing/JFormattedTextField.java:1.10 --- kaffe/libraries/javalib/javax/swing/JFormattedTextField.java:1.9 Sun May 15 09:46:20 2005 +++ kaffe/libraries/javalib/javax/swing/JFormattedTextField.java Sat Jun 11 21:43:17 2005 @@ -197,7 +197,8 @@ public Action[] getActions () { - throw new InternalError ("not implemented"); + // FIXME: Add JFormattedTextField specific actions + return super.getActions(); } public int getFocusLostBehavior() @@ -240,7 +241,10 @@ protected void processFocusEvent (FocusEvent evt) { - throw new InternalError ("not implemented"); + // it's safe to simply call super for now, until it gets clear + // what this method is supposed to do + // throw new InternalError ("not implemented"); + super.processFocusEvent(evt); } public void setDocument(Document newDocument) Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java:1.6 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java:1.7 --- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java:1.6 Sat Jun 11 21:09:33 2005 +++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java Sat Jun 11 21:43:18 2005 @@ -990,8 +990,8 @@ */ protected void installDefaults() { - resetLayoutManager(); divider = createDefaultDivider(); + resetLayoutManager(); nonContinuousLayoutDivider = createDefaultNonContinuousLayoutDivider(); splitPane.add(divider, JSplitPane.DIVIDER); @@ -1384,11 +1384,6 @@ */ public void paint(Graphics g, JComponent jc) { - // Make sure that the location is valid - int divLoc = splitPane.getDividerLocation(); - int valLoc = validLocation(divLoc); - if (divLoc != valLoc) - splitPane.setDividerLocation(valLoc); } /** @@ -1449,9 +1444,8 @@ layoutManager = new BasicHorizontalLayoutManager(); else layoutManager = new BasicVerticalLayoutManager(); - layoutManager.invalidateLayout(splitPane); - layoutManager.updateComponents(); getSplitPane().setLayout(layoutManager); + layoutManager.updateComponents(); // invalidating by itself does not invalidate the layout. getSplitPane().revalidate(); Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.14 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.15 --- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.14 Sat Jun 11 21:37:13 2005 +++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java Sat Jun 11 21:43:18 2005 @@ -375,6 +375,12 @@ UIDefaults defaults = UIManager.getLookAndFeelDefaults(); JTextComponent.KeyBinding[] bindings = (JTextComponent.KeyBinding[]) defaults.get(prefix + ".keyBindings"); + if (bindings == null) + { + bindings = new JTextComponent.KeyBinding[0]; + defaults.put(prefix + ".keyBindings", bindings); + } + Keymap km = JTextComponent.addKeymap(getKeymapName(), JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP)); JTextComponent.loadKeymap(km, bindings, textComponent.getActions()); Index: kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java diff -u kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.10 kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.11 --- kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.10 Mon Apr 18 23:57:52 2005 +++ kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java Sat Jun 11 21:43:18 2005 @@ -92,6 +92,16 @@ } } + /** + * This action is executed as default action when a KEY_TYPED + * event is received and no keymap entry exists for that. The purpose + * of this action is to filter out a couple of characters. This includes + * the control characters and characters with the ALT-modifier. + * + * If an event does not get filtered, it is inserted into the document + * of the text component. If there is some text selected in the text component, + * this text will be replaced. + */ public static class DefaultKeyTypedAction extends TextAction { @@ -102,6 +112,13 @@ public void actionPerformed(ActionEvent event) { + // first we filter the following events: + // - control characters + // - key events with the ALT modifier (FIXME: filter that too!) + char c = event.getActionCommand().charAt(0); + if (Character.isISOControl(c)) + return; + JTextComponent t = getTextComponent(event); if (t != null) { @@ -119,6 +136,11 @@ } } + /** + * This action inserts a newline character into the document + * of the text component. This is typically triggered by hitting + * ENTER on the keyboard. + */ public static class InsertBreakAction extends TextAction { @@ -129,6 +151,8 @@ public void actionPerformed(ActionEvent event) { + JTextComponent t = getTextComponent(event); + t.replaceSelection("\n"); } } _______________________________________________ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe