summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing')
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java171
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiButtonUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiColorChooserUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiComboBoxUI.java427
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiDesktopIconUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiDesktopPaneUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiFileChooserUI.java505
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiInternalFrameUI.java353
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiLabelUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiListUI.java446
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java241
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiMenuBarUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiMenuItemUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiOptionPaneUI.java396
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiPanelUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiPopupMenuUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiProgressBarUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiRootPaneUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiScrollBarUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiScrollPaneUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiSeparatorUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiSliderUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiSpinnerUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiSplitPaneUI.java488
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiTabbedPaneUI.java444
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiTableHeaderUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiTableUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiTextUI.java617
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiToolBarUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiToolTipUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiTreeUI.java628
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiViewportUI.java352
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/package.html46
-rw-r--r--libjava/classpath/javax/swing/text/AbstractWriter.java480
-rw-r--r--libjava/classpath/javax/swing/text/BoxView.java714
-rw-r--r--libjava/classpath/javax/swing/text/CompositeView.java652
-rw-r--r--libjava/classpath/javax/swing/text/ElementIterator.java181
-rw-r--r--libjava/classpath/javax/swing/text/FlowView.java617
-rw-r--r--libjava/classpath/javax/swing/text/GlyphView.java521
-rw-r--r--libjava/classpath/javax/swing/text/IconView.java128
-rw-r--r--libjava/classpath/javax/swing/text/LabelView.java54
-rw-r--r--libjava/classpath/javax/swing/text/LayoutQueue.java115
-rw-r--r--libjava/classpath/javax/swing/text/ParagraphView.java89
43 files changed, 15705 insertions, 0 deletions
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
new file mode 100644
index 00000000000..20526eba8cd
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
@@ -0,0 +1,171 @@
+/* MetalInternalFrameTitlePane.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.LayoutManager;
+
+import javax.swing.Icon;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
+
+/**
+ * The title pane for a {@link JInternalFrame}.
+ */
+public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
+{
+
+ protected boolean isPalette;
+
+ protected Icon paletteCloseIcon = MetalIconFactory.getInternalFrameCloseIcon(16);
+
+ protected int paletteTitleHeight = 12;
+
+ /**
+ * Creates a new title pane.
+ *
+ * @param f the internal frame.
+ */
+ public MetalInternalFrameTitlePane(JInternalFrame f)
+ {
+ super(f);
+ isPalette = false;
+ }
+
+ /**
+ * Fetches the colors used in the title pane.
+ */
+ protected void installDefaults()
+ {
+ super.installDefaults();
+ selectedTextColor = MetalLookAndFeel.getControlTextColor();
+ selectedTitleColor = MetalLookAndFeel.getWindowTitleBackground();
+ notSelectedTextColor = MetalLookAndFeel.getInactiveControlTextColor();
+ notSelectedTitleColor = MetalLookAndFeel.getWindowTitleInactiveBackground();
+ }
+
+ /**
+ * Clears the colors used for the title pane.
+ */
+ protected void uninstallDefaults()
+ {
+ super.uninstallDefaults();
+ selectedTextColor = null;
+ selectedTitleColor = null;
+ notSelectedTextColor = null;
+ notSelectedTitleColor = null;
+ }
+
+ /**
+ * Calls the super class to create the buttons, then calls
+ * <code>setBorderPainted(false)</code> and
+ * <code>setContentAreaFilled(false)</code> for each button.
+ */
+ protected void createButtons()
+ {
+ super.createButtons();
+ closeButton.setBorderPainted(false);
+ closeButton.setContentAreaFilled(false);
+ iconButton.setBorderPainted(false);
+ iconButton.setContentAreaFilled(false);
+ maxButton.setBorderPainted(false);
+ maxButton.setContentAreaFilled(false);
+ }
+
+ /**
+ * Overridden to do nothing.
+ */
+ protected void addSystemMenuItems(JMenu systemMenu)
+ {
+ // do nothing
+ }
+
+ /**
+ * Overridden to do nothing.
+ */
+ protected void showSystemMenu()
+ {
+ // do nothing
+ }
+
+ /**
+ * Creates a layout manager for the components in the title pane.
+ *
+ * @return A layout manager.
+ */
+ protected LayoutManager createLayout()
+ {
+ return new TitlePaneLayout()
+ {
+ public Dimension preferredLayoutSize(Container c)
+ {
+ return new Dimension(24, 24);
+ }
+ };
+ }
+
+ public void paintPalette(Graphics g)
+ {
+ // FIXME: needs implementing
+ // most likely this is equivalent to paintComponent(g) when the isPalette
+ // flag is true
+ }
+
+ public void paintComponent(Graphics g)
+ {
+ // probably need to check the isPalette flag here, if true pass over to
+ // paintPalette(Graphics)
+ super.paintComponent(g);
+ Dimension d = getSize();
+ if (frame.isSelected())
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+ }
+
+ public void setPalette(boolean b)
+ {
+ isPalette = b;
+ }
+}
+
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiButtonUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiButtonUI.java
new file mode 100644
index 00000000000..ac2a5fa918a
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiButtonUI.java
@@ -0,0 +1,352 @@
+/* MultiButtonUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ButtonUI;
+import javax.swing.plaf.ComponentUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ButtonUI} instances, one
+ * from the primary look and feel, and one or more from the auxiliary look and
+ * feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiButtonUI extends ButtonUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiButtonUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiButtonUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiButtonUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiButtonUI mui = new MultiButtonUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiButtonUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiButtonUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiButtonUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiButtonUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiButtonUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiColorChooserUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiColorChooserUI.java
new file mode 100644
index 00000000000..8adb9500bb0
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiColorChooserUI.java
@@ -0,0 +1,352 @@
+/* MultiColorChooserUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ColorChooserUI;
+import javax.swing.plaf.ComponentUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ColorChooserUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiColorChooserUI extends ColorChooserUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiColorChooserUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiColorChooserUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiColorChooserUI</code>
+ * is returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiColorChooserUI mui = new MultiColorChooserUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiColorChooserUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiColorChooserUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiColorChooserUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiColorChooserUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiColorChooserUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiComboBoxUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiComboBoxUI.java
new file mode 100644
index 00000000000..05279d7d654
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiComboBoxUI.java
@@ -0,0 +1,427 @@
+/* MultiComboBoxUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComboBoxUI;
+import javax.swing.plaf.ComponentUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ComboBoxUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiComboBoxUI extends ComboBoxUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiComboBoxUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiComboBoxUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiComboBoxUI</code>
+ * is returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiComboBoxUI mui = new MultiComboBoxUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiComboBoxUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiComboBoxUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComboBoxUI#setPopupVisible(JComboBox, boolean)} method
+ * for all the UI delegates managed by this <code>MultiComboBoxUI</code>.
+ *
+ * @param c the component.
+ * @param visible the visible state.
+ */
+ public void setPopupVisible(JComboBox c, boolean visible) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComboBoxUI ui = (ComboBoxUI) iterator.next();
+ ui.setPopupVisible(c, visible);
+ }
+ }
+
+ /**
+ * Calls the {@link ComboBoxUI#isPopupVisible(JComboBox)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The result for the UI delegate from the primary look and feel.
+ */
+ public boolean isPopupVisible(JComboBox c) {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComboBoxUI ui = (ComboBoxUI) iterator.next();
+ result = ui.isPopupVisible(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComboBoxUI ui = (ComboBoxUI) iterator.next();
+ /* boolean ignored = */ ui.isPopupVisible(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComboBoxUI#isFocusTraversable(JComboBox)} method for all
+ * the UI delegates managed by this <code>MultiComboBoxUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return <code>true</code> if the combo box is traversable according to the
+ * UI delegate in the primary look and feel, and <code>false</code>
+ * otherwise.
+ */
+ public boolean isFocusTraversable(JComboBox c) {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComboBoxUI ui = (ComboBoxUI) iterator.next();
+ result = ui.isFocusTraversable(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComboBoxUI ui = (ComboBoxUI) iterator.next();
+ /* boolean ignored = */ ui.isFocusTraversable(c);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiDesktopIconUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiDesktopIconUI.java
new file mode 100644
index 00000000000..186ce32fe24
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiDesktopIconUI.java
@@ -0,0 +1,352 @@
+/* MultiDesktopIconUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.DesktopIconUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link DesktopIconUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiDesktopIconUI extends DesktopIconUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiDesktopIconUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiDesktopIconUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiDesktopIconUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiDesktopIconUI mui = new MultiDesktopIconUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiDesktopIconUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiDesktopIconUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopIconUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiDesktopIconUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiDesktopIconUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiDesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiDesktopPaneUI.java
new file mode 100644
index 00000000000..d48fb2b0185
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiDesktopPaneUI.java
@@ -0,0 +1,352 @@
+/* MultiDesktopIconUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.DesktopPaneUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link DesktopPaneUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiDesktopPaneUI extends DesktopPaneUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiDesktopPaneUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiDesktopPaneUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiDesktopPaneUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiDesktopPaneUI mui = new MultiDesktopPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiDesktopPaneUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiDesktopPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiDesktopPaneUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiDesktopPaneUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiDesktopPaneUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiFileChooserUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiFileChooserUI.java
new file mode 100644
index 00000000000..6f88260101c
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiFileChooserUI.java
@@ -0,0 +1,505 @@
+/* MultiFileChooserUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.io.File;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileView;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.FileChooserUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link FileChooserUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiFileChooserUI extends FileChooserUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiFileChooserUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiFileChooserUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiFileChooserUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiFileChooserUI mui = new MultiFileChooserUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiFileChooserUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiFileChooserUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link FileChooserUI#getAcceptAllFileFilter(JFileChooser)} method
+ * for all the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the filter for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param chooser the file chooser.
+ *
+ * @return The filter returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public FileFilter getAcceptAllFileFilter(JFileChooser chooser) {
+ FileFilter result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ result = ui.getAcceptAllFileFilter(chooser);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ /* FileFilter ignored = */ ui.getAcceptAllFileFilter(chooser);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link FileChooserUI#getFileView(JFileChooser)} method
+ * for all the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the view for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param chooser the file chooser.
+ *
+ * @return The view returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public FileView getFileView(JFileChooser chooser) {
+ FileView result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ result = ui.getFileView(chooser);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ /* FileView ignored = */ ui.getFileView(chooser);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link FileChooserUI#getApproveButtonText(JFileChooser)} method
+ * for all the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the text for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param chooser the file chooser.
+ *
+ * @return The text returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public String getApproveButtonText(JFileChooser chooser) {
+ String result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ result = ui.getApproveButtonText(chooser);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ /* String ignored = */ ui.getApproveButtonText(chooser);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link FileChooserUI#getDialogTitle(JFileChooser)} method
+ * for all the UI delegates managed by this <code>MultiFileChooserUI</code>,
+ * returning the title for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param chooser the file chooser.
+ *
+ * @return The title returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public String getDialogTitle(JFileChooser chooser) {
+ String result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ result = ui.getDialogTitle(chooser);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ /* String ignored = */ ui.getDialogTitle(chooser);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link FileChooserUI#rescanCurrentDirectory(JFileChooser)}
+ * method for all the UI delegates managed by this
+ * <code>MultiFileChooserUI</code>.
+ *
+ * @param chooser the file chooser.
+ */
+ public void rescanCurrentDirectory(JFileChooser chooser) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ ui.rescanCurrentDirectory(chooser);
+ }
+ }
+
+ /**
+ * Calls the {@link FileChooserUI#ensureFileIsVisible(JFileChooser, File)}
+ * method for all the UI delegates managed by this
+ * <code>MultiFileChooserUI</code>.
+ *
+ * @param chooser the file chooser.
+ * @param file the file.
+ */
+ public void ensureFileIsVisible(JFileChooser chooser, File file) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ FileChooserUI ui = (FileChooserUI) iterator.next();
+ ui.ensureFileIsVisible(chooser, file);
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiInternalFrameUI.java
new file mode 100644
index 00000000000..01d1df6a124
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiInternalFrameUI.java
@@ -0,0 +1,353 @@
+/* MultiInternalFrameUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.InternalFrameUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link InternalFrameUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiInternalFrameUI extends InternalFrameUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiInternalFrameUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiInternalFrameUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiInternalFrameUI</code>
+ * is returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiInternalFrameUI mui = new MultiInternalFrameUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiInternalFrameUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiInternalFrameUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiInternalFrameUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiInternalFrameUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiInternalFrameUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiLabelUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiLabelUI.java
new file mode 100644
index 00000000000..ba5b9d47380
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiLabelUI.java
@@ -0,0 +1,352 @@
+/* MultiLabelUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.LabelUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link LabelUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiLabelUI extends LabelUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiLabelUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiLabelUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiLabelUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiLabelUI mui = new MultiLabelUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiLabelUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiLabelUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiLabelUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiLabelUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiLabelUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiListUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiListUI.java
new file mode 100644
index 00000000000..7350b454115
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiListUI.java
@@ -0,0 +1,446 @@
+/* MultiListUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ListUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ListUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiListUI extends ListUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiListUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiListUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiListUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiListUI mui = new MultiListUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiListUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiListUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ListUI#locationToIndex(JList, Point)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the index for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param list the list.
+ * @param location the location.
+ *
+ * @return The index returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int locationToIndex(JList list, Point location) {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ListUI ui = (ListUI) iterator.next();
+ result = ui.locationToIndex(list, location);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ListUI ui = (ListUI) iterator.next();
+ /* int ignored = */ ui.locationToIndex(list, location);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ListUI#indexToLocation(JList, int)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the location for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param list the list.
+ * @param index the index.
+ *
+ * @return The location returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Point indexToLocation(JList list, int index) {
+ Point result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ListUI ui = (ListUI) iterator.next();
+ result = ui.indexToLocation(list, index);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ListUI ui = (ListUI) iterator.next();
+ /* Point ignored = */ ui.indexToLocation(list, index);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ListUI#getCellBounds(JList, int, int)} method for all
+ * the UI delegates managed by this <code>MultiListUI</code>,
+ * returning the bounds for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param list the list.
+ * @param index1 the first index.
+ * @param index2 the second index.
+ *
+ * @return The bounds returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Rectangle getCellBounds(JList list, int index1, int index2) {
+ Rectangle result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ListUI ui = (ListUI) iterator.next();
+ result = ui.getCellBounds(list, index1, index2);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ListUI ui = (ListUI) iterator.next();
+ /* Rectangle ignored = */ ui.getCellBounds(list, index1, index2);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java b/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
new file mode 100644
index 00000000000..a70a8ff690e
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
@@ -0,0 +1,241 @@
+/* MultiLookAndFeel.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.util.Vector;
+
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+
+/**
+ * A look and feel that provides the ability to use auxiliary look and feels
+ * in addition to the primary look and feel.
+ */
+public class MultiLookAndFeel extends LookAndFeel {
+
+ /**
+ * Creates a new instance of the look and feel.
+ */
+ public MultiLookAndFeel()
+ {
+ }
+
+ /**
+ * Returns the name for the look and feel.
+ *
+ * @return "Multiplexing Look and Feel".
+ */
+ public String getName()
+ {
+ return "Multiplexing Look and Feel";
+ }
+
+ /**
+ * Returns an identifier for the look and feel.
+ *
+ * @return "Multiplex".
+ */
+ public String getID()
+ {
+ return "Multiplex";
+ }
+
+ /**
+ * Returns a description of the look and feel.
+ *
+ * @return A description of the look and feel.
+ */
+ public String getDescription()
+ {
+ return "Allows multiple UI instances per component instance";
+ }
+
+ /**
+ * Returns <code>false</code> to indicate that this look and feel is not
+ * native to any platform.
+ *
+ * @return <code>false</code>.
+ */
+ public boolean isNativeLookAndFeel()
+ {
+ return false;
+ }
+
+ /**
+ * Returns <code>true</code> always, since this look and feel is supported on
+ * all platforms.
+ *
+ * @return <code>true</code>.
+ */
+ public boolean isSupportedLookAndFeel()
+ {
+ return true;
+ }
+
+ /**
+ * Creates and returns the UI defaults for this look and feel.
+ *
+ * @return The UI defaults.
+ */
+ public UIDefaults getDefaults()
+ {
+ UIDefaults defaults = new UIDefaults();
+ defaults.put("ButtonUI", "javax.swing.plaf.multi.MultiButtonUI");
+ defaults.put("CheckBoxUI", "javax.swing.plaf.multi.MultiButtonUI");
+ defaults.put("CheckBoxMenuItemUI", "javax.swing.plaf.multi.MultiMenuItemUI");
+ defaults.put("ColorChooserUI",
+ "javax.swing.plaf.multi.MultiColorChooserUI");
+ defaults.put("ComboBoxUI", "javax.swing.plaf.multi.MultiComboBoxUI");
+ defaults.put("DesktopPaneUI", "javax.swing.plaf.multi.MultiDesktopPaneUI");
+ defaults.put("DesktopIconUI", "javax.swing.plaf.multi.MultiDesktopIconUI");
+ defaults.put("EditorPaneUI", "javax.swing.plaf.multi.MultiTextUI");
+ defaults.put("FileChooserUI", "javax.swing.plaf.multi.MultiFileChooserUI");
+ defaults.put("FormattedTextFieldUI", "javax.swing.plaf.multi.MultiTextUI");
+ defaults.put("InternalFrameUI",
+ "javax.swing.plaf.multi.MultiInternalFrameUI");
+ defaults.put("LabelUI", "javax.swing.plaf.multi.MultiLabelUI");
+ defaults.put("ListUI", "javax.swing.plaf.multi.MultiListUI");
+ defaults.put("MenuItemUI", "javax.swing.plaf.multi.MultiMenuItemUI");
+ defaults.put("MenuUI", "javax.swing.plaf.multi.MultiMenuItemUI");
+ defaults.put("MenuBarUI", "javax.swing.plaf.multi.MultiMenuBarUI");
+ defaults.put("OptionPaneUI", "javax.swing.plaf.multi.MultiOptionPaneUI");
+ defaults.put("PanelUI", "javax.swing.plaf.multi.MultiPanelUI");
+ defaults.put("PasswordFieldUI", "javax.swing.plaf.multi.MultiTextUI");
+ defaults.put("PopupMenuUI", "javax.swing.plaf.multi.MultiPopupMenuUI");
+ defaults.put("PopupMenuSeparatorUI",
+ "javax.swing.plaf.multi.MultiSeparatorUI");
+ defaults.put("ProgressBarUI", "javax.swing.plaf.multi.MultiProgressBarUI");
+ defaults.put("RadioButtonUI", "javax.swing.plaf.multi.MultiButtonUI");
+ defaults.put("RadioButtonMenuItemUI",
+ "javax.swing.plaf.multi.MultiMenuItemUI");
+ defaults.put("RootPaneUI", "javax.swing.plaf.multi.MultiRootPaneUI");
+ defaults.put("ScrollBarUI", "javax.swing.plaf.multi.MultiScrollBarUI");
+ defaults.put("ScrollPaneUI", "javax.swing.plaf.multi.MultiScrollPaneUI");
+ defaults.put("SeparatorUI", "javax.swing.plaf.multi.MultiSeparatorUI");
+ defaults.put("SliderUI", "javax.swing.plaf.multi.MultiSliderUI");
+ defaults.put("SpinnerUI", "javax.swing.plaf.multi.MultiSpinnerUI");
+ defaults.put("SplitPaneUI", "javax.swing.plaf.multi.MultiSplitPaneUI");
+ defaults.put("TabbedPaneUI", "javax.swing.plaf.multi.MultiTabbedPaneUI");
+ defaults.put("TableHeaderUI", "javax.swing.plaf.multi.MultiTableHeaderUI");
+ defaults.put("TableUI", "javax.swing.plaf.multi.MultiTableUI");
+ defaults.put("TextAreaUI", "javax.swing.plaf.multi.MultiTextUI");
+ defaults.put("TextFieldUI", "javax.swing.plaf.multi.MultiTextUI");
+ defaults.put("TextPaneUI", "javax.swing.plaf.multi.MultiTextUI");
+ defaults.put("ToggleButtonUI", "javax.swing.plaf.multi.MultiButtonUI");
+ defaults.put("ToolBarSeparatorUI",
+ "javax.swing.plaf.multi.MultiSeparatorUI");
+ defaults.put("ToolBarUI", "javax.swing.plaf.multi.MultiToolBarUI");
+ defaults.put("ToolTipUI", "javax.swing.plaf.multi.MultiToolTipUI");
+ defaults.put("ViewportUI", "javax.swing.plaf.multi.MultiViewportUI");
+ return defaults;
+ }
+
+ /**
+ * Creates the UI delegates for the <code>target</code> component and
+ * returns a multiplexing UI delegate (<code>mui</code>) if there are
+ * multiple delegates.
+ *
+ * @param mui a multiplexing UI delegate appropriate for the component.
+ * @param uis a vector into which the UI delegates will be added.
+ * @param target the target component.
+ *
+ * @return A UI delegate.
+ */
+ public static ComponentUI createUIs(ComponentUI mui, Vector uis,
+ JComponent target)
+ {
+ // get primary UI delegate for 'target', and add it to uis
+ ComponentUI ui = null;
+ LookAndFeel primary = UIManager.getLookAndFeel();
+ if (primary != null)
+ {
+ ui = UIManager.getUI(target);
+ uis.add(ui);
+ }
+ // for any auxiliary look and feels in use, get the UI delegate and add
+ // it to uis
+ LookAndFeel[] auxlafs = UIManager.getAuxiliaryLookAndFeels();
+ for (int i = 0; i < auxlafs.length; i++)
+ {
+ LookAndFeel auxlaf = auxlafs[i];
+ // FIXME: here I call getDefaults() to get the UI delegate from the
+ // auxiliary look and feel. But getDefaults() creates a new set of
+ // defaults every time it is called, which is wasteful. Unfortunately
+ // I cannot find another way to get the UI delegate, so I'm doing it
+ // anyway...
+ UIDefaults defaults = auxlaf.getDefaults();
+ ui = defaults.getUI(target);
+ if (ui != null)
+ uis.add(ui);
+ }
+ // if uis contains more than 1 delegate, return mui, otherwise return
+ // the primary delegate
+ if (uis.size() > 1)
+ return mui;
+ else
+ return ui;
+ }
+
+ /**
+ * Returns an array containing the same {@link ComponentUI} instances as
+ * <code>uis</code>. If <code>uis</code> is <code>null</code>, a zero-length
+ * array is returned.
+ *
+ * @param uis a list of {@link ComponentUI} references (<code>null</code>
+ * permitted).
+ *
+ * @return An array containing the same {@link ComponentUI} instances as
+ * <code>uis</code>, or <code>null</code> if <code>uis</code> is
+ * empty.
+ */
+ protected static ComponentUI[] uisToArray(Vector uis)
+ {
+ if (uis == null)
+ return new ComponentUI[0];
+ int size = uis.size();
+ if (size == 0)
+ return null;
+ ComponentUI[] result = new ComponentUI[size];
+ uis.copyInto(result);
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiMenuBarUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiMenuBarUI.java
new file mode 100644
index 00000000000..a8e805af1d4
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiMenuBarUI.java
@@ -0,0 +1,352 @@
+/* MultiMenuBarUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.MenuBarUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link MenuBarUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiMenuBarUI extends MenuBarUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiMenuBarUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiMenuBarUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiMenuBarUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiMenuBarUI mui = new MultiMenuBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiMenuBarUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiMenuBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuBarUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiMenuBarUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiMenuBarUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiMenuItemUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiMenuItemUI.java
new file mode 100644
index 00000000000..ccab5feec9f
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiMenuItemUI.java
@@ -0,0 +1,352 @@
+/* MultiMenuItemUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.MenuItemUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link MenuItemUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiMenuItemUI extends MenuItemUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiMenuItemUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiMenuItemUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiItemUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiMenuItemUI mui = new MultiMenuItemUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiMenuItemUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiMenuItemUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiMenuItemUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiMenuItemUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiMenuItemUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiOptionPaneUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiOptionPaneUI.java
new file mode 100644
index 00000000000..c5cb913a068
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiOptionPaneUI.java
@@ -0,0 +1,396 @@
+/* MultiOptionPaneUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.OptionPaneUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link OptionPaneUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiOptionPaneUI extends OptionPaneUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiOptionPaneUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiOptionPaneUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiOptionPaneUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiOptionPaneUI mui = new MultiOptionPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiOptionPaneUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiOptionPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiOptionPaneUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiOptionPaneUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiOptionPaneUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link OptionPaneUI#selectInitialValue(JOptionPane)} method for
+ * all the UI delegates managed by this <code>MultiOptionPaneUI</code>.
+ *
+ * @param pane the option pane.
+ */
+ public void selectInitialValue(JOptionPane pane) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ OptionPaneUI ui = (OptionPaneUI) iterator.next();
+ ui.selectInitialValue(pane);
+ }
+ }
+
+ /**
+ * Calls the {@link OptionPaneUI#containsCustomComponents(JOptionPane)}
+ * method for all the UI delegates managed by this
+ * <code>MultiOptionPaneUI</code>, returning the result for the UI delegate
+ * from the primary look and feel.
+ *
+ * @param pane the option pane.
+ *
+ * @return The result for the UI delegate from the primary look and feel.
+ */
+ public boolean containsCustomComponents(JOptionPane pane) {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ OptionPaneUI ui = (OptionPaneUI) iterator.next();
+ result = ui.containsCustomComponents(pane);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ OptionPaneUI ui = (OptionPaneUI) iterator.next();
+ /* boolean ignored = */ ui.containsCustomComponents(pane);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiPanelUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiPanelUI.java
new file mode 100644
index 00000000000..67629b2feba
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiPanelUI.java
@@ -0,0 +1,352 @@
+/* MultiPanelUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.PanelUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link PanelUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiPanelUI extends PanelUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiPanelUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiPanelUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiPanelUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiPanelUI mui = new MultiPanelUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiPanelUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiPanelUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPanelUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiPanelUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiPanelUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiPopupMenuUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiPopupMenuUI.java
new file mode 100644
index 00000000000..161429d296f
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiPopupMenuUI.java
@@ -0,0 +1,352 @@
+/* MultiPopupMenuUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.PopupMenuUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link PopupMenuUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiPopupMenuUI extends PopupMenuUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiPopupMenuUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiPopupMenuUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiPopupMenuUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiPopupMenuUI mui = new MultiPopupMenuUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiPopupMenuUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiPopupMenuUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiPopupMenuUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiPopupMenuUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiPopupMenuUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiProgressBarUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiProgressBarUI.java
new file mode 100644
index 00000000000..c5dbbe815ae
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiProgressBarUI.java
@@ -0,0 +1,352 @@
+/* MultiProgressBarUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ProgressBarUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ProgressBarUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiProgressBarUI extends ProgressBarUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiProgressBarUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiProgressBarUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiProgressBarUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiProgressBarUI mui = new MultiProgressBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiProgressBarUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiProgressBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiProgressBarUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiProgressBarUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiProgressBarUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiRootPaneUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiRootPaneUI.java
new file mode 100644
index 00000000000..bd0cb5c1d1a
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiRootPaneUI.java
@@ -0,0 +1,352 @@
+/* MultiRootPaneUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.RootPaneUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link RootPaneUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiRootPaneUI extends RootPaneUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiRootPanelUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiRootPaneUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiRootPaneUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiRootPaneUI mui = new MultiRootPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiRootPaneUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiRootPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiRootPaneUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiRootPaneUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiRootPaneUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiScrollBarUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiScrollBarUI.java
new file mode 100644
index 00000000000..1a993b840b6
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiScrollBarUI.java
@@ -0,0 +1,352 @@
+/* MultiScrollBarUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ScrollBarUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ScrollBarUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiScrollBarUI extends ScrollBarUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiScrollBarUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiScrollBarUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiScrollBarUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiScrollBarUI mui = new MultiScrollBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiScrollBarUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiScrollBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollBarUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiScrollBarUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiScrollBarUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiScrollPaneUI.java
new file mode 100644
index 00000000000..a50c3ba7f18
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiScrollPaneUI.java
@@ -0,0 +1,352 @@
+/* MultiScrollPaneUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ScrollPaneUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ScrollPaneUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiScrollPaneUI extends ScrollPaneUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiScrollPaneUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiScrollPaneUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiScrollPaneUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiScrollPaneUI mui = new MultiScrollPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiScrollPaneUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiScrollPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiScrollPaneUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiScrollPaneUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiScrollPaneUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiSeparatorUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiSeparatorUI.java
new file mode 100644
index 00000000000..f8e4feae7f3
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiSeparatorUI.java
@@ -0,0 +1,352 @@
+/* MultiSeparatorUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.SeparatorUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link MultiSeparatorUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiSeparatorUI extends SeparatorUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiSeparatorUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiSeparatorUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiSeparatorUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiSeparatorUI mui = new MultiSeparatorUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiSeparatorUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiSeparatorUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSeparatorUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiSeparatorUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiSeparatorUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiSliderUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiSliderUI.java
new file mode 100644
index 00000000000..8a4aab6e041
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiSliderUI.java
@@ -0,0 +1,352 @@
+/* MultiSliderUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.SliderUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link SliderUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiSliderUI extends SliderUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiSliderUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiSliderUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiSliderUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiSliderUI mui = new MultiSliderUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiSliderUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiSliderUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSliderUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiSliderUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiSliderUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiSpinnerUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiSpinnerUI.java
new file mode 100644
index 00000000000..70068e82a56
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiSpinnerUI.java
@@ -0,0 +1,352 @@
+/* MultiSpinnerUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.SpinnerUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link SpinnerUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiSpinnerUI extends SpinnerUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiSpinnerUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiSpinnerUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiSpinnerUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiSpinnerUI mui = new MultiSpinnerUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiSpinnerUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiSpinnerUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSpinnerUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiSpinnerUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiSpinnerUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiSplitPaneUI.java
new file mode 100644
index 00000000000..f481f8109d9
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiSplitPaneUI.java
@@ -0,0 +1,488 @@
+/* MultiSplitPaneUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.JSplitPane;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.SplitPaneUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link SplitPaneUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiSplitPaneUI extends SplitPaneUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiSplitPaneUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiSplitPaneUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiSplitPaneUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiSplitPaneUI mui = new MultiSplitPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiSplitPaneUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiSplitPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link SplitPaneUI#resetToPreferredSizes(JSplitPane)} method
+ * for all the UI delegates managed by this <code>MultiSplitPaneUI</code>.
+ *
+ * @param pane the component.
+ */
+ public void resetToPreferredSizes(JSplitPane pane) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ ui.resetToPreferredSizes(pane);
+ }
+ }
+
+ /**
+ * Calls the {@link SplitPaneUI#setDividerLocation(JSplitPane, int)} method
+ * for all the UI delegates managed by this <code>MultiSplitPaneUI</code>.
+ *
+ * @param pane the component.
+ * @param location the location.
+ */
+ public void setDividerLocation(JSplitPane pane, int location) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ ui.setDividerLocation(pane, location);
+ }
+ }
+
+ /**
+ * Calls the {@link SplitPaneUI#getDividerLocation(JSplitPane)} method for all
+ * the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the location for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param pane the component.
+ *
+ * @return The location returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getDividerLocation(JSplitPane pane) {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ result = ui.getDividerLocation(pane);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ /* int ignored = */ ui.getDividerLocation(pane);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link SplitPaneUI#getMinimumDividerLocation(JSplitPane)} method
+ * for all the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the location for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param pane the component.
+ *
+ * @return The location returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getMinimumDividerLocation(JSplitPane pane) {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ result = ui.getMinimumDividerLocation(pane);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ /* int ignored = */ ui.getMinimumDividerLocation(pane);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link SplitPaneUI#getMaximumDividerLocation(JSplitPane)} method
+ * for all the UI delegates managed by this <code>MultiSplitPaneUI</code>,
+ * returning the location for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param pane the component.
+ *
+ * @return The location returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getMaximumDividerLocation(JSplitPane pane) {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ result = ui.getMaximumDividerLocation(pane);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ /* int ignored = */ ui.getMaximumDividerLocation(pane);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link SplitPaneUI#finishedPaintingChildren(JSplitPane,
+ * Graphics)} method for all the UI delegates managed by this
+ * <code>MultiSplitPaneUI</code>.
+ *
+ * @param pane the component.
+ * @param g the graphics device.
+ */
+ public void finishedPaintingChildren(JSplitPane pane, Graphics g) {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ SplitPaneUI ui = (SplitPaneUI) iterator.next();
+ ui.finishedPaintingChildren(pane, g);
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiTabbedPaneUI.java
new file mode 100644
index 00000000000..575de192a53
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiTabbedPaneUI.java
@@ -0,0 +1,444 @@
+/* MultiTabbedPaneUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.JTabbedPane;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TabbedPaneUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link TabbedPaneUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiTabbedPaneUI extends TabbedPaneUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiTabbedPaneUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiTabbedPaneUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiTabbedPaneUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiTabbedPaneUI mui = new MultiTabbedPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiTabbedPaneUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiTabbedPaneUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTabbedPaneUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiTabbedPaneUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiTabbedPaneUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TabbedPaneUI#tabForCoordinate(JTabbedPane, int, int)}
+ * method for all the UI delegates managed by this
+ * <code>MultiTabbedPaneUI</code>, returning the tab index for the UI
+ * delegate from the primary look and feel.
+ *
+ * @param pane the tabbed pane.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return The tab index returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int tabForCoordinate(JTabbedPane pane, int x, int y) {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TabbedPaneUI ui = (TabbedPaneUI) iterator.next();
+ result = ui.tabForCoordinate(pane, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TabbedPaneUI ui = (TabbedPaneUI) iterator.next();
+ /* int ignored = */ ui.tabForCoordinate(pane, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TabbedPaneUI#getTabBounds(JTabbedPane, int)}
+ * method for all the UI delegates managed by this
+ * <code>MultiTabbedPaneUI</code>, returning the bounds for the UI
+ * delegate from the primary look and feel.
+ *
+ * @param pane the tabbed pane.
+ * @param index the index.
+ *
+ * @return The bounds returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Rectangle getTabBounds(JTabbedPane pane, int index) {
+ Rectangle result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TabbedPaneUI ui = (TabbedPaneUI) iterator.next();
+ result = ui.getTabBounds(pane, index);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TabbedPaneUI ui = (TabbedPaneUI) iterator.next();
+ /* int ignored = */ ui.getTabRunCount(pane);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TabbedPaneUI#getTabRunCount(JTabbedPane)}
+ * method for all the UI delegates managed by this
+ * <code>MultiTabbedPaneUI</code>, returning the nt for the UI
+ * delegate from the primary look and feel.
+ *
+ * @param pane the tabbed pane.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getTabRunCount(JTabbedPane pane) {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TabbedPaneUI ui = (TabbedPaneUI) iterator.next();
+ result = ui.getTabRunCount(pane);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TabbedPaneUI ui = (TabbedPaneUI) iterator.next();
+ /* int ignored = */ ui.getTabRunCount(pane);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiTableHeaderUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiTableHeaderUI.java
new file mode 100644
index 00000000000..6c59cef6c96
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiTableHeaderUI.java
@@ -0,0 +1,352 @@
+/* MultiTableHeaderUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TableHeaderUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link TableHeaderUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiTableHeaderUI extends TableHeaderUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiTableHeaderUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiTableHeaderUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiTableHeaderUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiTableHeaderUI mui = new MultiTableHeaderUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiTableHeaderUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiTableHeaderUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableHeaderUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiTableHeaderUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiTableHeaderUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiTableUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiTableUI.java
new file mode 100644
index 00000000000..2e5b5bcf532
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiTableUI.java
@@ -0,0 +1,352 @@
+/* MultiTableUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TableUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link TableUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiTableUI extends TableUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiTableUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiTableUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiTableUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiTableUI mui = new MultiTableUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiTableUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiTableUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTableUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiTableUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiTableUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiTextUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiTextUI.java
new file mode 100644
index 00000000000..c5dee247dd3
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiTextUI.java
@@ -0,0 +1,617 @@
+/* MultiTextUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TextUI;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.EditorKit;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.Position;
+import javax.swing.text.View;
+import javax.swing.text.Position.Bias;
+
+/**
+ * A UI delegate that that coordinates multiple {@link TextUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiTextUI extends TextUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiTextUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiTextUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiTextUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiTextUI mui = new MultiTextUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiTextUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiTextUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#modelToView(JTextComponent, int)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the bounds for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tc the text component.
+ *
+ * @return The bounds returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Rectangle modelToView(JTextComponent tc, int pos)
+ throws BadLocationException
+ {
+ Rectangle result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.modelToView(tc, pos);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* Rectangle ignored = */ ui.modelToView(tc, pos);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#modelToView(JTextComponent, int, Position.Bias)}
+ * method for all the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the bounds for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tc the text component.
+ *
+ * @return The bounds returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Rectangle modelToView(JTextComponent tc, int pos, Bias bias)
+ throws BadLocationException
+ {
+ Rectangle result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.modelToView(tc, pos, bias);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* Rectangle ignored = */ ui.modelToView(tc, pos, bias);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#viewToModel(JTextComponent, Point)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the position for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param t the text component.
+ * @param pt the point.
+ *
+ * @return The position returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int viewToModel(JTextComponent t, Point pt)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.viewToModel(t, pt);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* int ignored = */ ui.viewToModel(t, pt);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#viewToModel(JTextComponent, Point, Bias[])} method
+ * for all the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the position for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tc the text component.
+ *
+ * @return The position returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int viewToModel(JTextComponent tc, Point loc, Bias[] outBias)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.viewToModel(tc, loc, outBias);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* int ignored = */ ui.viewToModel(tc, loc, outBias);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#getNextVisualPositionFrom(JTextComponent, int,
+ * Position.Bias, int, Position.Bias[])} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the position for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tc the text component.
+ *
+ * @return The position returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getNextVisualPositionFrom(JTextComponent tc, int pos, Bias bias,
+ int direction, Bias[] outBias) throws BadLocationException
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.getNextVisualPositionFrom(tc, pos, bias, direction,
+ outBias);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* int ignored = */ ui.getNextVisualPositionFrom(tc, pos, bias,
+ direction, outBias);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#damageRange(JTextComponent, int, int)} method for
+ * all the UI delegates managed by this <code>MultiTextUI</code>.
+ *
+ * @param tc the component.
+ * @param start the start position.
+ * @param end the end position.
+ */
+ public void damageRange(JTextComponent tc, int start, int end)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ ui.damageRange(tc, start, end);
+ }
+ }
+
+ /**
+ * Calls the {@link TextUI#damageRange(JTextComponent, int, int,
+ * Position.Bias, Position.Bias)} method for all the UI delegates managed by
+ * this <code>MultiTextUI</code>.
+ *
+ * @param tc the component.
+ * @param start the start position.
+ * @param end the end position.
+ * @param startBias the start bias.
+ * @param endBias the end bias.
+ */
+ public void damageRange(JTextComponent tc, int start, int end,
+ Bias startBias, Bias endBias)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ ui.damageRange(tc, start, end, startBias, endBias);
+ }
+ }
+
+ /**
+ * Calls the {@link TextUI#getEditorKit(JTextComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the editor kit for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tc the text component.
+ *
+ * @return The editor kit returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public EditorKit getEditorKit(JTextComponent tc)
+ {
+ EditorKit result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.getEditorKit(tc);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* EditorKit ignored = */ ui.getEditorKit(tc);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TextUI#getRootView(JTextComponent)} method for all
+ * the UI delegates managed by this <code>MultiTextUI</code>,
+ * returning the view for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tc the text component.
+ *
+ * @return The view returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public View getRootView(JTextComponent tc)
+ {
+ View result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ result = ui.getRootView(tc);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TextUI ui = (TextUI) iterator.next();
+ /* View ignored = */ ui.getRootView(tc);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiToolBarUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiToolBarUI.java
new file mode 100644
index 00000000000..afe63bf358f
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiToolBarUI.java
@@ -0,0 +1,352 @@
+/* MultiToolBarUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ToolBarUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ToolBarUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiToolBarUI extends ToolBarUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiToolBarUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiToolBarUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiToolBarUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiToolBarUI mui = new MultiToolBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiToolBarUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiToolBarUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolBarUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiToolBarUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiToolBarUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiToolTipUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiToolTipUI.java
new file mode 100644
index 00000000000..fcd622dd8d3
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiToolTipUI.java
@@ -0,0 +1,352 @@
+/* MultiToolTipUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ToolTipUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ToolTipUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiToolTipUI extends ToolTipUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiToolTipUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiToolTipUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiToolTipUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiToolTipUI mui = new MultiToolTipUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiToolTipUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiToolTipUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiToolTipUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiToolTipUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiToolTipUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiTreeUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiTreeUI.java
new file mode 100644
index 00000000000..de1dc6cc773
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiTreeUI.java
@@ -0,0 +1,628 @@
+/* MultiTreeUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.JTree;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TreeUI;
+import javax.swing.tree.TreePath;
+
+/**
+ * A UI delegate that that coordinates multiple {@link TreeUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiTreeUI extends TreeUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiTreeUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiTreeUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiTreeUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiTreeUI mui = new MultiTreeUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiTreeUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiTreeUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#getPathBounds(JTree, TreePath)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the bounds for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The bounds returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Rectangle getPathBounds(JTree tree, TreePath path)
+ {
+ Rectangle result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.getPathBounds(tree, path);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* Rectangle ignored = */ ui.getPathBounds(tree, path);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#getPathForRow(JTree, int)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the path for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The path returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public TreePath getPathForRow(JTree tree, int row)
+ {
+ TreePath result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.getPathForRow(tree, row);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* TreePath ignored = */ ui.getPathForRow(tree, row);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#getRowForPath(JTree, TreePath)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the row index for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The row index returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getRowForPath(JTree tree, TreePath path)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.getRowForPath(tree, path);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* int ignored = */ ui.getRowForPath(tree, path);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#getRowCount(JTree)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getRowCount(JTree tree)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.getRowCount(tree);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* int ignored = */ ui.getRowCount(tree);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#getClosestPathForLocation(JTree, int, int)} method
+ * for all the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the path for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The path returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public TreePath getClosestPathForLocation(JTree tree, int x, int y)
+ {
+ TreePath result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.getClosestPathForLocation(tree, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* TreePath ignored = */ ui.getClosestPathForLocation(tree, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#isEditing(JTree)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The result returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public boolean isEditing(JTree tree)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.isEditing(tree);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* boolean ignored = */ ui.isEditing(tree);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#stopEditing(JTree)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The result returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public boolean stopEditing(JTree tree)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.stopEditing(tree);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* boolean ignored = */ ui.stopEditing(tree);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link TreeUI#cancelEditing(JTree)} method for
+ * all the UI delegates managed by this <code>MultiTreeUI</code>.
+ *
+ * @param tree the tree component.
+ */
+ public void cancelEditing(JTree tree)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ ui.cancelEditing(tree);
+ }
+ }
+
+ /**
+ * Calls the {@link TreeUI#startEditingAtPath(JTree, TreePath)} method for
+ * all the UI delegates managed by this <code>MultiTreeUI</code>.
+ *
+ * @param tree the tree component.
+ * @param path the path.
+ */
+ public void startEditingAtPath(JTree tree, TreePath path)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ ui.startEditingAtPath(tree, path);
+ }
+ }
+
+ /**
+ * Calls the {@link TreeUI#getEditingPath(JTree)} method for all
+ * the UI delegates managed by this <code>MultiTreeUI</code>,
+ * returning the path for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param tree the tree component.
+ *
+ * @return The path returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public TreePath getEditingPath(JTree tree)
+ {
+ TreePath result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ result = ui.getEditingPath(tree);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ TreeUI ui = (TreeUI) iterator.next();
+ /* TreePath ignored = */ ui.getEditingPath(tree);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiViewportUI.java b/libjava/classpath/javax/swing/plaf/multi/MultiViewportUI.java
new file mode 100644
index 00000000000..33bbc3b7f75
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiViewportUI.java
@@ -0,0 +1,352 @@
+/* MultiViewPortUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.multi;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.ViewportUI;
+
+/**
+ * A UI delegate that that coordinates multiple {@link ViewportUI}
+ * instances, one from the primary look and feel, and one or more from the
+ * auxiliary look and feel(s).
+ *
+ * @see UIManager#addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+public class MultiViewportUI extends ViewportUI
+{
+
+ /** A list of references to the actual component UIs. */
+ protected Vector uis;
+
+ /**
+ * Creates a new <code>MultiViewPortUI</code> instance.
+ *
+ * @see #createUI(JComponent)
+ */
+ public MultiViewportUI()
+ {
+ uis = new Vector();
+ }
+
+ /**
+ * Creates a delegate object for the specified component. If any auxiliary
+ * look and feels support this component, a <code>MultiViewportUI</code> is
+ * returned, otherwise the UI from the default look and feel is returned.
+ *
+ * @param target the component.
+ *
+ * @see MultiLookAndFeel#createUIs(ComponentUI, Vector, JComponent)
+ */
+ public static ComponentUI createUI(JComponent target)
+ {
+ MultiViewportUI mui = new MultiViewportUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, target);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#installUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.installUI(c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#uninstallUI(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.uninstallUI(c);
+ }
+ }
+
+ /**
+ * Returns an array containing the UI delegates managed by this
+ * <code>MultiViewportUI</code>. The first item in the array is always
+ * the UI delegate from the installed default look and feel.
+ *
+ * @return An array of UI delegates.
+ */
+ public ComponentUI[] getUIs()
+ {
+ return MultiLookAndFeel.uisToArray(uis);
+ }
+
+ /**
+ * Calls the {@link ComponentUI#contains(JComponent, int, int)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>,
+ * returning the result for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return <code>true</code> if the specified (x, y) coordinate falls within
+ * the bounds of the component as rendered by the UI delegate in the
+ * primary look and feel, and <code>false</code> otherwise.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ boolean result = false;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.contains(c, x, y);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* boolean ignored = */ ui.contains(c, x, y);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#update(Graphics, JComponent)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.update(g, c);
+ }
+ }
+
+ /**
+ * Calls the <code>paint(Graphics, JComponent)</code> method for all the UI
+ * delegates managed by this <code>MultiViewportUI</code>.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Iterator iterator = uis.iterator();
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ ui.paint(g, c);
+ }
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getPreferredSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>,
+ * returning the preferred size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The preferred size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getPreferredSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getPreferredSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMinimumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>,
+ * returning the minimum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The minimum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMinimumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMinimumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getMaximumSize(JComponent)} method for all
+ * the UI delegates managed by this <code>MultiViewportUI</code>,
+ * returning the maximum size for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The maximum size returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ Dimension result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getMaximumSize(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Dimension ignored = */ ui.getMaximumSize(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChildrenCount(JComponent)} method
+ * for all the UI delegates managed by this <code>MultiViewportUI</code>,
+ * returning the count for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component.
+ *
+ * @return The count returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ int result = 0;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChildrenCount(c);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* int ignored = */ ui.getAccessibleChildrenCount(c);
+ }
+ return result;
+ }
+
+ /**
+ * Calls the {@link ComponentUI#getAccessibleChild(JComponent, int)} method
+ * for all the UI delegates managed by this <code>MultiViewportUI</code>,
+ * returning the child for the UI delegate from the primary look and
+ * feel.
+ *
+ * @param c the component
+ * @param i the child index.
+ *
+ * @return The child returned by the UI delegate from the primary
+ * look and feel.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ Accessible result = null;
+ Iterator iterator = uis.iterator();
+ // first UI delegate provides the return value
+ if (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ result = ui.getAccessibleChild(c, i);
+ }
+ // return values from auxiliary UI delegates are ignored
+ while (iterator.hasNext())
+ {
+ ComponentUI ui = (ComponentUI) iterator.next();
+ /* Accessible ignored = */ ui.getAccessibleChild(c, i);
+ }
+ return result;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/multi/package.html b/libjava/classpath/javax/swing/plaf/multi/package.html
new file mode 100644
index 00000000000..568a7d0bf98
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/multi/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.swing.plaf.metal package.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.swing.plaf.multi</title></head>
+
+<body>
+<p>Provides a look and feel that can combine a primary look and feel with one or more auxiliary look and feels.</p>
+
+</body>
+</html>
diff --git a/libjava/classpath/javax/swing/text/AbstractWriter.java b/libjava/classpath/javax/swing/text/AbstractWriter.java
new file mode 100644
index 00000000000..d5fc395e1ac
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/AbstractWriter.java
@@ -0,0 +1,480 @@
+/* AbstractWriter.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.Enumeration;
+
+/**
+ * This is an abstract base class for writing Document instances to a
+ * Writer. A concrete subclass must implement a method to iterate
+ * over the Elements of the Document and correctly format them.
+ */
+public abstract class AbstractWriter
+{
+ /**
+ * The default line separator character.
+ * @specnote although this is a constant, it is not static in the JDK
+ */
+ protected static final char NEWLINE = '\n';
+
+ // Where we write.
+ private Writer writer;
+ // How we iterate over the document.
+ private ElementIterator iter;
+ // The document over which we iterate.
+ private Document document;
+ // Maximum number of characters per line.
+ private int maxLineLength = 100;
+ // Number of characters we have currently written.
+ private int lineLength;
+ // True if we can apply line wrapping.
+ private boolean canWrapLines; // FIXME default?
+ // The number of spaces per indentation level.
+ private int indentSpace = 2;
+ // The current indentation level.
+ private int indentLevel;
+ // True if we have indented this line.
+ private boolean indented;
+ // Starting offset in document.
+ private int startOffset;
+ // Ending offset in document.
+ private int endOffset;
+ // The line separator string.
+ private String lineSeparator = "" + NEWLINE;
+ // The characters making up the line separator.
+ private char[] lineSeparatorChars = lineSeparator.toCharArray();
+
+ /**
+ * Create a new AbstractWriter with the indicated Writer and
+ * Document. The full range of the Document will be used. The
+ * internal ElementIterator will be initialized with the Document's
+ * root node.
+ */
+ protected AbstractWriter(Writer writer, Document doc)
+ {
+ this.writer = writer;
+ this.iter = new ElementIterator(doc);
+ this.document = doc;
+ this.startOffset = 0;
+ this.endOffset = doc.getLength();
+ }
+
+ /**
+ * Create a new AbstractWriter with the indicated Writer and
+ * Document. The full range of the Document will be used. The
+ * internal ElementIterator will be initialized with the Document's
+ * root node.
+ */
+ protected AbstractWriter(Writer writer, Document doc, int pos, int len)
+ {
+ this.writer = writer;
+ this.iter = new ElementIterator(doc);
+ this.document = doc;
+ this.startOffset = pos;
+ this.endOffset = pos + len;
+ }
+
+ /**
+ * Create a new AbstractWriter with the indicated Writer and
+ * Element. The full range of the Element will be used.
+ */
+ protected AbstractWriter(Writer writer, Element elt)
+ {
+ this.writer = writer;
+ this.iter = new ElementIterator(elt);
+ this.document = elt.getDocument();
+ this.startOffset = elt.getStartOffset();
+ this.endOffset = elt.getEndOffset();
+ }
+
+ /**
+ * Create a new AbstractWriter with the indicated Writer and
+ * Element. The full range of the Element will be used. The range
+ * will be limited to the indicated range of the Document.
+ */
+ protected AbstractWriter(Writer writer, Element elt, int pos, int len)
+ {
+ this.writer = writer;
+ this.iter = new ElementIterator(elt);
+ this.document = elt.getDocument();
+ this.startOffset = pos;
+ this.endOffset = pos + len;
+ }
+
+ /**
+ * Return the ElementIterator for this writer.
+ */
+ protected ElementIterator getElementIterator()
+ {
+ return iter;
+ }
+
+ /**
+ * Return the Writer to which we are writing.
+ * @since 1.3
+ */
+ protected Writer getWriter()
+ {
+ return writer;
+ }
+
+ /**
+ * Return this writer's Document.
+ */
+ protected Document getDocument()
+ {
+ return document;
+ }
+
+ /**
+ * This method must be overridden by a concrete subclass. It is
+ * responsible for iterating over the Elements of the Document and
+ * writing them out.
+ */
+ protected abstract void write() throws IOException, BadLocationException;
+
+ /**
+ * Return the text of the Document that is associated with the given
+ * Element. If the Element is not a leaf Element, this will throw
+ * BadLocationException.
+ *
+ * @throws BadLocationException if the element is not a leaf
+ */
+ protected String getText(Element elt) throws BadLocationException
+ {
+ if (! elt.isLeaf())
+ throw new BadLocationException("Element is not a leaf",
+ elt.getStartOffset());
+ return document.getText(elt.getStartOffset(), elt.getEndOffset());
+ }
+
+ /**
+ * This method calls Writer.write on the indicated data, and updates
+ * the current line length. This method does not look for newlines
+ * in the written data; the caller is responsible for that.
+ *
+ * @since 1.3
+ */
+ protected void output(char[] data, int start, int len) throws IOException
+ {
+ writer.write(data, start, len);
+ lineLength += len;
+ }
+
+ /**
+ * Write a line separator using the output method, and then reset
+ * the current line length.
+ *
+ * @since 1.3
+ */
+ protected void writeLineSeparator() throws IOException
+ {
+ output(lineSeparatorChars, 0, lineSeparatorChars.length);
+ lineLength = 0;
+ indented = false;
+ }
+
+ /**
+ * Write a single character.
+ */
+ protected void write(char ch) throws IOException
+ {
+ write(new char[] { ch }, 0, 1);
+ }
+
+ /**
+ * Write a String.
+ */
+ protected void write(String s) throws IOException
+ {
+ char[] v = s.toCharArray();
+ write(v, 0, v.length);
+ }
+
+ /**
+ * Write a character array to the output Writer, properly handling
+ * newlines and, if needed, wrapping lines as they are output.
+ * @since 1.3
+ */
+ protected void write(char[] data, int start, int len) throws IOException
+ {
+ if (getCanWrapLines())
+ {
+ // FIXME: should we be handling newlines specially here?
+ for (int i = 0; i < len; )
+ {
+ int start_i = i;
+ // Find next space.
+ while (i < len && data[start + i] != ' ')
+ ++i;
+ if (i < len && lineLength + i - start_i >= maxLineLength)
+ writeLineSeparator();
+ else if (i < len)
+ {
+ // Write the trailing space.
+ ++i;
+ }
+ // Write out the text.
+ output(data, start + start_i, start + i - start_i);
+ }
+ }
+ else
+ {
+ int saved_i = start;
+ for (int i = start; i < start + len; ++i)
+ {
+ if (data[i] == NEWLINE)
+ {
+ output(data, saved_i, i - saved_i);
+ writeLineSeparator();
+ }
+ }
+ if (saved_i < start + len - 1)
+ output(data, saved_i, start + len - saved_i);
+ }
+ }
+
+ /**
+ * Indent this line by emitting spaces, according to the current
+ * indent level and the current number of spaces per indent. After
+ * this method is called, the current line is no longer considered
+ * to be empty, even if no spaces are actually written.
+ */
+ protected void indent() throws IOException
+ {
+ int spaces = indentLevel * indentSpace;
+ if (spaces > 0)
+ {
+ char[] v = new char[spaces];
+ Arrays.fill(v, ' ');
+ write(v, 0, v.length);
+ }
+ indented = true;
+ }
+
+ /**
+ * Return the index of the Document at which output starts.
+ * @since 1.3
+ */
+ public int getStartOffset()
+ {
+ return startOffset;
+ }
+
+ /**
+ * Return the index of the Document at which output ends.
+ * @since 1.3
+ */
+ public int getEndOffset()
+ {
+ return endOffset;
+ }
+
+ /**
+ * Return true if the Element's range overlaps our desired output
+ * range; false otherwise.
+ */
+ protected boolean inRange(Element elt)
+ {
+ int eltStart = elt.getStartOffset();
+ int eltEnd = elt.getEndOffset();
+ return ((eltStart >= startOffset && eltStart < endOffset)
+ || (eltEnd >= startOffset && eltEnd < endOffset));
+ }
+
+ /**
+ * Output the text of the indicated Element, properly clipping it to
+ * the range of the Document specified when the AbstractWriter was
+ * created.
+ */
+ protected void text(Element elt) throws BadLocationException, IOException
+ {
+ int eltStart = elt.getStartOffset();
+ int eltEnd = elt.getEndOffset();
+
+ eltStart = Math.max(eltStart, startOffset);
+ eltEnd = Math.min(eltEnd, endOffset);
+ write(document.getText(eltStart, eltEnd));
+ }
+
+ /**
+ * Set the maximum line length.
+ */
+ protected void setLineLength(int maxLineLength)
+ {
+ this.maxLineLength = maxLineLength;
+ }
+
+ /**
+ * Return the maximum line length.
+ * @since 1.3
+ */
+ protected int getLineLength()
+ {
+ return maxLineLength;
+ }
+
+ /**
+ * Set the current line length.
+ * @since 1.3
+ */
+ protected void setCurrentLineLength(int lineLength)
+ {
+ this.lineLength = lineLength;
+ }
+
+ /**
+ * Return the current line length.
+ * @since 1.3
+ */
+ protected int getCurrentLineLength()
+ {
+ return lineLength;
+ }
+
+ /**
+ * Return true if the line is empty, false otherwise. The line is
+ * empty if nothing has been written since the last newline, and
+ * indent has not been invoked.
+ */
+ protected boolean isLineEmpty()
+ {
+ return lineLength == 0 && ! indented;
+ }
+
+ /**
+ * Set the flag indicating whether lines will wrap. This affects
+ * the behavior of write().
+ * @since 1.3
+ */
+ protected void setCanWrapLines(boolean canWrapLines)
+ {
+ this.canWrapLines = canWrapLines;
+ }
+
+ /**
+ * Return true if lines printed via write() will wrap, false
+ * otherwise.
+ * @since 1.3
+ */
+ protected boolean getCanWrapLines()
+ {
+ return canWrapLines;
+ }
+
+ /**
+ * Set the number of spaces per indent level.
+ * @since 1.3
+ */
+ protected void setIndentSpace(int indentSpace)
+ {
+ this.indentSpace = indentSpace;
+ }
+
+ /**
+ * Return the number of spaces per indent level.
+ * @since 1.3
+ */
+ protected int getIndentSpace()
+ {
+ return indentSpace;
+ }
+
+ /**
+ * Set the current line separator.
+ * @since 1.3
+ */
+ public void setLineSeparator(String lineSeparator)
+ {
+ this.lineSeparator = lineSeparator;
+ this.lineSeparatorChars = lineSeparator.toCharArray();
+ }
+
+ /**
+ * Return the current line separator.
+ * @since 1.3
+ */
+ public String getLineSeparator()
+ {
+ return lineSeparator;
+ }
+
+ /**
+ * Increment the indent level.
+ */
+ protected void incrIndent()
+ {
+ ++indentLevel;
+ }
+
+ /**
+ * Decrement the indent level.
+ */
+ protected void decrIndent()
+ {
+ --indentLevel;
+ }
+
+ /**
+ * Return the current indent level.
+ * @since 1.3
+ */
+ protected int getIndentLevel()
+ {
+ return indentLevel;
+ }
+
+ /**
+ * Print the given AttributeSet as a sequence of assignment-like
+ * strings, e.g. "key=value".
+ */
+ protected void writeAttributes(AttributeSet attrs) throws IOException
+ {
+ Enumeration e = attrs.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ Object val = attrs.getAttribute(name);
+ write(name + "=" + val);
+ writeLineSeparator();
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/BoxView.java b/libjava/classpath/javax/swing/text/BoxView.java
new file mode 100644
index 00000000000..0f8ba1ce15e
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/BoxView.java
@@ -0,0 +1,714 @@
+/* BoxView.java -- An composite view
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+import javax.swing.SizeRequirements;
+
+/**
+ * An implementation of {@link CompositeView} that arranges its children in
+ * a box along one axis. This is comparable to how the <code>BoxLayout</code>
+ * works, but for <code>View</code> children.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public class BoxView
+ extends CompositeView
+{
+
+ /**
+ * The axis along which this <code>BoxView</code> is laid out.
+ */
+ int myAxis;
+
+ /**
+ * Indicates wether the layout in X_AXIS is valid.
+ */
+ boolean xLayoutValid;
+
+ /**
+ * Indicates whether the layout in Y_AXIS is valid.
+ */
+ boolean yLayoutValid;
+
+ /**
+ * The spans in X direction of the children.
+ */
+ int[] spansX;
+
+ /**
+ * The spans in Y direction of the children.
+ */
+ int[] spansY;
+
+ /**
+ * The offsets of the children in X direction relative to this BoxView's
+ * inner bounds.
+ */
+ int[] offsetsX;
+
+ /**
+ * The offsets of the children in Y direction relative to this BoxView's
+ * inner bounds.
+ */
+ int[] offsetsY;
+
+ /**
+ * The current width.
+ */
+ int width;
+
+ /**
+ * The current height.
+ */
+ int height;
+
+ /**
+ * Creates a new <code>BoxView</code> for the given
+ * <code>Element</code> and axis. Valid values for the axis are
+ * {@link View#X_AXIS} and {@link View#Y_AXIS}.
+ *
+ * @param element the element that is rendered by this BoxView
+ * @param axis the axis along which the box is laid out
+ */
+ public BoxView(Element element, int axis)
+ {
+ super(element);
+ myAxis = axis;
+ xLayoutValid = false;
+ yLayoutValid = false;
+
+ // Initialize the cache arrays.
+ spansX = new int[0];
+ spansY = new int[0];
+ offsetsX = new int[0];
+ offsetsY = new int[0];
+
+ width = 0;
+ height = 0;
+ }
+
+ /**
+ * Returns the axis along which this <code>BoxView</code> is laid out.
+ *
+ * @return the axis along which this <code>BoxView</code> is laid out
+ */
+ public int getAxis()
+ {
+ return myAxis;
+ }
+
+ /**
+ * Sets the axis along which this <code>BoxView</code> is laid out.
+ *
+ * Valid values for the axis are {@link View#X_AXIS} and
+ * {@link View#Y_AXIS}.
+ *
+ * @param axis the axis along which this <code>BoxView</code> is laid out
+ */
+ public void setAxis(int axis)
+ {
+ myAxis = axis;
+ }
+
+ /**
+ * Marks the layout along the specified axis as invalid. This is triggered
+ * automatically when any of the child view changes its preferences
+ * via {@link #preferenceChanged(View, boolean, boolean)}.
+ *
+ * The layout will be updated the next time when {@link #setSize()} is
+ * called, typically from within the {@link #paint()} method.
+ *
+ * Valid values for the axis are {@link View#X_AXIS} and
+ * {@link View#Y_AXIS}.
+ *
+ * @param axis an <code>int</code> value
+ */
+ public void layoutChanged(int axis)
+ {
+ switch (axis)
+ {
+ case X_AXIS:
+ xLayoutValid = false;
+ break;
+ case Y_AXIS:
+ yLayoutValid = false;
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid axis parameter.");
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if the layout along the specified
+ * <code>axis</code> is valid, <code>false</code> otherwise.
+ *
+ * Valid values for the axis are {@link View#X_AXIS} and
+ * {@link View#Y_AXIS}.
+ *
+ * @param axis the axis
+ *
+ * @return <code>true</code> if the layout along the specified
+ * <code>axis</code> is valid, <code>false</code> otherwise
+ */
+ protected boolean isLayoutValid(int axis)
+ {
+ boolean valid = false;
+ switch (axis)
+ {
+ case X_AXIS:
+ valid = xLayoutValid;
+ break;
+ case Y_AXIS:
+ valid = yLayoutValid;
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid axis parameter.");
+ }
+ return valid;
+ }
+
+ /**
+ * Paints the child <code>View</code> at the specified <code>index</code>.
+ * This method modifies the actual values in <code>alloc</code> so make
+ * sure you have a copy of the original values if you need them.
+ *
+ * @param g the <code>Graphics</code> context to paint to
+ * @param alloc the allocated region for the child to paint into
+ * @param index the index of the child to be painted
+ *
+ * @see {@link #childAllocation}
+ */
+ protected void paintChild(Graphics g, Rectangle alloc, int index)
+ {
+ View child = getView(index);
+ childAllocation(index, alloc);
+ child.paint(g, alloc);
+ }
+
+ /**
+ * Replaces child views by some other child views. If there are no views to
+ * remove (<code>length == 0</code>), the result is a simple insert, if
+ * there are no children to add (<code>view == null</code>) the result
+ * is a simple removal.
+ *
+ * In addition this invalidates the layout and resizes the internal cache
+ * for the child allocations. The old children's cached allocations can
+ * still be accessed (although they are not guaranteed to be valid), and
+ * the new children will have an initial offset and span of 0.
+ *
+ * @param offset the start offset from where to remove children
+ * @param length the number of children to remove
+ * @param views the views that replace the removed children
+ */
+ public void replace(int offset, int length, View[] views)
+ {
+ // Resize and copy data for cache arrays.
+ // The spansX cache.
+ int oldSize = getViewCount();
+
+ int[] newSpansX = new int[oldSize - length + views.length];
+ System.arraycopy(spansX, 0, newSpansX, 0, offset);
+ System.arraycopy(spansX, offset + length, newSpansX,
+ offset + views.length,
+ oldSize - (offset + length));
+ spansX = newSpansX;
+
+ // The spansY cache.
+ int[] newSpansY = new int[oldSize - length + views.length];
+ System.arraycopy(spansY, 0, newSpansY, 0, offset);
+ System.arraycopy(spansY, offset + length, newSpansY,
+ offset + views.length,
+ oldSize - (offset + length));
+ spansY = newSpansY;
+
+ // The offsetsX cache.
+ int[] newOffsetsX = new int[oldSize - length + views.length];
+ System.arraycopy(offsetsX, 0, newOffsetsX, 0, offset);
+ System.arraycopy(offsetsX, offset + length, newOffsetsX,
+ offset + views.length,
+ oldSize - (offset + length));
+ offsetsX = newOffsetsX;
+
+ // The offsetsY cache.
+ int[] newOffsetsY = new int[oldSize - length + views.length];
+ System.arraycopy(offsetsY, 0, newOffsetsY, 0, offset);
+ System.arraycopy(offsetsY, offset + length, newOffsetsY,
+ offset + views.length,
+ oldSize - (offset + length));
+ offsetsY = newOffsetsY;
+
+ // Actually perform the replace.
+ super.replace(offset, length, views);
+
+ // Invalidate layout information.
+ layoutChanged(X_AXIS);
+ layoutChanged(Y_AXIS);
+ }
+
+ /**
+ * Renders the <code>Element</code> that is associated with this
+ * <code>View</code>.
+ *
+ * @param g the <code>Graphics</code> context to render to
+ * @param a the allocated region for the <code>Element</code>
+ */
+ public void paint(Graphics g, Shape a)
+ {
+ // Adjust size if the size is changed.
+ Rectangle bounds = a.getBounds();
+
+ if (bounds.width != getWidth() || bounds.height != getHeight())
+ setSize(bounds.width, bounds.height);
+
+ Rectangle inside = getInsideAllocation(a);
+
+ Rectangle copy = new Rectangle(inside);
+ int count = getViewCount();
+ for (int i = 0; i < count; ++i)
+ {
+ // TODO: Figure out if the parameter to paintChild is meant to
+ // be the child allocation or the allocation of this BoxView.
+ // I assume the second option here.
+ // We pass this method a copy of the inside rectangle here because
+ // it modifies the actual values.
+ copy.setBounds(inside);
+ paintChild(g, copy, i);
+ }
+ }
+
+ /**
+ * Returns the preferred span of the content managed by this
+ * <code>View</code> along the specified <code>axis</code>.
+ *
+ * @param axis the axis
+ *
+ * @return the preferred span of this <code>View</code>.
+ */
+ public float getPreferredSpan(int axis)
+ {
+ SizeRequirements sr = new SizeRequirements();
+ int pref = baselineRequirements(axis, sr).preferred;
+ return (float) pref;
+ }
+
+ public float getMaximumSpan(int axis)
+ {
+ if (axis == getAxis())
+ return getPreferredSpan(axis);
+ else
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * Calculates the size requirements for this <code>BoxView</code> along
+ * the specified axis.
+ *
+ * @param axis the axis that is examined
+ * @param sr the <code>SizeRequirements</code> object to hold the result,
+ * if <code>null</code>, a new one is created
+ *
+ * @return the size requirements for this <code>BoxView</code> along
+ * the specified axis
+ */
+ protected SizeRequirements baselineRequirements(int axis,
+ SizeRequirements sr)
+ {
+ SizeRequirements result;
+ if (axis == myAxis)
+ result = calculateMajorAxisRequirements(axis, sr);
+ else
+ result = calculateMinorAxisRequirements(axis, sr);
+ return result;
+ }
+
+ /**
+ * Calculates the size requirements of this <code>BoxView</code> along
+ * its major axis, that is the axis specified in the constructor.
+ *
+ * @param axis the axis that is examined
+ * @param sr the <code>SizeRequirements</code> object to hold the result,
+ * if <code>null</code>, a new one is created
+ *
+ * @return the size requirements for this <code>BoxView</code> along
+ * the specified axis
+ */
+ protected SizeRequirements calculateMajorAxisRequirements(int axis,
+ SizeRequirements sr)
+ {
+ if (sr == null)
+ sr = new SizeRequirements();
+ else
+ {
+ sr.maximum = 0;
+ sr.minimum = 0;
+ sr.preferred = 0;
+ sr.alignment = 0.5F;
+ }
+
+ int count = getViewCount();
+
+ // Sum up the sizes of the children along the specified axis.
+ for (int i = 0; i < count; ++i)
+ {
+ View child = getView(i);
+ sr.minimum += child.getMinimumSpan(axis);
+ sr.preferred += child.getPreferredSpan(axis);
+ sr.maximum += child.getMaximumSpan(axis);
+ }
+ return sr;
+ }
+
+ /**
+ * Calculates the size requirements of this <code>BoxView</code> along
+ * its minor axis, that is the axis opposite to the axis specified in the
+ * constructor.
+ *
+ * @param axis the axis that is examined
+ * @param sr the <code>SizeRequirements</code> object to hold the result,
+ * if <code>null</code>, a new one is created
+ *
+ * @return the size requirements for this <code>BoxView</code> along
+ * the specified axis
+ */
+ protected SizeRequirements calculateMinorAxisRequirements(int axis,
+ SizeRequirements sr)
+ {
+ if (sr == null)
+ sr = new SizeRequirements();
+ else
+ {
+ sr.maximum = 0;
+ sr.minimum = 0;
+ sr.preferred = 0;
+ sr.alignment = 0.5F;
+ }
+
+ int count = getViewCount();
+
+ int aboveBaseline = 0;
+ int belowBaseline = 0;
+ int aboveBaselineMin = 0;
+ int belowBaselineMin = 0;
+ int aboveBaselineMax = 0;
+ int belowBaselineMax = 0;
+
+ for (int i = 0; i < count; ++i)
+ {
+ View child = getView(i);
+ float align = child.getAlignment(axis);
+ int pref = (int) child.getPreferredSpan(axis);
+ int min = (int) child.getMinimumSpan(axis);
+ int max = (int) child.getMaximumSpan(axis);
+ aboveBaseline += (int) (align * pref);
+ belowBaseline += (int) ((1.F - align) * pref);
+ aboveBaselineMin += (int) (align * min);
+ belowBaselineMin += (int) ((1.F - align) * min);
+ aboveBaselineMax += (int) (align * max);
+ belowBaselineMax += (int) ((1.F - align) * max);
+ }
+ sr.minimum = aboveBaselineMin + belowBaselineMin;
+ sr.maximum = aboveBaselineMax + belowBaselineMax;
+ sr.preferred = aboveBaseline + belowBaseline;
+ if (aboveBaseline == 0)
+ sr.alignment = 1.0F;
+ else
+ sr.alignment = (float) (sr.preferred / aboveBaseline);
+
+ return sr;
+ }
+
+ /**
+ * Returns <code>true</code> if the specified point lies before the
+ * given <code>Rectangle</code>, <code>false</code> otherwise.
+ *
+ * &quot;Before&quot; is typically defined as being to the left or above.
+ *
+ * @param x the X coordinate of the point
+ * @param y the Y coordinate of the point
+ * @param r the rectangle to test the point against
+ *
+ * @return <code>true</code> if the specified point lies before the
+ * given <code>Rectangle</code>, <code>false</code> otherwise
+ */
+ protected boolean isBefore(int x, int y, Rectangle r)
+ {
+ boolean result = false;
+
+ if (myAxis == X_AXIS)
+ result = x < r.x;
+ else
+ result = y < r.y;
+
+ return result;
+ }
+
+ /**
+ * Returns <code>true</code> if the specified point lies after the
+ * given <code>Rectangle</code>, <code>false</code> otherwise.
+ *
+ * &quot;After&quot; is typically defined as being to the right or below.
+ *
+ * @param x the X coordinate of the point
+ * @param y the Y coordinate of the point
+ * @param r the rectangle to test the point against
+ *
+ * @return <code>true</code> if the specified point lies after the
+ * given <code>Rectangle</code>, <code>false</code> otherwise
+ */
+ protected boolean isAfter(int x, int y, Rectangle r)
+ {
+ boolean result = false;
+
+ if (myAxis == X_AXIS)
+ result = x > r.x;
+ else
+ result = y > r.y;
+
+ return result;
+ }
+
+ /**
+ * Returns the child <code>View</code> at the specified location.
+ *
+ * @param x the X coordinate
+ * @param y the Y coordinate
+ * @param r the inner allocation of this <code>BoxView</code> on entry,
+ * the allocation of the found child on exit
+ *
+ * @return the child <code>View</code> at the specified location
+ */
+ protected View getViewAtPoint(int x, int y, Rectangle r)
+ {
+ View result = null;
+
+ int count = getViewCount();
+ Rectangle copy = new Rectangle(r);
+
+ for (int i = 0; i < count; ++i)
+ {
+ copy.setBounds(r);
+ childAllocation(i, r);
+ if (copy.contains(x, y))
+ {
+ result = getView(i);
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Computes the allocation for a child <code>View</code>. The parameter
+ * <code>a</code> stores the allocation of this <code>CompositeView</code>
+ * and is then adjusted to hold the allocation of the child view.
+ *
+ * @param index the index of the child <code>View</code>
+ * @param a the allocation of this <code>CompositeView</code> before the
+ * call, the allocation of the child on exit
+ */
+ protected void childAllocation(int index, Rectangle a)
+ {
+ if (! isAllocationValid())
+ layout(a.width, a.height);
+
+ a.x += offsetsX[index];
+ a.y += offsetsY[index];
+ a.width = spansX[index];
+ a.height = spansY[index];
+ }
+
+ /**
+ * Lays out the children of this <code>BoxView</code> with the specified
+ * bounds.
+ *
+ * @param width the width of the allocated region for the children (that
+ * is the inner allocation of this <code>BoxView</code>
+ * @param height the height of the allocated region for the children (that
+ * is the inner allocation of this <code>BoxView</code>
+ */
+ protected void layout(int width, int height)
+ {
+ this.width = width;
+ this.height = height;
+
+ if (myAxis == X_AXIS)
+ {
+ layoutMajorAxis(width, X_AXIS, offsetsX, spansX);
+ layoutMinorAxis(height, Y_AXIS, offsetsY, spansY);
+ }
+ else
+ {
+ layoutMajorAxis(height, Y_AXIS, offsetsY, spansY);
+ layoutMinorAxis(width, X_AXIS, offsetsX, spansX);
+ }
+ }
+
+ /**
+ * Performs the layout along the major axis of a <code>BoxView</code>.
+ *
+ * @param targetSpan the (inner) span of the <code>BoxView</code> in which
+ * to layout the children
+ * @param axis the axis along which the layout is performed
+ * @param offsets the array that holds the offsets of the children on exit
+ * @param offsets the array that holds the spans of the children on exit
+ */
+ protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,
+ int[] spans)
+ {
+ // Allocate SizeRequirements for each child view.
+ int count = getViewCount();
+ SizeRequirements[] childReqs = new SizeRequirements[count];
+ for (int i = 0; i < count; ++i)
+ {
+ View view = getView(i);
+ childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
+ (int) view.getPreferredSpan(axis),
+ (int) view.getMaximumSpan(axis),
+ view.getAlignment(axis));
+ }
+
+ // Calculate the spans and offsets using the SizeRequirements uility
+ // methods.
+ SizeRequirements.calculateTiledPositions(targetSpan, null, childReqs,
+ offsets, spans);
+
+ validateLayout(axis);
+ }
+
+ /**
+ * Performs the layout along the minor axis of a <code>BoxView</code>.
+ *
+ * @param targetSpan the (inner) span of the <code>BoxView</code> in which
+ * to layout the children
+ * @param axis the axis along which the layout is performed
+ * @param offsets the array that holds the offsets of the children on exit
+ * @param offsets the array that holds the spans of the children on exit
+ */
+ protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets,
+ int[] spans)
+ {
+ // Allocate SizeRequirements for each child view.
+ int count = getViewCount();
+ SizeRequirements[] childReqs = new SizeRequirements[count];
+ for (int i = 0; i < count; ++i)
+ {
+ View view = getView(i);
+ childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
+ (int) view.getPreferredSpan(axis),
+ (int) view.getMaximumSpan(axis),
+ view.getAlignment(axis));
+ }
+
+ // Calculate the spans and offsets using the SizeRequirements uility
+ // methods.
+ SizeRequirements.calculateAlignedPositions(targetSpan, null, childReqs,
+ offsets, spans);
+ validateLayout(axis);
+ }
+
+ /**
+ * Returns <code>true</code> if the cached allocations for the children
+ * are still valid, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the cached allocations for the children
+ * are still valid, <code>false</code> otherwise
+ */
+ protected boolean isAllocationValid()
+ {
+ return isLayoutValid(X_AXIS) && isLayoutValid(Y_AXIS);
+ }
+
+ /**
+ * Return the current width of the box. This is the last allocated width.
+ *
+ * @return the current width of the box
+ */
+ public int getWidth()
+ {
+ return width;
+ }
+
+ /**
+ * Return the current height of the box. This is the last allocated height.
+ *
+ * @return the current height of the box
+ */
+ public int getHeight()
+ {
+ return height;
+ }
+
+ /**
+ * Sets the size of the view. If the actual size has changed, the layout
+ * is updated accordingly.
+ *
+ * @param width the new width
+ * @param height the new height
+ */
+ public void setSize(float width, float height)
+ {
+ if (this.width != (int) width)
+ layoutChanged(X_AXIS);
+ if (this.height != (int) height)
+ layoutChanged(Y_AXIS);
+
+ Rectangle outside = new Rectangle(0, 0, this.width, this.height);
+ Rectangle inside = getInsideAllocation(outside);
+ if (!isAllocationValid())
+ layout(inside.width, inside.height);
+ }
+
+ /**
+ * Sets the layout to valid for a specific axis.
+ *
+ * @param axis the axis for which to validate the layout
+ */
+ void validateLayout(int axis)
+ {
+ if (axis == X_AXIS)
+ xLayoutValid = true;
+ if (axis == Y_AXIS)
+ yLayoutValid = true;
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/CompositeView.java b/libjava/classpath/javax/swing/text/CompositeView.java
new file mode 100644
index 00000000000..6776c95727a
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/CompositeView.java
@@ -0,0 +1,652 @@
+/* CompositeView.java -- An abstract view that manages child views
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+import javax.swing.SwingConstants;
+
+/**
+ * An abstract base implementation of {@link View} that manages child
+ * <code>View</code>s.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public abstract class CompositeView
+ extends View
+{
+
+ /**
+ * The child views of this <code>CompositeView</code>.
+ */
+ View[] children;
+
+ /**
+ * The allocation of this <code>View</code> minus its insets. This is
+ * initialized in {@link #getInsideAllocation} and reused and modified in
+ * {@link childAllocation}.
+ */
+ Rectangle insideAllocation;
+
+ /**
+ * The insets of this <code>CompositeView</code>. This is initialized
+ * in {@link #setInsets}.
+ */
+ Insets insets;
+
+ /**
+ * Creates a new <code>CompositeView</code> for the given
+ * <code>Element</code>.
+ *
+ * @param element the element that is rendered by this CompositeView
+ */
+ public CompositeView(Element element)
+ {
+ super(element);
+ children = new View[0];
+ insets = new Insets(0, 0, 0, 0);
+ }
+
+ /**
+ * Loads the child views of this <code>CompositeView</code>. This method
+ * is called from {@link #setParent} to initialize the child views of
+ * this composite view.
+ *
+ * @param f the view factory to use for creating new child views
+ *
+ * @see #setParent
+ */
+ protected void loadChildren(ViewFactory f)
+ {
+ Element el = getElement();
+ int count = el.getElementCount();
+ View[] newChildren = new View[count];
+ for (int i = 0; i < count; ++i)
+ {
+ Element child = el.getElement(i);
+ View view = f.create(child);
+ newChildren[i] = view;
+ }
+ replace(0, getViewCount(), newChildren);
+ }
+
+ /**
+ * Sets the parent of this <code>View</code>.
+ * In addition to setting the parent, this calls {@link #loadChildren}, if
+ * this <code>View</code> does not already have its children initialized.
+ *
+ * @param parent the parent to set
+ */
+ public void setParent(View parent)
+ {
+ super.setParent(parent);
+ if (parent != null && ((children == null) || children.length == 0))
+ loadChildren(getViewFactory());
+ }
+
+ /**
+ * Returns the number of child views.
+ *
+ * @return the number of child views
+ */
+ public int getViewCount()
+ {
+ return children.length;
+ }
+
+ /**
+ * Returns the child view at index <code>n</code>.
+ *
+ * @param n the index of the requested child view
+ *
+ * @return the child view at index <code>n</code>
+ */
+ public View getView(int n)
+ {
+ return children[n];
+ }
+
+ /**
+ * Replaces child views by some other child views. If there are no views to
+ * remove (<code>length == 0</code>), the result is a simple insert, if
+ * there are no children to add (<code>view == null</code>) the result
+ * is a simple removal.
+ *
+ * @param offset the start offset from where to remove children
+ * @param length the number of children to remove
+ * @param views the views that replace the removed children
+ */
+ public void replace(int offset, int length, View[] views)
+ {
+ // Check for null views to add.
+ for (int i = 0; i < views.length; ++i)
+ if (views[i] == null)
+ throw new NullPointerException("Added views must not be null");
+
+ int endOffset = offset + length;
+
+ // First we set the parent of the removed children to null.
+ for (int i = offset; i < endOffset; ++i)
+ children[i].setParent(null);
+
+ View[] newChildren = new View[children.length - length + views.length];
+ System.arraycopy(children, 0, newChildren, 0, offset);
+ System.arraycopy(views, 0, newChildren, offset, views.length);
+ System.arraycopy(children, offset + length, newChildren,
+ offset + views.length,
+ children.length - (offset + length));
+ children = newChildren;
+
+ // Finally we set the parent of the added children to this.
+ for (int i = 0; i < views.length; ++i)
+ views[i].setParent(this);
+ }
+
+ /**
+ * Returns the allocation for the specified child <code>View</code>.
+ *
+ * @param index the index of the child view
+ * @param a the allocation for this view
+ *
+ * @return the allocation for the specified child <code>View</code>
+ */
+ public Shape getChildAllocation(int index, Shape a)
+ {
+ Rectangle r = getInsideAllocation(a);
+ childAllocation(index, r);
+ return r;
+ }
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param bias either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public Shape modelToView(int pos, Shape a, Position.Bias bias)
+ throws BadLocationException
+ {
+ int childIndex = getViewIndex(pos, bias);
+ if (childIndex != -1)
+ {
+ View child = getView(childIndex);
+ Shape result = child.modelToView(pos, a, bias);
+ if (result == null)
+ throw new AssertionError("" + child.getClass().getName()
+ + ".modelToView() must not return null");
+ return result;
+ }
+ else
+ {
+ // FIXME: Handle the case when we have no child view for the given
+ // position.
+ throw new AssertionError("No child views found where child views are "
+ + "expected. pos = " + pos + ", bias = "
+ + bias);
+ }
+ }
+
+ /**
+ * Maps a region in the document into the coordinate space of the View.
+ *
+ * @param p1 the beginning position inside the document
+ * @param b1 the direction bias for the beginning position
+ * @param p2 the end position inside the document
+ * @param b2 the direction bias for the end position
+ * @param a the area that is occupied by the view
+ *
+ * @return a rectangle that gives the span of the document region
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>p1</code> or <code>p2</code> are
+ * invalid
+ * @throws IllegalArgumentException if b1 or b2 is not one of the above
+ * listed valid values
+ */
+ public Shape modelToView(int p1, Position.Bias b1,
+ int p2, Position.Bias b2, Shape a)
+ throws BadLocationException
+ {
+ // TODO: This is most likely not 100% ok, figure out what else is to
+ // do here.
+ return super.modelToView(p1, b1, p2, b2, a);
+ }
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ Rectangle r = getInsideAllocation(a);
+ View view = getViewAtPoint((int) x, (int) y, r);
+ return view.viewToModel(x, y, a, b);
+ }
+
+ /**
+ * Returns the next model location that is visible in eiter north / south
+ * direction or east / west direction. This is used to determine the
+ * placement of the caret when navigating around the document with
+ * the arrow keys.
+ *
+ * This is a convenience method for
+ * {@link #getNextNorthSouthVisualPositionFrom} and
+ * {@link #getNextEastWestVisualPositionFrom}.
+ *
+ * @param pos the model position to start search from
+ * @param b the bias for <code>pos</code>
+ * @param a the allocated region for this view
+ * @param direction the direction from the current position, can be one of
+ * the following:
+ * <ul>
+ * <li>{@link SwingConstants#WEST}</li>
+ * <li>{@link SwingConstants#EAST}</li>
+ * <li>{@link SwingConstants#NORTH}</li>
+ * <li>{@link SwingConstants#SOUTH}</li>
+ * </ul>
+ * @param biasRet the bias of the return value gets stored here
+ *
+ * @return the position inside the model that represents the next visual
+ * location
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid location
+ * inside the document model
+ * @throws IllegalArgumentException if <code>direction</code> is invalid
+ */
+ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
+ int direction, Position.Bias[] biasRet)
+ {
+ int retVal = -1;
+ switch (direction)
+ {
+ case SwingConstants.WEST:
+ case SwingConstants.EAST:
+ retVal = getNextEastWestVisualPositionFrom(pos, b, a, direction,
+ biasRet);
+ break;
+ case SwingConstants.NORTH:
+ case SwingConstants.SOUTH:
+ retVal = getNextNorthSouthVisualPositionFrom(pos, b, a, direction,
+ biasRet);
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal value for direction.");
+ }
+ return retVal;
+ }
+
+ /**
+ * Returns the index of the child view that represents the specified
+ * model location.
+ *
+ * @param pos the model location for which to determine the child view index
+ * @param b the bias to be applied to <code>pos</code>
+ *
+ * @return the index of the child view that represents the specified
+ * model location
+ */
+ public int getViewIndex(int pos, Position.Bias b)
+ {
+ // FIXME: Handle bias somehow.
+ return getViewIndexAtPosition(pos);
+ }
+
+ /**
+ * Returns <code>true</code> if the specified point lies before the
+ * given <code>Rectangle</code>, <code>false</code> otherwise.
+ *
+ * &quot;Before&quot; is typically defined as being to the left or above.
+ *
+ * @param x the X coordinate of the point
+ * @param y the Y coordinate of the point
+ * @param r the rectangle to test the point against
+ *
+ * @return <code>true</code> if the specified point lies before the
+ * given <code>Rectangle</code>, <code>false</code> otherwise
+ */
+ protected abstract boolean isBefore(int x, int y, Rectangle r);
+
+ /**
+ * Returns <code>true</code> if the specified point lies after the
+ * given <code>Rectangle</code>, <code>false</code> otherwise.
+ *
+ * &quot;After&quot; is typically defined as being to the right or below.
+ *
+ * @param x the X coordinate of the point
+ * @param y the Y coordinate of the point
+ * @param r the rectangle to test the point against
+ *
+ * @return <code>true</code> if the specified point lies after the
+ * given <code>Rectangle</code>, <code>false</code> otherwise
+ */
+ protected abstract boolean isAfter(int x, int y, Rectangle r);
+
+ /**
+ * Returns the child <code>View</code> at the specified location.
+ *
+ * @param x the X coordinate
+ * @param y the Y coordinate
+ * @param r the inner allocation of this <code>BoxView</code> on entry,
+ * the allocation of the found child on exit
+ *
+ * @return the child <code>View</code> at the specified location
+ */
+ protected abstract View getViewAtPoint(int x, int y, Rectangle r);
+
+ /**
+ * Computes the allocation for a child <code>View</code>. The parameter
+ * <code>a</code> stores the allocation of this <code>CompositeView</code>
+ * and is then adjusted to hold the allocation of the child view.
+ *
+ * @param index the index of the child <code>View</code>
+ * @param a the allocation of this <code>CompositeView</code> before the
+ * call, the allocation of the child on exit
+ */
+ protected abstract void childAllocation(int index, Rectangle a);
+
+ /**
+ * Returns the child <code>View</code> that contains the given model
+ * position. The given <code>Rectangle</code> gives the parent's allocation
+ * and is changed to the child's allocation on exit.
+ *
+ * @param pos the model position to query the child <code>View</code> for
+ * @param a the parent allocation on entry and the child allocation on exit
+ *
+ * @return the child view at the given model position
+ */
+ protected View getViewAtPosition(int pos, Rectangle a)
+ {
+ int i = getViewIndexAtPosition(pos);
+ View view = children[i];
+ childAllocation(i, a);
+ return view;
+ }
+
+ /**
+ * Returns the index of the child <code>View</code> for the given model
+ * position.
+ *
+ * @param pos the model position for whicht the child <code>View</code> is
+ * queried
+ *
+ * @return the index of the child <code>View</code> for the given model
+ * position
+ */
+ protected int getViewIndexAtPosition(int pos)
+ {
+ // We have one child view allocated for each child element in
+ // loadChildren(), so this should work.
+ Element el = getElement();
+ int index = el.getElementIndex(pos);
+ return index;
+ }
+
+ /**
+ * Returns the allocation that is given to this <code>CompositeView</code>
+ * minus this <code>CompositeView</code>'s insets.
+ *
+ * Also this translates from an immutable allocation to a mutable allocation
+ * that is typically reused and further narrowed, like in
+ * {@link #childAllocation}.
+ *
+ * @param a the allocation given to this <code>CompositeView</code>
+ *
+ * @return the allocation that is given to this <code>CompositeView</code>
+ * minus this <code>CompositeView</code>'s insets or
+ * <code>null</code> if a was <code>null</code>
+ */
+ protected Rectangle getInsideAllocation(Shape a)
+ {
+ if (a == null)
+ return null;
+
+ Rectangle alloc = a.getBounds();
+ // Initialize the inside allocation rectangle. This is done inside
+ // a synchronized block in order to avoid multiple threads creating
+ // this instance simultanously.
+ Rectangle inside;
+ synchronized(this)
+ {
+ inside = insideAllocation;
+ if (inside == null)
+ {
+ inside = new Rectangle();
+ insideAllocation = inside;
+ }
+ }
+ inside.x = alloc.x - insets.left;
+ inside.y = alloc.y - insets.top;
+ inside.width = alloc.width - insets.left - insets.right;
+ inside.height = alloc.height - insets.top - insets.bottom;
+ return inside;
+ }
+
+ /**
+ * Sets the insets defined by attributes in <code>attributes</code>. This
+ * queries the attribute keys {@link StyleConstants#SpaceAbove},
+ * {@link StyleConstants#SpaceBelow}, {@link StyleConstants#LeftIndent} and
+ * {@link StyleConstants#RightIndent} and calls {@link #setInsets} to
+ * actually set the insets on this <code>CompositeView</code>.
+ *
+ * @param attributes the attributes from which to query the insets
+ */
+ protected void setParagraphInsets(AttributeSet attributes)
+ {
+ Float l = (Float) attributes.getAttribute(StyleConstants.LeftIndent);
+ short left = 0;
+ if (l != null)
+ left = l.shortValue();
+ Float r = (Float) attributes.getAttribute(StyleConstants.RightIndent);
+ short right = 0;
+ if (r != null)
+ right = r.shortValue();
+ Float t = (Float) attributes.getAttribute(StyleConstants.SpaceAbove);
+ short top = 0;
+ if (t != null)
+ top = t.shortValue();
+ Float b = (Float) attributes.getAttribute(StyleConstants.SpaceBelow);
+ short bottom = 0;
+ if (b != null)
+ bottom = b.shortValue();
+ setInsets(top, left, bottom, right);
+ }
+
+ /**
+ * Sets the insets of this <code>CompositeView</code>.
+ *
+ * @param top the top inset
+ * @param left the left inset
+ * @param bottom the bottom inset
+ * @param right the right inset
+ */
+ protected void setInsets(short top, short left, short bottom, short right)
+ {
+ insets.top = top;
+ insets.left = left;
+ insets.bottom = bottom;
+ insets.right = right;
+ }
+
+ /**
+ * Returns the left inset of this <code>CompositeView</code>.
+ *
+ * @return the left inset of this <code>CompositeView</code>
+ */
+ protected short getLeftInset()
+ {
+ return (short) insets.left;
+ }
+
+ /**
+ * Returns the right inset of this <code>CompositeView</code>.
+ *
+ * @return the right inset of this <code>CompositeView</code>
+ */
+ protected short getRightInset()
+ {
+ return (short) insets.right;
+ }
+
+ /**
+ * Returns the top inset of this <code>CompositeView</code>.
+ *
+ * @return the top inset of this <code>CompositeView</code>
+ */
+ protected short getTopInset()
+ {
+ return (short) insets.top;
+ }
+
+ /**
+ * Returns the bottom inset of this <code>CompositeView</code>.
+ *
+ * @return the bottom inset of this <code>CompositeView</code>
+ */
+ protected short getBottomInset()
+ {
+ return (short) insets.bottom;
+ }
+
+ /**
+ * Returns the next model location that is visible in north or south
+ * direction.
+ * This is used to determine the
+ * placement of the caret when navigating around the document with
+ * the arrow keys.
+ *
+ * @param pos the model position to start search from
+ * @param b the bias for <code>pos</code>
+ * @param a the allocated region for this view
+ * @param direction the direction from the current position, can be one of
+ * the following:
+ * <ul>
+ * <li>{@link SwingConstants#NORTH}</li>
+ * <li>{@link SwingConstants#SOUTH}</li>
+ * </ul>
+ * @param biasRet the bias of the return value gets stored here
+ *
+ * @return the position inside the model that represents the next visual
+ * location
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid location
+ * inside the document model
+ * @throws IllegalArgumentException if <code>direction</code> is invalid
+ */
+ protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
+ Shape a, int direction,
+ Position.Bias[] biasRet)
+ {
+ // FIXME: Implement this correctly.
+ return pos;
+ }
+
+ /**
+ * Returns the next model location that is visible in east or west
+ * direction.
+ * This is used to determine the
+ * placement of the caret when navigating around the document with
+ * the arrow keys.
+ *
+ * @param pos the model position to start search from
+ * @param b the bias for <code>pos</code>
+ * @param a the allocated region for this view
+ * @param direction the direction from the current position, can be one of
+ * the following:
+ * <ul>
+ * <li>{@link SwingConstants#EAST}</li>
+ * <li>{@link SwingConstants#WEST}</li>
+ * </ul>
+ * @param biasRet the bias of the return value gets stored here
+ *
+ * @return the position inside the model that represents the next visual
+ * location
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid location
+ * inside the document model
+ * @throws IllegalArgumentException if <code>direction</code> is invalid
+ */
+ protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
+ Shape a, int direction,
+ Position.Bias[] biasRet)
+ {
+ // FIXME: Implement this correctly.
+ return pos;
+ }
+
+ /**
+ * Determines if the next view in horinzontal direction is located to
+ * the east or west of the view at position <code>pos</code>. Usually
+ * the <code>View</code>s are laid out from the east to the west, so
+ * we unconditionally return <code>false</code> here. Subclasses that
+ * support bidirectional text may wish to override this method.
+ *
+ * @param pos the position in the document
+ * @param bias the bias to be applied to <code>pos</code>
+ *
+ * @return <code>true</code> if the next <code>View</code> is located
+ * to the EAST, <code>false</code> otherwise
+ */
+ protected boolean flipEastAndWestAtEnds(int pos, Position.Bias bias)
+ {
+ return false;
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/ElementIterator.java b/libjava/classpath/javax/swing/text/ElementIterator.java
new file mode 100644
index 00000000000..a6a5ff618bd
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/ElementIterator.java
@@ -0,0 +1,181 @@
+/* ElementIterator.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+/**
+ * This class can be used to iterate over the {@link Element} tree of
+ * a {@link Document} or an {@link Element}. This iterator performs
+ * an "in-order" traversal -- first it visits a node, then each of the
+ * node's children in order. No locking is performed during the
+ * iteration; that is up to the caller.
+ */
+public class ElementIterator implements Cloneable
+{
+ // The root element.
+ private Element root;
+ // The current element.
+ private Element currentElement;
+ // The depth to which we have descended in the tree.
+ private int currentDepth;
+
+ // This is at least as big as the current depth, and at index N
+ // contains the index of the child element we're currently
+ // examining.
+ private int[] state;
+
+ // The previous item.
+ private Element previousItem;
+
+ /**
+ * Create a new ElementIterator to iterate over the given document.
+ * @param document the Document over which we iterate
+ */
+ public ElementIterator(Document document)
+ {
+ this.root = document.getDefaultRootElement();
+ this.currentElement = root;
+ this.state = new int[5];
+ }
+
+ /**
+ * Create a new ElementIterator to iterate over the given document.
+ * @param root the Document over which we iterate
+ */
+ public ElementIterator(Element root)
+ {
+ this.root = root;
+ this.currentElement = root;
+ this.state = new int[5];
+ }
+
+ /**
+ * Returns a new ElementIterator which is a clone of this
+ * ElementIterator.
+ */
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException _)
+ {
+ // Can't happen.
+ return null;
+ }
+ }
+
+ /**
+ * Returns the current element.
+ */
+ public Element current()
+ {
+ return currentElement;
+ }
+
+ /**
+ * Returns the depth to which we have descended in the tree.
+ */
+ public int depth()
+ {
+ return currentDepth;
+ }
+
+ /**
+ * Returns the first element in the tree.
+ */
+ public Element first()
+ {
+ // Reset the iterator.
+ currentElement = root;
+ currentDepth = 0;
+ previousItem = null;
+ return root;
+ }
+
+ /**
+ * Advance the iterator and return the next element of the tree,
+ * performing an "in-order" traversal.
+ */
+ public Element next()
+ {
+ previousItem = currentElement;
+ if (currentElement == null)
+ return null;
+ if (! currentElement.isLeaf())
+ {
+ ++currentDepth;
+ if (currentDepth > state.length)
+ {
+ int[] newState = new int[state.length * 2];
+ System.arraycopy(state, 0, newState, 0, state.length);
+ state = newState;
+ }
+ state[currentDepth] = 0;
+ currentElement = currentElement.getElement(0);
+ return currentElement;
+ }
+
+ while (currentDepth > 0)
+ {
+ // At a leaf, or done with a non-leaf's children, so go up a
+ // level.
+ --currentDepth;
+ currentElement = currentElement.getParentElement();
+ ++state[currentDepth];
+ if (state[currentDepth] < currentElement.getElementCount())
+ {
+ currentElement = currentElement.getElement(state[currentDepth]);
+ return currentElement;
+ }
+ }
+
+ currentElement = null;
+ return currentElement;
+ }
+
+ /**
+ * Returns the previous item. Does not modify the iterator state.
+ */
+ public Element previous()
+ {
+ if (currentElement == null || currentElement == root)
+ return null;
+ return previousItem;
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/FlowView.java b/libjava/classpath/javax/swing/text/FlowView.java
new file mode 100644
index 00000000000..a6ef89efb78
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/FlowView.java
@@ -0,0 +1,617 @@
+/* FlowView.java -- A composite View
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.util.Vector;
+
+import javax.swing.event.DocumentEvent;
+
+/**
+ * A <code>View</code> that can flows it's children into it's layout space.
+ *
+ * The <code>FlowView</code> manages a set of logical views (that are
+ * the children of the {@link #layoutPool} field). These are translated
+ * at layout time into a set of physical views. These are the views that
+ * are managed as the real child views. Each of these child views represents
+ * a row and are laid out within a box using the superclasses behaviour.
+ * The concrete implementation of the rows must be provided by subclasses.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public abstract class FlowView extends BoxView
+{
+ /**
+ * A strategy for translating the logical views of a <code>FlowView</code>
+ * into the real views.
+ */
+ public static class FlowStrategy
+ {
+ /**
+ * Creates a new instance of <code>FlowStragegy</code>.
+ */
+ public FlowStrategy()
+ {
+ }
+
+ /**
+ * Receives notification from a <code>FlowView</code> that some content
+ * has been inserted into the document at a location that the
+ * <code>FlowView</code> is responsible for.
+ *
+ * The default implementation simply calls {@link #layout}.
+ *
+ * @param fv the flow view that sends the notification
+ * @param e the document event describing the change
+ * @param alloc the current allocation of the flow view
+ */
+ public void insertUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
+ {
+ layout(fv);
+ }
+
+ /**
+ * Receives notification from a <code>FlowView</code> that some content
+ * has been removed from the document at a location that the
+ * <code>FlowView</code> is responsible for.
+ *
+ * The default implementation simply calls {@link #layout}.
+ *
+ * @param fv the flow view that sends the notification
+ * @param e the document event describing the change
+ * @param alloc the current allocation of the flow view
+ */
+ public void removeUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
+ {
+ layout(fv);
+ }
+
+ /**
+ * Receives notification from a <code>FlowView</code> that some attributes
+ * have changed in the document at a location that the
+ * <code>FlowView</code> is responsible for.
+ *
+ * The default implementation simply calls {@link #layout}.
+ *
+ * @param fv the flow view that sends the notification
+ * @param e the document event describing the change
+ * @param alloc the current allocation of the flow view
+ */
+ public void changedUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
+ {
+ layout(fv);
+ }
+
+ /**
+ * Returns the logical view of the managed <code>FlowView</code>.
+ *
+ * @param fv the flow view for which to return the logical view
+ *
+ * @return the logical view of the managed <code>FlowView</code>
+ */
+ public View getLogicalView(FlowView fv)
+ {
+ return fv.layoutPool;
+ }
+
+ /**
+ * Performs the layout for the whole view. By default this rebuilds
+ * all the physical views from the logical views of the managed FlowView.
+ *
+ * This is called by {@link FlowLayout#layout} to update the layout of
+ * the view.
+ *
+ * @param fv the flow view for which we perform the layout
+ */
+ public void layout(FlowView fv)
+ {
+ fv.removeAll();
+ Element el = fv.getElement();
+
+ int rowStart = el.getStartOffset();
+ int end = el.getEndOffset();
+ int rowIndex = 0;
+ while (rowStart >= 0 && rowStart < end)
+ {
+ View row = fv.createRow();
+ fv.append(row);
+ rowStart = layoutRow(fv, rowIndex, rowStart);
+ rowIndex++;
+ }
+ }
+
+ /**
+ * Lays out one row of the flow view. This is called by {@link #layout}
+ * to fill one row with child views until the available span is exhausted.
+ *
+ * @param fv the flow view for which we perform the layout
+ * @param rowIndex the index of the row
+ * @param pos the start position for the row
+ *
+ * @return the start position of the next row
+ */
+ protected int layoutRow(FlowView fv, int rowIndex, int pos)
+ {
+ int spanLeft = fv.getFlowSpan(rowIndex);
+ if (spanLeft <= 0)
+ return -1;
+
+ int offset = pos;
+ View row = fv.getView(rowIndex);
+ int flowAxis = fv.getFlowAxis();
+
+ while (spanLeft > 0)
+ {
+ View child = createView(fv, offset, spanLeft, rowIndex);
+ if (child == null)
+ break;
+
+ int span = (int) child.getPreferredSpan(flowAxis);
+ if (span > spanLeft)
+ break;
+
+ row.append(child);
+ spanLeft -= span;
+ offset = child.getEndOffset();
+ }
+ return offset;
+ }
+
+ /**
+ * Creates physical views that form the rows of the flow view. This
+ * can be an entire view from the logical view (if it fits within the
+ * available span), a fragment of such a view (if it doesn't fit in the
+ * available span and can be broken down) or <code>null</code> (if it does
+ * not fit in the available span and also cannot be broken down).
+ *
+ * @param fv the flow view
+ * @param startOffset the start offset for the view to be created
+ * @param spanLeft the available span
+ * @param rowIndex the index of the row
+ *
+ * @return a view to fill the row with, or <code>null</code> if there
+ * is no view or view fragment that fits in the available span
+ */
+ protected View createView(FlowView fv, int offset, int spanLeft,
+ int rowIndex)
+ {
+ // Find the logical element for the given offset.
+ View logicalView = getLogicalView(fv);
+
+ int viewIndex = logicalView.getViewIndex(offset, Position.Bias.Forward);
+ View child = logicalView.getView(viewIndex);
+ int flowAxis = fv.getFlowAxis();
+ int span = (int) child.getPreferredSpan(flowAxis);
+
+ if (span <= spanLeft)
+ return child;
+
+ else if (child.getBreakWeight(flowAxis, offset, spanLeft)
+ > BadBreakWeight)
+ // FIXME: What to do with the pos parameter here?
+ return child.breakView(flowAxis, offset, 0, spanLeft);
+ else
+ return null;
+ }
+ }
+
+ /**
+ * This special subclass of <code>View</code> is used to represent
+ * the logical representation of this view. It does not support any
+ * visual representation, this is handled by the physical view implemented
+ * in the <code>FlowView</code>.
+ */
+ class LogicalView extends View
+ {
+ /**
+ * The child views of this logical view.
+ */
+ Vector children;
+
+ /**
+ * Creates a new LogicalView instance.
+ */
+ LogicalView(Element el)
+ {
+ super(el);
+ children = new Vector();
+ }
+
+ /**
+ * Returns the container that holds this view. The logical view returns
+ * the enclosing FlowView's container here.
+ *
+ * @return the container that holds this view
+ */
+ public Container getContainer()
+ {
+ return FlowView.this.getContainer();
+ }
+
+ /**
+ * Returns the number of child views of this logical view.
+ *
+ * @return the number of child views of this logical view
+ */
+ public int getViewCount()
+ {
+ return children.size();
+ }
+
+ /**
+ * Returns the child view at the specified index.
+ *
+ * @param index the index
+ *
+ * @return the child view at the specified index
+ */
+ public View getView(int index)
+ {
+ return (View) children.get(index);
+ }
+
+ /**
+ * Replaces some child views with other child views.
+ *
+ * @param offset the offset at which to replace child views
+ * @param length the number of children to remove
+ * @param views the views to be inserted
+ */
+ public void replace(int offset, int length, View[] views)
+ {
+ if (length > 0)
+ {
+ for (int count = 0; count < length; ++count)
+ children.remove(offset);
+ }
+
+ int endOffset = offset + views.length;
+ for (int i = offset; i < endOffset; ++i)
+ {
+ children.add(i, views[i - offset]);
+ // Set the parent of the child views to the flow view itself so
+ // it has something to resolve.
+ views[i - offset].setParent(FlowView.this);
+ }
+ }
+
+ /**
+ * Returns the index of the child view that contains the specified
+ * position in the document model.
+ *
+ * @param pos the position for which we are searching the child view
+ * @param b the bias
+ *
+ * @return the index of the child view that contains the specified
+ * position in the document model
+ */
+ public int getViewIndex(int pos, Position.Bias b)
+ {
+ return getElement().getElementIndex(pos);
+ }
+
+ /**
+ * Throws an AssertionError because it must never be called. LogicalView
+ * only serves as a holder for child views and has no visual
+ * representation.
+ */
+ public float getPreferredSpan(int axis)
+ {
+ throw new AssertionError("This method must not be called in "
+ + "LogicalView.");
+ }
+
+ /**
+ * Throws an AssertionError because it must never be called. LogicalView
+ * only serves as a holder for child views and has no visual
+ * representation.
+ */
+ public Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ throw new AssertionError("This method must not be called in "
+ + "LogicalView.");
+ }
+
+ /**
+ * Throws an AssertionError because it must never be called. LogicalView
+ * only serves as a holder for child views and has no visual
+ * representation.
+ */
+ public void paint(Graphics g, Shape s)
+ {
+ throw new AssertionError("This method must not be called in "
+ + "LogicalView.");
+ }
+
+ /**
+ * Throws an AssertionError because it must never be called. LogicalView
+ * only serves as a holder for child views and has no visual
+ * representation.
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ throw new AssertionError("This method must not be called in "
+ + "LogicalView.");
+ }
+ }
+
+ /**
+ * The shared instance of FlowStrategy.
+ */
+ static final FlowStrategy sharedStrategy = new FlowStrategy();
+
+ /**
+ * The span of the <code>FlowView</code> that should be flowed.
+ */
+ protected int layoutSpan;
+
+ /**
+ * Represents the logical child elements of this view, encapsulated within
+ * one parent view (an instance of a package private <code>LogicalView</code>
+ * class). These will be translated to a set of real views that are then
+ * displayed on screen. This translation is performed by the inner class
+ * {@link FlowStrategy}.
+ */
+ protected View layoutPool;
+
+ /**
+ * The <code>FlowStrategy</code> to use for translating between the
+ * logical and physical view.
+ */
+ protected FlowStrategy strategy;
+
+ /**
+ * Creates a new <code>FlowView</code> for the given
+ * <code>Element</code> and <code>axis</code>.
+ *
+ * @param element the element that is rendered by this FlowView
+ * @param axis the axis along which the view is tiled, either
+ * <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>, the flow
+ * axis is orthogonal to this one
+ */
+ public FlowView(Element element, int axis)
+ {
+ super(element, axis);
+ strategy = sharedStrategy;
+ }
+
+ /**
+ * Returns the axis along which the view should be flowed. This is
+ * orthogonal to the axis along which the boxes are tiled.
+ *
+ * @return the axis along which the view should be flowed
+ */
+ public int getFlowAxis()
+ {
+ int axis = getAxis();
+ int flowAxis;
+
+ if (axis == X_AXIS)
+ flowAxis = Y_AXIS;
+ else
+ flowAxis = X_AXIS;
+
+ return flowAxis;
+
+ }
+
+ /**
+ * Returns the span of the flow for the specified child view. A flow
+ * layout can be shaped by providing different span values for different
+ * child indices. The default implementation returns the entire available
+ * span inside the view.
+ *
+ * @param index the index of the child for which to return the span
+ *
+ * @return the span of the flow for the specified child view
+ */
+ public int getFlowSpan(int index)
+ {
+ return layoutSpan;
+ }
+
+ /**
+ * Returns the location along the flow axis where the flow span starts
+ * given a child view index. The flow can be shaped by providing
+ * different values here.
+ *
+ * @param index the index of the child for which to return the flow location
+ *
+ * @return the location along the flow axis where the flow span starts
+ */
+ public int getFlowStart(int index)
+ {
+ return getLeftInset(); // TODO: Is this correct?
+ }
+
+ /**
+ * Creates a new view that represents a row within a flow.
+ *
+ * @return a view for a new row
+ */
+ protected abstract View createRow();
+
+ /**
+ * Loads the children of this view. The <code>FlowView</code> does not
+ * directly load its children. Instead it creates a logical view
+ * (@{link #layoutPool}) which is filled by the logical child views.
+ * The real children are created at layout time and each represent one
+ * row.
+ *
+ * This method is called by {@link #setParent} in order to initialize
+ * the view.
+ *
+ * @param vf the view factory to use for creating the child views
+ */
+ protected void loadChildren(ViewFactory vf)
+ {
+ if (layoutPool == null)
+ {
+ layoutPool = new LogicalView(getElement());
+
+ Element el = getElement();
+ int count = el.getElementCount();
+ for (int i = 0; i < count; ++i)
+ {
+ Element childEl = el.getElement(i);
+ View childView = vf.create(childEl);
+ layoutPool.append(childView);
+ }
+ }
+ }
+
+ /**
+ * Performs the layout of this view. If the span along the flow axis changed,
+ * this first calls {@link FlowStrategy.layout} in order to rebuild the
+ * rows of this view. Then the superclass's behaviour is called to arrange
+ * the rows within the box.
+ *
+ * @param width the width of the view
+ * @param height the height of the view
+ */
+ protected void layout(int width, int height)
+ {
+ boolean rebuild = false;
+
+ int flowAxis = getFlowAxis();
+ if (flowAxis == X_AXIS)
+ {
+ rebuild = !(width == layoutSpan);
+ layoutSpan = width;
+ }
+ else
+ {
+ rebuild = !(height == layoutSpan);
+ layoutSpan = height;
+ }
+
+ if (rebuild)
+ strategy.layout(this);
+
+ // TODO: If the span along the box axis has changed in the process of
+ // relayouting the rows (that is, if rows have been added or removed),
+ // call preferenceChanged in order to throw away cached layout information
+ // of the surrounding BoxView.
+
+ super.layout(width, height);
+ }
+
+ /**
+ * Receice notification that some content has been inserted in the region
+ * that this view is responsible for. This calls
+ * {@link FlowStrategy#insertUpdate}.
+ *
+ * @param changes the document event describing the changes
+ * @param a the current allocation of the view
+ * @param vf the view factory that is used for creating new child views
+ */
+ public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory vf)
+ {
+ strategy.insertUpdate(this, changes, getInsideAllocation(a));
+ }
+
+ /**
+ * Receice notification that some content has been removed from the region
+ * that this view is responsible for. This calls
+ * {@link FlowStrategy#removeUpdate}.
+ *
+ * @param changes the document event describing the changes
+ * @param a the current allocation of the view
+ * @param vf the view factory that is used for creating new child views
+ */
+ public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory vf)
+ {
+ strategy.removeUpdate(this, changes, getInsideAllocation(a));
+ }
+
+ /**
+ * Receice notification that some attributes changed in the region
+ * that this view is responsible for. This calls
+ * {@link FlowStrategy#changedUpdate}.
+ *
+ * @param changes the document event describing the changes
+ * @param a the current allocation of the view
+ * @param vf the view factory that is used for creating new child views
+ */
+ public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory vf)
+ {
+ strategy.changedUpdate(this, changes, getInsideAllocation(a));
+ }
+
+ /**
+ * Returns the index of the child <code>View</code> for the given model
+ * position.
+ *
+ * This is implemented to iterate over the children of this
+ * view (the rows) and return the index of the first view that contains
+ * the given position.
+ *
+ * @param pos the model position for whicht the child <code>View</code> is
+ * queried
+ *
+ * @return the index of the child <code>View</code> for the given model
+ * position
+ */
+ protected int getViewIndexAtPosition(int pos)
+ {
+ // First make sure we have a valid layout.
+ if (!isAllocationValid())
+ layout(getWidth(), getHeight());
+
+ int count = getViewCount();
+ int result = -1;
+
+ for (int i = 0; i < count; ++i)
+ {
+ View child = getView(i);
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ if (start <= pos && end > pos)
+ {
+ result = i;
+ break;
+ }
+ }
+ return result;
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/GlyphView.java b/libjava/classpath/javax/swing/text/GlyphView.java
new file mode 100644
index 00000000000..f9e60972d84
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/GlyphView.java
@@ -0,0 +1,521 @@
+/* GlyphView.java -- A view to render styled text
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+/**
+ * Renders a run of styled text. This {@link View} subclass paints the
+ * characters of the <code>Element</code> it is responsible for using
+ * the style information from that <code>Element</code>.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public class GlyphView
+ extends View
+ implements TabableView, Cloneable
+{
+
+ /**
+ * An abstract base implementation for a glyph painter for
+ * <code>GlyphView</code>.
+ */
+ public abstract static class GlyphPainter
+ {
+ /**
+ * Creates a new <code>GlyphPainer</code>.
+ */
+ public GlyphPainter()
+ {
+ }
+
+ /**
+ * Returns the full height of the rendered text.
+ *
+ * @return the full height of the rendered text
+ */
+ public abstract float getHeight(GlyphView view);
+
+ /**
+ * Paints the glyphs.
+ *
+ * @param view the glyph view to paint
+ * @param g the graphics context to use for painting
+ * @param a the allocation of the glyph view
+ * @param p0 the start position (in the model) from which to paint
+ * @param p1 the end position (in the model) to which to paint
+ */
+ public abstract void paint(GlyphView view, Graphics g, Shape a, int p0,
+ int p1);
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param view the glyph view
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param bias either {@link Position.Bias.Forward} or
+ * {@link Position.Bias.Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public abstract Shape modelToView(GlyphView view, int pos, Position.Bias b,
+ Shape a)
+ throws BadLocationException;
+
+ /**
+ * Determine the span of the glyphs from location <code>p0</code> to
+ * location <code>p1</code>. If <code>te</code> is not <code>null</code>,
+ * then TABs are expanded using this <code>TabExpander</code>.
+ * The parameter <code>x</code> is the location at which the view is
+ * located (this is important when using TAB expansion).
+ *
+ * @param view the glyph view
+ * @param p0 the starting location in the document model
+ * @param p0 the end location in the document model
+ * @param te the tab expander to use
+ * @param x the location at which the view is located
+ *
+ * @return the span of the glyphs from location <code>p0</code> to
+ * location <code>p1</code>, possibly using TAB expansion
+ */
+ public abstract float getSpan(GlyphView view, int p0, int p1,
+ TabExpander te, float x);
+
+ }
+
+ /**
+ * The default <code>GlyphPainter</code> used in <code>GlyphView</code>.
+ */
+ static class DefaultGlyphPainter extends GlyphPainter
+ {
+ /**
+ * Returns the full height of the rendered text.
+ *
+ * @return the full height of the rendered text
+ */
+ public float getHeight(GlyphView view)
+ {
+ Font font = view.getFont();
+ FontMetrics metrics = view.getContainer().getFontMetrics(font);
+ float height = metrics.getHeight();
+ return height;
+ }
+
+ /**
+ * Paints the glyphs.
+ *
+ * @param view the glyph view to paint
+ * @param g the graphics context to use for painting
+ * @param a the allocation of the glyph view
+ * @param p0 the start position (in the model) from which to paint
+ * @param p1 the end position (in the model) to which to paint
+ */
+ public void paint(GlyphView view, Graphics g, Shape a, int p0,
+ int p1)
+ {
+ int height = (int) getHeight(view);
+ Segment txt = view.getText(p0, p1);
+ Rectangle bounds = a.getBounds();
+
+ TabExpander tabEx = null;
+ View parent = view.getParent();
+ if (parent instanceof TabExpander)
+ tabEx = (TabExpander) parent;
+
+ // FIXME: Set character attributes like font-family, font-size, colors.
+ Color foreground = view.getForeground();
+ g.setColor(foreground);
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx,
+ txt.offset);
+ }
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param view the glyph view
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param bias either {@link Position.Bias.Forward} or
+ * {@link Position.Bias.Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public Shape modelToView(GlyphView view, int pos, Position.Bias b,
+ Shape a)
+ throws BadLocationException
+ {
+ Element el = view.getElement();
+ Font font = view.getFont();
+ FontMetrics fm = view.getContainer().getFontMetrics(font);
+ Segment txt = view.getText(el.getStartOffset(), pos);
+ int width = fm.charsWidth(txt.array, txt.offset, txt.count);
+ int height = fm.getHeight();
+ Rectangle bounds = a.getBounds();
+ Rectangle result = new Rectangle(bounds.x + width, bounds.y,
+ bounds.x + width, height);
+ return result;
+ }
+
+ /**
+ * Determine the span of the glyphs from location <code>p0</code> to
+ * location <code>p1</code>. If <code>te</code> is not <code>null</code>,
+ * then TABs are expanded using this <code>TabExpander</code>.
+ * The parameter <code>x</code> is the location at which the view is
+ * located (this is important when using TAB expansion).
+ *
+ * @param view the glyph view
+ * @param p0 the starting location in the document model
+ * @param p0 the end location in the document model
+ * @param te the tab expander to use
+ * @param x the location at which the view is located
+ *
+ * @return the span of the glyphs from location <code>p0</code> to
+ * location <code>p1</code>, possibly using TAB expansion
+ */
+ public float getSpan(GlyphView view, int p0, int p1,
+ TabExpander te, float x)
+ {
+ Element el = view.getElement();
+ Font font = view.getFont();
+ FontMetrics fm = view.getContainer().getFontMetrics(font);
+ Segment txt = view.getText(p0, p1);
+ int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0);
+ return span;
+ }
+ }
+
+ /**
+ * The GlyphPainer used for painting the glyphs.
+ */
+ GlyphPainter glyphPainter;
+
+ /**
+ * Creates a new <code>GlyphView</code> for the given <code>Element</code>.
+ *
+ * @param element the element that is rendered by this GlyphView
+ */
+ public GlyphView(Element element)
+ {
+ super(element);
+ }
+
+ /**
+ * Returns the <code>GlyphPainter</code> that is used by this
+ * <code>GlyphView</code>. If no <code>GlyphPainer</code> has been installed
+ * <code>null</code> is returned.
+ *
+ * @return the glyph painter that is used by this
+ * glyph view or <code>null</code> if no glyph painter has been
+ * installed
+ */
+ public GlyphPainter getGlyphPainter()
+ {
+ return glyphPainter;
+ }
+
+ /**
+ * Sets the {@link GlyphPainter} to be used for this <code>GlyphView</code>.
+ *
+ * @param painter the glyph painter to be used for this glyph view
+ */
+ public void setGlyphPainter(GlyphPainter painter)
+ {
+ glyphPainter = painter;
+ }
+
+ /**
+ * Checks if a <code>GlyphPainer</code> is installed. If this is not the
+ * case, a default painter is installed.
+ */
+ protected void checkPainter()
+ {
+ if (glyphPainter == null)
+ glyphPainter = new DefaultGlyphPainter();
+ }
+
+ /**
+ * Renders the <code>Element</code> that is associated with this
+ * <code>View</code>.
+ *
+ * @param g the <code>Graphics</code> context to render to
+ * @param a the allocated region for the <code>Element</code>
+ */
+ public void paint(Graphics g, Shape a)
+ {
+ Element el = getElement();
+ checkPainter();
+ getGlyphPainter().paint(this, g, a, el.getStartOffset(),
+ el.getEndOffset());
+ }
+
+
+ /**
+ * Returns the preferred span of the content managed by this
+ * <code>View</code> along the specified <code>axis</code>.
+ *
+ * @param axis the axis
+ *
+ * @return the preferred span of this <code>View</code>.
+ */
+ public float getPreferredSpan(int axis)
+ {
+ Element el = getElement();
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ TabExpander tabEx = null;
+ View parent = getParent();
+ if (parent instanceof TabExpander)
+ tabEx = (TabExpander) parent;
+ // FIXME: Figure out how to determine the x parameter.
+ float span = painter.getSpan(this, el.getStartOffset(), el.getEndOffset(),
+ tabEx, 0.F);
+ return span;
+ }
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ GlyphPainter p = getGlyphPainter();
+ return p.modelToView(this, pos, b, a);
+ }
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ // FIXME: not implemented
+ return 0;
+ }
+
+ /**
+ * Return the {@link TabExpander} to use.
+ *
+ * @return the {@link TabExpander} to use
+ */
+ public TabExpander getTabExpander()
+ {
+ // TODO: Figure out if this is correct.
+ TabExpander te = null;
+ View parent = getParent();
+
+ if (parent instanceof ParagraphView)
+ te = (ParagraphView) parent;
+
+ return te;
+ }
+
+ /**
+ * Returns the preferred span of this view for tab expansion.
+ *
+ * @param x the location of the view
+ * @param te the tab expander to use
+ *
+ * @return the preferred span of this view for tab expansion
+ */
+ public float getTabbedSpan(float x, TabExpander te)
+ {
+ Element el = getElement();
+ return getGlyphPainter().getSpan(this, el.getStartOffset(),
+ el.getEndOffset(), te, x);
+ }
+
+ /**
+ * Returns the span of a portion of the view. This is used in TAB expansion
+ * for fragments that don't contain TABs.
+ *
+ * @param p0 the start index
+ * @param p1 the end index
+ *
+ * @return the span of the specified portion of the view
+ */
+ public float getPartialSpan(int p0, int p1)
+ {
+ Element el = getElement();
+ Document doc = el.getDocument();
+ Segment seg = new Segment();
+ try
+ {
+ doc.getText(p0, p1 - p0, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ throw new AssertionError("BadLocationException must not be thrown "
+ + "here");
+ }
+ FontMetrics fm = null; // Fetch font metrics somewhere.
+ return Utilities.getTabbedTextWidth(seg, fm, 0, null, p0);
+ }
+
+ /**
+ * Returns the starting offset in the document model of the portion
+ * of text that this view is responsible for.
+ *
+ * @return the starting offset in the document model of the portion
+ * of text that this view is responsible for
+ */
+ public int getBeginIndex()
+ {
+ return getElement().getStartOffset();
+ }
+
+ /**
+ * Returns the end offset in the document model of the portion
+ * of text that this view is responsible for.
+ *
+ * @return the end offset in the document model of the portion
+ * of text that this view is responsible for
+ */
+ public int getEndIndex()
+ {
+ return getElement().getEndOffset();
+ }
+
+ /**
+ * Returns the text segment that this view is responsible for.
+ *
+ * @param p0 the start index in the document model
+ * @param p1 the end index in the document model
+ *
+ * @return the text segment that this view is responsible for
+ */
+ public Segment getText(int p0, int p1)
+ {
+ Segment txt = new Segment();
+ try
+ {
+ getDocument().getText(p0, p1 - p0, txt);
+ }
+ catch (BadLocationException ex)
+ {
+ throw new AssertionError("BadLocationException should not be "
+ + "thrown here. p0 = " + p0 + ", p1 = " + p1);
+ }
+
+ return txt;
+ }
+
+ /**
+ * Returns the font for the text run for which this <code>GlyphView</code>
+ * is responsible.
+ *
+ * @return the font for the text run for which this <code>GlyphView</code>
+ * is responsible
+ */
+ public Font getFont()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ String family = StyleConstants.getFontFamily(atts);
+ int size = StyleConstants.getFontSize(atts);
+ int style = Font.PLAIN;
+ if (StyleConstants.isBold(atts))
+ style |= Font.BOLD;
+ if (StyleConstants.isItalic(atts))
+ style |= Font.ITALIC;
+ Font font = new Font(family, style, size);
+ return font;
+ }
+
+ /**
+ * Returns the foreground color which should be used to paint the text.
+ * This is fetched from the associated element's text attributes using
+ * {@link StyleConstants#getForeground}.
+ *
+ * @return the foreground color which should be used to paint the text
+ */
+ public Color getForeground()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.getForeground(atts);
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/IconView.java b/libjava/classpath/javax/swing/text/IconView.java
new file mode 100644
index 00000000000..c7e22b6c3eb
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/IconView.java
@@ -0,0 +1,128 @@
+/* IconView.java -- A view to render icons
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Graphics;
+import java.awt.Shape;
+
+// TODO: Implement this class.
+public class IconView
+ extends View
+{
+
+ /**
+ * Creates a new <code>IconView</code> for the given <code>Element</code>.
+ *
+ * @param element the element that is rendered by this IconView
+ */
+ public IconView(Element element)
+ {
+ super(element);
+ }
+
+ /**
+ * Renders the <code>Element</code> that is associated with this
+ * <code>View</code>.
+ *
+ * @param g the <code>Graphics</code> context to render to
+ * @param a the allocated region for the <code>Element</code>
+ */
+ public void paint(Graphics g, Shape a)
+ {
+ // TODO: Implement me.
+ }
+
+ /**
+ * Returns the preferred span of the content managed by this
+ * <code>View</code> along the specified <code>axis</code>.
+ *
+ * @param axis the axis
+ *
+ * @return the preferred span of this <code>View</code>.
+ */
+ public float getPreferredSpan(int axis)
+ {
+ // TODO: Implement me.
+ return 0F;
+ }
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ // Implement me.
+ return null;
+ }
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ // FIXME: not implemented
+ return 0;
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/LabelView.java b/libjava/classpath/javax/swing/text/LabelView.java
new file mode 100644
index 00000000000..a10391613cd
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/LabelView.java
@@ -0,0 +1,54 @@
+/* LabelView.java -- A view to render styled text
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+// TODO: Implement this class.
+public class LabelView
+ extends GlyphView
+{
+ /**
+ * Creates a new <code>GlyphView</code> for the given <code>Element</code>.
+ *
+ * @param element the element that is rendered by this GlyphView
+ */
+ public LabelView(Element element)
+ {
+ super(element);
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/LayoutQueue.java b/libjava/classpath/javax/swing/text/LayoutQueue.java
new file mode 100644
index 00000000000..83433b6eef5
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/LayoutQueue.java
@@ -0,0 +1,115 @@
+/* LayoutQueue.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.util.LinkedList;
+
+/**
+ * This is a queue which holds {@link Runnable} objects. It is
+ * intended for deferring layout operations.
+ */
+public class LayoutQueue
+{
+ // The default layout queue.
+ private static LayoutQueue defaultQueue = new LayoutQueue();
+
+ // The queue of tasks.
+ private LinkedList list = new LinkedList();
+
+ /**
+ * Create a new layout queue.
+ */
+ public LayoutQueue()
+ {
+ }
+
+ /**
+ * Add a layout task to the queue.
+ */
+ public void addTask(Runnable task)
+ {
+ synchronized (list)
+ {
+ list.addLast(task);
+ list.notify();
+ }
+ }
+
+ /**
+ * Called by a worker thread to retrieve the next layout task. This
+ * will block until a new task is available. This method will
+ * return null if the thread is interrupted while waiting.
+ */
+ protected Runnable waitForWork()
+ {
+ synchronized (list)
+ {
+ while (list.size() == 0)
+ {
+ try
+ {
+ list.wait();
+ }
+ catch (InterruptedException _)
+ {
+ // This seemed like a good idea, but it has not been
+ // tested on the JDK.
+ return null;
+ }
+ }
+ return (Runnable) list.removeFirst();
+ }
+ }
+
+ /**
+ * Return the default layout queue.
+ */
+ public static synchronized LayoutQueue getDefaultQueue()
+ {
+ return defaultQueue;
+ }
+
+ /**
+ * Set the default layout queue.
+ */
+ public static synchronized void setDefaultQueue(LayoutQueue q)
+ {
+ defaultQueue = q;
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/ParagraphView.java b/libjava/classpath/javax/swing/text/ParagraphView.java
new file mode 100644
index 00000000000..6c6006a2a0f
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/ParagraphView.java
@@ -0,0 +1,89 @@
+/* ParagraphView.java -- A composite View
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+/**
+ * A {@link FlowView} that flows it's children horizontally and boxes the rows
+ * vertically.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public class ParagraphView extends FlowView implements TabExpander
+{
+ /**
+ * A specialized horizontal <code>BoxView</code> that represents exactly
+ * one row in a <code>ParagraphView</code>.
+ */
+ class Row extends BoxView
+ {
+ /**
+ * Creates a new instance of <code>Row</code>.
+ */
+ Row(Element el)
+ {
+ super(el, X_AXIS);
+ }
+ }
+
+ /**
+ * Creates a new <code>ParagraphView</code> for the given
+ * <code>Element</code>.
+ *
+ * @param element the element that is rendered by this ParagraphView
+ */
+ public ParagraphView(Element element)
+ {
+ super(element, Y_AXIS);
+ }
+
+ public float nextTabStop(float x, int tabOffset)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+
+ /**
+ * Creates a new view that represents a row within a flow.
+ *
+ * @return a view for a new row
+ */
+ protected View createRow()
+ {
+ return new Row(getElement());
+ }
+}