diff options
author | fitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-09 16:07:07 +0000 |
---|---|---|
committer | fitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-09 16:07:07 +0000 |
commit | 48591d852fc71f04d7083dcb0b37cf27b5d6942b (patch) | |
tree | 0802013820f309170e8ae5584b09e9672bab2cb6 /libjava/classpath/java | |
parent | 5f2bd98fb3528fa948341bdac3f4c4ac9a177595 (diff) | |
download | gcc-48591d852fc71f04d7083dcb0b37cf27b5d6942b.tar.gz |
2006-06-09 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/lang/String.java, classpath/native/jni/classpath/jcl.h,
classpath/native/jni/qt-peer/eventmethods.h,
classpath/native/jni/qt-peer/qtmenupeer.cpp,
classpath/native/jni/qt-peer/.cvsignore,
classpath/native/jni/gtk-peer/gdkdisplay.h,
classpath/native/jni/gtk-peer/cairographics2d.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,
classpath/native/jni/gtk-peer/.cvsignore,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,
classpath/native/jni/gtk-peer/gtkpeer.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c,
classpath/native/jni/gtk-peer/Makefile.am,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
classpath/native/jawt/Makefile.am,
classpath/native/jawt/.cvsignore,
classpath/native/target/Linux/Makefile.in,
classpath/native/plugin/gcjwebplugin.cc,
classpath/native/plugin/Makefile.am,
classpath/native/plugin/.cvsignore,
classpath/resource/Makefile.in,
classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
classpath/gnu/java/awt/peer/gtk/CairoSurface.java,
classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,
classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java,
classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java,
classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,
classpath/gnu/java/awt/peer/gtk/GdkGraphics.java,
classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,
classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,
classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java,
classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,
classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java,
classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
classpath/gnu/java/awt/peer/gtk/GtkImage.java,
classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java,
classpath/gnu/java/awt/peer/gtk/GdkGlyphVector.java,
classpath/gnu/java/awt/peer/gtk/GtkCanvasPeer.java,
classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java,
classpath/gnu/java/awt/peer/swing/SwingComponent.java,
classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java,
classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java,
classpath/gnu/java/awt/peer/swing/SwingFramePeer.java,
classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java,
classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java,
classpath/gnu/java/awt/print/JavaPrinterJob.java,
classpath/gnu/java/awt/print/PostScriptGraphics2D.java,
classpath/gnu/java/awt/print/SpooledDocument.java,
classpath/gnu/java/awt/print/JavaPrinterGraphics.java,
classpath/gnu/java/awt/BitwiseXORComposite.java,
classpath/gnu/java/awt/font/GNUGlyphVector.java,
classpath/gnu/java/awt/font/opentype/NameDecoder.java,
classpath/gnu/java/awt/java2d/RasterGraphics.java,
classpath/gnu/java/awt/java2d/TexturePaintContext.java,
classpath/gnu/java/awt/java2d/PolyEdge.java,
classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,
classpath/gnu/java/awt/java2d/AlphaCompositeContext.java,
classpath/gnu/java/awt/java2d/ImagePaint.java,
classpath/gnu/java/awt/Buffers.java,
classpath/gnu/classpath/Configuration.java.in,
classpath/gnu/javax/swing/text/html/CombinedAttributes.java,
classpath/gnu/javax/swing/text/html/CharacterAttributeTranslator.java,
classpath/gnu/javax/swing/text/html/parser/htmlAttributeSet.java,
classpath/gnu/javax/swing/text/html/parser/SmallHtmlAttributeSet.java,
classpath/gnu/javax/swing/text/html/ImageViewIconFactory.java,
classpath/tools/toolwrapper.c,
classpath/tools/gnu/classpath/tools/native2ascii/Native2ASCII.java,
classpath/tools/gnu/classpath/tools/native2ascii/Messages.java,
classpath/tools/gnu/classpath/tools/getopt/FileArgumentCallback.java,
classpath/tools/gnu/classpath/tools/getopt/OptionGroup.java,
classpath/tools/gnu/classpath/tools/getopt/OptionException.java,
classpath/tools/gnu/classpath/tools/getopt/Messages.java,
classpath/tools/gnu/classpath/tools/getopt/Option.java,
classpath/tools/gnu/classpath/tools/getopt/Parser.java,
classpath/tools/gnu/classpath/tools/getopt/ClasspathToolParser.java,
classpath/tools/gnu/classpath/tools/jarsigner/JarSigner.java,
classpath/tools/gnu/classpath/tools/jarsigner/Main.java,
classpath/tools/gnu/classpath/tools/jarsigner/Messages.java,
classpath/tools/gnu/classpath/tools/jarsigner/package.html,
classpath/tools/gnu/classpath/tools/keytool/ListCmd.java,
classpath/tools/gnu/classpath/tools/keytool/StorePasswdCmd.java,
classpath/tools/gnu/classpath/tools/keytool/ExportCmd.java,
classpath/tools/gnu/classpath/tools/keytool/GenKeyCmd.java,
classpath/tools/gnu/classpath/tools/keytool/Messages.java,
classpath/tools/gnu/classpath/tools/keytool/package.html,
classpath/tools/gnu/classpath/tools/keytool/Command.java,
classpath/tools/gnu/classpath/tools/keytool/IdentityDBCmd.java,
classpath/tools/gnu/classpath/tools/keytool/Main.java,
classpath/tools/gnu/classpath/tools/keytool/DeleteCmd.java,
classpath/tools/gnu/classpath/tools/keytool/CertReqCmd.java,
classpath/tools/gnu/classpath/tools/keytool/SelfCertCmd.java,
classpath/tools/gnu/classpath/tools/keytool/KeyCloneCmd.java,
classpath/tools/gnu/classpath/tools/keytool/KeyPasswdCmd.java,
classpath/tools/gnu/classpath/tools/keytool/ImportCmd.java,
classpath/tools/gnu/classpath/tools/keytool/PrintCertCmd.java,
classpath/tools/gnu/classpath/tools/rmi/registry/package.html,
classpath/tools/gnu/classpath/tools/rmi/RMIC.txt,
classpath/tools/gnu/classpath/tools/rmi/RMIC.java,
classpath/tools/gnu/classpath/tools/appletviewer/ErrorApplet.java,
classpath/tools/gnu/classpath/tools/appletviewer/AppletClassLoader.java,
classpath/tools/gnu/classpath/tools/appletviewer/CommonAppletContext.java,
classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletContext.java,
classpath/tools/gnu/classpath/tools/appletviewer/AppletSecurityManager.java,
classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletContext.java,
classpath/tools/gnu/classpath/tools/appletviewer/AppletWarning.java,
classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletViewer.java,
classpath/tools/gnu/classpath/tools/appletviewer/AppletTag.java,
classpath/tools/gnu/classpath/tools/appletviewer/ConsoleDialog.java,
classpath/tools/gnu/classpath/tools/appletviewer/Main.java,
classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java,
classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletViewer.java,
classpath/tools/gnu/classpath/tools/appletviewer/TagParser.java,
classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java,
classpath/tools/gnu/classpath/tools/appletviewer/CommonAppletStub.java,
classpath/tools/gnu/classpath/tools/serialver/Messages.java,
classpath/tools/gnu/classpath/tools/serialver/SerialVer.java,
classpath/tools/gnu/classpath/tools/jar/Creator.java,
classpath/tools/gnu/classpath/tools/jar/Entry.java,
classpath/tools/gnu/classpath/tools/jar/Lister.java,
classpath/tools/gnu/classpath/tools/jar/Main.java,
classpath/tools/gnu/classpath/tools/jar/Updater.java,
classpath/tools/gnu/classpath/tools/jar/Messages.java,
classpath/tools/gnu/classpath/tools/jar/Extractor.java,
classpath/tools/gnu/classpath/tools/jar/Action.java,
classpath/tools/gnu/classpath/tools/jar/Indexer.java,
classpath/tools/gnu/classpath/tools/jar/WorkSet.java,
classpath/tools/gnu/classpath/tools/giop/GRMIC.txt,
classpath/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java,
classpath/tools/gnu/classpath/tools/giop/GRMIC.java,
classpath/tools/Makefile.am, classpath/tools/jarsigner.in,
classpath/tools/keytool.in, classpath/tools/appletviewer.in,
classpath/tools/.cvsignore, classpath/configure.ac,
classpath/javax/swing/JTabbedPane.java,
classpath/javax/swing/AbstractButton.java,
classpath/javax/swing/JViewport.java,
classpath/javax/swing/KeyboardManager.java,
classpath/javax/swing/JMenuItem.java,
classpath/javax/swing/JMenuBar.java,
classpath/javax/swing/MenuSelectionManager.java,
classpath/javax/swing/JOptionPane.java,
classpath/javax/swing/JSpinner.java,
classpath/javax/swing/JCheckBoxMenuItem.java,
classpath/javax/swing/JEditorPane.java,
classpath/javax/swing/JFormattedTextField.java,
classpath/javax/swing/JTree.java,
classpath/javax/swing/CellRendererPane.java,
classpath/javax/swing/JScrollPane.java,
classpath/javax/swing/tree/VariableHeightLayoutCache.java,
classpath/javax/swing/tree/TreeNode.java,
classpath/javax/swing/tree/FixedHeightLayoutCache.java,
classpath/javax/swing/tree/DefaultTreeCellEditor.java,
classpath/javax/swing/tree/TreePath.java,
classpath/javax/swing/tree/RowMapper.java,
classpath/javax/swing/tree/DefaultMutableTreeNode.java,
classpath/javax/swing/tree/DefaultTreeModel.java,
classpath/javax/swing/tree/AbstractLayoutCache.java,
classpath/javax/swing/tree/TreeSelectionModel.java,
classpath/javax/swing/tree/DefaultTreeSelectionModel.java,
classpath/javax/swing/tree/DefaultTreeCellRenderer.java,
classpath/javax/swing/tree/ExpandVetoException.java,
classpath/javax/swing/JList.java,
classpath/javax/swing/table/JTableHeader.java,
classpath/javax/swing/table/AbstractTableModel.java,
classpath/javax/swing/table/DefaultTableModel.java,
classpath/javax/swing/table/TableCellEditor.java,
classpath/javax/swing/table/TableCellRenderer.java,
classpath/javax/swing/ProgressMonitor.java,
classpath/javax/swing/JToolBar.java,
classpath/javax/swing/TransferHandler.java,
classpath/javax/swing/DefaultCellEditor.java,
classpath/javax/swing/DefaultButtonModel.java,
classpath/javax/swing/JLayeredPane.java,
classpath/javax/swing/text/DefaultEditorKit.java,
classpath/javax/swing/text/DefaultCaret.java,
classpath/javax/swing/text/FieldView.java,
classpath/javax/swing/text/JTextComponent.java,
classpath/javax/swing/text/TextAction.java,
classpath/javax/swing/text/StyleContext.java,
classpath/javax/swing/text/html/HTMLDocument.java,
classpath/javax/swing/text/html/MinimalHTMLWriter.java,
classpath/javax/swing/text/html/ImageView.java,
classpath/javax/swing/text/html/HTMLEditorKit.java,
classpath/javax/swing/text/AbstractWriter.java,
classpath/javax/swing/text/GapContent.java,
classpath/javax/swing/text/Utilities.java,
classpath/javax/swing/text/PlainView.java,
classpath/javax/swing/UIManager.java,
classpath/javax/swing/JSplitPane.java,
classpath/javax/swing/JComponent.java,
classpath/javax/swing/SwingUtilities.java,
classpath/javax/swing/border/AbstractBorder.java,
classpath/javax/swing/border/CompoundBorder.java,
classpath/javax/swing/border/TitledBorder.java,
classpath/javax/swing/border/MatteBorder.java,
classpath/javax/swing/border/BevelBorder.java,
classpath/javax/swing/RepaintManager.java,
classpath/javax/swing/JTable.java,
classpath/javax/swing/UIDefaults.java,
classpath/javax/swing/DefaultDesktopManager.java,
classpath/javax/swing/JMenu.java,
classpath/javax/swing/JLabel.java,
classpath/javax/swing/JSlider.java,
classpath/javax/swing/plaf/basic/BasicToolBarUI.java,
classpath/javax/swing/plaf/basic/BasicButtonUI.java,
classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java,
classpath/javax/swing/plaf/basic/BasicTextAreaUI.java,
classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java,
classpath/javax/swing/plaf/basic/BasicSpinnerUI.java,
classpath/javax/swing/plaf/basic/BasicSliderUI.java,
classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
classpath/javax/swing/plaf/basic/BasicComboPopup.java,
classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java,
classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,
classpath/javax/swing/plaf/basic/BasicProgressBarUI.java,
classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java,
classpath/javax/swing/plaf/basic/BasicPanelUI.java,
classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java,
classpath/javax/swing/plaf/basic/BasicTreeUI.java,
classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java,
classpath/javax/swing/plaf/basic/BasicFileChooserUI.java,
classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,
classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,
classpath/javax/swing/plaf/basic/BasicListUI.java,
classpath/javax/swing/plaf/basic/BasicIconFactory.java,
classpath/javax/swing/plaf/basic/BasicTextUI.java,
classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,
classpath/javax/swing/plaf/basic/BasicDirectoryModel.java,
classpath/javax/swing/plaf/basic/BasicRootPaneUI.java,
classpath/javax/swing/plaf/basic/BasicTableUI.java,
classpath/javax/swing/plaf/basic/SharedUIDefaults.java,
classpath/javax/swing/plaf/multi/MultiComboBoxUI.java,
classpath/javax/swing/plaf/multi/MultiListUI.java,
classpath/javax/swing/plaf/multi/MultiSplitPaneUI.java,
classpath/javax/swing/plaf/multi/MultiFileChooserUI.java,
classpath/javax/swing/plaf/multi/MultiOptionPaneUI.java,
classpath/javax/swing/plaf/multi/MultiTabbedPaneUI.java,
classpath/javax/swing/plaf/multi/MultiLookAndFeel.java,
classpath/javax/swing/plaf/metal/MetalSliderUI.java,
classpath/javax/swing/plaf/metal/MetalIconFactory.java,
classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java,
classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java,
classpath/javax/swing/plaf/metal/MetalLookAndFeel.java,
classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java,
classpath/javax/swing/plaf/metal/MetalSeparatorUI.java,
classpath/javax/swing/plaf/metal/MetalBorders.java,
classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java,
classpath/javax/swing/plaf/metal/MetalScrollBarUI.java,
classpath/javax/swing/plaf/metal/MetalRootPaneUI.java,
classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java,
classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java,
classpath/javax/swing/plaf/metal/MetalToolTipUI.java,
classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java,
classpath/javax/swing/plaf/metal/MetalFileChooserUI.java,
classpath/javax/swing/plaf/metal/MetalUtils.java,
classpath/javax/swing/plaf/metal/MetalComboBoxButton.java,
classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java,
classpath/javax/swing/plaf/metal/MetalButtonUI.java,
classpath/javax/swing/JPopupMenu.java,
classpath/javax/swing/JProgressBar.java,
classpath/javax/swing/WindowConstants.java,
classpath/javax/swing/JFrame.java,
classpath/javax/swing/JFileChooser.java,
classpath/javax/swing/JComboBox.java,
classpath/javax/swing/event/EventListenerList.java,
classpath/javax/swing/ListSelectionModel.java,
classpath/javax/swing/JScrollBar.java,
classpath/java/text/SimpleDateFormat.java,
classpath/java/text/NumberFormat.java,
classpath/java/text/class-dependencies.conf,
classpath/java/awt/image/ColorModel.java,
classpath/java/awt/image/BufferedImage.java,
classpath/java/awt/Window.java,
classpath/java/awt/ContainerOrderFocusTraversalPolicy.java,
classpath/java/awt/LightweightDispatcher.java,
classpath/java/awt/EventDispatchThread.java,
classpath/java/awt/BasicStroke.java,
classpath/java/awt/ColorPaintContext.java,
classpath/java/awt/Container.java,
classpath/java/awt/TexturePaint.java,
classpath/java/awt/Component.java, classpath/java/awt/Font.java,
classpath/java/awt/GraphicsConfiguration.java,
classpath/java/awt/DefaultKeyboardFocusManager.java,
classpath/java/awt/print/PrinterJob.java,
classpath/java/awt/im/InputContext.java,
classpath/java/awt/dnd/DragGestureRecognizer.java,
classpath/java/awt/Toolkit.java,
classpath/java/awt/font/GraphicAttribute.java,
classpath/java/awt/font/ImageGraphicAttribute.java,
classpath/java/awt/font/GlyphVector.java,
classpath/java/awt/font/GlyphMetrics.java,
classpath/java/awt/font/ShapeGraphicAttribute.java,
classpath/java/awt/Graphics2D.java,
classpath/include/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h,
classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,
classpath/include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h,
classpath/include/config.h.in,
classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h,
classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h,
classpath/include/gnu_java_awt_peer_gtk_GdkFontPeer.h,
classpath/include/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.h,
classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h,
classpath/include/gnu_java_awt_peer_gtk_GtkImage.h,
classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h,
classpath/include/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.h:
Merge from GNU Classpath HEAD.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114510 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java')
27 files changed, 1347 insertions, 299 deletions
diff --git a/libjava/classpath/java/awt/BasicStroke.java b/libjava/classpath/java/awt/BasicStroke.java index bf111d08050..3e259216fa7 100644 --- a/libjava/classpath/java/awt/BasicStroke.java +++ b/libjava/classpath/java/awt/BasicStroke.java @@ -363,7 +363,7 @@ public class BasicStroke implements Stroke * Compares this <code>BasicStroke</code> for equality with an arbitrary * object. This method returns <code>true</code> if and only if: * <ul> - * <li><code>o</code> is an instanceof <code>BasicStroke</code>;<li> + * <li><code>o</code> is an instanceof <code>BasicStroke</code>;</li> * <li>this object has the same width, line cap style, line join style, * miter limit, dash array and dash phase as <code>o</code>.</li> * </ul> diff --git a/libjava/classpath/java/awt/ColorPaintContext.java b/libjava/classpath/java/awt/ColorPaintContext.java index 82a78f63fb5..2996f899f17 100644 --- a/libjava/classpath/java/awt/ColorPaintContext.java +++ b/libjava/classpath/java/awt/ColorPaintContext.java @@ -117,7 +117,7 @@ class ColorPaintContext implements PaintContext { cachedRaster = new ColorRaster(colorModel, 0, 0, width, height, color); } - return cachedRaster.createChild(0 ,0 ,width ,height ,x ,y , null); + return cachedRaster.createChild(0 ,0 ,width ,height ,0 ,0 , null); } /** @@ -138,13 +138,13 @@ class ColorPaintContext implements PaintContext * @param rgbPixel The RGB value of the color for this raster. */ ColorRaster(ColorModel cm,int x, int y, int width, int height, int rgbPixel) - { + { super(cm.createCompatibleSampleModel(width,height),new Point(x,y)); Object pixel = cm.getDataElements(rgbPixel,null); - getSampleModel().setDataElements(0, 0, - width, height, - multiplyData(pixel,null,width*height), - dataBuffer); + int[] pixelComps = cm.getComponents(pixel, null, 0); + int[] d = (int[]) multiplyData(pixelComps,null,width*height); + getSampleModel().setPixels(0, 0, width, height, d, + dataBuffer); } diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java index dbbec8ac178..cc42d04f274 100644 --- a/libjava/classpath/java/awt/Component.java +++ b/libjava/classpath/java/awt/Component.java @@ -2067,11 +2067,9 @@ public abstract class Component */ public VolatileImage createVolatileImage(int width, int height) { - if (GraphicsEnvironment.isHeadless()) - return null; - GraphicsConfiguration config = getGraphicsConfiguration(); - return config == null ? null - : config.createCompatibleVolatileImage(width, height); + if (peer != null) + return peer.createVolatileImage(width, height); + return null; } /** @@ -2090,11 +2088,9 @@ public abstract class Component ImageCapabilities caps) throws AWTException { - if (GraphicsEnvironment.isHeadless()) - return null; - GraphicsConfiguration config = getGraphicsConfiguration(); - return config == null ? null - : config.createCompatibleVolatileImage(width, height, caps); + if (peer != null) + return peer.createVolatileImage(width, height); + return null; } /** @@ -4810,8 +4806,38 @@ p * <li>the set of backward traversal keys { Object target = e.getSource (); Event translated = null; + + if (e instanceof WindowEvent) + { + WindowEvent we = (WindowEvent) e; + int id = we.id; + int newId = 0; + + switch (id) + { + case WindowEvent.WINDOW_DEICONIFIED: + newId = Event.WINDOW_DEICONIFY; + break; + case WindowEvent.WINDOW_CLOSED: + case WindowEvent.WINDOW_CLOSING: + newId = Event.WINDOW_DESTROY; + break; + case WindowEvent.WINDOW_ICONIFIED: + newId = Event.WINDOW_ICONIFY; + break; + case WindowEvent.WINDOW_GAINED_FOCUS: + newId = Event.GOT_FOCUS; + break; + case WindowEvent.WINDOW_LOST_FOCUS: + newId = Event.LOST_FOCUS; + break; + default: + return null; + } - if (e instanceof InputEvent) + translated = new Event(target, 0, newId, 0, 0, 0, 0); + } + else if (e instanceof InputEvent) { InputEvent ie = (InputEvent) e; long when = ie.getWhen (); @@ -5052,7 +5078,12 @@ p * <li>the set of backward traversal keys .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: - if (isLightweight() && !e.isConsumed()) + // A mouse click on an enabled lightweight component + // which has not yet been marked as consumed by any + // other mouse listener results in a focus traversal + // to that component. + if (isLightweight() + && isEnabled() && !e.isConsumed()) requestFocus(); break; } diff --git a/libjava/classpath/java/awt/Container.java b/libjava/classpath/java/awt/Container.java index 2419a7bd24a..85a68ce13c2 100644 --- a/libjava/classpath/java/awt/Container.java +++ b/libjava/classpath/java/awt/Container.java @@ -457,8 +457,44 @@ public class Container extends Component { synchronized (getTreeLock ()) { - while (ncomponents > 0) - remove(0); + // In order to allow the same bad tricks to be used as in RI + // this code has to stay exactly that way: In a real-life app + // a Container subclass implemented its own vector for + // subcomponents, supplied additional addXYZ() methods + // and overrode remove(int) and removeAll (the latter calling + // super.removeAll() ). + // By doing it this way, user code cannot prevent the correct + // removal of components. + for ( int index = 0; index < ncomponents; index++) + { + Component r = component[index]; + + ComponentListener[] list = r.getComponentListeners(); + for (int j = 0; j < list.length; j++) + r.removeComponentListener(list[j]); + + r.removeNotify(); + + if (layoutMgr != null) + layoutMgr.removeLayoutComponent(r); + + r.parent = null; + + if (isShowing ()) + { + // Post event to notify of removing the component. + ContainerEvent ce + = new ContainerEvent(this, + ContainerEvent.COMPONENT_REMOVED, + r); + + getToolkit().getSystemEventQueue().postEvent(ce); + } + } + + invalidate(); + + ncomponents = 0; } } diff --git a/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java b/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java index 152482c887b..23b4ac2e8d3 100644 --- a/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java +++ b/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java @@ -111,14 +111,16 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { - // We've reached the top focus cycle root ancestor. Check - // if it is root. - if (ancestor != root) + // We've reached the top focus cycle root ancestor. Check + // if it is root. + if (ancestor == null) + ancestor = root; + else if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); - else - break; + else + break; } prevAncestor = ancestor; } @@ -136,7 +138,6 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy return getFirstComponent ((Container) current); Container parent = current.getParent (); - synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); @@ -146,47 +147,104 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy // Find component's index. for (int i = 0; i < numComponents; i++) { - if (components[i] == current) + if (components[i].equals(current)) componentIndex = i; } - // Search forward for the next acceptable component. - for (int i = componentIndex + 1; i < numComponents; i++) - { - if (accept (components[i])) - return components[i]; + // Search forward for the next acceptable component. + // Search through all components at least one time + // i.e. start at componentIndex + 1 --> nComponents -1 --> 0 ---> componentIndex + int i = componentIndex + 1; + int end = numComponents - 1; + Component next = getNextAvailableComponent(components, i, end); + if (next != null) + return next; + + // Now check remainder of components from 0 to componentIndex + i = 0; + end = componentIndex; + next = getNextAvailableComponent(components, i, end); + if (next != null) + return next; + + // No focusable components after current in its Container. So go + // to the next Component after current's Container (parent). + Component result = getComponentAfter (root, parent); + return result; + } + } + + /** + * Gets the next available component in the array between the given range. + * + * @param components - the array of components. + * @param start - where to start + * @param end - where to end + * @return next component if found + */ + private Component getNextAvailableComponent(Component[] components, int start, int end) + { + while (start <= end) + { + Component c = components[start]; + + if (c.visible && c.isDisplayable() && c.enabled && c.focusable) + return c; - if (components[i] instanceof Container) - { - Component result = getFirstComponent ((Container) components[i]); + if (c instanceof Container) + { + Component result = getFirstComponent((Container) c); - if (result != null - && implicitDownCycleTraversal) - return result; - } + if (result != null && implicitDownCycleTraversal && result.visible + && result.isDisplayable() && result.enabled && result.focusable) + return result; } + start++; + } - // No focusable components after current in its Container. So go - // to the next Component after current's Container (parent). - Component result = getComponentAfter (root, parent); + return null; + } - return result; + /** + * Gets the previous available component in the array between the given range. + * + * @param components - the array of components. + * @param start - where to start + * @param end - where to end + * @return previous component if found + */ + Component getPrevAvailableComponent(Component[] components, int start, int end) + { + while (start >= end) + { + Component c = components[start]; + if (c.visible && c.isDisplayable() && c.enabled && c.focusable) + return c; + + if (c instanceof Container) + { + Component result = getLastComponent((Container) c); + + if (result != null + && (result.visible && result.isDisplayable() && result.enabled && result.focusable)) + return result; + } + start--; } + return null; } /** * Returns the Component that should receive the focus before - * <code>current</code>. <code>root</code> must be a focus cycle - * root of current. - * + * <code>current</code>. <code>root</code> must be a focus cycle root of + * current. + * * @param root a focus cycle root of current * @param current a (possibly indirect) child of root, or root itself - * - * @return the previous Component in the focus traversal order for - * root, or null if no acceptable Component exists. - * - * @exception IllegalArgumentException If root is not a focus cycle - * root of current, or if either root or current is null. + * @return the previous Component in the focus traversal order for root, or + * null if no acceptable Component exists. + * @exception IllegalArgumentException If root is not a focus cycle root of + * current, or if either root or current is null. */ public Component getComponentBefore (Container root, Component current) { @@ -207,7 +265,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy { // We've reached the top focus cycle root ancestor. Check // if it is root. - if (ancestor != root) + if (ancestor == null) + ancestor = root; + else if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); @@ -244,20 +304,20 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy componentIndex = i; } - // Search backward for the next acceptable component. - for (int i = componentIndex - 1; i >= 0; i--) - { - if (accept (components[i])) - return components[i]; - - if (components[i] instanceof Container) - { - Component result = getLastComponent ((Container) components[i]); - - if (result != null) - return result; - } - } + // Search through all components at least one time + // i.e. start at componentIndex - 1 --> 0 --> numComponents -1 ---> componentIndex + int i = componentIndex - 1; + int end = 0; + Component prev = getPrevAvailableComponent(components, i, end); + if (prev != null) + return prev; + + // Now check remainder of components + i = numComponents -1; + end = componentIndex; + prev = getPrevAvailableComponent(components, i, end); + if (prev != null) + return prev; // No focusable components before current in its Container. So go // to the previous Component before current's Container (parent). @@ -286,7 +346,8 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy || !root.isDisplayable ()) return null; - if (accept (root)) + if (root.visible && root.isDisplayable() && root.enabled + && root.focusable) return root; Component[] componentArray = root.getComponents (); @@ -295,14 +356,16 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy { Component component = componentArray [i]; - if (accept (component)) + if (component.visible && component.isDisplayable() && component.enabled + && component.focusable) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); - if (result != null) + if (result != null + && (result.visible && result.isDisplayable() && result.enabled && result.focusable)) return result; } } @@ -329,7 +392,8 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy || !root.isDisplayable ()) return null; - if (accept (root)) + if (root.visible && root.isDisplayable() && root.enabled + && root.focusable) return root; Component[] componentArray = root.getComponents (); @@ -338,14 +402,17 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy { Component component = componentArray [i]; - if (accept (component)) + if (component.visible && component.isDisplayable() && component.enabled + && component.focusable) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); - if (result != null) + if (result != null && + result.visible && result.isDisplayable() && result.enabled + && result.focusable) return result; } } diff --git a/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java b/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java index a60cefd9c9d..037cb834c40 100644 --- a/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java +++ b/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java @@ -274,10 +274,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager public boolean dispatchKeyEvent (KeyEvent e) { - Component focusOwner = getGlobalPermanentFocusOwner (); - + Component focusOwner = getFocusOwner(); + if (focusOwner == null) + focusOwner = getFocusedWindow(); + if (focusOwner != null) - redispatchEvent(focusOwner, e); + redispatchEvent(focusOwner, e); // Loop through all registered KeyEventPostProcessors, giving // each a chance to process this event. @@ -294,7 +296,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager // MenuShortcut. if (postProcessKeyEvent (e)) return true; - + // Always return true. return true; } diff --git a/libjava/classpath/java/awt/EventDispatchThread.java b/libjava/classpath/java/awt/EventDispatchThread.java index a64cdae8567..7cb8af831bf 100644 --- a/libjava/classpath/java/awt/EventDispatchThread.java +++ b/libjava/classpath/java/awt/EventDispatchThread.java @@ -43,6 +43,11 @@ package java.awt; */ class EventDispatchThread extends Thread { + /** + * The default priority when no property has been set. + */ + private static final int DEFAULT_PRIORITY = NORM_PRIORITY + 1; + private static int dispatchThreadNum; private EventQueue queue; @@ -52,7 +57,22 @@ class EventDispatchThread extends Thread super(); setName("AWT-EventQueue-" + ++dispatchThreadNum); this.queue = queue; - setPriority(NORM_PRIORITY + 1); + + int priority = DEFAULT_PRIORITY; + try + { + String priorityString = + System.getProperty("gnu.awt.dispatchthread.priority"); + if (priorityString != null) + { + priority = Integer.parseInt(priorityString); + } + } + catch (NumberFormatException ex) + { + // Ignore and use default. + } + setPriority(priority); } public void run() diff --git a/libjava/classpath/java/awt/Font.java b/libjava/classpath/java/awt/Font.java index 2e4c9f61c68..a52f63408da 100644 --- a/libjava/classpath/java/awt/Font.java +++ b/libjava/classpath/java/awt/Font.java @@ -1013,7 +1013,7 @@ public class Font implements Serializable */ public int getNumGlyphs() { - return peer.getMissingGlyphCode(this); + return peer.getNumGlyphs(this); } /** diff --git a/libjava/classpath/java/awt/Graphics2D.java b/libjava/classpath/java/awt/Graphics2D.java index 3faa9dc0c66..b3ecbc58a98 100644 --- a/libjava/classpath/java/awt/Graphics2D.java +++ b/libjava/classpath/java/awt/Graphics2D.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2004 Free Software Foundation +/* Copyright (C) 2000, 2002, 2004, 2006, Free Software Foundation This file is part of GNU Classpath. @@ -45,10 +45,35 @@ import java.awt.image.BufferedImageOp; import java.awt.image.ImageObserver; import java.awt.image.RenderedImage; import java.awt.image.renderable.RenderableImage; +import java.awt.print.PageFormat; +import java.awt.print.Printable; import java.text.AttributedCharacterIterator; import java.util.Map; /** + * An abstract class defining a device independent two-dimensional vector + * graphics API. Concrete subclasses implement this API for output of + * vector graphics to: (*) + * <p> + * <ul> + * <li>a {@link javax.swing.JComponent} - in the + * {@link javax.swing.JComponent#paint(Graphics)} method, the incoming + * {@link Graphics} should always be an instance of + * <code>Graphics2D</code> (*);</li> + * <li>a {@link BufferedImage} - see + * {@link BufferedImage#createGraphics()} (*);</li> + * <li>a {@link java.awt.print.PrinterJob} - in the + * {@link Printable#print(Graphics, PageFormat, int)} method, the incoming + * {@link Graphics} should always be an instance of <code>Graphics2D</code> + * (*).</li> + * </ul> + * <p> + * (*) Support for this API is not fully implemented in GNU Classpath yet. + * <p> + * Third party libraries provide support for output to other formats via this + * API, including encapsulated postscript (EPS), portable document format (PDF), + * and scalable vector graphics (SVG). + * * @author Rolf W. Rasmussen (rolfwr@ii.uib.no) */ public abstract class Graphics2D extends Graphics @@ -70,6 +95,14 @@ public abstract class Graphics2D extends Graphics super.fill3DRect(x, y, width, height, raised); } + /** + * Draws an outline around a shape using the current stroke and paint. + * + * @param shape the shape (<code>null</code> not permitted). + * + * @see #getStroke() + * @see #getPaint() + */ public abstract void draw(Shape shape); public abstract boolean drawImage(Image image, AffineTransform xform, @@ -86,18 +119,57 @@ public abstract class Graphics2D extends Graphics public abstract void drawRenderableImage(RenderableImage image, AffineTransform xform); + /** + * Draws a string at the specified location, using the current font. + * + * @param text the string to draw. + * @param x the x-coordinate. + * @param y the y-coordinate. + * + * @see Graphics#setFont(Font) + */ public abstract void drawString(String text, int x, int y); + /** + * Draws a string at the specified location, using the current font. + * + * @param text the string to draw. + * @param x the x-coordinate. + * @param y the y-coordinate. + * + * @see Graphics#setFont(Font) + */ public abstract void drawString(String text, float x, float y); + /** + * Draws an attributed string at the specified location. + * + * @param iterator the source of the attributed text. + * @param x the x-coordinate. + * @param y the y-coordinate. + */ public abstract void drawString(AttributedCharacterIterator iterator, int x, int y); + /** + * Draws an attributed string at the specified location. + * + * @param iterator the source of the attributed text. + * @param x the x-coordinate. + * @param y the y-coordinate. + */ public abstract void drawString(AttributedCharacterIterator iterator, float x, float y); - // public abstract void drawGlyphVector(GlyphVector g, float x, float y); - + /** + * Fills the interior of the specified <code>shape</code> using the current + * paint. + * + * @param shape the shape to fill (<code>null</code> not permitted). + * + * @see #draw(Shape) + * @see #getPaint() + */ public abstract void fill(Shape shape); public abstract boolean hit(Rectangle rect, Shape text, @@ -105,21 +177,72 @@ public abstract class Graphics2D extends Graphics public abstract GraphicsConfiguration getDeviceConfiguration(); + /** + * Sets the current compositing rule. + * + * @param comp the composite. + * + * @see #getComposite() + */ public abstract void setComposite(Composite comp); - + + /** + * Sets the paint to be used for subsequent drawing operations. + * + * @param paint the paint (<code>null</code> not permitted). + * + * @see #getPaint() + */ public abstract void setPaint(Paint paint); + /** + * Sets the stroke to be used for subsequent drawing operations. + * + * @param stroke the stroke (<code>null</code> not permitted). + * + * @see #getStroke() + */ public abstract void setStroke(Stroke stroke); + /** + * Adds or updates a hint in the current rendering hints table. + * + * @param hintKey the hint key. + * @param hintValue the hint value. + */ public abstract void setRenderingHint(RenderingHints.Key hintKey, Object hintValue); + /** + * Returns the current value of a rendering hint. + * + * @param hintKey the key for the hint. + * + * @return The value for the specified hint. + */ public abstract Object getRenderingHint(RenderingHints.Key hintKey); + /** + * Replaces the current rendering hints with the supplied hints. + * + * @param hints the hints. + * + * @see #addRenderingHints(Map) + */ public abstract void setRenderingHints(Map hints); + /** + * Adds/updates the rendering hint. + * + * @param hints the hints to add or update. + */ public abstract void addRenderingHints(Map hints); + /** + * Returns the current rendering hints. + * + * @return The current rendering hints. + */ public abstract RenderingHints getRenderingHints(); public abstract void translate(int x, int y); @@ -134,25 +257,104 @@ public abstract class Graphics2D extends Graphics public abstract void shear(double shearX, double shearY); - public abstract void transform(AffineTransform Tx); + /** + * Sets the current transform to a concatenation of <code>transform</code> + * and the existing transform. + * + * @param transform the transform. + */ + public abstract void transform(AffineTransform transform); - public abstract void setTransform(AffineTransform Tx); - + /** + * Sets the current transform. If the caller specifies a <code>null</code> + * transform, this method should set the current transform to the + * identity transform. + * + * @param transform the transform (<code>null</code> permitted). + * + * @see #getTransform() + */ + public abstract void setTransform(AffineTransform transform); + + /** + * Returns the current transform. + * + * @return The current transform. + * + * @see #setTransform(AffineTransform) + */ public abstract AffineTransform getTransform(); + /** + * Returns the current paint. + * + * @return The current paint. + * + * @see #setPaint(Paint) + */ public abstract Paint getPaint(); + /** + * Returns the current compositing rule. + * + * @return The current compositing rule. + * + * @see #setComposite(Composite) + */ public abstract Composite getComposite(); + /** + * Sets the background color (used by the + * {@link Graphics#clearRect(int, int, int, int)} method). + * + * @param color the color. + * + * @see #getBackground() + */ public abstract void setBackground(Color color); + /** + * Returns the color used by the + * {@link Graphics#clearRect(int, int, int, int)} method. + * + * @return The background color. + * + * @see #setBackground(Color) + */ public abstract Color getBackground(); + /** + * Returns the current stroke. + * + * @return The current stroke. + * + * @see #setStroke(Stroke) + */ public abstract Stroke getStroke(); + /** + * Sets the clip region to the intersection of the current clipping region + * and <code>s</code>. + * + * @param s the shape to intersect with the current clipping region. + * + * @see Graphics#setClip(Shape) + */ public abstract void clip(Shape s); - public abstract FontRenderContext getFontRenderContext (); - - public abstract void drawGlyphVector (GlyphVector g, float x, float y); + /** + * Returns the font render context. + * + * @return The font render context. + */ + public abstract FontRenderContext getFontRenderContext(); + + /** + * Draws a glyph vector at the specified location. + * + * @param g the glyph vector. + * @param x the x-coordinate. + * @param y the y-coordinate. + */ + public abstract void drawGlyphVector(GlyphVector g, float x, float y); } diff --git a/libjava/classpath/java/awt/GraphicsConfiguration.java b/libjava/classpath/java/awt/GraphicsConfiguration.java index f68a1e6ba4f..792b2cc1b2b 100644 --- a/libjava/classpath/java/awt/GraphicsConfiguration.java +++ b/libjava/classpath/java/awt/GraphicsConfiguration.java @@ -65,6 +65,13 @@ import java.awt.image.VolatileImage; */ public abstract class GraphicsConfiguration { + + /** The cached image capabilities. */ + private ImageCapabilities imageCapabilities; + + /** The cached buffer capabilities. */ + private BufferCapabilities bufferCapabilities; + /** * The default constructor. * @@ -218,9 +225,14 @@ public abstract class GraphicsConfiguration * @since 1.4 */ public BufferCapabilities getBufferCapabilities() - throws NotImplementedException { - throw new Error("not implemented"); + if (imageCapabilities == null) + getImageCapabilities(); + + if (bufferCapabilities == null) + bufferCapabilities = new BufferCapabilities(imageCapabilities, + imageCapabilities, null); + return bufferCapabilities; } /** @@ -230,8 +242,9 @@ public abstract class GraphicsConfiguration * @since 1.4 */ public ImageCapabilities getImageCapabilities() - throws NotImplementedException { - throw new Error("not implemented"); + if (imageCapabilities == null) + imageCapabilities = new ImageCapabilities(false); + return imageCapabilities; } } // class GraphicsConfiguration diff --git a/libjava/classpath/java/awt/LightweightDispatcher.java b/libjava/classpath/java/awt/LightweightDispatcher.java index 860646402cc..7e33bd4e9ce 100644 --- a/libjava/classpath/java/awt/LightweightDispatcher.java +++ b/libjava/classpath/java/awt/LightweightDispatcher.java @@ -38,8 +38,6 @@ exception statement from your version. */ package java.awt; -import gnu.java.awt.AWTUtilities; - import java.awt.event.MouseEvent; import java.util.WeakHashMap; @@ -67,6 +65,13 @@ class LightweightDispatcher * as well as the MOUSE_RELEASED event following the dragging. */ private Component dragTarget; + + /** + * Stores the button number which started the drag operation. This is needed + * because we want to handle only one drag operation and only the button that + * started the dragging should be able to stop it (by a button release). + */ + private int dragButton; /** * The last mouse event target. If the target changes, additional @@ -121,15 +126,41 @@ class LightweightDispatcher /** * Handles all mouse events that are targetted at toplevel containers * (Window instances) and dispatches them to the correct lightweight child. - * + * * @param ev the mouse event * @return whether or not we found a lightweight that handled the event. */ private boolean handleMouseEvent(MouseEvent ev) { Window window = (Window) ev.getSource(); - Component target = window.findComponentAt(ev.getX(), ev.getY()); - target = findTarget(target); + // Find the target for the mouse event. We first seach the deepest + // component at the specified location. The we go up to its parent and + // try to find a neighbor of the deepest component that is suitable as + // mouse event target (it must be showing, at that location and have either + // a MouseListener or MouseMotionListener installed). If no such component + // is found, then we walk up the container hierarchy and find the next + // container that has a MouseListener or MouseMotionListener installed. + Component deepest = window.findComponentAt(ev.getX(), ev.getY()); + if (deepest == null) + return false; + Container parent = deepest.getParent(); + Point loc = ev.getPoint(); + loc = convertPointToChild(window, loc, parent); + Component target = null; + if (parent != null) + { + target = findTarget(parent, loc); + while (target == null && parent != null) + { + if (parent.getMouseListeners().length > 0 + || parent.getMouseMotionListeners().length > 0) + { + target = parent; + } + else + parent = parent.getParent(); + } + } if (target == null || target.isLightweight()) { // Dispatch additional MOUSE_EXITED and MOUSE_ENTERED if event target @@ -138,18 +169,26 @@ class LightweightDispatcher { if (lastTarget != null) { - Point p1 = AWTUtilities.convertPoint(window, ev.getX(), - ev.getY(), lastTarget); + Point p1 = convertPointToChild(window, ev.getPoint(), + lastTarget); MouseEvent mouseExited = new MouseEvent(lastTarget, MouseEvent.MOUSE_EXITED, ev.getWhen(), ev.getModifiers(), p1.x, p1.y, ev.getClickCount(), ev.isPopupTrigger()); lastTarget.dispatchEvent(mouseExited); } - if (target != null) + + // If a target exists dispatch the MOUSE_ENTERED event only if + // there is currently no component from which a drag operation + // started (dragTarget == null) or the target is that component + // (dragTarget == target) + // That way a user can click and hold on a button (putting it into + // the armed state), move the cursor above other buttons without + // affecting their rollover state and get back to the initial + // button. + if (target != null && (dragTarget == null || dragTarget == target)) { - Point p = AWTUtilities.convertPoint(window, ev.getX(), ev.getY(), - target); + Point p = convertPointToChild(window, ev.getPoint(), target); MouseEvent mouseEntered = new MouseEvent(target, MouseEvent.MOUSE_ENTERED, ev.getWhen(), ev.getModifiers(), p.x, p.y, ev.getClickCount(), @@ -161,12 +200,30 @@ class LightweightDispatcher switch (ev.getID()) { case MouseEvent.MOUSE_PRESSED: - dragTarget = target; + // Handle the start of a drag operation or discard the event if + // one is already in progress. This prevents focus changes with the + // other mouse buttons when one is used for dragging. + if (dragTarget == null) + { + lastTarget = dragTarget = target; + + // Save the button that started the drag operation. + dragButton = ev.getButton(); + } + else + return false; + break; case MouseEvent.MOUSE_RELEASED: - if (dragTarget != null) - target = dragTarget; - dragTarget = null; + // Stop the drag operation only when the button that started + // it was released. + if (dragTarget != null && dragButton == ev.getButton()) + { + target = dragTarget; + dragTarget = null; + } + + lastTarget = target; break; case MouseEvent.MOUSE_CLICKED: // When we receive a MOUSE_CLICKED, we set the target to the @@ -174,27 +231,35 @@ class LightweightDispatcher // This is necessary for the case when the MOUSE_RELEASED has // caused the original target (like an internal component) go // away. + // This line is the reason why it is not possible to move the + // 'lastTarget = target' assignment before the switch-statement. target = lastTarget; break; case MouseEvent.MOUSE_DRAGGED: + // We consider only dragTarget for redispatching the event still + // we have to act in a way that the newly found target component + // was handled. + lastTarget = target; target = dragTarget; break; default: - // Do nothing in other cases. + // Only declare current target as the old value in all other + // cases. + lastTarget = target; break; } - lastTarget = target; - if (target != null) { - Point targetCoordinates = - AWTUtilities.convertPoint(window, ev.getX(), ev.getY(), target); + Point targetCoordinates = convertPointToChild(window, + ev.getPoint(), + target); int dx = targetCoordinates.x - ev.getX(); int dy = targetCoordinates.y - ev.getY(); ev.translatePoint(dx, dy); ev.setSource(target); target.dispatchEvent(ev); + // We reset the event, so that the normal event dispatching is not // influenced by this modified event. ev.setSource(window); @@ -209,20 +274,66 @@ class LightweightDispatcher /** * Finds the actual target for a mouseevent, starting at <code>c</code>. - * This searches upwards the component hierarchy until it finds a component - * that has a mouselistener attached. + * This searches through the children of the container and finds the first + * one which is showing, at the location from the mouse event and has + * a MouseListener or MouseMotionListener attached. If no such child component + * is found, null is returned. * - * @param c the component to start searching from + * @param c the container to search through + * @param loc the mouse event point * - * @return the actual receiver of the mouse event + * @return the actual receiver of the mouse event, or null, if no such + * component has been found */ - private Component findTarget(Component c) + private Component findTarget(Container c, Point loc) { - Component target = c; - while (target != null && target.getMouseListeners().length == 0) + Component[] children = c.getComponents(); + Component target = null; + if (c != null) { - target = target.getParent(); + for (int i = 0; i < children.length; i++) + { + Component child = children[i]; + if (child.isShowing()) + { + if (child.contains(loc.x - child.getX(), loc.y - child.getY()) + && (child.getMouseListeners().length > 0 + || child.getMouseMotionListeners().length > 0)) + { + target = child; + break; + } + } + } } return target; } + + /** + * Converts a point in the parent's coordinate system to a child coordinate + * system. The resulting point is stored in the same Point object and + * returned. + * + * @param parent the parent component + * @param p the point + * @param child the child component + * + * @return the translated point + */ + private Point convertPointToChild(Component parent, Point p, + Component child) + { + int offX = 0; + int offY = 0; + Component comp = child; + while (comp != null && comp != parent) + { + offX += comp.getX(); + offY += comp.getY(); + comp = comp.getParent(); + } + p.x -= offX; + p.y -= offY; + return p; + } } diff --git a/libjava/classpath/java/awt/TexturePaint.java b/libjava/classpath/java/awt/TexturePaint.java index 57d7574c3d4..387ccb0fd84 100644 --- a/libjava/classpath/java/awt/TexturePaint.java +++ b/libjava/classpath/java/awt/TexturePaint.java @@ -38,42 +38,81 @@ exception statement from your version. */ package java.awt; -import gnu.classpath.NotImplementedException; +import gnu.java.awt.java2d.TexturePaintContext; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; -/** STUB CLASS ONLY */ +/** + * This class provides a way to fill a Shape with a texture that is + * specified by a BufferedImage. + */ public class TexturePaint implements Paint { private final BufferedImage texture; private final Rectangle2D anchor; + + /** + * Constructor. + * + * @param texture - the texture + * @param anchor - the shape + */ public TexturePaint(BufferedImage texture, Rectangle2D anchor) { this.texture = texture; this.anchor = anchor; } + + /** + * Gets the texture image. + * + * @return the texture + */ public BufferedImage getImage() { return texture; } + + /** + * Gets the shape anchor. + * + * @return the shape anchor + */ public Rectangle2D getAnchorRect() { return anchor; } + + /** + * Creates the context used to paint the texture. + * + * @param cm - the ColorModel that receives the Paint data. Used only as a hint. + * @param deviceBounds - the device space being rendered. + * @param userBounds - the user space being rendered + * @param xform - the AffineTransform from user space into device space + * @param hints - a RenderingHints object that is used to specify how the + * pattern is rendered + * @return the paint context used to paint the texture + */ public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, - AffineTransform xform, - RenderingHints hints) - throws NotImplementedException + AffineTransform xform, RenderingHints hints) { - throw new Error("not implemented"); + // TODO: Maybe add some hook for providing alternative/accelerated + // implementations of this. + return new TexturePaintContext(this, deviceBounds, userBounds, xform); } + + /** + * Returns the transparency mode. + * + * @return the transparency mode. + */ public int getTransparency() - throws NotImplementedException { - throw new Error("not implemented"); + return texture.getTransparency(); } } // class TexturePaint diff --git a/libjava/classpath/java/awt/Toolkit.java b/libjava/classpath/java/awt/Toolkit.java index 16f1caf85df..282e50d2c50 100644 --- a/libjava/classpath/java/awt/Toolkit.java +++ b/libjava/classpath/java/awt/Toolkit.java @@ -544,7 +544,7 @@ public abstract class Toolkit return ClassLoader.getSystemClassLoader(); } }); - Class cls = cl.loadClass(toolkit_name); + Class cls = Class.forName(toolkit_name, true, cl); Object obj = cls.newInstance(); if (!(obj instanceof Toolkit)) throw new AWTError(toolkit_name + " is not a subclass of " + diff --git a/libjava/classpath/java/awt/Window.java b/libjava/classpath/java/awt/Window.java index d9e90c0ea4f..8bc4715aed5 100644 --- a/libjava/classpath/java/awt/Window.java +++ b/libjava/classpath/java/awt/Window.java @@ -38,8 +38,6 @@ exception statement from your version. */ package java.awt; -import gnu.classpath.NotImplementedException; - import java.awt.event.ComponentEvent; import java.awt.event.FocusEvent; import java.awt.event.WindowAdapter; @@ -132,33 +130,7 @@ public class Window extends Container implements Accessible // cycle roots. focusCycleRoot = true; setLayout(new BorderLayout()); - - addWindowFocusListener (new WindowAdapter () - { - public void windowGainedFocus (WindowEvent event) - { - if (windowFocusOwner != null) - { - // FIXME: move this section and the other similar - // sections in Component into a separate method. - EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); - synchronized (eq) - { - KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); - Component currentFocusOwner = manager.getGlobalPermanentFocusOwner (); - if (currentFocusOwner != null) - { - eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST, - false, windowFocusOwner)); - eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, - false, currentFocusOwner)); - } - else - eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false)); - } - } - } - }); + addWindowFocusListener(); GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration(); @@ -169,7 +141,68 @@ public class Window extends Container implements Accessible this(); graphicsConfiguration = gc; } + + private void addWindowFocusListener() + { + addWindowFocusListener(new WindowAdapter() + { + public void windowGainedFocus(WindowEvent event) + { + EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); + if (windowFocusOwner != null) + { + synchronized (eq) + { + KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + Component currentFocusOwner = manager.getGlobalPermanentFocusOwner(); + if (currentFocusOwner != null) + { + eq.postEvent(new FocusEvent(currentFocusOwner, + FocusEvent.FOCUS_LOST, false, + windowFocusOwner)); + eq.postEvent(new FocusEvent(windowFocusOwner, + FocusEvent.FOCUS_GAINED, false, + currentFocusOwner)); + } + else + eq.postEvent(new FocusEvent(windowFocusOwner, + FocusEvent.FOCUS_GAINED, false)); + } + } + else + eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_GAINED, + false)); + } + public void windowLostFocus(WindowEvent event) + { + EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); + if (windowFocusOwner != null) + { + synchronized (eq) + { + KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + Component currentFocusOwner = manager.getGlobalPermanentFocusOwner(); + if (currentFocusOwner != null) + { + eq.postEvent(new FocusEvent(currentFocusOwner, + FocusEvent.FOCUS_GAINED, false, + windowFocusOwner)); + eq.postEvent(new FocusEvent(windowFocusOwner, + FocusEvent.FOCUS_LOST, false, + currentFocusOwner)); + } + else + eq.postEvent(new FocusEvent(windowFocusOwner, + FocusEvent.FOCUS_LOST, false)); + } + } + else + eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_LOST, false)); + } + }); + } + /** * Initializes a new instance of <code>Window</code> with the specified * parent. The window will initially be invisible. @@ -1046,12 +1079,11 @@ public class Window extends Container implements Accessible /** * @since 1.2 * - * @deprecated + * @deprecated replaced by Component.applyComponentOrientation. */ public void applyResourceBundle(ResourceBundle rb) - throws NotImplementedException { - throw new Error ("Not implemented"); + applyComponentOrientation(ComponentOrientation.getOrientation(rb)); } /** diff --git a/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java b/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java index 37fde917836..145a24a3850 100644 --- a/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java +++ b/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java @@ -1,5 +1,5 @@ /* DragGestureRecognizer.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -130,7 +130,7 @@ public abstract class DragGestureRecognizer implements Serializable public void resetRecognizer() throws NotImplementedException { - throw new Error("not implemented"); + events = new ArrayList(); } /** @@ -154,10 +154,15 @@ public abstract class DragGestureRecognizer implements Serializable dragGestureListener = null; } + /** + * Fires a <code>DragGestureEvent</code> to the DragGestureListener + * associated with this object, if there is one. + */ protected void fireDragGestureRecognized(int dragAction, Point p) - throws NotImplementedException { - throw new Error("not implemented"); + if(dragGestureListener != null) + dragGestureListener.dragGestureRecognized + (new DragGestureEvent(this, dragAction, p, events)); } protected void appendEvent(InputEvent e) diff --git a/libjava/classpath/java/awt/font/GlyphMetrics.java b/libjava/classpath/java/awt/font/GlyphMetrics.java index 18aaedc7185..0a78d3052f6 100644 --- a/libjava/classpath/java/awt/font/GlyphMetrics.java +++ b/libjava/classpath/java/awt/font/GlyphMetrics.java @@ -38,8 +38,6 @@ exception statement from your version. */ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.geom.Rectangle2D; /** @@ -94,16 +92,18 @@ public final class GlyphMetrics return bounds; } - public float getLSB () - throws NotImplementedException + public float getLSB() { - throw new Error ("not implemented"); + if (horizontal) + return (float) bounds.getX(); + return (float) bounds.getY(); } - public float getRSB () - throws NotImplementedException + public float getRSB() { - throw new Error ("not implemented"); + if (horizontal) + return (float) (advanceX - (bounds.getX() + bounds.getWidth())); + return (float) (advanceY - (bounds.getY() + bounds.getHeight())); } public int getType () diff --git a/libjava/classpath/java/awt/font/GlyphVector.java b/libjava/classpath/java/awt/font/GlyphVector.java index 8d8a51d6877..f4cb01b9534 100644 --- a/libjava/classpath/java/awt/font/GlyphVector.java +++ b/libjava/classpath/java/awt/font/GlyphVector.java @@ -38,8 +38,6 @@ exception statement from your version. */ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.Font; import java.awt.Rectangle; import java.awt.Shape; @@ -48,6 +46,7 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; /** + * @author Lillian Angel (langel at redhat dot com) * @author Michael Koch */ public abstract class GlyphVector implements Cloneable @@ -72,16 +71,22 @@ public abstract class GlyphVector implements Cloneable public abstract FontRenderContext getFontRenderContext (); public int getGlyphCharIndex (int glyphIndex) - throws NotImplementedException { - throw new Error ("not implemented"); + return glyphIndex; } - public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries, - int[] codeReturn) - throws NotImplementedException + public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries, + int[] codeReturn) { - throw new Error ("not implemented"); + if (codeReturn == null) + codeReturn = new int[numEntries]; + + int i = 0; + int j = beginGlyphIndex; + while (j < numEntries) + codeReturn[i++] = getGlyphCharIndex(j++); + + return codeReturn; } public abstract int getGlyphCode (int glyphIndex); @@ -98,17 +103,27 @@ public abstract class GlyphVector implements Cloneable public abstract Shape getGlyphOutline (int glyphIndex); - public Shape getGlyphOutline (int glyphIndex, float x, float y) - throws NotImplementedException + public Shape getGlyphOutline(int glyphIndex, float x, float y) { - throw new Error ("not implemented"); + Shape s = getGlyphOutline(glyphIndex); + + // This is the only way to translate the origin of a shape + AffineTransform at = AffineTransform.getTranslateInstance(x, y); + return at.createTransformedShape(s); } - public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC, - float x, float y) - throws NotImplementedException + public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, + float x, float y) { - throw new Error ("not implemented"); + Rectangle bounds = new Rectangle(); + Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D(); + + bounds.x = (int) (rect.getX() + x); + bounds.y = (int) (rect.getY() + y); + bounds.width = (int) rect.getMaxX() - bounds.x; + bounds.height = (int) rect.getMaxY() - bounds.y; + + return bounds; } public abstract Point2D getGlyphPosition (int glyphIndex); @@ -121,10 +136,9 @@ public abstract class GlyphVector implements Cloneable public abstract Shape getGlyphVisualBounds (int glyphIndex); - public int getLayoutFlags () - throws NotImplementedException + public int getLayoutFlags() { - throw new Error ("not implemented"); + return 0; } public abstract Rectangle2D getLogicalBounds (); @@ -137,9 +151,16 @@ public abstract class GlyphVector implements Cloneable public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) - throws NotImplementedException { - throw new Error ("not implemented"); + Rectangle bounds = new Rectangle(); + Rectangle2D rect = getVisualBounds(); + + bounds.x = (int) (rect.getX() + x); + bounds.y = (int) (rect.getY() + y); + bounds.width = (int) rect.getMaxX() - bounds.x; + bounds.height = (int) rect.getMaxY() - bounds.y; + + return bounds; } public abstract Rectangle2D getVisualBounds (); diff --git a/libjava/classpath/java/awt/font/GraphicAttribute.java b/libjava/classpath/java/awt/font/GraphicAttribute.java index 107f16dcd18..19f781bcc29 100644 --- a/libjava/classpath/java/awt/font/GraphicAttribute.java +++ b/libjava/classpath/java/awt/font/GraphicAttribute.java @@ -38,51 +38,100 @@ exception statement from your version. */ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; /** + * This class represents a graphic embedded in text. + * * @author Michael Koch + * @author Lillian Angel (langel at redhat dot com) */ public abstract class GraphicAttribute { - public static final int BOTTOM_ALIGNMENT = -2; + public static final int BOTTOM_ALIGNMENT = - 2; public static final int CENTER_BASELINE = 1; public static final int HANGING_BASELINE = 2; public static final int ROMAN_BASELINE = 0; - public static final int TOP_ALIGNMENT = -1; + public static final int TOP_ALIGNMENT = - 1; private int alignment; - - protected GraphicAttribute (int alignment) + + /** + * Constructor. + * + * @param alignment - the alignment to use for the graphic + */ + protected GraphicAttribute(int alignment) { + if (alignment < BOTTOM_ALIGNMENT || alignment > HANGING_BASELINE) + throw new IllegalArgumentException("Invalid alignment"); this.alignment = alignment; } - public abstract void draw (Graphics2D graphics, float x, float y); - - public abstract float getAdvance (); - - public final int getAlignment () + /** + * Draws the graphic. + * + * @param graphics - the graphics configuration to use + * @param x - the x location + * @param y - the y location + */ + public abstract void draw(Graphics2D graphics, float x, float y); + + /** + * Gets the distance from the origin of its graphic to the right side of the + * bounds of its graphic. + * + * @return the advance + */ + public abstract float getAdvance(); + + /** + * Gets the positive distance from the origin of its graphic to the top of + * bounds. + * + * @return the ascent + */ + public abstract float getAscent(); + + /** + * Gets the distance from the origin of its graphic to the bottom of the bounds. + * + * @return the descent + */ + public abstract float getDescent(); + + /** + * Gets the alignment. + * + * @return the alignment + */ + public final int getAlignment() { return alignment; } - public abstract float getAscent (); - - public Rectangle2D getBounds () - throws NotImplementedException + /** + * Returns a Rectangle2D that encloses the rendered area. + * Default bounds is the rectangle (0, -ascent, advance, ascent+descent). + * + * @return the bounds of the rendered area + */ + public Rectangle2D getBounds() { - throw new Error ("not implemented"); + float asc = getAscent(); + return new Rectangle2D.Float(0, - asc, getAdvance(), asc + getDescent()); } - public abstract float getDescent (); - - public GlyphJustificationInfo getJustificationInfo () - throws NotImplementedException + /** + * Returns the justification information for this object. + * + * @return the justification information + */ + public GlyphJustificationInfo getJustificationInfo() { - throw new Error ("not implemented"); + float adv = getAdvance(); + return new GlyphJustificationInfo(adv, false, 2, adv / 3, adv / 3, false, + 1, 0, 0); } } diff --git a/libjava/classpath/java/awt/font/ImageGraphicAttribute.java b/libjava/classpath/java/awt/font/ImageGraphicAttribute.java index c050255ee97..3e4fdcf733f 100644 --- a/libjava/classpath/java/awt/font/ImageGraphicAttribute.java +++ b/libjava/classpath/java/awt/font/ImageGraphicAttribute.java @@ -38,82 +38,150 @@ exception statement from your version. */ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.Graphics2D; import java.awt.Image; import java.awt.geom.Rectangle2D; /** + * This is an implementation of GraphicAttribute which draws images in a + * TextLayout. + * + * @author Lillian Angel * @author Michael Koch */ -public final class ImageGraphicAttribute extends GraphicAttribute +public final class ImageGraphicAttribute + extends GraphicAttribute { private Image image; - - public ImageGraphicAttribute (Image image, int alignment) + private float originX; + private float originY; + + /** + * Constucts an instance from the specified Image. The origin is at (0, 0). + * + * @param image - image to construct from. + * @param alignment - the alignment + */ + public ImageGraphicAttribute(Image image, int alignment) { - super (alignment); - this.image = image; + this(image, alignment, 0, 0); } - public ImageGraphicAttribute (Image image, int alignment, float originX, - float originY) - throws NotImplementedException + /** + * Constucts an instance from the specified Image. The origin is at (originX, + * originY). + * + * @param image - image to construct from + * @param alignment - the alignment + * @param originX - x point of origin + * @param originY - y point of origin + */ + public ImageGraphicAttribute(Image image, int alignment, float originX, + float originY) { - super (alignment); + super(alignment); this.image = image; - - throw new Error ("not implemented"); + this.originX = originX; + this.originY = originY; } - public void draw (Graphics2D graphics, float x, float y) - throws NotImplementedException + /** + * Draws the image at the specified location, relative to the + * origin. + * + * @param g - the graphics to use to render the image + * @param x - the x location + * @param y - the y location + */ + public void draw(Graphics2D g, float x, float y) { - throw new Error ("not implemented"); + g.drawImage(image, (int) (x - originX), (int) (y - originY), null); } - public boolean equals (Object obj) + /** + * Compares this to the specified Object + * + * @param obj - the object to compare + * @return true if the obj and this are equivalent + */ + public boolean equals(Object obj) { if (! (obj instanceof ImageGraphicAttribute)) return false; - return equals ((ImageGraphicAttribute) obj); + return equals((ImageGraphicAttribute) obj); } - public boolean equals (ImageGraphicAttribute rhs) - throws NotImplementedException + /** + * Compares this to the ImageGraphicAttribute given, by + * comparing all fields and values. + * + * @param rhs - the ImageGraphicAttribute to compare + * @return true if the object given is equivalent to this + */ + public boolean equals(ImageGraphicAttribute rhs) { - throw new Error ("not implemented"); + return ((this == rhs) || ((this.getAscent() == rhs.getAscent()) + && (this.getAdvance() == rhs.getAdvance()) + && (this.getAlignment() == rhs.getAlignment()) + && (this.getBounds().equals(rhs.getBounds())) + && (this.getDescent() == rhs.getDescent()) + && (this.hashCode() == rhs.hashCode()) + && (this.image.equals(rhs.image)) + && (this.originX == rhs.originX) + && (this.originY == rhs.originY))); } - public float getAdvance () - throws NotImplementedException + /** + * Returns distance from the origin to the right edge of the image of this. + * + * @return the advance + */ + public float getAdvance() { - throw new Error ("not implemented"); + return Math.max(0, image.getWidth(null) - originX); } - public float getAscent () - throws NotImplementedException + /** + * Returns the the distance from the top of the image to the origin of this. + * + * @return the ascent. + */ + public float getAscent() { - throw new Error ("not implemented"); + return Math.max(0, originY); } - public Rectangle2D getBounds () - throws NotImplementedException + /** + * Gets the bounds of the object rendered, relative to the position. + * + * @return the bounds of the object rendered, relative to the position. + */ + public Rectangle2D getBounds() { - throw new Error ("not implemented"); + // This is equivalent to what Sun's JDK returns. + // I am not entirely sure why the origin is negative. + return new Rectangle2D.Float(- originX, - originY, image.getWidth(null), + image.getHeight(null)); } - public float getDescent () - throws NotImplementedException + /** + * Returns the distance from the origin to the bottom of the image. + * + * @return the descent + */ + public float getDescent() { - throw new Error ("not implemented"); + return Math.max(0, image.getHeight(null) - originY); } - public int hashCode () - throws NotImplementedException + /** + * Gets the hash code for this image. + * + * @return the hash code + */ + public int hashCode() { - throw new Error ("not implemented"); + return image.hashCode(); } } diff --git a/libjava/classpath/java/awt/font/ShapeGraphicAttribute.java b/libjava/classpath/java/awt/font/ShapeGraphicAttribute.java index d5320854c38..06814972b06 100644 --- a/libjava/classpath/java/awt/font/ShapeGraphicAttribute.java +++ b/libjava/classpath/java/awt/font/ShapeGraphicAttribute.java @@ -38,74 +38,148 @@ exception statement from your version. */ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Rectangle2D; +/** + * This is an implementation of GraphicAttribute that draws shapes in a TextLayout. + * + * @author Lillian Angel (langel at redhat dot com) + */ public final class ShapeGraphicAttribute extends GraphicAttribute { + /** True if the shape should be filled. */ public static final boolean FILL = false; + + /** True if the shape should be stroked with a 1-pixel wide stroke. */ public static final boolean STROKE = true; private Shape shape; private boolean stroke; + private Rectangle2D bounds; - public ShapeGraphicAttribute (Shape shape, int alignment, boolean stroke) + /** + * Constructor. + * + * @param shape - the Shape to render. The Shape is rendered with its origin. + * @param alignment - the alignment + * @param stroke - true if the Shape should be stroked; false if the Shape + * should be filled. + */ + public ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke) { - super (alignment); + super(alignment); this.shape = shape; this.stroke = stroke; + this.bounds = shape.getBounds2D(); } - public void draw (Graphics2D graphics, float x, float y) - throws NotImplementedException + /** + * Draws the graphic at the given location. + * + * @param graphics - the graphics to use. + * @param x - the x location to draw at. + * @param y - the y location to draw at. + */ + public void draw(Graphics2D graphics, float x, float y) { - throw new Error ("not implemented"); + graphics.translate(x, y); + if (stroke == STROKE) + graphics.draw(shape); + else + graphics.fill(shape); + graphics.translate(- x, - y); } - public boolean equals (Object obj) + /** + * Compares this ShapeGraphicAttribute to obj. + * + * @param obj - the object to compare. + */ + public boolean equals(Object obj) { if (! (obj instanceof ShapeGraphicAttribute)) return false; - return equals ((ShapeGraphicAttribute) obj); + return equals((ShapeGraphicAttribute) obj); } - public boolean equals (ShapeGraphicAttribute rhs) + /** + * Compares this ShapeGraphicAttribute to rhs. + * + * @param rhs - the ShapeGraphicAttribute to compare. + */ + public boolean equals(ShapeGraphicAttribute rhs) { - return (shape.equals (rhs.shape) - && getAlignment () == rhs.getAlignment () - && stroke == rhs.stroke); + return (this == rhs || (this.shape.equals(rhs.shape) + && getAlignment() == rhs.getAlignment() + && stroke == rhs.stroke + && getAdvance() == rhs.getAdvance() + && getAscent() == rhs.getAscent() + && getBounds().equals(rhs.getBounds()) + && getDescent() == rhs.getDescent() + && hashCode() == rhs.hashCode())); } - public float getAdvance () - throws NotImplementedException + /** + * Gets the distance from the origin of its Shape to the right side of the + * bounds of its Shape. + * + * @return the advance + */ + public float getAdvance() { - throw new Error ("not implemented"); + return Math.max(0, (float) bounds.getMaxX()); } - public float getAscent () - throws NotImplementedException + /** + * Gets the positive distance from the origin of its Shape to the top of + * bounds. + * + * @return the ascent + */ + public float getAscent() { - throw new Error ("not implemented"); + return Math.max(0, -(float) bounds.getMinY()); } - public Rectangle2D getBounds () + /** + * Gets the distance from the origin of its Shape to the bottom of the bounds. + * + * @return the descent + */ + public float getDescent() { - return shape.getBounds2D (); + return Math.max(0, (float) bounds.getMaxY()); } - public float getDescent () - throws NotImplementedException + /** + * Returns a Rectangle2D that encloses all of the bits drawn by this shape. + * + * @return the bounds of the shape. + */ + public Rectangle2D getBounds() { - throw new Error ("not implemented"); + Rectangle2D.Float bounds = new Rectangle2D.Float(); + bounds.setRect(this.bounds); + + if (stroke == STROKE) + { + bounds.width++; + bounds.height++; + } + + return bounds; } - public int hashCode () + /** + * Gets the hash code. + * + * @return the hash code. + */ + public int hashCode() { - // FIXME: Check what SUN does here - return shape.hashCode (); + return shape.hashCode(); } } diff --git a/libjava/classpath/java/awt/im/InputContext.java b/libjava/classpath/java/awt/im/InputContext.java index 0bb107e36d1..3806736df3d 100644 --- a/libjava/classpath/java/awt/im/InputContext.java +++ b/libjava/classpath/java/awt/im/InputContext.java @@ -103,8 +103,8 @@ public class InputContext while (e.hasMoreElements()) { URL url = (URL) e.nextElement(); - BufferedReader in = null; - String line = null; + BufferedReader in; + String line; try { in = new BufferedReader diff --git a/libjava/classpath/java/awt/image/BufferedImage.java b/libjava/classpath/java/awt/image/BufferedImage.java index 3cabfbde692..16b0143850c 100644 --- a/libjava/classpath/java/awt/image/BufferedImage.java +++ b/libjava/classpath/java/awt/image/BufferedImage.java @@ -80,7 +80,7 @@ public class BufferedImage extends Image TYPE_BYTE_INDEXED = 13; static final int[] bits3 = { 8, 8, 8 }; - static final int[] bits4 = { 8, 8, 8 }; + static final int[] bits4 = { 8, 8, 8, 8 }; static final int[] bits1byte = { 8 }; static final int[] bits1ushort = { 16 }; diff --git a/libjava/classpath/java/awt/image/ColorModel.java b/libjava/classpath/java/awt/image/ColorModel.java index 40307f2b95d..e2f5378b4da 100644 --- a/libjava/classpath/java/awt/image/ColorModel.java +++ b/libjava/classpath/java/awt/image/ColorModel.java @@ -92,7 +92,12 @@ public abstract class ColorModel implements Transparency int transparency; boolean hasAlpha; boolean isAlphaPremultiplied; - + + /** + * The standard color model for the common sRGB. + */ + private static final ColorModel S_RGB_MODEL = new SRGBColorModel(); + static int[] nArray(int value, int times) { int[] array = new int[times]; @@ -196,7 +201,7 @@ public abstract class ColorModel implements Transparency */ public static ColorModel getRGBdefault() { - return new DirectColorModel(32, 0xff0000, 0xff00, 0xff, 0xff000000); + return S_RGB_MODEL; } public final boolean hasAlpha() @@ -761,4 +766,56 @@ public abstract class ColorModel implements Transparency { return getClass().getName() + "[" + stringParam() + "]"; } + + /** + * A color model optimized for standard sRGB. + */ + private static class SRGBColorModel + extends DirectColorModel + { + + SRGBColorModel() + { + super(32,0x00FF0000,0x0000FF00,0x000000FF,0xFF000000); + } + + public int getAlpha(Object inData) + { + return ((((int[]) inData)[0]) >> 24) & 0xFF; + } + + public int getBlue(Object inData) + { + return ((((int[]) inData)[0])) & 0xFF; + } + + public int getGreen(Object inData) + { + return ((((int[]) inData)[0]) >> 8) & 0xFF; + } + + public int getRed(Object inData) + { + return ((((int[]) inData)[0]) >> 16) & 0xFF; + } + + public int getRGB(Object inData) + { + return ((int[]) inData)[0]; + } + + public Object getDataElements(int rgb, Object pixel) + { + if(pixel == null) + { + pixel = new int[]{rgb}; + } + else + { + ((int[]) pixel)[0] = rgb; + } + + return pixel; + } + } } diff --git a/libjava/classpath/java/awt/print/PrinterJob.java b/libjava/classpath/java/awt/print/PrinterJob.java index 7f67a6b048b..8afada1675e 100644 --- a/libjava/classpath/java/awt/print/PrinterJob.java +++ b/libjava/classpath/java/awt/print/PrinterJob.java @@ -38,9 +38,13 @@ exception statement from your version. */ package java.awt.print; -import java.awt.HeadlessException; +import gnu.java.awt.print.JavaPrinterJob; +import java.awt.HeadlessException; import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.DocFlavor; +import javax.print.StreamPrintServiceFactory; import javax.print.attribute.PrintRequestAttributeSet; /** @@ -60,8 +64,7 @@ public abstract class PrinterJob */ public static PrinterJob getPrinterJob() { - // FIXME: Need to fix this to load a default implementation instance. - return new NoPrinterJob(); + return new JavaPrinterJob(); } /** @@ -244,13 +247,11 @@ public abstract class PrinterJob */ public static PrintService[] lookupPrintServices() { - return new PrintService[0]; - // FIXME: - // Enable this when javax.print has this implemented. -// return PrintServiceLookup.lookupPrintServices( -// new DocFlavor("application/x-java-jvm-local-objectref", -// "java.awt.print.Pageable"), -// null); + return PrintServiceLookup.lookupPrintServices + ( + new DocFlavor("application/x-java-jvm-local-objectref", + "java.awt.print.Pageable"), + null); } /** @@ -263,8 +264,8 @@ public abstract class PrinterJob * @return Array of stream print services, could be empty. * @since 1.4 */ - // FIXME: - // Enable when javax.print has StreamPrintServiceFactory + // FIXME: + // Enable when StreamPrintServiceFactory has lookupStreamServiceFactories // public static StreamPrintServiceFactory[] lookupStreamPrintServices(String mimeType) // { // return StreamPrintServiceFactory.lookupStreamServiceFactories( @@ -282,7 +283,7 @@ public abstract class PrinterJob */ public PrintService getPrintService() { - return null; + return printer; } /** @@ -297,6 +298,6 @@ public abstract class PrinterJob public void setPrintService(PrintService service) throws PrinterException { - throw new PrinterException(); + printer = service; } } diff --git a/libjava/classpath/java/text/NumberFormat.java b/libjava/classpath/java/text/NumberFormat.java index 5fede9ee37a..a42e9b3d9c8 100644 --- a/libjava/classpath/java/text/NumberFormat.java +++ b/libjava/classpath/java/text/NumberFormat.java @@ -481,7 +481,7 @@ public abstract class NumberFormat extends Format implements Cloneable */ public static NumberFormat getIntegerInstance(Locale locale) { - NumberFormat format = computeInstance (locale, "numberFormat", "#,##0"); + NumberFormat format = computeInstance (locale, "integerFormat", "#,##0"); format.setMaximumFractionDigits(0); format.setParseIntegerOnly (true); return format; diff --git a/libjava/classpath/java/text/SimpleDateFormat.java b/libjava/classpath/java/text/SimpleDateFormat.java index 00c08507e81..2825c7bed24 100644 --- a/libjava/classpath/java/text/SimpleDateFormat.java +++ b/libjava/classpath/java/text/SimpleDateFormat.java @@ -307,7 +307,7 @@ public class SimpleDateFormat extends DateFormat // Not a valid letter throw new IllegalArgumentException("Invalid letter " + thisChar + - "encountered at character " + " encountered at character " + i + "."); } else if (thisChar == '\'') diff --git a/libjava/classpath/java/text/class-dependencies.conf b/libjava/classpath/java/text/class-dependencies.conf new file mode 100644 index 00000000000..011b146ce10 --- /dev/null +++ b/libjava/classpath/java/text/class-dependencies.conf @@ -0,0 +1,220 @@ +# This property file contains dependencies of classes, methods, and +# field on other methods or classes. +# +# Syntax: +# +# <used>: <needed 1> [... <needed N>] +# +# means that when <used> is included, <needed 1> (... <needed N>) must +# be included as well. +# +# <needed X> and <used> are of the form +# +# <class.methodOrField(signature)> +# +# or just +# +# <class> +# +# Within dependencies, variables can be used. A variable is defined as +# follows: +# +# {variable}: value1 value2 ... value<n> +# +# variables can be used on the right side of dependencies as follows: +# +# <used>: com.bla.blu.{variable}.Class.m()V +# +# The use of the variable will expand to <n> dependencies of the form +# +# <used>: com.bla.blu.value1.Class.m()V +# <used>: com.bla.blu.value2.Class.m()V +# ... +# <used>: com.bla.blu.value<n>.Class.m()V +# +# Variables can be redefined when building a system to select the +# required support for features like encodings, protocols, etc. +# +# Hints: +# +# - For methods and fields, the signature is mandatory. For +# specification, please see the Java Virtual Machine Specification by +# SUN. Unlike in the spec, field signatures (types) are in brackets. +# +# - Package names must be separated by '/' (and not '.'). E.g., +# java/lang/Class (this is necessary, because the '.' is used to +# separate method or field names from classes) +# +# - In case <needed> refers to a class, only the class itself will be +# included in the resulting binary, NOT necessarily all its methods +# and fields. If you want to refer to all methods and fields, you can +# write class.* as an abbreviation. +# +# - Abbreviations for packages are also possible: my/package/* means all +# methods and fields of all classes in my/package. +# +# - A line with a trailing '\' continues in the next line. + +# end of file + +# All locales supported are loaded via classes from java.text (see below) +# from class gnu/java/locale/LocaleInformation_<locale_id> +# +# This introduces a dependency for all locales. To allow an easy selection +# and addition of locales, the library variable {text_locales} can be set to +# the set of supported locales. +# + +{text_locales}: \ + af_ZA \ + ar_AE \ + ar_BH \ + ar_DZ \ + ar_EG \ + ar_IN \ + ar_IQ \ + ar_JO \ + ar_KW \ + ar_LB \ + ar_LY \ + ar_MA \ + ar_OM \ + ar_QA \ + ar_SD \ + ar_SY \ + ar_TN \ + ar_YE \ + be_BY \ + bn_IN \ + br_FR \ + bs_BA \ + ca_ES \ + cs_CZ \ + cy_GB \ + da_DK \ + de \ + de_AT \ + de_BE \ + de_CH \ + de_DE \ + de_LU \ + el_GR \ + en \ + en_AU \ + en_BW \ + en_CA \ + en_DK \ + en_GB \ + en_HK \ + en_IE \ + en_IN \ + en_NZ \ + en_PH \ + en_SG \ + en_US \ + en_ZA \ + en_ZW \ + es_AR \ + es_BO \ + es_CL \ + es_CO \ + es_CR \ + es_DO \ + es_EC \ + es_ES \ + es_GT \ + es_HN \ + es_MX \ + es_NI \ + es_PA \ + es_PE \ + es_PR \ + es_PY \ + es_SV \ + es_US \ + es_UY \ + es_VE \ + et_EE \ + eu_ES \ + fa_IR \ + fi_FI \ + fo_FO \ + fr_BE \ + fr_CA \ + fr_CH \ + fr_FR \ + fr_LU \ + ga_IE \ + gd_GB \ + gl_ES \ + gv_GB \ + he_IL \ + hi_IN \ + hr_HR \ + hu_HU \ + id_ID \ + it_CH \ + it_IT \ + iw_IL \ + ja_JP \ + ka_GE \ + kl_GL \ + ko_KR \ + kw_GB \ + lt_LT \ + lv_LV \ + mi_NZ \ + mk_MK \ + mr_IN \ + mt_MT \ + nl \ + nl_BE \ + nl_NL \ + nn_NO \ + no_NO \ + oc_FR \ + pl_PL \ + pt_BR \ + pt_PT \ + ro_RO \ + ru_RU \ + ru_UA \ + se_NO \ + sk_SK \ + sl_SI \ + sq_AL \ + sr_YU \ + sv_FI \ + sv_SE \ + ta_IN \ + te_IN \ + tg_TJ \ + tl_PH \ + tr_TR \ + uk_UA \ + ur_PK \ + uz_UZ \ + vi_VN \ + yi_US \ + zh_CN \ + zh_HK \ + zh_SG \ + zh_TW + +java/text/Collator.getInstance(Ljava/util/Locale;)Ljava/text/Collator;: \ + gnu/java/locale/LocaleInformation_{text_locales}.* + +java/text/DateFormatSymbols.<init>(Ljava/util/Locale;)V: \ + gnu/java/locale/LocaleInformation_{text_locales}.* + +java/text/DecimalFormatSymbols.<init>(Ljava/util/Locale;)V: \ + gnu/java/locale/LocaleInformation_{text_locales}.* + +java/text/BreakIterator.getInstance(Ljava/lang/String;Ljava/util/Locale;)Ljava/text/BreakIterator;: \ + gnu/java/locale/LocaleInformation_{text_locales}.* + +java/text/NumberFormat.computeInstance(Ljava/util/Locale;Ljava/lang/String;Ljava/lang/String;)Ljava/text/NumberFormat;: \ + gnu/java/locale/LocaleInformation_{text_locales}.* + +java/text/DateFormat.computeInstance(IILjava/util/Locale;ZZ)Ljava/text/DateFormat;: \ + gnu/java/locale/LocaleInformation_{text_locales}.* |