diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-09 04:26:17 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-09 04:26:17 +0000 |
commit | 71946bc3b406beb3d1fb9b447204e4236d645c43 (patch) | |
tree | cdf9958b411887bead2263ea8ef0bdfc8eae6319 /libjava/javax | |
parent | 0fc014c9ce8232f14be66144bf5a4c08a3e5ffe7 (diff) | |
download | gcc-71946bc3b406beb3d1fb9b447204e4236d645c43.tar.gz |
AWT/Swing merge from GNU Classpath.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/javax')
309 files changed, 50248 insertions, 0 deletions
diff --git a/libjava/javax/accessibility/Accessible.java b/libjava/javax/accessibility/Accessible.java new file mode 100644 index 00000000000..1c407a682f5 --- /dev/null +++ b/libjava/javax/accessibility/Accessible.java @@ -0,0 +1,61 @@ +/* Accessible.java -- primary Java accessibility interface + Copyright (C) 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Implementing the Accessibility API must start with implementation + * of this interface at a bare minimum. This is the major interface + * for the Accessibility API which must be implemented by all user + * interface components. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @since 1.2 + * @status updated to 1.4 + */ +public interface Accessible +{ + /** + * If a component supports the Accessibility API then this method should + * not return <code>null</code>. Only classes which must extend an accessible + * class, but must not itself be accessible, may return null. + * + * @return the context associated with this accessible object + */ + AccessibleContext getAccessibleContext(); +} // interface Accessible diff --git a/libjava/javax/accessibility/AccessibleAction.java b/libjava/javax/accessibility/AccessibleAction.java new file mode 100644 index 00000000000..b05883aa98c --- /dev/null +++ b/libjava/javax/accessibility/AccessibleAction.java @@ -0,0 +1,82 @@ +/* AccessibleAction.java -- aids in accessibly performing actions + Copyright (C) 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * If an object implements this interface then it must be able to perform one + * or more actions. Accessibility software can use the implementations of this + * interface to discover and perform actions on an object. + * + * <p>The <code>AccessibleContext.getAccessibleAction()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleAction() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleAction +{ + /** + * Get the number possible actions for this object, with the zeroth + * representing the default action. + * + * @return the 0-based number of actions + */ + int getAccessibleActionCount(); + + /** + * Get a description for the specified action. Returns null if out of + * bounds. + * + * @param i the action to describe, 0-based + * @return description of the action + */ + String getAccessibleActionDescription(int i); + + /** + * Perform the specified action. Does nothing if out of bounds. + * + * @param i the action to perform, 0-based + * @return true if the action was performed + */ + boolean doAccessibleAction(int i); +} // interface AccessibleAction diff --git a/libjava/javax/accessibility/AccessibleBundle.java b/libjava/javax/accessibility/AccessibleBundle.java new file mode 100644 index 00000000000..11b9cb38efa --- /dev/null +++ b/libjava/javax/accessibility/AccessibleBundle.java @@ -0,0 +1,120 @@ +/* AccessibleBundle.java -- base class for accessibility "enumerations" + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.util.Locale; + +/** + * This serves as a base class for accessibility "enumerations". These + * objects are strongly typed; to make up for the lack of true enums in Java. + * Display should be locale dependent. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see AccessibleRole + * @see AccessibleState + * @since 1.2 + * @status updated to 1.4, but missing Locale support + */ +public abstract class AccessibleBundle +{ + /** + * The locale independent name of the object. This is for the computer, not + * necessarily for humans; changing it in subclasses is frowned upon. + * + * @see #toDisplayString(String, Locale) + */ + protected String key; + + /** + * Default constructor. + */ + public AccessibleBundle() + { + } + + /** + * Obtains the key as a localized string, falling back to the + * locale-independent version if necessary. + * + * @param resourceBundle the resource to use for lookup + * @param locale the locale to translate to + * @return the translated name + * @throws NullPointerException if resourceBundle or locale is null + * @XXX For now, no transformation is done. + */ + protected String toDisplayString(String resourceBundle, Locale locale) + { + return key; + } + + /** + * Obtains the key as a localized string, falling back to the + * locale-independent version if necessary. + * + * @param locale the locale to translate to + * @return the translated name + * @throws NullPointerException if locale is null + * @XXX For now, no transformation is done. + */ + public String toDisplayString(Locale locale) + { + return key; + } + + /** + * Obtains the key as a localized string, using the default locale. + * + * @return the translated name + * @XXX For now, no transformation is done. + */ + public String toDisplayString() + { + return toDisplayString(Locale.getDefault()); + } + + /** + * Obtains the key as a localized string, using the default locale. + * + * @return the translated name + * @XXX For now, no transformation is done. + */ + public String toString() + { + return toDisplayString(Locale.getDefault()); + } +} // class AccessibleBundle diff --git a/libjava/javax/accessibility/AccessibleComponent.java b/libjava/javax/accessibility/AccessibleComponent.java new file mode 100644 index 00000000000..7634eb5ba93 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleComponent.java @@ -0,0 +1,321 @@ +/* AccessibleComponent.java -- aids in accessibly rendering Java components + Copyright (C) 2000, 2001, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.FocusListener; + +/** + * Objects which are to be rendered to a screen as part of a graphical + * user interface should implement this interface. Accessibility + * software can use the implementations of this interface to determine + * and set the screen representation for an object. + * + * <p>The <code>AccessibleContext.getAccessibleComponent()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleComponent() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleComponent +{ + /** + * Get the background color of this component. + * + * @return the background color of this component, or null if not supported + * @see #setBackground(Color) + */ + Color getBackground(); + + /** + * Set the background color of this component to the specified color. + * + * @param color the color to set the background to + * @see #getBackground() + */ + void setBackground(Color color); + + /** + * Get the foreground color of this component. + * + * @return the foreground color of this component, or null if not supported + * @see #setForeground(Color) + */ + Color getForeground(); + + /** + * Set the foreground color of this component. + * + * @param color the color to set the foreground to + * @see #getForeground() + */ + void setForeground(Color color); + + /** + * Get the cursor of this component. + * + * @return the Cursor of this component, or null if not supported + * @see #setCursor(Cursor) + */ + Cursor getCursor(); + + /** + * Set the cursor of the component. + * + * @param cursor the graphical representation of the cursor to use + * @see #getCursor() + */ + void setCursor(Cursor cursor); + + /** + * Get the font of this component + * + * @return the font of the component, or null if not supported + * @see setFont(Font) + */ + Font getFont(); + + /** + * Set the font of this component. + * + * @param font the font to use + * @see #getFont() + */ + void setFont(Font font); + + /** + * Get the <code>FontMetrics</code> of the specified font in this component. + * + * @param font the specified font + * @return the metrics for the specified font, or null if not supported + * @throws NullPointerException if font is null + * @see #getFont() + */ + FontMetrics getFontMetrics(Font font); + + /** + * Indicates whether or not this component is enabled. An object which is + * enabled also has AccessibleState.ENABLED in its StateSet. + * + * @return true if the component is enabled + * @see #setEnabled(boolean) + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#ENABLED + */ + boolean isEnabled(); + + /** + * Set this component to an enabled or disabled state. + * + * @param b true to enable the component, else disable it + * @see #isEnabled() + */ + void setEnabled(boolean b); + + /** + * Indicates whether or not this component is visible or intends to be + * visible although one of its ancestors may not be. An object which is + * visible also has AccessibleState.VISIBLE in its StateSet. Check + * <code>isShowing()</code> to see if the object is on screen. + * + * @return true if the component is visible + * @see #setVisible(boolean) + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#VISIBLE + */ + boolean isVisible(); + + /** + * Set the visible state of this component. + * + * @param b true to make the component visible, else hide it + * @see #isVisible() + */ + void setVisible(boolean b); + + /** + * Indicates whether or not this component is visible by checking + * the visibility of this component and its ancestors. The component may + * be hidden on screen by another component like pop-up help. An object + * which is showing on screen also has AccessibleState.SHOWING in its + * StateSet. + * + * @return true if component and ancestors are visible + * @see #isVisible() + * @see #setVisible(boolean) + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#SHOWING + */ + boolean isShowing(); + + /** + * Tests whether or not the specified point is contained within + * this component. The coordinates are specified relative to this + * component's coordinate system. + * + * @param point the Point to locate + * @return true if the point is within this component + * @throws NullPointerException if point is null + * @see #getBounds() + */ + boolean contains(Point point); + + /** + * Get the location of this component in the screen's coordinate space. + * The point specified is the top-left corner of this component. + * + * @return the location on screen, or null if off-screen + * @see #getBounds() + * @see #getLocation() + */ + Point getLocationOnScreen(); + + /** + * Get the location of this component in the parent's coordinate system. + * The point specified is the top-left corner of this component. + * + * @return the location in the parent on screen, or null if off-screen + * @see #getBounds() + * @see #getLocationOnScreen() + * @see #setLocation(Point) + */ + Point getLocation(); + + /** + * Set the location of this component relative to its parent. The point + * specified represents the top-left corner of this component. + * + * @param point the top-left corner of this component relative to the parent + * @throws NullPointerException if point is null + * @see #getLocation() + */ + void setLocation(Point point); + + /** + * Get the bounds of this component relative to its parent - it's width, + * height, and relative location to its parent. + * + * @return the bounds of this component, or null if not on screen + * @see #contains(Point) + */ + Rectangle getBounds(); + + /** + * Set the bounds of this component to the specified height and width, and + * relative location to its parent. + * + * @param rectangle the new height, width, and relative location + * @throws NullPointerException if rectangle is null + */ + void setBounds(Rectangle rectangle); + + /** + * Get the size of this component - it's width and height. + * + * @return the dimensions of this component, or null if not on screen + * @see #setSize(Dimension) + */ + Dimension getSize(); + + /** + * Set the size of this component to the given dimensions. + * + * @param dimension the new size of the component + * @throws NullPointerException if dimension is null + * @see #getSize() + */ + void setSize(Dimension dimension); + + /** + * If an object exists at the specified point which is a child of this + * parent component, and it is accessible, then it is returned. + * + * @param point the location within this component's coordinate system + * @return the accessible child object at that point, or null + */ + Accessible getAccessibleAt(Point point); + + /** + * Indicates whether or not this component can accept focus. An object + * which can accept focus also has AccessibleState.FOCUSABLE in its + * StateSet. + * + * @return true if the component can accept focus + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#FOCUSABLE + * @see AccessibleState#FOCUSED + */ + boolean isFocusTraversable(); + + /** + * If this method is called this component will attempt to gain focus, + * but if it cannot accept focus nothing happens. On success, the StateSet + * will contain AccessibleState.FOCUSED + * + * @see #isFocusTraversable() + * @see AccessibleState#FOCUSED + */ + void requestFocus(); + + /** + * Adds the specified listener to this component. + * + * @param listener the listener to add to this component + * @see #removeFocusListener(FocusListener) + */ + void addFocusListener(FocusListener listener); + + /** + * Removes the specified listener from this component. + * + * @param listener the listener to remove + * @see #addFocusListener(FocusListener) + */ + void removeFocusListener(FocusListener listener); +} // interface AccessibleComponent diff --git a/libjava/javax/accessibility/AccessibleContext.java b/libjava/javax/accessibility/AccessibleContext.java new file mode 100644 index 00000000000..d84c1463d39 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleContext.java @@ -0,0 +1,589 @@ +/* AccessibleContext.java -- the context of an accessible object + Copyright (C) 2002 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.Locale; + +/** + * The minimum information that all accessible objects return. This includes + * name, description, role, and state of the object, parents and children, + * and any other useful information. If a component supports further details, + * it should implement one of the following:<ul> + * <li>{@link AccessibleAction} - the object can perform actions</li> + * <li>{@link AccessibleComponent} - the object has a graphical + * representation</li> + * <li>{@link AccessibleSelection} - the object allows its children to be + * selected</li> + * <li>{@link AccessibleText} - the object represents editable text</li> + * <li>{@link AccessibleValue} - the object represents a numerical value</li> + * </ul> + * + * @author Eric Blake <ebb9@email.byu.edu> + * @since 1.2 + * @status updated to 1.4 + */ +public abstract class AccessibleContext +{ + /** + * Constant used when the accessible name has changed. Both the old and new + * values are listed in the event. + * + * @see #getAccessibleName() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_NAME_PROPERTY + = "AccessibleName"; + + /** + * Constanat used when the accessible description has changed. Both the old + * and new values are listed in the event. + * + * @see #getAccessibleDescription() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_DESCRIPTION_PROPERTY + = "AccessibleDescription"; + + /** + * Constant used when the accessibleStateSet has changed. Both the old and + * new values are listed in the event, although either may be null if a + * state was disabled at that time. + * + * @see #getAccessibleStateSet() + * @see AccessibleState + * @see AccessibleStateSet + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_STATE_PROPERTY + = "AccessibleState"; + + /** + * Constant used when the accessibleValue has changed. Both the old and new + * values are listed in the event. + * + * @see #getAccessibleValue() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_VALUE_PROPERTY + = "AccessibleValue"; + + /** + * Constant used when the accessibleSelection has changed. Both the old and + * new values of the event are reserved for future use. + * + * @see #getAccessibleSelection() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_SELECTION_PROPERTY + = "AccessibleSelection"; + + /** + * Constant used when the accessibleText has changed. Both the old and new + * values of the event are reserved for future use. + * + * @see #getAccessibleText() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_TEXT_PROPERTY + = "AccessibleText"; + + /** + * Constant used when the accessibleText caret has changed. Both the old and + * new values are listed in the event. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_CARET_PROPERTY + = "AccessibleCaret"; + + /** + * Constant used when the visible data has changed. Both the old and new + * values of the event are reserved for future use. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY + = "AccessibleVisibleData"; + + /** + * Constant used when children are added or removed. On addition, the new + * value of the event holds the new child; on removal, the old value holds + * the removed child. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_CHILD_PROPERTY + = "AccessibleChild"; + + /** + * Constant used when active descendent of a component has changed. Both + * the old and new values are listed in the event. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY + = "AccessibleActiveDescendant"; + + /** + * Constant used when the accessible table caption has changed. Both the + * old and new values are listed in the event. + * + * @see Accessible + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_CAPTION_CHANGED + = "accessibleTableCaptionChanged"; + + /** + * Constant used when the accessible table summary has changed. Both the + * old and new values are listed in the event. + * + * @see Accessible + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_SUMMARY_CHANGED + = "accessibleTableSummaryChanged"; + + /** + * Constant used when the accessible table model has changed. Only the new + * value of the event has meaning. + * + * @see AccessibleTable + * @see AccessibleTableModelChange + */ + public static final String ACCESSIBLE_TABLE_MODEL_CHANGED + = "accessibleTableModelChanged"; + + /** + * Constant used when the accessible table row header has changed. Only the + * new value of the event has meaning. + * + * @see AccessibleTable + * @see AccessibleTableModelChange + */ + public static final String ACCESSIBLE_TABLE_ROW_HEADER_CHANGED + = "accessibleTableRowHeaderChanged"; + + /** + * Constant used when the accessible table row description has changed. Only + * the new value of the event has meaning. + * + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED + = "accessibleTableRowDescriptionChanged"; + + /** + * Constant used when the accessible table column header has changed. Only + * the new value of the event has meaning. + * + * @see AccessibleTable + * @see AccessibleTableModelChange + */ + public static final String ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED + = "accessibleTableColumnHeaderChanged"; + + /** + * Constant used when the accessible table column description has changed. + * Only the new value of the event has meaning. + * + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED + = "accessibleTableColumnDescriptionChanged"; + + /** + * Constant used when supported set of actions has changed. Both the old + * and new values are listed in the event. + * + * @see AccessibleAction + */ + public static final String ACCESSIBLE_ACTION_PROPERTY + = "accessibleActionProperty"; + + /** + * Constant used when a hypertext element received focus. Both the old + * and new values are listed in the event, with -1 indicating that no link + * had focus. + * + * @see AccessibleHyperlink + */ + public static final String ACCESSIBLE_HYPERTEXT_OFFSET + = "AccessibleHypertextOffset"; + + /** + * The accessible parent of this object. + * + * @see #getAccessibleParent() + * @see #setAccessibleParent(Accessible) + */ + protected Accessible accessibleParent; + + /** + * A localized string naming this object. + * + * @see #getAccessibleName() + * @see #setAccessibleName(String) + */ + protected String accessibleName; + + /** + * A localized string describing this object. + * + * @see #getAccessibleDescription() + * @see #setAccessibleDescription(String) + */ + protected String accessibleDescription; + + /** + * The listener tool. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + * @see #removePropertyChangeListener(PropertyChangeListener) + * @see #firePropertyChange(String, Object, Object) + */ + private final PropertyChangeSupport listeners + = new PropertyChangeSupport(this); + + /** + * Default constructor. + */ + public AccessibleContext() + { + } + + /** + * Get the localized name of the object. For example, a label may just + * return the text of the label, while an entry field for city may return + * "city" in en_US. + * + * @return the accessible object's name, or null if it is unnamed + * @see #setAccessibleName(String) + */ + public String getAccessibleName() + { + return accessibleName; + } + + /** + * Set the localized name of the object. This will fire a + * PropertyChangeEvent with ACCESSIBLE_NAME_PROPERTY. + * + * @param s the new name + * @see #getAccessibleName() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public void setAccessibleName(String s) + { + listeners.firePropertyChange(ACCESSIBLE_NAME_PROPERTY, accessibleName, s); + accessibleName = s; + } + + /** + * Get the localized description of the object. For example, a 'Cancel' + * button may be described as "Ignore changes and close dialog box" in + * en_US. + * + * @return the accessible object's description, or null if there is none + * @see #setAccessibleDescription(String) + */ + public String getAccessibleDescription() + { + return accessibleDescription; + } + + /** + * Set the localized name of the object. This will fire a + * PropertyChangeEvent with ACCESSIBLE_DESCRIPTION_PROPERTY. + * + * @param s the new description + * @see #getAccessibleDescription() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public void setAccessibleDescription(String s) + { + listeners.firePropertyChange(ACCESSIBLE_DESCRIPTION_PROPERTY, + accessibleDescription, s); + accessibleDescription = s; + } + + /** + * Gets the role of this object. For example, a button serves the role of + * AccessibleRole.PUSH_BUTTON. This allows assistive technologies to funnel + * similar objects into the same assistance classes. Note that the class + * is extensible, to define new roles if necessary. + * + * @return the role of the object + * @see AccessibleRole + */ + public abstract AccessibleRole getAccessibleRole(); + + /** + * Gets the state set of this object. A change in the state of the object + * will fire a PropertyChangeEvent for ACCESSIBLE_STATE_PROPERTY. + * + * @return the current state of the object + * @see AccessibleState + * @see AccessibleStateSet + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public abstract AccessibleStateSet getAccessibleStateSet(); + + /** + * Return the accessible parent of this object. + * + * @return the accessible parent, or null if there is none + */ + public Accessible getAccessibleParent() + { + return accessibleParent; + } + + /** + * Sets the accessible parent of this object. This should only be used when + * the current parent object should not be the accessible parent; only the + * parent of the accessible child should call this method. + * + * @param a the new parent + */ + public void setAccessibleParent(Accessible a) + { + accessibleParent = a; + } + + /** + * Gets the index of this object within its accessible parent. + * + * @return the 0-based index, or -1 if there is no accessible parent + * @see #getAccessibleParent() + * @see #getAccessibleChildrenCount() + * @see #getAccessibleChild(int) + */ + public abstract int getAccessibleIndexInParent(); + + /** + * Returns the number of accessible children of this object. + * + * @return the number of accessible children + * @see #getAccessibleChild(int) + */ + public abstract int getAccessibleChildrenCount(); + + /** + * Returns the specified accessible chile. + * + * @param i the 0-based index to get + * @return the child, or null if out of bounds + * @see #getAccessibleChildrenCount() + */ + public abstract Accessible getAccessibleChild(int i); + + /** + * Gets the component locale, deferring to the parent if one is not declared. + * + * @return the locale + * @throws java.awt.IllegalComponentStateException if there is no locale + * or parent + */ + public abstract Locale getLocale(); + + /** + * Add a PropertyChangeListener to the listener list. This listener will + * be notified of all property changes to the accessible object. + * + * @param l the listener to add + * @see #ACCESSIBLE_NAME_PROPERTY + * @see #ACCESSIBLE_DESCRIPTION_PROPERTY + * @see #ACCESSIBLE_STATE_PROPERTY + * @see #ACCESSIBLE_VALUE_PROPERTY + * @see #ACCESSIBLE_SELECTION_PROPERTY + * @see #ACCESSIBLE_TEXT_PROPERTY + * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY + * @see #removePropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(PropertyChangeListener l) + { + listeners.addPropertyChangeListener(l); + } + + /** + * Remove a PropertyChangeListener from the listener list. + * + * @param l the listener to remove + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener l) + { + listeners.removePropertyChangeListener(l); + } + + /** + * Get any supported accessible actions. The default implementation returns + * null. + * + * @return the supported action, or null + * @see AccessibleAction + */ + public AccessibleAction getAccessibleAction() + { + return null; + } + + /** + * Get any supported accessible compoent. The default implementation returns + * null. + * + * @return the supported component, or null + * @see AccessibleComponent + */ + public AccessibleComponent getAccessibleComponent() + { + return null; + } + + /** + * Get any supported accessible selection. The default implementation returns + * null. + * + * @return the supported selection, or null + * @see AccessibleSelection + */ + public AccessibleSelection getAccessibleSelection() + { + return null; + } + + /** + * Get any supported accessible text. The default implementation returns + * null. + * + * @return the supported text, or null + * @see AccessibleText + */ + public AccessibleText getAccessibleText() + { + return null; + } + + /** + * Get any supported accessible editable text. The default implementation + * returns null. + * + * @return the supported editable text, or null + * @see AccessibleEditableText + */ + public AccessibleEditableText getAccessibleEditableText() + { + return null; + } + + /** + * Get any supported accessible value. The default implementation returns + * null. + * + * @return the supported value, or null + * @see AccessibleValue + */ + public AccessibleValue getAccessibleValue() + { + return null; + } + + /** + * Get all supported accessible icons. The default implementation returns + * null. + * + * @return the supported icons, or null + * @see AccessibleIcon + */ + public AccessibleIcon[] getAccessibleIcon() + { + return null; + } + + /** + * Get any supported accessible relation set. The default implementation + * returns null. + * + * @return the supported relation set, or null + * @see AccessibleRelationSet + */ + public AccessibleRelationSet getAccessibleRelationSet() + { + return null; + } + + /** + * Get any supported accessible table. The default implementation returns + * null. + * + * @return the supported table, or null + * @see AccessibleTable + */ + public AccessibleTable getAccessibleTable() + { + return null; + } + + /** + * Fire an event to report property changes. This is intended for use by + * the accessible objects, not general application programs. If oldValue and + * newValue differ, and the listenter list is not empty, a PropertyChange + * event is fired to each listener. + * + * @param name the property name + * @param oldValue the prior value + * @param newValue the updated value + * @see PropertyChangeSupport + * @see #addPropertyChangeListener(PropertyChangeListener) + * @see #removePropertyChangeListener(PropertyChangeListener) + * @see #ACCESSIBLE_NAME_PROPERTY + * @see #ACCESSIBLE_DESCRIPTION_PROPERTY + * @see #ACCESSIBLE_STATE_PROPERTY + * @see #ACCESSIBLE_VALUE_PROPERTY + * @see #ACCESSIBLE_SELECTION_PROPERTY + * @see #ACCESSIBLE_TEXT_PROPERTY + * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY + */ + public void firePropertyChange(String name, Object oldValue, Object newValue) + { + listeners.firePropertyChange(name, oldValue, newValue); + } +} // class AccessibleContext diff --git a/libjava/javax/accessibility/AccessibleEditableText.java b/libjava/javax/accessibility/AccessibleEditableText.java new file mode 100644 index 00000000000..3387a7c56f4 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleEditableText.java @@ -0,0 +1,142 @@ +/* AccessibleEditableText.java -- aids in accessibly for editable text + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import javax.swing.text.AttributeSet; + +/** + * Objects which present editable textual information on the display should + * implement this interface. Accessibility software can use the + * implementations of this interface to change the content, attributes, + * and spacial location of the text. + * + * <p>The <code>AccessibleContext.getAccessibleEditableText()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleText() + * @see AccessibleContext#getAccessibleEditableText() + * @since 1.2 + * @status updated to 1.4, except for javax.swing support + */ +public interface AccessibleEditableText extends AccessibleText +{ + /** + * Set the text contents to the given string. + * + * @param s the new text + */ + // XXX What happens if s is null? + void setTextContents(String s); + + /** + * Inserts the given string at the specified location. + * + * @param index the index for insertion + * @param s the new text + */ + // XXX What happens if index is out of bounds, or s is null? + void insertTextAtIndex(int index, String s); + + /** + * Return the text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + String getTextRange(int start, int end); + + /** + * Delete the text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + String delete(int start, int end); + + /** + * Cut the text between two points to the system clipboard. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + String cut(int start, int end); + + /** + * Paste the text from the system clipboard at the given index. + * + * @param start the start position + */ + // XXX What happens if start is out of bounds? + void paste(int start); + + /** + * Replace the text between two points with the given string. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + * @param s the string to paste + */ + // XXX What happens if indices are out of bounds, or s is null? + void replaceText(int start, int end, String s); + + /** + * Select the text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + void selectText(int start, int stop); + + /** + * Set the attributes of text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + * @param s the new attribute set for the range + */ + // XXX What happens if indices are out of bounds, or s is null? + void setAttributes(int start, int end, AttributeSet s); +} // interface AccessibleEditableText diff --git a/libjava/javax/accessibility/AccessibleExtendedComponent.java b/libjava/javax/accessibility/AccessibleExtendedComponent.java new file mode 100644 index 00000000000..d57de19745f --- /dev/null +++ b/libjava/javax/accessibility/AccessibleExtendedComponent.java @@ -0,0 +1,78 @@ +/* AccessibleExtendedComponent.java -- aids in extended component access + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Objects which present graphical components with extensions such as key + * bindings or tool-tips should implement this interface. Accessibility + * software can use the implementations of this interface to display the + * extended information of the component. + * + * <p>The <code>AccessibleContext.getAccessibleComponent()</code> method + * should return an instance of this interface only when it is supported. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleComponent() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleExtendedComponent extends AccessibleComponent +{ + /** + * Returns the tool-tip text for this component. + * + * @return the tool-tip, or null if not supported + */ + String getToolTipText(); + + /** + * Returns the title border text for this component. + * + * @return the titled border text, or null if not supported + */ + String getTitledBorderText(); + + /** + * Returns the accessible key bindings for this component. + * + * @return the key bindings, or null if not supported + */ + AccessibleKeyBinding getAccessibleKeyBinding(); +} // interface AccessibleExtendedComponent diff --git a/libjava/javax/accessibility/AccessibleExtendedTable.java b/libjava/javax/accessibility/AccessibleExtendedTable.java new file mode 100644 index 00000000000..627b0242825 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleExtendedTable.java @@ -0,0 +1,81 @@ +/* AccessibleExtendedTable.java -- aids in extended table access + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Objects which present 2-D tables with the extension of a flat address + * space should implement this interface. Accessibility software can use the + * implementations of this interface to better manipulate the table. + * + * <p>The <code>AccessibleContext.getAccessibleTable()</code> method + * should return an instance of this interface only when it is supported. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleTable() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleExtendedTable extends AccessibleTable +{ + /** + * Returns the row number of an index in the table. + * + * @param index the cell index, in row-major form from (0,0) + * @return the row number, or -1 if out of bounds + */ + int getAccessibleRow(int index); + + /** + * Returns the column number of an index in the table. + * + * @param index the cell index, in row-major form from (0,0) + * @return the column number, or -1 if out of bounds + */ + int getAccessibleColumn(int index); + + /** + * Returns the cell number for a row-major address from (0,0). + * + * @param r the row + * @param c the column + * @return the cell index + */ + int getAccessibleIndex(int r, int c); +} // interface AccessibleExtendedTable diff --git a/libjava/javax/accessibility/AccessibleHyperlink.java b/libjava/javax/accessibility/AccessibleHyperlink.java new file mode 100644 index 00000000000..716dd1dd0f5 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleHyperlink.java @@ -0,0 +1,139 @@ +/* AccessibleHyperlink.java -- aids in accessibly navigating hypertext + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * This object encapsulates actions associated with navigating hypertext. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleText + * @see AccessibleContext#getAccessibleText() + * @since 1.2 + * @status updated to 1.4 + */ +public abstract class AccessibleHyperlink implements AccessibleAction +{ + /** + * The default constructor. + */ + public AccessibleHyperlink() + { + } + + /** + * Returns whether the document the link references is still valid, as the + * association may have changed with a text edit. + * + * @return true if the link is valid with respect to the AccessibleHypertext + */ + public abstract boolean isValid(); + + /** + * Get the number possible actions for this object, starting from 0. In + * general, a hypertext link has only one action, except for an image map, + * so there isn't really a default action. + * + * @return the 0-based number of actions + */ + public abstract int getAccessibleActionCount(); + + /** + * Perform the specified action. Does nothing if out of bounds. + * + * @param i the action to perform, 0-based + * @return true if the action was performed + * @see #getAccessibleActionCount() + */ + public abstract boolean doAccessibleAction(int i); + + /** + * Get the anchor text of the link, or null if the index is out of bounds. + * For example, <a href="http://www.gnu.org/">GNU Home Page</a> + * would return "GNU Home Page", while <a HREF="#top"> + * <img src="top-hat.png" alt="top hat"></a> would return + * "top hat". + * + * @param i the link to retrieve, 0-based + * @return the link anchor text + * @see #getAccessibleActionCount() + */ + public abstract String getAccessibleActionDescription(int i); + + /** + * Get the link location, or null if the index is out of bounds. For + * example, <a href="http://www.gnu.org/">GNU Home Page</a> + * would return a java.net.URL("http://www.gnu.org/"). + * + * @param i the link to retrieve, 0-based + * @return the link location + * @see #getAccessibleActionCount() + */ + public abstract String getAccessibleActionObject(int i); + + /** + * Get the anchor appropriate for the link, or null if the index is out of + * bounds. For example, <a href="http://www.gnu.org/">GNU Home Page + * </a> would return "GNU Home Page", while <a HREF="#top"> + * <img src="top-hat.png" alt="top hat"></a> would return + * an ImageIcon("top-hat.png", "top hat"). + * + * @param i the link to retrieve, 0-based + * @return the link anchor object + * @see #getAccessibleActionCount() + */ + public abstract String getAccessibleActionAnchor(int i); + + /** + * Gets the character index where this link starts in the parent hypertext + * document. + * + * @return the starting index + */ + public abstract int getStartIndex(); + + /** + * Gets the character index where this link ends in the parent hypertext + * document. + * + * @return the ending index + */ + public abstract int getEndIndex(); +} // class AccessibleAction diff --git a/libjava/javax/accessibility/AccessibleHypertext.java b/libjava/javax/accessibility/AccessibleHypertext.java new file mode 100644 index 00000000000..ae0d150bd02 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleHypertext.java @@ -0,0 +1,84 @@ +/* AccessibleHypertext.java -- aids in accessibly rendering hypertext + Copyright (C) 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Objects which present hyperlinks in a document should implement this + * interface. Accessibility software can use the implementations of this + * interface to aid the user in navigating the links. + * + * <p>The <code>AccessibleContext.getAccessibleText()</code> method + * should return an instance of this interface only when it is supported. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleText + * @see AccessibleContext#getAccessibleText() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleHypertext extends AccessibleText +{ + /** + * Returns the number of links in the document, if any exist. + * + * @return the number of links, or -1 + */ + int getLinkCount(); + + /** + * Returns link object denoted by the number <code>i</code> in this + * document, or null if i is out of bounds. + * + * @param i the ith hyperlink of the document + * @return link object denoted by <code>i</code> + */ + AccessibleHyperlink getLink(int i); + + /** + * Returns the link index for this character index if it resides within + * one of the hyperlinks of the document. If no association exists at that + * character, or c is out of bounds, returns -1. + * + * @param c the character index + * @return the link index, or -1 + */ + int getLinkIndex(int c); +} // interface AccessibleHypertext diff --git a/libjava/javax/accessibility/AccessibleIcon.java b/libjava/javax/accessibility/AccessibleIcon.java new file mode 100644 index 00000000000..c13b14009b9 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleIcon.java @@ -0,0 +1,85 @@ +/* AccessibleIcon.java -- aids in accessibly rendering icons + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Objects which have an associated icon, such as buttons, should implement + * this interface. Accessibility software can use the implementations of this + * interface to aid the user in navigating the links. + * + * <p>The <code>AccessibleContext.getAccessibleIcon()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleIcon() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleIcon +{ + /** + * Returns a textual description of the icon and its purpose. + * + * @return the description, or null if there is none + */ + String getAccessibleIconDescription(); + + /** + * Modify the textual description of the icon and its purpose. + * + * @param s the new descrption string + */ + void setAccessibleIconDescription(String s); + + /** + * Get the icon width. + * + * @return the width + */ + int getAccessibleIconWidth(); + + /** + * Get the icon height. + * + * @return the height + */ + int getAccessibleIconHeight(); +} // interface AccessibleIcon diff --git a/libjava/javax/accessibility/AccessibleKeyBinding.java b/libjava/javax/accessibility/AccessibleKeyBinding.java new file mode 100644 index 00000000000..777f8b734d6 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleKeyBinding.java @@ -0,0 +1,78 @@ +/* AccessibleKeyBinding.java -- aids in using keyboard navigation + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Objects which have keyboard bindings for mneumonics or shortcuts should + * implement this interface. Accessibility software can use the + * implementations of this interface to aid the user in using the key + * bindings. + * + * <p>The <code>AccessibleContext.getAccessibleKeyBinding()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleKeyBinding() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleKeyBinding +{ + /** + * Returns the count of key bindings for this object. + * + * @return the 0-based count, or -1 if there are none + */ + int getAccessibleKeyBindingCount(); + + /** + * Return the numbered key binding, which can then be cast in an + * implementation dependent way to the appropriate object type. For example, + * swing uses <code>javax.swing.KeyStroke</code>. This returns null if i + * is out of bounds. + * + * @param i the 0-based index of key bindings + * @return the key binding + * @see #getAccessibleKeyBindingCount() + */ + Object getAccessibleKeyBinding(int i); +} // interface AccessibleKeyBinding diff --git a/libjava/javax/accessibility/AccessibleRelation.java b/libjava/javax/accessibility/AccessibleRelation.java new file mode 100644 index 00000000000..68f1f646a59 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleRelation.java @@ -0,0 +1,220 @@ +/* AccessibleRelation.java -- the relation between accessible objects + Copyright (C) 2002 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * The relation between one accessible object and one or more other objects. + * For example, a button may control an action. An AccessibleRelationSet + * summarizes all relations of the object. This strongly typed "enumeration" + * supports localized strings. If the constants of this class are not + * adequate, new ones may be added in a similar matter. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleRelation extends AccessibleBundle +{ + /** + * Indicates the object labels other objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public static final String LABEL_FOR = "labelFor"; + + /** + * Indicates the object is labeled by other objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #MEMBER_OF + */ + public static final String LABELED_BY = "labeledBy"; + + /** + * Indicates an object is a member of a group of target objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #LABELED_BY + */ + public static final String MEMBER_OF = "memberOf"; + + /** + * Indicates an object is a controller for other objects. + * + * @see #getTarget() + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public static final String CONTROLLER_FOR = "controllerFor"; + + /** + * Indicates an object is controlled by other objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #LABEL_FOR + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public static final String CONTROLLED_BY = "controlledBy"; + + /** Indicates that the label target group has changed. */ + public static final String LABEL_FOR_PROPERTY = "labelForProperty"; + + /** Indicates that the labelling objects have changed. */ + public static final String LABELED_BY_PROPERTY = "labeledByProperty"; + + /** Indicates that group membership has changed. */ + public static final String MEMBER_OF_PROPERTY = "memberOfProperty"; + + /** Indicates that the controller target group has changed. */ + public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty"; + + /** Indicates that the controlling objects have changed. */ + public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty"; + + /** An empty set of targets. */ + private static final Object[] EMPTY_TARGETS = { }; + + /** + * The related objects. + * + * @see #getTarget() + * @see #setTarget(Object) + * @see #setTarget(Object[]) + */ + Object[] targets; + + /** + * Create a new relation with a locale independent key, and no related + * objects. + * + * @param key the name of the role + * @see #toDisplayString(String, Locale) + */ + public AccessibleRelation(String key) + { + this.key = key; + targets = EMPTY_TARGETS; + } + + /** + * Create a new relation with a locale independent key, and a single related + * object. + * + * @param key the name of the role + * @param target the related object + * @see #toDisplayString(String, Locale) + */ + public AccessibleRelation(String key, Object target) + { + this.key = key; + targets = new Object[] { target }; + } + + /** + * Create a new relation with a locale independent key, and the given + * related objects. + * + * @param key the name of the role + * @param targets the related objects + * @see #toDisplayString(String, Locale) + */ + public AccessibleRelation(String key, Object[] targets) + { + this.key = key; + this.targets = targets == null ? EMPTY_TARGETS : targets; + } + + /** + * Return the key for this relation. + * + * @return the key + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public String getKey() + { + return key; + } + + /** + * Return the targets of this relation. + * + * @return the targets, may be empty, but never null + */ + public Object[] getTarget() + { + return targets; + } + + /** + * Set the target to a single object. + * + * @param target the new target + */ + public void setTarget(Object target) + { + targets = new Object[] { target }; + } + + /** + * Set the target to an array of objects. + * + * @param targets the new targets + */ + public void setTarget(Object[] targets) + { + this.targets = targets == null ? EMPTY_TARGETS : targets; + } +} // class AccessibleRelation diff --git a/libjava/javax/accessibility/AccessibleRelationSet.java b/libjava/javax/accessibility/AccessibleRelationSet.java new file mode 100644 index 00000000000..27dc58da3c3 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleRelationSet.java @@ -0,0 +1,222 @@ +/* AccessibleRelationSet.java -- the combined relations of an accessible object + Copyright (C) 2002 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.util.Vector; + +/** + * Describes all relations of an accessible object. For example, an object + * by labeled by one object and control another. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see AccessibleRelation + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleRelationSet +{ + /** + * The list of relations, should be instances of AccessibleRelation. Don't + * set this to null. + * + * @see #add(AccessibleRelation) + * @see #addAll(AccessibleRelation[]) + * @see #remove(AccessibleRelation) + * @see #contains(String) + * @see #get(String) + * @see #size() + * @see #toArray() + * @see #clear() + */ + protected Vector relations = new Vector(); + + /** + * Create an empty relation set. + */ + public AccessibleRelationSet() + { + } + + /** + * Create a relation set initialized with the given relations, duplicates are + * ignored. + * + * @param relations the relations to insert + * @throws NullPointerException if relations is null + */ + public AccessibleRelationSet(AccessibleRelation[] relations) + { + addAll(relations); + } + + /** + * Add a new relation to the current set. If the relation is already in + * the set, the targets are merged with the existing relation, possibly + * resulting in an object being in the target list more than once. Do not + * add a relation with a null key, as it will cause problems later. + * + * @param relation the relation to add + * @return true if the set was modified, which is always the case + * @throws NullPointerException if relation is null + */ + public boolean add(AccessibleRelation relation) + { + AccessibleRelation old = get(relation.key); + if (old == null) + return relations.add(relation); + if (old.targets.length == 0) + old.targets = relation.targets; + else if (relation.targets.length != 0) + { + Object[] t = new Object[old.targets.length + relation.targets.length]; + System.arraycopy(old.targets, 0, t, 0, old.targets.length); + System.arraycopy(relation.targets, 0, t, old.targets.length, + relation.targets.length); + old.targets = t; + } + return true; + } + + /** + * Add all of the relations to the current set. Duplicates are ignored. + * + * @param array the array of relations to add + * @throws NullPointerException if array is null or has null entries + */ + public void addAll(AccessibleRelation[] array) + { + int i = array.length; + while (--i >= 0) + add(array[i]); + } + + /** + * Remove a relation from the set. If a relation was removed, return true. + * Note that this uses AccessibleRelation.equals, which defaults to ==, so a + * relation with the same key may still exist in the set afterwords. + * + * @param relation the state to remove + * @return true if the set changed + */ + public boolean remove(AccessibleRelation relation) + { + return relations.remove(relation); + } + + /** + * Clear all relations in the set. + */ + public void clear() + { + relations.clear(); + } + + /** + * Return the number of relations in the set. + * + * @return the set size + */ + public int size() + { + return relations.size(); + } + + /** + * Check if the relation key is in the set. + * + * @param relation the relation to locate + * @return true if it is in the set + */ + public boolean contains(String key) + { + int i = relations.size(); + while (--i >= 0) + if (((AccessibleRelation) relations.get(i)).key.equals(key)) + return true; + return false; + } + + /** + * Get the relation that matches the key. + * + * @param relation the relation to locate + * @return the relation in the set, or null + */ + public AccessibleRelation get(String key) + { + int i = relations.size(); + while (--i >= 0) + { + AccessibleRelation r = (AccessibleRelation) relations.get(i); + if (r.key.equals(key)) + return r; + } + return null; + } + + /** + * Return the relation set as an array. + * + * @return an array of the current relations + */ + public AccessibleRelation[] toArray() + { + AccessibleRelation[] result = new AccessibleRelation[relations.size()]; + relations.toArray(result); + return result; + } + + /** + * Return a localized, comma-separated string representing all relations + * in the set. This is in arbitrary order. + * + * @return the string representation + * @see AccessibleBundle#toDisplayString(String, Locale) + */ + public String toString() + { + int i = relations.size(); + if (i == 0) + return ""; + // Pre-allocate an average of 10 chars per state. + StringBuffer b = new StringBuffer(i * 10); + while (--i >= 0) + b.append(relations.get(i)).append(','); + return b.substring(0, b.length() - 1); + } +} // class AccessibleRelationSet diff --git a/libjava/javax/accessibility/AccessibleResourceBundle.java b/libjava/javax/accessibility/AccessibleResourceBundle.java new file mode 100644 index 00000000000..01c2bcfdf98 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleResourceBundle.java @@ -0,0 +1,74 @@ +/* AccessibleResourceBundle.java -- deprecated class + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.util.ListResourceBundle; + +/** + * This class is deprecated. It once was used for localizing accessibility + * strings, and was never meant for external use anyway. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see AccessibleBundle.toDisplayString(String, Locale) + * @since 1.2 + * @deprecated this class is no longer used + * @status updated to 1.4 + */ +public class AccessibleResourceBundle extends ListResourceBundle +{ + /** + * Default constructor. + * + * @deprecated do not use this class + */ + public AccessibleResourceBundle() + { + } + + /** + * Returns the mapping between keys and display strings. + * + * @return null + * @deprecated do not use this class + */ + public Object[][] getContents() + { + return null; + } +} // class AccessibleResourceBundle diff --git a/libjava/javax/accessibility/AccessibleRole.java b/libjava/javax/accessibility/AccessibleRole.java new file mode 100644 index 00000000000..86bfa6d382d --- /dev/null +++ b/libjava/javax/accessibility/AccessibleRole.java @@ -0,0 +1,478 @@ +/* AccessibleRole.java -- the primary role of an accessible object + Copyright (C) 2002 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * The role of an accessible object. For example, this could be "button" or + * "table". This strongly typed "enumeration" supports localized strings. If + * the constants of this class are not adequate, new ones may be added in a + * similar matter, while avoiding a public constructor. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleRole extends AccessibleBundle +{ + /** The object alerts the user about something. */ + public static final AccessibleRole ALERT + = new AccessibleRole("alert"); + + /** The header for a column of data. */ + public static final AccessibleRole COLUMN_HEADER + = new AccessibleRole("column header"); + + /** + * The object can be drawn into, and traps events. + * + * @see #FRAME + * @see #GLASS_PANE + * @see #LAYERED_PANE + */ + public static final AccessibleRole CANVAS + = new AccessibleRole("canvas"); + + /** + * A list of choices, which may optionally allow the user to create a new + * choice. + */ + public static final AccessibleRole COMBO_BOX + = new AccessibleRole("combo box"); + + /** + * An iconified frame in a desktop. + * + * @see #DESKTOP_PANE + * @see #INTERNAL_FRAME + */ + public static final AccessibleRole DESKTOP_ICON + = new AccessibleRole("desktop icon"); + + /** + * A frame-like object clipped by a desktop pane. + * + * @see #DESKTOP_ICON + * @see #DESKTOP_PANE + * @see #FRAME + */ + public static final AccessibleRole INTERNAL_FRAME + = new AccessibleRole("internal frame"); + + /** + * A pane which supports internal frames and their icons. + * + * @see #DESKTOP_ICON + * @see #INTERNAL_FRAME + */ + public static final AccessibleRole DESKTOP_PANE + = new AccessibleRole("desktop pane"); + + /** + * A specialized pane for use in a dialog. + * + * @see #DIALOG + */ + public static final AccessibleRole OPTION_PANE + = new AccessibleRole("option pane"); + + /** + * A top level window with no title or border. + * + * @see #FRAME + * @see #DIALOG + */ + public static final AccessibleRole WINDOW + = new AccessibleRole("window"); + + /** + * A top level window with title, menu bar, border, and so forth. It is + * often the primary window of an application. + * + * @see #DIALOG + * @see #CANVAS + * @see #WINDOW + */ + public static final AccessibleRole FRAME + = new AccessibleRole("frame"); + + /** + * A top level window title bar and border. It is limited compared to a + * frame, and is often a secondary window. + * + * @see #FRAME + * @see #WINDOW + */ + public static final AccessibleRole DIALOG + = new AccessibleRole("dialog"); + + /** A specialized dialog for choosing a color. */ + public static final AccessibleRole COLOR_CHOOSER + = new AccessibleRole("color chooser"); + + /** + * A pane for navigating through directories. + * + * @see #FILE_CHOOSER + */ + public static final AccessibleRole DIRECTORY_PANE + = new AccessibleRole("directory pane"); + + /** + * A specialized dialog that allows a user to select a file. + * + * @see #DIRECTORY_PANE + */ + public static final AccessibleRole FILE_CHOOSER + = new AccessibleRole("file chooser"); + + /** An object to fill space between other components. */ + public static final AccessibleRole FILLER + = new AccessibleRole("filler"); + + /** A hypertext anchor. */ + public static final AccessibleRole HYPERLINK + = new AccessibleRole("hyperlink"); + + /** A small picture to decorate components. */ + public static final AccessibleRole ICON + = new AccessibleRole("icon"); + + /** An object to label something in a graphic interface. */ + public static final AccessibleRole LABEL + = new AccessibleRole("label"); + + /** + * A specialized pane with a glass pane and layered pane as children. + * + * @see #GLASS_PANE + * @see #LAYERED_PANE + */ + public static final AccessibleRole ROOT_PANE + = new AccessibleRole("root pane"); + + /** + * A pane guaranteed to be painted on top of panes beneath it. + * + * @see #ROOT_PANE + * @see #LAYERED_PANE + */ + public static final AccessibleRole GLASS_PANE + = new AccessibleRole("glass pane"); + + /** + * A specialized pane that allows drawing children in layers. This is often + * used in menus and other visual components. + * + * @see #ROOT_PANE + * @see #GLASS_PANE + */ + public static final AccessibleRole LAYERED_PANE + = new AccessibleRole("layered pane"); + + /** + * An object which presents a list of items for selection. Often contained + * in a scroll pane. + * + * @see #SCROLL_PANE + * @see #LIST_ITEM + */ + public static final AccessibleRole LIST + = new AccessibleRole("list"); + + /** + * An object which represents an item in a list. Often contained in a scroll + * pane. + * + * @see #SCROLL_PANE + * @see #LIST + */ + public static final AccessibleRole LIST_ITEM + = new AccessibleRole("list item"); + + /** + * An object usually at the top of a frame to list available menus. + * + * @see #MENU + * @see #POPUP_MENU + * @see #LAYERED_PANE + */ + public static final AccessibleRole MENU_BAR + = new AccessibleRole("menu bar"); + + /** + * A temporary window with a menu of options, which hides on selection. + * + * @see #MENU + * @see #MENU_ITEM + */ + public static final AccessibleRole POPUP_MENU + = new AccessibleRole("popup menu"); + + /** + * An object usually in a menu bar which contains a list of actions to + * perform. Such actions are usually associated with menu items or submenus. + * + * @see #MENU_BAR + * @see #MENU_ITEM + * @see #SEPARATOR + * @see #RADIO_BUTTON + * @see #CHECK_BOX + * @see #POPUP_MENU + */ + public static final AccessibleRole MENU + = new AccessibleRole("menu"); + + /** + * An object usually in a menu with an action available for the user. + * + * @see #MENU_BAR + * @see #SEPARATOR + * @see #POPUP_MENU + */ + public static final AccessibleRole MENU_ITEM + = new AccessibleRole("menu item"); + + /** + * An object usually in a menu which separates logical sections of items. + * + * @see #MENU + * @see #MENU_ITEM + */ + public static final AccessibleRole SEPARATOR + = new AccessibleRole("separator"); + + /** + * An object which presents a series of panels, usually via tabs along the + * top. Children are all page tabs. + * + * @see #PAGE_TAB + */ + public static final AccessibleRole PAGE_TAB_LIST + = new AccessibleRole("page tab list"); + + /** + * An object in a page tab list, which contains the panel to display when + * selected from the list. + * + * @see #PAGE_TAB_LIST + */ + public static final AccessibleRole PAGE_TAB + = new AccessibleRole("page tab"); + + /** A generic container to group objects. */ + public static final AccessibleRole PANEL + = new AccessibleRole("panel"); + + /** An object used to track amount of a task that has completed. */ + public static final AccessibleRole PROGRESS_BAR + = new AccessibleRole("progress bar"); + + /** An object for passwords which should not be shown to the user. */ + public static final AccessibleRole PASSWORD_TEXT + = new AccessibleRole("password text"); + + /** + * An object that can be manipulated to do something. + * + * @see #CHECK_BOX + * @see #TOGGLE_BUTTON + * @see #RADIO_BUTTON + */ + public static final AccessibleRole PUSH_BUTTON + = new AccessibleRole("push button"); + + /** + * A specialized button which can be on or off, with no separate indicator. + * + * @see #PUSH_BUTTON + * @see #CHECK_BOX + * @see #RADIO_BUTTON + */ + public static final AccessibleRole TOGGLE_BUTTON + = new AccessibleRole("toggle button"); + + /** + * A choice which can be on or off, and has a separate indicator. + * + * @see #PUSH_BUTTON + * @see #TOGGLE_BUTTON + * @see #RADIO_BUTTON + */ + public static final AccessibleRole CHECK_BOX + = new AccessibleRole("check box"); + + /** + * A specialized choice which toggles radio buttons in the group when it + * is selected. + * + * @see #PUSH_BUTTON + * @see #TOGGLE_BUTTON + * @see #CHECK_BOX + */ + public static final AccessibleRole RADIO_BUTTON + = new AccessibleRole("radio button"); + + /** The header for a row of data. */ + public static final AccessibleRole ROW_HEADER + = new AccessibleRole("row header"); + + /** + * An object which allows an incremental view of a larger pane. + * + * @see #SCROLL_BAR + * @see #VIEWPORT + */ + public static final AccessibleRole SCROLL_PANE + = new AccessibleRole("scroll pane"); + + /** + * An object which allows selection of the view in a scroll pane. + * + * @see #SCROLL_PANE + */ + public static final AccessibleRole SCROLL_BAR + = new AccessibleRole("scroll bar"); + + /** + * An object which represents the visual section in a scroll pane. + * + * @see #SCROLL_PANE + */ + public static final AccessibleRole VIEWPORT + = new AccessibleRole("viewport"); + + /** An object which allows selection in a bounded range. */ + public static final AccessibleRole SLIDER + = new AccessibleRole("slider"); + + /** + * A specialized pane which presents two other panels, and can often adjust + * the divider between them. + */ + public static final AccessibleRole SPLIT_PANE + = new AccessibleRole("split pane"); + + /** An object for presenting data in rows and columns. */ + public static final AccessibleRole TABLE + = new AccessibleRole("table"); + + /** + * An object which represents text, usually editable by the user. + * + * @see #LABEL + */ + public static final AccessibleRole TEXT + = new AccessibleRole("text"); + + /** + * An object which represents a hierachical view of data. Subnodes can + * often be expanded or collapsed. + */ + public static final AccessibleRole TREE + = new AccessibleRole("tree"); + + /** A bar or pallete with buttons for common actions in an application. */ + public static final AccessibleRole TOOL_BAR + = new AccessibleRole("tool bar"); + + /** + * An object which provides information about another object. This is often + * displayed as a "help bubble" when a mouse hovers over the other object. + */ + public static final AccessibleRole TOOL_TIP + = new AccessibleRole("tool tip"); + + /** + * An AWT component with nothing else known about it. + * + * @see #SWING_COMPONENT + * @see #UNKNOWN + */ + public static final AccessibleRole AWT_COMPONENT + = new AccessibleRole("AWT component"); + + /** + * A swing component with nothing else known about it. + * + * @see #AWT_COMPONENT + * @see #UNKNOWN + */ + public static final AccessibleRole SWING_COMPONENT + = new AccessibleRole("SWING component"); + + /** + * An accessible object whose role is unknown. + * + * @see #AWT_COMPONENT + * @see #SWING_COMPONENT + */ + public static final AccessibleRole UNKNOWN + = new AccessibleRole("unknown"); + + /** A component with multiple labels of status information. */ + public static final AccessibleRole STATUS_BAR + = new AccessibleRole("statusbar"); + + /** A component which allows editing of Date and Time objects. */ + public static final AccessibleRole DATE_EDITOR + = new AccessibleRole("dateeditor"); + + /** A component with spinner arrows for simple numbers. */ + public static final AccessibleRole SPIN_BOX + = new AccessibleRole("spinbox"); + + /** A component for choosing fonts and their attributes. */ + public static final AccessibleRole FONT_CHOOSER + = new AccessibleRole("fontchooser"); + + /** A component with a border to group other components. */ + public static final AccessibleRole GROUP_BOX + = new AccessibleRole("groupbox"); + + /** + * Create a new constant with a locale independent key. Follow the example, + * keep the constructor private and make public constants instead. + * + * @param key the name of the role + * @see #toDisplayString(String, Locale) + */ + protected AccessibleRole(String key) + { + this.key = key; + } +} // class AccessibleRole diff --git a/libjava/javax/accessibility/AccessibleSelection.java b/libjava/javax/accessibility/AccessibleSelection.java new file mode 100644 index 00000000000..d1e8c7c2a46 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleSelection.java @@ -0,0 +1,113 @@ +/* AccessibleSelection.java -- aids in accessibly selecting components + Copyright (C) 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * If an object implements this interface then it must be able to control + * the selection of its children. Accessibility software can use the + * implementations of this interface to change the selection set of children. + * + * <p>The <code>AccessibleContext.getAccessibleSelection()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleSelection() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleSelection +{ + /** + * Returns the number of currently selected Accessible children, which may + * be 0 if nothing is selected. + * + * @return the number of selected children + */ + int getAccessibleSelectionCount(); + + /** + * Returns the i-th selected child (not necessarily the overall i-th child) + * of this Accessible object. If i is out of bounds, null is returned. + * + * @param i zero-based index of selected child objects + * @return the Accessible child, or null + * @see #getAccessibleSelectionCount() + */ + Accessible getAccessibleSelection(int i); + + /** + * Determine if i-th overall child of this accessible object is selected. + * If i is out of bounds, false is returned. + * + * @param i zero-based index of child objects + * @return true if specified child exists and is selected + */ + boolean isAccessibleChildSelected(int i); + + /** + * Select the specified child if it is not already selected, placing it in + * the object's current selection. If the object does not support multiple + * selections then the new selection replaces the old. If the specified + * child is already selected, or is out of bounds, this method does nothing. + * + * @param i zero-based index of child objects + */ + void addAccessibleSelection(int i); + + /** + * Unselect the specified child of this Accessible object. If the specified + * child is not selected, or is out of bounds, this method does nothing. + * + * @param i the zero-based index of the child objects + */ + void removeAccessibleSelection(int i); + + /** + * Unselect all children of this Accessible object. + */ + void clearAccessibleSelection(); + + /** + * Select all children of this Accessible object if the object supports + * multiple selections or has a single child. Otherwise this does nothing. + */ + void selectAllAccessibleSelection(); +} // interface AccessibleSelection diff --git a/libjava/javax/accessibility/AccessibleState.java b/libjava/javax/accessibility/AccessibleState.java new file mode 100644 index 00000000000..24005ae9a6e --- /dev/null +++ b/libjava/javax/accessibility/AccessibleState.java @@ -0,0 +1,315 @@ +/* AccessibleState.java -- a state of an accessible object + Copyright (C) 2002 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * A state portion of an accessible object. A combination of states represent + * the entire object state, in an AccessibleStateSet. For example, this could + * be "active" or "selected". This strongly typed "enumeration" supports + * localized strings. If the constants of this class are not adequate, new + * ones may be added in a similar matter, while avoiding a public constructor. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleState extends AccessibleBundle +{ + /** + * Indicates an active window, as well as an active child in a list or other + * collection. + * + * @see AccessibleRole#WINDOW + * @see AccessibleRole#FRAME + * @see AccessibleRole#DIALOG + */ + public static final AccessibleState ACTIVE + = new AccessibleState("active"); + + /** + * Indicates a pushed button, usually when the mouse has been pressed but + * not released. + * + * @see AccessibleRole#PUSH_BUTTON + */ + public static final AccessibleState PRESSED + = new AccessibleState("pressed"); + + /** + * Indicates an armed object, usually a button which has been pushed and + * the mouse has not left the button area. + * + * @see AccessibleRole#PUSH_BUTTON + */ + public static final AccessibleState ARMED + = new AccessibleState("armed"); + + /** + * Indicates an object is busy, such as a slider, scroll bar, or progress + * bar in transition. + * + * @see AccessibleRole#PROGRESS_BAR + * @see AccessibleRole#SCROLL_BAR + * @see AccessibleRole#SLIDER + */ + public static final AccessibleState BUSY + = new AccessibleState("busy"); + + /** + * Indicates an object is checked. + * + * @see AccessibleRole#TOGGLE_BUTTON + * @see AccessibleRole#RADIO_BUTTON + * @see AccessibleRole#CHECK_BOX + */ + public static final AccessibleState CHECKED + = new AccessibleState("checked"); + + /** + * Indicates the user can edit the component contents. This is usually for + * text, as other objects like scroll bars are automatically editable. + * + * @see #ENABLED + */ + public static final AccessibleState EDITABLE + = new AccessibleState("editable"); + + /** + * Indicates the object allows progressive disclosure of its children, + * usually in a collapsible tree or other hierachical object. + * + * @see #EXPANDED + * @see #COLLAPSED + * @see AccessibleRole#TREE + */ + public static final AccessibleState EXPANDABLE + = new AccessibleState("expandable"); + + /** + * Indicates that the object is collapsed, usually in a tree. + * + * @see #EXPANDABLE + * @see #EXPANDED + * @see AccessibleRole#TREE + */ + public static final AccessibleState COLLAPSED + = new AccessibleState("collapsed"); + + /** + * Indicates that the object is expanded, usually in a tree. + * + * @see #EXPANDABLE + * @see #COLLAPSED + * @see AccessibleRole#TREE + */ + public static final AccessibleState EXPANDED + = new AccessibleState("expanded"); + + /** + * Indicates that an object is enabled. In the absence of this state, + * graphics are often grayed out, and cannot be manipulated. + */ + public static final AccessibleState ENABLED + = new AccessibleState("enabled"); + + /** + * Indicates that an object can accept focus, which means it will process + * keyboard events when focused. + * + * @see #FOCUSED + */ + public static final AccessibleState FOCUSABLE + = new AccessibleState("focusable"); + + /** + * Indicates that an object has keyboard focus. + * + * @see #FOCUSABLE + */ + public static final AccessibleState FOCUSED + = new AccessibleState("focused"); + + /** + * Indicates that an object is minimized to an icon. + * + * @see AccessibleRole#FRAME + * @see AccessibleRole#INTERNAL_FRAME + */ + public static final AccessibleState ICONIFIED + = new AccessibleState("iconified"); + + /** + * Indicates that something must be done in the current object before + * interaction is allowed on other windows, usually for dialogs. + * + * @see AccessibleRole#DIALOG + */ + public static final AccessibleState MODAL + = new AccessibleState("modal"); + + /** + * Indicates that all pixels in the object are painted. If this state is not + * present, then the object has some degree of transparency, letting lower + * panes show through. + * + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleComponent() + * @see AccessibleComponent#getBounds() + */ + public static final AccessibleState OPAQUE + = new AccessibleState("opaque"); + + /** + * Indicates the size of this object is not fixed. + * + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleComponent() + * @see AccessibleComponent#getSize() + * @see AccessibleComponent#setSize(Dimension) + */ + public static final AccessibleState RESIZABLE + = new AccessibleState("resizable"); + + /** + * Indicates that multiple children can be selected at once. + * + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleSelection() + * @see AccessibleSelection + */ + public static final AccessibleState MULTISELECTABLE + = new AccessibleState("multiselectable"); + + /** + * Indicates that this child is one which can be selected from its parent. + * + * @see #SELECTED + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleSelection() + * @see AccessibleSelection + */ + public static final AccessibleState SELECTABLE + = new AccessibleState("selectable"); + + /** + * Indicates that this child has been selected from its parent. + * + * @see #SELECTABLE + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleSelection() + * @see AccessibleSelection + */ + public static final AccessibleState SELECTED + = new AccessibleState("selected"); + + /** + * Indicates that this object and all its parents are visible, so that it + * is on the screen. However, something opaque may be on top of it. + * + * @see #VISIBLE + */ + public static final AccessibleState SHOWING + = new AccessibleState("showing"); + + /** + * Indicates that this object intends to be visible. However, if its + * parent is invisible, this object is as well. + * + * @see #SHOWING + */ + public static final AccessibleState VISIBLE + = new AccessibleState("visible"); + + /** + * Indicates that an object has vertical orientation. + * + * @see #HORIZONTAL + * @see AccessibleRole#SCROLL_BAR + * @see AccessibleRole#SLIDER + * @see AccessibleRole#PROGRESS_BAR + */ + public static final AccessibleState VERTICAL + = new AccessibleState("vertical"); + + /** + * Indicates that an object has horizontal orientation. + * + * @see #VERTICAL + * @see AccessibleRole#SCROLL_BAR + * @see AccessibleRole#SLIDER + * @see AccessibleRole#PROGRESS_BAR + */ + public static final AccessibleState HORIZONTAL + = new AccessibleState("horizontal"); + + /** + * Indicates that this text object can only hold a single line. + * + * @see #MULTI_LINE + */ + public static final AccessibleState SINGLE_LINE + = new AccessibleState("single line"); + + /** + * Indicates that this text object can hold multiple lines. + * + * @see #SINGLE_LINE + */ + public static final AccessibleState MULTI_LINE + = new AccessibleState("multiple line"); + + /** + * Indicates that this object is transient. This means the object is + * generated for method queries, but will never generate events, because + * its container (such as a tree, list, or table) does all the work. + */ + public static final AccessibleState TRANSIENT + = new AccessibleState("transient"); + + /** + * Create a new constant with a locale independent key. Follow the example, + * keep the constructor private and make public constants instead. + * + * @param key the name of the state + * @see #toDisplayString(String, Locale) + */ + protected AccessibleState(String key) + { + this.key = key; + } +} // class AccessibleState diff --git a/libjava/javax/accessibility/AccessibleStateSet.java b/libjava/javax/accessibility/AccessibleStateSet.java new file mode 100644 index 00000000000..e1b112abf79 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleStateSet.java @@ -0,0 +1,172 @@ +/* AccessibleStateSet.java -- the combined state of an accessible object + Copyright (C) 2002 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.util.Vector; + +/** + * Describes all elements of an accessible object's state. For example, an + * object may be enabled and have focus. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see AccessibleState + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleStateSet +{ + /** + * The list of states, should be instances of AccessibleState. Don't set + * this to null. + * + * @see #add(AccessibleState) + * @see #addAll(AccessibleState[]) + * @see #remove(AccessibleState) + * @see #contains(AccessibleState) + * @see #toArray() + * @see #clear() + */ + protected Vector states = new Vector(); + + /** + * Create an empty state set. + */ + public AccessibleStateSet() + { + } + + /** + * Create a state set initialized with the given states, duplicates are + * ignored. + * + * @param states the states to insert + * @throws NullPointerException if states is null + */ + public AccessibleStateSet(AccessibleState[] states) + { + addAll(states); + } + + /** + * Add a new state to the current set. Return true if the state was added, + * as duplicates are ignored. Entering a null state will cause problems + * later, so don't do it. + * + * @param state the state to add + * @return true if the state was added + */ + public boolean add(AccessibleState state) + { + return states.contains(state) ? false : states.add(state); + } + + /** + * Add all of the states to the current set. Duplicates are ignored. + * Entering a null state will cause problems later, so don't do it. + * + * @param array the array of states to add + * @throws NullPointerException if array is null + */ + public void addAll(AccessibleState[] array) + { + int i = array.length; + while (--i >= 0) + add(array[i]); + } + + /** + * Remove a state from the set. If a state was removed, return true. + * + * @param state the state to remove + * @return true if the set changed + */ + public boolean remove(AccessibleState state) + { + return states.remove(state); + } + + /** + * Clear all states in the set. + */ + public void clear() + { + states.clear(); + } + + /** + * Check if the current state is in the set. + * + * @param state the state to locate + * @return true if it is in the set + */ + public boolean contains(AccessibleState state) + { + return states.contains(state); + } + + /** + * Return the state set as an array. + * + * @return an array of the current states + */ + public AccessibleState[] toArray() + { + AccessibleState[] result = new AccessibleState[states.size()]; + states.toArray(result); + return result; + } + + /** + * Return a localized, comma-separated string representing all states + * in the set. This is in arbitrary order. + * + * @return the string representation + * @see AccessibleBundle#toDisplayString(String, Locale) + */ + public String toString() + { + int i = states.size(); + if (i == 0) + return ""; + // Pre-allocate an average of 10 chars per state. + StringBuffer b = new StringBuffer(i * 10); + while (--i >= 0) + b.append(states.get(i)).append(','); + return b.substring(0, b.length() - 1); + } +} // class AccessibleStateSet diff --git a/libjava/javax/accessibility/AccessibleTable.java b/libjava/javax/accessibility/AccessibleTable.java new file mode 100644 index 00000000000..4fd58c5a237 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleTable.java @@ -0,0 +1,236 @@ +/* AccessibleTable.java -- aids in accessibly manipulating tables + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Objects which present information in a 2-dimensional table should implement + * this interface. Accessibility software can use the implementations of + * this interface to navigate and change the attributes of the table. + * + * <p>The <code>AccessibleContext.getAccessibleTable()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleTable() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleTable +{ + /** + * Return the caption for the table, or null if unknown. + * + * @return the table caption + */ + Accessible getAccessibleCaption(); + + /** + * Set the table caption. + * + * @param caption the new caption + */ + void setAccessibleCaption(Accessible caption); + + /** + * Return the summary description of the table, or null if unknown. + * + * @return the summary description + */ + Accessible getAccessibleSummary(); + + /** + * Set the table summary description. + * + * @param summary the new summary + */ + void setAccessibleSummary(Accessible summary); + + /** + * Return the number of rows in the table. + * + * @return the row count + */ + int getAccessibleRowCount(); + + /** + * Return the number of columns in the table. + * + * @return the column count + */ + int getAccessibleColumnCount(); + + /** + * Return the cell at the specified row and column, or null if out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return the cell at (r,c) + */ + Accessible getAccessibleAt(int r, int c); + + /** + * Returns the number of merged rows occupied at the specified row and + * column, or 0 if out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return the row extent at (r,c) + */ + int getAccessibleRowExtentAt(int r, int c); + + /** + * Returns the number of merged columns occupied at the specified row and + * column, or 0 if out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return the column extent at (r,c) + */ + int getAccessibleColumnExtentAt(int r, int c); + + /** + * Return the row headers as a table. + * + * @return the row headers, or null if there are none + */ + AccessibleTable getAccessibleRowHeader(); + + /** + * Set the row headers. + * + * @param header the new row header + */ + // XXX What happens if header is incompatible size? + void setAccessibleRowHeader(AccessibleTable header); + + /** + * Return the column headers as a table. + * + * @return the column headers, or null if there are none + */ + AccessibleTable getAccessibleColumnHeader(); + + /** + * Set the column headers. + * + * @param header the new column header + */ + // XXX What happens if header is incompatible size? + void setAccessibleColumnHeader(AccessibleTable header); + + /** + * Return the description of a row, or null if there is none or the index + * is out of bounds. + * + * @param r the 0-based row index + * @return the description + */ + Accessible getAccessibleRowDescription(int r); + + /** + * Set the description of a row. Does nothing if the index is invalid. + * + * @param r the 0-based row index + * @param description the new description + */ + void setAccessibleRowDescription(int r, Accessible description); + + /** + * Return the description of a column, or null if there is none or the index + * is out of bounds. + * + * @param c the 0-based column index + * @return the description + */ + Accessible getAccessibleColumnDescription(int c); + + /** + * Set the description of a column. Does nothing if the index is invalid. + * + * @param c the 0-based column index + * @param description the new description + */ + void setAccessibleColumnDescription(int c, Accessible description); + + /** + * Return whether the cell at the specified location is selected. Returns + * false if the index is out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return true if that cell is selected + */ + boolean isAccessibleSelected(int r, int c); + + /** + * Return whether the specified row is selected. Returns false if the + * index is out of bounds. + * + * @param r the 0-based row index + * @return true if that row is selected + */ + boolean isAccessibleRowSelected(int r); + + /** + * Return whether the specified column is selected. Returns false if the + * index is out of bounds. + * + * @param c the 0-based column index + * @return true if that column is selected + */ + boolean isAccessibleColumnSelected(int c); + + /** + * Return the selected rows. May be null or empty if there is no selection. + * + * @return the indices of selected rows + */ + int[] getSelectedAccessibleRows(); + + /** + * Return the selected columns. May be null or empty if there is no + * selection. + * + * @return the indices of selected columns + */ + int[] getSelectedAccessibleColumns(); +} // interface AccessibleTable diff --git a/libjava/javax/accessibility/AccessibleTableModelChange.java b/libjava/javax/accessibility/AccessibleTableModelChange.java new file mode 100644 index 00000000000..9cff7bfa749 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleTableModelChange.java @@ -0,0 +1,102 @@ +/* AccessibleTableModelChange.java -- describes change to an accessible table + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * Describes a change to an accessible table. Accessibility software can use + * the implementations of this interface to update their state after a + * change to a table. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleTable() + * @see AccessibleTable + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleTableModelChange +{ + /** Identifies insertion of rows or columns. */ + int INSERT = 1; + + /** Identifies change to existing data. */ + int UPDATE = 0; + + /** Identifies deletion of rows or columns. */ + int DELETE = -1; + + /** + * Returns the change type. + * + * @return the type + * @see #INSERT + * @see #UPDATE + * @see #DELETE + */ + int getType(); + + /** + * Returns the first row that changed. + * + * @return the 0-based index of the first row to change + */ + int getFirstRow(); + + /** + * Returns the last row that changed. + * + * @return the 0-based index of the last row to change + */ + int getLastRow(); + + /** + * Returns the first column that changed. + * + * @return the 0-based index of the first column to change + */ + int getFirstColumn(); + + /** + * Returns the last column that changed. + * + * @return the 0-based index of the last column to change + */ + int getLastColumn(); +} // interface AccessibleTableModelChange diff --git a/libjava/javax/accessibility/AccessibleText.java b/libjava/javax/accessibility/AccessibleText.java new file mode 100644 index 00000000000..14c324c7708 --- /dev/null +++ b/libjava/javax/accessibility/AccessibleText.java @@ -0,0 +1,184 @@ +/* AccessibleText.java -- aids in accessibly manipulating text + Copyright (C) 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +import java.awt.Rectangle; +import java.awt.Point; +import javax.swing.text.AttributeSet; + +/** + * Objects which present textual information on the display should implement + * this interface. Accessibility software can use the implementations of + * this interface to change the attributes and spacial location of the text. + * + * <p>The <code>AccessibleContext.getAccessibleText()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleText() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleText +{ + /** + * Constant designating that the next selection should be a character. + * + * @see #getAtIndex(int, int) + * @see #getAfterIndex(int, int) + * @see #getBeforeIndex(int, int) + */ + int CHARACTER = 1; + + /** + * Constant designating that the next selection should be a word. + * + * @see #getAtIndex(int, int) + * @see #getAfterIndex(int, int) + * @see #getBeforeIndex(int, int) + */ + int WORD = 2; + + /** + * Constant designating that the next selection should be a sentence. + * + * @see #getAtIndex(int, int) + * @see #getAfterIndex(int, int) + * @see #getBeforeIndex(int, int) + */ + int SENTENCE = 3; + + /** + * Given a point in the coordinate system of this object, return the + * 0-based index of the character at that point, or -1 if there is none. + * + * @param p the point to look at + * @return the character index, or -1 + */ + int getIndexAtPoint(Point point); + + /** + * Determines the bounding box of the indexed character. Returns an empty + * rectangle if the index is out of bounds. + * + * @param index the 0-based character index + * @return the bounding box, may be empty + */ + Rectangle getCharacterBounds(int index); + + /** + * Return the number of characters. + * + * @return the character count + */ + int getCharCount(); + + /** + * Return the offset of the character. The offset matches the index of the + * character to the right, since the carat lies between characters. + * + * @return the 0-based caret position + */ + int getCaretPosition(); + + /** + * Returns the section of text at the index, or null if the index or part + * is invalid. + * + * @param part {@link CHARACTER}, {@link WORD}, or {@link SENTENCE} + * @param index the 0-based character index + * @return the selection of text at that index, or null + */ + String getAtIndex(int part, int index); + + /** + * Returns the section of text after the index, or null if the index or part + * is invalid. + * + * @param part {@link CHARACTER}, {@link WORD}, or {@link SENTENCE} + * @param index the 0-based character index + * @return the selection of text after that index, or null + */ + String getAfterIndex(int part, int index); + + /** + * Returns the section of text before the index, or null if the index or part + * is invalid. + * + * @param part {@link CHARACTER}, {@link WORD}, or {@link SENTENCE} + * @param index the 0-based character index + * @return the selection of text before that index, or null + */ + String getBeforeIndex(int part, int index); + + /** + * Returns the attributes of a character at an index, or null if the index + * is out of bounds. + * + * @param index the 0-based character index + * @return the character's attributes + */ + AttributeSet getCharacterAttribute(int index); + + /** + * Returns the start index of the selection. If there is no selection, this + * is the same as the caret location. + * + * @return the 0-based character index of the selection start + */ + int getSelectionStart(); + + /** + * Returns the end index of the selection. If there is no selection, this + * is the same as the caret location. + * + * @return the 0-based character index of the selection end + */ + int getSelectionEnd(); + + /** + * Returns the selected text. This may be null or "" if no text is selected. + * + * @return the selected text + */ + String getSelectedText(); +} // interface AccessibleText diff --git a/libjava/javax/accessibility/AccessibleValue.java b/libjava/javax/accessibility/AccessibleValue.java new file mode 100644 index 00000000000..69da5c8a4eb --- /dev/null +++ b/libjava/javax/accessibility/AccessibleValue.java @@ -0,0 +1,94 @@ +/* AccessibleValue.java -- aids in accessibly controlling values + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.accessibility; + +/** + * If an object implements this interface then it must be able to control + * a numerical value. For example, a scroll bar has a position represented + * by a number. Accessibility software can use the implementations of this + * interface to change the associated value. + * + * <p>The <code>AccessibleContext.getAccessibleValue()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake <ebb9@email.byu.edu> + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleValue() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleValue +{ + /** + * Gets the current value of this object, or null if it has not been set. + * + * @return the current value, or null + * @see #setCurrentAccessibleValue(Number) + */ + Number getCurrentAccessibleValue(); + + /** + * Sets the current value of this object. Returns true if the number + * successfully changed. + * + * @param number the new value + * @return true on success + */ + // XXX What happens if number is null? + boolean setCurrentAccessibleValue(Number number); + + /** + * Gets the minimum value in the range of this object, or null if there is + * no minimum. + * + * @return the minimum + * @see #getMaximumAccessibleValue() + */ + Number getMinimumAccessibleValue(); + + /** + * Gets the maximum value in the range of this object, or null if there is + * no maximum. + * + * @return the maximum + * @see #getMinimumAccessibleValue() + */ + Number getMaximumAccessibleValue(); +} // interface AccessibleValue diff --git a/libjava/javax/swing/AbstractAction.java b/libjava/javax/swing/AbstractAction.java new file mode 100644 index 00000000000..fb81c503b48 --- /dev/null +++ b/libjava/javax/swing/AbstractAction.java @@ -0,0 +1,215 @@ +/* AbstractAction.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import javax.swing.event.*; +import java.util.*; + +/** + * AbstractAction + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class AbstractAction implements Action, Cloneable, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * enabled + */ + protected boolean enabled = true; + + /** + * changeSupport + */ + protected SwingPropertyChangeSupport changeSupport = + new SwingPropertyChangeSupport(this); + + /** + * store + */ + private transient HashMap store = new HashMap(); + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AbstractAction + */ + public AbstractAction() { + this(""); // TODO: default name + } // AbstractAction() + + /** + * Constructor AbstractAction + * @param name TODO + */ + public AbstractAction(String name) { + this(name, null); // TODO: default icon?? + } // AbstractAction() + + /** + * Constructor AbstractAction + * @param name TODO + * @param icon TODO + */ + public AbstractAction(String name, Icon icon) { + putValue(NAME, name); + putValue(SMALL_ICON, icon); + } // AbstractAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * readObject + * @param stream TODO + * @exception ClassNotFoundException TODO + * @exception IOException TODO + */ + private void readObject(ObjectInputStream stream) + throws ClassNotFoundException, IOException { + // TODO + } // readObject() + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * clone + * @exception CloneNotSupportedException TODO + * @returns Object + */ + protected Object clone() throws CloneNotSupportedException { + // What to do?? + return null; + } // clone() + + /** + * getValue + * @param key TODO + * @returns Object + */ + public Object getValue(String key) { + return store.get(key); + } // getValue() + + /** + * putValue + * @param key TODO + * @param value TODO + */ + public void putValue(String key, Object value) { + store.put(key, value); + } // putValue() + + /** + * isEnabled + * @returns boolean + */ + public boolean isEnabled() { + return enabled; + } // isEnabled() + + /** + * setEnabled + * @param enabled TODO + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } // setEnabled() + + /** + * getKeys + * @returns Object[] + */ + public Object[] getKeys() { + return store.keySet().toArray(); + } // getKeys() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + protected void firePropertyChange(String propertyName, + Object oldValue, Object newValue) { + changeSupport.firePropertyChange(propertyName, oldValue, newValue); + } // firePropertyChange() + + /** + * addPropertyChangeListener + * @param listener TODO + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + changeSupport.addPropertyChangeListener(listener); + } // addPropertyChangeListener() + + /** + * removePropertyChangeListener + * @param listener TODO + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + changeSupport.removePropertyChangeListener(listener); + } // removePropertyChangeListener() + + /** + * actionPerformed + * @param event TODO + */ + public abstract void actionPerformed(ActionEvent event); + + +} // AbstractAction diff --git a/libjava/javax/swing/AbstractButton.java b/libjava/javax/swing/AbstractButton.java new file mode 100644 index 00000000000..b675d808a42 --- /dev/null +++ b/libjava/javax/swing/AbstractButton.java @@ -0,0 +1,795 @@ +/* AbstractButton.java -- Provides basic button functionality. + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.event.*; +import javax.swing.plaf.*; +import javax.swing.text.*; +import javax.accessibility.*; + +import java.util.*; +import java.beans.*; + +/** + * Provides basic button functionality + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public abstract class AbstractButton extends JComponent + implements ItemSelectable, SwingConstants +{ + Icon default_icon, pressed_button, disabled_button, + selected_button, disabled_selected_button, current_icon; + String text; + + int vert_align = CENTER; + int hori_align = CENTER; + int hori_text_pos = CENTER; + int vert_text_pos = CENTER; + + boolean paint_border = true, paint_focus; + Action action_taken; + ButtonModel model; + Insets margin; + + + public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted"; + + /** + * AccessibleAbstractButton + */ + protected abstract class AccessibleAbstractButton + extends AccessibleJComponent + implements AccessibleAction, AccessibleValue, AccessibleText { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleAbstractButton + * @param component TODO + */ + protected AccessibleAbstractButton(AbstractButton component) { + super(component); + // TODO + } // AccessibleAbstractButton() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleName + * @returns String + */ + public String getAccessibleName() { + return null; // TODO + } // getAccessibleName() + + /** + * getAccessibleIcon + * @returns AccessibleIcon[] + */ + public AccessibleIcon[] getAccessibleIcon() { + return null; // TODO + } // getAccessibleIcon() + + /** + * getAccessibleRelationSet + * @returns AccessibleRelationSet + */ + public AccessibleRelationSet getAccessibleRelationSet() { + return null; // TODO + } // getAccessibleRelationSet() + + /** + * getAccessibleAction + * @returns AccessibleAction + */ + public AccessibleAction getAccessibleAction() { + return null; // TODO + } // getAccessibleAction() + + /** + * getAccessibleValue + * @returns AccessibleValue + */ + public AccessibleValue getAccessibleValue() { + return null; // TODO + } // getAccessibleValue() + + /** + * getAccessibleActionCount + * @returns int + */ + public int getAccessibleActionCount() { + return 0; // TODO + } // getAccessibleActionCount() + + /** + * getAccessibleActionDescription + * @param value0 TODO + * @returns String + */ + public String getAccessibleActionDescription(int value0) { + return null; // TODO + } // getAccessibleActionDescription() + + /** + * doAccessibleAction + * @param value0 TODO + * @returns boolean + */ + public boolean doAccessibleAction(int value0) { + return false; // TODO + } // doAccessibleAction() + + /** + * getCurrentAccessibleValue + * @returns Number + */ + public Number getCurrentAccessibleValue() { + return null; // TODO + } // getCurrentAccessibleValue() + + /** + * setCurrentAccessibleValue + * @param value0 TODO + * @returns boolean + */ + public boolean setCurrentAccessibleValue(Number value0) { + return false; // TODO + } // setCurrentAccessibleValue() + + /** + * getMinimumAccessibleValue + * @returns Number + */ + public Number getMinimumAccessibleValue() { + return null; // TODO + } // getMinimumAccessibleValue() + + /** + * getMaximumAccessibleValue + * @returns Number + */ + public Number getMaximumAccessibleValue() { + return null; // TODO + } // getMaximumAccessibleValue() + + /** + * getAccessibleText + * @returns AccessibleText + */ + public AccessibleText getAccessibleText() { + return null; // TODO + } // getAccessibleText() + + /** + * getIndexAtPoint + * @param value0 TODO + * @returns int + */ + public int getIndexAtPoint(Point value0) { + return 0; // TODO + } // getIndexAtPoint() + + /** + * getCharacterBounds + * @param value0 TODO + * @returns Rectangle + */ + public Rectangle getCharacterBounds(int value0) { + return null; // TODO + } // getCharacterBounds() + + /** + * getCharCount + * @returns int + */ + public int getCharCount() { + return 0; // TODO + } // getCharCount() + + /** + * getCaretPosition + * @returns int + */ + public int getCaretPosition() { + return 0; // TODO + } // getCaretPosition() + + /** + * getAtIndex + * @param value0 TODO + * @param value1 TODO + * @returns String + */ + public String getAtIndex(int value0, int value1) { + return null; // TODO + } // getAtIndex() + + /** + * getAfterIndex + * @param value0 TODO + * @param value1 TODO + * @returns String + */ + public String getAfterIndex(int value0, int value1) { + return null; // TODO + } // getAfterIndex() + + /** + * getBeforeIndex + * @param value0 TODO + * @param value1 TODO + * @returns String + */ + public String getBeforeIndex(int value0, int value1) { + return null; // TODO + } // getBeforeIndex() + + /** + * getCharacterAttribute + * @param value0 TODO + * @returns AttributeSet + */ + public AttributeSet getCharacterAttribute(int value0) { + return null; // TODO + } // getCharacterAttribute() + + /** + * getSelectionStart + * @returns int + */ + public int getSelectionStart() { + return 0; // TODO + } // getSelectionStart() + + /** + * getSelectionEnd + * @returns int + */ + public int getSelectionEnd() { + return 0; // TODO + } // getSelectionEnd() + + /** + * getSelectedText + * @returns String + */ + public String getSelectedText() { + return null; // TODO + } // getSelectedText() + + /** + * getTextRectangle + * @returns Rectangle + */ + private Rectangle getTextRectangle() { + return null; // TODO + } // getTextRectangle() + + + } // AccessibleAbstractButton + + + static private class JFocusListener implements FocusListener + { + AbstractButton c; + + JFocusListener(AbstractButton c) + { + this.c = c; + } + + public void focusLost(FocusEvent event) + { + c.getModel().setArmed(false); + + System.out.println("LOST FOCUS"); + if (c.isFocusPainted()) + { + c.repaint(); + } + } + public void focusGained(FocusEvent event) + { + System.out.println("GAIN FOCUS"); + } + } + + + /********************************************** + * + * + * Constructors + * + * + ****************/ + + AbstractButton() + { + this("",null); + } + + AbstractButton(String text, + Icon icon) + { + this.text = text; + setIcon(icon); + + setAlignmentX(LEFT_ALIGNMENT); + setAlignmentY(CENTER_ALIGNMENT); + + addFocusListener( new JFocusListener(this) ); + + setModel(new DefaultButtonModel(this)); + + updateUI(); // get a proper ui + } + + + /********************************************** + * + * + * Actions etc + * + * + ****************/ + + public ButtonModel getModel() + { return model; } + public void setModel(ButtonModel newModel) + { model = newModel; } + + public String getActionCommand() + { return getModel().getActionCommand(); } + public void setActionCommand(String aCommand) + { getModel().setActionCommand(aCommand); } + + public void addActionListener(ActionListener l) + { getModel().addActionListener(l); } + public void removeActionListener(ActionListener l) + { getModel().removeActionListener(l); } + + public void addChangeListener(ChangeListener l) + { getModel().addChangeListener(l); } + public void removeChangeListener(ChangeListener l) + { getModel().removeChangeListener(l); } + + public void addItemListener(ItemListener l) + { getModel().addItemListener(l); } + public void removeItemListener(ItemListener l) + { getModel().removeItemListener(l); } + + public int getHorizontalAlignment() + { return hori_align; } + public int getHorizontalTextPosition() + { return hori_text_pos; } + public int getVerticalAlignment() + { return vert_align; } + public int getVerticalTextPosition() + { return vert_text_pos; } + + + protected void fireItemStateChanged(ItemEvent event) + { getModel().fireItemStateChanged(event); } + protected void fireStateChanged(ChangeEvent event) + { getModel().fireStateChanged(event); } + protected void fireActionPerformed(ActionEvent event) + { getModel().fireActionPerformed(event); } + + public void setVerticalAlignment(int alignment) + { vert_align = alignment; } + public void setHorizontalAlignment(int alignment) + { hori_align = alignment; } + public void setVerticalTextPosition(int textPosition) + { vert_text_pos = textPosition; } + public void setHorizontalTextPosition(int textPosition) + { hori_text_pos = textPosition; } + + public int getMnemonic() + { return getModel().getMnemonic(); } + public void setMnemonic(char mne) + { getModel().setMnemonic(mne); } + public void setMnemonic(int mne) + { getModel().setMnemonic(mne); } + + public void setRolloverEnabled(boolean b) + { getModel().setRollover(b); } + public boolean isRolloverEnabled() + { return getModel().isRollover(); } + + + public boolean isBorderPainted() + { return paint_border; } + public void setBorderPainted(boolean b) + { + if (b != paint_border) + { + paint_border = b; + revalidate(); + repaint(); + } + } + + public Action getAction() + { return action_taken; } + public void setAction(Action a) + { + action_taken = a; + revalidate(); + repaint(); + } + + public void setSelected(boolean b) + { getModel().setSelected(b); } + public boolean isSelected() + { return getModel().isSelected(); } + + + public Icon getIcon() + { return default_icon; } + public void setIcon(Icon defaultIcon) + { + if (default_icon == defaultIcon) + return; + + default_icon = defaultIcon; + if (default_icon != null) + { + // XXX FIXME - icons do not know their parent +// default_icon.setParent(this); + } + revalidate(); + repaint(); + } + + public String getText() + { return text; } + public void setLabel(String label) + { setText(label); } + public String getLabel() + { return getText(); } + public void setText(String text) + { + this.text = text; + revalidate(); + repaint(); + } + + + public Insets getMargin() + { return margin; } + public void setMargin(Insets m) + { + margin = m; + revalidate(); + repaint(); + } + + public void setEnabled(boolean b) + { + super.setEnabled(b); + getModel().setEnabled(b); + repaint(); + } + + public Icon getPressedIcon() + { return pressed_button; } + public void setPressedIcon(Icon pressedIcon) + { + pressed_button = pressedIcon; + revalidate(); + repaint(); + } + + + public Icon getDisabledIcon() + { return disabled_button; } + public void setDisabledIcon(Icon disabledIcon) + { + disabled_button = disabledIcon; + revalidate(); + repaint(); + } + + public boolean isFocusPainted() + { return paint_focus; } + public void setFocusPainted(boolean b) + { + boolean old = paint_focus; + paint_focus = b; + + firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, + old, + b); + if (hasFocus()) + { + revalidate(); + repaint(); + } + } + + public boolean isFocusTraversable() + { + //Identifies whether or not this component can receive the focus. + return true; + } + + + protected int checkHorizontalKey(int key, String exception) + { + // Verify that key is a legal value for the horizontalAlignment properties. + return 0; + } + protected int checkVerticalKey(int key, String exception) + { + // Ensures that the key is a valid. + return 0; + } + protected void configurePropertiesFromAction(Action a) + { + //Factory method which sets the ActionEvent source's properties according to values from the Action instance. + } + + protected ActionListener createActionListener() + { + return new ActionListener() + { + public void actionPerformed(ActionEvent e) { } + }; + } + + protected PropertyChangeListener createActionPropertyChangeListener(Action a) + { + //Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. + return null; + } + protected ChangeListener createChangeListener() + { + // Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation. + return new ChangeListener() + { + public void stateChanged(ChangeEvent e) { } + }; + } + + protected ItemListener createItemListener() + { + return new ItemListener() + { + public void itemStateChanged(ItemEvent e) { } + }; + } + + + public void doClick() + { + doClick(100); + } + public void doClick(int pressTime) + { + //Toolkit.tlkBeep (); + //Programmatically perform a "click". + } + + + public Icon getDisabledSelectedIcon() + { + //Returns the icon used by the button when it's disabled and selected. + return disabled_selected_button; + } + + + public Icon getRolloverIcon() + { + // Returns the rollover icon for the button. + return null; + } + + Icon getRolloverSelectedIcon() + { + // Returns the rollover selection icon for the button. + return null; + } + Icon getSelectedIcon() + { + // Returns the selected icon for the button. + return selected_button; + } + + + public Object[] getSelectedObjects() + { + //Returns an array (length 1) containing the label or null if the button is not selected. + return null; + } + + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) + { + //This is overridden to return false if the current Icon's Image is not equal to the passed in Image img. + return current_icon == img; + } + + public boolean isContentAreaFilled() + { + // Checks whether the "content area" of the button should be filled. + return false; + } + + + + protected void paintBorder(Graphics g) + { + // Paint the button's border if BorderPainted property is true. + if (isBorderPainted()) + super.paintBorder(g); + } + protected String paramString() + { + // Returns a string representation of this AbstractButton. + return "AbstractButton"; + } + + + public void setContentAreaFilled(boolean b) + { + //Sets whether the button should paint the content area or leave it transparent. + } + + + public void setDisabledSelectedIcon(Icon disabledSelectedIcon) + { + // Sets the disabled selection icon for the button. + } + + public void setRolloverIcon(Icon rolloverIcon) + { + // Sets the rollover icon for the button. + } + public void setRolloverSelectedIcon(Icon rolloverSelectedIcon) + { + // Sets the rollover selected icon for the button. + } + + + public void setSelectedIcon(Icon selectedIcon) + { + // Sets the selected icon for the button. + } + + + public void setUI(ButtonUI ui) + { // Sets the L&F object that renders this component. + super.setUI(ui); + } + + public ButtonUI getUI() + { + //Returns the L&F object that renders this component. + return (ButtonUI) ui; + } + + public void updateUI() + { + /* + // Notification from the UIFactory that the L&F has changed. + if (getUI() == null) + { + setUI(getUI()); + } + */ + } + + protected void processActionEvent(ActionEvent e) + { + System.out.println("PROCESS-ACTION-EVENT: " + e); + } + + + protected void processMouseEvent(MouseEvent e) + { + // System.out.println("PROCESS-MOUSE-EVENT: " + e + ", PRESSED-IN-MODEL="+getModel().isPressed()); + + switch (e.getID()) + { + case MouseEvent.MOUSE_MOVED: + { + break; + } + case MouseEvent.MOUSE_PRESSED: + { + if (! isEnabled()) + { + System.out.println("button not enabled, ignoring press"); + } + else + { + System.out.println("telling model:press: " + getModel()); + getModel().setPressed(true); + repaint(); + } + break; + } + + case MouseEvent.MOUSE_RELEASED: + { + if (! isEnabled()) + { + System.out.println("button not enabled, ignoring release"); + } + else + { + int flags = 0; + + System.out.println(" XXX--> " + getActionCommand()); + + fireActionPerformed(new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, + getActionCommand(), + flags)); + + //System.out.println("telling model:release"); + getModel().setPressed(false); + repaint(); + } + break; + } + case MouseEvent.MOUSE_CLICKED: + { + break; + } + } + } +} diff --git a/libjava/javax/swing/AbstractCellEditor.java b/libjava/javax/swing/AbstractCellEditor.java new file mode 100644 index 00000000000..098aa990134 --- /dev/null +++ b/libjava/javax/swing/AbstractCellEditor.java @@ -0,0 +1,153 @@ +/* AbstractCellEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * AbstractCellEditor + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class AbstractCellEditor implements CellEditor, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * listenerList + */ + protected EventListenerList listenerList; + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AbstractCellEditor + */ + public AbstractCellEditor() { + // TODO + } // AbstractCellEditor() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * isCellEditable + * @param event TODO + * @returns boolean + */ + public boolean isCellEditable(EventObject event) { + return false; // TODO + } // isCellEditable() + + /** + * shouldSelectCell + * @param event TODO + * @returns boolean + */ + public boolean shouldSelectCell(EventObject event) { + return false; // TODO + } // shouldSelectCell() + + /** + * stopCellEditing + * @returns boolean + */ + public boolean stopCellEditing() { + return false; // TODO + } // stopCellEditing() + + /** + * cancelCellEditing + */ + public void cancelCellEditing() { + // TODO + } // cancelCellEditing() + + /** + * addCellEditorListener + * @param listener TODO + */ + public void addCellEditorListener(CellEditorListener listener) { + // TODO + } // addCellEditorListener() + + /** + * removeCellEditorListener + * @param listener TODO + */ + public void removeCellEditorListener(CellEditorListener listener) { + // TODO + } // removeCellEditorListener() + + /** + * fireEditingStopped + */ + protected void fireEditingStopped() { + // TODO + } // fireEditingStopped() + + /** + * fireEditingCanceled + */ + protected void fireEditingCanceled() { + // TODO + } // fireEditingCanceled() + + /** + * getCellEditorValue + * @returns Object + */ + public abstract Object getCellEditorValue(); + + +} // AbstractCellEditor diff --git a/libjava/javax/swing/AbstractListModel.java b/libjava/javax/swing/AbstractListModel.java new file mode 100644 index 00000000000..13518cafa19 --- /dev/null +++ b/libjava/javax/swing/AbstractListModel.java @@ -0,0 +1,204 @@ +/* AbstractListModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * AbstractListModel + * A2uthor Ronald Veldema + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class AbstractListModel implements ListModel, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * listenerList + */ + protected EventListenerList listenerList = new EventListenerList(); + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AbstractListModel + */ + public AbstractListModel() { + } // AbstractListModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addListDataListener + * @param listener TODO + */ + public void addListDataListener(ListDataListener listener) { + listenerList.add(ListDataListener.class, (EventListener) listener); + } // addListDataListener() + + /** + * removeListDataListener + * @param listener TODO + */ + public void removeListDataListener(ListDataListener listener) { + listenerList.remove(ListDataListener.class, (EventListener) listener); + } // removeListDataListener() + + /** + * fireContentsChanged + * @param source TODO + * @param startIndex TODO + * @param endIndex TODO + */ + protected void fireContentsChanged(Object source, int startIndex, int endIndex) { + + // Variables + ListDataEvent event; + EventListener[] listeners; + ListDataListener listener; + int index; + + // Create Event + event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED, + startIndex, endIndex); + + // Get Listeners + listeners = listenerList.getListeners(ListDataListener.class); + + // Process Listeners + for (index = 0; index < listeners.length; index++) { + listener = (ListDataListener) listeners[index]; + listener.contentsChanged(event); + } // for + + } // fireContentsChanged() + + /** + * fireIntervalAdded + * @param source TODO + * @param startIndex TODO + * @param endIndex TODO + */ + protected void fireIntervalAdded(Object source, int startIndex, int endIndex) { + + // Variables + ListDataEvent event; + EventListener[] listeners; + ListDataListener listener; + int index; + + // Create Event + event = new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED, + startIndex, endIndex); + + // Get Listeners + listeners = listenerList.getListeners(ListDataListener.class); + + // Process Listeners + for (index = 0; index < listeners.length; index++) { + listener = (ListDataListener) listeners[index]; + listener.intervalAdded(event); + } // for + + } // fireIntervalAdded() + + /** + * fireIntervalRemoved + * @param source TODO + * @param startIndex TODO + * @param endIndex TODO + */ + protected void fireIntervalRemoved(Object source, int startIndex, int endIndex) { + + // Variables + ListDataEvent event; + EventListener[] listeners; + ListDataListener listener; + int index; + + // Create Event + event = new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED, + startIndex, endIndex); + + // Get Listeners + listeners = listenerList.getListeners(ListDataListener.class); + + // Process Listeners + for (index = 0; index < listeners.length; index++) { + listener = (ListDataListener) listeners[index]; + listener.intervalRemoved(event); + } // for + + } // fireIntervalRemoved() + + /** + * getListeners + * @param listenerType TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class listenerType) { + return listenerList.getListeners(listenerType); + } // getListeners() + + /** + * getElementAt + * @param index TODO + * @returns Object + */ + public abstract Object getElementAt(int index); + + /** + * getSize + * @returns int + */ + public abstract int getSize(); + + +} // AbstractListModel diff --git a/libjava/javax/swing/AbstractSet.java b/libjava/javax/swing/AbstractSet.java new file mode 100644 index 00000000000..d83bb8a3b96 --- /dev/null +++ b/libjava/javax/swing/AbstractSet.java @@ -0,0 +1,101 @@ +/* AbstractSet.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.util.*; + +/** + * Empty + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public abstract class AbstractSet extends AbstractCollection implements Set +{ + boolean contained(Object []a1, Object b) + { + for (int i=0;i<a1.length;i++) + { + if (a1[i] == b) + return true; + } + return false; + } + + public boolean equals(Object o) + { + if (! (o instanceof AbstractSet)) + return false; + AbstractSet s = (AbstractSet) o; + + if (s == this) + return true; + + if (s.size() != size()) + return false; + + Object[] a1 = s.toArray(); + Object[] a2 = toArray(); + + for (int i=0;i<a1.length;i++) + { + if (! contained(a2, a1[i])) + return false; + } + return true; + } + + public int hashCode() + { + int hash = 0; + Object[] a1 = toArray(); + + if (a1 == null) + return 0; + + for (int i=0; i<a1.length; i++) + { + hash += a1[i].hashCode(); + } + return hash; + } + + public boolean removeAll(Collection c) + { + return false; + } +} diff --git a/libjava/javax/swing/Action.java b/libjava/javax/swing/Action.java new file mode 100644 index 00000000000..e9fbc762b1f --- /dev/null +++ b/libjava/javax/swing/Action.java @@ -0,0 +1,125 @@ +/* Action.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.PropertyChangeListener; + +/** + * Action + * @author Ronald Veldema (rveldema@cs.vu.nl) + * @author Andrew Selkirk + */ +public interface Action extends ActionListener { + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * DEFAULT + */ + public static final String DEFAULT = "Default"; + + /** + * LONG_DESCRIPTION + */ + public static final String LONG_DESCRIPTION = "LongDescription"; + + /** + * NAME + */ + public static final String NAME = "Name"; + + /** + * SHORT_DESCRIPTION + */ + public static final String SHORT_DESCRIPTION = "ShortDescription"; + + /** + * SMALL_ICON + */ + public static final String SMALL_ICON = "SmallIcon"; + + + //------------------------------------------------------------- + // Interface: Action ------------------------------------------ + //------------------------------------------------------------- + + /** + * getValue + * @param key TODO + * @returns TODO + */ + public Object getValue(String key); + + /** + * setValue + * @param key TODO + * @param value TODO + */ + public void putValue(String key, Object value); + + /** + * isEnabled + * @returns TODO + */ + public boolean isEnabled(); + + /** + * setEnabled + * @param b TODO + */ + public void setEnabled(boolean b); + + /** + * addPropertyChangeListener + * @param listener TODO + */ + public void addPropertyChangeListener(PropertyChangeListener listener); + + /** + * removePropertyChangeListener + * @param listener TODO + */ + public void removePropertyChangeListener(PropertyChangeListener listener); + + +} // Action diff --git a/libjava/javax/swing/ActionMap.java b/libjava/javax/swing/ActionMap.java new file mode 100644 index 00000000000..b95144de4f6 --- /dev/null +++ b/libjava/javax/swing/ActionMap.java @@ -0,0 +1,229 @@ +/* ActionMap.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; + +/** + * ActionMap + * @author Andrew Selkirk + * @version 1.0 + */ +public class ActionMap implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionMap + */ + private Map actionMap = new HashMap(); + + /** + * parent + */ + private ActionMap parent = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ActionMap + */ + public ActionMap() { + } // ActionMap() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * get + * @param key TODO + * @returns Action + */ + public Action get(Object key) { + + // Variables + Object result; + + // Check Local store + result = actionMap.get(key); + + // Check Parent + if (result == null) { + result = parent.get(key); + } // if + + return (Action) result; + + } // get() + + /** + * put + * @param key TODO + * @param action TODO + */ + public void put(Object key, Action action) { + if (action == null) { + actionMap.remove(key); + } else { + actionMap.put(key, action); + } // if + } // put() + + /** + * remove + * @param key TODO + */ + public void remove(Object key) { + actionMap.remove(key); + } // remove() + + /** + * getParent + * @returns ActionMap + */ + public ActionMap getParent() { + return parent; + } // getParent() + + /** + * setParent + * @param parentMap TODO + */ + public void setParent(ActionMap parentMap) { + parent = parentMap; + } // setParent() + + /** + * size + * @returns int + */ + public int size() { + return actionMap.size(); + } // size() + + /** + * clear + */ + public void clear() { + actionMap.clear(); + } // clear() + + /** + * keys + * @returns Object[] + */ + public Object[] keys() { + return convertSet(actionMap.keySet()); + } // keys() + + /** + * allKeys + * @returns Object[] + */ + public Object[] allKeys() { + + // Variables + Set set; + + // Initialize + set = new HashSet(); + + // Get Key Sets + if (parent != null) { + set.addAll(Arrays.asList(parent.allKeys())); + } // if + set.addAll(actionMap.keySet()); + + return convertSet(set); + + } // allKeys() + + private Object[] convertSet(Set set) { + + // Variables + int index; + Iterator iterator; + Object[] keys; + + // Create Final array + keys = new Object[set.size()]; + iterator = set.iterator(); + index = 0; + while (iterator.hasNext()) { + keys[index++] = iterator.next(); + } // while + + return keys; + + } // convertSet() + + + //------------------------------------------------------------- + // Interface: Serializable ------------------------------------ + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param stream TODO + * @exception ClassNotFoundException TODO + * @exception IOException TODO + */ + private void readObject(ObjectInputStream value0) throws ClassNotFoundException, IOException { + // TODO + } // readObject() + + +} // ActionMap diff --git a/libjava/javax/swing/BorderFactory.java b/libjava/javax/swing/BorderFactory.java new file mode 100644 index 00000000000..4a4433c7bff --- /dev/null +++ b/libjava/javax/swing/BorderFactory.java @@ -0,0 +1,331 @@ +package javax.swing; + +import java.awt.*; +import java.awt.font.*; +import javax.swing.border.*; + + +public class BorderFactory +{ + public static Border createLineBorder(Color color) + { /* + Creates a line border withe the specified color. + + Parameters: + color - a Color to use for the lineReturns: + the Border object +createLineBorder + */ + return null; + } + +public static Border createLineBorder(Color color, + int thickness) + { /* + + Creates a line border withe the specified color and width. The width applies to all 4 sides of the border. To specify widths individually for the top, bottom, left, and right, use createMatteBorder(int,int,int,int,Color). + + Parameters: + color - a Color to use for the linethickness - an int specifying the width in pixelsReturns: + the Border object +createRaisedBevelBorder + */ + return null; + } + + +public static Border createRaisedBevelBorder() + { /* + + Created a border with a raised beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a raised border, highlights are on top and shadows are underneath.) + + Returns: + the Border object +createLoweredBevelBorder + + */ + return null; + } + +public static Border createLoweredBevelBorder() + { /* + + Created a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.) + + Returns: + the Border object +createBevelBorder + + */ + return null; + } + +public static Border createBevelBorder(int type) + + { /* + Create a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.). + + Parameters: + type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDReturns: + the Border object +createBevelBorder + + */ + return null; + } + +public static Border createBevelBorder(int type, + Color highlight, + Color shadow) + { /* + + Create a beveled border of the specified type, using the specified highlighting and shadowing. The outer edge of the highlighted area uses a brighter shade of the highlight color. The inner edge of the shadow area uses a brighter shade of the shadaw color. + + Parameters: + type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDhighlight - a Color object for highlightsshadow - a Color object for shadowsReturns: + the Border object +createBevelBorder + + */ + return null; + } + +public static Border createBevelBorder(int type, + Color highlightOuter, + Color highlightInner, + Color shadowOuter, + Color shadowInner) + { /* + + Create a beveled border of the specified type, using the specified colors for the inner and outer highlight and shadow areas. + + Parameters: + type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDhighlightOuter - a Color object for the outer edge of the highlight areahighlightInner - a Color object for the inner edge of the highlight areashadowOuter - a Color object for the outer edge of the shadow areashadowInner - a Color object for the inner edge of the shadow areaReturns: + the Border object +createEtchedBorder + */ + return null; + } + + +public static Border createEtchedBorder() + { /* + + Create a border with an "etched" look using the component's current background color for highlighting and shading. + + Returns: + the Border object +createEtchedBorder + + */ + return null; + } + +public static Border createEtchedBorder(Color highlight, + Color shadow) + { /* + + Create a border with an "etched" look using the specified highlighting and shading colors. + + Parameters: + highlight - a Color object for the border highlightsshadow - a Color object for the border shadowsReturns: + the Border object +createTitledBorder + + */ + return null; + } + + public static TitledBorder createTitledBorder(String title) + { /* + Create a new title border specifying the text of the title, using the default border (etched), using the default text position (sitting on the top line) and default justification (left) and using the default font and text color determined by the current look and feel. + + Parameters: + title - a String containing the text of the titleReturns: + the TitledBorder object +createTitledBorder + + */ + return null; + } + + public static TitledBorder createTitledBorder(Border border) + { /* + + Create a new title border with an empty title specifying the border object, using the default text position (sitting on the top line) and default justification (left) and using the default font, text color, and border determined by the current look and feel. (The Motif and Windows look and feels use an etched border; The Java look and feel use a gray border.) + + Parameters: + border - the Border object to add the title toReturns: + the TitledBorder object +createTitledBorder + + */ + return null; + } + +public static TitledBorder createTitledBorder(Border border, + String title) + { /* + + Add a title to an existing border, specifying the text of the title, using the default positioning (sitting on the top line) and default justification (left) and using the default font and text color determined by the current look and feel. + + Parameters: + border - the Border object to add the title totitle - a String containing the text of the titleReturns: + the TitledBorder object +createTitledBorder + + */ + return null; + } + +public static TitledBorder createTitledBorder(Border border, + String title, + int titleJustification, + int titlePosition) + { /* + + Add a title to an existing border, specifying the text of the title along with its positioning, using the default font and text color determined by the current look and feel. + + Parameters: + border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).Returns: + the TitledBorder object +createTitledBorder + + */ + return null; + } + +public static TitledBorder createTitledBorder(Border border, + String title, + int titleJustification, + int titlePosition, + Font titleFont) + { /* + + Add a title to an existing border, specifying the text of the title along with its positioning and font, using the default text color determined by the current look and feel. + + Parameters: + border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).titleFont - a Font object specifying the title fontReturns: + the TitledBorder object +createTitledBorder + + */ + return null; + } + +public static TitledBorder createTitledBorder(Border border, + String title, + int titleJustification, + int titlePosition, + Font titleFont, + Color titleColor) + { /* + + Add a title to an existing border, specifying the text of the title along with its positioning, font, and color. + + Parameters: + border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).titleFont - a Font object specifying the title fonttitleColor - a Color object specifying the title colorReturns: + the TitledBorder object +createEmptyBorder + + */ + return null; + } + +public static Border createEmptyBorder() + { /* + + Creates an empty border that takes up no space. (The width of the top, bottom, left, and right sides are all zero.) + + Returns: + the Border object +createEmptyBorder + + */ + return null; + } + +public static Border createEmptyBorder(int top, + int left, + int bottom, + int right) + { /* + + Creates an empty border that takes up no space but which does no drawing, specifying the width of the top, left, bottom, and right sides. + + Parameters: + top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelsReturns: + the Border object +createCompoundBorder + + */ + return null; + } + +public static CompoundBorder createCompoundBorder() + { /* + + Create a compound border with a null inside edge and a null outside edge. + + Returns: + the CompoundBorder object +createCompoundBorder + */ + return null; + } + + +public static CompoundBorder createCompoundBorder(Border outsideBorder, + Border insideBorder) + { /* + + Create a compound border specifying the border objects to use for the outside and inside edges. + + Parameters: + outsideBorder - a Border object for the outer edge of the compound borderinsideBorder - a Border object for the inner edge of the compound borderReturns: + the CompoundBorder object +createMatteBorder + */ + return null; + } + + +public static MatteBorder createMatteBorder(int top, + int left, + int bottom, + int right, + Color color) + { /* + + Create a matte-look border using a solid color. (The difference between this border and a line border is that you can specify the individual border dimensions.) + + Parameters: + top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelscolor - a Color to use for the borderReturns: + the MatteBorder object +createMatteBorder + + */ + return null; + } + +public static MatteBorder createMatteBorder(int top, + int left, + int bottom, + int right, + Icon tileIcon) + { /* + + Create a matte-look border that consists of multiple tiles of a specified icon. Multiple copies of the icon are placed side-by-side to fill up the border area. + + Note: + If the icon doesn't load, the border area is painted gray. + + Parameters: + top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelstileIcon - the Icon object used for the border tilesReturns: + the MatteBorder object + + */ + return null; + } + +} diff --git a/libjava/javax/swing/BoundedRangeModel.java b/libjava/javax/swing/BoundedRangeModel.java new file mode 100644 index 00000000000..d2db8764c77 --- /dev/null +++ b/libjava/javax/swing/BoundedRangeModel.java @@ -0,0 +1,138 @@ +/* BoundedRangeModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import javax.swing.event.*; + +/** + * BoundedRangeModel + * @author Andrew Selkirk + * @version 1.0 + */ +public interface BoundedRangeModel { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getValue + * @returns int + */ + public int getValue(); + + /** + * setValue + * @param value TODO + */ + public void setValue(int value); + + /** + * getMinimum + * @returns int + */ + public int getMinimum(); + + /** + * setMinimum + * @param minimum TODO + */ + public void setMinimum(int minimum); + + /** + * getMaximum + * @returns int + */ + public int getMaximum(); + + /** + * setMaximum + * @param maximum TODO + */ + public void setMaximum(int maximum); + + /** + * getValueIsAdjusting + * @returns boolean + */ + public boolean getValueIsAdjusting(); + + /** + * setValueIsAdjusting + * @param adjusting TODO + */ + public void setValueIsAdjusting(boolean adjusting); + + /** + * getExtent + * @returns int + */ + public int getExtent(); + + /** + * setExtent + * @param extent TODO + */ + public void setExtent(int extent); + + /** + * setRangeProperties + * @param value TODO + * @param extent TODO + * @param min TODO + * @param max TODO + * @param adjusting TODO + */ + public void setRangeProperties(int value, int extent, int min, + int max, boolean adjusting); + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener); + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener listener); + + +} // BoundedRangeModel diff --git a/libjava/javax/swing/Box.java b/libjava/javax/swing/Box.java new file mode 100644 index 00000000000..a425db50b65 --- /dev/null +++ b/libjava/javax/swing/Box.java @@ -0,0 +1,52 @@ +/* Box.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * Needs some work I guess.... + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class Box extends JComponent +{ + Box(int a) + { + setLayout(new BoxLayout(this, + a)); + } +} diff --git a/libjava/javax/swing/BoxLayout.java b/libjava/javax/swing/BoxLayout.java new file mode 100644 index 00000000000..00d9cb438a2 --- /dev/null +++ b/libjava/javax/swing/BoxLayout.java @@ -0,0 +1,148 @@ +/* BoxLayout.java -- A layout for swing components. + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + +/** + * A layout for swing components. + * This implementation delegates its methods to + * java.awt.GridLayout to do its work. + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class BoxLayout implements LayoutManager2 +{ + GridLayout gridbag; + + final static int X_AXIS = 0; + final static int Y_AXIS = 1; + + int way = X_AXIS; + + BoxLayout(JComponent p, + int way) + { + int width = 0; + int height = 0; + + this.way = way; + + if (way == X_AXIS) + { + width = 1; + } + else + { + height = 1; + } + + + gridbag = new GridLayout(width, height); + } + + BoxLayout(int way) + { + this(null,way); + } + + + public void addLayoutComponent(String name, Component comp) + { + if (way == X_AXIS) + { + gridbag.setColumns( gridbag.getColumns() + 1); + } + else + { + gridbag.setRows( gridbag.getRows() + 1); + } + } + + public void removeLayoutComponent(Component comp) + { + gridbag.removeLayoutComponent(comp); + if (way == X_AXIS) + { + gridbag.setColumns( gridbag.getColumns() - 1); + } + else + { + gridbag.setRows( gridbag.getRows() - 1); + } + } + + public Dimension preferredLayoutSize(Container parent) + { + return gridbag.preferredLayoutSize(parent); + } + + public Dimension minimumLayoutSize(Container parent) + { + return gridbag.minimumLayoutSize(parent); + } + + public void layoutContainer(Container parent) + { + gridbag.layoutContainer(parent); + } + + public void addLayoutComponent ( Component child, Object constraints ) + { + addLayoutComponent("", child); + } + + public float getLayoutAlignmentX ( Container parent ) + { + return 0; + } + + public float getLayoutAlignmentY ( Container parent ) + { + return 0; + } + + public void invalidateLayout ( Container parent ) + { + } + + public Dimension maximumLayoutSize ( Container parent ) + { + return preferredLayoutSize(parent); + } +} diff --git a/libjava/javax/swing/ButtonGroup.java b/libjava/javax/swing/ButtonGroup.java new file mode 100644 index 00000000000..2301e5194ef --- /dev/null +++ b/libjava/javax/swing/ButtonGroup.java @@ -0,0 +1,137 @@ +/* ButtonGroup.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.io.*; +import java.util.*; +import javax.swing.event.*; + + +public class ButtonGroup implements Serializable +{ + Vector v = new Vector(); + ButtonModel sel; + + public ButtonGroup() {} + + public void add(AbstractButton b) + { + b.getModel().setGroup(this); + v.addElement(b); + } + + public void remove(AbstractButton b) + { + b.getModel().setGroup(null); + v.removeElement(b); + } + + + public Enumeration getElements() { + return v.elements(); + } + + public ButtonModel getSelection() { + return sel; + } + + AbstractButton FindButton(ButtonModel m) + { + for (int i=0;i<v.size();i++) + { + AbstractButton a = (AbstractButton) v.get(i); + if (a.getModel()== m) + { + return a; + } + } + return null; + } + + public void setSelected(ButtonModel m, boolean b) + { + if ((m == sel) && + (b == true)) + { + // clicked on sam item twice. + System.out.println("PRESSED TWICE:" + m + ", sel="+sel); + return; + } + + if (sel != null) + { + + System.out.println("DESELECTING: " + sel); + sel.setSelected(!b); + + AbstractButton but = FindButton(sel); + if (but != null) + { + System.out.println("REPAINT-REQUIST: " + but.text); + //but.revalidate(); + but.repaint(); + } + } + else + { + System.out.println("NO SELECTION YET"); + } + + sel = m; + } + + public boolean isSelected(ButtonModel m) + { + return (m == sel); + } + + public int getButtonCount() + { + return v.size(); + } + +} + + + + + + + + + diff --git a/libjava/javax/swing/ButtonModel.java b/libjava/javax/swing/ButtonModel.java new file mode 100644 index 00000000000..6d6aa7abbf2 --- /dev/null +++ b/libjava/javax/swing/ButtonModel.java @@ -0,0 +1,87 @@ +/* ButtonModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.event.*; + +public interface ButtonModel extends ItemSelectable +{ + boolean isArmed(); + void setArmed(boolean b); + + + boolean isEnabled(); + void setEnabled(boolean b); + + void setPressed(boolean b); + boolean isPressed(); + + + void removeActionListener(ActionListener l); + void addActionListener(ActionListener l); + + void addItemListener(ItemListener l); + void removeItemListener(ItemListener l); + + void addChangeListener(ChangeListener l); + void removeChangeListener(ChangeListener l); + + void setRollover(boolean b); + boolean isRollover(); + + int getMnemonic(); + void setMnemonic(int key); + + void setActionCommand(String s); + String getActionCommand(); + + void setGroup(ButtonGroup group); + + void setSelected(boolean b); + boolean isSelected(); + + + // there are not in the spec !! + + + void fireItemStateChanged(ItemEvent event); + void fireStateChanged(ChangeEvent event); + void fireActionPerformed(ActionEvent event); +} diff --git a/libjava/javax/swing/CellEditor.java b/libjava/javax/swing/CellEditor.java new file mode 100644 index 00000000000..63a1ff498d7 --- /dev/null +++ b/libjava/javax/swing/CellEditor.java @@ -0,0 +1,99 @@ +/* CellEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.util.*; +import javax.swing.event.*; + +/** + * CellEditor + * @author Andrew Selkirk + * @version 1.0 + */ +public interface CellEditor { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getCellEditorValue + * @returns Object + */ + public Object getCellEditorValue(); + + /** + * isCellEditable + * @param event TODO + * @returns boolean + */ + public boolean isCellEditable(EventObject event); + + /** + * shouldSelectCell + * @param event TODO + * @returns boolean + */ + public boolean shouldSelectCell(EventObject event); + + /** + * stopCellEditing + * @returns boolean + */ + public boolean stopCellEditing(); + + /** + * cancelCellEditing + */ + public void cancelCellEditing(); + + /** + * addCellEditorListener + * @param value0 TODO + */ + public void addCellEditorListener(CellEditorListener listener); + + /** + * removeCellEditorListener + * @param listener TODO + */ + public void removeCellEditorListener(CellEditorListener listener); + + +} // CellEditor diff --git a/libjava/javax/swing/CellRendererPane.java b/libjava/javax/swing/CellRendererPane.java new file mode 100644 index 00000000000..c93b919c817 --- /dev/null +++ b/libjava/javax/swing/CellRendererPane.java @@ -0,0 +1,215 @@ +/* CellRendererPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; +import javax.accessibility.*; + +/** + * CellRendererPane + * @author Andrew Selkirk + * @version 1.0 + */ +public class CellRendererPane extends Container implements Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleCellRendererPane + */ + protected class AccessibleCellRendererPane extends AccessibleAWTContainer { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleCellRendererPane + * @param component TODO + */ + protected AccessibleCellRendererPane(CellRendererPane component) { + super(); + // TODO + } // AccessibleCellRendererPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.PANEL; + } // getAccessibleRole() + + + } // AccessibleCellRendererPane + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * accessibleContext + */ + protected AccessibleContext accessibleContext = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor CellRendererPane + */ + public CellRendererPane() { + // TODO + } // CellRendererPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * update + * @param graphics TODO + */ + public void update(Graphics graphics) { + // TODO + } // update() + + /** + * invalidate + */ + public void invalidate() { + // TODO + } // invalidate() + + /** + * paint + * @param graphics TODO + */ + public void paint(Graphics graphics) { + // TODO + } // paint() + + /** + * addImpl + * @param c TODO + * @param constraints TODO + * @param index TODO + */ + protected void addImpl(Component c, Object constraints, int index) { + // TODO + } // addImpl() + + /** + * paintComponent + * @param graphics TODO + * @param c TODO + * @param p TODO + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param shouldValidate TODO + */ + public void paintComponent(Graphics graphics, Component c, + Container p, int x, int y, int w, int h, + boolean shouldValidate) { + // TODO + } // paintComponent() + + /** + * paintComponent + * @param graphics TODO + * @param c TODO + * @param p TODO + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void paintComponent(Graphics graphics, Component c, + Container p, int x, int y, int w, int h) { + // TODO + } // paintComponent() + + /** + * paintComponent + * @param graphics TODO + * @param c TODO + * @param p TODO + * @param r TODO + */ + public void paintComponent(Graphics graphics, Component c, + Container p, Rectangle r) { + // TODO + } // paintComponent() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleCellRendererPane(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // CellRendererPane diff --git a/libjava/javax/swing/ComboBoxEditor.java b/libjava/javax/swing/ComboBoxEditor.java new file mode 100644 index 00000000000..8235273306f --- /dev/null +++ b/libjava/javax/swing/ComboBoxEditor.java @@ -0,0 +1,91 @@ +/* ComboBoxEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; + +/** + * ComboBoxEditor + * @author Andrew Selkirk + * @version 1.0 + */ +public interface ComboBoxEditor { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getEditorComponent + * @returns Component + */ + public Component getEditorComponent(); + + /** + * setItem + * @param item TODO + */ + public void setItem(Object item); + + /** + * getItem + * @returns Object + */ + public Object getItem(); + + /** + * selectAll + */ + public void selectAll(); + + /** + * addActionListener + * @param listener TODO + */ + public void addActionListener(ActionListener listener); + + /** + * removeActionListener + * @param listener TODO + */ + public void removeActionListener(ActionListener listener); + + +} // ComboBoxEditor diff --git a/libjava/javax/swing/ComboBoxModel.java b/libjava/javax/swing/ComboBoxModel.java new file mode 100644 index 00000000000..f208aa953fd --- /dev/null +++ b/libjava/javax/swing/ComboBoxModel.java @@ -0,0 +1,64 @@ +/* ComboBoxModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ComboBoxModel + * @author Andrew Selkirk + * @version 1.0 + */ +public interface ComboBoxModel extends ListModel { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setSelectedItem + * @param item TODO + */ + public void setSelectedItem(Object item); + + /** + * getSelectedItem + * @returns Object + */ + public Object getSelectedItem(); + + +} // ComboBoxModel diff --git a/libjava/javax/swing/ComponentInputMap.java b/libjava/javax/swing/ComponentInputMap.java new file mode 100644 index 00000000000..d6183155c82 --- /dev/null +++ b/libjava/javax/swing/ComponentInputMap.java @@ -0,0 +1,115 @@ +/* ComponentInputMap.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ComponentInputMap + * @author Andrew Selkirk + * @version 1.0 + */ +public class ComponentInputMap extends InputMap { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * component + */ + private JComponent component; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ComponentInputMap + * @param value0 TODO + */ + public ComponentInputMap(JComponent value0) { + // TODO + } // ComponentInputMap() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * put + * @param keystroke TODO + * @param value TODO + */ + public void put(KeyStroke keystroke, Object value) { + // TODO + } // put() + + /** + * clear + */ + public void clear() { + // TODO + } // clear() + + /** + * remove + * @param keystroke TODO + */ + public void remove(KeyStroke keystroke) { + // TODO + } // remove() + + /** + * setParent + * @param parent TODO + */ + public void setParent(InputMap parent) { + // TODO + } // setParent() + + /** + * getComponent + * @returns JComponent + */ + public JComponent getComponent() { + return null; // TODO + } // getComponent() + + +} // ComponentInputMap diff --git a/libjava/javax/swing/DebugGraphics.java b/libjava/javax/swing/DebugGraphics.java new file mode 100644 index 00000000000..9a4c6592d23 --- /dev/null +++ b/libjava/javax/swing/DebugGraphics.java @@ -0,0 +1,720 @@ +/* DebugGraphics.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.image.*; +import java.io.*; +import java.text.*; + +/** + * DebugGraphics + * @author Andrew Selkirk + * @version 1.0 + */ +public class DebugGraphics extends Graphics { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * graphics + */ + Graphics graphics; + + /** + * buffer + */ + Image buffer; + + /** + * debugOptions + */ + int debugOptions; + + /** + * graphicsID + */ + int graphicsID; + + /** + * xOffset + */ + int xOffset; + + /** + * yOffset + */ + int yOffset; + + /** + * LOG_OPTION + */ + public static final int LOG_OPTION = 1; + + /** + * FLASH_OPTION + */ + public static final int FLASH_OPTION = 2; + + /** + * BUFFERED_OPTION + */ + public static final int BUFFERED_OPTION = 4; + + /** + * NONE_OPTION + */ + public static final int NONE_OPTION = -1; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DebugGraphics + */ + public DebugGraphics() { + // TODO + } // DebugGraphics() + + /** + * Constructor DebugGraphics + * @param graphics TODO + * @param component TODO + */ + public DebugGraphics(Graphics graphics, JComponent component) { + // TODO + } // DebugGraphics() + + /** + * Constructor DebugGraphics + * @param graphics TODO + */ + public DebugGraphics(Graphics graphics) { + // TODO + } // DebugGraphics() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setColor + * @param value0 TODO + */ + public void setColor(Color color) { + // TODO + } // setColor() + + /** + * create + * @returns Graphics + */ + public Graphics create() { + return null; // TODO + } // create() + + /** + * create + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @returns Graphics + */ + public Graphics create(int valx, int y, int w, int h) { + return null; // TODO + } // create() + + /** + * flashColor + * @returns Color + */ + public static Color flashColor() { + return null; // TODO + } // flashColor() + + /** + * setFlashColor + * @param color TODO + */ + public static void setFlashColor(Color color) { + // TODO + } // setFlashColor() + + /** + * flashTime + * @returns int + */ + public static int flashTime() { + return 0; // TODO + } // flashTime() + + /** + * setFlashTime + * @param time TODO + */ + public static void setFlashTime(int time) { + // TODO + } // setFlashTime() + + /** + * flashCount + * @returns int + */ + public static int flashCount() { + return 0; // TODO + } // flashCount() + + /** + * setFlashCount + * @param count TODO + */ + public static void setFlashCount(int count) { + // TODO + } // setFlashCount() + + /** + * logStream + * @returns PrintStream + */ + public static PrintStream logStream() { + return null; // TODO + } // logStream() + + /** + * setLogStream + * @param stream TODO + */ + public static void setLogStream(PrintStream stream) { + // TODO + } // setLogStream() + + /** + * getFont + * @returns Font + */ + public Font getFont() { + return null; // TODO + } // getFont() + + /** + * setFont + * @param font TODO + */ + public void setFont(Font font) { + // TODO + } // setFont() + + /** + * getColor + * @returns Color + */ + public Color getColor() { + return null; // TODO + } // getColor() + + /** + * getFontMetrics + * @returns FontMetrics + */ + public FontMetrics getFontMetrics() { + return null; // TODO + } // getFontMetrics() + + /** + * getFontMetrics + * @param font TODO + * @returns FontMetrics + */ + public FontMetrics getFontMetrics(Font font) { + return null; // TODO + } // getFontMetrics() + + /** + * translate + * @param x TODO + * @param y TODO + */ + public void translate(int x, int y) { + // TODO + } // translate() + + /** + * setPaintMode + */ + public void setPaintMode() { + // TODO + } // setPaintMode() + + /** + * setXORMode + * @param color TODO + */ + public void setXORMode(Color color) { + // TODO + } // setXORMode() + + /** + * getClipBounds + * @returns Rectangle + */ + public Rectangle getClipBounds() { + return null; // TODO + } // getClipBounds() + + /** + * clipRect + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + */ + public void clipRect(int value0, int value1, int value2, int value3) { + // TODO + } // clipRect() + + /** + * setClip + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void setClip(int x, int y, int w, int h) { + // TODO + } // setClip() + + /** + * getClip + * @returns Shape + */ + public Shape getClip() { + return null; // TODO + } // getClip() + + /** + * setClip + * @param shape TODO + */ + public void setClip(Shape shape) { + // TODO + } // setClip() + + /** + * drawRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param valh TODO + */ + public void drawRect(int x, int y, int w, int h) { + // TODO + } // drawRect() + + /** + * fillRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void fillRect(int x, int y, int w, int h) { + // TODO + } // fillRect() + + /** + * clearRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void clearRect(int x, int y, int w, int h) { + // TODO + } // clearRect() + + /** + * drawRoundRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param arcWidth TODO + * @param arcHeight TODO + */ + public void drawRoundRect(int x, int y, int w, int h, + int arcWidth, int arcHeight) { + // TODO + } // drawRoundRect() + + /** + * fillRoundRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param arcWidth TODO + * @param arcHeight TODO + */ + public void fillRoundRect(int x, int y, int w, int h, + int arcWidth, int arcHeight) { + // TODO + } // fillRoundRect() + + /** + * drawLine + * @param x1 TODO + * @param y1 TODO + * @param x2 TODO + * @param y2 TODO + */ + public void drawLine(int x1, int y1, int x2, int y2) { + // TODO + } // drawLine() + + /** + * draw3DRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param raised TODO + */ + public void draw3DRect(int x, int y, int w, int h, boolean raised) { + // TODO + } // draw3DRect() + + /** + * fill3DRect + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param raised TODO + */ + public void fill3DRect(int x, int y, int w, int h, boolean raised) { + // TODO + } // fill3DRect() + + /** + * drawOval + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void drawOval(int x, int y, int w, int h) { + // TODO + } // drawOval() + + /** + * fillOval + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void fillOval(int x, int y, int w, int h) { + // TODO + } // fillOval() + + /** + * drawArc + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param startAngle TODO + * @param arcAngle TODO + */ + public void drawArc(int x, int y, int w, int h, + int startAngle, int arcAngle) { + // TODO + } // drawArc() + + /** + * fillArc + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param startAngle TODO + * @param arcAngle TODO + */ + public void fillArc(int x, int y, int w, int h, + int startAngle, int arcAngle) { + // TODO + } // fillArc() + + /** + * drawPolyline + * @param xpoints TODO + * @param ypoints TODO + * @param npoints TODO + */ + public void drawPolyline(int[] xpoints, int[] ypoints, int npoints) { + // TODO + } // drawPolyline() + + /** + * drawPolygon + * @param xpoints TODO + * @param ypoints TODO + * @param npoints TODO + */ + public void drawPolygon(int[] xpoints, int[] ypoints, int npoints) { + // TODO + } // drawPolygon() + + /** + * fillPolygon + * @param xpoints TODO + * @param ypoints TODO + * @param npoints TODO + */ + public void fillPolygon(int[] xpoints, int[] ypoints, int npoints) { + // TODO + } // fillPolygon() + + /** + * drawString + * @param string TODO + * @param x TODO + * @param y TODO + */ + public void drawString(String string, int s, int y) { + // TODO + } // drawString() + + /** + * drawString + * @param iterator TODO + * @param x TODO + * @param y TODO + */ + public void drawString(AttributedCharacterIterator iterator, + int x, int y) { + // TODO + } // drawString() + + /** + * drawBytes + * @param data TODO + * @param offset TODO + * @param length TODO + * @param x TODO + * @param y TODO + */ + public void drawBytes(byte[] data, int offset, int length, + int x, int y) { + // TODO + } // drawBytes() + + /** + * drawChars + * @param data TODO + * @param offset TODO + * @param length TODO + * @param value3 TODO + * @param value4 TODO + */ + public void drawChars(char[] data, int offset, int value2, + int x, int y) { + // TODO + } // drawChars() + + /** + * drawImage + * @param image TODO + * @param x TODO + * @param y TODO + * @param observer TODO + * @returns boolean + */ + public boolean drawImage(Image image, int x, int y, + ImageObserver observer) { + return false; // TODO + } // drawImage() + + /** + * drawImage + * @param image TODO + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param observer TODO + * @returns boolean + */ + public boolean drawImage(Image image, int x, int y, int w, + int h, ImageObserver observer) { + return false; // TODO + } // drawImage() + + /** + * drawImage + * @param image TODO + * @param x TODO + * @param y TODO + * @param background TODO + * @param observer TODO + * @returns boolean + */ + public boolean drawImage(Image image, int x, int y, + Color background, ImageObserver observer) { + return false; // TODO + } // drawImage() + + /** + * drawImage + * @param image TODO + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param background TODO + * @param observer TODO + * @returns boolean + */ + public boolean drawImage(Image image, int x, int y, int w, int h, + Color background, ImageObserver observer) { + return false; // TODO + } // drawImage() + + /** + * drawImage + * @param image TODO + * @param dx1 TODO + * @param dy1 TODO + * @param dx2 TODO + * @param dy2 TODO + * @param sx1 TODO + * @param sy1 TODO + * @param sx2 TODO + * @param sy2 TODO + * @param observer TODO + * @returns boolean + */ + public boolean drawImage(Image image, int dx1, int dy1, + int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, + ImageObserver observer) { + return false; // TODO + } // drawImage() + + /** + * drawImage + * @param image TODO + * @param dx1 TODO + * @param dy1 TODO + * @param dx2 TODO + * @param dy2 TODO + * @param sx1 TODO + * @param sy1 TODO + * @param sx2 TODO + * @param sy2 TODO + * @param background TODO + * @param observer TODO + * @returns boolean + */ + public boolean drawImage(Image image, int dx1, int dy1, + int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, + Color background, ImageObserver observer) { + return false; // TODO + } // drawImage() + + /** + * copyArea + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + * @param destx TODO + * @param desty TODO + */ + public void copyArea(int x, int y, int w, int h, + int destx, int desty) { + // TODO + } // copyArea() + + /** + * dispose + */ + public void dispose() { + // TODO + } // dispose() + + /** + * isDrawingBuffer + * @returns boolean + */ + public boolean isDrawingBuffer() { + return false; // TODO + } // isDrawingBuffer() + + /** + * toShortString + * @returns String + */ + String toShortString() { + return null; // TODO + } // toShortString() + + /** + * setDebugOptions + * @param options TODO + */ + public void setDebugOptions(int options) { + // TODO + } // setDebugOptions() + + /** + * getDebugOptions + * @returns int + */ + public int getDebugOptions() { + return 0; // TODO + } // getDebugOptions() + + +} // DebugGraphics diff --git a/libjava/javax/swing/DefaultBoundedRangeModel.java b/libjava/javax/swing/DefaultBoundedRangeModel.java new file mode 100644 index 00000000000..82ab7675890 --- /dev/null +++ b/libjava/javax/swing/DefaultBoundedRangeModel.java @@ -0,0 +1,338 @@ +/* DefaultBoundedRangeModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * DefaultBoundedRangeModel + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent = new ChangeEvent(this); + + /** + * listenerList + */ + protected EventListenerList listenerList = new EventListenerList(); + + /** + * value + */ + private int value; + + /** + * extent + */ + private int extent; + + /** + * minimum + */ + private int minimum; + + /** + * maximum + */ + private int maximum; + + /** + * isAdjusting + */ + private boolean isAdjusting; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultBoundedRangeModel + */ + public DefaultBoundedRangeModel() { + setRangeProperties(0, 0, 0, 100, false); + } // DefaultBoundedRangeModel() + + /** + * Constructor DefaultBoundedRangeModel + * @param value TODO + * @param extent TODO + * @param minimum TODO + * @param maximum TODO + */ + public DefaultBoundedRangeModel(int value, int extent, + int minimum, int maximum) { + setRangeProperties(value, extent, minimum, maximum, false); + } // DefaultBoundedRangeModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * getValue + * @returns int + */ + public int getValue() { + return value; + } // getValue() + + /** + * setValue + * @param value TODO + */ + public void setValue(int value) { + + // Validate Constraints + if (minimum > value || value > (value + extent) || + (value + extent) > maximum) { + throw new IllegalArgumentException("Invalid value property set"); + } // if + + // Set Value + this.value = value; + + // Notification + fireStateChanged(); + + } // setValue() + + /** + * getExtent + * @returns int + */ + public int getExtent() { + return extent; + } // getExtent() + + /** + * setExtent + * @param extent TODO + */ + public void setExtent(int extent) { + + // Validate Constraints + if (minimum > value || value > (value + extent) || + (value + extent) > maximum) { + throw new IllegalArgumentException("Invalid extent property set"); + } // if + + // Set Extent + this.extent = extent; + + // Notification + fireStateChanged(); + + } // setExtent() + + /** + * getMinimum + * @returns int + */ + public int getMinimum() { + return minimum; + } // getMinimum() + + /** + * setMinimum + * @param minimum TODO + */ + public void setMinimum(int minimum) { + + // Validate Constraints + if (minimum > value || value > (value + extent) || + (value + extent) > maximum) { + throw new IllegalArgumentException("Invalid minimum property set"); + } // if + + // Set Minimum + this.minimum = minimum; + + // Notification + fireStateChanged(); + + } // setMinimum() + + /** + * getMaximum + * @returns int + */ + public int getMaximum() { + return maximum; + } // getMaximum() + + /** + * setMaximum + * @param maximum TODO + */ + public void setMaximum(int maximum) { + + // Validate Constraints + if (minimum > value || value > (value + extent) || + (value + extent) > maximum) { + throw new IllegalArgumentException("Invalid maximum property set"); + } // if + + // Set Maximum + this.maximum = maximum; + + // Notification + fireStateChanged(); + + } // setMaximum() + + /** + * getValueIsAdjusting + * @returns boolean + */ + public boolean getValueIsAdjusting() { + return isAdjusting; + } // getValueIsAdjusting() + + /** + * setValueIsAdjusting + * @param isAdjusting TODO + */ + public void setValueIsAdjusting(boolean isAdjusting) { + + // Set isAdjusting + this.isAdjusting = isAdjusting; + + // Notification + fireStateChanged(); + + } // setValueIsAdjusting() + + /** + * setRangeProperties + * @param value TODO + * @param extent TODO + * @param minimum TODO + * @param maximum TODO + * @param isAdjusting TODO + */ + public void setRangeProperties(int value, int extent, int minimum, + int maximum, boolean isAdjusting) { + + // Validate Constraints + if (minimum > value || value > (value + extent) || + (value + extent) > maximum) { + throw new IllegalArgumentException("Invalid property set"); + } // if + + // Set Data + this.value = value; + this.extent = extent; + this.minimum = minimum; + this.maximum = maximum; + this.isAdjusting = isAdjusting; + + // Notification + fireStateChanged(); + + } // setRangeProperties() + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener) { + listenerList.add(ChangeListener.class, listener); + } // addChangeListener() + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener listener) { + listenerList.remove(ChangeListener.class, listener); + } // removeChangeListener() + + /** + * fireStateChanged + */ + protected void fireStateChanged() { + + // Variables + ChangeListener listener; + EventListener[] listeners; + int index; + + // Get Listeners + listeners = listenerList.getListeners(ChangeListener.class); + + // Process Listeners + for (index = 0; index < listeners.length; index++) { + listener = (ChangeListener) listeners[index]; + listener.stateChanged(changeEvent); + } // for + + } // fireStateChanged() + + /** + * getListeners + * @param c TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class c) { + return listenerList.getListeners(c); + } // getListeners() + + +} // DefaultBoundedRangeModel diff --git a/libjava/javax/swing/DefaultButtonModel.java b/libjava/javax/swing/DefaultButtonModel.java new file mode 100644 index 00000000000..1dc0c8c97b6 --- /dev/null +++ b/libjava/javax/swing/DefaultButtonModel.java @@ -0,0 +1,169 @@ +/* DefaultButtonModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.util.*; +import java.awt.event.*; +import java.awt.*; +import javax.swing.event.*; + +public +class DefaultButtonModel implements ButtonModel, java.io.Serializable +{ + Vector actions = new Vector(); + + Vector items = new Vector(); + Vector changes = new Vector(); + ButtonGroup group; + JComponent comp; + + + DefaultButtonModel(JComponent a) + { + comp = a; + } + + + public Object[] getSelectedObjects() + { + return null; + } + + + public void fireItemStateChanged(ItemEvent event) + { + for (int i=0;i<items.size();i++) + { + ItemListener a = (ItemListener) items.get(i); + a.itemStateChanged(event); + } + } + public void fireStateChanged(ChangeEvent event) + { + for (int i=0;i<changes.size();i++) + { + ChangeListener a = (ChangeListener) changes.get(i); + a.stateChanged(event); + } + } + public void fireActionPerformed(ActionEvent event) + { + for (int i=0;i<actions.size();i++) + { + ActionListener a = (ActionListener) actions.get(i); + a.actionPerformed(event); + } + } + + boolean arm; + public boolean isArmed() { return arm; } + public void setArmed(boolean b) { arm = b; } + + boolean enabled = true; + public boolean isEnabled() { return enabled; } + public void setEnabled(boolean b) { enabled = b; } + + boolean pressed; + public void setPressed(boolean b) + { + pressed = b; + } + public boolean isPressed() { return pressed; } + + + public void removeActionListener(ActionListener l) { actions.removeElement(l); } + public void addActionListener(ActionListener l) + { + // comp.enableEvents( AWTEvent.ACTION_EVENT_MASK ); + actions.addElement(l); + } + + public void addItemListener(ItemListener l) { items.addElement(l); } + public void removeItemListener(ItemListener l) { items.removeElement(l); } + + public void addChangeListener(ChangeListener l) { changes.addElement(l); } + public void removeChangeListener(ChangeListener l) { changes.removeElement(l); } + + boolean roll; + public void setRollover(boolean b) { roll = b; } + public boolean isRollover() { return roll; } + + int mne; + public int getMnemonic() { return mne; } + public void setMnemonic(int key) { mne = key; } + + String com; + public void setActionCommand(String s) { com = s; } + public String getActionCommand() { return com; } + + public void setGroup(ButtonGroup group) + { + this.group = group; + } + + boolean sel; + public void setSelected(boolean b) + { + if (group != null) + { + if (b == true) + { + System.out.println("selected button in group:"+this); + group.setSelected(this, b); + sel = true; + } + else + { + System.out.println("deselected button in group: " + this); + sel = false; + } + } + else + { + sel = b; + } + } + public boolean isSelected() { return sel; } +} + + + + + + + diff --git a/libjava/javax/swing/DefaultCellEditor.java b/libjava/javax/swing/DefaultCellEditor.java new file mode 100644 index 00000000000..3f9442e08d1 --- /dev/null +++ b/libjava/javax/swing/DefaultCellEditor.java @@ -0,0 +1,319 @@ +/* DefaultCellEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; +import javax.swing.table.*; +import javax.swing.tree.*; + +/** + * DefaultCellEditor + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * EditorDelegate + */ + protected class EditorDelegate implements ActionListener, + ItemListener, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * value + */ + protected Object value; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor EditorDelegate + * @param value0 TODO + */ + protected EditorDelegate(DefaultCellEditor editor) { + // TODO + } // EditorDelegate() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setValue + * @param event TODO + */ + public void setValue(Object event) { + // TODO + } // setValue() + + /** + * getCellEditorValue + * @returns Object + */ + public Object getCellEditorValue() { + return null; // TODO + } // getCellEditorValue() + + /** + * isCellEditable + * @param event TODO + * @returns boolean + */ + public boolean isCellEditable(EventObject event) { + return false; // TODO + } // isCellEditable() + + /** + * shouldSelectCell + * @param event TODO + * @returns boolean + */ + public boolean shouldSelectCell(EventObject event) { + return false; // TODO + } // shouldSelectCell() + + /** + * stopCellEditing + * @returns boolean + */ + public boolean stopCellEditing() { + return false; // TODO + } // stopCellEditing() + + /** + * cancelCellEditing + */ + public void cancelCellEditing() { + // TODO + } // cancelCellEditing() + + /** + * startCellEditing + * @param event TODO + * @returns boolean + */ + public boolean startCellEditing(EventObject event) { + return false; // TODO + } // startCellEditing() + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + /** + * itemStateChanged + * @param event TODO + */ + public void itemStateChanged(ItemEvent event) { + // TODO + } // itemStateChanged() + + + } // EditorDelegate + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * editorComponent + */ + protected JComponent editorComponent; + + /** + * delegate + */ + protected EditorDelegate delegate; + + /** + * clickCountToStart + */ + protected int clickCountToStart; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultCellEditor + * @param textfield TODO + */ + public DefaultCellEditor(JTextField textfield) { + // TODO + } // DefaultCellEditor() + + /** + * Constructor DefaultCellEditor + * @param checkbox TODO + */ + public DefaultCellEditor(JCheckBox checkbox) { + // TODO + } // DefaultCellEditor() + + /** + * Constructor DefaultCellEditor + * @param combobox TODO + */ + public DefaultCellEditor(JComboBox combobox) { + // TODO + } // DefaultCellEditor() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getComponent + * @returns Component + */ + public Component getComponent() { + return null; // TODO + } // getComponent() + + /** + * getClickCountToStart + * @returns int + */ + public int getClickCountToStart() { + return 0; // TODO + } // getClickCountToStart() + + /** + * setClickCountToStart + * @param count TODO + */ + public void setClickCountToStart(int count) { + // TODO + } // setClickCountToStart() + + /** + * getCellEditorValue + * @returns Object + */ + public Object getCellEditorValue() { + return null; // TODO + } // getCellEditorValue() + + /** + * isCellEditable + * @param event TODO + * @returns boolean + */ + public boolean isCellEditable(EventObject event) { + return false; // TODO + } // isCellEditable() + + /** + * shouldSelectCell + * @param event TODO + * @returns boolean + */ + public boolean shouldSelectCell(EventObject event) { + return false; // TODO + } // shouldSelectCell() + + /** + * stopCellEditing + * @returns boolean + */ + public boolean stopCellEditing() { + return false; // TODO + } // stopCellEditing() + + /** + * cancelCellEditing + */ + public void cancelCellEditing() { + // TODO + } // cancelCellEditing() + + /** + * getTreeCellEditorComponent + * @param tree TODO + * @param value TODO + * @param isSelected TODO + * @param expanded TODO + * @param leaf TODO + * @param row TODO + * @returns Component + */ + public Component getTreeCellEditorComponent(JTree tree, + Object value, boolean isSelected, boolean expanded, + boolean leaf, int row) { + return null; // TODO + } // getTreeCellEditorComponent() + + /** + * getTableCellEditorComponent + * @param tree TODO + * @param value TODO + * @param isSelected TODO + * @param row TODO + * @param column TODO + * @returns Component + */ + public Component getTableCellEditorComponent(JTable tree, + Object value, boolean isSelected, int row, int column) { + return null; // TODO + } // getTableCellEditorComponent() + + +} // DefaultCellEditor diff --git a/libjava/javax/swing/DefaultCellRenderer.java b/libjava/javax/swing/DefaultCellRenderer.java new file mode 100644 index 00000000000..2730314629a --- /dev/null +++ b/libjava/javax/swing/DefaultCellRenderer.java @@ -0,0 +1,75 @@ +/* DefaultCellRenderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + + +// this is what SUN basically told us to do so: +// no icon though as that's not implemented yet.... + +public class DefaultCellRenderer extends JLabel implements ListCellRenderer +{ + public Component getListCellRendererComponent(JList list, + Object value, + int index, + boolean isSelected, + boolean cellHasFocus) + { + String s = value.toString(); + setText(s); + + // System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + s); + + + if (isSelected) + { + setBackground(list.getSelectionBackground()); + setForeground(list.getSelectionForeground()); + } + else + { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + } + + setEnabled(list.isEnabled()); + setFont(list.getFont()); + return this; + } +} diff --git a/libjava/javax/swing/DefaultComboBoxModel.java b/libjava/javax/swing/DefaultComboBoxModel.java new file mode 100644 index 00000000000..2ceb15a6573 --- /dev/null +++ b/libjava/javax/swing/DefaultComboBoxModel.java @@ -0,0 +1,182 @@ +/* DefaultComboBoxModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; + +/** + * DefaultComboBoxModel + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultComboBoxModel extends AbstractListModel + implements MutableComboBoxModel, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * list + */ + private Vector list; + + /** + * selectedItem + */ + private Object selectedItem; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultComboBoxModel + */ + public DefaultComboBoxModel() { + // TODO + } // DefaultComboBoxModel() + + /** + * Constructor DefaultComboBoxModel + * @param items TODO + */ + public DefaultComboBoxModel(Object[] items) { + // TODO + } // DefaultComboBoxModel() + + /** + * Constructor DefaultComboBoxModel + * @param vector TODO + */ + public DefaultComboBoxModel(Vector vector) { + // TODO + } // DefaultComboBoxModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addElement + * @param object TODO + */ + public void addElement(Object object) { + // TODO + } // addElement() + + /** + * removeElementAt + * @param index TODO + */ + public void removeElementAt(int index) { + // TODO + } // removeElementAt() + + /** + * insertElementAt + * @param object TODO + * @param index TODO + */ + public void insertElementAt(Object object, int index) { + // TODO + } // insertElementAt() + + /** + * removeElement + * @param object TODO + */ + public void removeElement(Object object) { + // TODO + } // removeElement() + + /** + * removeAllElements + */ + public void removeAllElements() { + // TODO + } // removeAllElements() + + /** + * getSize + * @returns int + */ + public int getSize() { + return 0; // TODO + } // getSize() + + /** + * setSelectedItem + * @param object TODO + */ + public void setSelectedItem(Object object) { + // TODO + } // setSelectedItem() + + /** + * getSelectedItem + * @returns Object + */ + public Object getSelectedItem() { + return null; // TODO + } // getSelectedItem() + + /** + * getElementAt + * @param index TODO + * @returns Object + */ + public Object getElementAt(int index) { + return null; // TODO + } // getElementAt() + + /** + * getIndexOf + * @param object TODO + * @returns int + */ + public int getIndexOf(Object object) { + return 0; // TODO + } // getIndexOf() + + +} // DefaultComboBoxModel diff --git a/libjava/javax/swing/DefaultDesktopManager.java b/libjava/javax/swing/DefaultDesktopManager.java new file mode 100644 index 00000000000..5581e580c4b --- /dev/null +++ b/libjava/javax/swing/DefaultDesktopManager.java @@ -0,0 +1,284 @@ +/* DefaultDesktopManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; + +/** + * DefaultDesktopManager + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultDesktopManager implements DesktopManager, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * HAS_BEEN_ICONIFIED_PROPERTY + */ + static final String HAS_BEEN_ICONIFIED_PROPERTY = ""; // TODO + + /** + * DEFAULT_DRAG_MODE + */ + static final int DEFAULT_DRAG_MODE = 0; // TODO + + /** + * OUTLINE_DRAG_MODE + */ + static final int OUTLINE_DRAG_MODE = 0; // TODO + + /** + * FASTER_DRAG_MODE + */ + static final int FASTER_DRAG_MODE = 0; // TODO + + /** + * dragMode + */ + int dragMode; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultDesktopManager + */ + public DefaultDesktopManager() { + // TODO + } // DefaultDesktopManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * openFrame + * @param frame TODO + */ + public void openFrame(JInternalFrame frame) { + // TODO + } // openFrame() + + /** + * closeFrame + * @param frame TODO + */ + public void closeFrame(JInternalFrame frame) { + // TODO + } // closeFrame() + + /** + * maximizeFrame + * @param frame TODO + */ + public void maximizeFrame(JInternalFrame frame) { + // TODO + } // maximizeFrame() + + /** + * minimizeFrame + * @param frame TODO + */ + public void minimizeFrame(JInternalFrame frame) { + // TODO + } // minimizeFrame() + + /** + * iconifyFrame + * @param frame TODO + */ + public void iconifyFrame(JInternalFrame frame) { + // TODO + } // iconifyFrame() + + /** + * deiconifyFrame + * @param frame TODO + */ + public void deiconifyFrame(JInternalFrame frame) { + // TODO + } // deiconifyFrame() + + /** + * activateFrame + * @param frame TODO + */ + public void activateFrame(JInternalFrame frame) { + // TODO + } // activateFrame() + + /** + * deactivateFrame + * @param frame TODO + */ + public void deactivateFrame(JInternalFrame frame) { + // TODO + } // deactivateFrame() + + /** + * beginDraggingFrame + * @param component TODO + */ + public void beginDraggingFrame(JComponent component) { + // TODO + } // beginDraggingFrame() + + /** + * dragFrame + * @param component TODO + * @param newX TODO + * @param newY TODO + */ + public void dragFrame(JComponent component, int newX, int newY) { + // TODO + } // dragFrame() + + /** + * endDraggingFrame + * @param component TODO + */ + public void endDraggingFrame(JComponent component) { + // TODO + } // endDraggingFrame() + + /** + * beginResizingFrame + * @param component TODO + * @param direction TODO + */ + public void beginResizingFrame(JComponent component, int direction) { + // TODO + } // beginResizingFrame() + + /** + * resizeFrame + * @param component TODO + * @param newX TODO + * @param newY TODO + * @param newWidth TODO + * @param newHeight TODO + */ + public void resizeFrame(JComponent component, int newX, int newY, + int newWidth, int newHeight) { + // TODO + } // resizeFrame() + + /** + * endResizingFrame + * @param component TODO + */ + public void endResizingFrame(JComponent component) { + // TODO + } // endResizingFrame() + + /** + * setBoundsForFrame + * @param component TODO + * @param newX TODO + * @param newY TODO + * @param newWidth TODO + * @param newHeight TODO + */ + public void setBoundsForFrame(JComponent component, int newX, + int newY, int newWidth, int newHeight) { + // TODO + } // setBoundsForFrame() + + /** + * removeIconFor + * @param frame TODO + */ + protected void removeIconFor(JInternalFrame frame) { + // TODO + } // removeIconFor() + + /** + * getBoundsForIconOf + * @param frame TODO + * @returns Rectangle + */ + protected Rectangle getBoundsForIconOf(JInternalFrame frame) { + return null; // TODO + } // getBoundsForIconOf() + + /** + * setPreviousBounds + * @param frame TODO + * @param rect TODO + */ + protected void setPreviousBounds(JInternalFrame frame, Rectangle rect) { + // TODO + } // setPreviousBounds() + + /** + * getPreviousBounds + * @param frame TODO + * @returns Rectangle + */ + protected Rectangle getPreviousBounds(JInternalFrame frame) { + return null; // TODO + } // getPreviousBounds() + + /** + * setWasIcon + * @param frame TODO + * @param value TODO + */ + protected void setWasIcon(JInternalFrame frame, Boolean value) { + // TODO + } // setWasIcon() + + /** + * wasIcon + * @param frame TODO + * @returns boolean + */ + protected boolean wasIcon(JInternalFrame frame) { + return false; // TODO + } // wasIcon() + + +} // DefaultDesktopManager diff --git a/libjava/javax/swing/DefaultFocusManager.java b/libjava/javax/swing/DefaultFocusManager.java new file mode 100644 index 00000000000..c2c5d610c7c --- /dev/null +++ b/libjava/javax/swing/DefaultFocusManager.java @@ -0,0 +1,155 @@ +/* DefaultFocusManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.util.*; + +/** + * DefaultFocusManager + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultFocusManager extends FocusManager { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * historyStack + */ + private Stack historyStack; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultFocusManager + */ + public DefaultFocusManager() { + // TODO + } // DefaultFocusManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * processKeyEvent + * @param component TODO + * @param event TODO + */ + public void processKeyEvent(Component component, KeyEvent event) { + // TODO + } // processKeyEvent() + + /** + * focusNextComponent + * @param component TODO + */ + public void focusNextComponent(Component component) { + // TODO + } // focusNextComponent() + + /** + * focusPreviousComponent + * @param component TODO + */ + public void focusPreviousComponent(Component component) { + // TODO + } // focusPreviousComponent() + + /** + * getFirstComponent + * @param container TODO + * @returns Component + */ + public Component getFirstComponent(Container container) { + return null; // TODO + } // getFirstComponent() + + /** + * getLastComponent + * @param container TODO + * @returns Component + */ + public Component getLastComponent(Container container) { + return null; // TODO + } // getLastComponent() + + /** + * getComponentBefore + * @param container TODO + * @param component TODO + * @returns Component + */ + public Component getComponentBefore(Container container, + Component component) { + return null; // TODO + } // getComponentBefore() + + /** + * getComponentAfter + * @param container TODO + * @param component TODO + * @returns Component + */ + public Component getComponentAfter(Container container, + Component component) { + return null; // TODO + } // getComponentAfter() + + /** + * compareTabOrder + * @param component1 TODO + * @param component2 TODO + * @returns boolean + */ + public boolean compareTabOrder(Component component1, + Component component2) { + return false; // TODO + } // compareTabOrder() + + +} // DefaultFocusManager diff --git a/libjava/javax/swing/DefaultListCellRenderer.java b/libjava/javax/swing/DefaultListCellRenderer.java new file mode 100644 index 00000000000..c6f8809e743 --- /dev/null +++ b/libjava/javax/swing/DefaultListCellRenderer.java @@ -0,0 +1,253 @@ +/* DefaultListCellRenderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; +import javax.swing.border.*; +import javax.swing.plaf.*; + +/** + * DefaultListCellRenderer + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultListCellRenderer extends JLabel + implements ListCellRenderer, Serializable { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * UIResource + */ + public static class UIResource extends DefaultListCellRenderer + implements javax.swing.plaf.UIResource { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UIResource + */ + public UIResource() { + // TODO + } // UIResource() + + + } // UIResource + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * noFocusBorder + */ + protected static Border noFocusBorder = null; // TODO + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultListCellRenderer + */ + public DefaultListCellRenderer() { + // TODO + } // DefaultListCellRenderer() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getListCellRendererComponent + * @param list TODO + * @param value TODO + * @param index TODO + * @param isSelected TODO + * @param cellHasFocus TODO + * @returns Component + */ + public Component getListCellRendererComponent(JList list, + Object value, int index, boolean isSelected, boolean cellHasFocus) { + return null; // TODO + } // getListCellRendererComponent() + + /** + * validate + */ + public void validate() { + // TODO + } // validate() + + /** + * revalidate + */ + public void revalidate() { + // TODO + } // revalidate() + + /** + * repaint + * @param tm TODO + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public void repaint(long tm, int x, int y, int w, int h) { + // TODO + } // repaint() + + /** + * repaint + * @param rect TODO + */ + public void repaint(Rectangle rect) { + // TODO + } // repaint() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + protected void firePropertyChange(String propertyName, + Object oldValue, Object newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + byte oldValue, byte newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + char oldValue, char newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + short oldValue, short newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + int oldValue, int newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + long oldValue, long newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + float oldValue, float newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + double oldValue, double newValue) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, + boolean oldValue, boolean newValue) { + // TODO + } // firePropertyChange() + + +} // DefaultListCellRenderer diff --git a/libjava/javax/swing/DefaultListModel.java b/libjava/javax/swing/DefaultListModel.java new file mode 100644 index 00000000000..3a841635903 --- /dev/null +++ b/libjava/javax/swing/DefaultListModel.java @@ -0,0 +1,529 @@ +/* DefaultListModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.util.*; + +/** + * DefaultListModel + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultListModel extends AbstractListModel { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * elements. Note: Sun obviously implemented the storage as a + * Vector according to the similar API on this class. I choose + * instead to implement the model with a proper collection object. + * Is this a good choice? Probably not (ya..I know there are + * sync issues by doing this) + */ + private ArrayList elements = new ArrayList(); + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultListModel + */ + public DefaultListModel() { + // TODO + } // DefaultListModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * elementAt + * @param index TODO + * @returns Object + */ + public Object elementAt(int index) { + return elements.get(index); + } // elementAt() + + /** + * toString + * @returns String + */ + public String toString() { + return elements.toString(); + } // toString() + + /** + * indexOf + * @param element TODO + * @returns int + */ + public int indexOf(Object element) { + return elements.indexOf(element); + } // indexOf() + + /** + * indexOf + * @param element TODO + * @param startIndex TODO + * @returns int + */ + public int indexOf(Object element, int startIndex) { + + // Variables + int index; + Object test; + + // Process Elements + for (index = startIndex; index < elements.size(); index++) { + test = elements.get(index); + if (test.equals(element) == true) { + return index; + } // if + } // for + return -1; + + } // indexOf() + + /** + * lastIndexOf + * @param element TODO + * @returns int + */ + public int lastIndexOf(Object element) { + return elements.lastIndexOf(element); + } // lastIndexOf() + + /** + * lastIndexOf + * @param element TODO + * @param endIndex TODO + * @returns int + */ + public int lastIndexOf(Object element, int endIndex) { + + // Variables + int index; + Object test; + + // Process Elements + for (index = endIndex; index >= 0; index--) { + test = elements.get(index); + if (test.equals(element) == true) { + return index; + } // if + } // for + return -1; + + } // lastIndexOf() + + /** + * get + * @param index TODO + * @returns Object + */ + public Object get(int index) { + return elements.get(index); + } // get() + + /** + * set + * @param index TODO + * @param element TODO + * @returns Object + */ + public Object set(int index, Object element) { + + // Variables + Object result; + + // Process Action + result = elements.set(index, element); + + // Send event + fireContentsChanged(this, index, index); + + return result; + + } // set() + + /** + * add + * @param index TODO + * @param element TODO + */ + public void add(int index, Object element) { + + // Process Action + elements.add(index, element); + + // Send event + fireContentsChanged(this, index, index); + + } // add() + + /** + * addElement + * @param element TODO + */ + public void addElement(Object element) { + + // Process Action + elements.add(element); + + // Send event + fireIntervalAdded(this, elements.size(), elements.size()); + + } // addElement() + + /** + * size + * @returns int + */ + public int size() { + return elements.size(); + } // size() + + /** + * toArray + * @returns Object[] + */ + public Object[] toArray() { + return elements.toArray(); + } // toArray() + + /** + * contains + * @param element TODO + * @returns boolean + */ + public boolean contains(Object element) { + return elements.contains(element); + } // contains() + + /** + * copyInto + * @param array TODO + */ + public void copyInto(Object[] array) { + + // Variables + int index; + int size; + Object[] srcArray; + + // Initialize + size = size(); + srcArray = toArray(); + + // Process Elements + for (index = 0; index < size; index++) { + array[index] = srcArray[index]; + } // for + + } // copyInto() + + /** + * clear + */ + public void clear() { + + // Process Action + elements.clear(); + + // Send event + fireIntervalRemoved(this, 0, elements.size()); + + } // clear() + + /** + * remove + * @param index TODO + * @returns Object + */ + public Object remove(int index) { + + // Variables + Object result; + + // Process Action + result = elements.remove(index); + + // Send event + fireIntervalRemoved(this, index, index); + + return result; + + } // remove() + + /** + * isEmpty + * @returns boolean + */ + public boolean isEmpty() { + return elements.isEmpty(); + } // isEmpty() + + /** + * elements + * @returns Enumeration + */ + public Enumeration elements() { + + // TODO + // Note: This is a pathetic implementation. If Vector + // was used for storage, this wouldn't be an issue. I'll + // have to implement an Enumeration inner class sometime. + + // Variables + Vector vector; + + // Get Enumeration + vector = new Vector(elements); + return vector.elements(); + + } // elements() + + /** + * trimToSize + */ + public void trimToSize() { + elements.trimToSize(); + } // trimToSize() + + /** + * ensureCapacity + * @param size TODO + */ + public void ensureCapacity(int size) { + elements.ensureCapacity(size); + } // ensureCapacity() + + /** + * setSize + * @param size TODO + */ + public void setSize(int size) { + elements.ensureCapacity(size); + } // setSize() + + /** + * capacity + * @returns int + */ + public int capacity() { + return elements.size(); + } // capacity() + + /** + * firstElement + * @returns Object + */ + public Object firstElement() { + + // Variables + Object element; + + try { + element = elements.get(0); + return element; + } catch (IndexOutOfBoundsException e) { + throw new NoSuchElementException(); + } // try + + } // firstElement() + + /** + * lastElement + * @returns Object + */ + public Object lastElement() { + + // Variables + Object element; + + try { + element = elements.get(elements.size() - 1); + return element; + } catch (ArrayIndexOutOfBoundsException e) { + throw new NoSuchElementException(); + } // try + + } // lastElement() + + /** + * setElementAt + * @param element TODO + * @param index TODO + */ + public void setElementAt(Object element, int index) { + + // Process Action + elements.set(index, element); + + // Send event + fireContentsChanged(this, index, index); + + } // setElementAt() + + /** + * removeElementAt + * @param index TODO + */ + public void removeElementAt(int index) { + + // Process Action + elements.remove(index); + + // Send event + fireIntervalRemoved(this, index, index); + + } // removeElementAt() + + /** + * insertElementAt + * @param element TODO + * @param index TODO + */ + public void insertElementAt(Object element, int index) { + + // Process Action + elements.add(index, element); + + // Send event + fireIntervalRemoved(this, index, index); + + } // insertElementAt() + + /** + * removeElement + * @param element TODO + * @returns boolean + */ + public boolean removeElement(Object element) { + + // Variables + int index; + + index = elements.indexOf(element); + if (index != -1) { + elements.remove(index); + + // Send event + fireIntervalRemoved(this, index, index); + + return true; + + } // if + + return false; + + } // removeElement() + + /** + * removeAllElements + */ + public void removeAllElements() { + + // Variables + int size; + + size = size(); + + if (size > 0) { + + // Process Action + elements.clear(); + + // Send event + fireIntervalRemoved(this, 0, size - 1); + + } // if + + } // removeAllElements() + + /** + * removeRange + * @param startIndex TODO + * @param endIndex TODO + */ + public void removeRange(int startIndex, int endIndex) { + + // Variables + int index; + + // Check Indices + if (startIndex > endIndex) { + throw new IllegalArgumentException(); + } // if + + // Process Elements + for (index = endIndex; index >= startIndex; index--) { + elements.remove(index); + } // for + + // Send event + fireIntervalRemoved(this, startIndex, endIndex); + + } // removeRange() + + /** + * getSize + * @returns int + */ + public int getSize() { + return elements.size(); + } // getSize() + + /** + * getElementAt + * @param index TODO + * @returns Object + */ + public Object getElementAt(int index) { + return elements.get(index); + } // getElementAt() + + +} // DefaultListModel diff --git a/libjava/javax/swing/DefaultListSelectionModel.java b/libjava/javax/swing/DefaultListSelectionModel.java new file mode 100644 index 00000000000..64ae505fd12 --- /dev/null +++ b/libjava/javax/swing/DefaultListSelectionModel.java @@ -0,0 +1,181 @@ +/* DefaultListSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import javax.swing.event.*; +import java.util.*; + +public class DefaultListSelectionModel implements ListSelectionModel +{ + int mode = SINGLE_SELECTION; + + Vector sel = new Vector(); + + Vector listeners; + + Vector get_listeners() + { + if (listeners == null) + listeners = new Vector(); + return listeners; + } + + + public void addListSelectionListener(ListSelectionListener listener) + { + get_listeners().addElement(listener); + } + + public void removeListSelectionListener(ListSelectionListener listener) + { + get_listeners().removeElement(listener); + } + + class Range + { + int i0, i1; + + Range(int a, int b) + { + if (a > b) + { + i0 = b; + i1 = a; + } + else + { + i0 = a; + i1 = b; + } + } + } + + + public int getMinSelectionIndex() + { + if (isSelectionEmpty()) + return -1; + + boolean first = true; + int min = -1; + for (int i=0;i<sel.size();i++) + { + Range r = (Range) sel.get(i); + + if (first) + { + min = r.i0; + first = false; + } + else + { + if (r.i0 > min) + { + min = r.i0; + } + } + } + return min; + } + + public int getMaxSelectionIndex() + { + if (isSelectionEmpty()) + return -1; + + boolean first = true; + int max = -1; + for (int i=1;i<sel.size();i++) + { + Range r = (Range) sel.get(i); + + if (first) + { + max = r.i1; + } + else + { + if (r.i1 > max) + { + max = r.i1; + } + } + } + return max; + } + + public boolean isSelectedIndex(int a) + { + for (int i=0;i<sel.size();i++) + { + Range r = (Range) sel.get(i); + if (r.i0 <= a && + r.i1 >= a) + { + return true; + } + } + return false; + } + + + public int getSelectionMode() + { return mode; } + public void setSelectionMode(int a) + { mode = a; } + + boolean isSelectionEmpty() + { + return sel.size() == 0; + } + + public void clearSelection() + { + sel.removeAllElements(); + } + + public void setSelectionInterval(int index0, int index1) + { + if (mode == SINGLE_SELECTION) + { + sel.removeAllElements(); + } + + sel.addElement(new Range(index0, index1)); + } +} diff --git a/libjava/javax/swing/DefaultSingleSelectionModel.java b/libjava/javax/swing/DefaultSingleSelectionModel.java new file mode 100644 index 00000000000..50a35d9d9a5 --- /dev/null +++ b/libjava/javax/swing/DefaultSingleSelectionModel.java @@ -0,0 +1,179 @@ +/* DefaultSingleSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * DefaultSingleSelectionModel + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultSingleSelectionModel implements + SingleSelectionModel, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent = new ChangeEvent(this); + + /** + * listenerList + */ + protected EventListenerList listenerList= new EventListenerList(); + + /** + * index + */ + private int index = -1; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultSingleSelectionModel + */ + public DefaultSingleSelectionModel() { + // TODO + } // DefaultSingleSelectionModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getSelectedIndex + * @returns int + */ + public int getSelectedIndex() { + return index; + } // getSelectedIndex() + + /** + * setSelectedIndex + * @param index TODO + */ + public void setSelectedIndex(int index) { + + // Set Data + this.index = index; + + // Notify Listeners + fireStateChanged(); + + } // setSelectedIndex() + + /** + * clearSelection + */ + public void clearSelection() { + + // Set Data + index = -1; + + // Notify Listeners + fireStateChanged(); + + } // clearSelection() + + /** + * isSelected + * @returns boolean + */ + public boolean isSelected() { + return (index == -1); + } // isSelected() + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener) { + listenerList.add(ChangeListener.class, listener); + } // addChangeListener() + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener listener) { + listenerList.remove(ChangeListener.class, listener); + } // removeChangeListener() + + /** + * fireStateChanged + */ + protected void fireStateChanged() { + + // Variables + ChangeListener listener; + EventListener[] listeners; + int index; + + // Get Listeners + listeners = listenerList.getListeners(ChangeListener.class); + + // Process Listeners + for (index = 0; index < listeners.length; index++) { + listener = (ChangeListener) listeners[index]; + listener.stateChanged(changeEvent); + } // for + + } // fireStateChanged() + + /** + * getListeners + * @param listenerClass TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class listenerClass) { + return listenerList.getListeners(listenerClass); + } // getListeners() + + +} // DefaultSingleSelectionModel diff --git a/libjava/javax/swing/DesktopManager.java b/libjava/javax/swing/DesktopManager.java new file mode 100644 index 00000000000..898d79e9dbd --- /dev/null +++ b/libjava/javax/swing/DesktopManager.java @@ -0,0 +1,155 @@ +/* DesktopManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * DesktopManager + * @author Andrew Selkirk + * @version 1.0 + */ +public interface DesktopManager { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * openFrame + * @param frame TODO + */ + public void openFrame(JInternalFrame frame); + + /** + * closeFrame + * @param frame TODO + */ + public void closeFrame(JInternalFrame frame); + + /** + * maximizeFrame + * @param frame TODO + */ + public void maximizeFrame(JInternalFrame frame); + + /** + * minimizeFrame + * @param frame TODO + */ + public void minimizeFrame(JInternalFrame frame); + + /** + * iconifyFrame + * @param frame TODO + */ + public void iconifyFrame(JInternalFrame frame); + + /** + * deiconifyFrame + * @param frame TODO + */ + public void deiconifyFrame(JInternalFrame frame); + + /** + * activateFrame + * @param frame TODO + */ + public void activateFrame(JInternalFrame vframe); + + /** + * deactivateFrame + * @param frame TODO + */ + public void deactivateFrame(JInternalFrame frame); + + /** + * beginDraggingFrame + * @param frame TODO + */ + public void beginDraggingFrame(JComponent frame); + + /** + * dragFrame + * @param frame TODO + * @param x TODO + * @param y TODO + */ + public void dragFrame(JComponent frame, int x, int y); + + /** + * endDraggingFrame + * @param frame TODO + */ + public void endDraggingFrame(JComponent frame); + + /** + * beginResizingFrame + * @param frame TODO + * @param direction TODO + */ + public void beginResizingFrame(JComponent frame, int direction); + + /** + * resizeFrame + * @param frame TODO + * @param x TODO + * @param y TODO + * @param width TODO + * @param height TODO + */ + public void resizeFrame(JComponent frame, int x, int y, + int width, int height); + + /** + * endResizingFrame + * @param frame TODO + */ + public void endResizingFrame(JComponent frame); + + /** + * setBoundsForFrame + * @param frame TODO + * @param x TODO + * @param y TODO + * @param width TODO + * @param height TODO + */ + public void setBoundsForFrame(JComponent frame, int x, int y, + int width, int height); + + +} // DesktopManager diff --git a/libjava/javax/swing/FocusManager.java b/libjava/javax/swing/FocusManager.java new file mode 100644 index 00000000000..c770bd0246e --- /dev/null +++ b/libjava/javax/swing/FocusManager.java @@ -0,0 +1,182 @@ +/* FocusManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; + +/** + * FocusManager + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class FocusManager { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * DisabledFocusManager + */ + static class DisabledFocusManager extends FocusManager { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DisabledFocusManager + */ + DisabledFocusManager() { + // TODO + } // DisabledFocusManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * processKeyEvent + * @param component TODO + * @param event TODO + */ + public void processKeyEvent(Component component, KeyEvent event) { + // TODO + } // processKeyEvent() + + /** + * focusNextComponent + * @param component TODO + */ + public void focusNextComponent(Component component) { + // TODO + } // focusNextComponent() + + /** + * focusPreviousComponent + * @param value0 TODO + */ + public void focusPreviousComponent(Component value0) { + // TODO + } // focusPreviousComponent() + + + } // DisabledFocusManager + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * FOCUS_MANAGER_CLASS_PROPERTY + */ + public static final String FOCUS_MANAGER_CLASS_PROPERTY = "FocusManagerClassName"; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FocusManager + */ + public FocusManager() { + // TODO + } // FocusManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getCurrentManager + * @returns FocusManager + */ + public static FocusManager getCurrentManager() { + return null; // TODO + } // getCurrentManager() + + /** + * setCurrentManager + * @param manager TODO + */ + public static void setCurrentManager(FocusManager manager) { + // TODO + } // setCurrentManager() + + /** + * disableSwingFocusManager + */ + public static void disableSwingFocusManager() { + // TODO + } // disableSwingFocusManager() + + /** + * isFocusManagerEnabled + * @returns boolean + */ + public static boolean isFocusManagerEnabled() { + return false; // TODO + } // isFocusManagerEnabled() + + /** + * processKeyEvent + * @param component TODO + * @param event TODO + */ + public abstract void processKeyEvent(Component component, KeyEvent event); + + /** + * focusNextComponent + * @param component TODO + */ + public abstract void focusNextComponent(Component component); + + /** + * focusPreviousComponent + * @param component TODO + */ + public abstract void focusPreviousComponent(Component component); + + +} // FocusManager diff --git a/libjava/javax/swing/GrayFilter.java b/libjava/javax/swing/GrayFilter.java new file mode 100644 index 00000000000..740653d1b9d --- /dev/null +++ b/libjava/javax/swing/GrayFilter.java @@ -0,0 +1,85 @@ +/* GrayFilter.java -- Java class for filtering Pixels to produce Gray Pictures + Copyright (C) 1999 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.Image; +import java.awt.image.FilteredImageSource; +import java.awt.image.RGBImageFilter; +import java.awt.Toolkit; + +public class GrayFilter extends RGBImageFilter +{ + private boolean b; + private int p; + + /** + Create a GrayFilter. If b is true then brighten. Also, indicate how much gray. + + @param b if brighten + @param p percent of gray, 0 - 100 + */ + public GrayFilter(boolean b, int p) + { + this.b = b; //FIXME - HANDLE THIS + this.p = p; + } + + /** + Create grayed image + + @param i image to gray + + @return a grayed image + */ + public static Image createDisabledImage(Image src) + { + return Toolkit.getDefaultToolkit().createImage( new FilteredImageSource(src.getSource(), + new GrayFilter(false, 100))); + } + + /** + Filter RGB to gray + */ + public int filterRGB(int x, + int y, + int rgb) + { + return (int) ( ( p * ( 0.299 * ( (0xff0000 & rgb) >> 16) + 0.587 * ( (0xff00 & rgb) >> 8 ) + 0.114 * (0xff & rgb ) ) )); + } +} diff --git a/libjava/javax/swing/Icon.java b/libjava/javax/swing/Icon.java new file mode 100644 index 00000000000..b4839c09ab7 --- /dev/null +++ b/libjava/javax/swing/Icon.java @@ -0,0 +1,47 @@ +/* Icon.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + +public interface Icon +{ + int getIconHeight(); + int getIconWidth(); + void paintIcon(Component c, Graphics g, int x, int y); +} diff --git a/libjava/javax/swing/ImageIcon.java b/libjava/javax/swing/ImageIcon.java new file mode 100644 index 00000000000..ded11a13424 --- /dev/null +++ b/libjava/javax/swing/ImageIcon.java @@ -0,0 +1,95 @@ +/* ImageIcon.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.image.*; + + + +public class ImageIcon implements Icon +{ + Image image; + String file, descr; + Component observer; + + public ImageIcon(String s) + { + this(s, ""); + } + + public ImageIcon(String file, + String descr) + { + this.file = file; + this.descr = descr; + + image = Toolkit.getDefaultToolkit().getImage(file); + if (image == null) { + return; + } + //loadImage(image); + } + + // not in SUN's spec !!! + public void setParent(Component p) + { + observer = p; + } + + public Image getImage() + { return image; } + + public String getDescription() + { return descr; } + public void setDescription(String description) + { this.descr = description; } + + public int getIconHeight() + { return image.getHeight(observer); } + public int getIconWidth() + { return image.getWidth(observer); } + + public void paintIcon(Component c, + Graphics g, + int x, + int y) + { + g.drawImage(image, x, y, observer); + } +} diff --git a/libjava/javax/swing/InputMap.java b/libjava/javax/swing/InputMap.java new file mode 100644 index 00000000000..9f81121c5a9 --- /dev/null +++ b/libjava/javax/swing/InputMap.java @@ -0,0 +1,230 @@ +/* InputMap.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.util.*; +import java.io.*; + +/** + * InputMap + * @author Andrew Selkirk + * @version 1.0 + */ +public class InputMap implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * inputMap + */ + private Map inputMap = new HashMap(); + + /** + * parent + */ + private InputMap parent = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor InputMap + */ + public InputMap() { + // TODO + } // InputMap() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * get + * @param value0 TODO + * @returns Object + */ + public Object get(KeyStroke keystroke) { + + // Variables + Object result; + + // Check Local store + result = inputMap.get(keystroke); + + // Check Parent + if (result == null) { + result = parent.get(keystroke); + } // if + + return result; + + } // get() + + /** + * put + * @param keystroke TODO + * @param actionMapKey TODO + */ + public void put(KeyStroke keystroke, Object actionMapKey) { + if (actionMapKey == null) { + inputMap.remove(keystroke); + } else { + inputMap.put(keystroke, actionMapKey); + } // if + } // put() + + /** + * remove + * @param keystroke TODO + */ + public void remove(KeyStroke keystroke) { + inputMap.remove(keystroke); + } // remove() + + /** + * getParent + * @returns InputMap + */ + public InputMap getParent() { + return parent; + } // getParent() + + /** + * setParent + * @param parentMap TODO + */ + public void setParent(InputMap parentMap) { + parent = parentMap; + } // setParent() + + /** + * size + * @returns int + */ + public int size() { + return inputMap.size(); + } // size() + + /** + * clear + */ + public void clear() { + inputMap.clear(); + } // clear() + + /** + * keys + * @returns KeyStroke[] + */ + public KeyStroke[] keys() { + return convertSet(inputMap.keySet()); + } // keys() + + /** + * allKeys + * @returns KeyStroke[] + */ + public KeyStroke[] allKeys() { + + // Variables + Set set; + + // Initialize + set = new HashSet(); + + // Get Key Sets + if (parent != null) { + set.addAll(Arrays.asList(parent.allKeys())); + } // if + set.addAll(inputMap.keySet()); + + return convertSet(set); + + } // allKeys() + + private KeyStroke[] convertSet(Set set) { + + // Variables + int index; + Iterator iterator; + KeyStroke[] keys; + + // Create Final array + keys = new KeyStroke[set.size()]; + iterator = set.iterator(); + index = 0; + while (iterator.hasNext()) { + keys[index++] = (KeyStroke) iterator.next(); + } // while + + return keys; + + } // convertSet() + + + //------------------------------------------------------------- + // Interface: Serializable ------------------------------------ + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param stream TODO + * @exception ClassNotFoundException TODO + * @exception IOException TODO + */ + private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException { + // TODO + } // readObject() + + +} // InputMap diff --git a/libjava/javax/swing/InputVerifier.java b/libjava/javax/swing/InputVerifier.java new file mode 100644 index 00000000000..a125fe43502 --- /dev/null +++ b/libjava/javax/swing/InputVerifier.java @@ -0,0 +1,79 @@ +/* InputVerifier.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * InputVerifier + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class InputVerifier { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor InputVerifier + */ + public InputVerifier() { + } // InputVerifier() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * verify + * @param component TODO + * @returns boolean + */ + public abstract boolean verify(JComponent component); + + /** + * shouldYieldFocus + * @param component TODO + * @returns boolean + */ + public boolean shouldYieldFocus(JComponent component) { + return verify(component); + } // shouldYieldFocus() + + +} // InputVerifier diff --git a/libjava/javax/swing/JApplet.java b/libjava/javax/swing/JApplet.java new file mode 100644 index 00000000000..094123a2c7b --- /dev/null +++ b/libjava/javax/swing/JApplet.java @@ -0,0 +1,213 @@ +/* JApplet.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.applet.*; +import java.awt.*; +import java.awt.event.*; + + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + + +public class JApplet extends Applet +{ + + public final static int HIDE_ON_CLOSE = 0; + public final static int EXIT_ON_CLOSE = 1; + public final static int DISPOSE_ON_CLOSE = 2; + public final static int DO_NOTHING_ON_CLOSE = 3; + + private int close_action = EXIT_ON_CLOSE; + private boolean checking; + protected JRootPane rootPane; + + public JApplet() + { + frameInit(); + } + + public JApplet(String title) + { + frameInit(); + } + + protected void frameInit() + { + super.setLayout(new BorderLayout(1, 1)); + getRootPane(); // will do set/create + } + + public Dimension getPreferredSize() + { + Dimension d = super.getPreferredSize(); + System.out.println("JFrame.getPrefSize(): " + d + " , comp="+countComponents() + ", layout=" + getLayout()); + return d; + } + + public void setLayout(LayoutManager manager) + { super.setLayout(manager); } + + void setLayeredPane(JLayeredPane layeredPane) + { getRootPane().setLayeredPane(layeredPane); } + + JLayeredPane getLayeredPane() + { return getRootPane().getLayeredPane(); } + + JRootPane getRootPane() + { + if (rootPane == null) + setRootPane(createRootPane()); + return rootPane; + } + + void setRootPane(JRootPane root) + { + if (rootPane != null) + remove(rootPane); + + rootPane = root; + add(rootPane, BorderLayout.CENTER); + } + + JRootPane createRootPane() + { return new JRootPane(); } + + Container getContentPane() + { return getRootPane().getContentPane(); } + + void setContentPane(Container contentPane) + { getRootPane().setContentPane(contentPane); } + + Component getGlassPane() + { return getRootPane().getGlassPane(); } + + void setGlassPane(Component glassPane) + { getRootPane().setGlassPane(glassPane); } + + + ///////////////////////////////////////////////////////////////////////////////// + protected void addImpl(Component comp, Object constraints, int index) + { super.addImpl(comp, constraints, index); } + + public AccessibleContext getAccessibleContext() + { return null; } + + int getDefaultCloseOperation() + { return close_action; } + + + JMenuBar getJMenuBar() + { return getRootPane().getJMenuBar(); } + + void setJMenuBar(JMenuBar menubar) + { getRootPane().setJMenuBar(menubar); } + + + protected String paramString() + { return "JFrame"; } + + protected void processKeyEvent(KeyEvent e) + { super.processKeyEvent(e); } + + protected void processWindowEvent(WindowEvent e) + { + // System.out.println("PROCESS_WIN_EV-1: " + e); + + // super.processWindowEvent(e); + + // System.out.println("PROCESS_WIN_EV-2: " + e); + switch (e.getID()) + { + case WindowEvent.WINDOW_CLOSING: + { + switch(close_action) + { + case EXIT_ON_CLOSE: + { + System.out.println("user requested exit on close"); + System.exit(1); + break; + } + case DISPOSE_ON_CLOSE: + { + System.out.println("user requested dispose on close"); + //dispose(); + break; + } + case HIDE_ON_CLOSE: + + case DO_NOTHING_ON_CLOSE: + break; + } + break; + } + + case WindowEvent.WINDOW_CLOSED: + case WindowEvent.WINDOW_OPENED: + case WindowEvent.WINDOW_ICONIFIED: + case WindowEvent.WINDOW_DEICONIFIED: + case WindowEvent.WINDOW_ACTIVATED: + case WindowEvent.WINDOW_DEACTIVATED: + break; + } + } + + + public void remove(Component comp) + { getContentPane().remove(comp); } + + + void setDefaultCloseOperation(int operation) + { close_action = operation; } + + + + protected boolean isRootPaneCheckingEnabled() + { return checking; } + + + protected void setRootPaneCheckingEnabled(boolean enabled) + { checking = enabled; } + + public void update(Graphics g) + { paint(g); } +} diff --git a/libjava/javax/swing/JButton.java b/libjava/javax/swing/JButton.java new file mode 100644 index 00000000000..9bfe32edaa9 --- /dev/null +++ b/libjava/javax/swing/JButton.java @@ -0,0 +1,133 @@ +/* JButton.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.plaf.*; +import javax.accessibility.*; + +/** + * An instance of JButton can be added to a panel, frame etc + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JButton extends AbstractButton implements Accessible +{ + boolean def, is_def; + + + public JButton() + { + this(null, null); + } + + public JButton(Action a) + { + this(); + setAction(a); + } + + public JButton(Icon icon) + { + this(null, icon); + } + + public JButton(String text) + { + this(text, null); + } + + public JButton(String text, Icon icon) + { + super(text, icon); + } + + public Object[] getSelectedObjects() + { + return null; + } + + protected void configurePropertiesFromAction(Action a) + { + //Factory method which sets the AbstractButton's properties according to values from the Action instance. + } + + public AccessibleContext getAccessibleContext() + { + //Gets the AccessibleContext associated with this JButton. + return null; + } + + public String getUIClassID() + { + //Returns a string that specifies the name of the L&F class that renders this component. + return "JButton"; + } + + public boolean isDefaultButton() + { + //Returns whether or not this button is the default button on the RootPane. + return is_def; + } + + public boolean isDefaultCapable() + { + //Returns whether or not this button is capable of being the default button on the RootPane. + return def; + } + + protected String paramString() + { + return "JButton"; + } + + public void removeNotify() + { + //Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so, sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference. + } + + public void setDefaultCapable(boolean defaultCapable) + { def = defaultCapable; } + + public void updateUI() + { + ButtonUI b = (ButtonUI)UIManager.getUI(this); + setUI(b); + } +} diff --git a/libjava/javax/swing/JCheckBox.java b/libjava/javax/swing/JCheckBox.java new file mode 100644 index 00000000000..4e6810ca22e --- /dev/null +++ b/libjava/javax/swing/JCheckBox.java @@ -0,0 +1,94 @@ +/* JCheckBox.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.plaf.*; +import javax.accessibility.*; + +/** + * An instance of JCheckbox can be added to a panel, frame etc + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JCheckBox extends JToggleButton +{ + public JCheckBox() + { + this(null, null); + } + public JCheckBox(Action a) + { + this(); + setAction(a); + } + + public JCheckBox(Icon icon) + { + this(null, icon); + } + + public JCheckBox(String text) + { + this(text, null); + } + + public JCheckBox(String text, Icon icon) + { + super(text, icon); + } + + + public AccessibleContext getAccessibleContext() + { + //Gets the AccessibleContext associated with this JCheckBox. + return null; + } + + public String getUIClassID() + { + //Returns a string that specifies the name of the L&F class that renders this component. + return "JCheckBox"; + } + + protected String paramString() + { + return "JCheckBox"; + } +} diff --git a/libjava/javax/swing/JCheckBoxMenuItem.java b/libjava/javax/swing/JCheckBoxMenuItem.java new file mode 100644 index 00000000000..ac3b6600cbf --- /dev/null +++ b/libjava/javax/swing/JCheckBoxMenuItem.java @@ -0,0 +1,241 @@ +/* JCheckBoxMenuItem.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import javax.accessibility.*; + +/** + * JCheckBoxMenuItem + * @author Andrew Selkirk + * @version 1.0 + */ +public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJCheckBoxMenuItem + */ + protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJCheckBoxMenuItem + * @param component TODO + */ + protected AccessibleJCheckBoxMenuItem(JCheckBoxMenuItem component) { + super(component); + // TODO + } // AccessibleJCheckBoxMenuItem() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.CHECK_BOX; + } // getAccessibleRole() + + + } // AccessibleJCheckBoxMenuItem + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "CheckBoxMenuItemUI"; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JCheckBoxMenuItem + */ + public JCheckBoxMenuItem() { + // TODO + } // JCheckBoxMenuItem() + + /** + * Constructor JCheckBoxMenuItem + * @param icon TODO + */ + public JCheckBoxMenuItem(Icon icon) { + // TODO + } // JCheckBoxMenuItem() + + /** + * Constructor JCheckBoxMenuItem + * @param text TODO + */ + public JCheckBoxMenuItem(String text) { + // TODO + } // JCheckBoxMenuItem() + + /** + * Constructor JCheckBoxMenuItem + * @param action TODO + */ + public JCheckBoxMenuItem(Action action) { + // TODO + } // JCheckBoxMenuItem() + + /** + * Constructor JCheckBoxMenuItem + * @param text TODO + * @param icon TODO + */ + public JCheckBoxMenuItem(String text, Icon icon) { + // TODO + } // JCheckBoxMenuItem() + + /** + * Constructor JCheckBoxMenuItem + * @param text TODO + * @param state TODO + */ + public JCheckBoxMenuItem(String text, boolean state) { + // TODO + } // JCheckBoxMenuItem() + + /** + * Constructor JCheckBoxMenuItem + * @param text TODO + * @param icon TODO + * @param state TODO + */ + public JCheckBoxMenuItem(String text, Icon icon, boolean state) { + // TODO + } // JCheckBoxMenuItem() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getState + * @returns boolean + */ + public boolean getState() { + return false; // TODO + } // getState() + + /** + * setState + * @param state TODO + */ + public synchronized void setState(boolean state) { + // TODO + } // setState() + + /** + * getSelectedObjects + * @returns Object[] + */ + public Object[] getSelectedObjects() { + return null; // TODO + } // getSelectedObjects() + + /** + * requestFocus + */ + public void requestFocus() { + // TODO + } // requestFocus() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJCheckBoxMenuItem(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JCheckBoxMenuItem diff --git a/libjava/javax/swing/JColorChooser.java b/libjava/javax/swing/JColorChooser.java new file mode 100644 index 00000000000..c9c22f18c57 --- /dev/null +++ b/libjava/javax/swing/JColorChooser.java @@ -0,0 +1,365 @@ +/* JColorChooser.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.accessibility.*; +import javax.swing.colorchooser.*; +import javax.swing.plaf.*; + +/** + * JColorChooser + * @author Andrew Selkirk + * @version 1.0 + */ +public class JColorChooser extends JComponent implements Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJColorChooser + */ + protected class AccessibleJColorChooser extends JComponent.AccessibleJComponent { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJColorChooser + * @param component TODO + */ + protected AccessibleJColorChooser(JColorChooser component) { + super(component); + // TODO + } // AccessibleJColorChooser() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.COLOR_CHOOSER; + } // getAccessibleRole() + + + } // AccessibleJColorChooser + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "ColorChooserUI"; + + /** + * selectionModel + */ + private ColorSelectionModel selectionModel; + + /** + * previewPanel + */ + private JComponent previewPanel; + + /** + * chooserPanels + */ + private AbstractColorChooserPanel[] chooserPanels; + + /** + * SELECTION_MODEL_PROPERTY + */ + public static final String SELECTION_MODEL_PROPERTY = "selectionModel"; + + /** + * PREVIEW_PANEL_PROPERTY + */ + public static final String PREVIEW_PANEL_PROPERTY = "previewPanel"; + + /** + * CHOOSER_PANELS_PROPERTY + */ + public static final String CHOOSER_PANELS_PROPERTY = "chooserPanels"; + + /** + * accessibleContext + */ + protected AccessibleContext accessibleContext; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JColorChooser + */ + public JColorChooser() { + // TODO + } // JColorChooser() + + /** + * Constructor JColorChooser + * @param initial TODO + */ + public JColorChooser(Color initial) { + // TODO + } // JColorChooser() + + /** + * Constructor JColorChooser + * @param model TODO + */ + public JColorChooser(ColorSelectionModel model) { + // TODO + } // JColorChooser() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * setColor + * @param color TODO + */ + public void setColor(Color color) { + // TODO + } // setColor() + + /** + * setColor + * @param r TODO + * @param g TODO + * @param b TODO + */ + public void setColor(int r, int g, int b) { + // TODO + } // setColor() + + /** + * setColor + * @param color TODO + */ + public void setColor(int color) { + // TODO + } // setColor() + + /** + * showDialog + * @param component TODO + * @param title TODO + * @param initial TODO + * @returns Color + */ + public static Color showDialog(Component component, String title, + Color initial) { + return null; // TODO + } // showDialog() + + /** + * createDialog + * @param component TODO + * @param title TODO + * @param modal TODO + * @param chooserPane TODO + * @param okListener TODO + * @param cancelListener TODO + * @returns JDialog + */ + public static JDialog createDialog(Component component, String title, + boolean modal, JColorChooser chooserPane, + ActionListener okListener, ActionListener cancelListener) { + return null; // TODO + } // createDialog() + + /** + * getUI + * @returns ColorChooserUI + */ + public ColorChooserUI getUI() { + return (ColorChooserUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(ColorChooserUI ui) { + super.setUI(ui); + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((ColorChooserUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getColor + * @returns Color + */ + public Color getColor() { + return null; // TODO + } // getColor() + + /** + * setPreviewPanel + * @param component TODO + */ + public void setPreviewPanel(JComponent component) { + // TODO + } // setPreviewPanel() + + /** + * getPreviewPanel + * @returns JComponent + */ + public JComponent getPreviewPanel() { + return null; // TODO + } // getPreviewPanel() + + /** + * addChooserPanel + * @param panel TODO + */ + public void addChooserPanel(AbstractColorChooserPanel panel) { + // TODO + } // addChooserPanel() + + /** + * removeChooserPanel + * @param panel TODO + * @returns AbstractColorChooserPanel + */ + public AbstractColorChooserPanel removeChooserPanel( + AbstractColorChooserPanel panel) { + return null; // TODO + } // removeChooserPanel() + + /** + * setChooserPanels + * @param panels TODO + */ + public void setChooserPanels(AbstractColorChooserPanel[] panels) { + // TODO + } // setChooserPanels() + + /** + * getChooserPanels + * @returns AbstractColorChooserPanel[] + */ + public AbstractColorChooserPanel[] getChooserPanels() { + return null; // TODO + } // getChooserPanels() + + /** + * getSelectionModel + * @returns ColorSelectionModel + */ + public ColorSelectionModel getSelectionModel() { + return null; // TODO + } // getSelectionModel() + + /** + * setSelectionModel + * @param model TODO + */ + public void setSelectionModel(ColorSelectionModel model) { + // TODO + } // setSelectionModel() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJColorChooser(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JColorChooser diff --git a/libjava/javax/swing/JComboBox.java b/libjava/javax/swing/JComboBox.java new file mode 100644 index 00000000000..4837e972087 --- /dev/null +++ b/libjava/javax/swing/JComboBox.java @@ -0,0 +1,835 @@ +/* JComboBox.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import java.util.*; +import javax.accessibility.*; +import javax.swing.event.*; +import javax.swing.plaf.*; + +/** + * JComboBox + * @author Andrew Selkirk + * @version 1.0 + */ +public class JComboBox extends JComponent implements ItemSelectable, + ListDataListener, ActionListener, Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJComboBox + */ + protected class AccessibleJComboBox extends AccessibleJComponent + implements AccessibleAction, AccessibleSelection { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJComboBox + * @param component TODO + */ + protected AccessibleJComboBox(JComboBox component) { + super(component); + // TODO + } // AccessibleJComboBox() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleChildrenCount + * @returns int + */ + public int getAccessibleChildrenCount() { + return 0; // TODO + } // getAccessibleChildrenCount() + + /** + * getAccessibleChild + * @param value0 TODO + * @returns Accessible + */ + public Accessible getAccessibleChild(int value0) { + return null; // TODO + } // getAccessibleChild() + + /** + * getAccessibleSelection + * @returns AccessibleSelection + */ + public AccessibleSelection getAccessibleSelection() { + return null; // TODO + } // getAccessibleSelection() + + /** + * getAccessibleSelection + * @param value0 TODO + * @returns Accessible + */ + public Accessible getAccessibleSelection(int value0) { + return null; // TODO + } // getAccessibleSelection() + + /** + * isAccessibleChildSelected + * @param value0 TODO + * @returns boolean + */ + public boolean isAccessibleChildSelected(int value0) { + return false; // TODO + } // isAccessibleChildSelected() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.COMBO_BOX; + } // getAccessibleRole() + + /** + * getAccessibleAction + * @returns AccessibleAction + */ + public AccessibleAction getAccessibleAction() { + return null; // TODO + } // getAccessibleAction() + + /** + * getAccessibleActionDescription + * @param value0 TODO + * @returns String + */ + public String getAccessibleActionDescription(int value0) { + return null; // TODO + } // getAccessibleActionDescription() + + /** + * getAccessibleActionCount + * @returns int + */ + public int getAccessibleActionCount() { + return 0; // TODO + } // getAccessibleActionCount() + + /** + * doAccessibleAction + * @param value0 TODO + * @returns boolean + */ + public boolean doAccessibleAction(int value0) { + return false; // TODO + } // doAccessibleAction() + + /** + * getAccessibleSelectionCount + * @returns int + */ + public int getAccessibleSelectionCount() { + return 0; // TODO + } // getAccessibleSelectionCount() + + /** + * addAccessibleSelection + * @param value0 TODO + */ + public void addAccessibleSelection(int value0) { + // TODO + } // addAccessibleSelection() + + /** + * removeAccessibleSelection + * @param value0 TODO + */ + public void removeAccessibleSelection(int value0) { + // TODO + } // removeAccessibleSelection() + + /** + * clearAccessibleSelection + */ + public void clearAccessibleSelection() { + // TODO + } // clearAccessibleSelection() + + /** + * selectAllAccessibleSelection + */ + public void selectAllAccessibleSelection() { + // TODO + } // selectAllAccessibleSelection() + + + } // AccessibleJComboBox + + /** + * KeySelectionManager + */ + public static interface KeySelectionManager { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * selectionForKey + * @param value0 TODO + * @param value1 TODO + * @returns int + */ + public abstract int selectionForKey(char value0, ComboBoxModel value1); + + + } // KeySelectionManager + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "ComboBoxUI"; + + /** + * dataModel + */ + protected ComboBoxModel dataModel; + + /** + * renderer + */ + protected ListCellRenderer renderer; + + /** + * editor + */ + protected ComboBoxEditor editor; + + /** + * maximumRowCount + */ + protected int maximumRowCount; + + /** + * isEditable + */ + protected boolean isEditable; + + /** + * selectedItemReminder + */ + protected Object selectedItemReminder; + + /** + * keySelectionManager + */ + protected JComboBox.KeySelectionManager keySelectionManager; + + /** + * actionCommand + */ + protected String actionCommand; + + /** + * lightWeightPopupEnabled + */ + protected boolean lightWeightPopupEnabled; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JComboBox + * @param value0 TODO + */ + public JComboBox(ComboBoxModel value0) { + // TODO + } // JComboBox() + + /** + * Constructor JComboBox + * @param value0 TODO + */ + public JComboBox(Object[] value0) { + // TODO + } // JComboBox() + + /** + * Constructor JComboBox + * @param value0 TODO + */ + public JComboBox(Vector value0) { + // TODO + } // JComboBox() + + /** + * Constructor JComboBox + */ + public JComboBox() { + // TODO + } // JComboBox() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * isEditable + * @returns boolean + */ + public boolean isEditable() { + return false; // TODO + } // isEditable() + + /** + * installAncestorListener + */ + protected void installAncestorListener() { + // TODO + } // installAncestorListener() + + /** + * setUI + * @param ui TODO + */ + public void setUI(ComboBoxUI ui) { + super.setUI(ui); + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((ComboBoxUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getUI + * @returns ComboBoxUI + */ + public ComboBoxUI getUI() { + return (ComboBoxUI) ui; + } // getUI() + + /** + * setModel + * @param value0 TODO + */ + public void setModel(ComboBoxModel value0) { + // TODO + } // setModel() + + /** + * getModel + * @returns ComboBoxModel + */ + public ComboBoxModel getModel() { + return null; // TODO + } // getModel() + + /** + * setLightWeightPopupEnabled + * @param value0 TODO + */ + public void setLightWeightPopupEnabled(boolean value0) { + // TODO + } // setLightWeightPopupEnabled() + + /** + * isLightWeightPopupEnabled + * @returns boolean + */ + public boolean isLightWeightPopupEnabled() { + return false; // TODO + } // isLightWeightPopupEnabled() + + /** + * setEditable + * @param value0 TODO + */ + public void setEditable(boolean value0) { + // TODO + } // setEditable() + + /** + * setMaximumRowCount + * @param value0 TODO + */ + public void setMaximumRowCount(int value0) { + // TODO + } // setMaximumRowCount() + + /** + * getMaximumRowCount + * @returns int + */ + public int getMaximumRowCount() { + return 0; // TODO + } // getMaximumRowCount() + + /** + * setRenderer + * @param value0 TODO + */ + public void setRenderer(ListCellRenderer value0) { + // TODO + } // setRenderer() + + /** + * getRenderer + * @returns ListCellRenderer + */ + public ListCellRenderer getRenderer() { + return null; // TODO + } // getRenderer() + + /** + * setEditor + * @param value0 TODO + */ + public void setEditor(ComboBoxEditor value0) { + // TODO + } // setEditor() + + /** + * getEditor + * @returns ComboBoxEditor + */ + public ComboBoxEditor getEditor() { + return null; // TODO + } // getEditor() + + /** + * setSelectedItem + * @param value0 TODO + */ + public void setSelectedItem(Object value0) { + // TODO + } // setSelectedItem() + + /** + * getSelectedItem + * @returns Object + */ + public Object getSelectedItem() { + return null; // TODO + } // getSelectedItem() + + /** + * setSelectedIndex + * @param value0 TODO + */ + public void setSelectedIndex(int value0) { + // TODO + } // setSelectedIndex() + + /** + * getSelectedIndex + * @returns int + */ + public int getSelectedIndex() { + return 0; // TODO + } // getSelectedIndex() + + /** + * addItem + * @param value0 TODO + */ + public void addItem(Object value0) { + // TODO + } // addItem() + + /** + * insertItemAt + * @param value0 TODO + * @param value1 TODO + */ + public void insertItemAt(Object value0, int value1) { + // TODO + } // insertItemAt() + + /** + * removeItem + * @param value0 TODO + */ + public void removeItem(Object value0) { + // TODO + } // removeItem() + + /** + * removeItemAt + * @param value0 TODO + */ + public void removeItemAt(int value0) { + // TODO + } // removeItemAt() + + /** + * removeAllItems + */ + public void removeAllItems() { + // TODO + } // removeAllItems() + + /** + * showPopup + */ + public void showPopup() { + // TODO + } // showPopup() + + /** + * hidePopup + */ + public void hidePopup() { + // TODO + } // hidePopup() + + /** + * setPopupVisible + * @param value0 TODO + */ + public void setPopupVisible(boolean value0) { + // TODO + } // setPopupVisible() + + /** + * isPopupVisible + * @returns boolean + */ + public boolean isPopupVisible() { + return false; // TODO + } // isPopupVisible() + + /** + * addItemListener + * @param value0 TODO + */ + public void addItemListener(ItemListener value0) { + // TODO + } // addItemListener() + + /** + * removeItemListener + * @param value0 TODO + */ + public void removeItemListener(ItemListener value0) { + // TODO + } // removeItemListener() + + /** + * addActionListener + * @param value0 TODO + */ + public void addActionListener(ActionListener value0) { + // TODO + } // addActionListener() + + /** + * removeActionListener + * @param value0 TODO + */ + public void removeActionListener(ActionListener value0) { + // TODO + } // removeActionListener() + + /** + * setActionCommand + * @param value0 TODO + */ + public void setActionCommand(String value0) { + // TODO + } // setActionCommand() + + /** + * getActionCommand + * @returns String + */ + public String getActionCommand() { + return null; // TODO + } // getActionCommand() + + /** + * setAction + * @param value0 TODO + */ + public void setAction(Action value0) { + // TODO + } // setAction() + + /** + * isListener + * @param value0 TODO + * @param value1 TODO + * @returns boolean + */ + private boolean isListener(Class value0, ActionListener value1) { + return false; // TODO + } // isListener() + + /** + * getAction + * @returns Action + */ + public Action getAction() { + return null; // TODO + } // getAction() + + /** + * configurePropertiesFromAction + * @param value0 TODO + */ + protected void configurePropertiesFromAction(Action value0) { + // TODO + } // configurePropertiesFromAction() + + /** + * createActionPropertyChangeListener + * @param value0 TODO + * @returns PropertyChangeListener + */ + protected PropertyChangeListener createActionPropertyChangeListener(Action value0) { + return null; // TODO + } // createActionPropertyChangeListener() + + /** + * fireItemStateChanged + * @param value0 TODO + */ + protected void fireItemStateChanged(ItemEvent value0) { + // TODO + } // fireItemStateChanged() + + /** + * fireActionEvent + */ + protected void fireActionEvent() { + // TODO + } // fireActionEvent() + + /** + * selectedItemChanged + */ + protected void selectedItemChanged() { + // TODO + } // selectedItemChanged() + + /** + * getSelectedObjects + * @returns Object[] + */ + public Object[] getSelectedObjects() { + return null; // TODO + } // getSelectedObjects() + + /** + * actionPerformed + * @param value0 TODO + */ + public void actionPerformed(ActionEvent value0) { + // TODO + } // actionPerformed() + + /** + * contentsChanged + * @param value0 TODO + */ + public void contentsChanged(ListDataEvent value0) { + // TODO + } // contentsChanged() + + /** + * selectWithKeyChar + * @param value0 TODO + * @returns boolean + */ + public boolean selectWithKeyChar(char value0) { + return false; // TODO + } // selectWithKeyChar() + + /** + * intervalAdded + * @param value0 TODO + */ + public void intervalAdded(ListDataEvent value0) { + // TODO + } // intervalAdded() + + /** + * intervalRemoved + * @param value0 TODO + */ + public void intervalRemoved(ListDataEvent value0) { + // TODO + } // intervalRemoved() + + /** + * setEnabled + * @param value0 TODO + */ + public void setEnabled(boolean value0) { + // TODO + } // setEnabled() + + /** + * configureEditor + * @param value0 TODO + * @param value1 TODO + */ + public void configureEditor(ComboBoxEditor value0, Object value1) { + // TODO + } // configureEditor() + + /** + * processKeyEvent + * @param value0 TODO + */ + public void processKeyEvent(KeyEvent value0) { + // TODO + } // processKeyEvent() + + /** + * isFocusTraversable + * @returns boolean + */ + public boolean isFocusTraversable() { + return false; // TODO + } // isFocusTraversable() + + /** + * setKeySelectionManager + * @param value0 TODO + */ + public void setKeySelectionManager(KeySelectionManager value0) { + // TODO + } // setKeySelectionManager() + + /** + * getKeySelectionManager + * @returns JComboBox.KeySelectionManager + */ + public JComboBox.KeySelectionManager getKeySelectionManager() { + return null; // TODO + } // getKeySelectionManager() + + /** + * getItemCount + * @returns int + */ + public int getItemCount() { + return 0; // TODO + } // getItemCount() + + /** + * getItemAt + * @param value0 TODO + * @returns Object + */ + public Object getItemAt(int value0) { + return null; // TODO + } // getItemAt() + + /** + * createDefaultKeySelectionManager + * @returns KeySelectionManager + */ + protected KeySelectionManager createDefaultKeySelectionManager() { + return null; // TODO + } // createDefaultKeySelectionManager() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJComboBox(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JComboBox diff --git a/libjava/javax/swing/JComponent.java b/libjava/javax/swing/JComponent.java new file mode 100644 index 00000000000..fad7b6cb2a5 --- /dev/null +++ b/libjava/javax/swing/JComponent.java @@ -0,0 +1,1063 @@ +/* JComponent.java -- Every component in swing inherits from this class. + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.peer.*; +import java.awt.event.*; +import java.io.*; + +import javax.swing.event.*; +import javax.swing.border.*; +import javax.swing.plaf.*; + +import java.util.*; +import java.beans.*; + +import javax.accessibility.*; + +/** + * Every component in swing inherits from this class (JLabel, JButton, etc). + * It contains generic methods to manage events, properties and sizes. + * Actual drawing of the component is channeled to a look-and-feel class + * that is implemented elsewhere. + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public abstract class JComponent extends Container implements Serializable +{ + /** + * accessibleContext + */ + protected AccessibleContext accessibleContext; + + Dimension pref,min,max; + Border border; + JToolTip tooltip; + String tool_tip_text; + boolean use_double_buffer, opaque; + protected ComponentUI ui; + + Vector ancestor_list; + Vector veto_list; + Vector change_list; + Hashtable prop_hash; + + /** + * AccessibleJComponent + */ + public abstract class AccessibleJComponent + extends AccessibleAWTContainer { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleFocusHandler + */ + protected class AccessibleFocusHandler implements FocusListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleFocusHandler + * @param component TODO + */ + protected AccessibleFocusHandler(AccessibleJComponent component) { + // TODO + } // AccessibleFocusHandler() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * focusGained + * @param event TODO + */ + public void focusGained(FocusEvent event) { + // TODO + } // focusGained() + + /** + * focusLost + * @param event TODO + */ + public void focusLost(FocusEvent valevent) { + // TODO + } // focusLost() + + + } // AccessibleFocusHandler + + /** + * AccessibleContainerHandler + */ + protected class AccessibleContainerHandler implements ContainerListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleContainerHandler + * @param component TODO + */ + protected AccessibleContainerHandler(AccessibleJComponent component) { + // TODO + } // AccessibleContainerHandler() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * componentAdded + * @param event TODO + */ + public void componentAdded(ContainerEvent event) { + // TODO + } // componentAdded() + + /** + * componentRemoved + * @param event TODO + */ + public void componentRemoved(ContainerEvent valevent) { + // TODO + } // componentRemoved() + + + } // AccessibleContainerHandler + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * accessibleContainerHandler + */ + protected ContainerListener accessibleContainerHandler; + + /** + * accessibleFocusHandler + */ + protected FocusListener accessibleFocusHandler; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJComponent + * @param component TODO + */ + protected AccessibleJComponent(JComponent component) { +// super((Container)component); + // TODO + } // AccessibleJComponent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addPropertyChangeListener + * @param listener TODO + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + // TODO + } // addPropertyChangeListener() + + /** + * removePropertyChangeListener + * @param listener TODO + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + // TODO + } // removePropertyChangeListener() + + /** + * getAccessibleChildrenCount + * @returns int + */ + public int getAccessibleChildrenCount() { + return 0; // TODO + } // getAccessibleChildrenCount() + + /** + * getAccessibleChild + * @param value0 TODO + * @returns Accessible + */ + public Accessible getAccessibleChild(int value0) { + return null; // TODO + } // getAccessibleChild() + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleName + * @returns String + */ + public String getAccessibleName() { + return null; // TODO + } // getAccessibleName() + + /** + * getAccessibleDescription + * @returns String + */ + public String getAccessibleDescription() { + return null; // TODO + } // getAccessibleDescription() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return null; // TODO + } // getAccessibleRole() + + /** + * getBorderTitle + * @param value0 TODO + * @returns String + */ + protected String getBorderTitle(Border value0) { + return null; // TODO + } // getBorderTitle() + + + } // AccessibleJComponent + + + public JComponent() + { + super(); + super.setLayout(new FlowLayout()); + + //eventMask |= AWTEvent.COMP_KEY_EVENT_MASK; + enableEvents( AWTEvent.KEY_EVENT_MASK ); + + //updateUI(); // get a proper ui + } + + + // protected EventListenerList listenerList + public boolean contains(int x, int y) + { + //return dims.contains(x,y); + return super.contains(x,y); + } + + + public void addNotify() + { + //Notification to this component that it now has a parent component. + super.addNotify(); + } + + + Hashtable get_prop_hash() + { + if (prop_hash == null) + prop_hash = new Hashtable(); + return prop_hash; + } + public Vector get_veto_list() + { + if (veto_list == null) + veto_list = new Vector(); + return veto_list; + } + public Vector get_change_list() + { + if (change_list == null) + change_list = new Vector(); + return change_list; + } + public Vector get_ancestor_list() + { + if (ancestor_list == null) + ancestor_list = new Vector(); + return ancestor_list; + } + + public Object getClientProperty(Object key) + { return get_prop_hash().get(key); } + + public void putClientProperty(Object key, Object value) + { get_prop_hash().put(key, value); } + + + public void removeAncestorListener(AncestorListener listener) + { get_ancestor_list().removeElement(listener); } + + public void removePropertyChangeListener(PropertyChangeListener listener) + { get_change_list().removeElement(listener); } + + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) + { /* FIXME */ get_change_list().removeElement(listener); } + + public void removeVetoableChangeListener(VetoableChangeListener listener) + { get_veto_list().removeElement(listener); } + + public void addAncestorListener(AncestorListener listener) + { get_ancestor_list().addElement(listener); } + + public void addPropertyChangeListener(PropertyChangeListener listener) + { get_change_list().addElement(listener); } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) + { /* FIXME */ get_change_list().addElement(listener); } + + public void addVetoableChangeListener(VetoableChangeListener listener) + { get_veto_list().addElement(listener); } + + public void computeVisibleRect(Rectangle rect) + { + //Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors. + //super.computeVisibleRect(rect); + } + + + public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) + { + //Reports a bound property change. + } + public void firePropertyChange(String propertyName, byte oldValue, byte newValue) + { + // Reports a bound property change. + } + public void firePropertyChange(String propertyName, char oldValue, char newValue) + { + //Reports a bound property change. + } + + public void firePropertyChange(String propertyName, double oldValue, double newValue) + { + //Reports a bound property change. + } + + public void firePropertyChange(String propertyName, float oldValue, float newValue) + { + // Reports a bound property change. + } + public void firePropertyChange(String propertyName, int oldValue, int newValue) + { + // Reports a bound property change. + } + public void firePropertyChange(String propertyName, long oldValue, long newValue) + { + //Reports a bound property change. protected + } + + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) + { + // Support for reporting bound property changes. + } + public void firePropertyChange(String propertyName, short oldValue, short newValue) + { + // Reports a bound property change. + } + + + protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) + { + // Support for reporting constrained property changes. + } + + public AccessibleContext getAccessibleContext() + { + // Get the AccessibleContext associated with this JComponent + return null; + } + + public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke) + { + //Return the object that will perform the action registered for a given keystroke. + return null; + } + public float getAlignmentX() + { + // Overrides Container.getAlignmentX to return the vertical alignment. + return 0; + } + + public float getAlignmentY() + { + // Overrides Container.getAlignmentY to return the horizontal alignment. + return 0; + } + public boolean getAutoscrolls() + { + //Returns true if this component automatically scrolls its contents when dragged, (when contained in a component that supports scrolling, like JViewport + return false; + } + + public void setBorder(Border border) + { + //System.out.println("set border called !, new border = " + border); + this.border = border; + revalidate(); + repaint(); + } + + public Border getBorder() + { return border; } + + + public Rectangle getBounds(Rectangle rv) + { + if (rv == null) + return new Rectangle(getX(),getY(),getWidth(),getHeight()); + else + { + rv.setBounds(getX(),getY(),getWidth(),getHeight()); + return rv; + } + } + + protected Graphics getComponentGraphics(Graphics g) + { return g; } + + public int getConditionForKeyStroke(KeyStroke aKeyStroke) + { + //Return the condition that determines whether a registered action occurs in response to the specified keystroke. + return 0; + } + public int getDebugGraphicsOptions() + { + return 0; + } + + public Graphics getGraphics() + { return super.getGraphics(); } + + + // static MantaNative void DebugMe(Border b); + + public Insets getInsets() + { + // System.out.println("watch this border"); + // DebugMe(border); + // System.out.println("border = " + border); + + if (border == null) + { + //System.out.println("compares to null !"); + return super.getInsets(); + } + // System.out.println("compare failed !"); + return getBorder().getBorderInsets(this); + } + + public Insets getInsets(Insets insets) + { + Insets t = getInsets(); + + if (insets == null) + return t; + + + return new Insets(t.top, t.left, t.bottom, t.right); + } + public Point getLocation(Point rv) + { + //Store the x,y origin of this component into "return value" rv and return rv. + + if (rv == null) + return new Point(getX(), + getY()); + + rv.setLocation(getX(), + getY()); + return rv; + } + + public Dimension getMaximumSize() + { + if (max != null) + { + //System.out.println("HAVE_MAX_SIZE = " + max); + return max; + } + if (ui != null) + { + Dimension s = ui.getMaximumSize(this); + if (s != null) + { + //System.out.println(" UI-MAX = " + s + ", UI = " + ui + ", IM="+this); + return s; + } + } + Dimension p = super.getMaximumSize(); + //System.out.println(" MAX = " + p + ", COMP="+this); + return p; + } + + public Dimension getMinimumSize() + { + if (min != null) + { + //System.out.println("HAVE_MIN_SIZE = " + min); + return min; + } + if (ui != null) + { + Dimension s = ui.getMinimumSize(this); + if (s != null) + { + // System.out.println(" UI-MIN = " + s + ", UI = " + ui + ", IM="+this); + return s; + } + } + Dimension p = super.getMinimumSize(); + // System.out.println(" MIN = " + p + ", COMP="+this); + return p; + } + + public Dimension getPreferredSize() + { + if (pref != null) + { + //System.out.println("HAVE_PREF_SIZE = " + pref); + return pref; + } + + if (ui != null) + { + Dimension s = ui.getPreferredSize(this); + if (s != null) + { + //System.out.println(" UI-PREF = " + s + ", UI = " + ui + ", IM="+this); + return s; + } + } + Dimension p = super.getPreferredSize(); + // System.out.println(" PREF = " + p + ", COMP="+this); + return p; + } + + public Component getNextFocusableComponent() + { + // Return the next focusable component or null if the focus manager should choose the next focusable component automatically + return null; + } + + + public KeyStroke[] getRegisteredKeyStrokes() + { + // Return the KeyStrokes that will initiate registered actions. + return null; + } + + public JRootPane getRootPane() + { + JRootPane p = SwingUtilities.getRootPane(this); + System.out.println("root = " + p); + return p; + } + + public Dimension getSize(Dimension rv) + { + // System.out.println("JComponent, getsize()"); + if (rv == null) + return new Dimension(getWidth(), + getHeight()); + else + { + rv.setSize(getWidth(), + getHeight()); + return rv; + } + } + + + + /********************************************************************* + * + * + * tooltips: + * + * + **************************************/ + + public JToolTip createToolTip() + { + if (tooltip == null) + tooltip = new JToolTip(tool_tip_text); + return tooltip; + } + + public Point getToolTipLocation(MouseEvent event) + { return null; } + + public void setToolTipText(String text) + { tool_tip_text = text; } + + public String getToolTipText() + { return tool_tip_text; } + + public String getToolTipText(MouseEvent event) + { return tool_tip_text; } + + /********************************************************************* + * + * + * things to do with visibility: + * + * + **************************************/ + + + public Container getTopLevelAncestor() + { + // Returns the top-level ancestor of this component (either the containing Window or Applet), or null if this component has not been added to any container. + System.out.println("JComponent, getTopLevelAncestor()"); + return null; + } + + public Rectangle getVisibleRect() + { + /// Returns the Component's "visible rectangle" - the intersection of this components visible rectangle: + System.out.println("JComponent, getVisibleRect()"); + return null; + } + + public void grabFocus() + { + // Set the focus on the receiving component. + } + + public boolean hasFocus() + { + // Returns true if this Component has the keyboard focus. + return false; + } + + public boolean isDoubleBuffered() + { return use_double_buffer; } + + public boolean isFocusCycleRoot() + { + // Override this method and return true if your component is the root of of a component tree with its own focus cycle. + return false; + } + + public boolean isFocusTraversable() + { + // Identifies whether or not this component can receive the focus. + return false; + } + + public static boolean isLightweightComponent(Component c) + { + return c.getPeer() instanceof LightweightPeer; + } + + public boolean isManagingFocus() + { + // Override this method and return true if your JComponent manages focus. + return false; + } + + public boolean isOpaque() + { return opaque; } + + public boolean isOptimizedDrawingEnabled() + { + // Returns true if this component tiles its children, + return true; + } + + public boolean isPaintingTile() + { + // Returns true if the receiving component is currently painting a tile. + return false; + } + + public boolean isRequestFocusEnabled() + { + // Return whether the receiving component can obtain the focus by calling requestFocus + return false; + } + + public boolean isValidateRoot() + { + // If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated. + return false; + } + + public void paint(Graphics g) + { + // System.out.println("SWING_PAINT:" + this); + + paintBorder(g); + paintComponent(g); + paintChildren(g); + } + + protected void paintBorder(Graphics g) + { + // System.out.println("PAINT_BORDER x XXXXXXX x x x x x x x x x x x x:" + getBorder() + ", THIS="+this); + + // Paint the component's border. + if (getBorder() != null) + { + //System.out.println("PAINT_BORDER x XXXXXXX x x x x x x x x x x x x:" + getBorder() + ", THIS="+this); + + getBorder().paintBorder(this, + g, + 0, + 0, + getWidth(), + getHeight()); + } + } + + protected void paintChildren(Graphics g) + { + // Paint this component's children. + //super.paintChildren(g); + } + + protected void paintComponent(Graphics g) + { + // If the UI delegate is non-null, call its paint method. + if (ui != null) + { + ui.paint(g, this); + } + } + + /** + * Paint the specified region in this component and all of + * its descendants that overlap the region, immediately. + */ + public void paintImmediately(int x, int y, int w, int h) + { + + //Ronald: this shoudld probably redirect to the PLAF .... + } + + public void paintImmediately(Rectangle r) + { + /// Paint the specified region now. + paintImmediately((int)r.getX(), + (int)r.getY(), + (int)r.getWidth(), + (int)r.getHeight()); + } + protected String paramString() + { + // Returns a string representation of this JComponent. + return "JComponent"; + } + protected void processComponentKeyEvent(KeyEvent e) + { + // Process any key events that the component itself recognizes. + //System.out.println("COMP_KEY-EVENT: " + e); + } + protected void processFocusEvent(FocusEvent e) + { + // Processes focus events occurring on this component by dispatching them to any registered FocusListener objects. + //System.out.println("FOCUS_EVENT: " + e); + } + + protected void processKeyEvent(KeyEvent e) + { + // Override processKeyEvent to process events protected + //System.out.println("KEY-EVENT: " + e); + } + + public void processMouseMotionEvent(MouseEvent e) + { + // Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects. + //System.out.println("COMP_MOUSE-EVENT: " + e + ", MEMORY = " + Runtime.getRuntime().freeMemory()); + } + + public void registerKeyboardAction(ActionListener anAction, + KeyStroke aKeyStroke, + int aCondition) + { + registerKeyboardAction(anAction, + null, + aKeyStroke, + aCondition); + } + + public void registerKeyboardAction(ActionListener anAction, + String aCommand, + KeyStroke aKeyStroke, + int aCondition) + { + // Register a new keyboard action. + } + + + public void removeNotify() + { + // Notification to this component that it no longer has a parent component. + } + + public void repaint(long tm, int x, int y, int width, int height) + { + // Adds the specified region to the dirty region list if the component is showing. + //System.out.println("JC: repaint"); + super.repaint(tm, x,y,width,height); + } + + public void repaint(Rectangle r) + { + // Adds the specified region to the dirty region list if the component is showing. + repaint((long)0, + (int)r.getX(), + (int)r.getY(), + (int)r.getWidth(), + (int)r.getHeight()); + } + + public boolean requestDefaultFocus() + { + // Request the focus for the component that should have the focus by default. + return false; + } + + public void requestFocus() + { + // Set focus on the receiving component if isRequestFocusEnabled returns true + super.requestFocus(); + } + + public void resetKeyboardActions() + { + // Unregister all keyboard actions + } + + public void reshape(int x, int y, int w, int h) + { + /// Moves and resizes this component. + super.reshape(x,y,w,h); + } + + public void revalidate() + { + // Support for deferred automatic layout. + if (getParent() == null) + invalidate(); + } + + public void scrollRectToVisible(Rectangle aRect) + { + // Forwards the scrollRectToVisible() message to the JComponent's parent. + } + + public void setAlignmentX(float alignmentX) + { + // Set the the vertical alignment. + } + + public void setAlignmentY(float alignmentY) + { + // Set the the horizontal alignment. + } + + public void setAutoscrolls(boolean autoscrolls) + { + // If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport + } + + + public void setDebugGraphicsOptions(int debugOptions) + { + // Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. + } + + public void setDoubleBuffered(boolean aFlag) + { + use_double_buffer = aFlag; + } + + public void setEnabled(boolean enabled) + { + // Sets whether or not this component is enabled. + super.setEnabled(enabled); + repaint(); + } + + public void setFont(Font font) + { + super.setFont(font); + revalidate(); + repaint(); + } + public void setBackground(Color bg) + { + super.setBackground(bg); + revalidate(); + repaint(); + } + public void setForeground(Color fg) + { + super.setForeground(fg); + revalidate(); + repaint(); + } + + public void setMaximumSize(Dimension maximumSize) + { max = maximumSize; } + + public void setMinimumSize(Dimension minimumSize) + { min = minimumSize; } + + public void setPreferredSize(Dimension preferredSize) + { pref = preferredSize; } + + public void setNextFocusableComponent(Component aComponent) + { + // Specifies the next component to get the focus after this one, for example, when the tab key is pressed. + } + + public void setOpaque(boolean isOpaque) + { + opaque = isOpaque; + revalidate(); + repaint(); + } + + + public void setRequestFocusEnabled(boolean aFlag) + { + } + + + public void setVisible(boolean aFlag) + { + // Makes the component visible or invisible. + + super.setVisible(aFlag); + if (getParent() != null) + { + Rectangle dims = getBounds(); + getParent().repaint((int)dims.getX(), + (int)dims.getY(), + (int)dims.getWidth(), + (int)dims.getHeight()); + } + } + + public void unregisterKeyboardAction(KeyStroke aKeyStroke) + { + // Unregister a keyboard action. + } + + + public void update(Graphics g) + { + paint(g); + } + + + + /****************************************** + * + * + * UI management + * + * + *********/ + + public String getUIClassID() + { + /// Return the UIDefaults key used to look up the name of the swing. + return "JComponent"; + } + + protected void setUI(ComponentUI newUI) + { + if (ui != null) + { + ui.uninstallUI(this); + } + + // Set the look and feel delegate for this component. + ui = newUI; + + if (ui != null) + { + ui.installUI(this); + } + + revalidate(); + repaint(); + } + + public void updateUI() + { + // Resets the UI property to a value from the current look and feel. + System.out.println("update UI not overwritten in class: " + this); + } + +} diff --git a/libjava/javax/swing/JDesktopPane.java b/libjava/javax/swing/JDesktopPane.java new file mode 100644 index 00000000000..af979f3084a --- /dev/null +++ b/libjava/javax/swing/JDesktopPane.java @@ -0,0 +1,284 @@ +/* JDesktopPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import javax.accessibility.*; +import javax.swing.plaf.*; + +/** + * JDesktopPane + * @author Andrew Selkirk + * @version 1.0 + */ +public class JDesktopPane extends JLayeredPane implements Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJDesktopPane + */ + protected class AccessibleJDesktopPane extends AccessibleJComponent { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJDesktopPane + * @param component TODO + */ + protected AccessibleJDesktopPane(JDesktopPane component) { + super(component); + // TODO + } // AccessibleJDesktopPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.DESKTOP_PANE; + } // getAccessibleRole() + + + } // AccessibleJDesktopPane + + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * LIVE_DRAG_MODE + */ + public static int LIVE_DRAG_MODE = 0; + + /** + * OUTLINE_DRAG_MODE + */ + public static int OUTLINE_DRAG_MODE = 1; + + /** + * uiClassID + */ + private static final String uiClassID = "DesktopPaneUI"; + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * selectedFrame + */ + private transient JInternalFrame selectedFrame; + + /** + * desktopManager + */ + private transient DesktopManager desktopManager; + + + /** + * dragMode + */ + private int dragMode; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JDesktopPane + */ + public JDesktopPane() { + // TODO + } // JDesktopPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getUI + * @returns DesktopPaneUI + */ + public DesktopPaneUI getUI() { + return (DesktopPaneUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(DesktopPaneUI ui) { + super.setUI(ui); + } // setUI() + + /** + * setDragMode + * @param mode TODO + */ + public void setDragMode(int mode) { + this.dragMode = mode; + // TODO + } // setDragMode() + + /** + * getDragMode + * @returns int + */ + public int getDragMode() { + return dragMode; + } // getDragMode() + + /** + * getDesktopManager + * @returns DesktopManager + */ + public DesktopManager getDesktopManager() { + return desktopManager; + } // getDesktopManager() + + /** + * setDesktopManager + * @param manager TODO + */ + public void setDesktopManager(DesktopManager manager) { + this.desktopManager = manager; + // TODO + } // setDesktopManager() + + /** + * updateUI + */ + public void updateUI() { + setUI((DesktopPaneUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getAllFrames + * @returns JInternalFrame[] + */ + public JInternalFrame[] getAllFrames() { + return null; // TODO + } // getAllFrames() + + /** + * getSelectedFrame + * @returns JInternalFrame + */ + public JInternalFrame getSelectedFrame() { + return null; // TODO + } // getSelectedFrame() + + /** + * setSelectedFrame + * @param frame TODO + */ + public void setSelectedFrame(JInternalFrame frame) { + // TODO + } // setSelectedFrame() + + /** + * getAllFramesInLayer + * @param layer TODO + * @returns JInternalFrame[] + */ + public JInternalFrame[] getAllFramesInLayer(int layer) { + return null; // TODO + } // getAllFramesInLayer() + + /** + * isOpaque + * @returns boolean + */ + public boolean isOpaque() { + return true; + } // isOpaque() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJDesktopPane(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JDesktopPane diff --git a/libjava/javax/swing/JDialog.java b/libjava/javax/swing/JDialog.java new file mode 100644 index 00000000000..61b9d40a49b --- /dev/null +++ b/libjava/javax/swing/JDialog.java @@ -0,0 +1,266 @@ +/* JDialog.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; + +import javax.accessibility.Accessible; +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +/** + * Unlike JComponent derivatives, JDialog inherits from + * java.awt.Dialog. But also lets a look-and-feel component to its work. + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JDialog extends Dialog implements Accessible +{ + public final static int HIDE_ON_CLOSE = 0; + public final static int DISPOSE_ON_CLOSE = 1; + public final static int DO_NOTHING_ON_CLOSE = 2; + + protected AccessibleContext accessibleContext; + + private int close_action = HIDE_ON_CLOSE; + + /*************************************************** + * + * + * constructors + * + * + *************/ + + JDialog(Frame owner) + { + this(owner, "dialog"); + } + + JDialog(Frame owner, + String s) + { + this(owner, s, true); + } + + JDialog(Frame owner, + String s, + boolean modeld) + { + super(owner, s, modeld); + } + + JDialog(Frame owner, + // String s, + boolean modeld) + { + super(owner, "JDialog", modeld); + } + JDialog(Dialog owner) + { + this(owner, "dialog"); + } + + JDialog(Dialog owner, + String s) + { + this(owner, s, true); + } + + JDialog(Dialog owner, + String s, + boolean modeld) + { + super(owner, s, modeld); + } + + + /*************************************************** + * + * + * methods, this part is shared with JDialog, JFrame + * + * + *************/ + + + private boolean checking; + protected JRootPane rootPane; + + void setLocationRelativeTo(Component c) + { + } + + + protected void frameInit() + { + super.setLayout(new BorderLayout(1, 1)); + getRootPane(); // will do set/create + } + + public Dimension getPreferredSize() + { + Dimension d = super.getPreferredSize(); + return d; + } + + JMenuBar getJMenuBar() + { return getRootPane().getJMenuBar(); } + + void setJMenuBar(JMenuBar menubar) + { getRootPane().setJMenuBar(menubar); } + + + public void setLayout(LayoutManager manager) + { super.setLayout(manager); } + + void setLayeredPane(JLayeredPane layeredPane) + { getRootPane().setLayeredPane(layeredPane); } + + JLayeredPane getLayeredPane() + { return getRootPane().getLayeredPane(); } + + JRootPane getRootPane() + { + if (rootPane == null) + setRootPane(createRootPane()); + return rootPane; + } + + void setRootPane(JRootPane root) + { + if (rootPane != null) + remove(rootPane); + + rootPane = root; + add(rootPane, BorderLayout.CENTER); + } + + JRootPane createRootPane() + { return new JRootPane(); } + + Container getContentPane() + { return getRootPane().getContentPane(); } + + void setContentPane(Container contentPane) + { getRootPane().setContentPane(contentPane); } + + Component getGlassPane() + { return getRootPane().getGlassPane(); } + + void setGlassPane(Component glassPane) + { getRootPane().setGlassPane(glassPane); } + + + protected void addImpl(Component comp, Object constraints, int index) + { super.addImpl(comp, constraints, index); } + + + public void remove(Component comp) + { getContentPane().remove(comp); } + + protected boolean isRootPaneCheckingEnabled() + { return checking; } + + + protected void setRootPaneCheckingEnabled(boolean enabled) + { checking = enabled; } + + + public void update(Graphics g) + { paint(g); } + + protected void processKeyEvent(KeyEvent e) + { super.processKeyEvent(e); } + + ///////////////////////////////////////////////////////////////////////////////// + + + protected void processWindowEvent(WindowEvent e) + { + // System.out.println("PROCESS_WIN_EV-1: " + e); + super.processWindowEvent(e); + // System.out.println("PROCESS_WIN_EV-2: " + e); + switch (e.getID()) + { + case WindowEvent.WINDOW_CLOSING: + { + switch(close_action) + { + case DISPOSE_ON_CLOSE: + { + System.out.println("user requested dispose on close"); + dispose(); + break; + } + case HIDE_ON_CLOSE: + { + setVisible(false); + break; + } + case DO_NOTHING_ON_CLOSE: + break; + } + break; + } + + case WindowEvent.WINDOW_CLOSED: + case WindowEvent.WINDOW_OPENED: + case WindowEvent.WINDOW_ICONIFIED: + case WindowEvent.WINDOW_DEICONIFIED: + case WindowEvent.WINDOW_ACTIVATED: + case WindowEvent.WINDOW_DEACTIVATED: + break; + } + } + + + void setDefaultCloseOperation(int operation) + { close_action = operation; } + + protected String paramString() + { return "JDialog"; } + + public AccessibleContext getAccessibleContext() + { + return null; + } +} diff --git a/libjava/javax/swing/JEditorPane.java b/libjava/javax/swing/JEditorPane.java new file mode 100644 index 00000000000..a2db3ee9007 --- /dev/null +++ b/libjava/javax/swing/JEditorPane.java @@ -0,0 +1,219 @@ +/* JEditorPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.io.*; +import java.net.*; +import javax.swing.text.*; +import javax.swing.event.*; +import java.awt.event.*; +import java.awt.*; +import javax.accessibility.*; + +public class JEditorPane extends JTextComponent +{ + URL page_url; + EditorKit kit; + String ctype = "text/plain"; + boolean focus_root; + boolean manages_focus; + + + public JEditorPane() + { + } + + public JEditorPane(String url) + { + this(); + setPage(url); + } + + public JEditorPane(String type, String text) + { + ctype = text; + setText(text); + } + + public JEditorPane(URL url) + { + setPage(url); + } + + void addHyperlinkListener(HyperlinkListener listener) + { } + + protected EditorKit createDefaultEditorKit() + { return new PlainEditorKit(); } + + static EditorKit createEditorKitForContentType(String type) + { return new PlainEditorKit(); } + + void fireHyperlinkUpdate(HyperlinkEvent e) + { + } + + public AccessibleContext getAccessibleContext() + { return null; } + + String getContentType() + { return ctype; } + + EditorKit getEditorKit() + { return kit; } + + static String getEditorKitClassNameForContentType(String type) + { return "text/plain"; } + + EditorKit getEditorKitForContentType(String type) + { return kit; } + + public Dimension getPreferredSize() + { + //Returns the preferred size for the JEditorPane. + return super.getPreferredSize(); + } + + public boolean getScrollableTracksViewportHeight() + { return false; } + public boolean getScrollableTracksViewportWidth() + { return false; } + + URL getPage() + { return page_url; } + + protected InputStream getStream(URL page) + { + try { + return page.openStream(); + } catch (Exception e) { + System.out.println("Hhmmm, failed to open stream: " + e); + } + return null; + } + + public String getText() + { return super.getText(); } + + public String getUIClassID() + { return "JEditorPane"; } + + public boolean isFocusCycleRoot() + { return focus_root; } + + public boolean isManagingFocus() + { return manages_focus; } + + protected String paramString() + { return "JEditorPane"; } + + protected void processComponentKeyEvent(KeyEvent e) + { + //Overridden to handle processing of tab/shift tab. + } + + protected void processKeyEvent(KeyEvent e) + { + //Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal. + } + + void read(InputStream in, Object desc) + { + //This method initializes from a stream. + } + + static void registerEditorKitForContentType(String type, String classname) + { + //Establishes the default bindings of type to classname. + } + + static void registerEditorKitForContentType(String type, String classname, ClassLoader loader) + { + //Establishes the default bindings of type to classname. + } + + void removeHyperlinkListener(HyperlinkListener listener) + { + //Removes a hyperlink listener. + } + + void replaceSelection(String content) + { + //Replaces the currently selected content with new content represented by the given string. + } + + protected void scrollToReference(String reference) + { + //Scrolls the view to the given reference location (that is, the value returned by the UL.getRef method for the URL being displayed). + } + + void setContentType(String type) + { + ctype = type; + invalidate(); + repaint(); + } + + void setEditorKit(EditorKit kit) + { + this.kit = kit; + invalidate(); + repaint(); + } + + void setEditorKitForContentType(String type, EditorKit k) + { + ctype = type; + setEditorKit(k); + } + + void setPage(String url) + { + // Sets the current URL being displayed. + } + + void setPage(URL page) + { + // Sets the current URL being displayed. + } + + public void setText(String t) + { + super.setText(t); + } +} // class JEditorPane diff --git a/libjava/javax/swing/JFileChooser.java b/libjava/javax/swing/JFileChooser.java new file mode 100644 index 00000000000..cfa435c6d41 --- /dev/null +++ b/libjava/javax/swing/JFileChooser.java @@ -0,0 +1,968 @@ +/* JFileChooser.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; +import javax.accessibility.*; +import javax.swing.filechooser.*; +import javax.swing.filechooser.FileFilter; +import javax.swing.plaf.*; + +/** + * JFileChooser + * @author Andrew Selkirk + * @version 1.0 + */ +public class JFileChooser extends JComponent implements Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJFileChooser + */ + protected class AccessibleJFileChooser extends AccessibleJComponent { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJFileChooser + * @param component TODO + */ + protected AccessibleJFileChooser(JFileChooser component) { + super(component); + // TODO + } // AccessibleJFileChooser() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.FILE_CHOOSER; + } // getAccessibleRole() + + + } // AccessibleJFileChooser + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "FileChooserUI"; + + /** + * OPEN_DIALOG + */ + public static final int OPEN_DIALOG = 0; + + /** + * SAVE_DIALOG + */ + public static final int SAVE_DIALOG = 1; + + /** + * CUSTOM_DIALOG + */ + public static final int CUSTOM_DIALOG = 2; + + /** + * CANCEL_OPTION + */ + public static final int CANCEL_OPTION = 1; + + /** + * APPROVE_OPTION + */ + public static final int APPROVE_OPTION = 0; + + /** + * ERROR_OPTION + */ + public static final int ERROR_OPTION = -1; + + /** + * FILES_ONLY + */ + public static final int FILES_ONLY = 0; + + /** + * DIRECTORIES_ONLY + */ + public static final int DIRECTORIES_ONLY = 1; + + /** + * FILES_AND_DIRECTORIES + */ + public static final int FILES_AND_DIRECTORIES = 2; + + /** + * CANCEL_SELECTION + */ + public static final String CANCEL_SELECTION = "CancelSelection"; + + /** + * APPROVE_SELECTION + */ + public static final String APPROVE_SELECTION = "ApproveSelection"; + + /** + * APPROVE_BUTTON_TEXT_CHANGED_PROPERTY + */ + public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty"; + + /** + * APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY + */ + public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty"; + + /** + * APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY + */ + public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty"; + + /** + * CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY + */ + public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty"; + + /** + * DIRECTORY_CHANGED_PROPERTY + */ + public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged"; + + /** + * SELECTED_FILE_CHANGED_PROPERTY + */ + public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty"; + + /** + * SELECTED_FILES_CHANGED_PROPERTY + */ + public static final String SELECTED_FILES_CHANGED_PROPERTY = "SelectedFilesChangedProperty"; + + /** + * MULTI_SELECTION_ENABLED_CHANGED_PROPERTY + */ + public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty"; + + /** + * FILE_SYSTEM_VIEW_CHANGED_PROPERTY + */ + public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged"; + + /** + * FILE_VIEW_CHANGED_PROPERTY + */ + public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged"; + + /** + * FILE_HIDING_CHANGED_PROPERTY + */ + public static final String FILE_HIDING_CHANGED_PROPERTY = "FileHidingChanged"; + + /** + * FILE_FILTER_CHANGED_PROPERTY + */ + public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged"; + + /** + * FILE_SELECTION_MODE_CHANGED_PROPERTY + */ + public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged"; + + /** + * ACCESSORY_CHANGED_PROPERTY + */ + public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty"; + + /** + * ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY + */ + public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged"; + + /** + * DIALOG_TITLE_CHANGED_PROPERTY + */ + public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty"; + + /** + * DIALOG_TYPE_CHANGED_PROPERTY + */ + public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty"; + + /** + * CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY + */ + public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty"; + + /** + * dialogTitle + */ + private String dialogTitle; + + /** + * approveButtonText + */ + private String approveButtonText; + + /** + * approveButtonToolTipText + */ + private String approveButtonToolTipText; + + /** + * approveButtonMnemonic + */ + private int approveButtonMnemonic; + + /** + * actionListener + */ + private ActionListener actionListener; + + /** + * filters + */ + private Vector filters; + + /** + * dialog + */ + private JDialog dialog; + + /** + * dialogType + */ + private int dialogType; + + /** + * returnValue + */ + private int returnValue; + + /** + * accessory + */ + private JComponent accessory; + + /** + * fileView + */ + private FileView fileView; + + /** + * uiFileView + */ + private FileView uiFileView; + + /** + * controlsShown + */ + private boolean controlsShown; + + /** + * useFileHiding + */ + private boolean useFileHiding; + + /** + * fileSelectionMode + */ + private int fileSelectionMode; + + /** + * multiSelectionEnabled + */ + private boolean multiSelectionEnabled; + + /** + * useAcceptAllFileFilter + */ + private boolean useAcceptAllFileFilter; + + /** + * fileFilter + */ + private FileFilter fileFilter; + + /** + * fileSystemView + */ + private FileSystemView fileSystemView; + + /** + * currentDirectory + */ + private File currentDirectory; + + /** + * selectedFile + */ + private File selectedFile; + + /** + * selectedFiles + */ + private File[] selectedFiles; + + /** + * accessibleContext + */ + protected AccessibleContext accessibleContext; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JFileChooser + */ + public JFileChooser() { + // TODO + } // JFileChooser() + + /** + * Constructor JFileChooser + * @param currentDirectoryPath TODO + */ + public JFileChooser(String currentDirectoryPath) { + // TODO + } // JFileChooser() + + /** + * Constructor JFileChooser + * @param currentDirectory TODO + */ + public JFileChooser(File currentDirectory) { + // TODO + } // JFileChooser() + + /** + * Constructor JFileChooser + * @param value0 TODO + */ + public JFileChooser(FileSystemView fsv) { + // TODO + } // JFileChooser() + + /** + * Constructor JFileChooser + * @param currentDirectory TODO + * @param fsv TODO + */ + public JFileChooser(File currentDirectory, FileSystemView fsv) { + // TODO + } // JFileChooser() + + /** + * Constructor JFileChooser + * @param currentDirectoryPath TODO + * @param fsv TODO + */ + public JFileChooser(String currentDirectoryPath, FileSystemView fsv) { + // TODO + } // JFileChooser() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getName + * @param file TODO + * @returns String + */ + public String getName(File file) { + return null; // TODO + } // getName() + + /** + * setup + * @param view TODO + */ + protected void setup(FileSystemView view) { + // TODO + } // setup() + + /** + * accept + * @param file TODO + * @returns boolean + */ + public boolean accept(File file) { + return false; // TODO + } // accept() + + /** + * getSelectedFile + * @returns File + */ + public File getSelectedFile() { + return null; // TODO + } // getSelectedFile() + + /** + * setSelectedFile + * @param file TODO + */ + public void setSelectedFile(File file) { + // TODO + } // setSelectedFile() + + /** + * getSelectedFiles + * @returns File[] + */ + public File[] getSelectedFiles() { + return null; // TODO + } // getSelectedFiles() + + /** + * setSelectedFiles + * @param files TODO + */ + public void setSelectedFiles(File[] files) { + // TODO + } // setSelectedFiles() + + /** + * getCurrentDirectory + * @returns File + */ + public File getCurrentDirectory() { + return null; // TODO + } // getCurrentDirectory() + + /** + * setCurrentDirectory + * @param directory TODO + */ + public void setCurrentDirectory(File directory) { + // TODO + } // setCurrentDirectory() + + /** + * changeToParentDirectory + */ + public void changeToParentDirectory() { + // TODO + } // changeToParentDirectory() + + /** + * rescanCurrentDirectory + */ + public void rescanCurrentDirectory() { + // TODO + } // rescanCurrentDirectory() + + /** + * ensureFileIsVisible + * @param file TODO + */ + public void ensureFileIsVisible(File file) { + // TODO + } // ensureFileIsVisible() + + /** + * showOpenDialog + * @param parent TODO + * @returns int + */ + public int showOpenDialog(Component parent) { + return 0; // TODO + } // showOpenDialog() + + /** + * showSaveDialog + * @param parent TODO + * @returns int + */ + public int showSaveDialog(Component parent) { + return 0; // TODO + } // showSaveDialog() + + /** + * showDialog + * @param parent TODO + * @param approveButtonText TODO + * @returns int + */ + public int showDialog(Component parent, String approveButtonText) { + return 0; // TODO + } // showDialog() + + /** + * getControlButtonsAreShown + * @returns boolean + */ + public boolean getControlButtonsAreShown() { + return false; // TODO + } // getControlButtonsAreShown() + + /** + * setControlButtonsAreShown + * @param value TODO + */ + public void setControlButtonsAreShown(boolean value) { + // TODO + } // setControlButtonsAreShown() + + /** + * getDialogType + * @returns int + */ + public int getDialogType() { + return 0; // TODO + } // getDialogType() + + /** + * setDialogType + * @param type TODO + */ + public void setDialogType(int type) { + // TODO + } // setDialogType() + + /** + * setDialogTitle + * @param title TODO + */ + public void setDialogTitle(String title) { + // TODO + } // setDialogTitle() + + /** + * getDialogTitle + * @returns String + */ + public String getDialogTitle() { + return null; // TODO + } // getDialogTitle() + + /** + * setApproveButtonToolTipText + * @param text TODO + */ + public void setApproveButtonToolTipText(String text) { + // TODO + } // setApproveButtonToolTipText() + + /** + * getApproveButtonToolTipText + * @returns String + */ + public String getApproveButtonToolTipText() { + return null; // TODO + } // getApproveButtonToolTipText() + + /** + * getApproveButtonMnemonic + * @returns int + */ + public int getApproveButtonMnemonic() { + return 0; // TODO + } // getApproveButtonMnemonic() + + /** + * setApproveButtonMnemonic + * @param mnemonic TODO + */ + public void setApproveButtonMnemonic(int mnemonic) { + // TODO + } // setApproveButtonMnemonic() + + /** + * setApproveButtonMnemonic + * @param mnemonic TODO + */ + public void setApproveButtonMnemonic(char mnemonic) { + // TODO + } // setApproveButtonMnemonic() + + /** + * setApproveButtonText + * @param text TODO + */ + public void setApproveButtonText(String text) { + // TODO + } // setApproveButtonText() + + /** + * getApproveButtonText + * @returns String + */ + public String getApproveButtonText() { + return null; // TODO + } // getApproveButtonText() + + /** + * getChoosableFileFilters + * @returns FileFilter[] + */ + public FileFilter[] getChoosableFileFilters() { + return null; // TODO + } // getChoosableFileFilters() + + /** + * addChoosableFileFilter + * @param filter TODO + */ + public void addChoosableFileFilter(FileFilter filter) { + // TODO + } // addChoosableFileFilter() + + /** + * removeChoosableFileFilter + * @param filter TODO + * @returns boolean + */ + public boolean removeChoosableFileFilter(FileFilter filter) { + return false; // TODO + } // removeChoosableFileFilter() + + /** + * resetChoosableFileFilters + */ + public void resetChoosableFileFilters() { + // TODO + } // resetChoosableFileFilters() + + /** + * getAcceptAllFileFilter + * @returns FileFilter + */ + public FileFilter getAcceptAllFileFilter() { + return null; // TODO + } // getAcceptAllFileFilter() + + /** + * isAcceptAllFileFilterUsed + * @returns boolean + */ + public boolean isAcceptAllFileFilterUsed() { + return false; // TODO + } // isAcceptAllFileFilterUsed() + + /** + * setAcceptAllFileFilterUsed + * @param value TODO + */ + public void setAcceptAllFileFilterUsed(boolean value) { + // TODO + } // setAcceptAllFileFilterUsed() + + /** + * getAccessory + * @returns JComponent + */ + public JComponent getAccessory() { + return null; // TODO + } // getAccessory() + + /** + * setAccessory + * @param accessory TODO + */ + public void setAccessory(JComponent accessory) { + // TODO + } // setAccessory() + + /** + * setFileSelectionMode + * @param mode TODO + */ + public void setFileSelectionMode(int mode) { + // TODO + } // setFileSelectionMode() + + /** + * getFileSelectionMode + * @returns int + */ + public int getFileSelectionMode() { + return 0; // TODO + } // getFileSelectionMode() + + /** + * isFileSelectionEnabled + * @returns boolean + */ + public boolean isFileSelectionEnabled() { + return false; // TODO + } // isFileSelectionEnabled() + + /** + * isDirectorySelectionEnabled + * @returns boolean + */ + public boolean isDirectorySelectionEnabled() { + return false; // TODO + } // isDirectorySelectionEnabled() + + /** + * isMultiSelectionEnabled + * @returns boolean + */ + public boolean isMultiSelectionEnabled() { + return false; // TODO + } // isMultiSelectionEnabled() + + /** + * setMultiSelectionEnabled + * @param enabled TODO + */ + public void setMultiSelectionEnabled(boolean enabled) { + // TODO + } // setMultiSelectionEnabled() + + /** + * isFileHidingEnabled + * @returns boolean + */ + public boolean isFileHidingEnabled() { + return false; // TODO + } // isFileHidingEnabled() + + /** + * setFileHidingEnabled + * @param enabled TODO + */ + public void setFileHidingEnabled(boolean enabled) { + // TODO + } // setFileHidingEnabled() + + /** + * getFileFilter + * @returns FileFilter + */ + public FileFilter getFileFilter() { + return null; // TODO + } // getFileFilter() + + /** + * setFileFilter + * @param filter TODO + */ + public void setFileFilter(FileFilter filter) { + // TODO + } // setFileFilter() + + /** + * getFileView + * @returns FileView + */ + public FileView getFileView() { + return null; // TODO + } // getFileView() + + /** + * setFileView + * @param view TODO + */ + public void setFileView(FileView view) { + // TODO + } // setFileView() + + /** + * getDescription + * @param file TODO + * @returns String + */ + public String getDescription(File file) { + return null; // TODO + } // getDescription() + + /** + * getTypeDescription + * @param file TODO + * @returns String + */ + public String getTypeDescription(File file) { + return null; // TODO + } // getTypeDescription() + + /** + * getIcon + * @param file TODO + * @returns Icon + */ + public Icon getIcon(File file) { + return null; // TODO + } // getIcon() + + /** + * isTraversable + * @param file TODO + * @returns boolean + */ + public boolean isTraversable(File file) { + return false; // TODO + } // isTraversable() + + /** + * getFileSystemView + * @returns FileSystemView + */ + public FileSystemView getFileSystemView() { + return null; // TODO + } // getFileSystemView() + + /** + * setFileSystemView + * @param fsv TODO + */ + public void setFileSystemView(FileSystemView fsv) { + // TODO + } // setFileSystemView() + + /** + * approveSelection + */ + public void approveSelection() { + // TODO + } // approveSelection() + + /** + * cancelSelection + */ + public void cancelSelection() { + // TODO + } // cancelSelection() + + /** + * addActionListener + * @param listener TODO + */ + public void addActionListener(ActionListener listener) { + // TODO + } // addActionListener() + + /** + * removeActionListener + * @param listener TODO + */ + public void removeActionListener(ActionListener listener) { + // TODO + } // removeActionListener() + + /** + * fireActionPerformed + * @param command TODO + */ + protected void fireActionPerformed(String command) { + // TODO + } // fireActionPerformed() + + /** + * updateUI + */ + public void updateUI() { + setUI((FileChooserUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getUI + * @returns FileChooserUI + */ + public FileChooserUI getUI() { + return (FileChooserUI) ui; + } // getUI() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJFileChooser(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JFileChooser diff --git a/libjava/javax/swing/JFrame.java b/libjava/javax/swing/JFrame.java new file mode 100644 index 00000000000..947bfab0e6c --- /dev/null +++ b/libjava/javax/swing/JFrame.java @@ -0,0 +1,245 @@ +/* JFrame.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +/** + * Unlike JComponent derivatives, JFrame inherits from + * java.awt.Frame. But also lets a look-and-feel component to its work. + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JFrame extends Frame +{ + public final static int HIDE_ON_CLOSE = 0; + public final static int EXIT_ON_CLOSE = 1; + public final static int DISPOSE_ON_CLOSE = 2; + public final static int DO_NOTHING_ON_CLOSE = 3; + + protected AccessibleContext accessibleContext; + + private int close_action = EXIT_ON_CLOSE; + + + /*************************************************** + * + * initia + * + * + *************/ + + + public JFrame() + { + super("JFrame"); + frameInit(); + } + + public JFrame(String title) + { + super(title); + frameInit(); + } + + + /*************************************************** + * + * + * methods, this part is shared with JDialog, JFrame + * + * + *************/ + + + private boolean checking; + protected JRootPane rootPane; + + + protected void frameInit() + { + super.setLayout(new BorderLayout(1, 1)); + getRootPane(); // will do set/create + } + + public Dimension getPreferredSize() + { + Dimension d = super.getPreferredSize(); + return d; + } + + JMenuBar getJMenuBar() + { return getRootPane().getJMenuBar(); } + + void setJMenuBar(JMenuBar menubar) + { getRootPane().setJMenuBar(menubar); } + + + public void setLayout(LayoutManager manager) + { super.setLayout(manager); } + + void setLayeredPane(JLayeredPane layeredPane) + { getRootPane().setLayeredPane(layeredPane); } + + JLayeredPane getLayeredPane() + { return getRootPane().getLayeredPane(); } + + JRootPane getRootPane() + { + if (rootPane == null) + setRootPane(createRootPane()); + return rootPane; + } + + void setRootPane(JRootPane root) + { + if (rootPane != null) + remove(rootPane); + + rootPane = root; + add(rootPane, BorderLayout.CENTER); + } + + JRootPane createRootPane() + { return new JRootPane(); } + + Container getContentPane() + { return getRootPane().getContentPane(); } + + void setContentPane(Container contentPane) + { getRootPane().setContentPane(contentPane); } + + Component getGlassPane() + { return getRootPane().getGlassPane(); } + + void setGlassPane(Component glassPane) + { getRootPane().setGlassPane(glassPane); } + + + protected void addImpl(Component comp, Object constraints, int index) + { super.addImpl(comp, constraints, index); } + + + public void remove(Component comp) + { getContentPane().remove(comp); } + + protected boolean isRootPaneCheckingEnabled() + { return checking; } + + + protected void setRootPaneCheckingEnabled(boolean enabled) + { checking = enabled; } + + + public void update(Graphics g) + { paint(g); } + + protected void processKeyEvent(KeyEvent e) + { super.processKeyEvent(e); } + + ///////////////////////////////////////////////////////////////////////////////// + + public AccessibleContext getAccessibleContext() + { + return accessibleContext; + } + + int getDefaultCloseOperation() + { return close_action; } + + + + protected String paramString() + { return "JFrame"; } + + + protected void processWindowEvent(WindowEvent e) + { + // System.out.println("PROCESS_WIN_EV-1: " + e); + super.processWindowEvent(e); + // System.out.println("PROCESS_WIN_EV-2: " + e); + switch (e.getID()) + { + case WindowEvent.WINDOW_CLOSING: + { + switch(close_action) + { + case EXIT_ON_CLOSE: + { + System.out.println("user requested exit on close"); + System.exit(1); + break; + } + case DISPOSE_ON_CLOSE: + { + System.out.println("user requested dispose on close"); + dispose(); + break; + } + case HIDE_ON_CLOSE: + { + setVisible(false); + break; + } + case DO_NOTHING_ON_CLOSE: + break; + } + break; + } + + case WindowEvent.WINDOW_CLOSED: + case WindowEvent.WINDOW_OPENED: + case WindowEvent.WINDOW_ICONIFIED: + case WindowEvent.WINDOW_DEICONIFIED: + case WindowEvent.WINDOW_ACTIVATED: + case WindowEvent.WINDOW_DEACTIVATED: + break; + } + } + + + void setDefaultCloseOperation(int operation) + { close_action = operation; } + +} diff --git a/libjava/javax/swing/JInternalFrame.java b/libjava/javax/swing/JInternalFrame.java new file mode 100644 index 00000000000..55162393412 --- /dev/null +++ b/libjava/javax/swing/JInternalFrame.java @@ -0,0 +1,45 @@ +/* JInternalFrame.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; +/** + * STUBBED + */ +public class JInternalFrame extends JComponent +/*implements Accessible, WindowConstants, RootPaneContainer*/ +{ +} // class JInternalFrame diff --git a/libjava/javax/swing/JLabel.java b/libjava/javax/swing/JLabel.java new file mode 100644 index 00000000000..a4d6fa16faf --- /dev/null +++ b/libjava/javax/swing/JLabel.java @@ -0,0 +1,240 @@ +/* JLabel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import javax.swing.plaf.*; + + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + + +public class JLabel extends JComponent implements SwingConstants +{ + String text; + Icon icon; + int gap; + int align; + + int hor_align; + int hor_text_pos; + + int vert_align; + int vert_text_pos; + + public JLabel() + { + this("", null, 0); + } + + public JLabel(Icon image) + { + this("", image, 0); + } + + public JLabel(Icon image, int horizontalAlignment) + { + this("", image, horizontalAlignment); + } + + public JLabel(String text) + { + this(text, null, 0); + } + + public JLabel(String text, int horizontalAlignment) + { + this(text, null, horizontalAlignment); + } + + public JLabel(String text, Icon icon, int horizontalAlignment) + { + // do the work..... + this.text = text; + setIcon(icon); + this.align = horizontalAlignment; + + updateUI(); // get a proper ui + } + + + protected int checkHorizontalKey(int key, String message) + { + // Verify that key is a legal value for the horizontalAlignment properties. + return 0; + } + protected int checkVerticalKey(int key, String message) + { + // Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties. + return 0; + } + public AccessibleContext getAccessibleContext() + { + // Get the AccessibleContext of this object + return null; + } + public Icon getDisabledIcon() + { + // Returns the value of the disabledIcon property if it's been set, If it hasn't been set and the value of the icon property is an ImageIcon, we compute a "grayed out" version of the icon and update the disabledIcon property with that. + return null; + } + public int getDisplayedMnemonic() + { + // Return the keycode that indicates a mnemonic key. + return 0; + } + public int getHorizontalAlignment() + { + // Returns the alignment of the label's contents along the X axis. + return hor_align; + } + public int getHorizontalTextPosition() + { + // Returns the horizontal position of the label's text, relative to its image. + return hor_text_pos; + } + + public Icon getIcon() + { return icon; } + + public int getIconTextGap() + { + // Returns the amount of space between the text and the icon displayed in this label. + return 0; + } + public Component getLabelFor() + { + // Get the component this is labelling. + return null; + } + public String getText() + { return text; } + + public String getUIClassID() + { return "JLabel"; } + + public int getVerticalAlignment() + { + // Returns the alignment of the label's contents along the Y axis. + return vert_align; + } + public int getVerticalTextPosition() + { + // Returns the vertical position of the label's text, relative to its image. + return vert_text_pos; + } + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) + { + // This is overriden to return false if the current Icon's Image is not equal to the passed in Image img. + return (img == icon); + } + protected String paramString() + { + // Returns a string representation of this JLabel. + return "JLabel"; + } + public void setDisabledIcon(Icon disabledIcon) + { + // Set the icon to be displayed if this JLabel is "disabled" (JLabel.setEnabled(false)). + } + public void setDisplayedMnemonic(char aChar) + { + // Specifies the displayedMnemonic as a char value. + } + public void setDisplayedMnemonic(int key) + { + // Specify a keycode that indicates a mnemonic key. + } + public void setHorizontalAlignment(int alignment) + { + // Sets the alignment of the label's contents along the X axis. + hor_align = alignment; + } + public void setHorizontalTextPosition(int textPosition) + { + // Sets the horizontal position of the label's text, relative to its image. + hor_text_pos = textPosition; + } + public void setIcon(Icon icon) + { + this.icon = icon; + if (icon != null) + { + // XXX FIXME - icons do not know their parent +// icon.setParent(this); + } + revalidate(); + repaint(); + } + + public void setIconTextGap(int iconTextGap) + { + gap = iconTextGap; + } + + public void setLabelFor(Component c) + { + // Set the component this is labelling. + } + public void setText(String text) + { + this.text = text; + revalidate(); + repaint(); + } + + public void setVerticalAlignment(int alignment) + { + // Sets the alignment of the label's contents along the Y axis. + vert_align = alignment; + } + public void setVerticalTextPosition(int textPosition) + { + // Sets the vertical position of the label's text, relative to its image. + vert_text_pos = textPosition; + } + public void updateUI() + { + LabelUI b = (LabelUI)UIManager.getUI(this); + setUI(b); + } +} diff --git a/libjava/javax/swing/JLayeredPane.java b/libjava/javax/swing/JLayeredPane.java new file mode 100644 index 00000000000..ca49378dbb3 --- /dev/null +++ b/libjava/javax/swing/JLayeredPane.java @@ -0,0 +1,58 @@ +/* JLayeredPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + +public class JLayeredPane extends JComponent +{ + JLayeredPane() + { + } + + + protected void addImpl(Component comp, Object constraints, int index) + { + super.addImpl(comp, constraints, index); + + comp.validate(); + comp.repaint(); + } + + +} diff --git a/libjava/javax/swing/JList.java b/libjava/javax/swing/JList.java new file mode 100644 index 00000000000..b12e3c3d73f --- /dev/null +++ b/libjava/javax/swing/JList.java @@ -0,0 +1,239 @@ +/* JList.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import javax.swing.event.*; + +import java.awt.*; +import javax.swing.plaf.*; +import java.util.*; + + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +public class JList extends JComponent implements Scrollable +{ + Color select_back, select_fore; + ListCellRenderer render; + int visibles = 8; + + ListModel model; + ListSelectionModel sel_model; + + public JList() + { + init(); + } + + public JList(Object[] listData) + { + init(); + setListData(listData); + } + + + public JList(Vector listData) + { + init(); + setListData(listData); + } + + + public JList(ListModel listData) + { + init(); + setModel(listData); + } + void init() + { + render = new DefaultCellRenderer(); + + sel_model = new DefaultListSelectionModel(); + setModel(new DefaultListModel()); + + select_back = new Color(0,0,255); + select_fore = new Color(255,255,255); + + updateUI(); + } + + + public int getVisibleRowCount() + { return visibles; } + public void setVisibleRowCount(int visibleRowCount) + { + visibles = visibleRowCount; + invalidate(); + repaint(); + } + + void addListSelectionListener(ListSelectionListener listener) + { sel_model.addListSelectionListener(listener); } + void removeListSelectionListener(ListSelectionListener listener) + { sel_model.removeListSelectionListener(listener); } + + void setSelectionMode(int a) + { sel_model.setSelectionMode(a); } + void setSelectedIndex(int a) + { sel_model.setSelectionInterval(a,a); } + int getSelectedIndex() + { return sel_model.getMinSelectionIndex(); } + Object getSelectedValue() + { + int index = getSelectedIndex(); + if (index == -1) + return null; + return getModel().getElementAt(index); + } + + Color getSelectionBackground() + { return select_back; } + Color getSelectionForeground() + { return select_fore; } + + + public void setListData(final Object[] listData) + { + class AL extends AbstractListModel + { + public int getSize() { return listData.length; } + public Object getElementAt(int i) { return listData[i]; } + }; + + setModel (new AL()); + } + + public void setListData(final Vector listData) + { + // XXX - FIXME Don't also name this AL, workaround for gcj 3.1. + class ALData extends AbstractListModel + { + public int getSize() { return listData.size(); } + public Object getElementAt(int i) { return listData.elementAt(i); } + }; + + setModel (new ALData()); + } + + + public ListCellRenderer getCellRenderer() + { return render; } + public void setCellRenderer(ListCellRenderer cellRenderer) + { + render = cellRenderer; + invalidate(); + repaint(); + } + + public void setModel(ListModel model) + { + ListDataListener l = new ListDataListener() + { + public void intervalAdded(ListDataEvent e) { + repaint(); + } + public void intervalRemoved(ListDataEvent e) { + repaint(); + } + public void contentsChanged(ListDataEvent e) { + repaint(); + } + }; + + this.model = model; + model.addListDataListener(l); + } + + public ListModel getModel() + { return model; } + + + public ListUI getUI() + { return (ListUI) ui; } + public void setUI(ListUI ui) + { super.setUI(ui); } + + public void updateUI() + { + setUI((ListUI)UIManager.getUI(this)); + } + + public String getUIClassID() + { + return "JList"; + } + + + public AccessibleContext getAccessibleContext() + { + return null; + } + + public Dimension getPreferredScrollableViewportSize() + { + return null; + } + + public int getScrollableUnitIncrement(Rectangle visibleRect, + int orientation, + int direction) + { + return 1; + } + + public int getScrollableBlockIncrement(Rectangle visibleRect, + int orientation, + int direction) + { + return 1; + } + + public boolean getScrollableTracksViewportWidth() + { + return false; + } + + public boolean getScrollableTracksViewportHeight() + { + return false; + } + +} diff --git a/libjava/javax/swing/JMenu.java b/libjava/javax/swing/JMenu.java new file mode 100644 index 00000000000..0d4d8686300 --- /dev/null +++ b/libjava/javax/swing/JMenu.java @@ -0,0 +1,756 @@ +/* JMenu.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import java.util.*; +import javax.accessibility.*; +import javax.swing.event.*; + +/** + * JMenu + * @author Andrew Selkirk + * @version 1.0 + */ +public class JMenu extends JMenuItem implements Accessible, MenuElement { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJMenu + */ + protected class AccessibleJMenu extends AccessibleJMenuItem + implements AccessibleSelection { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJMenu + * @param component TODO + */ + protected AccessibleJMenu(JMenu component) { + super(component); + // TODO + } // AccessibleJMenu() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleChildrenCount + * @returns int + */ + public int getAccessibleChildrenCount() { + return 0; // TODO + } // getAccessibleChildrenCount() + + /** + * getAccessibleChild + * @param value0 TODO + * @returns Accessible + */ + public Accessible getAccessibleChild(int value0) { + return null; // TODO + } // getAccessibleChild() + + /** + * getAccessibleSelection + * @returns AccessibleSelection + */ + public AccessibleSelection getAccessibleSelection() { + return null; // TODO + } // getAccessibleSelection() + + /** + * getAccessibleSelection + * @param value0 TODO + * @returns Accessible + */ + public Accessible getAccessibleSelection(int value0) { + return null; // TODO + } // getAccessibleSelection() + + /** + * isAccessibleChildSelected + * @param value0 TODO + * @returns boolean + */ + public boolean isAccessibleChildSelected(int value0) { + return false; // TODO + } // isAccessibleChildSelected() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.MENU; + } // getAccessibleRole() + + /** + * getAccessibleSelectionCount + * @returns int + */ + public int getAccessibleSelectionCount() { + return 0; // TODO + } // getAccessibleSelectionCount() + + /** + * addAccessibleSelection + * @param value0 TODO + */ + public void addAccessibleSelection(int value0) { + // TODO + } // addAccessibleSelection() + + /** + * removeAccessibleSelection + * @param value0 TODO + */ + public void removeAccessibleSelection(int value0) { + // TODO + } // removeAccessibleSelection() + + /** + * clearAccessibleSelection + */ + public void clearAccessibleSelection() { + // TODO + } // clearAccessibleSelection() + + /** + * selectAllAccessibleSelection + */ + public void selectAllAccessibleSelection() { + // TODO + } // selectAllAccessibleSelection() + + + } // AccessibleJMenu + + /** + * WinListener + */ + protected class WinListener extends WindowAdapter implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * popupMenu + */ + JPopupMenu popupMenu; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor WinListener + * @param value0 TODO + * @param value1 TODO + */ + public WinListener(JMenu value0, JPopupMenu value1) { + // TODO + } // WinListener() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * windowClosing + * @param value0 TODO + */ + public void windowClosing(WindowEvent value0) { + // TODO + } // windowClosing() + + + } // WinListener + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "MenuUI"; + + /** + * popupMenu + */ + private JPopupMenu popupMenu; + + /** + * menuChangeListener + */ + private ChangeListener menuChangeListener; + + /** + * menuEvent + */ + private MenuEvent menuEvent; + + /** + * listenerRegistry + */ + private static Hashtable listenerRegistry = null; // TODO + + /** + * delay + */ + private int delay; + + /** + * TRACE + */ + private static final boolean TRACE = false; // TODO + + /** + * VERBOSE + */ + private static final boolean VERBOSE = false; // TODO + + /** + * DEBUG + */ + private static final boolean DEBUG = false; // TODO + + /** + * popupListener + */ + protected JMenu.WinListener popupListener; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JMenu + */ + public JMenu() { + // TODO + } // JMenu() + + /** + * Constructor JMenu + * @param text TODO + */ + public JMenu(String text) { + // TODO + } // JMenu() + + /** + * Constructor JMenu + * @param action TODO + */ + public JMenu(Action action) { + // TODO + } // JMenu() + + /** + * Constructor JMenu + * @param text TODO + * @param tearoff TODO + */ + public JMenu(String text, boolean tearoff) { + // TODO + } // JMenu() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * add + * @param value0 TODO + * @returns JMenuItem + */ + public JMenuItem add(JMenuItem item) { + return null; // TODO + } // add() + + /** + * add + * @param component TODO + * @returns Component + */ + public Component add(Component component) { + return null; // TODO + } // add() + + /** + * add + * @param component TODO + * @param index TODO + * @returns Component + */ + public Component add(Component component, int index) { + return null; // TODO + } // add() + + /** + * add + * @param text TODO + * @returns JMenuItem + */ + public JMenuItem add(String text) { + return null; // TODO + } // add() + + /** + * add + * @param action TODO + * @returns JMenuItem + */ + public JMenuItem add(Action action) { + return null; // TODO + } // add() + + /** + * remove + * @param item TODO + */ + public void remove(JMenuItem item) { + // TODO + } // remove() + + /** + * remove + * @param index TODO + */ + public void remove(int index) { + // TODO + } // remove() + + /** + * remove + * @param component TODO + */ + public void remove(Component component) { + // TODO + } // remove() + + /** + * removeAll + */ + public void removeAll() { + // TODO + } // removeAll() + + /** + * insert + * @param text TODO + * @param index TODO + */ + public void insert(String text, int index) { + // TODO + } // insert() + + /** + * insert + * @param item TODO + * @param index TODO + * @returns JMenuItem + */ + public JMenuItem insert(JMenuItem item, int index) { + return null; // TODO + } // insert() + + /** + * insert + * @param action TODO + * @param index TODO + * @returns JMenuItem + */ + public JMenuItem insert(Action action, int index) { + return null; // TODO + } // insert() + + /** + * updateUI + */ + public void updateUI() { + //setUI((MenuUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * setModel + * @param model TODO + */ + public void setModel(ButtonModel model) { + // TODO + } // setModel() + + /** + * isSelected + * @returns boolean + */ + public boolean isSelected() { + return false; // TODO + } // isSelected() + + /** + * setSelected + * @param selected TODO + */ + public void setSelected(boolean selected) { + // TODO + } // setSelected() + + /** + * isPopupMenuVisible + * @returns boolean + */ + public boolean isPopupMenuVisible() { + return false; // TODO + } // isPopupMenuVisible() + + /** + * setPopupMenuVisible + * @param popup TODO + */ + public void setPopupMenuVisible(boolean popup) { + // TODO + } // setPopupMenuVisible() + + /** + * getPopupMenuOrigin + * @returns Point + */ + protected Point getPopupMenuOrigin() { + return null; // TODO + } // getPopupMenuOrigin() + + /** + * getDelay + * @returns int + */ + public int getDelay() { + return 0; // TODO + } // getDelay() + + /** + * setDelay + * @param value0 TODO + */ + public void setDelay(int delay) { + // TODO + } // setDelay() + + /** + * setMenuLocation + * @param x TODO + * @param y TODO + */ + public void setMenuLocation(int x, int y) { + // TODO + } // setMenuLocation() + + /** + * createActionComponent + * @param action TODO + * @returns JMenuItem + */ + protected JMenuItem createActionComponent(Action action) { + return null; // TODO + } // createActionComponent() + + /** + * createActionChangeListener + * @param item TODO + * @returns PropertyChangeListener + */ + protected PropertyChangeListener createActionChangeListener(JMenuItem item) { + return null; // TODO + } // createActionChangeListener() + + /** + * addSeparator + */ + public void addSeparator() { + // TODO + } // addSeparator() + + /** + * insertSeparator + * @param index TODO + */ + public void insertSeparator(int index) { + // TODO + } // insertSeparator() + + /** + * getItem + * @param index TODO + * @returns JMenuItem + */ + public JMenuItem getItem(int index) { + return null; // TODO + } // getItem() + + /** + * getItemCount + * @returns int + */ + public int getItemCount() { + return 0; // TODO + } // getItemCount() + + /** + * isTearOff + * @returns boolean + */ + public boolean isTearOff() { + return false; // TODO + } // isTearOff() + + /** + * getMenuComponentCount + * @returns int + */ + public int getMenuComponentCount() { + return 0; // TODO + } // getMenuComponentCount() + + /** + * getMenuComponent + * @param index TODO + * @returns Component + */ + public Component getMenuComponent(int index) { + return null; // TODO + } // getMenuComponent() + + /** + * getMenuComponents + * @returns Component[] + */ + public Component[] getMenuComponents() { + return null; // TODO + } // getMenuComponents() + + /** + * isTopLevelMenu + * @returns boolean + */ + public boolean isTopLevelMenu() { + return false; // TODO + } // isTopLevelMenu() + + /** + * isMenuComponent + * @param component TODO + * @returns boolean + */ + public boolean isMenuComponent(Component component) { + return false; // TODO + } // isMenuComponent() + + /** + * getPopupMenu + * @returns JPopupMenu + */ + public JPopupMenu getPopupMenu() { + return null; // TODO + } // getPopupMenu() + + /** + * addMenuListener + * @param listener TODO + */ + public void addMenuListener(MenuListener listener) { + // TODO + } // addMenuListener() + + /** + * removeMenuListener + * @param listener TODO + */ + public void removeMenuListener(MenuListener listener) { + // TODO + } // removeMenuListener() + + /** + * fireMenuSelected + */ + protected void fireMenuSelected() { + // TODO + } // fireMenuSelected() + + /** + * fireMenuDeselected + */ + protected void fireMenuDeselected() { + // TODO + } // fireMenuDeselected() + + /** + * fireMenuCanceled + */ + protected void fireMenuCanceled() { + // TODO + } // fireMenuCanceled() + + /** + * createMenuChangeListener + * @returns ChangeListener + */ + private ChangeListener createMenuChangeListener() { + return null; // TODO + } // createMenuChangeListener() + + /** + * createWinListener + * @param popup TODO + * @returns JMenu.WinListener + */ + protected JMenu.WinListener createWinListener(JPopupMenu popup) { + return null; // TODO + } // createWinListener() + + /** + * menuSelectionChanged + * @param value0 TODO + */ + public void menuSelectionChanged(boolean changed) { + // TODO + } // menuSelectionChanged() + + /** + * getSubElements + * @returns MenuElement[] + */ + public MenuElement[] getSubElements() { + return null; // TODO + } // getSubElements() + + /** + * getComponent + * @returns Component + */ + public Component getComponent() { + return null; // TODO + } // getComponent() + + /** + * setAccelerator + * @param keystroke TODO + */ + public void setAccelerator(KeyStroke keystroke) { + // TODO + } // setAccelerator() + + /** + * processKeyEvent + * @param event TODO + */ + protected void processKeyEvent(KeyEvent event) { + // TODO + } // processKeyEvent() + + /** + * doClick + * @param time TODO + */ + public void doClick(int time) { + // TODO + } // doClick() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJMenu(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JMenu diff --git a/libjava/javax/swing/JMenuBar.java b/libjava/javax/swing/JMenuBar.java new file mode 100644 index 00000000000..dcceb9e3122 --- /dev/null +++ b/libjava/javax/swing/JMenuBar.java @@ -0,0 +1,45 @@ +/* JMenuBar.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public class JMenuBar extends JComponent +{ + JMenuBar() + { + } +} diff --git a/libjava/javax/swing/JMenuItem.java b/libjava/javax/swing/JMenuItem.java new file mode 100644 index 00000000000..7d3bfef9a7a --- /dev/null +++ b/libjava/javax/swing/JMenuItem.java @@ -0,0 +1,463 @@ +/* JMenuItem.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import javax.accessibility.*; +import javax.swing.event.*; +import javax.swing.plaf.*; + +/** + * JMenuItem + * @author Andrew Selkirk + * @version 1.0 + */ +public class JMenuItem extends AbstractButton implements Accessible, MenuElement { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJMenuItem + */ + protected class AccessibleJMenuItem extends AccessibleAbstractButton + implements ChangeListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJMenuItem + * @param component TODO + */ + AccessibleJMenuItem(JMenuItem component) { + super(component); + // TODO + } // AccessibleJMenuItem() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * stateChanged + * @param event TODO + */ + public void stateChanged(ChangeEvent event) { + // TODO + } // stateChanged() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.MENU_ITEM; + } // getAccessibleRole() + + + } // AccessibleJMenuItem + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "MenuItemUI"; + + /** + * accelerator + */ + private KeyStroke accelerator; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JMenuItem + */ + public JMenuItem() { + // TODO + } // JMenuItem() + + /** + * Constructor JMenuItem + * @param icon TODO + */ + public JMenuItem(Icon icon) { + // TODO + } // JMenuItem() + + /** + * Constructor JMenuItem + * @param text TODO + */ + public JMenuItem(String text) { + // TODO + } // JMenuItem() + + /** + * Constructor JMenuItem + * @param action TODO + */ + public JMenuItem(Action action) { + // TODO + } // JMenuItem() + + /** + * Constructor JMenuItem + * @param text TODO + * @param icon TODO + */ + public JMenuItem(String text, Icon icon) { + // TODO + } // JMenuItem() + + /** + * Constructor JMenuItem + * @param text TODO + * @param mnemonic TODO + */ + public JMenuItem(String text, int mnemonic) { + // TODO + } // JMenuItem() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * readObject + * @param stream TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * init + * @param text TODO + * @param icon TODO + */ + protected void init(String text, Icon icon) { + // TODO + } // init() + + /** + * setUI + * @param ui TODO + */ + public void setUI(MenuItemUI ui) { + super.setUI(ui); + // TODO + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((MenuItemUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * isArmed + * @returns boolean + */ + public boolean isArmed() { + return false; // TODO + } // isArmed() + + /** + * setArmed + * @param armed TODO + */ + public void setArmed(boolean armed) { + // TODO + } // setArmed() + + /** + * setEnabled + * @param enabled TODO + */ + public void setEnabled(boolean enabled) { + // TODO + } // setEnabled() + + /** + * getAccelerator + * @returns KeyStroke + */ + public KeyStroke getAccelerator() { + return null; // TODO + } // getAccelerator() + + /** + * setAccelerator + * @param keystroke TODO + */ + public void setAccelerator(KeyStroke keystroke) { + // TODO + } // setAccelerator() + + /** + * configurePropertiesFromAction + * @param action TODO + */ + protected void configurePropertiesFromAction(Action action) { + // TODO + } // configurePropertiesFromAction() + + /** + * createActionPropertyChangeListener + * @param action TODO + * @returns PropertyChangeListener + */ + protected PropertyChangeListener createActionPropertyChangeListener(Action action) { + return null; // TODO + } // createActionPropertyChangeListener() + + /** + * processMouseEvent + * @param event TODO + * @param path TODO + * @param manager TODO + */ + public void processMouseEvent(MouseEvent event, MenuElement[] path, + MenuSelectionManager manager) { + // TODO + } // processMouseEvent() + + /** + * processKeyEvent + * @param event TODO + * @param path TODO + * @param manager TODO + */ + public void processKeyEvent(KeyEvent event, MenuElement[] path, + MenuSelectionManager manager) { + // TODO + } // processKeyEvent() + + /** + * processMenuDragMouseEvent + * @param event TODO + */ + public void processMenuDragMouseEvent(MenuDragMouseEvent event) { + // TODO + } // processMenuDragMouseEvent() + + /** + * processMenuKeyEvent + * @param event TODO + */ + public void processMenuKeyEvent(MenuKeyEvent event) { + // TODO + } // processMenuKeyEvent() + + /** + * fireMenuDragMouseEntered + * @param event TODO + */ + protected void fireMenuDragMouseEntered(MenuDragMouseEvent event) { + // TODO + } // fireMenuDragMouseEntered() + + /** + * fireMenuDragMouseExited + * @param event TODO + */ + protected void fireMenuDragMouseExited(MenuDragMouseEvent event) { + // TODO + } // fireMenuDragMouseExited() + + /** + * fireMenuDragMouseDragged + * @param event TODO + */ + protected void fireMenuDragMouseDragged(MenuDragMouseEvent event) { + // TODO + } // fireMenuDragMouseDragged() + + /** + * fireMenuDragMouseReleased + * @param event TODO + */ + protected void fireMenuDragMouseReleased(MenuDragMouseEvent event) { + // TODO + } // fireMenuDragMouseReleased() + + /** + * fireMenuKeyPressed + * @param event TODO + */ + protected void fireMenuKeyPressed(MenuKeyEvent event) { + // TODO + } // fireMenuKeyPressed() + + /** + * fireMenuKeyReleased + * @param event TODO + */ + protected void fireMenuKeyReleased(MenuKeyEvent event) { + // TODO + } // fireMenuKeyReleased() + + /** + * fireMenuKeyTyped + * @param event TODO + */ + protected void fireMenuKeyTyped(MenuKeyEvent event) { + // TODO + } // fireMenuKeyTyped() + + /** + * menuSelectionChanged + * @param changed TODO + */ + public void menuSelectionChanged(boolean changed) { + // TODO + } // menuSelectionChanged() + + /** + * getSubElements + * @returns MenuElement[] + */ + public MenuElement[] getSubElements() { + return null; // TODO + } // getSubElements() + + /** + * getComponent + * @returns Component + */ + public Component getComponent() { + return null; // TODO + } // getComponent() + + /** + * addMenuDragMouseListener + * @param listener TODO + */ + public void addMenuDragMouseListener(MenuDragMouseListener listener) { + // TODO + } // addMenuDragMouseListener() + + /** + * removeMenuDragMouseListener + * @param listener TODO + */ + public void removeMenuDragMouseListener(MenuDragMouseListener listener) { + // TODO + } // removeMenuDragMouseListener() + + /** + * addMenuKeyListener + * @param listener TODO + */ + public void addMenuKeyListener(MenuKeyListener listener) { + // TODO + } // addMenuKeyListener() + + /** + * removeMenuKeyListener + * @param listener TODO + */ + public void removeMenuKeyListener(MenuKeyListener listener) { + // TODO + } // removeMenuKeyListener() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJMenuItem(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JMenuItem diff --git a/libjava/javax/swing/JOptionPane.java b/libjava/javax/swing/JOptionPane.java new file mode 100644 index 00000000000..71904021a9e --- /dev/null +++ b/libjava/javax/swing/JOptionPane.java @@ -0,0 +1,397 @@ +/* JOptionPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import javax.swing.plaf.*; +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +public class JOptionPane extends JComponent +{ + public static final int DEFAULT_OPTION = 0; + public static final int YES_NO_OPTION = 1; + public static final int YES_NO_CANCEL_OPTION = 2; + public static final int OK_CANCEL_OPTION = 3; + public static final int YES_OPTION = 4; + public static final int NO_OPTION = 5; + public static final int CANCEL_OPTION = 6; + public static final int OK_OPTION = 7; + public static final int CLOSED_OPTION = 8; + + public static final int ERROR_MESSAGE = 0; + public static final int INFORMATION_MESSAGE = 1; + public static final int WARNING_MESSAGE = 2; + public static final int QUESTION_MESSAGE = 3; + public static final int PLAIN_MESSAGE = 4; + + final static String VALUE_PROPERTY = "value_prop"; + final static String INPUT_VALUE_PROPERTY = "input_value_prop"; + + final static String UNINITIALIZED_VALUE = "uninit"; + + // Ronald: shouldnt by public ? + public Object msg; + public int mtype; + public int otype; + public Icon icon; + public Object []args; + public Object init; + + public JDialog dialog; + + /***************************************************************************** + * + * + * joptionpanels + * + * + ***********************************/ + + JOptionPane() + { + this("mess"); + } + + JOptionPane(Object m) + { + this(m, PLAIN_MESSAGE); + } + + JOptionPane(Object m, + int mtype) + { + this(m, mtype, DEFAULT_OPTION); + } + + JOptionPane(Object m, + int mtype, + int otype) + { + this(m, mtype, otype, null); + } + + JOptionPane(Object m, + int mtype, + int otype, + Icon icon) + { + this(m, mtype, otype, icon, null); + } + + JOptionPane(Object m, + int mtype, + int otype, + Icon icon, + Object []args) + { + this(m, mtype, otype, icon, args, null); + } + + JOptionPane(Object msg, + int mtype, + int otype, + Icon icon, + Object []args, + Object init) + { + // this(m, mtype, otype, icon, args, init); + this.msg = msg; + this.mtype = mtype; + this.otype = otype; + this.icon = icon; + this.args = args; + this.init = init; + + updateUI(); + } + + + /***************************************************************************** + * + * + * + * + * + ***********************************/ + + Object val; + public void setValue(Object v) + { val = v; } + public Object getValue() + { return val; } + + public String getUIClassID() + { return "JOptionPane"; } + + + public void setUI(OptionPaneUI ui) { + super.setUI(ui); + } + + public OptionPaneUI getUI() { + return (OptionPaneUI)ui; + } + + public void updateUI() { + setUI((OptionPaneUI)UIManager.getUI(this)); + } + + + public AccessibleContext getAccessibleContext() + { + return null; + } + + protected String paramString() + { + return "JOptionPane"; + } + + public static void showMessageDialog(Component frame, + String msg, + String title, + int bla) + { + DoShowOptionDialog(frame, + msg, + title, + bla, + 0, + null, + null, + null); + } + + public static void showMessageDialog(Component frame, + String msg, + String title, + int bla, + Icon icon) + { + DoShowOptionDialog(frame, + msg, + title, + bla, + 0, + icon, + null, + null); + } + + public static void showMessageDialog(Component frame, + String msg) + { + showMessageDialog(frame, + msg, + null); + } + + + public static void showMessageDialog(Component frame, + String msg, + Icon icon) + { + //System.out.println("++++++++++++++++++creating message dialog:"+msg + ", frame="+frame); + DoShowOptionDialog(frame, + msg, + "Message", + DEFAULT_OPTION, + PLAIN_MESSAGE, + icon, + null, + null); + } + + public static int showConfirmDialog(JFrame frame, + String yes, + String no, + int bla) + { + return 0; + } + + public static String showInputDialog(JFrame frame, + String msg, + String title, + int opt_type, + int msg_type, + Icon icon, + Object[] opts, + Object init) + { + return (String) DoShowOptionDialog(frame, + msg, + title, + opt_type, + msg_type, + icon, + opts, + init); + } + + public static Object showInputDialog(JFrame frame, + String msg, + String title, + int opt_type, + Icon icon, + Object[] opts, + Object init) + { + return DoShowOptionDialog(frame, + msg, + title, + opt_type, + 0, //msg_type, + icon, + opts, + init); + } + + + // everybody comes here eventually + public static int showOptionDialog(Component frame, + String msg, + String title, + int opt_type, + int msg_type, + Icon icon, + Object[] opts, + Object init) + { + Integer a = (Integer) DoShowOptionDialog(frame, + msg, + title, + opt_type, + msg_type, + icon, + opts, + init); + if (a == null) + return -1; + return a.intValue(); + } + + public static Object DoShowOptionDialog(Component frame, + String msg, + String title, + int opt_type, + int msg_type, + Icon icon, + Object[] opts, + Object init) + { + + JOptionPane p = new JOptionPane(msg, + msg_type, + opt_type, + icon, + opts, + init); + System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); + + + JDialog a; + + if (frame == null) + { + a = new JDialog((Frame)frame, + title, + true); + } + else if (frame instanceof Dialog) + { + a = new JDialog((Dialog) frame, + title, + true); + } + else if (frame instanceof Frame) + { + a = new JDialog((Frame) frame, + title, + true); + } + else + { + System.out.println("HUUUUHHH, not a frame or dialog !"); + + a = new JDialog((Frame)null, + title, + true); + } + + p.dialog = a; + + a.getContentPane().setLayout(new BorderLayout()); + a.getContentPane().add(p, + BorderLayout.CENTER); + // package the deal + a.pack(); + + a.setVisible(true); + + Object s = p.getValue(); + + System.out.println("RESULT FROM DIALOG = " + s); + + if (s == null) + return null; + + return s; + } + +} + + + + + + + + + + + + + + + + + diff --git a/libjava/javax/swing/JPanel.java b/libjava/javax/swing/JPanel.java new file mode 100644 index 00000000000..b50271628b4 --- /dev/null +++ b/libjava/javax/swing/JPanel.java @@ -0,0 +1,114 @@ +/* JPanel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import javax.swing.plaf.*; + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +/** + * An instance of JPanel can be added to a panel, frame etc + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JPanel extends JComponent +{ + public JPanel() + { + this(new FlowLayout(), + true); + } + + public JPanel(boolean double_buffered) + { + this(new FlowLayout(), + double_buffered); + } + + public JPanel(LayoutManager layout) + { + this(layout, + true); + } + + + public JPanel(LayoutManager layout, + boolean isDoubleBuffered) + { + if (layout == null) + { + System.err.println("NO LAYOUT SET !!!"); + layout = new FlowLayout(); + } + setLayout(layout); + setOpaque(true); + + updateUI(); + } + + public String getUIClassID() + { return "JPanel"; } + + + public void setUI(PanelUI ui) { + super.setUI(ui); + } + + public PanelUI getUI() { + return (PanelUI)ui; + } + + public void updateUI() { + setUI((PanelUI)UIManager.getUI(this)); + } + + + public AccessibleContext getAccessibleContext() + { + return null; + } + + protected String paramString() + { + return "JPanel"; + } +} diff --git a/libjava/javax/swing/JPasswordField.java b/libjava/javax/swing/JPasswordField.java new file mode 100644 index 00000000000..3e28a8fc106 --- /dev/null +++ b/libjava/javax/swing/JPasswordField.java @@ -0,0 +1,265 @@ +/* JPasswordField.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import javax.accessibility.*; +import javax.swing.text.*; + +/** + * JPasswordField + * @author Andrew Selkirk + * @version 1.0 + */ +public class JPasswordField extends JTextField { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJPasswordField + */ + protected class AccessibleJPasswordField extends AccessibleJTextField { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJPasswordField + * @param component TODO + */ + protected AccessibleJPasswordField(JPasswordField component) { + super(component); + // TODO + } // AccessibleJPasswordField() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.PASSWORD_TEXT; + } // getAccessibleRole() + + + } // AccessibleJPasswordField + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "PasswordFIeldUI"; + + /** + * echoChar. Default is 0 + */ + private char echoChar = 0; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JPasswordField + */ + public JPasswordField() { + // TODO + } // JPasswordField() + + /** + * Constructor JPasswordField + * @param text TODO + */ + public JPasswordField(String text) { + // TODO + } // JPasswordField() + + /** + * Constructor JPasswordField + * @param columns TODO + */ + public JPasswordField(int columns) { + // TODO + } // JPasswordField() + + /** + * Constructor JPasswordField + * @param text TODO + * @param columns TODO + */ + public JPasswordField(String text, int columns) { + // TODO + } // JPasswordField() + + /** + * Constructor JPasswordField + * @param document TODO + * @param text TODO + * @param columns TODO + */ + public JPasswordField(Document document, String text, int columns) { + // TODO + } // JPasswordField() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * copy + */ + public void copy() { + // TODO + } // copy() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getEchoChar + * @returns char + */ + public char getEchoChar() { + return echoChar; + } // getEchoChar() + + /** + * setEchoChar + * @param echo TODO + */ + public void setEchoChar(char echo) { + this.echoChar = echo; + // TODO + } // setEchoChar() + + /** + * echoCharIsSet + * @returns boolean + */ + public boolean echoCharIsSet() { + return (echoChar == 0); + } // echoCharIsSet() + + /** + * cut + */ + public void cut() { + // TODO + } // cut() + + /** + * getText + * @returns String + */ + public String getText() { + return null; // TODO + } // getText() + + /** + * getText + * @param offset TODO + * @param length TODO + * @exception BadLocationException TODO + * @returns String + */ + public String getText(int offset, int length) throws BadLocationException { + return null; // TODO + } // getText() + + /** + * getPassword + * @returns char[] + */ + public char[] getPassword() { + return null; // TODO + } // getPassword() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJPasswordField(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JPasswordField diff --git a/libjava/javax/swing/JPopupMenu.java b/libjava/javax/swing/JPopupMenu.java new file mode 100644 index 00000000000..a787332f176 --- /dev/null +++ b/libjava/javax/swing/JPopupMenu.java @@ -0,0 +1,667 @@ +/* JPopupMenu.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import javax.accessibility.*; +import javax.swing.event.*; +import javax.swing.plaf.*; + +/** + * JPopupMenu + * @author Andrew Selkirk + * @version 1.0 + */ +public class JPopupMenu extends JComponent implements Accessible, MenuElement { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Separator + */ + public static class Separator extends JSeparator { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor Separator + */ + public Separator() { + // TODO + } // Separator() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return null; // TODO + } // getUIClassID() + + + } // Separator + + /** + * AccessibleJPopupMenu + */ + protected class AccessibleJPopupMenu extends AccessibleJComponent { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJPopupMenu + * @param component TODO + */ + protected AccessibleJPopupMenu(JPopupMenu component) { + super(component); + // TODO + } // AccessibleJPopupMenu() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.POPUP_MENU; + } // getAccessibleRole() + + + } // AccessibleJPopupMenu + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "PopupMenuUI"; + + /** + * invoker + */ + transient Component invoker; + + /** + * desiredLocationX + */ + private int desiredLocationX; + + /** + * desiredLocationY + */ + private int desiredLocationY; + + /** + * label + */ + private String label; + + /** + * paintBorder + */ + private boolean paintBorder; + + /** + * margin + */ + private Insets margin; + + /** + * defaultLWPopupEnabledKey + */ + private static final Object defaultLWPopupEnabledKey = null; // TODO + + /** + * lightWeightPopupEnabled + */ + private boolean lightWeightPopupEnabled; + + /** + * selectionModel + */ + private SingleSelectionModel selectionModel; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JPopupMenu + */ + public JPopupMenu() { + // TODO + } // JPopupMenu() + + /** + * Constructor JPopupMenu + * @param label TODO + */ + public JPopupMenu(String label) { + // TODO + } // JPopupMenu() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * readObject + * @param stream TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * add + * @param item TODO + * @returns JMenuItem + */ + public JMenuItem add(JMenuItem item) { + return null; // TODO + } // add() + + /** + * add + * @param text TODO + * @returns JMenuItem + */ + public JMenuItem add(String text) { + return null; // TODO + } // add() + + /** + * add + * @param action TODO + * @returns JMenuItem + */ + public JMenuItem add(Action action) { + return null; // TODO + } // add() + + /** + * remove + * @param index TODO + */ + public void remove(int index) { + // TODO + } // remove() + + /** + * insert + * @param action TODO + * @param index TODO + */ + public void insert(Action action, int index) { + // TODO + } // insert() + + /** + * insert + * @param component TODO + * @param index TODO + */ + public void insert(Component component, int index) { + // TODO + } // insert() + + /** + * paintBorder + * @param graphics TODO + */ + protected void paintBorder(Graphics graphics) { + // TODO + } // paintBorder() + + /** + * getDefaultLightWeightPopupEnabled + * @returns boolean + */ + public static boolean getDefaultLightWeightPopupEnabled() { + return false; // TODO + } // getDefaultLightWeightPopupEnabled() + + /** + * setDefaultLightWeightPopupEnabled + * @param enabled TODO + */ + public static void setDefaultLightWeightPopupEnabled(boolean enabled) { + // TODO + } // setDefaultLightWeightPopupEnabled() + + /** + * getUI + * @returns PopupMenuUI + */ + public PopupMenuUI getUI() { + return (PopupMenuUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(PopupMenuUI ui) { + super.setUI(ui); + // TODO + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((PopupMenuUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getSelectionModel + * @returns SingleSelectionModel + */ + public SingleSelectionModel getSelectionModel() { + return null; // TODO + } // getSelectionModel() + + /** + * setSelectionModel + * @param model TODO + */ + public void setSelectionModel(SingleSelectionModel model) { + // TODO + } // setSelectionModel() + + /** + * createActionComponent + * @param action TODO + * @returns JMenuItem + */ + protected JMenuItem createActionComponent(Action action) { + return null; // TODO + } // createActionComponent() + + /** + * createActionChangeListener + * @param item TODO + * @returns PropertyChangeListener + */ + protected PropertyChangeListener createActionChangeListener(JMenuItem item) { + return null; // TODO + } // createActionChangeListener() + + /** + * isLightWeightPopupEnabled + * @returns boolean + */ + public boolean isLightWeightPopupEnabled() { + return false; // TODO + } // isLightWeightPopupEnabled() + + /** + * setLightWeightPopupEnabled + * @param enabled TODO + */ + public void setLightWeightPopupEnabled(boolean enabled) { + // TODO + } // setLightWeightPopupEnabled() + + /** + * getLabel + * @returns String + */ + public String getLabel() { + return null; // TODO + } // getLabel() + + /** + * setLabel + * @param label TODO + */ + public void setLabel(String label) { + // TODO + } // setLabel() + + /** + * addSeparator + */ + public void addSeparator() { + // TODO + } // addSeparator() + + /** + * addPopupMenuListener + * @param listener TODO + */ + public void addPopupMenuListener(PopupMenuListener listener) { + // TODO + } // addPopupMenuListener() + + /** + * removePopupMenuListener + * @param listener TODO + */ + public void removePopupMenuListener(PopupMenuListener listener) { + // TODO + } // removePopupMenuListener() + + /** + * firePopupMenuWillBecomeVisible + */ + protected void firePopupMenuWillBecomeVisible() { + // TODO + } // firePopupMenuWillBecomeVisible() + + /** + * firePopupMenuWillBecomeInvisible + */ + protected void firePopupMenuWillBecomeInvisible() { + // TODO + } // firePopupMenuWillBecomeInvisible() + + /** + * firePopupMenuCanceled + */ + protected void firePopupMenuCanceled() { + // TODO + } // firePopupMenuCanceled() + + /** + * pack + */ + public void pack() { + // TODO + } // pack() + + /** + * isVisible + * @returns boolean + */ + public boolean isVisible() { + return false; // TODO + } // isVisible() + + /** + * setVisible + * @param visible TODO + */ + public void setVisible(boolean visible) { + // TODO + } // setVisible() + + /** + * setLocation + * @param x TODO + * @param y TODO + */ + public void setLocation(int x, int y) { + // TODO + } // setLocation() + + /** + * isPopupMenu + * @returns boolean + */ + private boolean isPopupMenu() { + return false; // TODO + } // isPopupMenu() + + /** + * getInvoker + * @returns Component + */ + public Component getInvoker() { + return null; // TODO + } // getInvoker() + + /** + * setInvoker + * @param component TODO + */ + public void setInvoker(Component component) { + // TODO + } // setInvoker() + + /** + * show + * @param component TODO + * @param x TODO + * @param y TODO + */ + public void show(Component component, int x, int y) { + // TODO + } // show() + + /** + * getRootPopupMenu + * @returns JPopupMenu + */ + JPopupMenu getRootPopupMenu() { + return null; // TODO + } // getRootPopupMenu() + + /** + * getComponentAtIndex + * @param index TODO + * @returns Component + */ + public Component getComponentAtIndex(int index) { + return null; // TODO + } // getComponentAtIndex() + + /** + * getComponentIndex + * @param component TODO + * @returns int + */ + public int getComponentIndex(Component component) { + return 0; // TODO + } // getComponentIndex() + + /** + * setPopupSize + * @param size TODO + */ + public void setPopupSize(Dimension size) { + // TODO + } // setPopupSize() + + /** + * setPopupSize + * @param x TODO + * @param y TODO + */ + public void setPopupSize(int x, int y) { + // TODO + } // setPopupSize() + + /** + * setSelected + * @param selected TODO + */ + public void setSelected(Component selected) { + // TODO + } // setSelected() + + /** + * isBorderPainted + * @returns boolean + */ + public boolean isBorderPainted() { + return false; // TODO + } // isBorderPainted() + + /** + * setBorderPainted + * @param painted TODO + */ + public void setBorderPainted(boolean painted) { + // TODO + } // setBorderPainted() + + /** + * getMargin + * @returns Insets + */ + public Insets getMargin() { + return null; // TODO + } // getMargin() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * processMouseEvent + * @param event TODO + * @param path TODO + * @param manager TODO + */ + public void processMouseEvent(MouseEvent event, MenuElement[] path, + MenuSelectionManager manager) { + // TODO + } // processMouseEvent() + + /** + * processKeyEvent + * @param event TODO + * @param path TODO + * @param manager TODO + */ + public void processKeyEvent(KeyEvent event, MenuElement[] path, + MenuSelectionManager manager) { + // TODO + } // processKeyEvent() + + /** + * menuSelectionChanged + * @param changed TODO + */ + public void menuSelectionChanged(boolean changed) { + // TODO + } // menuSelectionChanged() + + /** + * getSubElements + * @returns MenuElement[] + */ + public MenuElement[] getSubElements() { + return null; // TODO + } // getSubElements() + + /** + * getComponent + * @returns Component + */ + public Component getComponent() { + return null; // TODO + } // getComponent() + + /** + * isPopupTrigger + * @param event TODO + * @returns boolean + */ + public boolean isPopupTrigger(MouseEvent event) { + return false; // TODO + } // isPopupTrigger() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJPopupMenu(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JPopupMenu diff --git a/libjava/javax/swing/JProgressBar.java b/libjava/javax/swing/JProgressBar.java new file mode 100644 index 00000000000..6558bf83abc --- /dev/null +++ b/libjava/javax/swing/JProgressBar.java @@ -0,0 +1,482 @@ +/* JProgressBar.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; +import javax.accessibility.*; +import javax.swing.event.*; +import javax.swing.plaf.*; + +/** + * JProgressBar + * @author Andrew Selkirk + * @version 1.0 + */ +public class JProgressBar extends JComponent implements SwingConstants, Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + + /** + * AccessibleJProgressBar + */ + protected class AccessibleJProgressBar extends AccessibleJComponent + implements AccessibleValue { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJProgressBar + * @param component TODO + */ + protected AccessibleJProgressBar(JProgressBar component) { + super(component); + // TODO + } // AccessibleJProgressBar() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.PROGRESS_BAR; + } // getAccessibleRole() + + /** + * getAccessibleValue + * @returns AccessibleValue + */ + public AccessibleValue getAccessibleValue() { + return null; // TODO + } // getAccessibleValue() + + /** + * getCurrentAccessibleValue + * @returns Number + */ + public Number getCurrentAccessibleValue() { + return null; // TODO + } // getCurrentAccessibleValue() + + /** + * setCurrentAccessibleValue + * @param value0 TODO + * @returns boolean + */ + public boolean setCurrentAccessibleValue(Number value0) { + return false; // TODO + } // setCurrentAccessibleValue() + + /** + * getMinimumAccessibleValue + * @returns Number + */ + public Number getMinimumAccessibleValue() { + return null; // TODO + } // getMinimumAccessibleValue() + + /** + * getMaximumAccessibleValue + * @returns Number + */ + public Number getMaximumAccessibleValue() { + return null; // TODO + } // getMaximumAccessibleValue() + + + } // AccessibleJProgressBar + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "ProgressBarUI"; + + /** + * orientation + */ + protected int orientation; + + /** + * paintBorder + */ + protected boolean paintBorder; + + /** + * model + */ + protected BoundedRangeModel model; + + /** + * progressString + */ + protected String progressString; + + /** + * paintString + */ + protected boolean paintString; + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent; + + /** + * changeListener + */ + protected ChangeListener changeListener; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JProgressBar + */ + public JProgressBar() { + // TODO + } // JProgressBar() + + /** + * Constructor JProgressBar + * @param orientation TODO + */ + public JProgressBar(int orientation) { + // TODO + } // JProgressBar() + + /** + * Constructor JProgressBar + * @param minimum TODO + * @param maximum TODO + */ + public JProgressBar(int minimum, int maximum) { + // TODO + } // JProgressBar() + + /** + * Constructor JProgressBar + * @param minimum TODO + * @param maximum TODO + * @param orientation TODO + */ + public JProgressBar(int minimum, int maximum, int orientation) { + // TODO + } // JProgressBar() + + /** + * Constructor JProgressBar + * @param model TODO + */ + public JProgressBar(BoundedRangeModel model) { + // TODO + } // JProgressBar() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getValue + * @returns int + */ + public int getValue() { + return 0; // TODO + } // getValue() + + /** + * setValue + * @param value TODO + */ + public void setValue(int value) { + // TODO + } // setValue() + + /** + * paintBorder + * @param graphics TODO + */ + protected void paintBorder(Graphics graphics) { + // TODO + } // paintBorder() + + /** + * getOrientation + * @returns int + */ + public int getOrientation() { + return 0; // TODO + } // getOrientation() + + /** + * setOrientation + * @param orientation TODO + */ + public void setOrientation(int orientation) { + // TODO + } // setOrientation() + + /** + * isStringPainted + * @returns boolean + */ + public boolean isStringPainted() { + return false; // TODO + } // isStringPainted() + + /** + * setStringPainted + * @param painted TODO + */ + public void setStringPainted(boolean painted) { + // TODO + } // setStringPainted() + + /** + * getString + * @returns String + */ + public String getString() { + return null; // TODO + } // getString() + + /** + * setString + * @param string TODO + */ + public void setString(String string) { + // TODO + } // setString() + + /** + * getPercentComplete + * @returns double + */ + public double getPercentComplete() { + return 0.0; // TODO + } // getPercentComplete() + + /** + * isBorderPainted + * @returns boolean + */ + public boolean isBorderPainted() { + return false; // TODO + } // isBorderPainted() + + /** + * setBorderPainted + * @param painted TODO + */ + public void setBorderPainted(boolean painted) { + // TODO + } // setBorderPainted() + + /** + * getUI + * @returns ProgressBarUI + */ + public ProgressBarUI getUI() { + return (ProgressBarUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(ProgressBarUI ui) { + super.setUI(ui); + // TODO + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((ProgressBarUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * createChangeListener + * @returns ChangeListener + */ + protected ChangeListener createChangeListener() { + return null; // TODO + } // createChangeListener() + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener) { + // TODO + } // addChangeListener() + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener valulistener) { + // TODO + } // removeChangeListener() + + /** + * fireStateChanged + */ + protected void fireStateChanged() { + // TODO + } // fireStateChanged() + + /** + * getModel + * @returns BoundedRangeModel + */ + public BoundedRangeModel getModel() { + return null; // TODO + } // getModel() + + /** + * setModel + * @param model TODO + */ + public void setModel(BoundedRangeModel model) { + // TODO + } // setModel() + + /** + * getMinimum + * @returns int + */ + public int getMinimum() { + return 0; // TODO + } // getMinimum() + + /** + * setMinimum + * @param minimum TODO + */ + public void setMinimum(int minimum) { + // TODO + } // setMinimum() + + /** + * getMaximum + * @returns int + */ + public int getMaximum() { + return 0; // TODO + } // getMaximum() + + /** + * setMaximum + * @param maximum TODO + */ + public void setMaximum(int maximum) { + // TODO + } // setMaximum() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJProgressBar(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JProgressBar diff --git a/libjava/javax/swing/JRadioButton.java b/libjava/javax/swing/JRadioButton.java new file mode 100644 index 00000000000..7671b1d3f7b --- /dev/null +++ b/libjava/javax/swing/JRadioButton.java @@ -0,0 +1,92 @@ +/* JRadioButton.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.plaf.*; +import javax.accessibility.*; + +public class JRadioButton extends JToggleButton +{ + public JRadioButton() + { + this(null, null); + } + public JRadioButton(Action a) + { + this(); + setAction(a); + } + + public JRadioButton(Icon icon) + { + this(null, icon); + } + + public JRadioButton(String text) + { + this(text, null); + } + + public JRadioButton(String text, Icon icon) + { + super(text, icon); + } + + + public AccessibleContext getAccessibleContext() + { + //Gets the AccessibleContext associated with this JRadioButton. + return null; + } + + public String getUIClassID() + { + //Returns a string that specifies the name of the L&F class that renders this component. + return "JRadioButton"; + } + + protected String paramString() + { + return "JRadioButton"; + } +} + + + diff --git a/libjava/javax/swing/JRadioButtonMenuItem.java b/libjava/javax/swing/JRadioButtonMenuItem.java new file mode 100644 index 00000000000..208b678ee5c --- /dev/null +++ b/libjava/javax/swing/JRadioButtonMenuItem.java @@ -0,0 +1,221 @@ +/* JRadioButtonMenuItem.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import javax.accessibility.*; + +/** + * JRadioButtonMenuItem + * @author Andrew Selkirk + * @version 1.0 + */ +public class JRadioButtonMenuItem extends JMenuItem implements Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJRadioButtonMenuItem + */ + protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJRadioButtonMenuItem + * @param component TODO + */ + protected AccessibleJRadioButtonMenuItem(JRadioButtonMenuItem component) { + super(component); + // TODO + } // AccessibleJRadioButtonMenuItem() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.RADIO_BUTTON; + } // getAccessibleRole() + + + } // AccessibleJRadioButtonMenuItem + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "RadioButtonMenuItemUI"; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JRadioButtonMenuItem + */ + public JRadioButtonMenuItem() { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param icon TODO + */ + public JRadioButtonMenuItem(Icon icon) { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param text TODO + */ + public JRadioButtonMenuItem(String text) { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param action TODO + */ + public JRadioButtonMenuItem(Action action) { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param text TODO + * @param icon TODO + */ + public JRadioButtonMenuItem(String text, Icon icon) { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param text TODO + * @param selected TODO + */ + public JRadioButtonMenuItem(String text, boolean selected) { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param icon TODO + * @param selected TODO + */ + public JRadioButtonMenuItem(Icon icon, boolean selected) { + // TODO + } // JRadioButtonMenuItem() + + /** + * Constructor JRadioButtonMenuItem + * @param text TODO + * @param icon TODO + * @param selected TODO + */ + public JRadioButtonMenuItem(String text, Icon icon, boolean selected) { + // TODO + } // JRadioButtonMenuItem() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * requestFocus + */ + public void requestFocus() { + // TODO + } // requestFocus() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJRadioButtonMenuItem(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JRadioButtonMenuItem diff --git a/libjava/javax/swing/JRootPane.java b/libjava/javax/swing/JRootPane.java new file mode 100644 index 00000000000..e7216d706a2 --- /dev/null +++ b/libjava/javax/swing/JRootPane.java @@ -0,0 +1,209 @@ +/* JRootPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +/** + * This class is where JComponents are added to. + * Unlike awt where you could just say frame.add(), + * with swing you need to say frame.getRootPane() + * (which delivers an instance of this class) + * and add your components to that. + * + * It is implemented by several 'layers' (pane() should be read as plane()) + * each on top of the others + * where you can add components to. + * (getContentPane(), getGlassPane(), getLayeredPane()) + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JRootPane extends JComponent +{ + // The class used to obtain the accessible role for this object. + static protected class AccessibleJRootPane + { + } + + //A custom layout manager + static protected class RootLayout extends BorderLayout + { + public Dimension preferredLayoutSize ( Container c ) + { + Dimension p = super.preferredLayoutSize(c); + System.out.println(" PREF-SIZE from RootLayout = " + p); + return p; + } + } + + /***********************************************************/ + + + //The glass pane that overlays the menu bar and content pane, so it can intercept mouse movements and such. + protected Component glassPane; + + //The layered pane that manages the menu bar and content pane. + protected JLayeredPane layeredPane; + + // The menu bar. + protected JMenuBar menuBar; + + protected Container contentPane; + + /********************************************************/ + + public String getUIClassID() + { return "JPanel"; } + + + void setJMenuBar(JMenuBar m) + { menuBar = m; } + + JMenuBar getJMenuBar() + { return menuBar; } + + + public Container getContentPane() + { + if (contentPane == null) + { + setContentPane(createContentPane()); + } + return contentPane; + } + + public void setContentPane(Container p) + { + contentPane = p; + getLayeredPane().add(contentPane, 0); + } + + protected void addImpl(Component comp, + Object constraints, + int index) + { + super.addImpl(comp, constraints, index); + //System.out.println("don't do that !"); + } + + public Component getGlassPane() + { + if (glassPane == null) + setGlassPane(createGlassPane()); + return glassPane; + } + + public void setGlassPane(Component f) + { + if (glassPane != null) + remove(glassPane); + + glassPane = f; + + glassPane.setVisible(false); + add(glassPane, 0); + } + + public JLayeredPane getLayeredPane() + { + if (layeredPane == null) + setLayeredPane(createLayeredPane()); + return layeredPane; + } + public void setLayeredPane(JLayeredPane f) + { + if (layeredPane != null) + remove(layeredPane); + + layeredPane = f; + add(f, -1); + } + + + /********************************************************/ + + JRootPane() + { + setLayout(createRootLayout()); + + getGlassPane(); + getLayeredPane(); + getContentPane(); + + setDoubleBuffered(true); + updateUI(); + } + + protected LayoutManager createRootLayout() { + return new RootLayout(); + } + + JComponent createContentPane() + { + JPanel p = new JPanel(); + p.setName(this.getName()+".contentPane"); + p.setLayout(new BorderLayout()); + // p.setVisible(true); + + System.out.println("Created ContentPane: " + p); + return p; + } + + Component createGlassPane() + { + JPanel p = new JPanel(); + p.setName(this.getName()+".glassPane"); + p.setLayout(new BorderLayout()); + p.setVisible(false); + + System.out.println("created the glasspane: "+p); + return p; + } + + JLayeredPane createLayeredPane() + { + JLayeredPane l = new JLayeredPane(); + return l; + } +} diff --git a/libjava/javax/swing/JScrollBar.java b/libjava/javax/swing/JScrollBar.java new file mode 100644 index 00000000000..482ed8f62bf --- /dev/null +++ b/libjava/javax/swing/JScrollBar.java @@ -0,0 +1,43 @@ +/* JScrollBar.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public class JScrollBar extends JComponent +{ +} diff --git a/libjava/javax/swing/JScrollPane.java b/libjava/javax/swing/JScrollPane.java new file mode 100644 index 00000000000..70cbd2d6ef7 --- /dev/null +++ b/libjava/javax/swing/JScrollPane.java @@ -0,0 +1,133 @@ +/* JScrollPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import javax.swing.plaf.*; + + +public class JScrollPane extends JComponent +{ + protected JViewport columnHeader; + protected JViewport rowHeader; + + protected Component lowerLeft; + protected Component lowerRight; + protected Component upperLeft; + protected Component upperRight; + + protected JScrollBar horizontalScrollBar; + protected int horizontalScrollBarPolicy; + protected JScrollBar verticalScrollBar; + protected int verticalScrollBarPolicy; + + protected JViewport viewport; + + + public JScrollPane() + { + this(null, 0, 0); + } + + public JScrollPane(Component view) + { + this(view, 0, 0); + } + + + public JScrollPane(int vsbPolicy, int hsbPolicy) + { + this(null, 0, 0); + } + + public JScrollPane(Component view, int vsbPolicy, int hsbPolicy) + { + setViewportView(view); + setOpaque(true); + updateUI(); + } + + public String getUIClassID() + { + //Returns a string that specifies the name of the L&F class that renders this component. + return "JScrollPane"; + } + + public JViewport getViewport() + { + return viewport; + } + + public JViewport createViewport() + { + return new JViewport(); + } + + public void setViewport(JViewport v) + { + if (viewport != null) + remove(viewport); + + viewport = v; + + add(v); + + revalidate(); + repaint(); + } + + public void updateUI() + { + ScrollPaneUI b = (ScrollPaneUI)UIManager.getUI(this); + setUI(b); + } + + + public void setViewportView(Component view) + { + if (getViewport() == null) + { + setViewport(createViewport()); + } + + if (view != null) + { + getViewport().setView(view); + } + } +} diff --git a/libjava/javax/swing/JSeparator.java b/libjava/javax/swing/JSeparator.java new file mode 100644 index 00000000000..a49a77faa52 --- /dev/null +++ b/libjava/javax/swing/JSeparator.java @@ -0,0 +1,223 @@ +/* JSeparator.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import javax.accessibility.*; +import javax.swing.plaf.*; + +/** + * JSeparator + * @author Andrew Selkirk + * @version 1.0 + */ +public class JSeparator extends JComponent + implements SwingConstants, Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJSeparator + */ + protected class AccessibleJSeparator extends AccessibleJComponent { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJSeparator + * @param component TODO + */ + protected AccessibleJSeparator(JSeparator component) { + super(component); + // TODO + } // AccessibleJSeparator() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.SEPARATOR; + } // getAccessibleRole() + + + } // AccessibleJSeparator + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "SeparatorUI"; + + /** + * orientation + */ + private int orientation; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JSeparator + */ + public JSeparator() { + this(HORIZONTAL); + } // JSeparator() + + /** + * Constructor JSeparator + * @param value0 TODO + */ + public JSeparator(int orientation) { + this.orientation = orientation; + // TODO + } // JSeparator() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getUI + * @returns SeparatorUI + */ + public SeparatorUI getUI() { + return (SeparatorUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(SeparatorUI ui) { + super.setUI(ui); + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((SeparatorUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getOrientation + * @returns int + */ + public int getOrientation() { + return orientation; + } // getOrientation() + + /** + * setOrientation + * @param orientation TODO + */ + public void setOrientation(int orientation) { + this.orientation = orientation; + // TODO + } // setOrientation() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * isFocusTraversable + * @returns boolean + */ + public boolean isFocusTraversable() { + return false; + } // isFocusTraversable() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJSeparator(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JSeparator diff --git a/libjava/javax/swing/JSlider.java b/libjava/javax/swing/JSlider.java new file mode 100644 index 00000000000..e0588288d60 --- /dev/null +++ b/libjava/javax/swing/JSlider.java @@ -0,0 +1,689 @@ +/* JSlider.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import java.util.*; +import javax.accessibility.*; +import javax.swing.event.*; +import javax.swing.plaf.*; + +/** + * JSlider + * @author Andrew Selkirk + * @version 1.0 + */ +public class JSlider extends JComponent implements SwingConstants, Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + + /** + * AccessibleJSlider + */ + protected class AccessibleJSlider extends JComponent.AccessibleJComponent implements AccessibleValue { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJSlider + * @param value0 TODO + */ + protected AccessibleJSlider(JSlider value0) { + super(value0); + // TODO + } // AccessibleJSlider() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return null; // TODO + } // getAccessibleRole() + + /** + * getAccessibleValue + * @returns AccessibleValue + */ + public AccessibleValue getAccessibleValue() { + return null; // TODO + } // getAccessibleValue() + + /** + * getCurrentAccessibleValue + * @returns Number + */ + public Number getCurrentAccessibleValue() { + return null; // TODO + } // getCurrentAccessibleValue() + + /** + * setCurrentAccessibleValue + * @param value0 TODO + * @returns boolean + */ + public boolean setCurrentAccessibleValue(Number value0) { + return false; // TODO + } // setCurrentAccessibleValue() + + /** + * getMinimumAccessibleValue + * @returns Number + */ + public Number getMinimumAccessibleValue() { + return null; // TODO + } // getMinimumAccessibleValue() + + /** + * getMaximumAccessibleValue + * @returns Number + */ + public Number getMaximumAccessibleValue() { + return null; // TODO + } // getMaximumAccessibleValue() + + + } // AccessibleJSlider + + /** + * ModelListener + */ + private class ModelListener implements ChangeListener, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ModelListener + * @param value0 TODO + */ + private ModelListener(JSlider value0) { + // TODO + } // ModelListener() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * stateChanged + * @param value0 TODO + */ + public void stateChanged(ChangeEvent value0) { + // TODO + } // stateChanged() + + + } // ModelListener + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "SliderUI"; + + /** + * paintTicks + */ + private boolean paintTicks; + + /** + * paintTrack + */ + private boolean paintTrack; + + /** + * paintLabels + */ + private boolean paintLabels; + + /** + * isInverted + */ + private boolean isInverted; + + /** + * sliderModel + */ + protected BoundedRangeModel sliderModel; + + /** + * majorTickSpacing + */ + protected int majorTickSpacing; + + /** + * minorTickSpacing + */ + protected int minorTickSpacing; + + /** + * snapToTicks + */ + protected boolean snapToTicks; + + /** + * snapToValue + */ + boolean snapToValue; + + /** + * orientation + */ + protected int orientation; + + /** + * labelTable + */ + private Dictionary labelTable; + + /** + * changeListener + */ + protected ChangeListener changeListener; + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JSlider + */ + public JSlider() { + // TODO + } // JSlider() + + /** + * Constructor JSlider + * @param value0 TODO + */ + public JSlider(int orientation) { + // TODO + } // JSlider() + + /** + * Constructor JSlider + * @param minimum TODO + * @param maximum TODO + */ + public JSlider(int minimum, int maximum) { + // TODO + } // JSlider() + + /** + * Constructor JSlider + * @param minimum TODO + * @param maximum TODO + * @param value TODO + */ + public JSlider(int minimum, int maximum, int value) { + // TODO + } // JSlider() + + /** + * Constructor JSlider + * @param orientation TODO + * @param minimum TODO + * @param maximum TODO + * @param value TODO + */ + public JSlider(int orientation, int minimum, int maximum, int value) { + // TODO + } // JSlider() + + /** + * Constructor JSlider + * @param value0 TODO + */ + public JSlider(BoundedRangeModel model) { + // TODO + } // JSlider() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getValue + * @returns int + */ + public int getValue() { + return 0; // TODO + } // getValue() + + /** + * setValue + * @param value0 TODO + */ + public void setValue(int value) { + // TODO + } // setValue() + + /** + * getUI + * @returns SliderUI + */ + public SliderUI getUI() { + return (SliderUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(SliderUI ui) { + super.setUI(ui); + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((SliderUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * createChangeListener + * @returns ChangeListener + */ + protected ChangeListener createChangeListener() { + return null; // TODO + } // createChangeListener() + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener) { + // TODO + } // addChangeListener() + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener listener) { + // TODO + } // removeChangeListener() + + /** + * fireStateChanged + */ + protected void fireStateChanged() { + // TODO + } // fireStateChanged() + + /** + * getModel + * @returns BoundedRangeModel + */ + public BoundedRangeModel getModel() { + return null; // TODO + } // getModel() + + /** + * setModel + * @param model TODO + */ + public void setModel(BoundedRangeModel model) { + // TODO + } // setModel() + + /** + * getMinimum + * @returns int + */ + public int getMinimum() { + return 0; // TODO + } // getMinimum() + + /** + * setMinimum + * @param minimum TODO + */ + public void setMinimum(int minimum) { + // TODO + } // setMinimum() + + /** + * getMaximum + * @returns int + */ + public int getMaximum() { + return 0; // TODO + } // getMaximum() + + /** + * setMaximum + * @param maximum TODO + */ + public void setMaximum(int maximum) { + // TODO + } // setMaximum() + + /** + * getValueIsAdjusting + * @returns boolean + */ + public boolean getValueIsAdjusting() { + return false; // TODO + } // getValueIsAdjusting() + + /** + * setValueIsAdjusting + * @param adjusting TODO + */ + public void setValueIsAdjusting(boolean adjusting) { + // TODO + } // setValueIsAdjusting() + + /** + * getExtent + * @returns int + */ + public int getExtent() { + return 0; // TODO + } // getExtent() + + /** + * setExtent + * @param vextent TODO + */ + public void setExtent(int extent) { + // TODO + } // setExtent() + + /** + * getOrientation + * @returns int + */ + public int getOrientation() { + return 0; // TODO + } // getOrientation() + + /** + * setOrientation + * @param orientation TODO + */ + public void setOrientation(int orientation) { + // TODO + } // setOrientation() + + /** + * getLabelTable + * @returns Dictionary + */ + public Dictionary getLabelTable() { + return null; // TODO + } // getLabelTable() + + /** + * setLabelTable + * @param table TODO + */ + public void setLabelTable(Dictionary table) { + // TODO + } // setLabelTable() + + /** + * updateLabelUIs + */ + protected void updateLabelUIs() { + // TODO + } // updateLabelUIs() + + /** + * createStandardLabels + * @param increment TODO + * @returns Hashtable + */ + public Hashtable createStandardLabels(int increment) { + return null; // TODO + } // createStandardLabels() + + /** + * createStandardLabels + * @param increment TODO + * @param start TODO + * @returns Hashtable + */ + public Hashtable createStandardLabels(int increment, int start) { + return null; // TODO + } // createStandardLabels() + + /** + * getInverted + * @returns boolean + */ + public boolean getInverted() { + return false; // TODO + } // getInverted() + + /** + * setInverted + * @param inverted TODO + */ + public void setInverted(boolean inverted) { + // TODO + } // setInverted() + + /** + * getMajorTickSpacing + * @returns int + */ + public int getMajorTickSpacing() { + return 0; // TODO + } // getMajorTickSpacing() + + /** + * setMajorTickSpacing + * @param spacing TODO + */ + public void setMajorTickSpacing(int spacing) { + // TODO + } // setMajorTickSpacing() + + /** + * getMinorTickSpacing + * @returns int + */ + public int getMinorTickSpacing() { + return 0; // TODO + } // getMinorTickSpacing() + + /** + * setMinorTickSpacing + * @param spacing TODO + */ + public void setMinorTickSpacing(int spacing) { + // TODO + } // setMinorTickSpacing() + + /** + * getSnapToTicks + * @returns boolean + */ + public boolean getSnapToTicks() { + return false; // TODO + } // getSnapToTicks() + + /** + * getSnapToValue + * @returns boolean + */ + boolean getSnapToValue() { + return false; // TODO + } // getSnapToValue() + + /** + * setSnapToTicks + * @param snap TODO + */ + public void setSnapToTicks(boolean snap) { + // TODO + } // setSnapToTicks() + + /** + * getPaintTicks + * @returns boolean + */ + public boolean getPaintTicks() { + return false; // TODO + } // getPaintTicks() + + /** + * setPaintTicks + * @param paint TODO + */ + public void setPaintTicks(boolean paint) { + // TODO + } // setPaintTicks() + + /** + * getPaintTrack + * @returns boolean + */ + public boolean getPaintTrack() { + return false; // TODO + } // getPaintTrack() + + /** + * setPaintTrack + * @param paint TODO + */ + public void setPaintTrack(boolean paint) { + // TODO + } // setPaintTrack() + + /** + * getPaintLabels + * @returns boolean + */ + public boolean getPaintLabels() { + return false; // TODO + } // getPaintLabels() + + /** + * setPaintLabels + * @param paint TODO + */ + public void setPaintLabels(boolean paint) { + // TODO + } // setPaintLabels() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJSlider(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JSlider diff --git a/libjava/javax/swing/JSplitPane.java b/libjava/javax/swing/JSplitPane.java new file mode 100644 index 00000000000..f47ef7595d1 --- /dev/null +++ b/libjava/javax/swing/JSplitPane.java @@ -0,0 +1,643 @@ +/* JSplitPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; +import javax.accessibility.*; +import javax.swing.plaf.*; + +/** + * JSplitPane + * @author Andrew Selkirk + * @version 1.0 + */ +public class JSplitPane extends JComponent implements Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJSplitPane + */ + protected class AccessibleJSplitPane extends AccessibleJComponent + implements AccessibleValue { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJSplitPane + * @param component TODO + */ + protected AccessibleJSplitPane(JSplitPane component) { + super(component); + // TODO + } // AccessibleJSplitPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.SPLIT_PANE; + } // getAccessibleRole() + + /** + * getAccessibleValue + * @returns AccessibleValue + */ + public AccessibleValue getAccessibleValue() { + return null; // TODO + } // getAccessibleValue() + + /** + * getCurrentAccessibleValue + * @returns Number + */ + public Number getCurrentAccessibleValue() { + return null; // TODO + } // getCurrentAccessibleValue() + + /** + * setCurrentAccessibleValue + * @param value0 TODO + * @returns boolean + */ + public boolean setCurrentAccessibleValue(Number value0) { + return false; // TODO + } // setCurrentAccessibleValue() + + /** + * getMinimumAccessibleValue + * @returns Number + */ + public Number getMinimumAccessibleValue() { + return null; // TODO + } // getMinimumAccessibleValue() + + /** + * getMaximumAccessibleValue + * @returns Number + */ + public Number getMaximumAccessibleValue() { + return null; // TODO + } // getMaximumAccessibleValue() + + + } // AccessibleJSplitPane + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "SplitPaneUI"; + + /** + * VERTICAL_SPLIT + */ + public static final int VERTICAL_SPLIT = 0; + + /** + * HORIZONTAL_SPLIT + */ + public static final int HORIZONTAL_SPLIT = 1; + + /** + * LEFT + */ + public static final String LEFT = "left"; + + /** + * RIGHT + */ + public static final String RIGHT = "right"; + + /** + * TOP + */ + public static final String TOP = "top"; + + /** + * BOTTOM + */ + public static final String BOTTOM = "bottom"; + + /** + * DIVIDER + */ + public static final String DIVIDER = "divider"; + + /** + * ORIENTATION_PROPERTY + */ + public static final String ORIENTATION_PROPERTY = "orientation"; + + /** + * CONTINUOUS_LAYOUT_PROPERTY + */ + public static final String CONTINUOUS_LAYOUT_PROPERTY = "continuousLayout"; + + /** + * DIVIDER_SIZE_PROPERTY + */ + public static final String DIVIDER_SIZE_PROPERTY = "dividerSize"; + + /** + * ONE_TOUCH_EXPANDABLE_PROPERTY + */ + public static final String ONE_TOUCH_EXPANDABLE_PROPERTY = "oneTouchExpandable"; + + /** + * LAST_DIVIDER_LOCATION_PROPERTY + */ + public static final String LAST_DIVIDER_LOCATION_PROPERTY = "lastDividerLocation"; + + /** + * DIVIDER_LOCATION_PROPERTY + */ + public static final String DIVIDER_LOCATION_PROPERTY = "dividerLocation"; + + /** + * RESIZE_WEIGHT_PROPERTY + */ + public static final String RESIZE_WEIGHT_PROPERTY = "resizeWeight"; + + /** + * orientation + */ + protected int orientation; + + /** + * continuousLayout + */ + protected boolean continuousLayout; + + /** + * leftComponent + */ + protected Component leftComponent; + + /** + * rightComponent + */ + protected Component rightComponent; + + /** + * dividerSize + */ + protected int dividerSize; + + /** + * oneTouchExpandable + */ + protected boolean oneTouchExpandable; + + /** + * lastDividerLocation + */ + protected int lastDividerLocation; + + /** + * resizeWeight + */ + private double resizeWeight; + + /** + * dividerLocation + */ + private int dividerLocation; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JSplitPane + */ + public JSplitPane() { + // TODO + } // JSplitPane() + + /** + * Constructor JSplitPane + * @param value0 TODO + */ + public JSplitPane(int value0) { + // TODO + } // JSplitPane() + + /** + * Constructor JSplitPane + * @param value0 TODO + * @param value1 TODO + */ + public JSplitPane(int value0, boolean value1) { + // TODO + } // JSplitPane() + + /** + * Constructor JSplitPane + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public JSplitPane(int value0, Component value1, Component value2) { + // TODO + } // JSplitPane() + + /** + * Constructor JSplitPane + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + */ + public JSplitPane(int value0, boolean value1, Component value2, Component value3) { + // TODO + } // JSplitPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * remove + * @param value0 TODO + */ + public void remove(Component value0) { + // TODO + } // remove() + + /** + * remove + * @param value0 TODO + */ + public void remove(int value0) { + // TODO + } // remove() + + /** + * removeAll + */ + public void removeAll() { + // TODO + } // removeAll() + + /** + * setUI + * @param ui TODO + */ + public void setUI(SplitPaneUI ui) { + super.setUI(ui); + } // setUI() + + /** + * getUI + * @returns SplitPaneUI + */ + public SplitPaneUI getUI() { + return (SplitPaneUI) ui; + } // getUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((SplitPaneUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * setDividerSize + * @param value0 TODO + */ + public void setDividerSize(int value0) { + // TODO + } // setDividerSize() + + /** + * getDividerSize + * @returns int + */ + public int getDividerSize() { + return 0; // TODO + } // getDividerSize() + + /** + * setLeftComponent + * @param value0 TODO + */ + public void setLeftComponent(Component value0) { + // TODO + } // setLeftComponent() + + /** + * getLeftComponent + * @returns Component + */ + public Component getLeftComponent() { + return null; // TODO + } // getLeftComponent() + + /** + * setTopComponent + * @param value0 TODO + */ + public void setTopComponent(Component value0) { + // TODO + } // setTopComponent() + + /** + * getTopComponent + * @returns Component + */ + public Component getTopComponent() { + return null; // TODO + } // getTopComponent() + + /** + * setRightComponent + * @param value0 TODO + */ + public void setRightComponent(Component value0) { + // TODO + } // setRightComponent() + + /** + * getRightComponent + * @returns Component + */ + public Component getRightComponent() { + return null; // TODO + } // getRightComponent() + + /** + * setBottomComponent + * @param value0 TODO + */ + public void setBottomComponent(Component value0) { + // TODO + } // setBottomComponent() + + /** + * getBottomComponent + * @returns Component + */ + public Component getBottomComponent() { + return null; // TODO + } // getBottomComponent() + + /** + * setOneTouchExpandable + * @param value0 TODO + */ + public void setOneTouchExpandable(boolean value0) { + // TODO + } // setOneTouchExpandable() + + /** + * isOneTouchExpandable + * @returns boolean + */ + public boolean isOneTouchExpandable() { + return false; // TODO + } // isOneTouchExpandable() + + /** + * setLastDividerLocation + * @param value0 TODO + */ + public void setLastDividerLocation(int value0) { + // TODO + } // setLastDividerLocation() + + /** + * getLastDividerLocation + * @returns int + */ + public int getLastDividerLocation() { + return 0; // TODO + } // getLastDividerLocation() + + /** + * setOrientation + * @param value0 TODO + */ + public void setOrientation(int value0) { + // TODO + } // setOrientation() + + /** + * getOrientation + * @returns int + */ + public int getOrientation() { + return 0; // TODO + } // getOrientation() + + /** + * setContinuousLayout + * @param value0 TODO + */ + public void setContinuousLayout(boolean value0) { + // TODO + } // setContinuousLayout() + + /** + * isContinuousLayout + * @returns boolean + */ + public boolean isContinuousLayout() { + return false; // TODO + } // isContinuousLayout() + + /** + * setResizeWeight + * @param value0 TODO + */ + public void setResizeWeight(double value0) { + // TODO + } // setResizeWeight() + + /** + * getResizeWeight + * @returns double + */ + public double getResizeWeight() { + return 0.0; // TODO + } // getResizeWeight() + + /** + * resetToPreferredSizes + */ + public void resetToPreferredSizes() { + // TODO + } // resetToPreferredSizes() + + /** + * setDividerLocation + * @param value0 TODO + */ + public void setDividerLocation(double value0) { + // TODO + } // setDividerLocation() + + /** + * setDividerLocation + * @param value0 TODO + */ + public void setDividerLocation(int value0) { + // TODO + } // setDividerLocation() + + /** + * getDividerLocation + * @returns int + */ + public int getDividerLocation() { + return 0; // TODO + } // getDividerLocation() + + /** + * getMinimumDividerLocation + * @returns int + */ + public int getMinimumDividerLocation() { + return 0; // TODO + } // getMinimumDividerLocation() + + /** + * getMaximumDividerLocation + * @returns int + */ + public int getMaximumDividerLocation() { + return 0; // TODO + } // getMaximumDividerLocation() + + /** + * isValidateRoot + * @returns boolean + */ + public boolean isValidateRoot() { + return false; // TODO + } // isValidateRoot() + + /** + * addImpl + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + protected void addImpl(Component value0, Object value1, int value2) { + // TODO + } // addImpl() + + /** + * paintChildren + * @param value0 TODO + */ + protected void paintChildren(Graphics value0) { + // TODO + } // paintChildren() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJSplitPane(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JSplitPane diff --git a/libjava/javax/swing/JTabbedPane.java b/libjava/javax/swing/JTabbedPane.java new file mode 100644 index 00000000000..915ec93258f --- /dev/null +++ b/libjava/javax/swing/JTabbedPane.java @@ -0,0 +1,131 @@ +/* JTabbedPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.util.*; +import javax.swing.plaf.*; +import java.awt.*; + + +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; + +public class JTabbedPane extends JComponent +{ + class Tab + { + Icon icon; + String name, descr; + Component tab; + + Tab(String name, + Icon icon, + Component tab, + String descr) + { + this.name = name; + this.icon = icon; + this.tab = tab; + this.descr = descr; + } + } + + private Vector tabs = new Vector(); + + public JTabbedPane() + { + } + + public void addTab(String name, + Component panel) + { + addTab(name, null, panel, null); + } + public void addTab(String name, + Icon icon, + Component panel) + { + addTab(name, icon, panel, null); + } + public void addTab(String name, + Icon icon, + Component panel, + String descr) + { + tabs.addElement(new Tab(name, icon, panel, descr)); + } + + public int getTabCount() + { + return tabs.size(); + } + public Component getComponentAt(int i) + { + Tab t = (Tab) tabs.elementAt(i); + return t.tab; + } + + public String getUIClassID() + { return "JTabbedPane"; } + + + public void setUI(TabbedPaneUI ui) { + super.setUI(ui); + } + + public TabbedPaneUI getUI() { + return (TabbedPaneUI)ui; + } + + public void updateUI() + { + setUI((TabbedPaneUI)UIManager.getUI(this)); + } + + public AccessibleContext getAccessibleContext() + { + return null; + } + + protected String paramString() + { + return "JTabbedPane"; + } +} diff --git a/libjava/javax/swing/JTable.java b/libjava/javax/swing/JTable.java new file mode 100644 index 00000000000..a30ad360adc --- /dev/null +++ b/libjava/javax/swing/JTable.java @@ -0,0 +1,46 @@ +/* JTable.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; +/** + * STUBBED + */ +public class JTable extends JComponent +/*implements TableModelListener, Scrollable, TableColumnModelListener, + ListSelectionListener, CellEditorListener, Accessible*/ +{ +} // class JTable diff --git a/libjava/javax/swing/JTextField.java b/libjava/javax/swing/JTextField.java new file mode 100644 index 00000000000..806aa27dfb3 --- /dev/null +++ b/libjava/javax/swing/JTextField.java @@ -0,0 +1,106 @@ +/* JTextField.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.event.*; +import java.util.*; + +import javax.accessibility.*; + +public class JTextField extends JEditorPane +{ + + /** + * AccessibleJTextField + */ + protected class AccessibleJTextField extends AccessibleJTextComponent { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJTextField + * @param component TODO + */ + protected AccessibleJTextField(JTextField component) { + super(component); + // TODO + } // AccessibleJTextField() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + + } // AccessibleJTextField + + + Vector actions = new Vector(); + + public JTextField() + { + } + + public JTextField(int a) + { + } + + public void addActionListener(ActionListener l) + { + actions.addElement(l); + } + + public void removeActionListener(ActionListener l) + { + actions.removeElement(l); + } + + public void selectAll() + { + } +} diff --git a/libjava/javax/swing/JTextPane.java b/libjava/javax/swing/JTextPane.java new file mode 100644 index 00000000000..80e5a0e91c1 --- /dev/null +++ b/libjava/javax/swing/JTextPane.java @@ -0,0 +1,271 @@ +/* JTextPane.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; +import javax.swing.text.*; + +/** + * JTextPane + * @author Andrew Selkirk + * @version 1.0 + */ +public class JTextPane extends JEditorPane { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "TextPaneUI"; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JTextPane + */ + public JTextPane() { + // TODO + } // JTextPane() + + /** + * Constructor JTextPane + * @param document TODO + */ + public JTextPane(StyledDocument document) { + // TODO + } // JTextPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * setDocument + * @param document TODO + */ + public void setDocument(Document document) { + // TODO + } // setDocument() + + /** + * getStyledDocument + * @returns StyledDocument + */ + public StyledDocument getStyledDocument() { + return null; // TODO + } // getStyledDocument() + + /** + * setStyledDocument + * @param document TODO + */ + public void setStyledDocument(StyledDocument document) { + // TODO + } // setStyledDocument() + + /** + * replaceSelection + * @param content TODO + */ + public void replaceSelection(String content) { + // TODO + } // replaceSelection() + + /** + * insertComponent + * @param component TODO + */ + public void insertComponent(Component component) { + // TODO + } // insertComponent() + + /** + * insertIcon + * @param icon TODO + */ + public void insertIcon(Icon icon) { + // TODO + } // insertIcon() + + /** + * addStyle + * @param nm TODO + * @param parent TODO + * @returns Style + */ + public Style addStyle(String nm, Style parent) { + return null; // TODO + } // addStyle() + + /** + * removeStyle + * @param nm TODO + */ + public void removeStyle(String nm) { + // TODO + } // removeStyle() + + /** + * getStyle + * @param nm TODO + * @returns Style + */ + public Style getStyle(String nm) { + return null; // TODO + } // getStyle() + + /** + * getLogicalStyle + * @returns Style + */ + public Style getLogicalStyle() { + return null; // TODO + } // getLogicalStyle() + + /** + * setLogicalStyle + * @param style TODO + */ + public void setLogicalStyle(Style style) { + // TODO + } // setLogicalStyle() + + /** + * getCharacterAttributes + * @returns AttributeSet + */ + public AttributeSet getCharacterAttributes() { + return null; // TODO + } // getCharacterAttributes() + + /** + * setCharacterAttributes + * @param attribute TODO + * @param replace TODO + */ + public void setCharacterAttributes(AttributeSet attribute, + boolean replace) { + // TODO + } // setCharacterAttributes() + + /** + * getParagraphAttributes + * @returns AttributeSet + */ + public AttributeSet getParagraphAttributes() { + return null; // TODO + } // getParagraphAttributes() + + /** + * setParagraphAttributes + * @param attribute TODO + * @param replace TODO + */ + public void setParagraphAttributes(AttributeSet attribute, + boolean replace) { + // TODO + } // setParagraphAttributes() + + /** + * getInputAttributes + * @returns MutableAttributeSet + */ + public MutableAttributeSet getInputAttributes() { + return null; // TODO + } // getInputAttributes() + + /** + * getStyledEditorKit + * @returns StyledEditorKit + */ + protected final StyledEditorKit getStyledEditorKit() { + return null; // TODO + } // getStyledEditorKit() + + /** + * createDefaultEditorKit + * @returns EditorKit + */ + protected EditorKit createDefaultEditorKit() { + return null; // TODO + } // createDefaultEditorKit() + + /** + * setEditorKit + * @param editor TODO + */ + public final void setEditorKit(EditorKit editor) { + // TODO + } // setEditorKit() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + +} // JTextPane diff --git a/libjava/javax/swing/JToggleButton.java b/libjava/javax/swing/JToggleButton.java new file mode 100644 index 00000000000..d0e90cb59c8 --- /dev/null +++ b/libjava/javax/swing/JToggleButton.java @@ -0,0 +1,110 @@ +/* JToggleButton.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.plaf.*; +import javax.accessibility.*; + +public class JToggleButton extends AbstractButton +{ + public JToggleButton() + { + this(null, null); + } + public JToggleButton(Action a) + { + this(); + setAction(a); + } + + public JToggleButton(Icon icon) + { + this(null, icon); + } + + public JToggleButton(String text) + { + this(text, null); + } + + public JToggleButton(String text, Icon icon) + { + this(text, icon, false); + } + + public JToggleButton (String text, Icon icon, boolean selected) + { + super(text, icon); + + // Create the model + setModel(new ToggleButtonModel(this)); + + model.setSelected(selected); + } + + + + public AccessibleContext getAccessibleContext() + { + //Gets the AccessibleContext associated with this JToggleButton. + return null; + } + + public String getUIClassID() + { + //Returns a string that specifies the name of the L&F class that renders this component. + return "JToggleButton"; + } + + protected String paramString() + { + return "JToggleButton"; + } + + + public void updateUI() + { + ButtonUI b = (ButtonUI)UIManager.getUI(this); + setUI(b); + } +} + + + diff --git a/libjava/javax/swing/JToolBar.java b/libjava/javax/swing/JToolBar.java new file mode 100644 index 00000000000..f5b18d900ac --- /dev/null +++ b/libjava/javax/swing/JToolBar.java @@ -0,0 +1,466 @@ +/* JToolBar.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.beans.*; +import java.io.*; +import javax.accessibility.*; +import javax.swing.plaf.*; + +/** + * JToolBar + * @author Andrew Selkirk + * @version 1.0 + */ +public class JToolBar extends JComponent + implements SwingConstants, Accessible { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * AccessibleJToolBar + */ + protected class AccessibleJToolBar extends AccessibleJComponent { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJToolBar + * @param component TODO + */ + protected AccessibleJToolBar(JToolBar component) { + super(component); + // TODO + } // AccessibleJToolBar() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return AccessibleRole.TOOL_BAR; + } // getAccessibleRole() + + + } // AccessibleJToolBar + + /** + * Separator + */ + public static class Separator extends JSeparator { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * separatorSize + */ + private Dimension size; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor Separator + */ + public Separator() { + // TODO + } // Separator() + + /** + * Constructor Separator + * @param size TODO + */ + public Separator(Dimension size) { + // TODO + } // Separator() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return null; // TODO + } // getUIClassID() + + /** + * getPreferredSize + * @returns Dimension + */ + public Dimension getPreferredSize() { + return null; // TODO + } // getPreferredSize() + + /** + * getMaximumSize + * @returns Dimension + */ + public Dimension getMaximumSize() { + return null; // TODO + } // getMaximumSize() + + /** + * getMinimumSize + * @returns Dimension + */ + public Dimension getMinimumSize() { + return null; // TODO + } // getMinimumSize() + + /** + * getSeparatorSize + * @returns Dimension + */ + public Dimension getSeparatorSize() { + return null; // TODO + } // getSeparatorSize() + + /** + * setSeparatorSize + * @param size TODO + */ + public void setSeparatorSize(Dimension size) { + // TODO + } // setSeparatorSize() + + + } // Separator + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * uiClassID + */ + private static final String uiClassID = "ToolBarUI"; + + /** + * paintBorder + */ + private boolean paintBorder; + + /** + * margin + */ + private Insets margin; + + /** + * floatable + */ + private boolean floatable; + + /** + * orientation + */ + private int orientation; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor JToolBar + */ + public JToolBar() { + // TODO + } // JToolBar() + + /** + * Constructor JToolBar + * @param orientation TODO + */ + public JToolBar(int orientation) { + // TODO + } // JToolBar() + + /** + * Constructor JToolBar + * @param name TODO + */ + public JToolBar(String name) { + // TODO + } // JToolBar() + + /** + * Constructor JToolBar + * @param name TODO + * @param orientation TODO + */ + public JToolBar(String name, int orientation) { + // TODO + } // JToolBar() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * add + * @param action TODO + * @returns JButton + */ + public JButton add(Action action) { + return null; // TODO + } // add() + + /** + * paintBorder + * @param graphics TODO + */ + protected void paintBorder(Graphics graphics) { + // TODO + } // paintBorder() + + /** + * getUI + * @returns ToolBarUI + */ + public ToolBarUI getUI() { + return (ToolBarUI) ui; + } // getUI() + + /** + * setUI + * @param ui TODO + */ + public void setUI(ToolBarUI ui) { + super.setUI(ui); + } // setUI() + + /** + * updateUI + */ + public void updateUI() { + setUI((ToolBarUI) UIManager.get(this)); + invalidate(); + } // updateUI() + + /** + * getUIClassID + * @returns String + */ + public String getUIClassID() { + return uiClassID; + } // getUIClassID() + + /** + * getComponentIndex + * @param component TODO + * @returns int + */ + public int getComponentIndex(Component component) { + return 0; // TODO + } // getComponentIndex() + + /** + * getComponentAtIndex + * @param index TODO + * @returns Component + */ + public Component getComponentAtIndex(int index) { + return null; // TODO + } // getComponentAtIndex() + + /** + * getMargin + * @returns Insets + */ + public Insets getMargin() { + return null; // TODO + } // getMargin() + + /** + * setMargin + * @param margin TODO + */ + public void setMargin(Insets margin) { + // TODO + } // setMargin() + + /** + * isBorderPainted + * @returns boolean + */ + public boolean isBorderPainted() { + return false; // TODO + } // isBorderPainted() + + /** + * setBorderPainted + * @param painted TODO + */ + public void setBorderPainted(boolean painted) { + // TODO + } // setBorderPainted() + + /** + * isFloatable + * @returns boolean + */ + public boolean isFloatable() { + return false; // TODO + } // isFloatable() + + /** + * setFloatable + * @param floatable TODO + */ + public void setFloatable(boolean floatable) { + // TODO + } // setFloatable() + + /** + * getOrientation + * @returns int + */ + public int getOrientation() { + return 0; // TODO + } // getOrientation() + + /** + * setOrientation + * @param orientation TODO + */ + public void setOrientation(int orientation) { + // TODO + } // setOrientation() + + /** + * addSeparator + */ + public void addSeparator() { + // TODO + } // addSeparator() + + /** + * addSeparator + * @param size TODO + */ + public void addSeparator(Dimension size) { + // TODO + } // addSeparator() + + /** + * createActionComponent + * @param action TODO + * @returns JButton + */ + protected JButton createActionComponent(Action action) { + return null; // TODO + } // createActionComponent() + + /** + * createActionChangeListener + * @param button TODO + * @returns PropertyChangeListener + */ + protected PropertyChangeListener createActionChangeListener(JButton button) { + return null; // TODO + } // createActionChangeListener() + + /** + * addImpl + * @param component TODO + * @param constraints TODO + * @param index TODO + */ + protected void addImpl(Component component, Object constraints, int index) { + // TODO + } // addImpl() + + /** + * paramString + * @returns String + */ + protected String paramString() { + return null; // TODO + } // paramString() + + /** + * getAccessibleContext + * @returns AccessibleContext + */ + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJToolBar(this); + } // if + return accessibleContext; + } // getAccessibleContext() + + +} // JToolBar diff --git a/libjava/javax/swing/JToolTip.java b/libjava/javax/swing/JToolTip.java new file mode 100644 index 00000000000..d245df99fe4 --- /dev/null +++ b/libjava/javax/swing/JToolTip.java @@ -0,0 +1,53 @@ +/* JToolTip.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + + +public class JToolTip extends JComponent +{ + String text; + + JToolTip(String text) + { + this.text = text; + } +} + + diff --git a/libjava/javax/swing/JTree.java b/libjava/javax/swing/JTree.java new file mode 100644 index 00000000000..f474c2f69ac --- /dev/null +++ b/libjava/javax/swing/JTree.java @@ -0,0 +1,109 @@ +/* JTree.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import javax.swing.plaf.*; +import javax.accessibility.*; + +public class JTree extends JComponent implements Scrollable, Accessible +{ + JTree() + { + updateUI(); + } + + public TreeUI getUI() + { + return (TreeUI) ui; + } + + public void setUI(TreeUI ui) + { + super.setUI(ui); + } + + public void updateUI() + { + setUI((TreeUI)UIManager.getUI(this)); + } + + + public String getUIClassID() + { + return "JTree"; + } + + + public AccessibleContext getAccessibleContext() + { + return null; + } + + public Dimension getPreferredScrollableViewportSize() + { + return null; + } + + public int getScrollableUnitIncrement(Rectangle visibleRect, + int orientation, + int direction) + { + return 1; + } + + public int getScrollableBlockIncrement(Rectangle visibleRect, + int orientation, + int direction) + { + return 1; + } + + public boolean getScrollableTracksViewportWidth() + { + return false; + } + + public boolean getScrollableTracksViewportHeight() + { + return false; + } +} + + + diff --git a/libjava/javax/swing/JViewport.java b/libjava/javax/swing/JViewport.java new file mode 100644 index 00000000000..c4a8df6e15c --- /dev/null +++ b/libjava/javax/swing/JViewport.java @@ -0,0 +1,136 @@ +/* JViewport.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import javax.swing.plaf.*; +import java.awt.*; + + +public class JViewport extends JComponent +{ + Component c; + + JViewport() + { + setOpaque(true); + updateUI(); + } + + void setView(Component c) + { + if (this.c != null) + remove(c); + + this.c = c; + + add(c); + } + + public String getUIClassID() + { + return "JViewport"; + } + + public void updateUI() + { + ViewportUI vp = (ViewportUI) UIManager.getUI(this); + setUI(vp); + } + + Container GetHeavy(Container parent) + { + if (parent == null) + return null; + + while (isLightweightComponent(parent)) + { + Container p = parent.getParent(); + + if (p == null) + { + System.out.println("GetHeavy FAILED, no heavy weight component found"); + return parent; + } + + parent = p; + } + return parent; + } + + + public void paint(Graphics g) + { + paintChildren(g); + + System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXX JViewport -----> paint()"); + + Container parent = GetHeavy(getParent()); + + System.out.println("parent = " + parent + ", " + getParent()); + + //parent.paint(); + + Graphics wg = parent.getGraphics(); + + int x = 0; + int y = 0; + int w = getWidth(); + int h = getHeight(); + + Rectangle r = new Rectangle(x, y, w, h); + + int ox = 0; + int oy = 0; + + wg.copyArea(r.x, + r.y, + r.width, + r.height, + ox, + oy); + + wg.dispose(); + } +} + + + + + + + diff --git a/libjava/javax/swing/JWindow.java b/libjava/javax/swing/JWindow.java new file mode 100644 index 00000000000..c74e33870c0 --- /dev/null +++ b/libjava/javax/swing/JWindow.java @@ -0,0 +1,230 @@ +/* JWindow.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; +import java.awt.event.*; +import javax.accessibility.*; + +/** + * Unlike JComponent derivatives, JWindow inherits from + * java.awt.Window. But also lets a look-and-feel component to its work. + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class JWindow extends Window implements Accessible +{ + public final static int HIDE_ON_CLOSE = 0; + public final static int EXIT_ON_CLOSE = 1; + public final static int DISPOSE_ON_CLOSE = 2; + public final static int DO_NOTHING_ON_CLOSE = 3; + + protected AccessibleContext accessibleContext; + + private int close_action = EXIT_ON_CLOSE; + + + /*************************************************** + * + * + * constructors + * + * + *************/ + + // huuu ? + public JWindow(Frame f) + { + super(f); + } + + /*************************************************** + * + * + * methods, this part is shared with JDialog, JFrame + * + * + *************/ + + + private boolean checking; + protected JRootPane rootPane; + + + protected void frameInit() + { + super.setLayout(new BorderLayout(1, 1)); + getRootPane(); // will do set/create + } + + public Dimension getPreferredSize() + { + Dimension d = super.getPreferredSize(); + return d; + } + + JMenuBar getJMenuBar() + { return getRootPane().getJMenuBar(); } + + void setJMenuBar(JMenuBar menubar) + { getRootPane().setJMenuBar(menubar); } + + + public void setLayout(LayoutManager manager) + { super.setLayout(manager); } + + void setLayeredPane(JLayeredPane layeredPane) + { getRootPane().setLayeredPane(layeredPane); } + + JLayeredPane getLayeredPane() + { return getRootPane().getLayeredPane(); } + + JRootPane getRootPane() + { + if (rootPane == null) + setRootPane(createRootPane()); + return rootPane; + } + + void setRootPane(JRootPane root) + { + if (rootPane != null) + remove(rootPane); + + rootPane = root; + add(rootPane, BorderLayout.CENTER); + } + + JRootPane createRootPane() + { return new JRootPane(); } + + Container getContentPane() + { return getRootPane().getContentPane(); } + + void setContentPane(Container contentPane) + { getRootPane().setContentPane(contentPane); } + + Component getGlassPane() + { return getRootPane().getGlassPane(); } + + void setGlassPane(Component glassPane) + { getRootPane().setGlassPane(glassPane); } + + + protected void addImpl(Component comp, Object constraints, int index) + { super.addImpl(comp, constraints, index); } + + + public void remove(Component comp) + { getContentPane().remove(comp); } + + protected boolean isRootPaneCheckingEnabled() + { return checking; } + + + protected void setRootPaneCheckingEnabled(boolean enabled) + { checking = enabled; } + + + public void update(Graphics g) + { paint(g); } + + protected void processKeyEvent(KeyEvent e) + { super.processKeyEvent(e); } + + ///////////////////////////////////////////////////////////////////////////////// + + public AccessibleContext getAccessibleContext() + { return null; } + + int getDefaultCloseOperation() + { return close_action; } + + protected String paramString() + { return "JWindow"; } + + + protected void processWindowEvent(WindowEvent e) + { + // System.out.println("PROCESS_WIN_EV-1: " + e); + super.processWindowEvent(e); + // System.out.println("PROCESS_WIN_EV-2: " + e); + switch (e.getID()) + { + case WindowEvent.WINDOW_CLOSING: + { + switch(close_action) + { + case EXIT_ON_CLOSE: + { + System.out.println("user requested exit on close"); + System.exit(1); + break; + } + case DISPOSE_ON_CLOSE: + { + System.out.println("user requested dispose on close"); + dispose(); + break; + } + case HIDE_ON_CLOSE: + { + setVisible(false); + break; + } + case DO_NOTHING_ON_CLOSE: + break; + } + break; + } + + case WindowEvent.WINDOW_CLOSED: + case WindowEvent.WINDOW_OPENED: + case WindowEvent.WINDOW_ICONIFIED: + case WindowEvent.WINDOW_DEICONIFIED: + case WindowEvent.WINDOW_ACTIVATED: + case WindowEvent.WINDOW_DEACTIVATED: + break; + } + } + + + void setDefaultCloseOperation(int operation) + { close_action = operation; } + +} diff --git a/libjava/javax/swing/KeyStroke.java b/libjava/javax/swing/KeyStroke.java new file mode 100644 index 00000000000..b2687cdc18c --- /dev/null +++ b/libjava/javax/swing/KeyStroke.java @@ -0,0 +1,269 @@ +/* KeyStroke.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.event.*; +import java.io.*; + +/** + * KeyStroke + * @author Andrew Selkirk + * @version 1.0 + */ +public class KeyStroke implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * keyChar + */ + private char keyChar = 0; + + /** + * keyCode + */ + private int keyCode = 0; + + /** + * modifiers + */ + private int modifiers = 0; + + /** + * onKeyRelease + */ + private boolean onKeyRelease = false; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor KeyStroke + */ + private KeyStroke() { + } // KeyStroke() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * hashCode + * @returns int + */ + public int hashCode() { + return 0; // TODO + } // hashCode() + + /** + * equals + * @param object TODO + * @returns boolean + */ + public boolean equals(Object object) { + + // Variables + KeyStroke key; + + if (object instanceof KeyStroke) { + key = (KeyStroke) object; + if (key.keyChar == keyChar && + key.keyCode == keyCode && + key.modifiers == modifiers && + key.onKeyRelease == onKeyRelease) { + return true; + } // if + } // if + return false; + + } // equals() + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * getKeyStroke + * @param keyChar TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStroke(char keyChar) { + + // Variables + KeyStroke key; + + key = new KeyStroke(); + key.keyChar = keyChar; + return key; + + } // getKeyStroke() + + /** + * getKeyStroke - deprecated + * @param keyChar TODO + * @param onKeyRelease TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStroke(char keyChar, boolean onKeyRelease) { + KeyStroke key = getKeyStroke(keyChar); + key.onKeyRelease = onKeyRelease; + return key; + } // getKeyStroke() + + /** + * getKeyStroke + * @param keyChar TODO + * @param modifiers TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStroke(Character keyChar, int modifiers) { + KeyStroke key = getKeyStroke(keyChar.charValue()); + key.modifiers = modifiers; + return key; + } // getKeyStroke() + + /** + * getKeyStroke + * @param keyCode TODO + * @param modifiers TODO + * @param onKeyRelease TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStroke(int keyCode, int modifiers, + boolean onKeyRelease) { + + // Variables + KeyStroke key; + + key = new KeyStroke(); + key.keyCode = keyCode; + key.modifiers = modifiers; + key.onKeyRelease = onKeyRelease; + return key; + + } // getKeyStroke() + + /** + * getKeyStroke + * @param keyCode TODO + * @param modifiers TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStroke(int keyCode, int modifiers) { + return getKeyStroke(keyCode, modifiers, false); + } // getKeyStroke() + + /** + * getKeyStroke + * @param string TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStroke(String string) { + return null; // TODO + } // getKeyStroke() + + /** + * getKeyStrokeForEvent + * @param event TODO + * @returns KeyStroke + */ + public static KeyStroke getKeyStrokeForEvent(KeyEvent event) { + + // Variables + int eventID; + int eventMod; + + // Get Event ID + eventID = event.getID(); + eventMod = event.getModifiers(); + + // Check for KEY_TYPED event + if (eventID == KeyEvent.KEY_TYPED) { + return getKeyStroke(event.getKeyChar(), eventMod); + + // KEY_PRESSED or KEY_RELEASED event + } else { + return getKeyStroke(event.getKeyCode(), eventMod); + } // if + + } // getKeyStrokeForEvent() + + /** + * getKeyChar + * @returns char + */ + public char getKeyChar() { + return keyChar; + } // getKeyChar() + + /** + * getKeyCode + * @returns int + */ + public int getKeyCode() { + return keyCode; + } // getKeyCode() + + /** + * getModifiers + * @returns int + */ + public int getModifiers() { + return modifiers; // TODO + } // getModifiers() + + /** + * isOnKeyRelease + * @returns boolean + */ + public boolean isOnKeyRelease() { + return onKeyRelease; + } // isOnKeyRelease() + + +} // KeyStroke diff --git a/libjava/javax/swing/ListCellRenderer.java b/libjava/javax/swing/ListCellRenderer.java new file mode 100644 index 00000000000..20cb97ef9c4 --- /dev/null +++ b/libjava/javax/swing/ListCellRenderer.java @@ -0,0 +1,49 @@ +/* ListCellRenderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + +public interface ListCellRenderer +{ + public Component getListCellRendererComponent(JList list, + Object value, + int index, + boolean isSelected, + boolean cellHasFocus); +} diff --git a/libjava/javax/swing/ListModel.java b/libjava/javax/swing/ListModel.java new file mode 100644 index 00000000000..02710272c86 --- /dev/null +++ b/libjava/javax/swing/ListModel.java @@ -0,0 +1,48 @@ +/* ListModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import javax.swing.event.*; + +public interface ListModel +{ + int getSize(); + Object getElementAt(int index); + void addListDataListener(ListDataListener l); + void removeListDataListener(ListDataListener l); +} diff --git a/libjava/javax/swing/ListSelectionModel.java b/libjava/javax/swing/ListSelectionModel.java new file mode 100644 index 00000000000..e4b985b93e0 --- /dev/null +++ b/libjava/javax/swing/ListSelectionModel.java @@ -0,0 +1,65 @@ +/* ListSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +import javax.swing.event.*; + +public interface ListSelectionModel +{ + final static int SINGLE_SELECTION = 0; + final static int SINGLE_INTERVAL_SELECTION = 1; + final static int MULTIPLE_INTERVAL_SELECTION = 1; + + void setSelectionMode(int a); + int getSelectionMode(); + + void clearSelection(); + + int getMinSelectionIndex(); + int getMaxSelectionIndex(); + boolean isSelectedIndex(int a); + + void setSelectionInterval(int index0, int index1); + + + + void addListSelectionListener(ListSelectionListener listener); + void removeListSelectionListener(ListSelectionListener listener); + +} diff --git a/libjava/javax/swing/LookAndFeel.java b/libjava/javax/swing/LookAndFeel.java new file mode 100644 index 00000000000..cd9d201dce6 --- /dev/null +++ b/libjava/javax/swing/LookAndFeel.java @@ -0,0 +1,125 @@ +/* LookAndFeel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import javax.swing.text.*; + +public abstract class LookAndFeel +{ + public UIDefaults getDefaults() + { + //This method is called once by UIManager.setLookAndFeel to create the look and feel specific defaults table. + return null; + } + + public abstract String getDescription(); + public abstract String getID(); + public abstract String getName(); + + public void initialize() + { + //UIManager.setLookAndFeel calls this method before the first call (and typically the only call) to getDefaults(). + } + + static void installBorder(JComponent c, String defaultBorderName) + { + //Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource. + } + + public static void installColors(JComponent c, String defaultBgName, String defaultFgName) + { + //Convenience method for initializing a component's foreground and background color properties with values from the current defaults table. + } + + public static void installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName) + { + //Convenience method for initializing a components foreground background and font properties with values from the current defaults table. + } + + public abstract boolean isNativeLookAndFeel(); + public abstract boolean isSupportedLookAndFeel(); + + public static void loadKeyBindings(InputMap retMap, Object[] keys) + { + //Loads the bindings in keys into retMap. + } + + public static ComponentInputMap makeComponentInputMap(JComponent c, Object[] keys) + { + // Creates a ComponentInputMap from keys. + return null; + } + + public static Object makeIcon(Class baseClass, String gifFile) + { + //Utility method that creates a UIDefaults.LazyValue that creates an ImageIcon UIResource for the specified gifFile filename. + return null; + } + + public static InputMap makeInputMap(Object[] keys) + { + //Creates a InputMap from keys. + return null; + } + + public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList) + { + // Convenience method for building lists of KeyBindings. + return null; + } + + + public String toString() + { + //Returns a string that displays and identifies this object's properties. + return "LookAndFeel"; + } + + public void uninitialize() + { + //UIManager.setLookAndFeel calls this method just before we're replaced by a new default look and feel. + } + + + public static void uninstallBorder(JComponent c) + { + //Convenience method for un-installing a component's default border on the specified component if the border is currently an instance of UIResource. + } + +} + diff --git a/libjava/javax/swing/MenuElement.java b/libjava/javax/swing/MenuElement.java new file mode 100644 index 00000000000..24fd6e0cd07 --- /dev/null +++ b/libjava/javax/swing/MenuElement.java @@ -0,0 +1,92 @@ +/* MenuElement.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; + +/** + * MenuElement + * @author Andrew Selkirk + * @version 1.0 + */ +public interface MenuElement { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * processMouseEvent + * @param event TODO + * @param path TODO + * @param manager TODO + */ + public void processMouseEvent(MouseEvent event, + MenuElement[] path, MenuSelectionManager manager); + + /** + * processKeyEvent + * @param event TODO + * @param path TODO + * @param manager TODO + */ + public abstract void processKeyEvent(KeyEvent event, + MenuElement[] path, MenuSelectionManager manager); + + /** + * menuSelectionChanged + * @param included TODO + */ + public abstract void menuSelectionChanged(boolean included); + + /** + * getSubElements + * @returns MenuElement[] + */ + public abstract MenuElement[] getSubElements(); + + /** + * getComponent + * @returns Component + */ + public abstract Component getComponent(); + + +} // MenuElement diff --git a/libjava/javax/swing/MenuSelectionManager.java b/libjava/javax/swing/MenuSelectionManager.java new file mode 100644 index 00000000000..4d635c0e81c --- /dev/null +++ b/libjava/javax/swing/MenuSelectionManager.java @@ -0,0 +1,44 @@ +/* MenuSelectionManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; +/** + * STUBBED + */ +public class MenuSelectionManager +{ +} // class MenuSelectionManager diff --git a/libjava/javax/swing/MutableComboBoxModel.java b/libjava/javax/swing/MutableComboBoxModel.java new file mode 100644 index 00000000000..f722e9c9247 --- /dev/null +++ b/libjava/javax/swing/MutableComboBoxModel.java @@ -0,0 +1,77 @@ +/* MutableComboBoxModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * MutableComboBoxModel + * @author Andrew Selkirk + * @version 1.0 + */ +public interface MutableComboBoxModel extends ComboBoxModel { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addElement + * @param object TODO + */ + public void addElement(Object object); + + /** + * removeElementAt + * @param index TODO + */ + public void removeElementAt(int index); + + /** + * insertElementAt + * @param object TODO + * @param index TODO + */ + public void insertElementAt(Object object, int index); + + /** + * removeElement + * @param object TODO + */ + public void removeElement(Object object); + + +} // MutableComboBoxModel diff --git a/libjava/javax/swing/OverlayLayout.java b/libjava/javax/swing/OverlayLayout.java new file mode 100644 index 00000000000..a238a436a47 --- /dev/null +++ b/libjava/javax/swing/OverlayLayout.java @@ -0,0 +1,186 @@ +/* OverlayLayout.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; + +/** + * OverlayLayout + * @author Andrew Selkirk + * @version 1.0 + */ +public class OverlayLayout implements LayoutManager2, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * target + */ + private Container target; + + /** + * xChildren + */ + private SizeRequirements[] xChildren; + + /** + * yChildren + */ + private SizeRequirements[] yChildren; + + /** + * xTotal + */ + private SizeRequirements xTotal; + + /** + * yTotal + */ + private SizeRequirements yTotal; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor OverlayLayout + * @param target TODO + */ + public OverlayLayout(Container target) { + // TODO + } // OverlayLayout() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * invalidateLayout + * @param target TODO + */ + public void invalidateLayout(Container target) { + // TODO + } // invalidateLayout() + + /** + * addLayoutComponent + * @param string TODO + * @param component TODO + */ + public void addLayoutComponent(String string, Component component) { + // TODO + } // addLayoutComponent() + + /** + * addLayoutComponent + * @param component TODO + * @param constraints TODO + */ + public void addLayoutComponent(Component component, Object constraints) { + // TODO + } // addLayoutComponent() + + /** + * removeLayoutComponent + * @param component TODO + */ + public void removeLayoutComponent(Component component) { + // TODO + } // removeLayoutComponent() + + /** + * preferredLayoutSize + * @param target TODO + * @returns Dimension + */ + public Dimension preferredLayoutSize(Container target) { + return null; // TODO + } // preferredLayoutSize() + + /** + * minimumLayoutSize + * @param target TODO + * @returns Dimension + */ + public Dimension minimumLayoutSize(Container target) { + return null; // TODO + } // minimumLayoutSize() + + /** + * maximumLayoutSize + * @param target TODO + * @returns Dimension + */ + public Dimension maximumLayoutSize(Container target) { + return null; // TODO + } // maximumLayoutSize() + + /** + * getLayoutAlignmentX + * @param target TODO + * @returns float + */ + public float getLayoutAlignmentX(Container target) { + return (float) 0.0; // TODO + } // getLayoutAlignmentX() + + /** + * getLayoutAlignmentY + * @param target TODO + * @returns float + */ + public float getLayoutAlignmentY(Container target) { + return (float) 0.0; // TODO + } // getLayoutAlignmentY() + + /** + * layoutContainer + * @param target TODO + */ + public void layoutContainer(Container target) { + // TODO + } // layoutContainer() + + +} // OverlayLayout diff --git a/libjava/javax/swing/ProgressMonitor.java b/libjava/javax/swing/ProgressMonitor.java new file mode 100644 index 00000000000..c3e01b5c018 --- /dev/null +++ b/libjava/javax/swing/ProgressMonitor.java @@ -0,0 +1,229 @@ +/* ProgressMonitor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; + +/** + * ProgressMonitor + * @author Andrew Selkirk + * @version 1.0 + */ +public class ProgressMonitor { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * parentComponent + */ + private Component component; + + /** + * note + */ + private String note; + + /** + * message + */ + private Object message; + + /** + * millisToDecideToPopup + */ + private int millisToDecideToPopup; + + /** + * millisToPopup + */ + private int millisToPopup; + + /** + * min + */ + private int minimum; + + /** + * max + */ + private int maximum; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ProgressMonitor + * @param component TODO + * @param message TODO + * @param note TODO + * @param minimum TODO + * @param maximum TODO + */ + public ProgressMonitor(Component component, Object message, + String note, int minimum, int maximum) { + + // Set Data + this.component = component; + this.message = message; + this.note = note; + this.minimum = minimum; + this.maximum = maximum; + + // TODO + } // ProgressMonitor() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * close + */ + public void close() { + // TODO + } // close() + + /** + * setProgress + * @param progress TODO + */ + public void setProgress(int progress) { + // TODO + } // setProgress() + + /** + * getMinimum + * @returns int + */ + public int getMinimum() { + return minimum; // TODO + } // getMinimum() + + /** + * setMinimum + * @param minimum TODO + */ + public void setMinimum(int minimum) { + this.minimum = minimum; + // TODO + } // setMinimum() + + /** + * getMaximum + * @returns int + */ + public int getMaximum() { + return maximum; // TODO + } // getMaximum() + + /** + * setMaximum + * @param maximum TODO + */ + public void setMaximum(int maximum) { + this.maximum = maximum; + // TODO + } // setMaximum() + + /** + * isCanceled + * @returns boolean + */ + public boolean isCanceled() { + return false; // TODO + } // isCanceled() + + /** + * getMillisToDecideToPopup + * @returns int + */ + public int getMillisToDecideToPopup() { + return millisToDecideToPopup; // TODO + } // getMillisToDecideToPopup() + + /** + * setMillisToDecideToPopup + * @param time TODO + */ + public void setMillisToDecideToPopup(int time) { + millisToDecideToPopup = time; + // TODO + } // setMillisToDecideToPopup() + + /** + * getMillisToPopup + * @returns int + */ + public int getMillisToPopup() { + return millisToPopup; // TODO + } // getMillisToPopup() + + /** + * setMillisToPopup + * @param time TODO + */ + public void setMillisToPopup(int time) { + millisToPopup = time; + // TODO + } // setMillisToPopup() + + /** + * getNote + * @returns String + */ + public String getNote() { + return note; // TODO + } // getNote() + + /** + * setNote + * @param note TODO + */ + public void setNote(String note) { + this.note = note; + // TODO + } // setNote() + + +} // ProgressMonitor diff --git a/libjava/javax/swing/ProgressMonitorInputStream.java b/libjava/javax/swing/ProgressMonitorInputStream.java new file mode 100644 index 00000000000..46a36f5bb97 --- /dev/null +++ b/libjava/javax/swing/ProgressMonitorInputStream.java @@ -0,0 +1,158 @@ +/* ProgressMonitorInputStream.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; + +/** + * ProgressMonitorInputStream + * @author Andrew Selkirk + * @version 1.0 + */ +public class ProgressMonitorInputStream extends FilterInputStream { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * monitor + */ + private ProgressMonitor monitor; + + /** + * nread + */ + private int nread; + + /** + * size + */ + private int size; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ProgressMonitorInputStream + * @param component TODO + * @param message TODO + * @param stream TODO + */ + public ProgressMonitorInputStream(Component component, Object message, + InputStream stream) { + super(stream); + // TODO + } // ProgressMonitorInputStream() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * reset + * @exception IOException TODO + */ + public synchronized void reset() throws IOException { + // TODO + } // reset() + + /** + * read + * @exception IOException TODO + * @returns int + */ + public int read() throws IOException { + return 0; // TODO + } // read() + + /** + * read + * @param data TODO + * @exception IOException TODO + * @returns int + */ + public int read(byte[] data) throws IOException { + return 0; // TODO + } // read() + + /** + * read + * @param data TODO + * @param offset TODO + * @param length TODO + * @exception IOException TODO + * @returns int + */ + public int read(byte[] data, int offset, int length) throws IOException { + return 0; // TODO + } // read() + + /** + * skip + * @param length TODO + * @exception IOException TODO + * @returns long + */ + public long skip(long length) throws IOException { + return 0; // TODO + } // skip() + + /** + * close + * @exception IOException TODO + */ + public void close() throws IOException { + // TODO + } // close() + + /** + * getProgressMonitor + * @returns ProgressMonitor + */ + public ProgressMonitor getProgressMonitor() { + return null; // TODO + } // getProgressMonitor() + + +} // ProgressMonitorInputStream diff --git a/libjava/javax/swing/Renderer.java b/libjava/javax/swing/Renderer.java new file mode 100644 index 00000000000..1c667798e52 --- /dev/null +++ b/libjava/javax/swing/Renderer.java @@ -0,0 +1,68 @@ +/* Renderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; + +/** + * Renderer + * @author Andrew Selkirk + * @version 1.0 + */ +public interface Renderer { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setValue + * @param value TODO + * @param selected TODO + */ + public void setValue(Object value, boolean selected); + + /** + * getComponent + * @returns Component + */ + public Component getComponent(); + + +} // Renderer diff --git a/libjava/javax/swing/RepaintManager.java b/libjava/javax/swing/RepaintManager.java new file mode 100644 index 00000000000..cce32b5a018 --- /dev/null +++ b/libjava/javax/swing/RepaintManager.java @@ -0,0 +1,278 @@ +/* RepaintManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.util.*; + +/** + * RepaintManager + * @author Andrew Selkirk + * @version 1.0 + */ +public class RepaintManager { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * dirtyComponents + */ + Hashtable dirtyComponents; + + /** + * tmpDirtyComponents + */ + Hashtable tmpDirtyComponents; + + /** + * invalidComponents + */ + Vector invalidComponents; + + /** + * doubleBufferingEnabled + */ + boolean doubleBufferingEnabled; + + /** + * doubleBuffer + */ + Image doubleBuffer; + + /** + * doubleBufferSize + */ + Dimension doubleBufferSize; + + /** + * doubleBufferMaxSize + */ + private Dimension doubleBufferMaxSize; + + /** + * resetDoubleBuffer + */ + private boolean resetDoubleBuffer; + + /** + * repaintManagerKey + */ + private static final Object repaintManagerKey = null; // TODO + + /** + * tmp + */ + Rectangle tmp; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor RepaintManager + */ + public RepaintManager() { + // TODO + } // RepaintManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public synchronized String toString() { + return null; // TODO + } // toString() + + /** + * currentManager + * @param component TODO + * @returns RepaintManager + */ + public static RepaintManager currentManager(Component component) { + return null; // TODO + } // currentManager() + + /** + * currentManager + * @param component TODO + * @returns RepaintManager + */ + public static RepaintManager currentManager(JComponent component) { + return null; // TODO + } // currentManager() + + /** + * setCurrentManager + * @param manager TODO + */ + public static void setCurrentManager(RepaintManager manager) { + // TODO + } // setCurrentManager() + + /** + * addInvalidComponent + * @param component TODO + */ + public synchronized void addInvalidComponent(JComponent component) { + // TODO + } // addInvalidComponent() + + /** + * removeInvalidComponent + * @param component TODO + */ + public synchronized void removeInvalidComponent(JComponent component) { + // TODO + } // removeInvalidComponent() + + /** + * addDirtyRegion + * @param component TODO + * @param x TODO + * @param y TODO + * @param w TODO + * @param h TODO + */ + public synchronized void addDirtyRegion(JComponent component, int x, + int y, int w, int h) { + // TODO + } // addDirtyRegion() + + /** + * getDirtyRegion + * @param component TODO + * @returns Rectangle + */ + public Rectangle getDirtyRegion(JComponent component) { + return null; // TODO + } // getDirtyRegion() + + /** + * markCompletelyDirty + * @param component TODO + */ + public void markCompletelyDirty(JComponent component) { + // TODO + } // markCompletelyDirty() + + /** + * markCompletelyClean + * @param component TODO + */ + public void markCompletelyClean(JComponent component) { + // TODO + } // markCompletelyClean() + + /** + * isCompletelyDirty + * @param component TODO + * @returns boolean + */ + public boolean isCompletelyDirty(JComponent component) { + return false; // TODO + } // isCompletelyDirty() + + /** + * validateInvalidComponents + */ + public void validateInvalidComponents() { + // TODO + } // validateInvalidComponents() + + /** + * paintDirtyRegions + */ + public void paintDirtyRegions() { + // TODO + } // paintDirtyRegions() + + /** + * getOffscreenBuffer + * @param component TODO + * @param proposedWidth TODO + * @param proposedHeight TODO + * @returns Image + */ + public Image getOffscreenBuffer(Component component, + int proposedWidth, int proposedHeight) { + return null; // TODO + } // getOffscreenBuffer() + + /** + * getDoubleBufferMaximumSize + * @returns Dimension + */ + public Dimension getDoubleBufferMaximumSize() { + return null; // TODO + } // getDoubleBufferMaximumSize() + + /** + * setDoubleBufferMaximumSize + * @param size TODO + */ + public void setDoubleBufferMaximumSize(Dimension size) { + // TODO + } // setDoubleBufferMaximumSize() + + /** + * setDoubleBufferingEnabled + * @param buffer TODO + */ + public void setDoubleBufferingEnabled(boolean buffer) { + // TODO + } // setDoubleBufferingEnabled() + + /** + * isDoubleBufferingEnabled + * @returns boolean + */ + public boolean isDoubleBufferingEnabled() { + return false; // TODO + } // isDoubleBufferingEnabled() + + +} // RepaintManager diff --git a/libjava/javax/swing/RootPaneContainer.java b/libjava/javax/swing/RootPaneContainer.java new file mode 100644 index 00000000000..983e9719a49 --- /dev/null +++ b/libjava/javax/swing/RootPaneContainer.java @@ -0,0 +1,97 @@ +/* RootPaneContainer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; + +/** + * RootPaneContainer + * @author Andrew Selkirk + * @version 1.0 + */ +public interface RootPaneContainer { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getRootPane + * @returns JRootPane + */ + public JRootPane getRootPane(); + + /** + * setContentPane + * @param contentPane TODO + */ + public void setContentPane(Container contentPane); + + /** + * getContentPane + * @returns Container + */ + public Container getContentPane(); + + /** + * setLayeredPane + * @param layeredPane TODO + */ + public void setLayeredPane(JLayeredPane layeredPane); + + /** + * getLayeredPane + * @returns JLayeredPane + */ + public JLayeredPane getLayeredPane(); + + /** + * setGlassPane + * @param glassPane TODO + */ + public void setGlassPane(Component glassPane); + + /** + * getGlassPane + * @returns Component + */ + public Component getGlassPane(); + + +} // RootPaneContainer diff --git a/libjava/javax/swing/ScrollPaneConstants.java b/libjava/javax/swing/ScrollPaneConstants.java new file mode 100644 index 00000000000..6f9edb80de2 --- /dev/null +++ b/libjava/javax/swing/ScrollPaneConstants.java @@ -0,0 +1,157 @@ +/* ScrollPaneConstants.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ScrollPaneConstants + * @author Andrew Selkirk + * @version 1.0 + */ +public interface ScrollPaneConstants { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * VIEWPORT + */ + public static final String VIEWPORT = "VIEWPORT"; + + /** + * VERTICAL_SCROLLBAR + */ + public static final String VERTICAL_SCROLLBAR = "VERTICAL_SCROLLBAR"; + + /** + * HORIZONTAL_SCROLLBAR + */ + public static final String HORIZONTAL_SCROLLBAR = "HORIZONTAL_SCROLLBAR"; + + /** + * ROW_HEADER + */ + public static final String ROW_HEADER = "ROW_HEADER"; + + /** + * COLUMN_HEADER + */ + public static final String COLUMN_HEADER = "COLUMN_HEADER"; + + /** + * LOWER_LEFT_CORNER + */ + public static final String LOWER_LEFT_CORNER = "LOWER_LEFT_CORNER"; + + /** + * LOWER_RIGHT_CORNER + */ + public static final String LOWER_RIGHT_CORNER = "LOWER_RIGHT_CORNER"; + + /** + * UPPER_LEFT_CORNER + */ + public static final String UPPER_LEFT_CORNER = "UPPER_LEFT_CORNER"; + + /** + * UPPER_RIGHT_CORNER + */ + public static final String UPPER_RIGHT_CORNER = "UPPER_RIGHT_CORNER"; + + /** + * LOWER_LEADING_CORNER + */ + public static final String LOWER_LEADING_CORNER = "LOWER_LEADING_CORNER"; + + /** + * LOWER_TRAILING_CORNER + */ + public static final String LOWER_TRAILING_CORNER = "LOWER_TRAILING_CORNER"; + + /** + * UPPER_LEADING_CORNER + */ + public static final String UPPER_LEADING_CORNER = "UPPER_LEADING_CORNER"; + + /** + * UPPER_TRAILING_CORNER + */ + public static final String UPPER_TRAILING_CORNER = "UPPER_TRAILING_CORNER"; + + /** + * VERTICAL_SCROLLBAR_POLICY + */ + public static final String VERTICAL_SCROLLBAR_POLICY = "VERTICAL_SCROLLBAR_POLICY"; + + /** + * HORIZONTAL_SCROLLBAR_POLICY + */ + public static final String HORIZONTAL_SCROLLBAR_POLICY = "HORIZONTAL_SCROLLBAR_POLICY"; + + /** + * VERTICAL_SCROLLBAR_AS_NEEDED + */ + public static final int VERTICAL_SCROLLBAR_AS_NEEDED = 20; + + /** + * VERTICAL_SCROLLBAR_NEVER + */ + public static final int VERTICAL_SCROLLBAR_NEVER = 21; + + /** + * VERTICAL_SCROLLBAR_ALWAYS + */ + public static final int VERTICAL_SCROLLBAR_ALWAYS = 22; + + /** + * HORIZONTAL_SCROLLBAR_AS_NEEDED + */ + public static final int HORIZONTAL_SCROLLBAR_AS_NEEDED = 30; + + /** + * HORIZONTAL_SCROLLBAR_NEVER + */ + public static final int HORIZONTAL_SCROLLBAR_NEVER = 31; + + /** + * HORIZONTAL_SCROLLBAR_ALWAYS + */ + public static final int HORIZONTAL_SCROLLBAR_ALWAYS = 32; + + +} // ScrollPaneConstants diff --git a/libjava/javax/swing/ScrollPaneLayout.java b/libjava/javax/swing/ScrollPaneLayout.java new file mode 100644 index 00000000000..503113e4545 --- /dev/null +++ b/libjava/javax/swing/ScrollPaneLayout.java @@ -0,0 +1,306 @@ +/* ScrollPaneLayout.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; +import javax.swing.plaf.*; + +/** + * ScrollPaneLayout + * @author Andrew Selkirk + * @version 1.0 + */ +public class ScrollPaneLayout implements LayoutManager, ScrollPaneConstants, Serializable { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * UIResource + */ + public static class UIResource extends ScrollPaneLayout + implements javax.swing.plaf.UIResource { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UIResource + */ + public UIResource() { + // TODO + } // UIResource() + + + } // UIResource + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * viewport + */ + protected JViewport viewport; + + /** + * vsb + */ + protected JScrollBar vsb; + + /** + * hsb + */ + protected JScrollBar hsb; + + /** + * rowHead + */ + protected JViewport rowHead; + + /** + * colHead + */ + protected JViewport colHead; + + /** + * lowerLeft + */ + protected Component lowerLeft; + + /** + * lowerRight + */ + protected Component lowerRight; + + /** + * upperLeft + */ + protected Component upperLeft; + + /** + * upperRight + */ + protected Component upperRight; + + /** + * vsbPolicy + */ + protected int vsbPolicy; + + /** + * hsbPolicy + */ + protected int hsbPolicy; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ScrollPaneLayout + */ + public ScrollPaneLayout() { + // TODO + } // ScrollPaneLayout() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * syncWithScrollPane + * @param scrollPane TODO + */ + public void syncWithScrollPane(JScrollPane scrollPane) { + // TODO + } // syncWithScrollPane() + + /** + * addSingletonComponent + * @param oldComponent TODO + * @param newComponent TODO + * @returns Component + */ + protected Component addSingletonComponent(Component oldComponent, + Component newComponent) { + return null; // TODO + } // addSingletonComponent() + + /** + * addLayoutComponent + * @param string TODO + * @param component TODO + */ + public void addLayoutComponent(String string, Component component) { + // TODO + } // addLayoutComponent() + + /** + * removeLayoutComponent + * @param component TODO + */ + public void removeLayoutComponent(Component component) { + // TODO + } // removeLayoutComponent() + + /** + * getVerticalScrollBarPolicy + * @returns int + */ + public int getVerticalScrollBarPolicy() { + return 0; // TODO + } // getVerticalScrollBarPolicy() + + /** + * setVerticalScrollBarPolicy + * @param policy TODO + */ + public void setVerticalScrollBarPolicy(int policy) { + // TODO + } // setVerticalScrollBarPolicy() + + /** + * getHorizontalScrollBarPolicy + * @returns int + */ + public int getHorizontalScrollBarPolicy() { + return 0; // TODO + } // getHorizontalScrollBarPolicy() + + /** + * setHorizontalScrollBarPolicy + * @param policy TODO + */ + public void setHorizontalScrollBarPolicy(int policy) { + // TODO + } // setHorizontalScrollBarPolicy() + + /** + * getViewport + * @returns JViewport + */ + public JViewport getViewport() { + return null; // TODO + } // getViewport() + + /** + * getHorizontalScrollBar + * @returns JScrollBar + */ + public JScrollBar getHorizontalScrollBar() { + return null; // TODO + } // getHorizontalScrollBar() + + /** + * getVerticalScrollBar + * @returns JScrollBar + */ + public JScrollBar getVerticalScrollBar() { + return null; // TODO + } // getVerticalScrollBar() + + /** + * getRowHeader + * @returns JViewport + */ + public JViewport getRowHeader() { + return null; // TODO + } // getRowHeader() + + /** + * getColumnHeader + * @returns JViewport + */ + public JViewport getColumnHeader() { + return null; // TODO + } // getColumnHeader() + + /** + * getCorner + * @param key TODO + * @returns Component + */ + public Component getCorner(String key) { + return null; // TODO + } // getCorner() + + /** + * preferredLayoutSize + * @param parent TODO + * @returns Dimension + */ + public Dimension preferredLayoutSize(Container parent) { + return null; // TODO + } // preferredLayoutSize() + + /** + * minimumLayoutSize + * @param parent TODO + * @returns Dimension + */ + public Dimension minimumLayoutSize(Container parent) { + return null; // TODO + } // minimumLayoutSize() + + /** + * layoutContainer + * @param parent TODO + */ + public void layoutContainer(Container parent) { + // TODO + } // layoutContainer() + + /** + * getViewportBorderBounds + * @param value0 TODO + * @returns Rectangle + */ + public Rectangle getViewportBorderBounds(JScrollPane scrollPane) { + return null; // TODO + } // getViewportBorderBounds() + + +} // ScrollPaneLayout diff --git a/libjava/javax/swing/Scrollable.java b/libjava/javax/swing/Scrollable.java new file mode 100644 index 00000000000..2f226f8528c --- /dev/null +++ b/libjava/javax/swing/Scrollable.java @@ -0,0 +1,49 @@ +/* Scrollable.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + +public interface Scrollable +{ + Dimension getPreferredScrollableViewportSize(); + int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction); + int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction); + boolean getScrollableTracksViewportWidth(); + boolean getScrollableTracksViewportHeight(); +} diff --git a/libjava/javax/swing/SingleSelectionModel.java b/libjava/javax/swing/SingleSelectionModel.java new file mode 100644 index 00000000000..8cc7f466b03 --- /dev/null +++ b/libjava/javax/swing/SingleSelectionModel.java @@ -0,0 +1,90 @@ +/* SingleSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import javax.swing.event.*; + +/** + * SingleSelectionModel + * @author Andrew Selkirk + * @version 1.0 + */ +public interface SingleSelectionModel { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getSelectedIndex + * @returns int + */ + public int getSelectedIndex(); + + /** + * setSelectedIndex + * @param index TODO + */ + public void setSelectedIndex(int index); + + /** + * clearSelection + */ + public void clearSelection(); + + /** + * isSelected + * @returns boolean + */ + public boolean isSelected(); + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener); + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener listener); + + +} // SingleSelectionModel diff --git a/libjava/javax/swing/SizeRequirements.java b/libjava/javax/swing/SizeRequirements.java new file mode 100644 index 00000000000..4b5edf56a7e --- /dev/null +++ b/libjava/javax/swing/SizeRequirements.java @@ -0,0 +1,169 @@ +/* SizeRequirements.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; + +/** + * SizeRequirements + * @author Andrew Selkirk + * @version 1.0 + */ +public class SizeRequirements implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * minimum + */ + public int minimum; + + /** + * preferred + */ + public int preferred; + + /** + * maximum + */ + public int maximum; + + /** + * alignment + */ + public float alignment; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor SizeRequirements + */ + public SizeRequirements() { + // TODO + } // SizeRequirements() + + /** + * Constructor SizeRequirements + * @param min TODO + * @param pref TODO + * @param max TODO + * @param align TODO + */ + public SizeRequirements(int min, int pref, int max, float align) { + // TODO + } // SizeRequirements() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * getTiledSizeRequirements + * @param children TODO + * @returns SizeRequirements + */ + public static SizeRequirements getTiledSizeRequirements( + SizeRequirements[] children) { + return null; // TODO + } // getTiledSizeRequirements() + + /** + * getAlignedSizeRequirements + * @param children TODO + * @returns SizeRequirements + */ + public static SizeRequirements getAlignedSizeRequirements( + SizeRequirements[] children) { + return null; // TODO + } // getAlignedSizeRequirements() + + /** + * calculateTiledPositions + * @param allocated TODO + * @param total TODO + * @param children TODO + * @param offset TODO + * @param spans TODO + */ + public static void calculateTiledPositions(int allocated, + SizeRequirements total, SizeRequirements[] children, + int[] offset, int[] spans) { + // TODO + } // calculateTiledPositions() + + /** + * calculateAlignedPositions + * @param allocated TODO + * @param total TODO + * @param children TODO + * @param offset TODO + * @param spans TODO + */ + public static void calculateAlignedPositions(int allocated, + SizeRequirements total, SizeRequirements[] children, + int[] offset, int[] spans) { + // TODO + } // calculateAlignedPositions() + + /** + * adjustSizes + * @param delta TODO + * @param children TODO + * @returns int[] + */ + public static int[] adjustSizes(int delta, SizeRequirements[] children) { + return null; // TODO + } // adjustSizes() + + +} // SizeRequirements diff --git a/libjava/javax/swing/SizeSequence.java b/libjava/javax/swing/SizeSequence.java new file mode 100644 index 00000000000..d03699f18ec --- /dev/null +++ b/libjava/javax/swing/SizeSequence.java @@ -0,0 +1,249 @@ +/* SizeSequence.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * SizeSequence + * @author Andrew Selkirk + * @version 1.0 + */ +public class SizeSequence { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * sizes + */ + private int[] sizes = new int[0]; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor SizeSequence + */ + public SizeSequence() { + sizes = new int[0]; + } // SizeSequence() + + /** + * Constructor SizeSequence + * @param numEntries TODO + */ + public SizeSequence(int numEntries) { + this(numEntries, 0); + } // SizeSequence() + + /** + * Constructor SizeSequence + * @param numEntries TODO + * @param value TODO + */ + public SizeSequence(int numEntries, int value) { + insertEntries(0, numEntries, value); + } // SizeSequence() + + /** + * Constructor SizeSequence + * @param sizes TODO + */ + public SizeSequence(int[] sizes) { + setSizes(sizes); + } // SizeSequence() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setSize + * @param index TODO + * @param size TODO + */ + public void setSize(int index, int size) { + sizes[index] = size; + } // setSize() + + /** + * getIndex + * @param position TODO + * @returns int + */ + public int getIndex(int position) { + return 0; // TODO + } // getIndex() + + /** + * getSize + * @param index TODO + * @returns int + */ + public int getSize(int index) { + return sizes[index]; + } // getSize() + + /** + * setSizes + * @param sizes TODO + */ + public void setSizes(int[] sizes) { + + // Variables + int index; + + // Initialize Sizes + this.sizes = new int[sizes.length]; + for (index = 0; index < sizes.length; index++) { + this.sizes[index] = sizes[index]; + } // for + + } // setSizes() + + /** + * getSizes + * @returns int[] + */ + public int[] getSizes() { + + // Variables + int[] array; + int index; + + // Create New Array + array = new int[sizes.length]; + for (index = 0; index < sizes.length; index++) { + array[index] = sizes[index]; + } // for + + // Return Newly created array + return array; + + } // getSizes() + + /** + * getPosition + * @param index TODO + * @returns int + */ + public int getPosition(int index) { + + // Variables + int position; + int loop; + + // Process Sizes + position = 0; + for (loop = 0; loop < index; loop++) { + position += sizes[loop]; + } // for + + // Return Position + return position; + + } // getPosition() + + /** + * insertEntries + * @param start TODO + * @param length TODO + * @param value TODO + */ + public void insertEntries(int start, int length, int value) { + + // Variables + int[] array; + int index; + int arrayIndex; + int loop; + + // Create New Array + array = new int[sizes.length + length]; + arrayIndex = 0; + for (index = 0; index < sizes.length; index++) { + if (index == start) { + for (loop = 0; loop < length; loop++) { + array[arrayIndex] = value; + arrayIndex++; + } // for + } else { + array[arrayIndex] = sizes[index]; + arrayIndex++; + } // if + } // for + + } // insertEntries() + + /** + * removeEntries + * @param start TODO + * @param length TODO + */ + public void removeEntries(int start, int length) { + + // Variables + int[] array; + int index; + int arrayIndex; + + // Sanity Check + if ((start + length) > sizes.length) { + throw new IllegalArgumentException("Specified start/length that " + + "is greater than available sizes"); + } // if + + // Create New Array + array = new int[sizes.length - length]; + arrayIndex = 0; + for (index = 0; index < sizes.length; index++) { + if (index == start) { + index += length - 1; + } else { + array[arrayIndex] = sizes[index]; + arrayIndex++; + } // if + } // for + + } // removeEntries() + + +} // SizeSequence diff --git a/libjava/javax/swing/SwingConstants.java b/libjava/javax/swing/SwingConstants.java new file mode 100644 index 00000000000..dbdd71043f1 --- /dev/null +++ b/libjava/javax/swing/SwingConstants.java @@ -0,0 +1,65 @@ +/* SwingConstants.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + + +public interface SwingConstants +{ + public static final int CENTER = 0; + public static final int TOP = 1; + public static final int LEFT = 2; + public static final int BOTTOM = 3; + public static final int RIGHT = 4; + + public static final int NORTH = 1; + public static final int NORTH_EAST = 2; + public static final int EAST = 3; + public static final int SOUTH_EAST = 4; + public static final int SOUTH = 5; + public static final int SOUTH_WEST = 6; + public static final int WEST = 7; + public static final int NORTH_WEST = 8; + + public static final int HORIZONTAL = 0; + public static final int VERTICAL = 1; + + public static final int LEADING = 10; + public static final int TRAILING = 11; +} + diff --git a/libjava/javax/swing/SwingUtilities.java b/libjava/javax/swing/SwingUtilities.java new file mode 100644 index 00000000000..974ee4f8d0e --- /dev/null +++ b/libjava/javax/swing/SwingUtilities.java @@ -0,0 +1,120 @@ +/* SwingUtilities.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.*; + + +public class SwingUtilities +{ + + public static FontMetrics getFontMetrics ( Font font ) { + return Toolkit.getDefaultToolkit().getFontMetrics(font); + } + + + static JRootPane getRootPane(Component a) + { + if (a instanceof JRootPane) + return (JRootPane) a; + + a = a.getParent(); + + if (a != null) + { + return getRootPane(a); + } + + return null; + } + + static void updateComponentTreeUI(JFrame comp) + { + } + + static public String layoutCompoundLabel(JComponent c, + FontMetrics fm, + String text, + Icon i, + int vert_a, + int hor_i, + int vert_text_pos, + int hor_text_pos, + Rectangle vr, + Rectangle ir, + Rectangle tr, + int gap) + { + // view rect 'vr' already ok, + // we need to compute ir (icon rect) and tr (text-rect) + + int next_x = 0;//vr.x; + int next_y = 0;//vr.y; + + ir.height = ir.width = ir.y = ir.x = 0; + + if (i != null) + { + ir.x = vr.x; + ir.y = vr.y; + ir.width = i.getIconWidth(); + ir.height = i.getIconWidth(); + + + next_x += gap + i.getIconWidth(); + next_y += gap + i.getIconHeight(); + } + + tr.x = next_x; + tr.y = vr.y + (vr.height/2); + + tr.width = fm.stringWidth(text); + tr.height = fm.getHeight() + fm.getAscent()/2; + + return text; + } +} + + + + + + + + + diff --git a/libjava/javax/swing/Timer.java b/libjava/javax/swing/Timer.java new file mode 100644 index 00000000000..1d52405218f --- /dev/null +++ b/libjava/javax/swing/Timer.java @@ -0,0 +1,154 @@ +/* Timer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.event.*; +import java.util.*; + + +public class Timer +{ + int ticks; + static boolean verbose; + boolean running; + boolean repeat_ticks = true; + long interval, init_delay; + Vector actions = new Vector(); + + class Waker extends Thread + { + public void run() + { + running = true; + try { + sleep(init_delay); + + while (running) + { + sleep(interval); + + if (verbose) + { + System.out.println("javax.swing.Timer -> clocktick"); + } + + ticks++; + fireActionPerformed(); + + if (! repeat_ticks) + break; + } + running = false; + } catch (Exception e) { + System.out.println("swing.Timer::" + e); + } + } + } + + public void addActionListener(ActionListener listener) + { + actions.addElement(listener); + } + public void removeActionListener(ActionListener listener) + { + actions.removeElement(listener); + } + + void fireActionPerformed() + { + for (int i=0;i<actions.size();i++) + { + ActionListener a = (ActionListener) actions.elementAt(i); + a.actionPerformed(new ActionEvent(this, ticks, "Timer")); + } + } + + + + public static void setLogTimers(boolean flag) + { + verbose = flag; + } + + public static boolean getLogTimers() + { + return verbose; + } + + + public void setDelay(int delay) + { + interval = delay; + } + + public int getDelay() + { + return (int)interval; + } + + + public void setInitialDelay(int initialDelay) + { + init_delay = initialDelay; + } + + public void setRepeats(boolean flag) + { + repeat_ticks = flag; + } + + boolean isRunning() + { + return running; + } + + void start() + { + if (isRunning()) + { + System.err.println("attempt to start a running timer"); + return; + } + new Waker().start(); + } + + void stop() + { + running = false; + } +} diff --git a/libjava/javax/swing/ToggleButtonModel.java b/libjava/javax/swing/ToggleButtonModel.java new file mode 100644 index 00000000000..0128258bd76 --- /dev/null +++ b/libjava/javax/swing/ToggleButtonModel.java @@ -0,0 +1,64 @@ +/* ToggleButtonModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.util.*; +import java.awt.event.*; +import javax.swing.event.*; + +public +class ToggleButtonModel extends DefaultButtonModel +{ + ToggleButtonModel(JComponent c) + { + super(c); + } + + public void setPressed(boolean b) + { + if (! isEnabled()) + return; + + if (! b) + { + return; + } + + setSelected(b); + } +} diff --git a/libjava/javax/swing/ToolTipManager.java b/libjava/javax/swing/ToolTipManager.java new file mode 100644 index 00000000000..ffd5e4f1f5a --- /dev/null +++ b/libjava/javax/swing/ToolTipManager.java @@ -0,0 +1,391 @@ +/* ToolTipManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; + +/** + * ToolTipManager + * @author Andrew Selkirk + * @version 1.0 + */ +public class ToolTipManager extends MouseAdapter implements MouseMotionListener { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * stillInsideTimerAction + */ + protected class stillInsideTimerAction implements ActionListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor stillInsideTimerAction + * @param manager TODO + */ + protected stillInsideTimerAction(ToolTipManager manager) { + // TODO + } // stillInsideTimerAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // stillInsideTimerAction + + /** + * outsideTimerAction + */ + protected class outsideTimerAction implements ActionListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor outsideTimerAction + * @param manager TODO + */ + protected outsideTimerAction(ToolTipManager manager) { + // TODO + } // outsideTimerAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param value0 TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // outsideTimerAction + + /** + * insideTimerAction + */ + protected class insideTimerAction implements ActionListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor insideTimerAction + * @param manager TODO + */ + protected insideTimerAction(ToolTipManager manager) { + // TODO + } // insideTimerAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // insideTimerAction + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * enterTimer + */ + Timer enterTimer; + + /** + * exitTimer + */ + Timer exitTimer; + + /** + * insideTimer + */ + Timer insideTimer; + + /** + * toolTipText + */ + String toolTipText; + + /** + * mouseEvent + */ + MouseEvent mouseEvent; + + /** + * showImmediately + */ + boolean showImmediately; + + /** + * tip + */ + JToolTip tip; + + /** + * enabled + */ + boolean enabled; + + /** + * timerEnter + */ + private long timerEnter; + + /** + * lightWeightPopupEnabled + */ + protected boolean lightWeightPopupEnabled; + + /** + * heavyWeightPopupEnabled + */ + protected boolean heavyWeightPopupEnabled; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ToolTipManager + */ + ToolTipManager() { + // TODO + } // ToolTipManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * sharedInstance + * @returns ToolTipManager + */ + public static ToolTipManager sharedInstance() { + return null; // TODO + } // sharedInstance() + + /** + * setEnabled + * @param enabled TODO + */ + public void setEnabled(boolean enabled) { + // TODO + } // setEnabled() + + /** + * isEnabled + * @returns boolean + */ + public boolean isEnabled() { + return false; // TODO + } // isEnabled() + + /** + * isLightWeightPopupEnabled + * @returns boolean + */ + public boolean isLightWeightPopupEnabled() { + return false; // TODO + } // isLightWeightPopupEnabled() + + /** + * setLightWeightPopupEnabled + * @param enabled TODO + */ + public void setLightWeightPopupEnabled(boolean enabled) { + // TODO + } // setLightWeightPopupEnabled() + + /** + * getInitialDelay + * @returns int + */ + public int getInitialDelay() { + return 0; // TODO + } // getInitialDelay() + + /** + * setInitialDelay + * @param delay TODO + */ + public void setInitialDelay(int delay) { + // TODO + } // setInitialDelay() + + /** + * getDismissDelay + * @returns int + */ + public int getDismissDelay() { + return 0; // TODO + } // getDismissDelay() + + /** + * setDismissDelay + * @param delay TODO + */ + public void setDismissDelay(int delay) { + // TODO + } // setDismissDelay() + + /** + * getReshowDelay + * @returns int + */ + public int getReshowDelay() { + return 0; // TODO + } // getReshowDelay() + + /** + * setReshowDelay + * @param delay TODO + */ + public void setReshowDelay(int delay) { + // TODO + } // setReshowDelay() + + /** + * registerComponent + * @param component TODO + */ + public void registerComponent(JComponent component) { + // TODO + } // registerComponent() + + /** + * unregisterComponent + * @param component TODO + */ + public void unregisterComponent(JComponent component) { + // TODO + } // unregisterComponent() + + /** + * mouseEntered + * @param event TODO + */ + public void mouseEntered(MouseEvent event) { + // TODO + } // mouseEntered() + + /** + * mouseExited + * @param event TODO + */ + public void mouseExited(MouseEvent event) { + // TODO + } // mouseExited() + + /** + * mousePressed + * @param event TODO + */ + public void mousePressed(MouseEvent event) { + // TODO + } // mousePressed() + + /** + * mouseDragged + * @param event TODO + */ + public void mouseDragged(MouseEvent event) { + // TODO + } // mouseDragged() + + /** + * mouseMoved + * @param event TODO + */ + public void mouseMoved(MouseEvent event) { + // TODO + } // mouseMoved() + + +} // ToolTipManager diff --git a/libjava/javax/swing/UIDefaults.java b/libjava/javax/swing/UIDefaults.java new file mode 100644 index 00000000000..de36203c9dc --- /dev/null +++ b/libjava/javax/swing/UIDefaults.java @@ -0,0 +1,303 @@ +/* UIDefaults.java -- database for all settings and interface bindings. + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Insets; +import java.beans.PropertyChangeListener; +import java.util.Hashtable; +import java.util.Locale; +import javax.swing.border.Border; +import javax.swing.plaf.ComponentUI; + +/** + * UIDefaults is a database where all settings and interface bindings are + * stored into. An PLAF implementation fills one of these (see for example + * plaf/basic/BasicDefaults.java) with "JButton" -> new BasicButtonUI(). + * + * @author Ronald Veldema (rveldema@cs.vu.nl) + */ +public class UIDefaults extends Hashtable +{ + public interface ActiveValue + { + Object createValue(UIDefaults table); + } // interface ActiveValue + + public static class LazyInputMap implements LazyValue + { + public LazyInputMap(Object[] bindings) + { + } + public Object createValue(UIDefaults table) + { + throw new Error("not implemented"); + } + } // class LazyInputMap + + public interface LazyValue + { + Object createValue(UIDefaults table); + } // interface LazyValue + + public static class ProxyLazyValue + { + public ProxyLazyValue(String s) + { + throw new Error("not implemented"); + } + public ProxyLazyValue(String c, String m) + { + throw new Error("not implemented"); + } + public ProxyLazyValue(String c, Object[] o) + { + throw new Error("not implemented"); + } + public ProxyLazyValue(String c, String m, Object[] o) + { + throw new Error("not implemented"); + } + public Object createValue(UIDefaults table) + { + throw new Error("not implemented"); + } + } // class ProxyLazyValue + + public UIDefaults() + { + } + + public UIDefaults(Object[] entries) + { + // XXX + } + + public Object get(Object key) + { + // XXX Obey 1.4 specs + return super.get(key); + } + + public Object get(Object key, Locale l) + { + throw new Error("not implemented"); + } + + public Object put(Object key, Object value) + { + throw new Error("not implemented"); + } + + public void putDefaults(Object[] list) + { + throw new Error("not implemented"); + } + + public Font getFont(Object key) + { + Object o = get(key); + return o instanceof Font ? (Font) o : null; + } + + public Font getFont(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Font ? (Font) o : null; + } + + public Color getColor(Object key) + { + Object o = get(key); + return o instanceof Color ? (Color) o : null; + } + + public Color getColor(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Color ? (Color) o : null; + } + + public Icon getIcon(Object key) + { + Object o = get(key); + return o instanceof Icon ? (Icon) o : null; + } + + public Icon getIcon(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Icon ? (Icon) o : null; + } + + public Border getBorder(Object key) + { + Object o = get(key); + return o instanceof Border ? (Border) o : null; + } + + public Border getBorder(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Border ? (Border) o : null; + } + + public String getString(Object key) + { + Object o = get(key); + return o instanceof String ? (String) o : null; + } + + public String getString(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof String ? (String) o : null; + } + + public int getInt(Object key) + { + Object o = get(key); + return o instanceof Integer ? ((Integer) o).intValue() : 0; + } + + public int getInt(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Integer ? ((Integer) o).intValue() : 0; + } + + public boolean getBoolean(Object key) + { + return Boolean.TRUE.equals(get(key)); + } + + public boolean getBoolean(Object key, Locale l) + { + return Boolean.TRUE.equals(get(key, l)); + } + + public Insets getInsets(Object key) + { + Object o = get(key); + return o instanceof Insets ? (Insets) o : null; + } + + public Insets getInsets(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Insets ? (Insets) o : null; + } + + public Dimension getDimension(Object key) + { + Object o = get(key); + return o instanceof Dimension ? (Dimension) o : null; + } + + public Dimension getDimension(Object key, Locale l) + { + Object o = get(key, l); + return o instanceof Dimension ? (Dimension) o : null; + } + + public Class getUIClass(String id, ClassLoader loader) + { + throw new Error("not implemented"); + } + + public Class getUIClass(String id) + { + throw new Error("not implemented"); + } + + protected void getUIError(String msg) + { + // Does nothing unless overridden. + } + + public ComponentUI getUI(JComponent a) + { + String pp = a.getUIClassID(); + ComponentUI p = (ComponentUI) get(pp); + if (p == null) + getUIError("failed to locate UI:" + pp); + return p; + } + + public void addPropertyChangeListener(PropertyChangeListener l) + { + throw new Error("not implemented"); + } + + public void removePropertyChangeListener(PropertyChangeListener l) + { + throw new Error("not implemented"); + } + + public PropertyChangeListener[] getPropertyChangeListeners() + { + throw new Error("not implemented"); + } + + protected void firePropertyChange(String property, Object o, Object n) + { + throw new Error("not implemented"); + } + + public void addResourceBundle(String name) + { + throw new Error("not implemented"); + } + + public void removeResourceBundle(String name) + { + throw new Error("not implemented"); + } + + public void setDefaultLocale(Locale l) + { + throw new Error("not implemented"); + } + + public Locale getDefaultLocale() + { + throw new Error("not implemented"); + } +} // class UIDefaults diff --git a/libjava/javax/swing/UIManager.java b/libjava/javax/swing/UIManager.java new file mode 100644 index 00000000000..18eebe35839 --- /dev/null +++ b/libjava/javax/swing/UIManager.java @@ -0,0 +1,282 @@ +/* UIManager.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +import java.io.*; +import java.awt.*; + +import javax.swing.border.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; + + +import java.beans.*; + + +public class UIManager implements Serializable +{ + static class LookAndFeelInfo + { + String name, clazz; + + LookAndFeelInfo(String name, + String clazz) + { + this.name = name; + this.clazz = clazz; + } + String getName() { return name; } + String getClassName() { return clazz; } + } + + + static LookAndFeelInfo [] installed = { + new LookAndFeelInfo("Metal", + "javax.swing.plaf.metal.MetalLookAndFeel") + }; + + + static LookAndFeel[] aux_installed; + + static LookAndFeel look_and_feel = new MetalLookAndFeel(); + + + UIManager() + { + } + + public static void addPropertyChangeListener(PropertyChangeListener listener) + { + // Add a PropertyChangeListener to the listener list. + } + + public static void addAuxiliaryLookAndFeel(LookAndFeel l) + { + // Add a LookAndFeel to the list of auxiliary look and feels. + if (aux_installed == null) + { + aux_installed = new LookAndFeel[1]; + aux_installed[0] = l; + return; + } + + LookAndFeel[] T = new LookAndFeel[ aux_installed.length+1 ]; + System.arraycopy(aux_installed, 0, + T, 0, + aux_installed.length); + aux_installed = T; + aux_installed[aux_installed.length-1] = l; + } + + public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf) + { + if (aux_installed == null) + return false; + + for (int i=0;i<aux_installed.length;i++) + { + if (aux_installed[i] == laf) + { + aux_installed[ i ] = aux_installed[aux_installed.length-1]; + + LookAndFeel[] T = new LookAndFeel[ aux_installed.length-1 ]; + System.arraycopy(aux_installed, 0, + T, 0, + aux_installed.length-1); + aux_installed = T; + return true; + } + } + return false; + } + + public static LookAndFeel[] getAuxiliaryLookAndFeels() + { return aux_installed; } + + + public static Object get(Object key) + { return getLookAndFeel().getDefaults().get(key); } + + /** + * Returns a border from the defaults table. + */ + public static Border getBorder(Object key) + { + return (Border) getLookAndFeel().getDefaults().get(key); + } + + /** + * Returns a drawing color from the defaults table. + */ + public static Color getColor(Object key) + { + return (Color) getLookAndFeel().getDefaults().get(key); + } + + /** + * this string can be passed to Class.forName() + */ + public static String getCrossPlatformLookAndFeelClassName() + { + return "javax.swing.plaf.metal.MetalLookAndFeel"; + } + + /** + * Returns the default values for this look and feel. + */ + static UIDefaults getDefaults() + { + return getLookAndFeel().getDefaults(); + } + + /** + * Returns a dimension from the defaults table. + */ + static Dimension getDimension(Object key) + { + System.out.println("UIManager.getDim"); + return new Dimension(200,100); + } + static Font getFont(Object key) + // Returns a drawing font from the defaults table. + { + return (Font) getLookAndFeel().getDefaults().get(key); + } + static Icon getIcon(Object key) + // Returns an Icon from the defaults table. + { + return (Icon) getLookAndFeel().getDefaults().get(key); + } + static Insets getInsets(Object key) + // Returns an Insets object from the defaults table. + { + return (Insets) getLookAndFeel().getDefaults().getInsets(key); + } + + static LookAndFeelInfo[] getInstalledLookAndFeels() + { + return installed; + } + + static int getInt(Object key) + { + Integer x = (Integer) getLookAndFeel().getDefaults().get(key); + if (x == null) + return 0; + return x.intValue(); + } + static LookAndFeel getLookAndFeel() + { + return look_and_feel; + } + + static UIDefaults getLookAndFeelDefaults() + // Returns the default values for this look and feel. + { + return getLookAndFeel().getDefaults(); + } + static String getString(Object key) + // Returns a string from the defaults table. + { + return (String) getLookAndFeel().getDefaults().get(key); + } + static String getSystemLookAndFeelClassName() + // Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class. + { + return getCrossPlatformLookAndFeelClassName(); + } + + + public static ComponentUI getUI(JComponent target) + // Returns the L&F object that renders the target component. + { + ComponentUI ui = getDefaults().getUI(target); + //System.out.println("GET-UI-> " + ui + ", for " + target); + return ui; + } + + + public static void installLookAndFeel(String name, String className) + // Creates a new look and feel and adds it to the current array. + { + } + public static void installLookAndFeel(LookAndFeelInfo info) + // Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]). + { + } + public static Object put(Object key, Object value) + // Stores an object in the defaults table. + { + return getLookAndFeel().getDefaults().put(key,value); + } + public static void removePropertyChangeListener(PropertyChangeListener listener) + // Remove a PropertyChangeListener from the listener list. + { + } + public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos) + // Replaces the current array of installed LookAndFeelInfos. + { + } + public static void setLookAndFeel(LookAndFeel newLookAndFeel) + { + if (look_and_feel != null) + look_and_feel.uninitialize(); + + // Set the current default look and feel using a LookAndFeel object. + look_and_feel = newLookAndFeel; + look_and_feel.initialize(); + + // revalidate(); + // repaint(); + } + + public static void setLookAndFeel(String className) + throws ClassNotFoundException, + InstantiationException, + IllegalAccessException, + UnsupportedLookAndFeelException + { + // Set the current default look and feel using a class name. + Class c = Class.forName(className); + LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception + setLookAndFeel(a); + } + + +} diff --git a/libjava/javax/swing/UnsupportedLookAndFeelException.java b/libjava/javax/swing/UnsupportedLookAndFeelException.java new file mode 100644 index 00000000000..18488648dea --- /dev/null +++ b/libjava/javax/swing/UnsupportedLookAndFeelException.java @@ -0,0 +1,47 @@ +/* UnsupportedLookAndFeelException.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public class UnsupportedLookAndFeelException extends Exception +{ + UnsupportedLookAndFeelException(String a) + { + super(a); + } +} diff --git a/libjava/javax/swing/ViewportLayout.java b/libjava/javax/swing/ViewportLayout.java new file mode 100644 index 00000000000..f5beb76db13 --- /dev/null +++ b/libjava/javax/swing/ViewportLayout.java @@ -0,0 +1,111 @@ +/* ViewportLayout.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.io.*; + +/** + * ViewportLayout + * @author Andrew Selkirk + * @version 1.0 + */ +public class ViewportLayout implements LayoutManager, Serializable { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ViewportLayout + */ + public ViewportLayout() { + // TODO + } // ViewportLayout() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addLayoutComponent + * @param name TODO + * @param c TODO + */ + public void addLayoutComponent(String name, Component c) { + // TODO + } // addLayoutComponent() + + /** + * removeLayoutComponent + * @param c TODO + */ + public void removeLayoutComponent(Component c) { + // TODO + } // removeLayoutComponent() + + /** + * preferredLayoutSize + * @param parent TODO + * @returns Dimension + */ + public Dimension preferredLayoutSize(Container parent) { + return null; // TODO + } // preferredLayoutSize() + + /** + * minimumLayoutSize + * @param parent TODO + * @returns Dimension + */ + public Dimension minimumLayoutSize(Container parent) { + return null; // TODO + } // minimumLayoutSize() + + /** + * layoutContainer + * @param parent TODO + */ + public void layoutContainer(Container parent) { + // TODO + } // layoutContainer() + + +} // ViewportLayout diff --git a/libjava/javax/swing/WindowConstants.java b/libjava/javax/swing/WindowConstants.java new file mode 100644 index 00000000000..ca501c0d6c4 --- /dev/null +++ b/libjava/javax/swing/WindowConstants.java @@ -0,0 +1,67 @@ +/* WindowConstants.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * WindowConstants + * @author Andrew Selkirk + * @version 1.0 + */ +public interface WindowConstants { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * DO_NOTHING_ON_CLOSE + */ + public static final int DO_NOTHING_ON_CLOSE = 0; + + /** + * HIDE_ON_CLOSE + */ + public static final int HIDE_ON_CLOSE = 1; + + /** + * DISPOSE_ON_CLOSE + */ + public static final int DISPOSE_ON_CLOSE = 2; + + +} // WindowConstants diff --git a/libjava/javax/swing/border/AbstractBorder.java b/libjava/javax/swing/border/AbstractBorder.java new file mode 100644 index 00000000000..971665414b6 --- /dev/null +++ b/libjava/javax/swing/border/AbstractBorder.java @@ -0,0 +1,122 @@ +/* AbstractBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.io.*; +import java.awt.*; + +public abstract class AbstractBorder implements Border, Serializable +{ + AbstractBorder() + { + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + System.out.println("HMMMMM, abstract-border.paintBorder"); + } + + + public Insets getBorderInsets(Component c, Insets insets) + { + if (insets == null) + insets = new Insets(0,0,0,0); + + insets.left = insets.top = insets.right = insets.bottom = 5; + + return insets; + } + + public Insets getBorderInsets(Component c) + { + return getBorderInsets(c, new Insets(0,0,0,0)); + } + + + public boolean isBorderOpaque() + { return false; } + + public Rectangle getInteriorRectangle(Component c, + int x, + int y, + int width, + int height) + { + return getInteriorRectangle(c, + this, + x, + y, + width, + height); + } + + + public static Rectangle getInteriorRectangle(Component c, + Border b, + int x, + int y, + int width, + int height) + { + if(b != null) + { + Insets insets = b.getBorderInsets(c); + + int w = insets.right - insets.left; + int h = insets.top - insets.bottom; + + return new Rectangle(x + insets.left, + y + insets.top, + width - w, + height - h); + } + else + { + return new Rectangle(x, + y, + width, + height); + } + } +} + diff --git a/libjava/javax/swing/border/BevelBorder.java b/libjava/javax/swing/border/BevelBorder.java new file mode 100644 index 00000000000..ef2c279fa71 --- /dev/null +++ b/libjava/javax/swing/border/BevelBorder.java @@ -0,0 +1,75 @@ +/* BevelBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public class BevelBorder extends EmptyBorder +{ + Color c; + + public BevelBorder() + { + } + + + public BevelBorder(int top, + int left, + int bottom, + int right, + Color color) + { + super(top, left, bottom, right); + this.c = color; + } + + public boolean isBorderOpaque() + { + return false; + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + } +} + diff --git a/libjava/javax/swing/border/Border.java b/libjava/javax/swing/border/Border.java new file mode 100644 index 00000000000..356693563c0 --- /dev/null +++ b/libjava/javax/swing/border/Border.java @@ -0,0 +1,52 @@ +/* Border.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public interface Border +{ + public Insets getBorderInsets(Component c); + public boolean isBorderOpaque(); + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height); +} diff --git a/libjava/javax/swing/border/CompoundBorder.java b/libjava/javax/swing/border/CompoundBorder.java new file mode 100644 index 00000000000..a1e731e17cf --- /dev/null +++ b/libjava/javax/swing/border/CompoundBorder.java @@ -0,0 +1,70 @@ +/* CompoundBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public class CompoundBorder extends AbstractBorder +{ + + public Insets getBorderInsets(Component c, + Insets s) + { + if (s == null) + s = new Insets(0,0,0,0); + + s.left = s.right = s.top = s.bottom = 5; + + return s; + } + + public boolean isBorderOpaque() + { + return false; + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + } +} + diff --git a/libjava/javax/swing/border/EmptyBorder.java b/libjava/javax/swing/border/EmptyBorder.java new file mode 100644 index 00000000000..c09a0affc40 --- /dev/null +++ b/libjava/javax/swing/border/EmptyBorder.java @@ -0,0 +1,90 @@ +/* EmptyBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + + +public class EmptyBorder extends AbstractBorder +{ + + protected int l,r,b,t; + + public EmptyBorder() + { + } + + public EmptyBorder(int left, + int right, + int top, + int bottom) + { + this.l = left; + this.r = r; + this.t = t; + this.b = b; + } + + + public Insets getBorderInsets(Component c, + Insets s) + { + if (s == null) + s = new Insets(0,0,0,0); + + s.left = l; + s.right = r; + s.top = t; + s.bottom = b; + + return s; + } + + public boolean isBorderOpaque() + { + return false; + } + + + public void paintBorder(Component c, + Graphics g, + int x, int y, int width, int height) + { + } +} + diff --git a/libjava/javax/swing/border/EtchedBorder.java b/libjava/javax/swing/border/EtchedBorder.java new file mode 100644 index 00000000000..97e5099d1a4 --- /dev/null +++ b/libjava/javax/swing/border/EtchedBorder.java @@ -0,0 +1,75 @@ +/* EtchedBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public class EtchedBorder extends EmptyBorder +{ + Color c; + + public EtchedBorder() + { + } + + + public EtchedBorder(int top, + int left, + int bottom, + int right, + Color color) + { + super(top, left, bottom, right); + this.c = color; + } + + public boolean isBorderOpaque() + { + return false; + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + } +} + diff --git a/libjava/javax/swing/border/LineBorder.java b/libjava/javax/swing/border/LineBorder.java new file mode 100644 index 00000000000..7f3c6511668 --- /dev/null +++ b/libjava/javax/swing/border/LineBorder.java @@ -0,0 +1,75 @@ +/* LineBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public class LineBorder extends EmptyBorder +{ + Color c; + + public LineBorder() + { + } + + + public LineBorder(int top, + int left, + int bottom, + int right, + Color color) + { + super(top, left, bottom, right); + this.c = color; + } + + public boolean isBorderOpaque() + { + return false; + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + } +} + diff --git a/libjava/javax/swing/border/MatteBorder.java b/libjava/javax/swing/border/MatteBorder.java new file mode 100644 index 00000000000..30e5f59e14e --- /dev/null +++ b/libjava/javax/swing/border/MatteBorder.java @@ -0,0 +1,75 @@ +/* MatteBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public class MatteBorder extends EmptyBorder +{ + Color c; + + public MatteBorder() + { + } + + + public MatteBorder(int top, + int left, + int bottom, + int right, + Color color) + { + super(top, left, bottom, right); + this.c = color; + } + + public boolean isBorderOpaque() + { + return false; + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + } +} + diff --git a/libjava/javax/swing/border/TitledBorder.java b/libjava/javax/swing/border/TitledBorder.java new file mode 100644 index 00000000000..5937aa4c0ad --- /dev/null +++ b/libjava/javax/swing/border/TitledBorder.java @@ -0,0 +1,68 @@ +/* TitledBorder.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.border; + +import java.awt.*; + +public class TitledBorder extends AbstractBorder +{ + + public Insets getBorderInsets(Component c, + Insets s) + { + s.left = s.right = s.top = s.bottom = 5; + return s; + } + + + + public boolean isBorderOpaque() + { + return false; + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + } +} + diff --git a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java new file mode 100644 index 00000000000..94503207af4 --- /dev/null +++ b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java @@ -0,0 +1,148 @@ +/* AbstractColorChooserPanel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.colorchooser; + +// Imports +import java.awt.*; +import java.io.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * AbstractColorChooserPanel + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class AbstractColorChooserPanel extends JPanel { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * chooser + */ + private JColorChooser chooser; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AbstractColorChooserPanel + */ + public AbstractColorChooserPanel() { + // TODO + } // AbstractColorChooserPanel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getDisplayName + * @returns String + */ + public abstract String getDisplayName(); + + /** + * updateChooser + */ + public abstract void updateChooser(); + + /** + * buildChooser + */ + protected abstract void buildChooser(); + + /** + * getSmallDisplayIcon + * @returns Icon + */ + public abstract Icon getSmallDisplayIcon(); + + /** + * getLargeDisplayIcon + * @returns Icon + */ + public abstract Icon getLargeDisplayIcon(); + + /** + * installChooserPanel + * @param chooser TODO + */ + public void installChooserPanel(JColorChooser chooser) { + // TODO + } // installChooserPanel() + + /** + * uninstallChooserPanel + * @param chooser TODO + */ + public void uninstallChooserPanel(JColorChooser chooser) { + // TODO + } // uninstallChooserPanel() + + /** + * getColorSelectionModel + * @returns ColorSelectionModel + */ + public ColorSelectionModel getColorSelectionModel() { + return null; // TODO + } // getColorSelectionModel() + + /** + * getColorFromModel + * @returns Color + */ + protected Color getColorFromModel() { + return null; // TODO + } // getColorFromModel() + + /** + * paint + * @param graphics TODO + */ + public void paint(Graphics graphics) { + // TODO + } // paint() + + +} // AbstractColorChooserPanel diff --git a/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java b/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java new file mode 100644 index 00000000000..122612e5669 --- /dev/null +++ b/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java @@ -0,0 +1,83 @@ +/* ColorChooserComponentFactory.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.colorchooser; + +// Imports +import javax.swing.*; + +/** + * ColorChooserComponentFactory + * @author Andrew Selkirk + * @version 1.0 + */ +public class ColorChooserComponentFactory { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ColorChooserComponentFactory + */ + private ColorChooserComponentFactory() { + // TODO + } // ColorChooserComponentFactory() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getDefaultChooserPanels + * @returns AbstractColorChooserPanel[] + */ + public static AbstractColorChooserPanel[] getDefaultChooserPanels() { + return null; // TODO + } // getDefaultChooserPanels() + + /** + * getPreviewPanel + * @returns JComponent + */ + public static JComponent getPreviewPanel() { + return null; // TODO + } // getPreviewPanel() + + +} // ColorChooserComponentFactory diff --git a/libjava/javax/swing/colorchooser/ColorSelectionModel.java b/libjava/javax/swing/colorchooser/ColorSelectionModel.java new file mode 100644 index 00000000000..8139a18c720 --- /dev/null +++ b/libjava/javax/swing/colorchooser/ColorSelectionModel.java @@ -0,0 +1,80 @@ +/* ColorSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.colorchooser; + +// Imports +import java.awt.*; +import javax.swing.event.*; + +/** + * ColorSelectionModel + * @author Andrew Selkirk + * @version 1.0 + */ +public interface ColorSelectionModel { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getSelectedColor + * @returns Color + */ + public abstract Color getSelectedColor(); + + /** + * setSelectedColor + * @param color TODO + */ + public abstract void setSelectedColor(Color color); + + /** + * addChangeListener + * @param listener TODO + */ + public abstract void addChangeListener(ChangeListener listener); + + /** + * removeChangeListener + * @param listener TODO + */ + public abstract void removeChangeListener(ChangeListener listener); + + +} // ColorSelectionModel diff --git a/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java b/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java new file mode 100644 index 00000000000..74bf0642a07 --- /dev/null +++ b/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java @@ -0,0 +1,137 @@ +/* BoundedRangeModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.colorchooser; + +// Imports +import java.awt.*; +import java.io.*; +import javax.swing.event.*; + +/** + * DefaultColorSelectionModel + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultColorSelectionModel + implements ColorSelectionModel, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent; + + /** + * listenerList + */ + protected EventListenerList listenerList; + + /** + * selectedColor + */ + private Color selectedColor; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultColorSelectionModel + */ + public DefaultColorSelectionModel() { + // TODO + } // DefaultColorSelectionModel() + + /** + * Constructor DefaultColorSelectionModel + * @param color TODO + */ + public DefaultColorSelectionModel(Color color) { + // TODO + } // DefaultColorSelectionModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getSelectedColor + * @returns Color + */ + public Color getSelectedColor() { + return null; // TODO + } // getSelectedColor() + + /** + * setSelectedColor + * @param color TODO + */ + public void setSelectedColor(Color color) { + // TODO + } // setSelectedColor() + + /** + * addChangeListener + * @param listener TODO + */ + public void addChangeListener(ChangeListener listener) { + // TODO + } // addChangeListener() + + /** + * removeChangeListener + * @param listener TODO + */ + public void removeChangeListener(ChangeListener listener) { + // TODO + } // removeChangeListener() + + /** + * fireStateChanged + */ + protected void fireStateChanged() { + // TODO + } // fireStateChanged() + + +} // DefaultColorSelectionModel diff --git a/libjava/javax/swing/event/AncestorEvent.java b/libjava/javax/swing/event/AncestorEvent.java new file mode 100644 index 00000000000..a1f5ae19fbd --- /dev/null +++ b/libjava/javax/swing/event/AncestorEvent.java @@ -0,0 +1,140 @@ +/* AncestorEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import javax.swing.*; +import java.awt.*; + +/** + * Ancestor Event + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class AncestorEvent extends AWTEvent { + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * ANCESTOR_ADDED constant + */ + public static int ANCESTOR_ADDED = 0; + + /** + * ANCESTOR_MOVED constant + */ + public static int ANCESTOR_MOVED = 1; + + /** + * ANCESTOR_REMOVED constant + */ + public static int ANCESTOR_REMOVED = 2; + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * Source component + */ + private JComponent sourceComponent = null; + + /** + * Ancestor + */ + private Container ancestor = null; + + /** + * Ancestor Parent + */ + private Container ancestorParent = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AncestorEvent + * @param source Source component + * @param id ID + * @param ancestor ancestor + * @param ancestorParent parent ancestor + */ + public AncestorEvent(JComponent source, int id, Container ancestor, + Container ancestorParent) { + super(source, id); + this.sourceComponent = source; + this.ancestor = ancestor; + this.ancestorParent = ancestorParent; + } // AncestorEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Get ancestor + * @return ancestor + */ + public Container getAncestor() { + return ancestor; + } // getAncestor() + + /** + * Get ancestor parent + * @return ancestor parent + */ + public Container getAncestorParent() { + return ancestorParent; + } // getAncestorParent() + + /** + * Get component + * @return component + */ + public JComponent getComponent() { + return sourceComponent; + } // getComponent() + + +} // AncestorEvent diff --git a/libjava/javax/swing/event/AncestorListener.java b/libjava/javax/swing/event/AncestorListener.java new file mode 100644 index 00000000000..acd10a606e2 --- /dev/null +++ b/libjava/javax/swing/event/AncestorListener.java @@ -0,0 +1,69 @@ +/* AncestorListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * AncestorListener Interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface AncestorListener extends EventListener { + + /** + * Ancestor Added + * @param event Ancestor Event + */ + public void ancestorAdded(AncestorEvent event); + + /** + * Ancestor Removed + * @param event Ancestor Event + */ + public void ancestorRemoved(AncestorEvent event); + + /** + * Ancestor Moved + * @param event Ancestor Event + */ + public void ancestorMoved(AncestorEvent event); + + +} // AncestorListener diff --git a/libjava/javax/swing/event/CaretEvent.java b/libjava/javax/swing/event/CaretEvent.java new file mode 100644 index 00000000000..876bf4f7e01 --- /dev/null +++ b/libjava/javax/swing/event/CaretEvent.java @@ -0,0 +1,79 @@ +/* CaretEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; + +/** + * CaretEvent + * @author Andrew Selkirk + */ +public abstract class CaretEvent extends EventObject { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * CaretEvent constructor + * @param source Source object + */ + public CaretEvent(Object source) { + super(source); + } // CaretEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Get caret location + * @returns the dot + */ + public abstract int getDot(); + + /** + * Get mark + * @returns the mark + */ + public abstract int getMark(); + + +} // CaretEvent diff --git a/libjava/javax/swing/event/CaretListener.java b/libjava/javax/swing/event/CaretListener.java new file mode 100644 index 00000000000..fae394742e8 --- /dev/null +++ b/libjava/javax/swing/event/CaretListener.java @@ -0,0 +1,56 @@ +/* CaretListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * CaretListener interface + * @author Andrew Selkirk + */ +public interface CaretListener extends EventListener { + + /** + * Caret position has been updated + * @param event Caret Event + */ + public void caretUpdate(CaretEvent event); + + +} // CaretListener diff --git a/libjava/javax/swing/event/CellEditorListener.java b/libjava/javax/swing/event/CellEditorListener.java new file mode 100644 index 00000000000..d58960514e3 --- /dev/null +++ b/libjava/javax/swing/event/CellEditorListener.java @@ -0,0 +1,62 @@ +/* CellEditorListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * CellEditorListener interface + * @author Andrew Selkirk + */ +public interface CellEditorListener extends EventListener { + + /** + * Editing has been canceled + * @param event Change Event + */ + public void editingCanceled(ChangeEvent event); + + /** + * Editing has been stopped + * @param event Change Event + */ + public void editingStopped(ChangeEvent event); + + +} // CellEditorListener diff --git a/libjava/javax/swing/event/ChangeEvent.java b/libjava/javax/swing/event/ChangeEvent.java new file mode 100644 index 00000000000..1d2d4e14f69 --- /dev/null +++ b/libjava/javax/swing/event/ChangeEvent.java @@ -0,0 +1,59 @@ +/* ChangeEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; + +/** + * ChangeEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class ChangeEvent extends EventObject { + + /** + * ChangeEvent constructor + * @param source Source object + */ + public ChangeEvent(Object source) { + super(source); + } // ChangeEvent() + + +} // ChangeEvent diff --git a/libjava/javax/swing/event/ChangeListener.java b/libjava/javax/swing/event/ChangeListener.java new file mode 100644 index 00000000000..71173655d1b --- /dev/null +++ b/libjava/javax/swing/event/ChangeListener.java @@ -0,0 +1,57 @@ +/* ChangeListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * ChangeListener interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface ChangeListener extends EventListener { + + /** + * State changed + * @param event Change Event + */ + public void stateChanged(ChangeEvent event); + + +} // ChangeListener diff --git a/libjava/javax/swing/event/DocumentEvent.java b/libjava/javax/swing/event/DocumentEvent.java new file mode 100644 index 00000000000..6ce9dd5257a --- /dev/null +++ b/libjava/javax/swing/event/DocumentEvent.java @@ -0,0 +1,185 @@ +/* DocumentEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import javax.swing.text.*; + +/** + * DocumentEvent interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface DocumentEvent { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * ElementChange interface + */ + public static interface ElementChange { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getIndex + * @returns int + */ + public int getIndex(); + + /** + * getElement + * @returns Element + */ + public Element getElement(); + + /** + * getChildrenRemoved + * @returns Element[] + */ + public Element[] getChildrenRemoved(); + + /** + * getChildrenAdded + * @returns Element[] + */ + public Element[] getChildrenAdded(); + + + } // ElementChange + + /** + * EventType + */ + public static final class EventType { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * INSERT + */ + public static final EventType INSERT = new EventType("INSERT"); // TODO + + /** + * REMOVE + */ + public static final EventType REMOVE = new EventType("REMOVE"); // TODO + + /** + * CHANGE + */ + public static final EventType CHANGE = new EventType("CHANGE"); // TODO + + /** + * typeString + */ + private String type; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor EventType + * @param type TODO + */ + private EventType(String type) { + this.type = type; + } // EventType() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public String toString() { + return type; // TODO + } // toString() + + + } // EventType + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getType + * @returns EventType + */ + public EventType getType(); + + /** + * getOffset + * @returns int + */ + public int getOffset(); + + /** + * getLength + * @returns int + */ + public int getLength(); + + /** + * getDocument + * @returns Document + */ + public Document getDocument(); + + /** + * getChange + * @param element TODO + * @returns ElementChange + */ + public ElementChange getChange(Element element); + + +} // DocumentEvent diff --git a/libjava/javax/swing/event/DocumentListener.java b/libjava/javax/swing/event/DocumentListener.java new file mode 100644 index 00000000000..dbf7e3c5bc3 --- /dev/null +++ b/libjava/javax/swing/event/DocumentListener.java @@ -0,0 +1,68 @@ +/* DocumentListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +import java.util.EventListener; + +/** + * DocumentListener interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface DocumentListener extends EventListener { + + /** + * Changed update + * @param event Document Event + */ + public void changedUpdate(DocumentEvent event); + + /** + * Insert update + * @param event Document Event + */ + public void insertUpdate(DocumentEvent event); + + /** + * Remove update + * @param event Document Event + */ + public void removeUpdate(DocumentEvent event); + + +} // DocumentListener diff --git a/libjava/javax/swing/event/EventListenerList.java b/libjava/javax/swing/event/EventListenerList.java new file mode 100644 index 00000000000..5017aa54336 --- /dev/null +++ b/libjava/javax/swing/event/EventListenerList.java @@ -0,0 +1,241 @@ +/* EventListenerList.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.io.Serializable; +import java.util.EventListener; + +/** + * EventListenerList + * @author Andrew Selkirk + */ +public class EventListenerList extends Object + implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * Listener list + */ + protected Object[] listenerList = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * EventListenerList constructor + */ + public EventListenerList() { + listenerList = new Object[0]; + } // EventListenerList() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Add Listener + * @param t Class type + * @param listener Listener to add + */ + public void add(Class t, EventListener listener) { + + // Variables + Object[] list; + int index; + Class checkClass; + EventListener checkListener; + + // Create New list in anticipation that listener is not present + list = new Object[listenerList.length + 2]; + + // Search through list looking for listener + for (index = 0; index < listenerList.length; index += 2) { + checkClass = (Class) listenerList[index]; + checkListener = (EventListener) listenerList[index + 1]; + if (checkClass.equals(t) == true && + checkListener.equals(listener) == true) { + return; + } // if + } // for + + // Add Listener + list[listenerList.length] = t; + list[listenerList.length + 1] = listener; + + // Replace Listener List + listenerList = list; + + } // add() + + /** + * Get the total number of listeners + * @return Count of listeners + */ + public int getListenerCount() { + return (int) listenerList.length / 2; + } // getListenerCount + + /** + * Get the number of listeners of a particular type + * @param t Class type to count + * @returns Count of the specified listeners + */ + public int getListenerCount(Class t) { + + // Variables + int index; + int count; + String name; + + // Loop through entire list + count = 0; + name = t.getName(); + for (index = 0; index < listenerList.length; index += 2) { + if (((Class) listenerList[index]).getName().equals(name) == true) { + count += 1; + } + } // for: index + + // Return Count + return count; + + } // getListenerCount() + + /** + * Get a list of listenerType/listener pairs + * @returns Listener list + */ + public Object[] getListenerList() { + return listenerList; + } // getListenerList() + + /** + * Get list of listeners of a particular type + * @param c Class type + * @returns List of listeners of the specified type + */ + public EventListener[] getListeners(Class c) { + + // Variables + int count; + EventListener[] list; + String name; + int index; + + // Get count of listeners + count = getListenerCount(c); + + // Create Event Listener list + list = new EventListener[count]; + + // Construct List + count = 0; + name = c.getName(); + for (index = 0; index < listenerList.length; index += 2) { + if (((Class) listenerList[index]).getName().equals(name) == true) { + list[count] = (EventListener) listenerList[index]; + count += 1; + } // if + } // for: index + + // Return List + return list; + + } // getListeners() + + /** + * Remove a listener + * @param t Class type + * @param listener Listener to be removed + */ + public void remove(Class t, EventListener listener) { + + // Variables + Object[] list; + int index; + Class checkClass; + EventListener checkListener; + int pointer; + boolean found; + + // Create New list in anticipation that listener is not present + if (listenerList.length == 0) { + return; + } // if + list = new Object[listenerList.length - 2]; + + // Search through list looking for listener + pointer = 0; + found = false; + for (index = 0; index < listenerList.length - 2; index += 2) { + checkClass = (Class) listenerList[index]; + checkListener = (EventListener) listenerList[index + 1]; + if (checkClass.equals(t) == false || + checkListener.equals(listener) == false) { + list[pointer] = checkClass; + list[pointer + 1] = checkListener; + pointer += 2; + } else { + found = true; + } // if + } // for + + // Replace Listener List + if (found == true) { + listenerList = list; + } // if + + } // remove() + + /** + * Get a string representation + * @returns String representation + */ + public String toString() { + return null; // TODO + } // toString() + + +} // EventListenerList diff --git a/libjava/javax/swing/event/HyperlinkEvent.java b/libjava/javax/swing/event/HyperlinkEvent.java new file mode 100644 index 00000000000..ae356bb92a9 --- /dev/null +++ b/libjava/javax/swing/event/HyperlinkEvent.java @@ -0,0 +1,195 @@ +/* HyperlinkEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.net.*; +import java.util.*; + +/** + * HyperlinkEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class HyperlinkEvent extends EventObject { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * EventType + */ + public static final class EventType { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * ENTERED + */ + public static final EventType ENTERED = new EventType("ENTERED"); // TODO + + /** + * EXITED + */ + public static final EventType EXITED = new EventType("EXITED"); // TODO + + /** + * ACTIVATED + */ + public static final EventType ACTIVATED = new EventType("ACTIVATED"); // TODO + + /** + * type + */ + private String type; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor EventType + * @param type TODO + */ + private EventType(String type) { + this.type = type; + } // EventType() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public String toString() { + return type; // TODO + } // toString() + + + } // EventType + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * type + */ + private EventType type; + + /** + * url + */ + private URL url; + + /** + * description + */ + private String description; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor HyperlinkEvent + * @param source TODO + * @param type TODO + * @param url TODO + */ + public HyperlinkEvent(Object source, EventType type, URL url) { + super(source); + this.type = type; + this.url = url; + this.description = null; + } // HyperlinkEvent() + + /** + * Constructor HyperlinkEvent + * @param source TODO + * @param type TODO + * @param url TODO + * @param description TODO + */ + public HyperlinkEvent(Object source, EventType type, URL url, String description) { + super(source); + this.type = type; + this.url = url; + this.description = null; + } // HyperlinkEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getURL + * @returns URL + */ + public URL getURL() { + return url; + } // getURL() + + /** + * getEventType + * @returns EventType + */ + public EventType getEventType() { + return type; + } // getEventType() + + /** + * getDescription + * @returns String + */ + public String getDescription() { + return description; + } // getDescription() + + +} // HyperlinkEvent diff --git a/libjava/javax/swing/event/HyperlinkListener.java b/libjava/javax/swing/event/HyperlinkListener.java new file mode 100644 index 00000000000..6b6903b66f8 --- /dev/null +++ b/libjava/javax/swing/event/HyperlinkListener.java @@ -0,0 +1,57 @@ +/* HyperlinkListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * HyperlinkListener + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface HyperlinkListener extends EventListener { + + /** + * Hyperlink updated + * @param event Hyperlink Event + */ + public void hyperlinkUpdate(HyperlinkEvent event); + + +} // HyperlinkListener diff --git a/libjava/javax/swing/event/InternalFrameAdapter.java b/libjava/javax/swing/event/InternalFrameAdapter.java new file mode 100644 index 00000000000..d314cadc068 --- /dev/null +++ b/libjava/javax/swing/event/InternalFrameAdapter.java @@ -0,0 +1,112 @@ +/* InternalFrameAdapter.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +/** + * InternalFrameAdapter + * @author Andrew Selkirk + */ +public class InternalFrameAdapter extends Object + implements InternalFrameListener { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * InternalFrameAdapter constructor + */ + public InternalFrameAdapter() { + } // InternalFrameAdapter() + + + //------------------------------------------------------------- + // Interface: InternalFrameListener --------------------------- + //------------------------------------------------------------- + + /** + * Internal frame activated + * @param event Internal frame event + */ + public void internalFrameActivated(InternalFrameEvent event) { + } // internalFrameActivated() + + /** + * Internal frame closed + * @param event Internal frame event + */ + public void internalFrameClosed(InternalFrameEvent event) { + } // internalFrameClosed() + + /** + * Internal frame closing + * @param event Internal frame event + */ + public void internalFrameClosing(InternalFrameEvent event) { + } // internalFrameClosing() + + /** + * Internal frame deactivated + * @param event Internal frame event + */ + public void internalFrameDeactivated(InternalFrameEvent event) { + } // internalFrameDeactivated() + + /** + * Internal frame deiconified + * @param event Internal frame event + */ + public void internalFrameDeiconified(InternalFrameEvent event) { + } // internalFrameDeiconified() + + /** + * Internal frame iconified + * @param event Internal frame event + */ + public void internalFrameIconified(InternalFrameEvent event) { + } // internalFrameIconified() + + /** + * Internal frame opened + * @param event Internal frame event + */ + public void internalFrameOpened(InternalFrameEvent event) { + } // internalFrameOpened() + + +} // InternalFrameAdapter diff --git a/libjava/javax/swing/event/InternalFrameEvent.java b/libjava/javax/swing/event/InternalFrameEvent.java new file mode 100644 index 00000000000..f974cb52ff3 --- /dev/null +++ b/libjava/javax/swing/event/InternalFrameEvent.java @@ -0,0 +1,114 @@ +/* InternalFrameEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.awt.AWTEvent; +import javax.swing.JInternalFrame; + +/** + * InternalFrameEvent + * @author Andrew Selkirk + */ +public class InternalFrameEvent extends AWTEvent { + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * Internal frame activated event + */ + public static int INTERNAL_FRAME_ACTIVATED = 25554; + + /** + * Internal frame closed event + */ + public static int INTERNAL_FRAME_CLOSED = 25551; + + /** + * Internal frame closing event + */ + public static int INTERNAL_FRAME_CLOSING = 25550; + + /** + * Internal frame deactivated event + */ + public static int INTERNAL_FRAME_DEACTIVATED = 25555; + + /** + * Internal frame deiconifed event + */ + public static int INTERNAL_FRAME_DEICONIFIED = 25553; + + /** + * Internal frame frame first event + */ + public static int INTERNAL_FRAME_FIRST = 25549; + + /** + * Internal frame iconified event + */ + public static int INTERNAL_FRAME_ICONIFIED = 2552; + + /** + * Internal frame last event + */ + public static int INTERNAL_FRAME_LAST = 25555; + + /** + * Internal frame opened event + */ + public static int INTERNAL_FRAME_OPENED = 25550; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor InternalFrameEvent + * @param source JInternalFrame + * @param id Event ID + */ + public InternalFrameEvent(JInternalFrame source, int id) { + super(source, id); + } // InternalFrameEvent() + + +} // InternalFrameEvent diff --git a/libjava/javax/swing/event/InternalFrameListener.java b/libjava/javax/swing/event/InternalFrameListener.java new file mode 100644 index 00000000000..b9e1de3f5ad --- /dev/null +++ b/libjava/javax/swing/event/InternalFrameListener.java @@ -0,0 +1,92 @@ +/* InternalFrameListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * InternalFrameListener interface + * @author Andrew Selkirk + */ +public interface InternalFrameListener extends EventListener { + + /** + * Internal frame activated + * @param event Internal Frame Event + */ + public void internalFrameActivated(InternalFrameEvent event); + + /** + * Internal frame closed + * @param event Internal Frame Event + */ + public void internalFrameClosed(InternalFrameEvent event); + + /** + * Internal frame closing + * @param event Internal Frame Event + */ + public void internalFrameClosing(InternalFrameEvent event); + + /** + * Internal frame deactivated + * @param event Internal Frame Event + */ + public void internalFrameDeactivated(InternalFrameEvent event); + + /** + * Internal frame deiconified + * @param event Internal Frame Event + */ + public void internalFrameDeiconified(InternalFrameEvent event); + + /** + * Internal frame iconified + * @param event Internal Frame Event + */ + public void internalFrameIconified(InternalFrameEvent event); + + /** + * Internal frame opened + * @param event Internal Frame Event + */ + public void internalFrameOpened(InternalFrameEvent event); + + +} // InternalFrameListener diff --git a/libjava/javax/swing/event/ListDataEvent.java b/libjava/javax/swing/event/ListDataEvent.java new file mode 100644 index 00000000000..5849f7dc898 --- /dev/null +++ b/libjava/javax/swing/event/ListDataEvent.java @@ -0,0 +1,139 @@ +/* ListDataEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; + +/** + * ListDataEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class ListDataEvent extends EventObject { + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * Contents changed + */ + public static int CONTENTS_CHANGED = 0; + + /** + * Internal added + */ + public static int INTERVAL_ADDED = 1; + + /** + * Interval removed + */ + public static int INTERVAL_REMOVED = 2; + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * type + */ + private int type = 0; + + /** + * index0 + */ + private int index0 = 0; + + /** + * index1 + */ + private int index1 = 0; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ListDataEvent + * @param source Source + * @param type Event type + * @param index0 Bottom of range + * @param index1 Top of range + */ + public ListDataEvent(Object source, int type, + int index0, int index1) { + super(source); + this.type = type; + this.index0 = index0; + this.index1 = index1; + } // ListDataEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getIndex0 + * @returns index0 + */ + public int getIndex0() { + return index0; + } // getIndex0() + + /** + * getIndex1 + * @returns index1 + */ + public int getIndex1() { + return index1; + } // getIndex1() + + /** + * Event type + * @returns Event type + */ + public int getType() { + return type; + } // getType() + + +} // ListDataEvent diff --git a/libjava/javax/swing/event/ListDataListener.java b/libjava/javax/swing/event/ListDataListener.java new file mode 100644 index 00000000000..11c4089d03d --- /dev/null +++ b/libjava/javax/swing/event/ListDataListener.java @@ -0,0 +1,69 @@ +/* ListDataListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * ListDataListener interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface ListDataListener extends EventListener { + + /** + * Contents Changed + * @param event ListDataEvent Event + */ + public void contentsChanged(ListDataEvent event); + + /** + * Interval Added + * @param event ListDataEvent Event + */ + public void intervalAdded(ListDataEvent event); + + /** + * Interval Removed + * @param event ListDataEvent Event + */ + public void intervalRemoved(ListDataEvent event); + + +} // ListDataListener diff --git a/libjava/javax/swing/event/ListSelectionEvent.java b/libjava/javax/swing/event/ListSelectionEvent.java new file mode 100644 index 00000000000..c2289f0141f --- /dev/null +++ b/libjava/javax/swing/event/ListSelectionEvent.java @@ -0,0 +1,126 @@ +/* ListSelectionEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; + +/** + * ListSelectionEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class ListSelectionEvent extends EventObject { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * firstIndex + */ + private int firstIndex = 0; + + /** + * lastIndex + */ + private int lastIndex = 0; + + /** + * isAdjusting + */ + private boolean isAdjusting = false; + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ListSelectionEvent + * @param source Source + * @param firstIndex First index + * @param lastIndex Last index + * @param isAdjusting Is Adjusting? + */ + public ListSelectionEvent(Object source, int firstIndex, + int lastIndex, boolean isAdjusting) { + super(source); + this.firstIndex = firstIndex; + this.lastIndex = lastIndex; + this.isAdjusting = isAdjusting; + } // ListSelectionEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getFirstIndex + * @returns firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } // getFirstIndex() + + /** + * getLastIndex + * @returns lastIndex + */ + public int getLastIndex() { + return lastIndex; + } // getLastIndex() + + /** + * getValueIsAdjusting + * @returns isAdjusting + */ + public boolean getValueIsAdjusting() { + return isAdjusting; + } // getValueIsAdjusting() + + /** + * String representation + * @returns String representation + */ + public String toString() { + return null; // TODO + } // toString() + + +} // ListSelectionEvent diff --git a/libjava/javax/swing/event/ListSelectionListener.java b/libjava/javax/swing/event/ListSelectionListener.java new file mode 100644 index 00000000000..3b9e73acf0c --- /dev/null +++ b/libjava/javax/swing/event/ListSelectionListener.java @@ -0,0 +1,57 @@ +/* ListSelectionListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * ListSelectionListener interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface ListSelectionListener extends EventListener { + + /** + * Value changed + * @param event List Selection Event + */ + public void valueChanged(ListSelectionEvent event); + + +} // ListSelectionListener diff --git a/libjava/javax/swing/event/MenuDragMouseEvent.java b/libjava/javax/swing/event/MenuDragMouseEvent.java new file mode 100644 index 00000000000..b1eb841c4fe --- /dev/null +++ b/libjava/javax/swing/event/MenuDragMouseEvent.java @@ -0,0 +1,114 @@ +/* MenuDragMouseEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.awt.event.MouseEvent; +import java.awt.Component; +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; + +/** + * MenuDragMouseEvent + * @author Andrew Selkirk + */ +public class MenuDragMouseEvent extends MouseEvent { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * path + */ + private MenuElement[] path = null; + + /** + * manager + */ + private MenuSelectionManager manager = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor MenuDragMouseEvent + * @param source Source + * @param id MouseEvent type + * @param when Time + * @param modifiers Key modifiers + * @param x Horizontal position + * @param y Vertical position + * @param clickCount Click count + * @param popupTrigger Popup trigger? + * @param path Path + * @param manager MenuSelectionManager + */ + public MenuDragMouseEvent(Component source, int id, long when, int modifiers, + int x, int y, int clickCount, boolean popupTrigger, + MenuElement[] path, MenuSelectionManager manager) { + super(source, id, when, modifiers, x, y, clickCount, popupTrigger); + this.path = path; + this.manager = manager; + } // MenuDragMouseEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Get path + * @returns path + */ + public MenuElement[] getPath() { + return path; + } // getPath() + + /** + * Get menu selection manager + * @returns manager + */ + public MenuSelectionManager getMenuSelectionManager() { + return manager; + } // getMenuSelectionManager() + + +} // MenuDragMouseEvent diff --git a/libjava/javax/swing/event/MenuDragMouseListener.java b/libjava/javax/swing/event/MenuDragMouseListener.java new file mode 100644 index 00000000000..42b80a01e16 --- /dev/null +++ b/libjava/javax/swing/event/MenuDragMouseListener.java @@ -0,0 +1,74 @@ +/* MenuDragMouseListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * MenuDragMouseListener interface + * @author Andrew Selkirk + */ +public interface MenuDragMouseListener extends EventListener { + + /** + * Menu drag mouse dragged + * @param event Menu Drag Mouse Event + */ + public void menuDragMouseDragged(MenuDragMouseEvent event); + + /** + * Menu drag mouse entered + * @param event Menu Drag Mouse Event + */ + public void menuDragMouseEntered(MenuDragMouseEvent event); + + /** + * Menu drag mouse exited + * @param event Menu Drag Mouse Event + */ + public void menuDragMouseExited(MenuDragMouseEvent event); + + /** + * Menu drag mouse released + * @param event Menu Drag Mouse Event + */ + public void menuDragMouseReleased(MenuDragMouseEvent event); + + +} // MenuDragMouseListener diff --git a/libjava/javax/swing/event/MenuEvent.java b/libjava/javax/swing/event/MenuEvent.java new file mode 100644 index 00000000000..de81744737c --- /dev/null +++ b/libjava/javax/swing/event/MenuEvent.java @@ -0,0 +1,59 @@ +/* MenuEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; + +/** + * MenuEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class MenuEvent extends EventObject { + + /** + * Constructor MenuEvent + * @param source Source object + */ + public MenuEvent(Object source) { + super(source); + } // MenuEvent() + + +} // MenuEvent diff --git a/libjava/javax/swing/event/MenuKeyEvent.java b/libjava/javax/swing/event/MenuKeyEvent.java new file mode 100644 index 00000000000..34653366fbc --- /dev/null +++ b/libjava/javax/swing/event/MenuKeyEvent.java @@ -0,0 +1,112 @@ +/* MenuKeyEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.awt.Component; +import java.awt.event.KeyEvent; +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; + +/** + * MenuKeyEvent + * @author Andrew Selkirk + */ +public class MenuKeyEvent extends KeyEvent { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * path + */ + private MenuElement[] path = null; + + /** + * manager + */ + private MenuSelectionManager manager = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor MenuKeyEvent + * @param source Source + * @param id KeyEvent ID + * @param when Time + * @param modifiers Modifier keys + * @param keyCode Key code + * @param keyhar Key char + * @param path Path + * @param manager MenuSelectionManager + */ + public MenuKeyEvent(Component source, int id, long when, int modifiers, + int keyCode, char keyChar, MenuElement[] path, + MenuSelectionManager manager) { + super(source, id, when, modifiers, keyCode, keyChar); + this.path = path; + this.manager = manager; + } // MenuKeyEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getPath + * @returns path + */ + public MenuElement[] getPath() { + return path; + } // getPath() + + /** + * getMenuSelectionManager + * @returns MenuSelectionManager + */ + public MenuSelectionManager getMenuSelectionManager() { + return manager; + } // getMenuSelectionManager() + + +} // MenuKeyEvent diff --git a/libjava/javax/swing/event/MenuKeyListener.java b/libjava/javax/swing/event/MenuKeyListener.java new file mode 100644 index 00000000000..cc16668b522 --- /dev/null +++ b/libjava/javax/swing/event/MenuKeyListener.java @@ -0,0 +1,68 @@ +/* MenuKeyListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * MenuKeyListener interface + * @author Andrew Selkirk + */ +public interface MenuKeyListener extends EventListener { + + /** + * Menu key pressed + * @param event Menu Key Event + */ + public void menuKeyPressed(MenuKeyEvent event); + + /** + * Menu key released + * @param event Menu Key Event + */ + public void menuKeyReleased(MenuKeyEvent event); + + /** + * Menu key typed + * @param event Menu Key Event + */ + public void menuKeyTyped(MenuKeyEvent event); + + +} // MenuKeyListener diff --git a/libjava/javax/swing/event/MenuListener.java b/libjava/javax/swing/event/MenuListener.java new file mode 100644 index 00000000000..9cc66ae419a --- /dev/null +++ b/libjava/javax/swing/event/MenuListener.java @@ -0,0 +1,68 @@ +/* MenuListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * MenuListener interface + * @author Andrew Selkirk + */ +public interface MenuListener extends EventListener { + + /** + * Menu canceled + * @param event Menu Event + */ + public void menuCanceled(MenuEvent event); + + /** + * Menu deselected + * @param event Menu Event + */ + public void menuDeselected(MenuEvent event); + + /** + * Menu selected + * @param event Menu Event + */ + public void menuSelected(MenuEvent event); + + +} // MenuListener diff --git a/libjava/javax/swing/event/MouseInputAdapter.java b/libjava/javax/swing/event/MouseInputAdapter.java new file mode 100644 index 00000000000..087f01c17d6 --- /dev/null +++ b/libjava/javax/swing/event/MouseInputAdapter.java @@ -0,0 +1,115 @@ +/* MouseInputAdapter.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.awt.event.MouseEvent; + +/** + * MouseInputAdapter + * @author Andrew Selkirk + */ +public class MouseInputAdapter extends Object + implements MouseInputListener { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor MouseInputAdapter + */ + public MouseInputAdapter() { + } // MouseInputAdapter() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Mouse clicked + * @param event Mouse event + */ + public void mouseClicked(MouseEvent event) { + } // mouseClicked() + + /** + * Mouse dragged + * @param event Mouse event + */ + public void mouseDragged(MouseEvent event) { + } // mouseDragged() + + /** + * Mouse entered + * @param event Mouse event + */ + public void mouseEntered(MouseEvent event) { + } // mouseEntered() + + /** + * Mouse exited + * @param event Mouse event + */ + public void mouseExited(MouseEvent event) { + } // mouseExited() + + /** + * Mouse moved + * @param event Mouse event + */ + public void mouseMoved(MouseEvent event) { + } // mouseMoved() + + /** + * Mouse pressed + * @param event Mouse event + */ + public void mousePressed(MouseEvent event) { + } // mousePressed() + + /** + * Mouse released + * @param event Mouse event + */ + public void mouseReleased(MouseEvent event) { + } // mouseReleased() + + +} // MouseInputAdapterEvent diff --git a/libjava/javax/swing/event/MouseInputListener.java b/libjava/javax/swing/event/MouseInputListener.java new file mode 100644 index 00000000000..4dcd04237c5 --- /dev/null +++ b/libjava/javax/swing/event/MouseInputListener.java @@ -0,0 +1,52 @@ +/* MouseInputListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +/** + * MouseInputListener interface + * @author Andrew Selkirk + */ +public interface MouseInputListener extends MouseListener, + MouseMotionListener { + +} // MouseInputListener + diff --git a/libjava/javax/swing/event/PopupMenuEvent.java b/libjava/javax/swing/event/PopupMenuEvent.java new file mode 100644 index 00000000000..b51f74b51c1 --- /dev/null +++ b/libjava/javax/swing/event/PopupMenuEvent.java @@ -0,0 +1,58 @@ +/* PopupMenuEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; + +/** + * PopupMenuEvent + * @author Andrew Selkirk + */ +public class PopupMenuEvent extends EventObject { + + /** + * Constructor PopupMenuEvent + * @param source Source + */ + public PopupMenuEvent(Object source) { + super(source); + } // PopupMenuEvent() + + +} // PopupMenuEvent diff --git a/libjava/javax/swing/event/PopupMenuListener.java b/libjava/javax/swing/event/PopupMenuListener.java new file mode 100644 index 00000000000..36e0960bac3 --- /dev/null +++ b/libjava/javax/swing/event/PopupMenuListener.java @@ -0,0 +1,68 @@ +/* PopupMenuListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * PopupMenuListener interface + * @author Andrew Selkirk + */ +public interface PopupMenuListener extends EventListener { + + /** + * Popup Menu Canceled + * @param event Popup Menu Event + */ + public void popupMenuCanceled(PopupMenuEvent event); + + /** + * Popup Menu will become invisible + * @param event Popup Menu Event + */ + public void popupMenuWillBecomeInvisible(PopupMenuEvent event); + + /** + * Popup Menu will become visible + * @param event Popup Menu Event + */ + public void popupMenuWillBecomeVisible(PopupMenuEvent event); + + +} // PopupMenuListener diff --git a/libjava/javax/swing/event/SwingPropertyChangeSupport.java b/libjava/javax/swing/event/SwingPropertyChangeSupport.java new file mode 100644 index 00000000000..2bb0d64aca6 --- /dev/null +++ b/libjava/javax/swing/event/SwingPropertyChangeSupport.java @@ -0,0 +1,248 @@ +/* SwingPropertyChangeSupport.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.beans.*; +import java.io.*; +import java.util.*; + +/** + * SwingPropertyChangeSupport + * @author Andrew Selkirk +*/ +public final class SwingPropertyChangeSupport + extends PropertyChangeSupport { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * listeners + */ + private transient EventListenerList listeners; + + /** + * propertyListeners + */ + private Hashtable propertyListeners; + + /** + * source + */ + private Object source; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor SwingPropertyChangeSupport + * @param source TODO + */ + public SwingPropertyChangeSupport(Object source) { + super(source); + this.source = source; + this.listeners = new EventListenerList(); + this.propertyListeners = new Hashtable(); + } // SwingPropertyChangeSupport() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param stream TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream stream) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param stream TODO + * @exception ClassNotFoundException TODO + * @exception IOException TODO + */ + private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException { + // TODO + } // readObject() + + /** + * addPropertyChangeListener + * @param listener TODO + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(PropertyChangeListener.class, listener); + } // addPropertyChangeListener() + + /** + * addPropertyChangeListener + * @param propertyName TODO + * @param listener TODO + */ + public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + + // Variables + EventListenerList list; + + // Get Listener list + list = (EventListenerList) propertyListeners.get(propertyName); + if (list == null) { + list = new EventListenerList(); + propertyListeners.put(propertyName, list); + } // if + + // Add Listeners + list.add(PropertyChangeListener.class, listener); + + } // addPropertyChangeListener() + + /** + * removePropertyChangeListener + * @param listener TODO + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(PropertyChangeListener.class, listener); + } // removePropertyChangeListener() + + /** + * removePropertyChangeListener + * @param propertyName TODO + * @param listener TODO + */ + public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + + // Variables + EventListenerList list; + + // Get Listener list + list = (EventListenerList) propertyListeners.get(propertyName); + if (list == null) { + return; + } // if + + // Remove Listeners + list.remove(PropertyChangeListener.class, listener); + + // Clean up propertyListeners + if (list.getListenerCount() == 0) { + propertyListeners.remove(propertyName); + } // if + + } // removePropertyChangeListener() + + /** + * firePropertyChange + * @param propertyName TODO + * @param oldValue TODO + * @param newValue TODO + */ + public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + + // Variables + PropertyChangeEvent event; + + // Create Property Change Event + event = new PropertyChangeEvent(source, propertyName, oldValue, newValue); + + // Fire Event + firePropertyChange(event); + + } // firePropertyChange() + + /** + * firePropertyChange + * @param event TODO + */ + public void firePropertyChange(PropertyChangeEvent event) { + + // Variables + EventListenerList list; + EventListener[] listenerList; + int index; + PropertyChangeListener listener; + + // Check Values if they are equal + if (event.getOldValue() == null || event.getNewValue() == null || + event.getOldValue().equals(event.getNewValue()) == true) { + return; + } // if + + // Process Main Listener List + listenerList = listeners.getListeners(PropertyChangeListener.class); + for (index = 0; index < listenerList.length; index++) { + listener = (PropertyChangeListener) listenerList[index]; + listener.propertyChange(event); + } // for + + // Process Property Listener List + list = (EventListenerList) propertyListeners.get(event.getPropertyName()); + if (list != null) { + listenerList = list.getListeners(PropertyChangeListener.class); + for (index = 0; index < listenerList.length; index++) { + listener = (PropertyChangeListener) listenerList[index]; + listener.propertyChange(event); + } // for + } // if + + } // firePropertyChange() + + /** + * hasListeners + * @param propertyName TODO + * @returns boolean + */ + public synchronized boolean hasListeners(String propertyName) { + + // Get Listener list + if (propertyListeners.get(propertyName) == null) { + return false; + } // if + + return true; + + } // hasListeners() + + +} // SwingPropertyChangeSupport diff --git a/libjava/javax/swing/event/TableColumnModelEvent.java b/libjava/javax/swing/event/TableColumnModelEvent.java new file mode 100644 index 00000000000..2525dfc8487 --- /dev/null +++ b/libjava/javax/swing/event/TableColumnModelEvent.java @@ -0,0 +1,104 @@ +/* TableColumnModelEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; +import javax.swing.table.TableColumnModel; + +/** + * TableColumnModelEvent + * @author Andrew Selkirk + */ +public class TableColumnModelEvent extends EventObject { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * fromIndex + */ + protected int fromIndex = 0; + + /** + * toIndex + */ + protected int toIndex = 0; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TableColumnModelEvent + * @param source Source TableColumnModel + * @param from From index + * @param to To index + */ + public TableColumnModelEvent(TableColumnModel source, + int from, int to) { + super(source); + fromIndex = from; + toIndex = to; + } // TableColumnModelEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getFromIndex. + * @returns From index + */ + public int getFromIndex() { + return fromIndex; + } // getFromIndex() + + /** + * getToIndex. + * @returns To index + */ + public int getToIndex() { + return toIndex; + } // getToIndex() + + +} // TableColumnModelEvent diff --git a/libjava/javax/swing/event/TableColumnModelListener.java b/libjava/javax/swing/event/TableColumnModelListener.java new file mode 100644 index 00000000000..8271507b48a --- /dev/null +++ b/libjava/javax/swing/event/TableColumnModelListener.java @@ -0,0 +1,80 @@ +/* TableColumnModelListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * TableColumnModelListener interface + * @author Andrew Selkirk + */ +public interface TableColumnModelListener extends EventListener { + + /** + * Column added + * @param event Table Column Model Event + */ + public void columnAdded(TableColumnModelEvent event); + + /** + * Column margin changed + * @param event Change Event + */ + public void columnMarginChanged(ChangeEvent event); + + /** + * Column moved + * @param event Table Column Model Event + */ + public void columnMoved(TableColumnModelEvent event); + + /** + * Column removed + * @param event Table Column Model Event + */ + public void columnRemoved(TableColumnModelEvent event); + + /** + * Column selection changed + * @param event List Selection Event + */ + public void columnSelectionChanged(ListSelectionEvent event); + + +} // TableColumnModelListener diff --git a/libjava/javax/swing/event/TableModelEvent.java b/libjava/javax/swing/event/TableModelEvent.java new file mode 100644 index 00000000000..2316c28a75c --- /dev/null +++ b/libjava/javax/swing/event/TableModelEvent.java @@ -0,0 +1,204 @@ +/* TableModelEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; +import javax.swing.table.TableModel; + +/** + * TableModelEvent + * @author Andrew Selkirk + */ +public class TableModelEvent extends EventObject { + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * ALL_COLUMNS + */ + public static int ALL_COLUMNS = -1; + + /** + * DELETE + */ + public static int DELETE = -1; + + /** + * HEADER_ROW + */ + public static int HEADER_ROW = -1; + + /** + * INSERT + */ + public static int INSERT = 1; + + /** + * UPDATE + */ + public static int UPDATE = 0; + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * column + */ + protected int column = 0; + + /** + * firstRow + */ + protected int firstRow = 0; + + /** + * lastRow + */ + protected int lastRow = 0; + + /** + * type + */ + protected int type = 0; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TableModelEvent + * @param source Source object + */ + public TableModelEvent(TableModel source) { + this(source, 0, source.getRowCount(), ALL_COLUMNS, UPDATE); + } // TableModelEvent() + + /** + * Constructor TableModelEvent + * @param source Source table model + * @param row Updated row + */ + public TableModelEvent(TableModel source, int row) { + this(source, row, row, ALL_COLUMNS, UPDATE); + } // TableModelEvent() + + /** + * Constructor TableModelEvent + * @param source Source table model + * @param firstRow First row of update + * @param lastRow Last row of update + */ + public TableModelEvent(TableModel source, int firstRow, + int lastRow) { + this(source, firstRow, lastRow, ALL_COLUMNS, UPDATE); + } // TableModelEvent() + + /** + * Constructor TableModelEvent + * @param source Source table model + * @param firstRow First row of update + * @param lastRow Last row of update + * @param column Affected column + */ + public TableModelEvent(TableModel source, int firstRow, + int lastRow, int column) { + this(source, firstRow, lastRow, column, UPDATE); + } // TableModelEvent() + + /** + * Constructor TableModelEvent + * @param source Source table model + * @param firstRow First row of update + * @param lastRow Last row of update + * @param column Affected column + * @param type Type of change + */ + public TableModelEvent(TableModel source, int firstRow, + int lastRow, int column, int type) { + super(source); + this.firstRow = firstRow; + this.lastRow = lastRow; + this.column = column; + this.type = type; + } // TableModelEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getColumn + * @returns column + */ + public int getColumn() { + return column; + } // getColumn() + + /** + * getFirstRow + * @returns row + */ + public int getFirstRow() { + return firstRow; + } // getFirstRow() + + /** + * getLastRow + * @returns row + */ + public int getLastRow() { + return lastRow; + } // getLastRow() + + /** + * Get type + * @returns Type of event + */ + public int getType() { + return type; + } // getType() + + +} // TableModelEvent diff --git a/libjava/javax/swing/event/TableModelListener.java b/libjava/javax/swing/event/TableModelListener.java new file mode 100644 index 00000000000..5a4399e753a --- /dev/null +++ b/libjava/javax/swing/event/TableModelListener.java @@ -0,0 +1,55 @@ +/* TableModelListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +import java.util.EventListener; + +/** + * TableModelListener interface + * @author Andrew Selkirk + */ +public interface TableModelListener extends EventListener { + + /** + * Table changed + * @param event Table Model Event + */ + public void tableChanged(TableModelEvent event); + + +} // TableModelListener diff --git a/libjava/javax/swing/event/TreeExpansionEvent.java b/libjava/javax/swing/event/TreeExpansionEvent.java new file mode 100644 index 00000000000..ee8b7c017c6 --- /dev/null +++ b/libjava/javax/swing/event/TreeExpansionEvent.java @@ -0,0 +1,88 @@ +/* TreeExpansionEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; +import javax.swing.tree.TreePath; + +/** + * TreeExpansionEvent + * @author Andrew Selkirk + */ +public class TreeExpansionEvent extends EventObject { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * path + */ + protected TreePath path = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TreeExpansionEvent + * @param source Source object + * @param path Path + */ + public TreeExpansionEvent(Object source, TreePath path) { + super(source); + this.path = path; + } // TreeExpansionEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getPath + * @returns Tree path + */ + public TreePath getPath() { + return path; + } // getPath() + + +} // TreeExpansionEvent diff --git a/libjava/javax/swing/event/TreeExpansionListener.java b/libjava/javax/swing/event/TreeExpansionListener.java new file mode 100644 index 00000000000..3263f3688be --- /dev/null +++ b/libjava/javax/swing/event/TreeExpansionListener.java @@ -0,0 +1,62 @@ +/* TreeExpansionListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * TreeExpansionListener interface + * @author Andrew Selkirk + */ +public interface TreeExpansionListener extends EventListener { + + /** + * Tree collapsed + * @param event Tree Expansion Event + */ + public void treeCollapsed(TreeExpansionEvent event); + + /** + * Tree expanded + * @param event Tree Expansion Event + */ + public void treeExpanded(TreeExpansionEvent event); + + +} // TreeExpansionListener diff --git a/libjava/javax/swing/event/TreeModelEvent.java b/libjava/javax/swing/event/TreeModelEvent.java new file mode 100644 index 00000000000..625dfe0c594 --- /dev/null +++ b/libjava/javax/swing/event/TreeModelEvent.java @@ -0,0 +1,170 @@ +/* TreeModelEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventObject; +import javax.swing.tree.TreePath; + +/** + * TreeModelEvent + * @author Andrew Selkirk + */ +public class TreeModelEvent extends EventObject { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * childIndices + */ + protected int[] childIndices = new int[0]; + + /** + * children + */ + protected Object[] children = new Object[0]; + + /** + * path + */ + protected TreePath path = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path + */ + public TreeModelEvent(Object source, Object[] path) { + super(source); + this.path = new TreePath(path); + } // TreeModelEvent() + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path path + * @param childIndices Child indices + * @param children Children + */ + public TreeModelEvent(Object source, Object[] path, + int[] childIndices, Object[] children) { + super(source); + this.path = new TreePath(path); + this.childIndices = childIndices; + this.children = children; + } // TreeModelEvent() + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path Path + */ + public TreeModelEvent(Object source, TreePath path) { + super(source); + this.path = path; + } // TreeModelEvent() + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path Path + * @param childIndices Child indices + * @param children Children + */ + public TreeModelEvent(Object source, TreePath path, + int[] childIndices, Object[] children) { + super(source); + this.path = path; + this.childIndices = childIndices; + this.children = children; + } // TreeModelEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getChildIndices + * @returns child indices + */ + public int[] getChildIndices() { + return childIndices; + } // getChildIndices() + + /** + * getChildren + * @returns children + */ + public Object[] getChildren() { + return children; + } // getChildren() + + /** + * getPath + * @returns path + */ + public Object[] getPath() { + return path.getPath(); + } // getPath() + + /** + * getTreePath + * @returns TreePath + */ + public TreePath getTreePath() { + return path; + } // getTreePath() + + /** + * String representation + * @returns String representation + */ + public String toString() { + return null; // TODO + } // toString() + + +} // TreeModelEvent diff --git a/libjava/javax/swing/event/TreeModelListener.java b/libjava/javax/swing/event/TreeModelListener.java new file mode 100644 index 00000000000..f240d6ba1ad --- /dev/null +++ b/libjava/javax/swing/event/TreeModelListener.java @@ -0,0 +1,74 @@ +/* TreeModelListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * TreeModelListener interface + * @author Andrew Selkirk + */ +public interface TreeModelListener extends EventListener { + + /** + * Tree nodes changed + * @param event Tree Model Event + */ + public void treeNodesChanged(TreeModelEvent event); + + /** + * Tree nodes inserted + * @param event Tree Model Event + */ + public void treeNodesInserted(TreeModelEvent event); + + /** + * Tree nodes removed + * @param event Tree Model Event + */ + public void treeNodesRemoved(TreeModelEvent event); + + /** + * Tree structured changed + * @param event Tree Model Event + */ + public void treeStructureChanged(TreeModelEvent event); + + +} // TreeModelListener diff --git a/libjava/javax/swing/event/TreeSelectionEvent.java b/libjava/javax/swing/event/TreeSelectionEvent.java new file mode 100644 index 00000000000..f53730fd645 --- /dev/null +++ b/libjava/javax/swing/event/TreeSelectionEvent.java @@ -0,0 +1,189 @@ +/* TreeSelectionEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.*; +import javax.swing.tree.*; + +/** + * TreeSelectionEvent + * @author Andrew Selkirk + * @version 1.0 + */ +public class TreeSelectionEvent extends EventObject { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * paths + */ + protected TreePath[] paths; + + /** + * areNew + */ + protected boolean[] areNew; + + /** + * oldLeadSelectionPath + */ + protected TreePath oldLeadSelectionPath; + + /** + * newLeadSelectionPath + */ + protected TreePath newLeadSelectionPath; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TreeSelectionEvent + * @param source TODO + * @param paths TODO + * @param areNew TODO + * @param oldLeadSelectionPath TODO + * @param newLeadSelectionPath TODO + */ + public TreeSelectionEvent(Object source, TreePath[] paths, + boolean[] areNew, TreePath oldLeadSelectionPath, + TreePath newLeadSelectionPath) { + super(source); + this.paths = paths; + this.areNew = areNew; + this.oldLeadSelectionPath = oldLeadSelectionPath; + this.newLeadSelectionPath = newLeadSelectionPath; + } // TreeSelectionEvent() + + /** + * Constructor TreeSelectionEvent + * @param source TODO + * @param paths TODO + * @param areNew TODO + * @param oldLeadSelectionPath TODO + * @param newLeadSelectionPath TODO + */ + public TreeSelectionEvent(Object source, TreePath path, + boolean isNew, TreePath oldLeadSelectionPath, + TreePath newLeadSelectionPath) { + super(source); +//TODO this.paths = new TreePath[1]{path}; +//TODO this.areNew = new boolean[1]{isNew}; + this.oldLeadSelectionPath = oldLeadSelectionPath; + this.newLeadSelectionPath = newLeadSelectionPath; + } // TreeSelectionEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getPath + * @returns TreePath + */ + public TreePath getPath() { + return paths[0]; + } // getPath() + + /** + * getPaths + * @returns TreePath[] + */ + public TreePath[] getPaths() { + return paths; + } // getPaths() + + /** + * isAddedPath + * @returns boolean + */ + public boolean isAddedPath() { + return false; // TODO + } // isAddedPath() + + /** + * isAddedPath + * @param path TODO + * @returns boolean + */ + public boolean isAddedPath(TreePath path) { + return false; // TODO + } // isAddedPath() + + /** + * isAddedPath + * @param index TODO + * @returns boolean + */ + public boolean isAddedPath(int index) { + return false; // TODO + } // isAddedPath() + + /** + * getOldLeadSelectionPath + * @returns TreePath + */ + public TreePath getOldLeadSelectionPath() { + return oldLeadSelectionPath; + } // getOldLeadSelectionPath() + + /** + * getNewLeadSelectionPath + * @returns TreePath + */ + public TreePath getNewLeadSelectionPath() { + return newLeadSelectionPath; + } // getNewLeadSelectionPath() + + /** + * cloneWithSource + * @param source TODO + * @returns Object + */ + public Object cloneWithSource(Object source) { + return null; // TODO + } // cloneWithSource() + + +} // TreeSelectionEvent diff --git a/libjava/javax/swing/event/TreeSelectionListener.java b/libjava/javax/swing/event/TreeSelectionListener.java new file mode 100644 index 00000000000..1657b222961 --- /dev/null +++ b/libjava/javax/swing/event/TreeSelectionListener.java @@ -0,0 +1,56 @@ +/* TreeSelectionListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * TreeSelectionListener interface + * @author Andrew Selkirk + */ +public interface TreeSelectionListener extends EventListener { + + /** + * Value changed + * @param event Tree Selection Event + */ + public void valueChanged(TreeSelectionEvent event); + + +} // TreeSelectionListener diff --git a/libjava/javax/swing/event/TreeWillExpandListener.java b/libjava/javax/swing/event/TreeWillExpandListener.java new file mode 100644 index 00000000000..c70c6c6d4a5 --- /dev/null +++ b/libjava/javax/swing/event/TreeWillExpandListener.java @@ -0,0 +1,62 @@ +/* TreeWillExpandListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * TreeWillExpandListener interface + * @author Andrew Selkirk + */ +public interface TreeWillExpandListener extends EventListener { + + /** + * Tree will collapse + * @param event Tree Expansion Event + */ + public void treeWillCollapse(TreeExpansionEvent event); + + /** + * Tree will expand + * @param event Tree Expansion Event + */ + public void treeWillExpand(TreeExpansionEvent event); + + +} // TreeWillExpandListener diff --git a/libjava/javax/swing/event/UndoableEditEvent.java b/libjava/javax/swing/event/UndoableEditEvent.java new file mode 100644 index 00000000000..43ed56a4953 --- /dev/null +++ b/libjava/javax/swing/event/UndoableEditEvent.java @@ -0,0 +1,89 @@ +/* UndoableEditEvent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.*; +import javax.swing.undo.*; + +/** + * UndoableEditEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class UndoableEditEvent extends EventObject { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * edit + */ + private UndoableEdit edit; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UndoableEditEvent + * @param source TODO + * @param edit TODO + */ + public UndoableEditEvent(Object source, UndoableEdit edit) { + super(source); + this.edit = edit; + } // UndoableEditEvent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getEdit + * @returns UndoableEdit + */ + public UndoableEdit getEdit() { + return edit; + } // getEdit() + + +} // UndoableEditEvent diff --git a/libjava/javax/swing/event/UndoableEditListener.java b/libjava/javax/swing/event/UndoableEditListener.java new file mode 100644 index 00000000000..40784071346 --- /dev/null +++ b/libjava/javax/swing/event/UndoableEditListener.java @@ -0,0 +1,57 @@ +/* UndoableEditListener.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +// Imports +import java.util.EventListener; + +/** + * UndoableEditListener interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface UndoableEditListener extends EventListener { + + /** + * Undoable edit has happened + * @param event Undoable Edit Event + */ + public void undoableEditHappened(UndoableEditEvent event); + + +} // UndoableEditListener diff --git a/libjava/javax/swing/filechooser/FileFilter.java b/libjava/javax/swing/filechooser/FileFilter.java new file mode 100644 index 00000000000..9f624b3c814 --- /dev/null +++ b/libjava/javax/swing/filechooser/FileFilter.java @@ -0,0 +1,80 @@ +/* FileFilter.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.filechooser; + +// Imports +import java.io.*; + +/** + * FileFilter + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class FileFilter { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FileFilter + */ + public FileFilter() { + // TODO + } // FileFilter() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * accept + * @param file TODO + * @returns boolean + */ + public abstract boolean accept(File file); + + /** + * getDescription + * @returns String + */ + public abstract String getDescription(); + + +} // FileFilter diff --git a/libjava/javax/swing/filechooser/FileSystemView.java b/libjava/javax/swing/filechooser/FileSystemView.java new file mode 100644 index 00000000000..20abe09259c --- /dev/null +++ b/libjava/javax/swing/filechooser/FileSystemView.java @@ -0,0 +1,149 @@ +/* FileSystemView.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.filechooser; + +// Imports +import java.io.*; + +/** + * FileSystemView + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class FileSystemView { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FileSystemView + */ + public FileSystemView() { + // TODO + } // FileSystemView() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getFileSystemView + * @returns FileSystemView + */ + public static FileSystemView getFileSystemView() { + return null; // TODO + } // getFileSystemView() + + /** + * isRoot + * @param file TODO + * @returns boolean + */ + public abstract boolean isRoot(File file); + + /** + * createNewFolder + * @param file TODO + * @exception IOException TODO + * @returns File + */ + public abstract File createNewFolder(File file) throws IOException; + + /** + * isHiddenFile + * @param file TODO + * @returns boolean + */ + public abstract boolean isHiddenFile(File file); + + /** + * getRoots + * @returns File[] + */ + public abstract File[] getRoots(); + + /** + * getHomeDirectory + * @returns File + */ + public File getHomeDirectory() { + return null; // TODO + } // getHomeDirectory() + + /** + * createFileObject + * @param directory TODO + * @param filename TODO + * @returns File + */ + public File createFileObject(File directory, String filename) { + return null; // TODO + } // createFileObject() + + /** + * createFileObject + * @param path TODO + * @returns File + */ + public File createFileObject(String path) { + return null; // TODO + } // createFileObject() + + /** + * getFiles + * @param directory TODO + * @param fileHiding TODO + * @returns File[] + */ + public File[] getFiles(File directory, boolean fileHiding) { + return null; // TODO + } // getFiles() + + /** + * getParentDirectory + * @param directory TODO + * @returns File + */ + public File getParentDirectory(File directory) { + return null; // TODO + } // getParentDirectory() + + +} // FileSystemView diff --git a/libjava/javax/swing/filechooser/FileView.java b/libjava/javax/swing/filechooser/FileView.java new file mode 100644 index 00000000000..77d28eb6bba --- /dev/null +++ b/libjava/javax/swing/filechooser/FileView.java @@ -0,0 +1,113 @@ +/* FileView.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.filechooser; + +// Imports +import java.io.*; +import javax.swing.*; + +/** + * FileView + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class FileView { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FileView + */ + public FileView() { + // TODO + } // FileView() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getName + * @param file TODO + * @returns String + */ + public String getName(File file) { + return null; // TODO + } // getName() + + /** + * getDescription + * @param value0 TODO + * @returns String + */ + public String getDescription(File value0) { + return null; // TODO + } // getDescription() + + /** + * getTypeDescription + * @param value0 TODO + * @returns String + */ + public String getTypeDescription(File value0) { + return null; // TODO + } // getTypeDescription() + + /** + * getIcon + * @param value0 TODO + * @returns Icon + */ + public Icon getIcon(File value0) { + return null; // TODO + } // getIcon() + + /** + * isTraversable + * @param value0 TODO + * @returns Boolean + */ + public Boolean isTraversable(File value0) { + return null; // TODO + } // isTraversable() + + +} // FileView diff --git a/libjava/javax/swing/plaf/ActionMapUIResource.java b/libjava/javax/swing/plaf/ActionMapUIResource.java new file mode 100644 index 00000000000..cd9771b2dbb --- /dev/null +++ b/libjava/javax/swing/plaf/ActionMapUIResource.java @@ -0,0 +1,62 @@ +/* ActionMapUIResource.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import javax.swing.*; + +/** + * ActionMapUIResource + * @author Andrew Selkirk + * @version 1.0 + */ +public class ActionMapUIResource extends ActionMap implements UIResource { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ActionMapUIResource + */ + public ActionMapUIResource() { + // TODO + } // ActionMapUIResource() + + +} // ActionMapUIResource diff --git a/libjava/javax/swing/plaf/BorderUIResource.java b/libjava/javax/swing/plaf/BorderUIResource.java new file mode 100644 index 00000000000..2ec1fe59d0d --- /dev/null +++ b/libjava/javax/swing/plaf/BorderUIResource.java @@ -0,0 +1,275 @@ +/* BorderUIResource.java + Copyright (C) 1999 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; +import javax.swing.border.*; +import javax.swing.Icon; +import java.io.Serializable; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Font; +import java.awt.Color; + +/** + * @serial + * @serialField delegate Border the <code>Border</code> wrapped + * @author Brian Jones + */ +public class BorderUIResource + extends Object + implements Border, UIResource, Serializable +{ + private Border delegate; + + /** + * Creates a <code>UIResource</code> wrapper for a <code>Border</code> + * object. + * + * @param delegate the border to be wrapped + */ + public BorderUIResource(Border delegate) + { + this.delegate = delegate; + } + + /** + */ + public static Border getEtchedBorderUIResource() { + return null; + } + + /** + */ + public static Border getLoweredBevelBorderUIResource() { + return null; + } + + /** + */ + public static Border getRaisedBevelBorderUIResource() { + return null; + } + + /** + */ + public static Border getBlackLineBorderUIResource() { + return null; + } + + /** + */ + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) { } + + /** + */ + public Insets getBorderInsets(Component c) { + return null; + } + + /** + */ + public boolean isBorderOpaque() { + return false; + } + + /** + * @serial + */ + public static class BevelBorderUIResource + extends BevelBorder + implements UIResource, Serializable + { + public BevelBorderUIResource(int bevelType) + { + + } + + public BevelBorderUIResource(int bevelType, + Color highlight, + Color shadow) + { + this(bevelType); + } + public BevelBorderUIResource(int bevelType, + Color highlightOuter, + Color highlightInner, + Color shadowOuter, + Color shadowInner) + { + this(bevelType); + } + } + + /** + * @serial + */ + public static class CompoundBorderUIResource + extends CompoundBorder + implements UIResource, Serializable + { + public CompoundBorderUIResource(Border outsideBorder, + Border insideBorder) + { + + } + } + + /** + * @serial + */ + public static class EmptyBorderUIResource + extends EmptyBorder + implements UIResource, Serializable + { + public EmptyBorderUIResource(int top, int left, int bottom, int right) + { + this(new Insets(top,left,bottom,right)); + } + + public EmptyBorderUIResource(Insets insets) + { + + } + } + + /** + * @serial + */ + public static class EtchedBorderUIResource + extends EtchedBorder + implements UIResource, Serializable + { + public EtchedBorderUIResource() { } + public EtchedBorderUIResource(int etchType) + { + + } + public EtchedBorderUIResource(Color highlight, Color shadow) + { + + } + public EtchedBorderUIResource(int etchType, Color highlight, + Color shadow) + { + + } + + } + + /** + * @serial + */ + public static class LineBorderUIResource + extends LineBorder + implements UIResource, Serializable + { + public LineBorderUIResource(Color color) + { + + } + public LineBorderUIResource(Color color, + int thickness) + { + + } + } + + /** + * @serial + */ + public static class MatteBorderUIResource + extends MatteBorder + implements UIResource, Serializable + { + public MatteBorderUIResource(int top, int left, int bottom, + int right, Color color) + { + + } + public MatteBorderUIResource(int top, int left, int bottom, + int right, Icon tileIcon) + { + + } + public MatteBorderUIResource(Icon tileIcon) + { + + } + } + + /** + * @serial + */ + public static class TitledBorderUIResource + extends TitledBorder + implements UIResource, Serializable + { + TitledBorderUIResource(String title) + { + + } + TitledBorderUIResource(Border border) + { + + } + TitledBorderUIResource(Border border, String title) + { + + } + TitledBorderUIResource(Border border, String title, + int titleJustification, int titlePosition) + { + + } + TitledBorderUIResource(Border border, String title, + int titleJustification, int titlePosition, + Font titleFont) + { + + } + TitledBorderUIResource(Border border, String title, + int titleJustification, int titlePosition, + Font titleFont, Color titleColor) + { + + } + } +} + diff --git a/libjava/javax/swing/plaf/ButtonUI.java b/libjava/javax/swing/plaf/ButtonUI.java new file mode 100644 index 00000000000..74fd1924416 --- /dev/null +++ b/libjava/javax/swing/plaf/ButtonUI.java @@ -0,0 +1,5 @@ +package javax.swing.plaf; + +public class ButtonUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/ColorChooserUI.java b/libjava/javax/swing/plaf/ColorChooserUI.java new file mode 100644 index 00000000000..e2a839ac28d --- /dev/null +++ b/libjava/javax/swing/plaf/ColorChooserUI.java @@ -0,0 +1,59 @@ +/* ColorChooserUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ColorChooserUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ColorChooserUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ColorChooserUI + */ + public ColorChooserUI() { + // TODO + } // ColorChooserUI() + + +} // ColorChooserUI diff --git a/libjava/javax/swing/plaf/ColorUIResource.java b/libjava/javax/swing/plaf/ColorUIResource.java new file mode 100644 index 00000000000..86ac7b1e5a2 --- /dev/null +++ b/libjava/javax/swing/plaf/ColorUIResource.java @@ -0,0 +1,24 @@ +package javax.swing.plaf; +import java.awt.Color; +/** + * STUBBED + */ +public class ColorUIResource extends Color implements UIResource +{ + public ColorUIResource(Color c) + { + super(c.getRGB()); + } + public ColorUIResource(float r, float g, float b) + { + super(r, g, b, 1.0f); + } + public ColorUIResource(int rgb) + { + super(rgb, false); + } + public ColorUIResource(int r, int g, int b) + { + super(r, g, b, 255); + } +} // class ColorUIResource diff --git a/libjava/javax/swing/plaf/ComboBoxUI.java b/libjava/javax/swing/plaf/ComboBoxUI.java new file mode 100644 index 00000000000..9c045e6f8c3 --- /dev/null +++ b/libjava/javax/swing/plaf/ComboBoxUI.java @@ -0,0 +1,88 @@ +/* ComboBoxUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import javax.swing.*; + +/** + * ComboBoxUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ComboBoxUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ComboBoxUI + */ + public ComboBoxUI() { + // TODO + } // ComboBoxUI() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setPopupVisible + * @param combobox TODO + * @param visible TODO + */ + public abstract void setPopupVisible(JComboBox combobox, boolean visible); + + /** + * isPopupVisible + * @param combobox TODO + * @returns boolean + */ + public abstract boolean isPopupVisible(JComboBox combobox); + + /** + * isFocusTraversable + * @param combobox TODO + * @returns boolean + */ + public abstract boolean isFocusTraversable(JComboBox combobox); + + +} // ComboBoxUI diff --git a/libjava/javax/swing/plaf/ComponentInputMapUIResource.java b/libjava/javax/swing/plaf/ComponentInputMapUIResource.java new file mode 100644 index 00000000000..376da1ada8c --- /dev/null +++ b/libjava/javax/swing/plaf/ComponentInputMapUIResource.java @@ -0,0 +1,64 @@ +/* ComponentInputMapUIResource.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import javax.swing.*; + +/** + * ComponentInputMapUIResource + * @author Andrew Selkirk + * @version 1.0 + */ +public class ComponentInputMapUIResource extends ComponentInputMap implements UIResource { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ComponentInputMapUIResource + * @param component TODO + */ + public ComponentInputMapUIResource(JComponent component) { + super(component); + // TODO + } // ComponentInputMapUIResource() + + +} // ComponentInputMapUIResource diff --git a/libjava/javax/swing/plaf/ComponentUI.java b/libjava/javax/swing/plaf/ComponentUI.java new file mode 100644 index 00000000000..cdccbabbe48 --- /dev/null +++ b/libjava/javax/swing/plaf/ComponentUI.java @@ -0,0 +1,88 @@ +package javax.swing.plaf; + +import java.awt.*; +import javax.swing.border.*; +import javax.swing.*; + +import javax.accessibility.*; + +public abstract class ComponentUI + implements UIResource // ?? +{ + boolean contains(JComponent c, int x, int y) + { + return c.inside(x,y); + } + + // this SHOULD thow an error: + public static ComponentUI createUI(JComponent c) + { + Exception e = new Exception("createUI from ComponentUI should never be called"); + e.printStackTrace(); + System.exit(1); + return null; + } + + public Accessible getAccessibleChild(JComponent c, int i) + { + //Return the nth Accessible child of the object. + return null; + } + + public int getAccessibleChildrenCount(JComponent c) + { + //Returns the number of accessible children in the object. + return 0; + } + + public Dimension getMaximumSize(JComponent c) + { + return getPreferredSize(c); + } + + public Dimension getMinimumSize(JComponent c) + { + return getPreferredSize(c); + } + + public Dimension getPreferredSize(JComponent c) + { + return null; + } + + public void installUI(JComponent c) + { + String id = c.getUIClassID() + ".border"; + + Border s = UIManager.getBorder( id ); + + if (s != null) + { + c.setBorder( s ); + //System.out.println("OK-INSTALL: " + this + ", ID=" + id + ",B="+s); + } + else + { + ///System.out.println("FAIL-INSTALL: " + this + ", " + id); + } + } + + public void paint(Graphics g, JComponent c) + { + // System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this); + } + + public void uninstallUI(JComponent c) + { + } + + public void update(Graphics g, JComponent c) { + if (c.isOpaque()) { + g.setColor(c.getBackground()); + g.fillRect(0, 0, c.getWidth(),c.getHeight()); + } + paint(g, c); + } + +} + diff --git a/libjava/javax/swing/plaf/DesktopIconUI.java b/libjava/javax/swing/plaf/DesktopIconUI.java new file mode 100644 index 00000000000..880fa43915c --- /dev/null +++ b/libjava/javax/swing/plaf/DesktopIconUI.java @@ -0,0 +1,59 @@ +/* DesktopIconUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * DesktopIconUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class DesktopIconUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DesktopIconUI + */ + public DesktopIconUI() { + // TODO + } // DesktopIconUI() + + +} // DesktopIconUI diff --git a/libjava/javax/swing/plaf/DesktopPaneUI.java b/libjava/javax/swing/plaf/DesktopPaneUI.java new file mode 100644 index 00000000000..9cb278839fb --- /dev/null +++ b/libjava/javax/swing/plaf/DesktopPaneUI.java @@ -0,0 +1,59 @@ +/* DesktopPaneUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * DesktopPaneUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class DesktopPaneUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DesktopPaneUI + */ + public DesktopPaneUI() { + // TODO + } // DesktopPaneUI() + + +} // DesktopPaneUI diff --git a/libjava/javax/swing/plaf/DimensionUIResource.java b/libjava/javax/swing/plaf/DimensionUIResource.java new file mode 100644 index 00000000000..5fe2ec8e170 --- /dev/null +++ b/libjava/javax/swing/plaf/DimensionUIResource.java @@ -0,0 +1,12 @@ +package javax.swing.plaf; +import java.awt.Dimension; +/** + * STUBBED + */ +public class DimensionUIResource extends Dimension implements UIResource +{ + public DimensionUIResource(int w, int h) + { + super(w, h); + } +} // class DimensionUIResource diff --git a/libjava/javax/swing/plaf/FileChooserUI.java b/libjava/javax/swing/plaf/FileChooserUI.java new file mode 100644 index 00000000000..00595eb7c66 --- /dev/null +++ b/libjava/javax/swing/plaf/FileChooserUI.java @@ -0,0 +1,111 @@ +/* FileChooserUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.io.*; +import javax.swing.*; +import javax.swing.filechooser.*; +import javax.swing.filechooser.FileFilter; + +/** + * FileChooserUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class FileChooserUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FileChooserUI + */ + public FileChooserUI() { + // TODO + } // FileChooserUI() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getAcceptAllFileFilter + * @param chooser TODO + * @returns FileFilter + */ + public abstract FileFilter getAcceptAllFileFilter(JFileChooser chooser); + + /** + * getFileView + * @param chooser TODO + * @returns FileView + */ + public abstract FileView getFileView(JFileChooser chooser); + + /** + * getApproveButtonText + * @param chooser TODO + * @returns String + */ + public abstract String getApproveButtonText(JFileChooser chooser); + + /** + * getDialogTitle + * @param chooser TODO + * @returns String + */ + public abstract String getDialogTitle(JFileChooser chooser); + + /** + * rescanCurrentDirectory + * @param value0 TODO + */ + public abstract void rescanCurrentDirectory(JFileChooser chooser); + + /** + * ensureFileIsVisible + * @param chooser TODO + * @param file TODO + */ + public abstract void ensureFileIsVisible(JFileChooser chooser, File file); + + +} // FileChooserUI diff --git a/libjava/javax/swing/plaf/FontUIResource.java b/libjava/javax/swing/plaf/FontUIResource.java new file mode 100644 index 00000000000..46bca96e483 --- /dev/null +++ b/libjava/javax/swing/plaf/FontUIResource.java @@ -0,0 +1,16 @@ +package javax.swing.plaf; +import java.awt.Font; +/** + * STUBBED + */ +public class FontUIResource extends Font implements UIResource +{ + public FontUIResource(Font f) + { + super(f.getName(), f.getStyle(), f.getSize()); + } + public FontUIResource(String name, int style, int size) + { + super(name, style, size); + } +} // class FontUIResource diff --git a/libjava/javax/swing/plaf/IconUIResource.java b/libjava/javax/swing/plaf/IconUIResource.java new file mode 100644 index 00000000000..02f1ea0725c --- /dev/null +++ b/libjava/javax/swing/plaf/IconUIResource.java @@ -0,0 +1,25 @@ +package javax.swing.plaf; +import java.awt.Component; +import java.awt.Graphics; +import java.io.Serializable; +import javax.swing.Icon; +/** + * STUBBED + */ +public class IconUIResource implements Icon, UIResource, Serializable +{ + public IconUIResource(Icon delegate) + { + } + public void paintIcon(Component c, Graphics g, int x, int y) + { + } + public int getIconWidth() + { + return 0; + } + public int getIconHeight() + { + return 0; + } +} // class IconUIResource diff --git a/libjava/javax/swing/plaf/InputMapUIResource.java b/libjava/javax/swing/plaf/InputMapUIResource.java new file mode 100644 index 00000000000..4d6793bd0a8 --- /dev/null +++ b/libjava/javax/swing/plaf/InputMapUIResource.java @@ -0,0 +1,62 @@ +/* InputMapUIResource.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import javax.swing.*; + +/** + * InputMapUIResource + * @author Andrew Selkirk + * @version 1.0 + */ +public class InputMapUIResource extends InputMap implements UIResource { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor InputMapUIResource + */ + public InputMapUIResource() { + // TODO + } // InputMapUIResource() + + +} // InputMapUIResource diff --git a/libjava/javax/swing/plaf/InsetsUIResource.java b/libjava/javax/swing/plaf/InsetsUIResource.java new file mode 100644 index 00000000000..4c5e3183a7b --- /dev/null +++ b/libjava/javax/swing/plaf/InsetsUIResource.java @@ -0,0 +1,12 @@ +package javax.swing.plaf; +import java.awt.Insets; +/** + * STUBBED + */ +public class InsetsUIResource extends Insets implements UIResource +{ + public InsetsUIResource(int top, int left, int bottom, int right) + { + super(top, left, bottom, right); + } +} // class InsetsUIResource diff --git a/libjava/javax/swing/plaf/InternalFrameUI.java b/libjava/javax/swing/plaf/InternalFrameUI.java new file mode 100644 index 00000000000..3019460c74a --- /dev/null +++ b/libjava/javax/swing/plaf/InternalFrameUI.java @@ -0,0 +1,59 @@ +/* InternalFrameUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * InternalFrameUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class InternalFrameUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor InternalFrameUI + */ + public InternalFrameUI() { + // TODO + } // InternalFrameUI() + + +} // InternalFrameUI diff --git a/libjava/javax/swing/plaf/LabelUI.java b/libjava/javax/swing/plaf/LabelUI.java new file mode 100644 index 00000000000..759550abdf7 --- /dev/null +++ b/libjava/javax/swing/plaf/LabelUI.java @@ -0,0 +1,6 @@ +package javax.swing.plaf; + + +public class LabelUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/ListUI.java b/libjava/javax/swing/plaf/ListUI.java new file mode 100644 index 00000000000..69c2396d08a --- /dev/null +++ b/libjava/javax/swing/plaf/ListUI.java @@ -0,0 +1,6 @@ +package javax.swing.plaf; + + +public class ListUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/MenuBarUI.java b/libjava/javax/swing/plaf/MenuBarUI.java new file mode 100644 index 00000000000..84c29d13ef5 --- /dev/null +++ b/libjava/javax/swing/plaf/MenuBarUI.java @@ -0,0 +1,59 @@ +/* MenuBarUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * MenuBarUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class MenuBarUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor MenuBarUI + */ + public MenuBarUI() { + // TODO + } // MenuBarUI() + + +} // MenuBarUI diff --git a/libjava/javax/swing/plaf/MenuItemUI.java b/libjava/javax/swing/plaf/MenuItemUI.java new file mode 100644 index 00000000000..a9271219c83 --- /dev/null +++ b/libjava/javax/swing/plaf/MenuItemUI.java @@ -0,0 +1,59 @@ +/* MenuItemUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * MenuItemUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class MenuItemUI extends ButtonUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor MenuItemUI + */ + public MenuItemUI() { + // TODO + } // MenuItemUI() + + +} // MenuItemUI diff --git a/libjava/javax/swing/plaf/OptionPaneUI.java b/libjava/javax/swing/plaf/OptionPaneUI.java new file mode 100644 index 00000000000..01a10d1f2f1 --- /dev/null +++ b/libjava/javax/swing/plaf/OptionPaneUI.java @@ -0,0 +1,6 @@ +package javax.swing.plaf; +import javax.accessibility.*; + +public class OptionPaneUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/PanelUI.java b/libjava/javax/swing/plaf/PanelUI.java new file mode 100644 index 00000000000..b884acec3d0 --- /dev/null +++ b/libjava/javax/swing/plaf/PanelUI.java @@ -0,0 +1,6 @@ +package javax.swing.plaf; + + +public class PanelUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/PopupMenuUI.java b/libjava/javax/swing/plaf/PopupMenuUI.java new file mode 100644 index 00000000000..d1faa78d146 --- /dev/null +++ b/libjava/javax/swing/plaf/PopupMenuUI.java @@ -0,0 +1,76 @@ +/* PopupMenuUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.event.*; + +/** + * PopupMenuUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class PopupMenuUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor PopupMenuUI + */ + public PopupMenuUI() { + // TODO + } // PopupMenuUI() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * isPopupTrigger + * @param event TODO + * @returns boolean + */ + public boolean isPopupTrigger(MouseEvent event) { + return false; // TODO + } // isPopupTrigger() + + +} // PopupMenuUI diff --git a/libjava/javax/swing/plaf/ProgressBarUI.java b/libjava/javax/swing/plaf/ProgressBarUI.java new file mode 100644 index 00000000000..c5f6466e7ab --- /dev/null +++ b/libjava/javax/swing/plaf/ProgressBarUI.java @@ -0,0 +1,59 @@ +/* ProgressBarUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ProgressBarUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ProgressBarUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ProgressBarUI + */ + public ProgressBarUI() { + // TODO + } // ProgressBarUI() + + +} // ProgressBarUI diff --git a/libjava/javax/swing/plaf/RootPaneUI.java b/libjava/javax/swing/plaf/RootPaneUI.java new file mode 100644 index 00000000000..53529fa6e89 --- /dev/null +++ b/libjava/javax/swing/plaf/RootPaneUI.java @@ -0,0 +1,59 @@ +/* RootPaneUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * RootPaneUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class RootPaneUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor RootPaneUI + */ + public RootPaneUI() { + // TODO + } // RootPaneUI() + + +} // RootPaneUI diff --git a/libjava/javax/swing/plaf/ScrollBarUI.java b/libjava/javax/swing/plaf/ScrollBarUI.java new file mode 100644 index 00000000000..0d778f3daa4 --- /dev/null +++ b/libjava/javax/swing/plaf/ScrollBarUI.java @@ -0,0 +1,59 @@ +/* ScrollBarUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ScrollBarUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ScrollBarUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ScrollBarUI + */ + public ScrollBarUI() { + // TODO + } // ScrollBarUI() + + +} // ScrollBarUI diff --git a/libjava/javax/swing/plaf/ScrollPaneUI.java b/libjava/javax/swing/plaf/ScrollPaneUI.java new file mode 100644 index 00000000000..3b36b08012b --- /dev/null +++ b/libjava/javax/swing/plaf/ScrollPaneUI.java @@ -0,0 +1,59 @@ +/* ScrollPaneUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ScrollPaneUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ScrollPaneUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ScrollPaneUI + */ + public ScrollPaneUI() { + // TODO + } // ScrollPaneUI() + + +} // ScrollPaneUI diff --git a/libjava/javax/swing/plaf/SeparatorUI.java b/libjava/javax/swing/plaf/SeparatorUI.java new file mode 100644 index 00000000000..23622a06286 --- /dev/null +++ b/libjava/javax/swing/plaf/SeparatorUI.java @@ -0,0 +1,59 @@ +/* SeparatorUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * SeparatorUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class SeparatorUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor SeparatorUI + */ + public SeparatorUI() { + // TODO + } // SeparatorUI() + + +} // SeparatorUI diff --git a/libjava/javax/swing/plaf/SliderUI.java b/libjava/javax/swing/plaf/SliderUI.java new file mode 100644 index 00000000000..59d51c10d51 --- /dev/null +++ b/libjava/javax/swing/plaf/SliderUI.java @@ -0,0 +1,59 @@ +/* SliderUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * SliderUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class SliderUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor SliderUI + */ + public SliderUI() { + // TODO + } // SliderUI() + + +} // SliderUI diff --git a/libjava/javax/swing/plaf/SplitPaneUI.java b/libjava/javax/swing/plaf/SplitPaneUI.java new file mode 100644 index 00000000000..6448ba86653 --- /dev/null +++ b/libjava/javax/swing/plaf/SplitPaneUI.java @@ -0,0 +1,111 @@ +/* SplitPaneUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import javax.swing.*; + +/** + * SplitPaneUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class SplitPaneUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor SplitPaneUI + */ + public SplitPaneUI() { + // TODO + } // SplitPaneUI() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * resetToPreferredSizes + * @param splitpane TODO + */ + public abstract void resetToPreferredSizes(JSplitPane splitpane); + + /** + * setDividerLocation + * @param splitpane TODO + * @param location TODO + */ + public abstract void setDividerLocation(JSplitPane splitpane, + int location); + + /** + * getDividerLocation + * @param splitpane TODO + * @returns int + */ + public abstract int getDividerLocation(JSplitPane splitpane); + + /** + * getMinimumDividerLocation + * @param splitpane TODO + * @returns int + */ + public abstract int getMinimumDividerLocation(JSplitPane splitpane); + + /** + * getMaximumDividerLocation + * @param splitpane TODO + * @returns int + */ + public abstract int getMaximumDividerLocation(JSplitPane splitpane); + + /** + * finishedPaintingChildren + * @param splitpane TODO + * @param graphics TODO + */ + public abstract void finishedPaintingChildren(JSplitPane splitpane, + Graphics graphics); + + +} // SplitPaneUI diff --git a/libjava/javax/swing/plaf/TabbedPaneUI.java b/libjava/javax/swing/plaf/TabbedPaneUI.java new file mode 100644 index 00000000000..748ab580224 --- /dev/null +++ b/libjava/javax/swing/plaf/TabbedPaneUI.java @@ -0,0 +1,23 @@ +package javax.swing.plaf; + +import java.awt.*; +import javax.swing.*; + +public class TabbedPaneUI extends ComponentUI +{ + public Rectangle getTabBounds(JTabbedPane pane, int index) + { + return null; + } + + public int getTabRunCount(JTabbedPane pane) + { + return 0; + } + + public int tabForCoordinate(JTabbedPane pane, int x, int y) + { + return 0; + } +} + diff --git a/libjava/javax/swing/plaf/TableHeaderUI.java b/libjava/javax/swing/plaf/TableHeaderUI.java new file mode 100644 index 00000000000..4510be588ea --- /dev/null +++ b/libjava/javax/swing/plaf/TableHeaderUI.java @@ -0,0 +1,59 @@ +/* TableHeaderUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * TableHeaderUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class TableHeaderUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TableHeaderUI + */ + public TableHeaderUI() { + // TODO + } // TableHeaderUI() + + +} // TableHeaderUI diff --git a/libjava/javax/swing/plaf/TableUI.java b/libjava/javax/swing/plaf/TableUI.java new file mode 100644 index 00000000000..473e04ebad4 --- /dev/null +++ b/libjava/javax/swing/plaf/TableUI.java @@ -0,0 +1,59 @@ +/* TableUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * TableUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class TableUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TableUI + */ + public TableUI() { + // TODO + } // TableUI() + + +} // TableUI diff --git a/libjava/javax/swing/plaf/TextUI.java b/libjava/javax/swing/plaf/TextUI.java new file mode 100644 index 00000000000..46fa2ca61b5 --- /dev/null +++ b/libjava/javax/swing/plaf/TextUI.java @@ -0,0 +1,26 @@ +package javax.swing.plaf; + +import javax.swing.text.*; +import java.awt.*; + +public abstract class TextUI extends ComponentUI +{ + public TextUI() + { + } + + public abstract void damageRange(JTextComponent t, int p0, int p1); + public abstract void damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, Position.Bias secondBias); + public abstract EditorKit getEditorKit(JTextComponent t); + public abstract int getNextVisualPositionFrom(JTextComponent t, + int pos, + Position.Bias b, + int direction, + Position.Bias[] biasRet); + public abstract View getRootView(JTextComponent t); + public abstract Rectangle modelToView(JTextComponent t, int pos); + public abstract Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias); + public abstract int viewToModel(JTextComponent t, Point pt); + public abstract int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn); + +} diff --git a/libjava/javax/swing/plaf/ToolBarUI.java b/libjava/javax/swing/plaf/ToolBarUI.java new file mode 100644 index 00000000000..80d0d1db317 --- /dev/null +++ b/libjava/javax/swing/plaf/ToolBarUI.java @@ -0,0 +1,59 @@ +/* ToolBarUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ToolBarUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ToolBarUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ToolBarUI + */ + public ToolBarUI() { + // TODO + } // ToolBarUI() + + +} // ToolBarUI diff --git a/libjava/javax/swing/plaf/ToolTipUI.java b/libjava/javax/swing/plaf/ToolTipUI.java new file mode 100644 index 00000000000..f325fd0f718 --- /dev/null +++ b/libjava/javax/swing/plaf/ToolTipUI.java @@ -0,0 +1,59 @@ +/* ToolTipUI.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * ToolTipUI + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class ToolTipUI extends ComponentUI { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ToolTipUI + */ + public ToolTipUI() { + // TODO + } // ToolTipUI() + + +} // ToolTipUI diff --git a/libjava/javax/swing/plaf/TreeUI.java b/libjava/javax/swing/plaf/TreeUI.java new file mode 100644 index 00000000000..48323750dc1 --- /dev/null +++ b/libjava/javax/swing/plaf/TreeUI.java @@ -0,0 +1,6 @@ +package javax.swing.plaf; + + +public class TreeUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/UIResource.java b/libjava/javax/swing/plaf/UIResource.java new file mode 100644 index 00000000000..8eca939a1da --- /dev/null +++ b/libjava/javax/swing/plaf/UIResource.java @@ -0,0 +1,55 @@ +/* UIResource.java + Copyright (C) 1999 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * This interface is used to designate which objects were created by + * <code>ComponentUI</code> delegates. When uninstalling the user interface + * renderer with <code>ComponentUI.uninstallUI()</code> the renderer + * property is set to <code>null</code>. + * <br> + * A comparison against null can be used with all properties except for + * the <code>java.awt.Component</code> properties font, foreground, and + * background. The container can provide the value of the properties if + * they are initialized or set to <code>null</code>. + * + * @author Brian Jones + * @see java.lang.ComponentUI + */ +public interface UIResource { } diff --git a/libjava/javax/swing/plaf/ViewportUI.java b/libjava/javax/swing/plaf/ViewportUI.java new file mode 100644 index 00000000000..5562973910a --- /dev/null +++ b/libjava/javax/swing/plaf/ViewportUI.java @@ -0,0 +1,6 @@ +package javax.swing.plaf; + + +public class ViewportUI extends ComponentUI +{ +} diff --git a/libjava/javax/swing/plaf/basic/BasicBorders.java b/libjava/javax/swing/plaf/basic/BasicBorders.java new file mode 100644 index 00000000000..80d66a72b80 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicBorders.java @@ -0,0 +1,42 @@ +package javax.swing.plaf.basic; +import java.awt.Color; +/** + * STUBBED + */ +public class BasicBorders +{ + public static class ButtonBorder + { + } // class ButtonBorder + public static class FieldBorder + { + public FieldBorder(Color shadow, Color darkShadow, + Color highlight, Color lightHighlight) + { + } + } // class FieldBorder + public static class MarginBorder + { + } // class MarginBorder + public static class MenuBarBorder + { + public MenuBarBorder(Color shadow, Color highlight) + { + } + } // class MenuBarBorder + public static class RadioButtonBorder + { + } // class RadioButtonBorder + public static class RolloverButtonBorder + { + } // class RolloverButtonBorder + public static class SplitPaneBorder + { + public SplitPaneBorder(Color highlight, Color shadow) + { + } + } // class SplitPaneBorder + public static class ToggleButtonBorder + { + } // class ToggleButtonBorder +} // class BasicBorders diff --git a/libjava/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/javax/swing/plaf/basic/BasicButtonUI.java new file mode 100644 index 00000000000..88ac6f25ae2 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicButtonUI.java @@ -0,0 +1,177 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import javax.swing.plaf.*; +import java.awt.*; + + +public class BasicButtonUI extends ButtonUI +{ + int gap = 3; + // int y_text_space = 2, x_text_space + 5; + + Color textColor, disabledTextColor; + Color pressedBackgroundColor; + Color normalBackgroundColor; + + + public static ComponentUI createUI(final JComponent c) + { + return new BasicButtonUI(); + } + + + public void installUI(final JComponent c) + { + super.installUI(c); + + textColor = new Color(0,0,0); + disabledTextColor = new Color(130, 130, 130); + pressedBackgroundColor = new Color(150,150,150); + pressedBackgroundColor = new Color(150,150,150); + normalBackgroundColor = new Color(192,192,192); + } + + + public Dimension getPreferredSize(JComponent c) + { + AbstractButton b = (AbstractButton)c; + Dimension d = BasicGraphicsUtils.getPreferredSize(b, + gap, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getHorizontalTextPosition(), + b.getVerticalTextPosition()); + // System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text); + return d; + } + + + public void paint(Graphics g, JComponent c) + { + AbstractButton b = (AbstractButton) c; + + Rectangle tr = new Rectangle(); + Rectangle ir = new Rectangle(); + Rectangle vr = new Rectangle(); + + Font f = c.getFont(); + + g.setFont(f); + + FontMetrics fm = SwingUtilities.getFontMetrics(f); + + Insets i = c.getInsets(); + + vr.x = i.left; + vr.y = i.top; + vr.width = b.getWidth() - (i.right + vr.x); + vr.height = b.getHeight() - (i.bottom + vr.y); + + //System.out.println(" VIEW-RECT-BUTTON="+vr+", insets="+i+", FONTM="+fm); + + String text = SwingUtilities.layoutCompoundLabel(c, + fm, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getVerticalTextPosition(), + b.getHorizontalTextPosition(), + vr, + ir, + tr, + gap); + + if (b.getModel().isPressed() || + b.getModel().isSelected()) + { + //System.out.println("paint pressed"); + paintButtonPressed(g, c); + } + else + { + //System.out.println("paint normal"); + paintButtonNormal(g, c); + } + + paintIcon(g, c, ir); + paintText(g, c, tr, b.getText()); + paintFocus(g, c, vr, tr, ir); + } + + + protected void paintFocus(Graphics g, + JComponent c, + Rectangle vr, + Rectangle tr, + Rectangle ir) + { + } + + protected void paintIcon(Graphics g, + JComponent c, + Rectangle iconRect) + { + AbstractButton b = (AbstractButton) c; + if (b.getIcon() != null) + { + int x = iconRect.x; + int y = iconRect.y; + + System.out.println("WE HAVE AN ICON: " + b.getIcon()); + + b.getIcon().paintIcon(c, g, x, y); + } + else + { + //System.out.println("NO ICON FOR BUTTON:" + b.text); + } + } + + protected void paintButtonPressed(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + g.setColor(pressedBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + } + + protected void paintButtonNormal(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + g.setColor(normalBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + } + + protected void paintText(Graphics g, + JComponent c, + Rectangle textRect, + String text) + { + Font f = c.getFont(); + + g.setFont(f); + + FontMetrics fm = SwingUtilities.getFontMetrics(f); + + g.setColor(c.isEnabled() ? textColor : disabledTextColor); + + BasicGraphicsUtils.drawString(g, + text, + 0, + textRect.x, + textRect.y + fm.getAscent()/2); + } +} + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java b/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java new file mode 100644 index 00000000000..1a84b1faa2c --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java @@ -0,0 +1,88 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import javax.swing.plaf.*; +import java.awt.*; + + +public class BasicCheckBoxUI extends BasicRadioButtonUI +{ + public static ComponentUI createUI(final JComponent c) { + return new BasicCheckBoxUI(); + } + + + public void installUI(final JComponent c) { + super.installUI(c); + } + + public Dimension getPreferredSize(JComponent c) + { + AbstractButton b = (AbstractButton)c; + Dimension d = BasicGraphicsUtils.getPreferredSize(b, + gap, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getHorizontalTextPosition(), + b.getVerticalTextPosition()); + + //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text); + return d; + } + + protected void paintFocus(Graphics g, + JComponent c, + Rectangle vr, + Rectangle tr, + Rectangle ir) + { + } + + protected void paintIcon(Graphics g, + JComponent c, + Rectangle iconRect) + { + } + + protected void paintButtonPressed(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + g.setColor(pressedBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + } + + protected void paintButtonNormal(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + g.setColor(normalBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + } + protected void paintText(Graphics g, + JComponent c, + Rectangle textRect, + String text) + { + // AbstractButton b = (AbstractButton) c; + + // System.out.println("drawing string: " + text + ", at:" + textRect); + + g.setColor(textColor); + BasicGraphicsUtils.drawString(g, + text, + 0, + textRect.x, + textRect.y); + } +} + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicDefaults.java b/libjava/javax/swing/plaf/basic/BasicDefaults.java new file mode 100644 index 00000000000..b3dd865ce8b --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicDefaults.java @@ -0,0 +1,82 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import java.awt.*; +import javax.swing.border.*; + +class BasicBorder extends MatteBorder +{ + static Color BtnPointClr = new Color( 180, 180, 180); + + BasicBorder() + { + super(5,5,5,5, null); + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + // System.out.println("PAINT-------------------------------------------BORDER"); + + if (g != null) + { + g.setColor( BtnPointClr); + g.draw3DRect( 0, 0, width-1, height-1, true); + } + } + } + +class PanelBorder extends MatteBorder +{ + PanelBorder() + { + super(5,5,5,5, null); + } + + public void paintBorder(Component c, + Graphics g, + int x, + int y, + int width, + int height) + { + // System.out.println("PAINT-------------------------------------------BORDER"); + super.paintBorder(c, g, x, y, width, height); + } + } + +public class BasicDefaults extends UIDefaults +{ + public BasicDefaults() + { + // System.out.println("BasicDefaults !!!!!!!!!!!!!!!!!!!!!!!!!"); + put("JButton", new BasicButtonUI()); + put("JLabel", new BasicLabelUI()); + + put("JPanel", new BasicPanelUI()); + put("JCheckBox", new BasicCheckBoxUI()); + put("JRadioButton", new BasicRadioButtonUI()); + put("JToggleButton", new BasicToggleButtonUI()); + put("JOptionPane", new BasicOptionPaneUI()); + put("JList", new BasicListUI()); + put("JTree", new BasicTreeUI()); + put("JTextComponent", new BasicTextUI()); + put("JTabbedPane", new BasicTabbedPaneUI()); + put("JScrollPane", new BasicScrollPaneUI()); + put("JViewport", new BasicViewportUI()); + + put("JButton.border", new BasicBorder()); + put("JPanel.border", new PanelBorder()); + + put("JToggleButton.border", new PanelBorder()); + put("JCheckBox.border", new PanelBorder()); + put("JRadioButton.border", new PanelBorder()); + } + +} + + diff --git a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java new file mode 100644 index 00000000000..10b7209f5dd --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java @@ -0,0 +1,77 @@ +package javax.swing.plaf.basic; + + +import java.awt.*; +import javax.swing.*; + + +public class BasicGraphicsUtils +{ + public static Dimension getPreferredSize(JComponent b, + int gap, + String text, + Icon icon, + int va, + int ha, + int htp, + int vtp) + { + JComponent c = b; + // this is a staight copy from BasicButtonUI.paint() + // + Rectangle tr = new Rectangle(); + Rectangle ir = new Rectangle(); + Rectangle vr = new Rectangle(); + + Font f = c.getFont(); + + FontMetrics fm = SwingUtilities.getFontMetrics(f); + + Insets i = c.getInsets(); + + vr.x = i.left; + vr.y = i.top; + vr.width = b.getWidth() - (i.right + i.left); + vr.height = b.getHeight() - (i.bottom + i.top); + + // System.out.println(" VIEW-RECT-BUTTON="+vr+", insets="+i); + + String tt = SwingUtilities.layoutCompoundLabel(b, + fm, + text, + icon, + va, + ha, + vtp, + htp, + vr, + ir, + tr, + gap); + + Rectangle r = ir.union(tr); + + Insets insets = b.getInsets(); + r.width += insets.left + insets.right; + r.height += insets.top + insets.bottom; + + // System.out.println("COMPUTED SIZE FOR PREF_SIZE="+r); + + return r.getSize(); + } + + public static void drawString(Graphics g, + String text, + int underlinedChar, + int x, + int y) + { + g.drawString(text, x, y); + } +} + + + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/javax/swing/plaf/basic/BasicIconFactory.java new file mode 100644 index 00000000000..347a1cc8a8b --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicIconFactory.java @@ -0,0 +1,45 @@ +package javax.swing.plaf.basic; + +import java.io.Serializable; +import javax.swing.Icon; +/** + * STUBBED + */ +public class BasicIconFactory implements Serializable +{ + public BasicIconFactory() + { + } + public static Icon getMenuItemCheckIcon() + { + return null; + } + public static Icon getMenuItemArrowIcon() + { + return null; + } + public static Icon getMenuArrowIcon() + { + return null; + } + public static Icon getCheckBoxIcon() + { + return null; + } + public static Icon getRadioButtonIcon() + { + return null; + } + public static Icon getCheckBoxMenuItemIcon() + { + return null; + } + public static Icon getRadioButtonMenuItemIcon() + { + return null; + } + public static Icon createEmptyFrameIcon() + { + return null; + } +} // class BasicIconFactory diff --git a/libjava/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/javax/swing/plaf/basic/BasicLabelUI.java new file mode 100644 index 00000000000..22bdc54aaab --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicLabelUI.java @@ -0,0 +1,158 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import javax.swing.plaf.*; +import java.awt.*; + + +public class BasicLabelUI extends LabelUI +{ + int gap = 3; + + Color foreground; + + + public static ComponentUI createUI(final JComponent c) { + return new BasicLabelUI(); + } + + + public void installUI(final JComponent c) { + super.installUI(c); + + foreground = new Color(0,0,250); + } + + + public Dimension getPreferredSize(JComponent c) + { + JLabel b = (JLabel)c; + Dimension d = BasicGraphicsUtils.getPreferredSize(b, + gap, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getHorizontalTextPosition(), + b.getVerticalTextPosition()); + System.out.println("JLABEL->^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.getText()); + return d; + } + + + public void paint(Graphics g, JComponent c) + { + JLabel b = (JLabel) c; + + Rectangle tr = new Rectangle(); + Rectangle ir = new Rectangle(); + Rectangle vr = new Rectangle(); + + Font f = c.getFont(); + + g.setFont(f); + + FontMetrics fm = SwingUtilities.getFontMetrics(f); + + Insets i = c.getInsets(); + + Rectangle bound = c.getBounds(); + + System.out.println("BOUND=" + bound + ", insets = " + i + ", " + b.getText()); + + if (bound == null) + { + vr.x = i.left; + vr.y = i.top; + vr.width = b.getWidth() - (i.right + i.left); + vr.height = b.getHeight() - (i.bottom + i.top); + } + else + { + vr.x = bound.x + i.left; + vr.y = bound.y + i.top; + vr.width = bound.width - (i.right + i.left); + vr.height = bound.height - (i.bottom + i.top); + } + + System.out.println(" VIEW-RECT-JLABEL="+vr+", insets="+i+", FONTM="+fm); + + String text = SwingUtilities.layoutCompoundLabel(c, + fm, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getVerticalTextPosition(), + b.getHorizontalTextPosition(), + vr, + ir, + tr, + gap); + + paintIcon(g, c, ir); + paintText(g, c, tr, b.getText()); + paintFocus(g, c, vr, tr, ir); + } + + + protected void paintFocus(Graphics g, + JComponent c, + Rectangle vr, + Rectangle tr, + Rectangle ir) + { + } + + protected void paintIcon(Graphics g, + JComponent c, + Rectangle iconRect) + { + JLabel b = (JLabel) c; + if (b.getIcon() != null) + { + int x = iconRect.x; + int y = iconRect.y; + + System.out.println("WE HAVE AN ICON: " + b.getIcon()); + + b.getIcon().paintIcon(c, g, x, y); + } + else + { + //System.out.println("NO ICON FOR BUTTON:" + b.text); + } + } + + + protected void paintText(Graphics g, + JComponent c, + Rectangle textRect, + String text) + { + // AbstractLabel b = (AbstractLabel) c; + + System.out.println("JLabel: drawing string: " + text + ", at:" + textRect); + + g.setColor(foreground); + //g.setBackColor(new Color(190,190,190)); + + g.drawLine(0,0,100,100); + + BasicGraphicsUtils.drawString(g, + text, + 0, + 0,//textRect.x, + 0);//textRect.y); + } +} + + + + + + + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicListUI.java b/libjava/javax/swing/plaf/basic/BasicListUI.java new file mode 100644 index 00000000000..abac5045031 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicListUI.java @@ -0,0 +1,132 @@ +package javax.swing.plaf.basic; + +import javax.swing.plaf.*; +import javax.swing.*; +import java.awt.*; + + +public class BasicListUI extends ListUI +{ + int gap_between_cells; + Color textColor, disabledTextColor, pressedBackgroundColor, normalBackgroundColor; + + + public static ComponentUI createUI(final JComponent c) + { + return new BasicButtonUI(); + } + + + public void installUI(final JComponent c) + { + super.installUI(c); + + textColor = new Color(0,0,0); + disabledTextColor = new Color(130, 130, 130); + pressedBackgroundColor = new Color(150,150,150); + normalBackgroundColor = new Color(192,192,192); + } + + public Dimension getPreferredSize(JComponent c) + { + JList l = (JList) c; + + System.out.println("XXXXXXXXXXXXXXXxx getPreferredSize------------> " + l); + + + int rows = l.getVisibleRowCount(); + + ListCellRenderer render = l.getCellRenderer(); + + int width = 200; + int height = rows * 16; + + if (l.getModel().getSize() == 0) + { + return new Dimension(width, height); + } + + System.out.println("BASIC_LIST_UI ====-> " + l.getModel().getElementAt(0)); + + Component elt = render.getListCellRendererComponent(l, + l.getModel().getElementAt(0), + 0, + false, + false); + Dimension a = elt.getPreferredSize(); + if (a == null) + { + return new Dimension(width, height); + } + + return new Dimension(a.width, + a.height * rows); + } + + public void paintBackground(Graphics g, + JComponent c) + { + Dimension size = getPreferredSize(c); + + g.setColor(normalBackgroundColor); + g.fillRect(0,0,size.width, size.height); + } + + public void paint(Graphics g, + JComponent c) + { + JList l = (JList) c; + + int rows = l.getVisibleRowCount(); + + ListCellRenderer render = l.getCellRenderer(); + + System.out.println("RENDER-JLIST: " + rows + ", " + l.getModel().getSize()); + + paintBackground(g, c); + + if (l.getModel().getSize() == 0) + return; + + // use element 0 to figure out how big we are: + Component elt = render.getListCellRendererComponent(l, + l.getModel().getElementAt(0), + 0, + false, + false); + Dimension dim = elt.getPreferredSize(); + + Rectangle a = new Rectangle(0, + 0, + dim.width, + dim.height); + + for (int i=0;i<l.getModel().getSize();i++) + { + boolean is_sel = false; + boolean has_focus = false; + + Component comp = render.getListCellRendererComponent(l, + l.getModel().getElementAt(i), + i, + is_sel, + has_focus); + + //System.out.println("AAAAA=> " + a + ", " + comp + ", index = " + i); + + comp.setBounds(a); + + comp.paint(g); + + a.y += dim.height + gap_between_cells; + } + } +} + + + + + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java new file mode 100644 index 00000000000..7655ea3b23a --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java @@ -0,0 +1,927 @@ +/* BasicLookAndFeel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.basic; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.KeyEvent; +import java.io.Serializable; +import java.util.Enumeration; +import java.util.ResourceBundle; +import javax.swing.ImageIcon; +import javax.swing.KeyStroke; +import javax.swing.LookAndFeel; +import javax.swing.UIDefaults; +import javax.swing.plaf.BorderUIResource; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.DimensionUIResource; +import javax.swing.plaf.FontUIResource; +import javax.swing.plaf.IconUIResource; +import javax.swing.plaf.InsetsUIResource; +import javax.swing.text.JTextComponent; + +/** + * BasicLookAndFeel + * @author Andrew Selkirk + */ +public abstract class BasicLookAndFeel extends LookAndFeel + implements Serializable +{ + /** + * Constructor BasicLookAndFeel + */ + public BasicLookAndFeel() + { + // TODO + } + + /** + * getDefaults + * @return UIDefaults + */ + public UIDefaults getDefaults() + { + // Variables + UIDefaults def = new UIDefaults(); + // Initialize Class Defaults + initClassDefaults(def); + // Initialize System Colour Defaults + initSystemColorDefaults(def); + // Initialize Component Defaults + initComponentDefaults(def); + // Return UI Defaults + return def; + } + + /** + * initClassDefaults + * @param value0 TODO + */ + protected void initClassDefaults(UIDefaults defaults) + { + // Variables + Object[] uiDefaults; + // Initialize Class Defaults + uiDefaults = new Object[] { + "ButtonUI", "javax.swing.plaf.basic.BasicButtonUI", + "CheckBoxMenuItemUI", "javax.swing.plaf.basic.BasicCheckBoxMenuItemUI", + "CheckBoxUI", "javax.swing.plaf.basic.BasicCheckBoxUI", + "ColorChooserUI", "javax.swing.plaf.basic.BasicColorChooserUI", + "ComboBoxUI", "javax.swing.plaf.basic.BasicComboBoxUI", + "DesktopIconUI", "javax.swing.plaf.basic.BasicDesktopIconUI", + "DesktopPaneUI", "javax.swing.plaf.basic.BasicDesktopPaneUI", + "EditorPaneUI", "javax.swing.plaf.basic.BasicEditorPaneUI", + "InternalFrameUI", "javax.swing.plaf.basic.BasicInternalFrameUI", + "LabelUI", "javax.swing.plaf.basic.BasicLabelUI", + "ListUI", "javax.swing.plaf.basic.BasicListUI", + "MenuBarUI", "javax.swing.plaf.basic.BasicMenuBarUI", + "MenuItemUI", "javax.swing.plaf.basic.BasicMenuItemUI", + "MenuUI", "javax.swing.plaf.basic.BasicMenuUI", + "OptionPaneUI", "javax.swing.plaf.basic.BasicOptionPaneUI", + "PanelUI", "javax.swing.plaf.basic.BasicPanelUI", + "PasswordFieldUI", "javax.swing.plaf.basic.BasicPasswordFieldUI", + "PopupMenuSeparatorUI", "javax.swing.plaf.basic.BasicPopupMenuSeparatorUI", + "PopupMenuUI", "javax.swing.plaf.basic.BasicPopupMenuUI", + "ProgressBarUI", "javax.swing.plaf.basic.BasicProgressBarUI", + "RadioButtonMenuItemUI", "javax.swing.plaf.basic.BasicRadioButtonMenuItemUI", + "RadioButtonUI", "javax.swing.plaf.basic.BasicRadioButtonUI", + "RootPaneUI", "javax.swing.plaf.basic.BasicRootPaneUI", + "ScrollBarUI", "javax.swing.plaf.basic.BasicScrollBarUI", + "ScrollPaneUI", "javax.swing.plaf.basic.BasicScrollPaneUI", + "SeparatorUI", "javax.swing.plaf.basic.BasicSeparatorUI", + "SliderUI", "javax.swing.plaf.basic.BasicSliderUI", + "SplitPaneUI", "javax.swing.plaf.basic.BasicSplitPaneUI", + "StandardDialogUI", "javax.swing.plaf.basic.BasicStandardDialogUI", + "TabbedPaneUI", "javax.swing.plaf.basic.BasicTabbedPaneUI", + "TableHeaderUI", "javax.swing.plaf.basic.BasicTableHeaderUI", + "TableUI", "javax.swing.plaf.basic.BasicTableUI", + "TextAreaUI", "javax.swing.plaf.basic.BasicTextAreaUI", + "TextFieldUI", "javax.swing.plaf.basic.BasicTextFieldUI", + "TextPaneUI", "javax.swing.plaf.basic.BasicTextPaneUI", + "ToggleButtonUI", "javax.swing.plaf.basic.BasicToggleButtonUI", + "ToolBarSeparatorUI", "javax.swing.plaf.basic.BasicToolBarSeparatorUI", + "ToolBarUI", "javax.swing.plaf.basic.BasicToolBarUI", + "ToolTipUI", "javax.swing.plaf.basic.BasicToolTipUI", + "TreeUI", "javax.swing.plaf.basic.BasicTreeUI", + "ViewportUI", "javax.swing.plaf.basic.BasicViewportUI" + }; + // Add Class Defaults to UI Defaults table + defaults.putDefaults(uiDefaults); + } + + /** + * initSystemColorDefaults + * @param defaults TODO + */ + protected void initSystemColorDefaults(UIDefaults defaults) + { + Object[] uiDefaults; + uiDefaults = new Object[] { + "activeCaption", new ColorUIResource(0, 0, 128), + "activeCaptionBorder", new ColorUIResource(Color.lightGray), + "activeCaptionText", new ColorUIResource(Color.white), + "control", new ColorUIResource(Color.lightGray), + "controlDkShadow", new ColorUIResource(Color.black), + "controlHighlight", new ColorUIResource(Color.lightGray), + "controlLtHighlight", new ColorUIResource(Color.white), + "controlShadow", new ColorUIResource(Color.gray), + "controlText", new ColorUIResource(Color.black), + "desktop", new ColorUIResource(0, 92, 92), + "inactiveCaption", new ColorUIResource(Color.gray), + "inactiveCaptionBorder", new ColorUIResource(Color.lightGray), + "inactiveCaptionText", new ColorUIResource(Color.lightGray), + "info", new ColorUIResource(Color.white), + "infoText", new ColorUIResource(Color.black), + "menu", new ColorUIResource(Color.lightGray), + "menuText", new ColorUIResource(Color.black), + "scrollbar", new ColorUIResource(224, 224, 224), + "text", new ColorUIResource(Color.lightGray), + "textHighlight", new ColorUIResource(0, 0, 128), + "textHighlightText", new ColorUIResource(Color.white), + "textInactiveText", new ColorUIResource(Color.gray), + "textText", new ColorUIResource(Color.black), + "window", new ColorUIResource(Color.white), + "windowBorder", new ColorUIResource(Color.black), + "windowText", new ColorUIResource(Color.black) + }; + defaults.putDefaults(uiDefaults); + } + + /** + * loadSystemColors + * @param defaults TODO + * @param value1 TODO + * @param value2 TODO + */ + protected void loadSystemColors(UIDefaults defaults, String[] value1, + boolean value2) + { + // TODO + } + + /** + * loadResourceBundle + * @param defaults TODO + */ + private void loadResourceBundle(UIDefaults defaults) + { + ResourceBundle bundle; + Enumeration enum; + String key; + String value; + bundle = ResourceBundle.getBundle("resources/basic"); + // Process Resources + enum = bundle.getKeys(); + while (enum.hasMoreElements()) + { + key = (String) enum.nextElement(); + value = bundle.getString(key); + defaults.put(key, value); + } + } + + /** + * initComponentDefaults + * @param defaults TODO + */ + protected void initComponentDefaults(UIDefaults defaults) + { + Object[] uiDefaults; + uiDefaults = new Object[] { + "Button.background", new ColorUIResource(Color.lightGray), + "Button.border", new BorderUIResource.CompoundBorderUIResource(null, + null), + "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "SPACE", "pressed", + "released SPACE", "released" + }), + "Button.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "Button.foreground", new ColorUIResource(Color.black), + "Button.margin", new InsetsUIResource(2, 14, 2, 14), + "Button.textIconGap", new Integer(4), + "Button.textShiftOffset", new Integer(0), + "CheckBox.background", new ColorUIResource(Color.lightGray), + "CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null, + null), + "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "SPACE", "pressed", + "released SPACE", "released" + }), + "CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "CheckBox.foreground", new ColorUIResource(Color.black), + "CheckBox.icon", BasicIconFactory.getCheckBoxIcon(), + "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2), + "CheckBox.textIconGap", new Integer(4), + "CheckBox.textShiftOffset", new Integer(0), + "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", + Font.PLAIN, 12), + "CheckBoxMenuItem.acceleratorForeground", new ColorUIResource(Color.black), + "CheckBoxMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), + "CheckBoxMenuItem.background", new ColorUIResource(Color.lightGray), + "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), + "CheckBoxMenuItem.borderPainted", Boolean.FALSE, + "CheckBoxMenuItem.checkIcon", BasicIconFactory.getCheckBoxMenuItemIcon(), + "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "CheckBoxMenuItem.foreground", new ColorUIResource(Color.black), + "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), + "CheckBoxMenuItem.selectionBackground", new ColorUIResource(0, 0, 128), + "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.white), + "ColorChooser.background", new ColorUIResource(Color.lightGray), + "ColorChooser.cancelText", "Cancel", + "ColorChooser.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "ColorChooser.foreground", new ColorUIResource(Color.black), + "ColorChooser.hsbBlueText", "B", + "ColorChooser.hsbBrightnessText", "B", + "ColorChooser.hsbGreenText", "G", + "ColorChooser.hsbHueText", "H", + "ColorChooser.hsbNameText", "HSB", + "ColorChooser.hsbRedText", "R", + "ColorChooser.hsbSaturationText", "S", + "ColorChooser.okText", "OK", + "ColorChooser.previewText", "Preview", + "ColorChooser.resetText", "Reset", + "ColorChooser.rgbBlueMnemonic", new Integer(66), + "ColorChooser.rgbBlueText", "Blue", + "ColorChooser.rgbGreenMnemonic", new Integer(71), + "ColorChooser.rgbGreenText", "Green", + "ColorChooser.rgbNameText", "RGB", + "ColorChooser.rgbRedMnemonic", new Integer(82), + "ColorChooser.rgbRedText", "Red", + "ColorChooser.sampleText", "Sample Text Sample Text", + "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(Color.lightGray), + "ColorChooser.swatchesNameText", "Swatches", + "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10), + "ColorChooser.swatchesRecentText", "Recent:", + "ColorChooser.swatchesSwatchSize", new Dimension(10, 10), + "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "ESCAPE", "hidePopup", + "PAGE_UP", "pageUpPassThrough", + "PAGE_DOWN", "pageDownPassThrough", + "HOME", "homePassThrough", + "END", "endPassThrough" + }), + "ComboBox.background", new ColorUIResource(Color.white), + "ComboBox.disabledBackground", new ColorUIResource(Color.lightGray), + "ComboBox.disabledForeground", new ColorUIResource(Color.gray), + "ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12), + "ComboBox.foreground", new ColorUIResource(Color.black), + "ComboBox.selectionBackground", new ColorUIResource(0, 0, 128), + "ComboBox.selectionForeground", new ColorUIResource(Color.white), + "Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "KP_LEFT", "left", + "KP_RIGHT", "right", + "ctrl F5", "restore", + "LEFT", "left", + "ctrl alt F6", "selectNextFrame", + "UP", "up", + "ctrl F6", "selectNextFrame", + "RIGHT", "right", + "DOWN", "down", + "ctrl F7", "move", + "ctrl F8", "resize", + "ESCAPE", "escape", + "ctrl TAB", "selectNextFrame", + "ctrl F9", "minimize", + "KP_UP", "up", + "ctrl F4", "close", + "KP_DOWN", "down", + "ctrl F10", "maximize", + "ctrl alt shift F6","selectPreviousFrame" + }), + "Desktop.background", new ColorUIResource(0, 92, 92), + "DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null, + null), + "EditorPane.background", new ColorUIResource(Color.white), + "EditorPane.border", new BasicBorders.MarginBorder(), + "EditorPane.caretBlinkRate", new Integer(500), + "EditorPane.caretForeground", new ColorUIResource(Color.red), + "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), + "EditorPane.foreground", new ColorUIResource(Color.black), + "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), + "EditorPane.keyBindings", new JTextComponent.KeyBinding[] { + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, + 0), "caret-up"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, + 0), "caret-down"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, + 0), "page-up"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, + 0), "page-down"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, + 0), "insert-break"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, + 0), "insert-tab") + }, + "EditorPane.margin", new InsetsUIResource(3, 3, 3, 3), + "EditorPane.selectionBackground", new ColorUIResource(Color.lightGray), + "EditorPane.selectionForeground", new ColorUIResource(Color.white), + "FileChooser.acceptAllFileFilterText", "All Files (*.*)", + "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "ESCAPE", "cancelSelection" + }), + "FileChooser.cancelButtonMnemonic", new Integer(67), + "FileChooser.cancelButtonText", "Cancel", + "FileChooser.cancelButtonToolTipText", "Abort file chooser dialog", + // XXX Don't use gif + "FileChooser.detailsViewIcon", new IconUIResource(new ImageIcon("icons/DetailsView.gif")), + "FileChooser.directoryDescriptionText", "Directory", + "FileChooser.fileDescriptionText", "Generic File", + "FileChooser.helpButtonMnemonic", new Integer(72), + "FileChooser.helpButtonText", "Help", + "FileChooser.helpButtonToolTipText", "FileChooser help", + // XXX Don't use gif + "FileChooser.homeFolderIcon", new IconUIResource(new ImageIcon("icons/HomeFolder.gif")), + // XXX Don't use gif + "FileChooser.listViewIcon", new IconUIResource(new ImageIcon("icons/ListView.gif")), + "FileChooser.newFolderErrorSeparator", ":", + "FileChooser.newFolderErrorText", "Error creating new folder", + // XXX Don't use gif + "FileChooser.newFolderIcon", new IconUIResource(new ImageIcon("icons/NewFolder.gif")), + "FileChooser.openButtonMnemonic", new Integer(79), + "FileChooser.openButtonText", "Open", + "FileChooser.openButtonToolTipText", "Open selected file", + "FileChooser.saveButtonMnemonic", new Integer(83), + "FileChooser.saveButtonText", "Save", + "FileChooser.saveButtonToolTipText", "Save selected file", + // XXX Don't use gif + "FileChooser.upFolderIcon", new IconUIResource(new ImageIcon("icons/UpFolder.gif")), + "FileChooser.updateButtonMnemonic", new Integer(85), + "FileChooser.updateButtonText", "Update", + "FileChooser.updateButtonToolTipText", "Update directory listing", + // XXX Don't use gif + "FileView.computerIcon", new IconUIResource(new ImageIcon("icons/Computer.gif")), + // XXX Don't use gif + "FileView.directoryIcon", new IconUIResource(new ImageIcon("icons/Directory.gif")), + // XXX Don't use gif + "FileView.fileIcon", new IconUIResource(new ImageIcon("icons/File.gif")), + // XXX Don't use gif + "FileView.floppyDriveIcon", new IconUIResource(new ImageIcon("icons/Floppy.gif")), + // XXX Don't use gif + "FileView.hardDriveIcon", new IconUIResource(new ImageIcon("icons/HardDrive.gif")), + "FocusManagerClassName", "TODO", + "FormView.resetButtonText", "Reset", + "FormView.submitButtonText", "Submit Query", + "InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128), + "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white), + "InternalFrame.border", new BorderUIResource.CompoundBorderUIResource(null, + null), + "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(), + // XXX Don't use gif + "InternalFrame.icon", new IconUIResource(new ImageIcon("icons/JavaCup.gif")), + "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(), + "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray), + "InternalFrame.inactiveTitleForeground", new ColorUIResource(Color.lightGray), + "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(), + "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(), + "InternalFrame.titleFont", new FontUIResource("Dialog", Font.PLAIN, 12), + "InternalFrame.windowBindings", new Object[] { + "shift ESCAPE", "showSystemMenu", + "ctrl SPACE", "showSystemMenu", + "ESCAPE", "showSystemMenu" + }, + "Label.background", new ColorUIResource(Color.lightGray), + "Label.disabledForeground", new ColorUIResource(Color.white), + "Label.disabledShadow", new ColorUIResource(Color.gray), + "Label.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "PAGE_UP", "scrollUp", + "ctrl \\", "clearSelection", + "PAGE_DOWN", "scrollDown", + "shift PAGE_DOWN","scrollDownExtendSelection", + "END", "selectLastRow", + "HOME", "selectFirstRow", + "shift END", "selectLastRowExtendSelection", + "shift HOME", "selectFirstRowExtendSelection", + "UP", "selectPreviousRow", + "ctrl /", "selectAll", + "ctrl A", "selectAll", + "DOWN", "selectNextRow", + "shift UP", "selectPreviousRowExtendSelection", + "ctrl SPACE", "selectNextRowExtendSelection", + "shift DOWN", "selectNextRowExtendSelection", + "KP_UP", "selectPreviousRow", + "shift PAGE_UP","scrollUpExtendSelection", + "KP_DOWN", "selectNextRow" + }), + "List.foreground", new ColorUIResource(Color.black), + "List.selectionBackground", new ColorUIResource(0, 0, 128), + "List.selectionForeground", new ColorUIResource(Color.white), + "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), + "Menu.acceleratorForeground", new ColorUIResource(Color.black), + "Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "Menu.arrowIcon", BasicIconFactory.getMenuArrowIcon(), + "Menu.background", new ColorUIResource(Color.lightGray), + "Menu.border", new BasicBorders.MarginBorder(), + "Menu.borderPainted", Boolean.FALSE, + "Menu.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), + "Menu.consumesTabs", Boolean.TRUE, + "Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "Menu.foreground", new ColorUIResource(Color.black), + "Menu.margin", new InsetsUIResource(2, 2, 2, 2), + "Menu.selectedWindowInputMapBindings", new Object[] { + "ESCAPE", "cancel", + "DOWN", "selectNext", + "KP_DOWN", "selectNext", + "UP", "selectPrevious", + "KP_UP", "selectPrevious", + "LEFT", "selectParent", + "KP_LEFT", "selectParent", + "RIGHT", "selectChild", + "KP_RIGHT", "selectChild", + "ENTER", "return", + "SPACE", "return" + }, + "Menutext.selectionBackground", new ColorUIResource(0, 0, 128), + "Menu.selectionForeground", new ColorUIResource(Color.white), + "MenuBar.background", new ColorUIResource(Color.lightGray), + "MenuBar.border", new BasicBorders.MenuBarBorder(null, null), + "MenuBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "MenuBar.foreground", new ColorUIResource(Color.black), + "MenuBar.windowBindings", new Object[] { + "F10", "takeFocus" + }, + "MenuItem.acceleratorDelimiter", "+", + "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), + "MenuItem.acceleratorForeground", new ColorUIResource(Color.black), + "MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "MenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), + "MenuItem.background", new ColorUIResource(Color.lightGray), + "MenuItem.border", new BasicBorders.MarginBorder(), + "MenuItem.borderPainted", Boolean.FALSE, + "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), + "MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "MenuItem.foreground", new ColorUIResource(Color.black), + "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2), + "MenuItem.selectionBackground", new ColorUIResource(0, 0, 128), + "MenuItem.selectionForeground", new ColorUIResource(Color.white), + "OptionPane.background", new ColorUIResource(Color.lightGray), + "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), + "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), + "OptionPane.cancelButtonText", "Cancel", + // XXX Don't use gif + "OptionPane.errorIcon", new IconUIResource(new ImageIcon("icons/Error.gif")), + "OptionPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "OptionPane.foreground", new ColorUIResource(Color.black), + // XXX Don't use gif + "OptionPane.informationIcon", new IconUIResource(new ImageIcon("icons/Inform.gif")), + "OptionPane.messageAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), + "OptionPane.messageForeground", new ColorUIResource(Color.black), + "OptionPane.minimumSize", new DimensionUIResource(262, 90), + "OptionPane.noButtonText", "No", + "OptionPane.okButtonText", "OK", + // XXX Don't use gif + "OptionPane.questionIcon", new IconUIResource(new ImageIcon("icons/Question.gif")), + // XXX Don't use gif + "OptionPane.warningIcon", new IconUIResource(new ImageIcon("icons/Warn.gif")), + "OptionPane.windowBindings", new Object[] { + "ESCAPE", "close" + }, + "OptionPane.yesButtonText", "Yes", + "Panel.background", new ColorUIResource(Color.lightGray), + "Panel.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "Panel.foreground", new ColorUIResource(Color.black), + "PasswordField.background", new ColorUIResource(Color.white), + "PasswordField.border", new BasicBorders.FieldBorder(null, null, + null, null), + "PasswordField.caretBlinkRate", new Integer(500), + "PasswordField.caretForeground", new ColorUIResource(Color.black), + "PasswordField.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12), + "PasswordField.foreground", new ColorUIResource(Color.black), + "PasswordField.inactiveForeground", new ColorUIResource(Color.gray), + "PasswordField.keyBindings", new JTextComponent.KeyBinding[] { + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, + 0), + "notify-field-accept")}, + "PasswordField.margin", new InsetsUIResource(0, 0, 0, 0), + "PasswordField.selectionBackground", new ColorUIResource(0, 0, 128), + "PasswordField.selectionForeground", new ColorUIResource(Color.white), + "PopupMenu.background", new ColorUIResource(Color.lightGray), + "PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0), + "PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "PopupMenu.foreground", new ColorUIResource(Color.black), + "ProgressBar.background", new ColorUIResource(Color.lightGray), + "ProgressBar.border", new BorderUIResource.LineBorderUIResource(null), + "ProgressBar.cellLength", new Integer(1), + "ProgressBar.cellSpacing", new Integer(0), + "ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "ProgressBar.foreground", new ColorUIResource(0, 0, 128), + "ProgressBar.selectionBackground", new ColorUIResource(0, 0, 128), + "ProgressBar.selectionForeground", new ColorUIResource(Color.lightGray), + "RadioButton.background", new ColorUIResource(Color.lightGray), + "RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null, + null), + "RadioButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "SPACE", "pressed", + "released SPACE", "released" + }), + "RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "RadioButton.foreground", new ColorUIResource(Color.black), + "RadioButton.icon", BasicIconFactory.getRadioButtonIcon(), + "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2), + "RadioButton.textIconGap", new Integer(4), + "RadioButton.textShiftOffset", new Integer(0), + "RadioButtonMenuItem.acceleratorFont", new FontUIResource("Dialog", + Font.PLAIN, 12), + "RadioButtonMenuItem.acceleratorForeground", new ColorUIResource(Color.black), + "RadioButtonMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "RadioButtonMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), + "RadioButtonMenuItem.background", new ColorUIResource(Color.lightGray), + "RadioButtonMenuItem.border", new BasicBorders.MarginBorder(), + "RadioButtonMenuItem.borderPainted", Boolean.FALSE, + "RadioButtonMenuItem.checkIcon", BasicIconFactory.getRadioButtonMenuItemIcon(), + "RadioButtonMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "RadioButtonMenuItem.foreground", new ColorUIResource(Color.black), + "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), + "RadioButtonMenuItem.selectionBackground", new ColorUIResource(0, 0, 128), + "RadioButtonMenuItem.selectionForeground", new ColorUIResource(Color.white), + "RootPane.defaultButtonWindowKeyBindings", new Object[] { + "ENTER", "press", + "released ENTER", "release", + "ctrl ENTER", "press", + "ctrl released ENTER", "release" + }, + "ScrollBar.background", new ColorUIResource(224, 224, 224), + "ScrollBar.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "PAGE_UP", "negativeBlockIncrement", + "PAGE_DOWN", "positiveBlockIncrement", + "END", "maxScroll", + "HOME", "minScroll", + "LEFT", "positiveUnitIncrement", + "KP_UP", "negativeUnitIncrement", + "KP_DOWN", "positiveUnitIncrement", + "UP", "negativeUnitIncrement", + "RIGHT", "negativeUnitIncrement", + "KP_LEFT", "positiveUnitIncrement", + "DOWN", "positiveUnitIncrement", + "KP_RIGHT", "negativeUnitIncrement" + }), + "ScrollBar.foreground", new ColorUIResource(Color.lightGray), + "ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096), + "ScrollBar.minimumThumbSize", new DimensionUIResource(8, 8), + "ScrollBar.thumb", new ColorUIResource(Color.lightGray), + "ScrollBar.thumbDarkShadow", new ColorUIResource(Color.black), + "ScrollBar.thumbHighlight", new ColorUIResource(Color.white), + "ScrollBar.thumbLightShadow", new ColorUIResource(Color.gray), + "ScrollBar.track", new ColorUIResource(224, 224, 224), + "ScrollBar.trackHighlight", new ColorUIResource(Color.black), + "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "PAGE_UP", "scrollUp", + "KP_LEFT", "unitScrollLeft", + "ctrl PAGE_DOWN","scrollRight", + "PAGE_DOWN", "scrollDown", + "KP_RIGHT", "unitScrollRight", + "LEFT", "unitScrollLeft", + "ctrl END", "scrollEnd", + "UP", "unitScrollUp", + "RIGHT", "unitScrollRight", + "DOWN", "unitScrollDown", + "ctrl HOME", "scrollHome", + "ctrl PAGE_UP", "scrollLeft", + "KP_UP", "unitScrollUp", + "KP_DOWN", "unitScrollDown" + }), + "ScrollPane.background", new ColorUIResource(Color.lightGray), + "ScrollPane.border", new BorderUIResource.EtchedBorderUIResource(), + "ScrollPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "ScrollPane.foreground", new ColorUIResource(Color.black), + "Separator.background", new ColorUIResource(Color.white), + "Separator.foreground", new ColorUIResource(Color.gray), + "Separator.highlight", new ColorUIResource(Color.white), + "Separator.shadow", new ColorUIResource(Color.gray), + "Slider.background", new ColorUIResource(Color.lightGray), + "Slider.focus", new ColorUIResource(Color.black), + "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "PAGE_UP", "positiveBlockIncrement", + "PAGE_DOWN", "negativeBlockIncrement", + "END", "maxScroll", + "HOME", "minScroll", + "LEFT", "negativeUnitIncrement", + "KP_UP", "positiveUnitIncrement", + "KP_DOWN", "negativeUnitIncrement", + "UP", "positiveUnitIncrement", + "RIGHT", "positiveUnitIncrement", + "KP_LEFT", "negativeUnitIncrement", + "DOWN", "negativeUnitIncrement", + "KP_RIGHT", "positiveUnitIncrement" + }), + "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2), + "Slider.foreground", new ColorUIResource(Color.lightGray), + "Slider.highlight", new ColorUIResource(Color.white), + "Slider.shadow", new ColorUIResource(Color.gray), + "SplitPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "F6", "toggleFocus", + "F8", "startResize", + "END", "selectMax", + "HOME", "selectMin", + "LEFT", "negativeIncremnent", + "KP_UP", "negativeIncrement", + "KP_DOWN", "positiveIncrement", + "UP", "negativeIncrement", + "RIGHT", "positiveIncrement", + "KP_LEFT", "negativeIncrement", + "DOWN", "positiveIncrement", + "KP_RIGHT", "positiveIncrement" + }), + "SplitPane.background", new ColorUIResource(Color.lightGray), + "SplitPane.border", new BasicBorders.SplitPaneBorder(null, null), + "SplitPane.dividerSize", new Integer(7), + "SplitPane.highlight", new ColorUIResource(Color.white), + "SplitPane.shadow", new ColorUIResource(Color.gray), + "TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "ctrl PAGE_DOWN","navigatePageDown", + "ctrl PAGE_UP", "navigatePageUp", + "ctrl UP", "requestFocus", + "ctrl KP_UP", "requestFocus" + }), + "TabbedPane.background", new ColorUIResource(Color.lightGray), + "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3), + "TabbedPane.darkShadow", new ColorUIResource(Color.black), + "TabbedPane.focus", new ColorUIResource(Color.black), + "TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "LEFT", "navigateLeft", + "KP_UP", "navigateUp", + "ctrl DOWN", "requestFocusForVisibleComponent", + "UP", "navigateUp", + "KP_DOWN", "navigateDown", + "RIGHT", "navigateRight", + "KP_LEFT", "navigateLeft", + "ctrl KP_DOWN", "requestFocusForVisibleComponent", + "KP_RIGHT", "navigateRight", + "DOWN", "navigateDown" + }), + "TabbedPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "TabbedPane.foreground", new ColorUIResource(Color.black), + "TabbedPane.highlight", new ColorUIResource(Color.lightGray), + "TabbedPane.lightHighlight", new ColorUIResource(Color.white), + "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), + "TabbedPane.shadow", new ColorUIResource(Color.gray), + "TabbedPane.tabAreaInsets", new InsetsUIResource(3, 2, 0, 2), + "TabbedPane.tabInsets", new InsetsUIResource(0, 4, 1, 4), + "TabbedPane.tabRunOverlay", new Integer(2), + "TabbedPane.textIconGap", new Integer(4), + "Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "shift PAGE_DOWN","scrollDownExtendSelection", + "PAGE_DOWN", "scrollDownChangeSelection", + "END", "selectLastColumn", + "shift END", "selectLastColumnExtendSelection", + "HOME", "selectFirstColumn", + "ctrl END", "selectLastRow", + "ctrl shift END","selectLastRowExtendSelection", + "LEFT", "selectPreviousColumn", + "shift HOME", "selectFirstColumnExtendSelection", + "UP", "selectPreviousRow", + "RIGHT", "selectNextColumn", + "ctrl HOME", "selectFirstRow", + "shift LEFT", "selectPreviousColumnExtendSelection", + "DOWN", "selectNextRow", + "ctrl shift HOME","selectFirstRowExtendSelection", + "shift UP", "selectPreviousRowExtendSelection", + "F2", "startEditing", + "shift RIGHT", "selectNextColumnExtendSelection", + "TAB", "selectNextColumnCell", + "shift DOWN", "selectNextRowExtendSelection", + "ENTER", "selectNextRowCell", + "KP_UP", "selectPreviousRow", + "KP_DOWN", "selectNextRow", + "KP_LEFT", "selectPreviousColumn", + "KP_RIGHT", "selectNextColumn", + "shift TAB", "selectPreviousColumnCell", + "ctrl A", "selectAll", + "shift ENTER", "selectPreviousRowCell", + "shift KP_DOWN", "selectNextRowExtendSelection", + "shift KP_LEFT", "selectPreviousColumnExtendSelection", + "ESCAPE", "cancel", + "ctrl shift PAGE_UP", "scrollRightExtendSelection", + "shift KP_RIGHT", " selectNextColumnExtendSelection", + "ctrl PAGE_UP", "scrollLeftChangeSelection", + "shift PAGE_UP", "scrollUpExtendSelection", + "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", + "ctrl PAGE_DOWN", "scrollRightChangeSelection", + "PAGE_UP", "scrollUpChangeSelection" + }), + "Table.background", new ColorUIResource(Color.white), + "Table.focusCellBackground", new ColorUIResource(Color.white), + "Table.focusCellForeground", new ColorUIResource(Color.black), + "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource(null), + "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "Table.foreground", new ColorUIResource(Color.black), + "Table.gridColor", new ColorUIResource(Color.gray), + "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), + "Table.selectionBackground", new ColorUIResource(0, 0, 128), + "Table.selectionForeground", new ColorUIResource(Color.white), + "TableHeader.background", new ColorUIResource(Color.lightGray), + "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), + "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "TableHeader.foreground", new ColorUIResource(Color.black), + "TextArea.background", new ColorUIResource(Color.white), + "TextArea.border", new BasicBorders.MarginBorder(), + "TextArea.caretBlinkRate", new Integer(500), + "TextArea.caretForeground", new ColorUIResource(Color.black), + "TextArea.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12), + "TextArea.foreground", new ColorUIResource(Color.black), + "TextArea.inactiveForeground", new ColorUIResource(Color.gray), + "TextArea.keyBindings", new JTextComponent.KeyBinding[] { + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, + 0), "caret-up"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, + 0), "caret-down"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, + 0), "page-up"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, + 0), "page-down"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, + 0), "insert-break"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, + 0), "insert-tab") + }, + "TextArea.margin", new InsetsUIResource(0, 0, 0, 0), + "TextArea.selectionBackground", new ColorUIResource(0, 0, 128), + "TextArea.selectionForeground", new ColorUIResource(Color.white), + "TextField.background", new ColorUIResource(Color.white), + "TextField.border", new BasicBorders.FieldBorder(null, null, null, null), + "TextField.caretBlinkRate", new Integer(500), + "TextField.caretForeground", new ColorUIResource(Color.black), + "TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12), + "TextField.foreground", new ColorUIResource(Color.black), + "TextField.inactiveForeground", new ColorUIResource(Color.gray), + "TextField.keyBindings", new JTextComponent.KeyBinding[] { + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, + 0), + "notify-field-accept")}, + "TextField.margin", new InsetsUIResource(0, 0, 0, 0), + "TextField.selectionBackground", new ColorUIResource(0, 0, 128), + "TextField.selectionForeground", new ColorUIResource(Color.white), + "TextPane.background", new ColorUIResource(Color.white), + "TextPane.border", new BasicBorders.MarginBorder(), + "TextPane.caretBlinkRate", new Integer(500), + "TextPane.caretForeground", new ColorUIResource(Color.black), + "TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12), + "TextPane.foreground", new ColorUIResource(Color.black), + "TextPane.inactiveForeground", new ColorUIResource(Color.gray), + "TextPane.keyBindings", new JTextComponent.KeyBinding[] { + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, + 0), "caret-up"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, + 0), "caret-down"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, + 0), "page-up"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, + 0), "page-down"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, + 0), "insert-break"), + new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, + 0), "insert-tab") + }, + "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), + "TextPane.selectionBackground", new ColorUIResource(Color.lightGray), + "TextPane.selectionForeground", new ColorUIResource(Color.white), + "TitledBorder.border", new BorderUIResource.EtchedBorderUIResource(), + "TitledBorder.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "TitledBorder.titleColor", new ColorUIResource(Color.black), + "ToggleButton.background", new ColorUIResource(Color.lightGray), + "ToggleButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), + "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "SPACE", "pressed", + "released SPACE", "released" + }), + "ToggleButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "ToggleButton.foreground", new ColorUIResource(Color.black), + "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), + "ToggleButton.textIconGap", new Integer(4), + "ToggleButton.textShiftOffset", new Integer(0), + "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "UP", "navigateUp", + "KP_UP", "navigateUp", + "DOWN", "navigateDown", + "KP_DOWN", "navigateDown", + "LEFT", "navigateLeft", + "KP_LEFT", "navigateLeft", + "RIGHT", "navigateRight", + "KP_RIGHT", "navigateRight" + }), + "ToolBar.background", new ColorUIResource(Color.lightGray), + "ToolBar.border", new BorderUIResource.EtchedBorderUIResource(), + "ToolBar.dockingBackground", new ColorUIResource(Color.lightGray), + "ToolBar.dockingForeground", new ColorUIResource(Color.red), + "ToolBar.floatingBackground", new ColorUIResource(Color.lightGray), + "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray), + "ToolBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "ToolBar.foreground", new ColorUIResource(Color.black), + "ToolBar.separatorSize", new DimensionUIResource(10, 10), + "ToolTip.background", new ColorUIResource(Color.white), + "ToolTip.border", new BorderUIResource.LineBorderUIResource(null), + "ToolTip.font", new FontUIResource("SansSerif", Font.PLAIN, 12), + "ToolTip.foreground", new ColorUIResource(Color.black), + "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { + "ESCAPE", "cancel" + }), + "Tree.background", new ColorUIResource(Color.white), + "Tree.changeSelectionWithFocus", Boolean.TRUE, + // XXX Don't use gif + "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.gif")), + "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE, + "Tree.editorBorder", new BorderUIResource.LineBorderUIResource(null), + "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "shift PAGE_DOWN", "scrollDownExtendSelection", + "PAGE_DOWN", "scrollDownChangeSelection", + "END", "selectLast", + "ctrl KP_UP", "selectPreviousChangeLead", + "shift END", "selectLastExtendSelection", + "HOME", "selectFirst", + "ctrl END", "selectLastChangeLead", + "ctrl /", "selectAll", + "LEFT", "selectParent", + "shift HOME", "selectFirstExtendSelection", + "UP", "selectPrevious", + "ctrl KP_DOWN", "selectNextChangeLead", + "RIGHT", "selectChild", + "ctrl HOME", "selectFirstChangeLead", + "DOWN", "selectNext", + "ctrl KP_LEFT", "scrollLeft", + "shift UP", "selectPreviousExtendSelection", + "F2", "startEditing", + "ctrl LEFT", "scrollLeft", + "ctrl KP_RIGHT","scrollRight", + "ctrl UP", "selectPreviousChangeLead", + "shift DOWN", "selectNextExtendSelection", + "ENTER", "toggle", + "KP_UP", "selectPrevious", + "KP_DOWN", "selectNext", + "ctrl RIGHT", "scrollRight", + "KP_LEFT", "selectParent", + "KP_RIGHT", "selectChild", + "ctrl DOWN", "selectNextChangeLead", + "ctrl A", "selectAll", + "shift KP_UP", "selectPreviousExtendSelection", + "shift KP_DOWN","selectNextExtendSelection", + "ctrl SPACE", "toggleSelectionPreserveAnchor", + "ctrl shift PAGE_UP", "scrollUpExtendSelection", + "ctrl \\", "clearSelection", + "shift SPACE", "extendSelection", + "ctrl PAGE_UP", "scrollUpChangeLead", + "shift PAGE_UP","scrollUpExtendSelection", + "SPACE", "toggleSelectionPreserveAnchor", + "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", + "PAGE_UP", "scrollUpChangeSelection", + "ctrl PAGE_DOWN", "scrollDownChangeLead" + }), + "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "Tree.foreground", new ColorUIResource(Color.black), + "Tree.hash", new ColorUIResource(Color.gray), + // XXX Don't use gif + "Tree.leafIcon", new IconUIResource(new ImageIcon("icons/TreeLeaf.gif")), + "Tree.leftChildIndent", new Integer(7), + // XXX Don't use gif + "Tree.openIcon", new IconUIResource(new ImageIcon("icons/TreeOpen.gif")), + "Tree.rightChildIndent", new Integer(13), + "Tree.rowHeight", new Integer(16), + "Tree.scrollsOnExpand", Boolean.TRUE, + "Tree.selectionBackground", new ColorUIResource(0, 0, 128), + "Tree.selectionBorderColor", new ColorUIResource(Color.black), + "Tree.selectionForeground", new ColorUIResource(Color.white), + "Tree.textBackground", new ColorUIResource(Color.lightGray), + "Tree.textForeground", new ColorUIResource(Color.black), + "Viewport.background", new ColorUIResource(Color.lightGray), + "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12), + }; + defaults.putDefaults(uiDefaults); + } +} // class BasicLookAndFeel diff --git a/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java new file mode 100644 index 00000000000..bfb6cbadfdc --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -0,0 +1,103 @@ +package javax.swing.plaf.basic; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.accessibility.*; + +public class BasicOptionPaneUI extends OptionPaneUI +{ + JOptionPane pane; + + BasicOptionPaneUI() + { + } + + public static ComponentUI createUI(JComponent x) + { + return new BasicOptionPaneUI(); + } + + public void installUI(JComponent c) + { + super.installUI(c); + pane = (JOptionPane)c; + + System.out.println(" -------------: " + pane); + + JLabel message = pane.msg != null ? new JLabel((String)pane.msg) : null; + JButton ok_button = new JButton("Ok"); + + ok_button.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent a) + { + System.out.println("ACTION ---> " + a); + // pane.dialog.dispose(); + + if (pane.dialog.isModal()) + { + System.out.println("modal dialog !!"); + pane.dialog.setModal(false); + } + pane.dialog.setVisible(false); + } + }); + + if (pane.args != null) + { + for (int i=0; i<pane.args.length; i++) + { + Object o = pane.args[i]; + if (o != null) + { + if (o instanceof String) + { + String s = (String) o; + JLabel m = new JLabel(s); + pane.add(m); + } + else if (o instanceof Component) + { + Component com = (Component) o; + pane.add(com); + } + else + { + System.out.println("UNRECOGNIZED ARG: " + o); + } + } + } + } + + pane.add(message); + pane.add(ok_button); + } + + Dimension getMinimumOptionPaneSize() + { + return new Dimension(300,100); + } + + public Dimension getPreferredSize(JComponent c) + { + if (c == null) + return getMinimumOptionPaneSize(); + + if (c != pane) + return null; + + LayoutManager l = c.getLayout(); + if (l == null) + return getMinimumOptionPaneSize(); + + Dimension d1 = l.preferredLayoutSize(c); + Dimension d2 = getMinimumOptionPaneSize(); + + d1.width = Math.max(d1.width, d2.width); + d1.height = Math.max(d1.height, d2.height); + + return d2; + } +} diff --git a/libjava/javax/swing/plaf/basic/BasicPanelUI.java b/libjava/javax/swing/plaf/basic/BasicPanelUI.java new file mode 100644 index 00000000000..5976bd2a1f2 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicPanelUI.java @@ -0,0 +1,21 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import javax.swing.plaf.*; +import java.awt.*; + + +public class BasicPanelUI extends PanelUI +{ + int gap = 3; + + public static ComponentUI createUI(JComponent x) + { + return new BasicPanelUI(); + } + + public void installUI(JComponent c) + { + super.installUI(c); + } +} diff --git a/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java new file mode 100644 index 00000000000..4f8f9289828 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java @@ -0,0 +1,127 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import javax.swing.plaf.*; +import java.awt.*; + + +public class BasicRadioButtonUI extends BasicToggleButtonUI +{ + int large_circle_width = 20; + int circle_width = large_circle_width - 8; // FIXME: sun == ? + + public static ComponentUI createUI(final JComponent c) { + return new BasicRadioButtonUI(); + } + + + public void installUI(final JComponent c) { + super.installUI(c); + } + + public Dimension getPreferredSize(JComponent c) + { + AbstractButton b = (AbstractButton)c; + Dimension d = BasicGraphicsUtils.getPreferredSize(b, + gap, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getHorizontalTextPosition(), + b.getVerticalTextPosition()); + + // and add a little something for the circles: + + d.width += large_circle_width; + d.height = Math.max(large_circle_width, d.height); + + //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text); + return d; + } + + protected void paintFocus(Graphics g, + JComponent c, + Rectangle vr, + Rectangle tr, + Rectangle ir) + { + } + + protected void paintIcon(Graphics g, + JComponent c, + Rectangle iconRect) + { + } + + protected void paintButtonPressed(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + paintButtonNormal(g, b); + + int x = gap; + int y = gap; + + int diffp = 2; + int diff = 3; + + g.setColor(textColor); + g.fillArc(x+diffp, y+diffp, + circle_width-diff, circle_width-diff, + 0, 360); + } + + protected void paintButtonNormal(Graphics g, + JComponent c) + { + AbstractButton b = (AbstractButton) c; + + Dimension size = b.getSize(); + + g.setColor(normalBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + int x = gap; + int y = gap; + + g.setColor(pressedBackgroundColor); + g.drawArc(x, y, + circle_width, circle_width, + 0, 360); + + g.setColor(new Color(255,255,255)); + g.drawArc(x, y, + circle_width+1, circle_width+1, + 145, 160); + } + + protected void paintText(Graphics g, + JComponent c, + Rectangle textRect, + String text) + { + // AbstractButton b = (AbstractButton) c; + + //System.out.println("drawing string: " + text + ", " + c.isEnabled()); + + g.setColor(c.isEnabled() ? textColor : disabledTextColor); + + BasicGraphicsUtils.drawString(g, + text, + 0, + textRect.x + circle_width + gap, + textRect.y); + } +} + + + + + + + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicScrollPaneUI.java b/libjava/javax/swing/plaf/basic/BasicScrollPaneUI.java new file mode 100644 index 00000000000..8d50b046e2e --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -0,0 +1,66 @@ +package javax.swing.plaf.basic; + + +import javax.swing.plaf.*; +import javax.swing.*; +import java.awt.*; + + + +public class BasicScrollPaneUI extends ScrollPaneUI +{ + int min_w = 50; + int min_h = 50; + + public static ComponentUI createUI(final JComponent c) + { + return new BasicScrollPaneUI(); + } + + + public void installUI(final JComponent c) + { + super.installUI(c); + } + + + public Dimension getPreferredSize(JComponent c) + { + JScrollPane p = (JScrollPane ) c; + + Dimension d = new Dimension(min_w, + min_h); + + Dimension a = p.getViewport().getPreferredSize(); + + if (a != null) + { + d.width = Math.max(d.width, a.width); + d.height = Math.max(d.height, a.height); + } + + + System.out.println("BasicScrollPaneUI->preff->"+d); + return d; + } + + public void paint(Graphics g, JComponent c) + { + System.out.println("BasicScrollPaneUI->paint()->"+c); + + JScrollPane p = (JScrollPane ) c; + p.getViewport().paint(g); + } +} + + + + + + + + + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java new file mode 100644 index 00000000000..49328d26740 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -0,0 +1,64 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import java.awt.*; +import javax.swing.plaf.*; + +public class BasicTabbedPaneUI extends TabbedPaneUI +{ + public static ComponentUI createUI(final JComponent c) + { + return new BasicTabbedPaneUI(); + } + + public void installUI(final JComponent c) + { + super.installUI(c); + } + + public Dimension getPreferredSize(JComponent c) + { + JTabbedPane p = (JTabbedPane) c; + + Dimension d = new Dimension(50,50); + + for (int i=0;i<p.getTabCount();i++) + { + Component comp = p.getComponentAt(i); + + Dimension pr = comp.getPreferredSize(); + + d.width = Math.max(d.width, comp.getWidth()); + d.height = Math.max(d.height, comp.getHeight()); + } + + Insets i = p.getInsets(); + + d.width += i.left + i.right; + d.height += i.top + i.bottom; + + int height_of_tabs = 25; + + d.height += height_of_tabs; + + // FIXME: should be max of panes in p + return d; + } + + + public Rectangle getTabBounds(JTabbedPane pane, int index) + { + return null; + } + + public int getTabRunCount(JTabbedPane pane) + { + return 0; + } + + public int tabForCoordinate(JTabbedPane pane, int x, int y) + { + return 0; + } +} + diff --git a/libjava/javax/swing/plaf/basic/BasicTextUI.java b/libjava/javax/swing/plaf/basic/BasicTextUI.java new file mode 100644 index 00000000000..bdb6e4c3a36 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicTextUI.java @@ -0,0 +1,126 @@ +package javax.swing.plaf.basic; + +import javax.swing.text.*; +import javax.swing.plaf.*; +import java.awt.*; +import javax.swing.*; + +public class BasicTextUI extends TextUI +{ + int gap = 3; + View view = new RootView(); + Color textColor, disabledTextColor, normalBackgroundColor; + EditorKit kit = new DefaultEditorKit(); + + class RootView extends View + { + RootView() + { + super(null); + } + public void paint(Graphics g, Shape s) + { + if (view != null) + { + Rectangle r = s.getBounds(); + + view.setSize((int)r.getWidth(), + (int)r.getHeight()); + view.paint(g, s); + } + } + } + + public BasicTextUI() + { + } + + public static ComponentUI createUI(final JComponent c) + { + return new BasicTextUI(); + } + + + public void installUI(final JComponent c) + { + super.installUI(c); + + textColor = new Color(0,0,0); + disabledTextColor = new Color(130, 130, 130); + normalBackgroundColor = new Color(192,192,192); + } + + public Dimension getPreferredSize(JComponent c) + { + JTextComponent b = (JTextComponent) c; + + View v = getRootView(b); + + float w = v.getPreferredSpan(View.X_AXIS); + float h = v.getPreferredSpan(View.Y_AXIS); + + return new Dimension((int)w, (int) h); + } + + + public void paint(Graphics g, JComponent c) + { + // view.paint( + } + + public void damageRange(JTextComponent t, int p0, int p1) + { + damageRange(t, p0, p1, null, null); + } + + public void damageRange(JTextComponent t, + int p0, int p1, + Position.Bias firstBias, + Position.Bias secondBias) + { + } + + public EditorKit getEditorKit(JTextComponent t) + { + return kit; + } + + public int getNextVisualPositionFrom(JTextComponent t, + int pos, + Position.Bias b, + int direction, + Position.Bias[] biasRet) + { + return 0; + } + + public View getRootView(JTextComponent t) + { + return view; + } + + public Rectangle modelToView(JTextComponent t, int pos) + { + return modelToView(t, pos, null); + } + + public Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias) + { + return null; + } + + public int viewToModel(JTextComponent t, Point pt) + { + return viewToModel(t, pt, null); + } + + public int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn) + { + return 0; + } +} + + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java b/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java new file mode 100644 index 00000000000..507d61732e4 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java @@ -0,0 +1,90 @@ +package javax.swing.plaf.basic; + +import javax.swing.*; +import javax.swing.plaf.*; +import java.awt.*; + + +public class BasicToggleButtonUI extends BasicButtonUI +{ + + public static ComponentUI createUI(final JComponent c) { + return new BasicToggleButtonUI(); + } + + + public void installUI(final JComponent c) { + super.installUI(c); + } + + public Dimension getPreferredSize(JComponent c) + { + AbstractButton b = (AbstractButton)c; + Dimension d = BasicGraphicsUtils.getPreferredSize(b, + gap, + b.getText(), + b.getIcon(), + b.getVerticalAlignment(), + b.getHorizontalAlignment(), + b.getHorizontalTextPosition(), + b.getVerticalTextPosition()); + + //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text); + return d; + } + + protected void paintFocus(Graphics g, + JComponent c, + Rectangle vr, + Rectangle tr, + Rectangle ir) + { + } + + protected void paintIcon(Graphics g, + JComponent c, + Rectangle iconRect) + { + } + + protected void paintButtonPressed(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + g.setColor(pressedBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + } + + protected void paintButtonNormal(Graphics g, + JComponent b) + { + Dimension size = b.getSize(); + + g.setColor(normalBackgroundColor); + g.fillRect(1,1,size.width-2, size.height-2); + + } + protected void paintText(Graphics g, + JComponent c, + Rectangle textRect, + String text) + { + // AbstractButton b = (AbstractButton) c; + + // System.out.println("drawing string: " + text + ", at:" + textRect); + + g.setColor(textColor); + + BasicGraphicsUtils.drawString(g, + text, + 0, + textRect.x, + textRect.y); + } +} + + + + diff --git a/libjava/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/javax/swing/plaf/basic/BasicTreeUI.java new file mode 100644 index 00000000000..1f4f2a8b2d4 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicTreeUI.java @@ -0,0 +1,7 @@ +package javax.swing.plaf.basic; + +import javax.swing.plaf.*; + +public class BasicTreeUI extends TreeUI +{ +} diff --git a/libjava/javax/swing/plaf/basic/BasicViewportUI.java b/libjava/javax/swing/plaf/basic/BasicViewportUI.java new file mode 100644 index 00000000000..1e592003773 --- /dev/null +++ b/libjava/javax/swing/plaf/basic/BasicViewportUI.java @@ -0,0 +1,33 @@ +package javax.swing.plaf.basic; + +import javax.swing.plaf.*; +import javax.swing.*; +import java.awt.*; + +public class BasicViewportUI extends ViewportUI +{ + + public static ComponentUI createUI(final JComponent c) + { + return new BasicViewportUI(); + } + + + public void installUI(final JComponent c) + { + super.installUI(c); + } + + + public Dimension getPreferredSize(JComponent c) + { + Dimension d = new Dimension(100,100); + System.out.println("BasicViewportUI->preff->"+d); + return d; + } + + public void paint(Graphics g, JComponent c) + { + System.out.println("BasicViewportUI->paint->"+c); + } +} diff --git a/libjava/javax/swing/table/AbstractTableModel.java b/libjava/javax/swing/table/AbstractTableModel.java new file mode 100644 index 00000000000..790568f88b4 --- /dev/null +++ b/libjava/javax/swing/table/AbstractTableModel.java @@ -0,0 +1,314 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * AbstractTableModel + * @author Andrew Selkirk + */ +public abstract class AbstractTableModel implements TableModel, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * listenerList + */ + protected EventListenerList listenerList = new EventListenerList(); + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AbstractTableModel + */ + public AbstractTableModel() { + // TODO + } // AbstractTableModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getColumnName + * @param value0 TODO + * @returns String + */ + public String getColumnName(int columnIndex) { + + // Variables + int index; + int left; + int base; + int multiplier; + StringBuffer buffer; + boolean foundFirst; + + // Ok, this is not the best solution in the world + // and it does produce wrong answers starting 1378 + // but it's a start. I sure hope there is a more + // simple algorithm. I started with a base 10 to + // base 26 converter and later found that there + // were so many are exceptions that it has morphed + // into a pile of goop. + + // NOTE2: I have a working algorithm which is much + // much simplier and works for all values...I'll + // be adding it soon... + + // Process Exponent levels + buffer = new StringBuffer(); + left = columnIndex; + foundFirst = false; + for (index = 6; index >= 0; index--) { + base = (int) (Math.pow(26, index)); + if (index > 1) { + base = base + (int) (Math.pow(26, index - 1)); + } + if (base <= left) { + multiplier = left / base; + if (foundFirst == false && index > 0) { + buffer.append((char) (multiplier + 64)); + } else { + buffer.append((char) (multiplier + 65)); + } + left = left - (base * multiplier); + foundFirst = true; + } else if (foundFirst == true || index == 0) { + buffer.append('A'); + } + } // for + + // Return Column Name + return buffer.toString(); + + } // getColumnName() + + /** + * findColumn + * @param value0 TODO + * @returns int + */ + public int findColumn(String columnName) { + + // Variables + int index; + String name; + int count; + + // Process Columns + count = getColumnCount(); + for (index = 0; index < count; index++) { + name = getColumnName(index); + if (columnName.equals(name) == true) { + return index; + } // if + } // for + + // Unable to Locate + return -1; + + } // findColumn() + + /** + * getColumnClass + * @param value0 TODO + * @returns Class + */ + public Class getColumnClass(int columnIndex) { + return Object.class; + } // getColumnClass() + + /** + * isCellEditable + * @param value0 TODO + * @param value1 TODO + * @returns boolean + */ + public boolean isCellEditable(int rowIndex, int columnIndex) { + return false; + } // isCellEditable() + + /** + * setValueAt + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void setValueAt(Object value, int rowIndex, int columnIndex) { + // Do nothing... + } // setValueAt() + + /** + * addTableModelListener + * @param value0 TODO + */ + public void addTableModelListener(TableModelListener listener) { + listenerList.add(TableModelListener.class, listener); + } // addTableModelListener() + + /** + * removeTableModelListener + * @param value0 TODO + */ + public void removeTableModelListener(TableModelListener listener) { + listenerList.remove(TableModelListener.class, listener); + } // removeTableModelListener() + + /** + * fireTableDataChanged + */ + public void fireTableDataChanged() { + fireTableChanged(new TableModelEvent(this)); + } // fireTableDataChanged() + + /** + * fireTableStructureChanged + */ + public void fireTableStructureChanged() { + fireTableChanged(new TableModelEvent(this, + TableModelEvent.HEADER_ROW)); + } // fireTableStructureChanged() + + /** + * fireTableRowsInserted + * @param value0 TODO + * @param value1 TODO + */ + public void fireTableRowsInserted(int firstRow, int lastRow) { + fireTableChanged(new TableModelEvent(this, firstRow, lastRow, + TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); + } // fireTableRowsInserted() + + /** + * fireTableRowsUpdated + * @param value0 TODO + * @param value1 TODO + */ + public void fireTableRowsUpdated(int firstRow, int lastRow) { + fireTableChanged(new TableModelEvent(this, firstRow, lastRow, + TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE)); + } // fireTableRowsUpdated() + + /** + * fireTableRowsDeleted + * @param value0 TODO + * @param value1 TODO + */ + public void fireTableRowsDeleted(int firstRow, int lastRow) { + fireTableChanged(new TableModelEvent(this, firstRow, lastRow, + TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE)); + } // fireTableRowsDeleted() + + /** + * fireTableCellUpdated + * @param value0 TODO + * @param value1 TODO + */ + public void fireTableCellUpdated(int row, int column) { + fireTableChanged(new TableModelEvent(this, row, row, column)); + } // fireTableCellUpdated() + + /** + * fireTableChanged + * @param value0 TODO + */ + public void fireTableChanged(TableModelEvent event) { + + // Variables + Object[] list; + int index; + TableModelListener listener; + + // Get Listener List + list = listenerList.getListenerList(); + + for (index = 0; index < list.length; index += 2) { + + // Get Listener + listener = (TableModelListener) list[index + 1]; + + // Notify Listener + listener.tableChanged(event); + + } // for: index + + } // fireTableChanged() + + /** + * getListeners + * @param value0 TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class listenerType) { + return listenerList.getListeners(listenerType); + } // getListeners() + + /** + * getValueAt + * @param value0 TODO + * @param value1 TODO + * @returns Object + */ + public abstract Object getValueAt(int row, int column); + + /** + * getColumnCount + * @returns int + */ + public abstract int getColumnCount(); + + /** + * getRowCount + * @returns int + */ + public abstract int getRowCount(); + + +} // AbstractTableModel + diff --git a/libjava/javax/swing/table/DefaultTableCellRenderer.java b/libjava/javax/swing/table/DefaultTableCellRenderer.java new file mode 100644 index 00000000000..63c8db2c252 --- /dev/null +++ b/libjava/javax/swing/table/DefaultTableCellRenderer.java @@ -0,0 +1,31 @@ +package javax.swing.table; +import java.awt.Component; +import java.io.Serializable; +import javax.swing.JLabel; +import javax.swing.JTable; +/** + * STUBBED + */ +public class DefaultTableCellRenderer extends JLabel + implements TableCellRenderer, Serializable +{ + public static class UIResource extends DefaultTableCellRenderer + implements javax.swing.plaf.UIResource + { + public UIResource() + { + } + } // class UIResource + + public DefaultTableCellRenderer() + { + } + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, + boolean hasFocus, + int row, int column) + { + return null; + } +} // class DefaultTableCellRenderer diff --git a/libjava/javax/swing/table/DefaultTableColumnModel.java b/libjava/javax/swing/table/DefaultTableColumnModel.java new file mode 100644 index 00000000000..0ead6bd9ee6 --- /dev/null +++ b/libjava/javax/swing/table/DefaultTableColumnModel.java @@ -0,0 +1,354 @@ +/* DefaultTableColumnModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.beans.*; +import java.io.*; +import java.util.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * DefaultTableColumnModel + * @author Andrew Selkirk + * @version 1.0 + */ +public class DefaultTableColumnModel implements TableColumnModel, PropertyChangeListener, ListSelectionListener, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * tableColumns + */ + protected Vector tableColumns; + + /** + * selectionModel + */ + protected ListSelectionModel selectionModel; + + /** + * columnMargin + */ + protected int columnMargin; + + /** + * listenerList + */ + protected EventListenerList listenerList; + + /** + * changeEvent + */ + protected transient ChangeEvent changeEvent; + + /** + * columnSelectionAllowed + */ + protected boolean columnSelectionAllowed; + + /** + * totalColumnWidth + */ + protected int totalColumnWidth; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTableColumnModel + */ + public DefaultTableColumnModel() { + // TODO + } // DefaultTableColumnModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addColumn + * @param value0 TODO + */ + public void addColumn(TableColumn value0) { + // TODO + } // addColumn() + + /** + * removeColumn + * @param value0 TODO + */ + public void removeColumn(TableColumn value0) { + // TODO + } // removeColumn() + + /** + * moveColumn + * @param value0 TODO + * @param value1 TODO + */ + public void moveColumn(int value0, int value1) { + // TODO + } // moveColumn() + + /** + * setColumnMargin + * @param value0 TODO + */ + public void setColumnMargin(int value0) { + // TODO + } // setColumnMargin() + + /** + * getColumnCount + * @returns int + */ + public int getColumnCount() { + return 0; // TODO + } // getColumnCount() + + /** + * getColumns + * @returns Enumeration + */ + public Enumeration getColumns() { + return null; // TODO + } // getColumns() + + /** + * getColumnIndex + * @param value0 TODO + * @returns int + */ + public int getColumnIndex(Object value0) { + return 0; // TODO + } // getColumnIndex() + + /** + * getColumn + * @param value0 TODO + * @returns TableColumn + */ + public TableColumn getColumn(int value0) { + return null; // TODO + } // getColumn() + + /** + * getColumnMargin + * @returns int + */ + public int getColumnMargin() { + return 0; // TODO + } // getColumnMargin() + + /** + * getColumnIndexAtX + * @param value0 TODO + * @returns int + */ + public int getColumnIndexAtX(int value0) { + return 0; // TODO + } // getColumnIndexAtX() + + /** + * getTotalColumnWidth + * @returns int + */ + public int getTotalColumnWidth() { + return 0; // TODO + } // getTotalColumnWidth() + + /** + * setSelectionModel + * @param value0 TODO + */ + public void setSelectionModel(ListSelectionModel value0) { + // TODO + } // setSelectionModel() + + /** + * getSelectionModel + * @returns ListSelectionModel + */ + public ListSelectionModel getSelectionModel() { + return null; // TODO + } // getSelectionModel() + + /** + * setColumnSelectionAllowed + * @param value0 TODO + */ + public void setColumnSelectionAllowed(boolean value0) { + // TODO + } // setColumnSelectionAllowed() + + /** + * getColumnSelectionAllowed + * @returns boolean + */ + public boolean getColumnSelectionAllowed() { + return false; // TODO + } // getColumnSelectionAllowed() + + /** + * getSelectedColumns + * @returns int[] + */ + public int[] getSelectedColumns() { + return null; // TODO + } // getSelectedColumns() + + /** + * getSelectedColumnCount + * @returns int + */ + public int getSelectedColumnCount() { + return 0; // TODO + } // getSelectedColumnCount() + + /** + * addColumnModelListener + * @param value0 TODO + */ + public void addColumnModelListener(TableColumnModelListener value0) { + // TODO + } // addColumnModelListener() + + /** + * removeColumnModelListener + * @param value0 TODO + */ + public void removeColumnModelListener(TableColumnModelListener value0) { + // TODO + } // removeColumnModelListener() + + /** + * fireColumnAdded + * @param value0 TODO + */ + protected void fireColumnAdded(TableColumnModelEvent value0) { + // TODO + } // fireColumnAdded() + + /** + * fireColumnRemoved + * @param value0 TODO + */ + protected void fireColumnRemoved(TableColumnModelEvent value0) { + // TODO + } // fireColumnRemoved() + + /** + * fireColumnMoved + * @param value0 TODO + */ + protected void fireColumnMoved(TableColumnModelEvent value0) { + // TODO + } // fireColumnMoved() + + /** + * fireColumnSelectionChanged + * @param value0 TODO + */ + protected void fireColumnSelectionChanged(ListSelectionEvent value0) { + // TODO + } // fireColumnSelectionChanged() + + /** + * fireColumnMarginChanged + */ + protected void fireColumnMarginChanged() { + // TODO + } // fireColumnMarginChanged() + + /** + * getListeners + * @param value0 TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class value0) { + return null; // TODO + } // getListeners() + + /** + * propertyChange + * @param value0 TODO + */ + public void propertyChange(PropertyChangeEvent value0) { + // TODO + } // propertyChange() + + /** + * valueChanged + * @param value0 TODO + */ + public void valueChanged(ListSelectionEvent value0) { + // TODO + } // valueChanged() + + /** + * createSelectionModel + * @returns ListSelectionModel + */ + protected ListSelectionModel createSelectionModel() { + return null; // TODO + } // createSelectionModel() + + /** + * recalcWidthCache + */ + protected void recalcWidthCache() { + // TODO + } // recalcWidthCache() + + /** + * invalidateWidthCache + */ + private void invalidateWidthCache() { + // TODO + } // invalidateWidthCache() + + +} // DefaultTableColumnModel + diff --git a/libjava/javax/swing/table/DefaultTableModel.java b/libjava/javax/swing/table/DefaultTableModel.java new file mode 100644 index 00000000000..3815bb98c04 --- /dev/null +++ b/libjava/javax/swing/table/DefaultTableModel.java @@ -0,0 +1,493 @@ +/* DefaultTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * DefaultTableModel + * @author Andrew Selkirk + */ +public class DefaultTableModel extends AbstractTableModel implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * dataVector + */ + protected Vector dataVector; + + /** + * columnIdentifiers + */ + protected Vector columnIdentifiers; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTableModel + */ + public DefaultTableModel() { + this(0, 0); + } // DefaultTableModel() + + /** + * Constructor DefaultTableModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTableModel(int numRows, int numColumns) { + + // Variables + int columnIndex; + Vector defaultNames; + + // Create Column Names + defaultNames = new Vector(); + for (columnIndex = 0; columnIndex < numColumns; columnIndex++) { + defaultNames.addElement(super.getColumnName(columnIndex)); + } // for + + // Setup Data +// setDataVector(defaultNames, numRows); + + } // DefaultTableModel() + + /** + * Constructor DefaultTableModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTableModel(Vector columnNames, int numRows) { + + // Variables + Vector data; + Vector rowData; + int rowIndex; + int columnIndex; + int numColumns; + + // Create Data + data = new Vector(); + if (columnNames == null) { + numColumns = 0; + } else { + numColumns = columnNames.size(); + } // if + for (rowIndex = 0; rowIndex < numRows; rowIndex++) { + rowData = new Vector(); + rowData.setSize(numColumns); + data.addElement(rowData); + } // for + + // Setup Data + setDataVector(data, columnNames); + + } // DefaultTableModel() + + /** + * Constructor DefaultTableModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTableModel(Object[] columnNames, int numRows) { + this(convertToVector(columnNames), numRows); + } // DefaultTableModel() + + /** + * Constructor DefaultTableModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTableModel(Vector data, Vector columnNames) { + setDataVector(data, columnNames); + } // DefaultTableModel() + + /** + * Constructor DefaultTableModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTableModel(Object[][] data, Object[] columnNames) { + this(convertToVector(data), convertToVector(columnNames)); + } // DefaultTableModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getDataVector + * @returns Vector + */ + public Vector getDataVector() { + return dataVector; + } // getDataVector() + + /** + * setDataVector + * @param value0 TODO + * @param value1 TODO + */ + public void setDataVector(Vector data, Vector columnNames) { + + // Variables + int rowIndex; + int columnIndex; + int numRows; + int numColumns; + Vector columnVector; + + // Set Data + dataVector = data; + columnIdentifiers = columnNames; + + // Check Data + numRows = data.size(); + numColumns = columnNames.size(); + for (rowIndex = 0; rowIndex < numRows; rowIndex++) { + columnVector = (Vector) dataVector.get(rowIndex); + columnVector.setSize(numColumns); + } // for + + } // setDataVector() + + /** + * setDataVector + * @param value0 TODO + * @param value1 TODO + */ + public void setDataVector(Object[][] data, Object[] columnNames) { + setDataVector(convertToVector(data), convertToVector(columnNames)); + } // setDataVector() + + /** + * newDataAvailable + * @param value0 TODO + */ + public void newDataAvailable(TableModelEvent event) { + fireTableChanged(event); + } // newDataAvailable() + + /** + * newRowsAdded + * @param value0 TODO + */ + public void newRowsAdded(TableModelEvent event) { + // TODO + } // newRowsAdded() + + /** + * rowsRemoved + * @param value0 TODO + */ + public void rowsRemoved(TableModelEvent event) { + fireTableChanged(event); + } // rowsRemoved() + + /** + * setColumnIdentifiers + * @param value0 TODO + */ + public void setColumnIdentifiers(Vector columnIdentifiers) { + this.columnIdentifiers = columnIdentifiers; + setColumnCount(columnIdentifiers.size()); + } // setColumnIdentifiers() + + /** + * setColumnIdentifiers + * @param value0 TODO + */ + public void setColumnIdentifiers(Object[] columnIdentifiers) { + setColumnIdentifiers(convertToVector(columnIdentifiers)); + } // setColumnIdentifiers() + + /** + * setNumRows + * @param value0 TODO + */ + public void setNumRows(int numRows) { + setRowCount(numRows); + } // setNumRows() + + /** + * setRowCount + * @param value0 TODO + */ + public void setRowCount(int rowCount) { + // TODO + } // setRowCount() + + /** + * setColumnCount + * @param value0 TODO + */ + public void setColumnCount(int columnCount) { + // TODO + } // setColumnCount() + + /** + * addColumn + * @param value0 TODO + */ + public void addColumn(Object columnName) { + addColumn(columnName, new Vector(dataVector.size())); + } // addColumn() + + /** + * addColumn + * @param value0 TODO + * @param value1 TODO + */ + public void addColumn(Object columnName, Vector columnData) { + // TODO + } // addColumn() + + /** + * addColumn + * @param value0 TODO + * @param value1 TODO + */ + public void addColumn(Object columnName, Object[] columnData) { + // TODO + } // addColumn() + + /** + * addRow + * @param value0 TODO + */ + public void addRow(Vector rowData) { + // TODO + } // addRow() + + /** + * addRow + * @param value0 TODO + */ + public void addRow(Object[] rowData) { + addRow(convertToVector(rowData)); + } // addRow() + + /** + * insertRow + * @param value0 TODO + * @param value1 TODO + */ + public void insertRow(int row, Vector rowData) { + dataVector.add(row, rowData); + } // insertRow() + + /** + * insertRow + * @param value0 TODO + * @param value1 TODO + */ + public void insertRow(int row, Object[] rowData) { + insertRow(row, convertToVector(rowData)); + } // insertRow() + + /** + * moveRow + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void moveRow(int startIndex, int endIndex, int toIndex) { + + // Variables + int index; + Vector vector; + + // Move Rows + for (index = 0; index < (endIndex - startIndex); index++) { + vector = (Vector) dataVector.remove(startIndex); + dataVector.add(toIndex, vector); + } // for + + } // moveRow() + + /** + * removeRow + * @param value0 TODO + */ + public void removeRow(int row) { + dataVector.remove(row); + } // removeRow() + + /** + * getRowCount + * @returns int + */ + public int getRowCount() { + return dataVector.size(); + } // getRowCount() + + /** + * getColumnCount + * @returns int + */ + public int getColumnCount() { + return columnIdentifiers.size(); + } // getColumnCount() + + /** + * getColumnName + * @param value0 TODO + * @returns String + */ + public String getColumnName(int column) { + + // Check for Column + if (columnIdentifiers == null || column >= getColumnCount()) { + return super.getColumnName(column); + } // if + + // Return Column name + return (String) columnIdentifiers.get(column); + + } // getColumnName() + + /** + * isCellEditable + * @param value0 TODO + * @param value1 TODO + * @returns boolean + */ + public boolean isCellEditable(int row, int column) { + return true; + } // isCellEditable() + + /** + * getValueAt + * @param value0 TODO + * @param value1 TODO + * @returns Object + */ + public Object getValueAt(int row, int column) { + + // Variables + Vector rowVector; + + // Get Row Vector + rowVector = (Vector) dataVector.get(row); + + // Get Data + return rowVector.get(column); + + } // getValueAt() + + /** + * setValueAt + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void setValueAt(Object value, int row, int column) { + + // Variables + Vector rowVector; + + // Get Row Vector + rowVector = (Vector) dataVector.get(row); + + // Set Data + rowVector.remove(column); + rowVector.add(column, value); + + } // setValueAt() + + /** + * convertToVector + * @param value0 TODO + * @returns Vector + */ + protected static Vector convertToVector(Object[] data) { + + // Variables + int index; + Vector vector; + + // Check for null + if (data == null) { + return null; + } // if + + // Process + vector = new Vector(); + for (index = 0; index < data.length; index++) { + vector.add(data[index]); + } // for: index + + // Return new Vector + return vector; + + } // convertToVector() + + /** + * convertToVector + * @param value0 TODO + * @returns Vector + */ + protected static Vector convertToVector(Object[][] data) { + + // Variables + int index; + Vector vector; + + // Process + vector = new Vector(); + for (index = 0; index < data.length; index++) { + vector.add(convertToVector(data[index])); + } // for: index + + // Return new Vector + return vector; + + } // convertToVector() + + +} // DefaultTableModel diff --git a/libjava/javax/swing/table/TableCellEditor.java b/libjava/javax/swing/table/TableCellEditor.java new file mode 100644 index 00000000000..e7673c16875 --- /dev/null +++ b/libjava/javax/swing/table/TableCellEditor.java @@ -0,0 +1,64 @@ +/* TableCellEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.awt.Component; +import javax.swing.JTable; +import javax.swing.CellEditor; + +/** + * TableCellEditor interface + * @author Andrew Selkirk + */ +public interface TableCellEditor extends CellEditor { + + /** + * Get table cell editor component + * @param table JTable + * @param value Value of cell + * @param isSelected Cell selected + * @param row Row of cell + * @param column Column of cell + * @returns Component + */ + public Component getTableCellEditorComponent(JTable table, + Object value, boolean isSelected, int row, int column); + + +} // TableCellEditor diff --git a/libjava/javax/swing/table/TableCellRenderer.java b/libjava/javax/swing/table/TableCellRenderer.java new file mode 100644 index 00000000000..12a950661e9 --- /dev/null +++ b/libjava/javax/swing/table/TableCellRenderer.java @@ -0,0 +1,65 @@ +/* TableCellRenderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.awt.Component; +import javax.swing.JTable; + +/** + * TableCellRenderer interface + * @author Andrew Selkirk + */ +public interface TableCellRenderer { + + /** + * Get table cell renderer component + * @param table JTable + * @param value Value of cell + * @param isSelected Cell selected + * @param hasFocus Cell has focus + * @param row Row of cell + * @param column Column of cell + * @returns Component + */ + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, + int row, int column); + + +} // TableCellRenderer diff --git a/libjava/javax/swing/table/TableColumn.java b/libjava/javax/swing/table/TableColumn.java new file mode 100644 index 00000000000..8be7c19233f --- /dev/null +++ b/libjava/javax/swing/table/TableColumn.java @@ -0,0 +1,515 @@ +/* TableColumn.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.beans.*; +import java.io.*; +import javax.swing.event.*; + +/** + * TableColumn + * @author Andrew Selkirk + * @version 1.0 + */ +public class TableColumn implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * COLUMN_WIDTH_PROPERTY + */ + public static final String COLUMN_WIDTH_PROPERTY = "columWidth"; + + /** + * HEADER_VALUE_PROPERTY + */ + public static final String HEADER_VALUE_PROPERTY = "headerValue"; + + /** + * HEADER_RENDERER_PROPERTY + */ + public static final String HEADER_RENDERER_PROPERTY = "headerRenderer"; + + /** + * CELL_RENDERER_PROPERTY + */ + public static final String CELL_RENDERER_PROPERTY = "cellRenderer"; + + /** + * modelIndex + */ + protected int modelIndex; + + /** + * identifier + */ + protected Object identifier; + + /** + * width + */ + protected int width; + + /** + * minWidth + */ + protected int minWidth = 15; + + /** + * preferredWidth + */ + private int preferredWidth; + + /** + * maxWidth + */ + protected int maxWidth = Integer.MAX_VALUE; + + /** + * headerRenderer + */ + protected TableCellRenderer headerRenderer; + + /** + * headerValue + */ + protected Object headerValue; + + /** + * cellRenderer + */ + protected TableCellRenderer cellRenderer; + + /** + * cellEditor + */ + protected TableCellEditor cellEditor; + + /** + * isResizable + */ + protected boolean isResizable = true; + + /** + * resizedPostingDisableCount + */ + protected transient int resizedPostingDisableCount; + + /** + * changeSupport + */ + private SwingPropertyChangeSupport changeSupport = new SwingPropertyChangeSupport(this); + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TableColumn + */ + public TableColumn() { + this(0, 75, null, null); + } // TableColumn() + + /** + * Constructor TableColumn + * @param modelIndex TODO + */ + public TableColumn(int modelIndex) { + this(modelIndex, 75, null, null); + } // TableColumn() + + /** + * Constructor TableColumn + * @param modelIndex TODO + * @param width TODO + */ + public TableColumn(int modelIndex, int width) { + this(modelIndex, width, null, null); + } // TableColumn() + + /** + * Constructor TableColumn + * @param modelIndex TODO + * @param width TODO + * @param cellRenderer TODO + * @param cellEditor TODO + */ + public TableColumn(int modelIndex, int width, + TableCellRenderer cellRenderer, TableCellEditor cellEditor) { + this.modelIndex = modelIndex; + this.width = width; + this.preferredWidth = width; + this.cellRenderer = cellRenderer; + this.cellEditor = cellEditor; + this.headerValue = null; + this.identifier = null; + } // TableColumn() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * firePropertyChange + * @param property TODO + * @param oldValue TODO + * @param newValue TODO + */ + private void firePropertyChange(String property, Object oldValue, Object newValue) { + changeSupport.firePropertyChange(property, oldValue, newValue); + } // firePropertyChange() + + /** + * firePropertyChange + * @param property TODO + * @param oldValue TODO + * @param newValue TODO + */ + private void firePropertyChange(String property, int oldValue, int newValue) { + firePropertyChange(property, new Integer(oldValue), new Integer(newValue)); + } // firePropertyChange() + + /** + * firePropertyChange + * @param property TODO + * @param oldValue TODO + * @param newValue TODO + */ + private void firePropertyChange(String property, boolean oldValue, boolean newValue) { + firePropertyChange(property, new Boolean(oldValue), new Boolean(newValue)); + } // firePropertyChange() + + /** + * setModelIndex + * @param modelIndex TODO + */ + public void setModelIndex(int modelIndex) { + this.modelIndex = modelIndex; + } // setModelIndex() + + /** + * getModelIndex + * @returns int + */ + public int getModelIndex() { + return modelIndex; + } // getModelIndex() + + /** + * setIdentifier + * @param identifier TODO + */ + public void setIdentifier(Object identifier) { + this.identifier = identifier; + } // setIdentifier() + + /** + * getIdentifier + * @returns Object + */ + public Object getIdentifier() { + if (identifier == null) { + return getHeaderValue(); + } // if + return identifier; + } // getIdentifier() + + /** + * setHeaderValue + * @param headerValue TODO + */ + public void setHeaderValue(Object headerValue) { + + // Variables + Object oldValue; + + // Get Old Value + oldValue = this.headerValue; + + // Set Propeprty + this.headerValue = headerValue; + + // Notify Listeners of change + firePropertyChange(HEADER_VALUE_PROPERTY, + oldValue, headerValue); + + } // setHeaderValue() + + /** + * getHeaderValue + * @returns Object + */ + public Object getHeaderValue() { + return headerValue; + } // getHeaderValue() + + /** + * setHeaderRenderer + * @param headerRenderer TODO + */ + public void setHeaderRenderer(TableCellRenderer headerRenderer) { + + // Variables + TableCellRenderer oldRenderer; + + // Get Old Renderer + oldRenderer = this.headerRenderer; + + // Set Property + this.headerRenderer = headerRenderer; + + // Notify Listeners of change + firePropertyChange(HEADER_RENDERER_PROPERTY, + oldRenderer, headerRenderer); + + } // setHeaderRenderer() + + /** + * getHeaderRenderer + * @returns TableCellRenderer + */ + public TableCellRenderer getHeaderRenderer() { + return headerRenderer; + } // getHeaderRenderer() + + /** + * setCellRenderer + * @param cellRenderer TODO + */ + public void setCellRenderer(TableCellRenderer cellRenderer) { + + // Variables + TableCellRenderer oldRenderer; + + // Get Old Renderer + oldRenderer = this.cellRenderer; + + // Set Property + this.cellRenderer = cellRenderer; + + // Notify Listeners of change + firePropertyChange(CELL_RENDERER_PROPERTY, + oldRenderer, cellRenderer); + + } // setCellRenderer() + + /** + * getCellRenderer + * @returns TableCellRenderer + */ + public TableCellRenderer getCellRenderer() { + return cellRenderer; + } // getCellRenderer() + + /** + * setCellEditor + * @param cellEditor TODO + */ + public void setCellEditor(TableCellEditor cellEditor) { + this.cellEditor = cellEditor; + } // setCellEditor() + + /** + * getCellEditor + * @returns TableCellEditor + */ + public TableCellEditor getCellEditor() { + return cellEditor; + } // getCellEditor() + + /** + * setWidth + * @param width TODO + */ + public void setWidth(int width) { + + // Variables + int oldWidth; + + // Get Old Width + oldWidth = this.width; + + // Adjust Width within Limits + if (width < minWidth) { + this.width = minWidth; + } else if (width > maxWidth) { + this.width = maxWidth; + } else { + this.width = width; + } // if + + // Fire Property Change + firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, this.width); + + } // setWidth() + + /** + * getWidth + * @returns int + */ + public int getWidth() { + return width; + } // getWidth() + + /** + * setPreferredWidth + * @param preferredWidth TODO + */ + public void setPreferredWidth(int preferredWidth) { + if (preferredWidth < minWidth) { + this.preferredWidth = minWidth; + } else if (preferredWidth > maxWidth) { + this.preferredWidth = maxWidth; + } else { + this.preferredWidth = preferredWidth; + } // if + } // setPreferredWidth() + + /** + * getPreferredWidth + * @returns int + */ + public int getPreferredWidth() { + return preferredWidth; + } // getPreferredWidth() + + /** + * setMinWidth + * @param minWidth TODO + */ + public void setMinWidth(int minWidth) { + this.minWidth = minWidth; + setWidth(getWidth()); + setPreferredWidth(getPreferredWidth()); + } // setMinWidth() + + /** + * getMinWidth + * @returns int + */ + public int getMinWidth() { + return minWidth; + } // getMinWidth() + + /** + * setMaxWidth + * @param maxWidth TODO + */ + public void setMaxWidth(int maxWidth) { + this.maxWidth = maxWidth; + setWidth(getWidth()); + setPreferredWidth(getPreferredWidth()); + } // setMaxWidth() + + /** + * getMaxWidth + * @returns int + */ + public int getMaxWidth() { + return maxWidth; + } // getMaxWidth() + + /** + * setResizable + * @param isResizable TODO + */ + public void setResizable(boolean isResizable) { + this.isResizable = isResizable; + } // setResizable() + + /** + * getResizable + * @returns boolean + */ + public boolean getResizable() { + return isResizable; + } // getResizable() + + /** + * sizeWidthToFit + */ + public void sizeWidthToFit() { + // TODO + } // sizeWidthToFit() + + /** + * disableResizedPosting + */ + public void disableResizedPosting() { + // Does nothing + } // disableResizedPosting() + + /** + * enableResizedPosting + */ + public void enableResizedPosting() { + // Does nothing + } // enableResizedPosting() + + /** + * addPropertyChangeListener + * @param listener TODO + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + changeSupport.addPropertyChangeListener(listener); + } // addPropertyChangeListener() + + /** + * removePropertyChangeListener + * @param listener TODO + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + changeSupport.removePropertyChangeListener(listener); + } // removePropertyChangeListener() + + /** + * createDefaultHeaderRenderer + * @returns TableCellRenderer + */ + protected TableCellRenderer createDefaultHeaderRenderer() { + return new DefaultTableCellRenderer(); + } // createDefaultHeaderRenderer() + + +} // TableColumn diff --git a/libjava/javax/swing/table/TableColumnModel.java b/libjava/javax/swing/table/TableColumnModel.java new file mode 100644 index 00000000000..fbb8b6281ae --- /dev/null +++ b/libjava/javax/swing/table/TableColumnModel.java @@ -0,0 +1,167 @@ +/* TableColumnModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import java.util.Enumeration; +import javax.swing.ListSelectionModel; +import javax.swing.event.TableColumnModelListener; + +/** + * TableColumnModel interface + * @author Andrew Selkirk + */ +public interface TableColumnModel { + + /** + * addColumn + * @param column TableColumn + */ + public void addColumn(TableColumn column); + + /** + * removeColumn + * @param column TableColumn + */ + public void removeColumn(TableColumn column); + + /** + * moveColumn + * @param columnIndex Index of column to move + * @param newIndex New index of column + */ + public void moveColumn(int columnIndex, int newIndex); + + /** + * setColumnMargin + * @param margin Margin of column + */ + public void setColumnMargin(int margin); + + /** + * getColumnCount + * @returns Column count + */ + public int getColumnCount(); + + /** + * getColumns + * @returns Enumeration of columns + */ + public Enumeration getColumns(); + + /** + * getColumnIndex + * @param columnIdentifier Column id + */ + public int getColumnIndex(Object columnIdentifier); + + /** + * getColumn + * @param columnIndex Index of column + */ + public TableColumn getColumn(int columnIndex); + + /** + * getColumnMargin + * @returns Column margin + */ + public int getColumnMargin(); + + /** + * getColumnIndexAtX + * @returns Column index as position x + */ + public int getColumnIndexAtX(int xPosition); + + /** + * getTotalColumnWidth + * @returns Total column width + */ + public int getTotalColumnWidth(); + + /** + * setColumnSelectionAllowed + * @param value Set column selection + */ + public void setColumnSelectionAllowed(boolean value); + + /** + * getColumnSelectionAllowed + * @returns true if column selection allowed, false otherwise + */ + public boolean getColumnSelectionAllowed(); + + /** + * getSelectedColumns + * @returns Selected columns + */ + public int[] getSelectedColumns(); + + /** + * getSelectedColumnCount + * @returns Count of selected columns + */ + public int getSelectedColumnCount(); + + /** + * setSelectionModel + * @param model ListSelectionModel + */ + public void setSelectionModel(ListSelectionModel model); + + /** + * getSelectionModel + * @param column TableColumn + */ + public ListSelectionModel getSelectionModel(); + + /** + * addColumnModelListener + * @param listener TableColumnModelListener + */ + public void addColumnModelListener(TableColumnModelListener listener); + + /** + * removeColumnModelListener + * @param listener TableColumnModelListener + */ + public void removeColumnModelListener(TableColumnModelListener listener); + + +} // TableColumnModel diff --git a/libjava/javax/swing/table/TableModel.java b/libjava/javax/swing/table/TableModel.java new file mode 100644 index 00000000000..849fba70006 --- /dev/null +++ b/libjava/javax/swing/table/TableModel.java @@ -0,0 +1,112 @@ +/* TableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.table; + +// Imports +import javax.swing.event.TableModelListener; + +/** + * TableModel interface + * @author Andrew Selkirk + */ +public interface TableModel { + + /** + * getRowCount + * @returns row count + */ + public int getRowCount(); + + /** + * getColumnCount + * @returns column count + */ + public int getColumnCount(); + + /** + * getColumnName + * @param columnIndex Column index + * @returns Column name + */ + public String getColumnName(int columnIndex); + + /** + * getColumnClass + * @param columnIndex Column index + * @returns Column class + */ + public Class getColumnClass(int columnIndex); + + /** + * isCellEditable + * @param rowIndex Row index + * @param columnIndex Column index + * @returns true if editable, false otherwise + */ + public boolean isCellEditable(int rowIndex, int columnIndex); + + /** + * getValueAt + * @param rowIndex Row index + * @param columnIndex Column index + * @returns Value at specified indices + */ + public Object getValueAt(int rowIndex, int columnIndex); + + /** + * setValueAt + * @param aValue Value to set + * @param rowIndex Row index + * @param columnIndex Column index + */ + public void setValueAt(Object aValue, int rowIndex, int columnIndex); + + /** + * addTableModelListener + * @param listener TableModelListener + */ + public void addTableModelListener(TableModelListener listener); + + /** + * removeTableModelListener + * @param listener TableModelListener + */ + public void removeTableModelListener(TableModelListener listener); + + +} // TableModel diff --git a/libjava/javax/swing/text/AbstractDocument.java b/libjava/javax/swing/text/AbstractDocument.java new file mode 100644 index 00000000000..56ec3777920 --- /dev/null +++ b/libjava/javax/swing/text/AbstractDocument.java @@ -0,0 +1,360 @@ +/* AbstractDocument.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.event.*; +import javax.swing.undo.*; +import java.util.*; +import javax.swing.tree.*; + +public abstract class AbstractDocument implements Document +{ + Vector doc_list = new Vector(); + Vector undo_list = new Vector(); + + // these still need to be implemented by a derived class: + public abstract Element getParagraphElement(int pos); + public abstract Element getDefaultRootElement(); + + // some inner classes sun says I should have: + abstract class AbstractElement implements Element, TreeNode + { + int count, offset; + AttributeSet attr; + Vector elts = new Vector(); + String name; + Element parent; + Vector kids = new Vector(); + TreeNode tree_parent; + + public AbstractElement(Element p, AttributeSet s) + { parent = p; attr = s; } + + public Enumeration children() { return kids.elements(); } + public boolean getAllowsChildren() { return true; } + public TreeNode getChildAt(int index) { return (TreeNode) kids.elementAt(index); } + public int getChildCount() { return kids.size(); } + public int getIndex(TreeNode node) { return kids.indexOf(node); } + public TreeNode getParent() { return tree_parent; } + + public AttributeSet getAttributes() { return attr; } + public Document getDocument() { return AbstractDocument.this; } + public Element getElement(int index) { return (Element)elts.elementAt(index); } + public String getName() { return name; } + public Element getParentElement() { return parent; } + + public abstract boolean isLeaf(); + public abstract int getEndOffset(); + public abstract int getElementCount(); + public abstract int getElementIndex(int offset); + public abstract int getStartOffset(); + } + + interface AttributeContext + { + } + + + class BranchElement extends AbstractElement + { + public BranchElement(Element e, AttributeSet a, int s, int end) + { super(e, a); } + + public boolean isLeaf() { return false; } + public int getEndOffset() { return 0; } + public int getElementCount() { return 0; } + public int getElementIndex(int offset) { return 0; } + public int getStartOffset() { return 0; } + } + + public interface Content + { + public Position createPosition(int offset) throws BadLocationException; + public int length(); + public UndoableEdit insertString(int where, String str) throws BadLocationException; + public UndoableEdit remove(int where, int nitems) throws BadLocationException; + public String getString(int where, int len) throws BadLocationException; + public void getChars(int where, int len, Segment txt) throws BadLocationException; + } + + class DefaultDocumentEvent implements DocumentEvent + { + int len, off; + public Document getDocument() { return AbstractDocument.this; } + public int getLength() { return len; } + public int getOffset() { return off; } + public DocumentEvent.EventType getType() { return null; } + public DocumentEvent.ElementChange getChange(Element elem) { return null; } + } + + static class ElementEdit + { + } + + class LeafElement extends AbstractElement + { + LeafElement(Element e, AttributeSet a, int s, int end) + { super(e, a); } + + public boolean isLeaf() { return true; } + public int getEndOffset() { return 0; } + public int getElementCount() { return 0; } + public int getElementIndex(int offset) { return 0; } + public int getStartOffset() { return 0; } + } + + + Content content; + + AbstractDocument(Content doc) + { + content = doc; + } + + /******************************************************** + * + * the meat: + * + ***********/ + + + public void addDocumentListener(DocumentListener listener) + { + doc_list.addElement(listener); + } + + public void addUndoableEditListener(UndoableEditListener listener) + { + undo_list.addElement(listener); + } + + protected Element createBranchElement(Element parent, AttributeSet a) + { + return new BranchElement(parent, a, 0, 0); + } + + protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) + { + return new LeafElement(parent, a, p0, p1-p0); + } + + public Position createPosition(int offs) + { + final int a = offs; + return new Position() + { + public int getOffset() + { + return a; + } + }; + } + + protected void fireChangedUpdate(DocumentEvent e) + { + } + + protected void fireInsertUpdate(DocumentEvent e) + { + } + + protected void fireRemoveUpdate(DocumentEvent e) + { + } + + protected void fireUndoableEditUpdate(UndoableEditEvent e) + { + } + int getAsynchronousLoadPriority() + { + return 0; + } + + protected AttributeContext getAttributeContext() + { + return null; + } + + Element getBidiRootElement() + { + return null; + } + + protected Content getContent() + { + return content; + } + + protected Thread getCurrentWriter() + { + return null; + } + + + Dictionary getDocumentProperties() + { + return null; + } + + public Position getEndPosition() + { + return null; + } + + public int getLength() + { + return content.length(); + } + + EventListener[] getListeners(Class listenerType) + { + return null; + } + + public Object getProperty(Object key) + { + return null; + } + + public Element[] getRootElements() + { + return null; + } + + public Position getStartPosition() + { + return null; + } + + public String getText(int offset, int length) + { + try { + return content.getString(offset, length); + } catch (Exception e) { + System.out.println("Hmmm, fail to getText: " + offset + " -> " + length); + return null; + } + } + + public void getText(int offset, int length, Segment txt) + { + String a = getText(offset, length); + + if (a == null) + { + txt.offset = 0; + txt.count = 0; + txt.array = new char[0]; + return; + } + + txt.offset = offset; + txt.count = length; + + char chars[] = new char[ a.length() ]; + + a.getChars(0, a.length(), chars, 0); + + txt.array = chars; + } + + public void insertString(int offs, String str, AttributeSet a) + { + try { + content.insertString(offs, str); + } catch (Exception e) { + System.err.println("FAILED TO INSERT-STRING: " + e + ", at:"+offs); + } + } + + protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr) + { + } + + protected void postRemoveUpdate(DefaultDocumentEvent chng) + { + } + + public void putProperty(Object key, Object value) + { + } + + void readLock() + { + } + + void readUnlock() + { + } + + public void remove(int offs, int len) + { + } + + public void removeDocumentListener(DocumentListener listener) + { + } + + public void removeUndoableEditListener(UndoableEditListener listener) + { + } + + protected void removeUpdate(DefaultDocumentEvent chng) + { + } + + public void render(Runnable r) + { + } + + void setAsynchronousLoadPriority(int p) + { + } + + void setDocumentProperties(Dictionary x) + { + } + + protected void writeLock() + { + } + + protected void writeUnlock() + { + } +} diff --git a/libjava/javax/swing/text/AttributeSet.java b/libjava/javax/swing/text/AttributeSet.java new file mode 100644 index 00000000000..2ed3fc37d80 --- /dev/null +++ b/libjava/javax/swing/text/AttributeSet.java @@ -0,0 +1,54 @@ +/* AttributeSet.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.*; + + +public interface AttributeSet +{ + boolean containsAttribute(Object name, Object value); + boolean containsAttributes(AttributeSet attributes); + AttributeSet copyAttributes(); + Object getAttribute(Object key); + int getAttributeCount(); + Enumeration getAttributeNames(); + AttributeSet getResolveParent(); + boolean isDefined(Object attrName); + boolean isEqual(AttributeSet attr); +} diff --git a/libjava/javax/swing/text/BadLocationException.java b/libjava/javax/swing/text/BadLocationException.java new file mode 100644 index 00000000000..81e6cc8dc03 --- /dev/null +++ b/libjava/javax/swing/text/BadLocationException.java @@ -0,0 +1,46 @@ +/* BadLocationException.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public class BadLocationException extends Exception +{ + BadLocationException() + { + } +} diff --git a/libjava/javax/swing/text/Caret.java b/libjava/javax/swing/text/Caret.java new file mode 100644 index 00000000000..69f63edf68d --- /dev/null +++ b/libjava/javax/swing/text/Caret.java @@ -0,0 +1,62 @@ +/* Caret.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.*; +import javax.swing.event.*; + +public interface Caret +{ + void addChangeListener(ChangeListener l); + void deinstall(JTextComponent c); + int getBlinkRate(); + int getDot(); + Point getMagicaretPosition(); + int getMark(); + void install(JTextComponent c); + boolean isSelectionVisible(); + boolean isVisible(); + void moveDot(int dot); + void paint(Graphics g); + void removeChangeListener(ChangeListener l); + void setBlinkRate(int rate); + void setDot(int dot); + void setMagicCaretPosition(Point p); + void setSelectionVisible(boolean v); + void setVisible(boolean v); +} diff --git a/libjava/javax/swing/text/CharacterIterator.java b/libjava/javax/swing/text/CharacterIterator.java new file mode 100644 index 00000000000..71c8d660e4f --- /dev/null +++ b/libjava/javax/swing/text/CharacterIterator.java @@ -0,0 +1,53 @@ +/* CharacterIterator.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public interface CharacterIterator extends Cloneable +{ + Object clone(); + char current(); + char first(); + int getBeginIndex(); + int getEndIndex(); + int getIndex(); + char last(); + char next(); + char previous(); + char setIndex(int position); +} diff --git a/libjava/javax/swing/text/ComponentView.java b/libjava/javax/swing/text/ComponentView.java new file mode 100644 index 00000000000..220ba0c8185 --- /dev/null +++ b/libjava/javax/swing/text/ComponentView.java @@ -0,0 +1,101 @@ +/* ComponentView.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.*; + +public class ComponentView extends View +{ + public ComponentView(Element elem) + { + super(elem); + } + + + protected Component createComponent() + { + return null; + } + + public float getAlignment(int axis) + { + return 0; + } + + public Component getComponent() + { + return null; + } + + public float getMaximumSpan(int axis) + { + return 0; + } + + public float getMinimumSpan(int axis) + { + return 0; + } + + public float getPreferredSpan(int axis) + { + return 0; + } + + public Shape modelToView(int pos, Shape a, Position.Bias b) + { + return null; + } + + public void paint(Graphics g, Shape a) + { + } + + public void setParent(View p) + { + } + + public void setSize(float width, float height) + { + } + + public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) + { + return 0; + } +} diff --git a/libjava/javax/swing/text/DefaultCaret.java b/libjava/javax/swing/text/DefaultCaret.java new file mode 100644 index 00000000000..7fb7f945262 --- /dev/null +++ b/libjava/javax/swing/text/DefaultCaret.java @@ -0,0 +1,172 @@ +/* DefaultCaret.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.*; +import java.util.*; +import java.awt.event.*; +import javax.swing.event.*; + + +public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener +{ + Color color = new Color(0,0,0); + JTextComponent parent; + + public void mouseDragged(java.awt.event.MouseEvent evt) + { + } + + public void mouseMoved(java.awt.event.MouseEvent evt) + { + } + + public void mouseClicked(java.awt.event.MouseEvent evt) + { + } + + public void mouseEntered(java.awt.event.MouseEvent evt) + { + } + + public void mouseExited(java.awt.event.MouseEvent evt) + { + } + + public void mousePressed(java.awt.event.MouseEvent evt) + { + } + + public void mouseReleased(java.awt.event.MouseEvent evt) + { + } + + public void focusGained(java.awt.event.FocusEvent evt) + { + } + + public void focusLost(java.awt.event.FocusEvent evt) + { + } + + // caret methods: + + public void deinstall(JTextComponent c) + { + parent.removeFocusListener(this); + parent.removeMouseListener(this); + + parent = null; + } + public void install(JTextComponent c) + { + parent.addFocusListener(this); + parent.addMouseListener(this); + parent = c; + repaint(); + } + + Point magic = null; + public void setMagicCaretPosition(Point p) + { magic = p; } + public Point getMagicaretPosition() + { return magic; } + + + int mark = 0; + public int getMark() + { return mark; } + + boolean vis_sel = true; + public void setSelectionVisible(boolean v) + { vis_sel = v; repaint(); } + public boolean isSelectionVisible() + { return vis_sel; } + + private void repaint() + { + if (parent != null) + { + parent.repaint(); + } + } + + public void paint(Graphics g) + { + g.setColor(color); + g.drawLine(x,y, + x,y+height); + } + + + Vector changes = new Vector(); + public void addChangeListener(ChangeListener l) + { changes.addElement(l); } + public void removeChangeListener(ChangeListener l) + { changes.removeElement(l); } + + + int blink = 500; + public int getBlinkRate() + { return blink; } + public void setBlinkRate(int rate) + { blink = rate; } + + int dot = 0; + public int getDot() + { return dot; } + public void moveDot(int dot) + { setDot(dot); } + public void setDot(int dot) + { + this.dot = dot; + repaint(); + } + + boolean vis = true; + public boolean isVisible() + { return vis; } + public void setVisible(boolean v) + { + vis = v; + repaint(); + } +} + + + diff --git a/libjava/javax/swing/text/DefaultEditorKit.java b/libjava/javax/swing/text/DefaultEditorKit.java new file mode 100644 index 00000000000..550c4a74db4 --- /dev/null +++ b/libjava/javax/swing/text/DefaultEditorKit.java @@ -0,0 +1,89 @@ +/* DefaultEditorKit.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.*; +import java.io.*; + +public class DefaultEditorKit extends EditorKit +{ + void deinstall(JEditorPane c) + { + // Called when the kit is being removed from the JEditorPane. + } + void install(JEditorPane c) + { + } + + Caret createCaret() + { + return null; + } + Document createDefaultDocument() + { + return new PlainDocument(); + } + + Action[] getActions() + { + return null; + } + + String getContentType() + { + return "text/plain"; + } + + ViewFactory getViewFactory() + { + return null; + } + void read(InputStream in, Document doc, int pos) + { + } + void read(Reader in, Document doc, int pos) + { + } + void write(OutputStream out, Document doc, int pos, int len) + { + } + void write(Writer out, Document doc, int pos, int len) + { + } +} + diff --git a/libjava/javax/swing/text/Document.java b/libjava/javax/swing/text/Document.java new file mode 100644 index 00000000000..398030f0849 --- /dev/null +++ b/libjava/javax/swing/text/Document.java @@ -0,0 +1,62 @@ +/* Document.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.event.*; + +public interface Document +{ + void addDocumentListener(DocumentListener listener); + void addUndoableEditListener(UndoableEditListener listener); + Position createPosition(int offs); + Element getDefaultRootElement(); + Position getEndPosition(); + int getLength(); + Object getProperty(Object key); + Element[] getRootElements(); + Position getStartPosition(); + String getText(int offset, int length); + void getText(int offset, int length, Segment txt); + void insertString(int offset, String str, AttributeSet a); + void putProperty(Object key, Object value); + void remove(int offs, int len); + void removeDocumentListener(DocumentListener listener); + void removeUndoableEditListener(UndoableEditListener listener); + void render(Runnable r); +} diff --git a/libjava/javax/swing/text/EditorKit.java b/libjava/javax/swing/text/EditorKit.java new file mode 100644 index 00000000000..b52298c441c --- /dev/null +++ b/libjava/javax/swing/text/EditorKit.java @@ -0,0 +1,71 @@ +/* EditorKit.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.*; +import java.io.*; + +public abstract class EditorKit implements Cloneable +{ + EditorKit() + { + } + + EditorKit(EditorKit kit) + { + } + + void deinstall(JEditorPane c) + { + // Called when the kit is being removed from the JEditorPane. + } + void install(JEditorPane c) + { + } + + abstract Caret createCaret(); + abstract Document createDefaultDocument(); + abstract Action[] getActions(); + abstract String getContentType(); + abstract ViewFactory getViewFactory(); + abstract void read(InputStream in, Document doc, int pos); + abstract void read(Reader in, Document doc, int pos); + abstract void write(OutputStream out, Document doc, int pos, int len); + abstract void write(Writer out, Document doc, int pos, int len); +} + diff --git a/libjava/javax/swing/text/Element.java b/libjava/javax/swing/text/Element.java new file mode 100644 index 00000000000..9f61612649f --- /dev/null +++ b/libjava/javax/swing/text/Element.java @@ -0,0 +1,54 @@ +/* Element.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + + +public interface Element +{ + AttributeSet getAttributes(); + Document getDocument(); + Element getElement(int index); + int getElementCount(); + int getElementIndex(int offset); + int getEndOffset(); + String getName(); + Element getParentElement(); + int getStartOffset(); + boolean isLeaf(); + } diff --git a/libjava/javax/swing/text/GapContent.java b/libjava/javax/swing/text/GapContent.java new file mode 100644 index 00000000000..d6986974be2 --- /dev/null +++ b/libjava/javax/swing/text/GapContent.java @@ -0,0 +1,104 @@ +/* GapContent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// too lazy to make a real gapcontent. +// lets just use a stringbuffer instead. + +import javax.swing.undo.*; + + +public class GapContent implements AbstractDocument.Content +{ + StringBuffer buf = new StringBuffer(); + + public GapContent() + { + this(10); + } + + public GapContent(int size) + { + } + + public Position createPosition(final int offset) throws BadLocationException + { + return new Position() + { + int off = offset; + public int getOffset() + { + return off; + } + }; + } + + public int length() + { + return buf.length(); + } + + public UndoableEdit insertString(int where, String str) throws BadLocationException + { + buf.insert(where, str); + return null; + } + + public UndoableEdit remove(int where, int nitems) throws BadLocationException + { + buf.delete(where, where + nitems); + return null; + } + + public String getString(int where, int len) throws BadLocationException + { + return buf.toString(); + } + + public void getChars(int where, int len, Segment txt) throws BadLocationException + { + txt.array = new char[len]; + + System.arraycopy(buf.toString().toCharArray(), where, + txt.array, 0, + len); + + txt.count = len; + txt.offset = 0; + } +} diff --git a/libjava/javax/swing/text/JTextComponent.java b/libjava/javax/swing/text/JTextComponent.java new file mode 100644 index 00000000000..9a6d350f048 --- /dev/null +++ b/libjava/javax/swing/text/JTextComponent.java @@ -0,0 +1,497 @@ +/* JTextComponent.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.AWTEvent; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.Point; +import javax.accessibility.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import javax.swing.Scrollable; +import javax.swing.UIManager; +import javax.swing.event.*; +import javax.swing.plaf.TextUI; + +public abstract class JTextComponent extends JComponent + implements Scrollable, Accessible +{ +// public class AccessibleJTextComponent extends AccessibleJComponent +// implements AccessibleText, CaretListener, DocumentListener, +// AccessibleAction, AccessibleEditableText +// { +// } // class AccessibleJTextComponent + + /** + * AccessibleJTextComponent + */ + public class AccessibleJTextComponent extends AccessibleJComponent + implements AccessibleText, CaretListener, DocumentListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * caretPos + */ + int caretPos; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AccessibleJTextComponent + * @param component TODO + */ + public AccessibleJTextComponent(JTextComponent component) { + super(component); + // TODO + } // AccessibleJTextComponent() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getCaretPosition + * @returns int + */ + public int getCaretPosition() { + return 0; // TODO + } // getCaretPosition() + + /** + * getSelectedText + * @returns String + */ + public String getSelectedText() { + return null; // TODO + } // getSelectedText() + + /** + * getSelectionStart + * @returns int + */ + public int getSelectionStart() { + return 0; // TODO + } // getSelectionStart() + + /** + * getSelectionEnd + * @returns int + */ + public int getSelectionEnd() { + return 0; // TODO + } // getSelectionEnd() + + /** + * caretUpdate + * @param value0 TODO + */ + public void caretUpdate(CaretEvent value0) { + // TODO + } // caretUpdate() + + /** + * getAccessibleStateSet + * @returns AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { + return null; // TODO + } // getAccessibleStateSet() + + /** + * getAccessibleRole + * @returns AccessibleRole + */ + public AccessibleRole getAccessibleRole() { + return null; // TODO + } // getAccessibleRole() + + /** + * getAccessibleText + * @returns AccessibleText + */ + public AccessibleText getAccessibleText() { + return null; // TODO + } // getAccessibleText() + + /** + * insertUpdate + * @param value0 TODO + */ + public void insertUpdate(DocumentEvent value0) { + // TODO + } // insertUpdate() + + /** + * removeUpdate + * @param value0 TODO + */ + public void removeUpdate(DocumentEvent value0) { + // TODO + } // removeUpdate() + + /** + * changedUpdate + * @param value0 TODO + */ + public void changedUpdate(DocumentEvent value0) { + // TODO + } // changedUpdate() + + /** + * getIndexAtPoint + * @param value0 TODO + * @returns int + */ + public int getIndexAtPoint(Point value0) { + return 0; // TODO + } // getIndexAtPoint() + + /** + * getRootEditorRect + * @returns Rectangle + */ + Rectangle getRootEditorRect() { + return null; // TODO + } // getRootEditorRect() + + /** + * getCharacterBounds + * @param value0 TODO + * @returns Rectangle + */ + public Rectangle getCharacterBounds(int value0) { + return null; // TODO + } // getCharacterBounds() + + /** + * getCharCount + * @returns int + */ + public int getCharCount() { + return 0; // TODO + } // getCharCount() + + /** + * getCharacterAttribute + * @param value0 TODO + * @returns AttributeSet + */ + public AttributeSet getCharacterAttribute(int value0) { + return null; // TODO + } // getCharacterAttribute() + + /** + * getAtIndex + * @param value0 TODO + * @param value1 TODO + * @returns String + */ + public String getAtIndex(int value0, int value1) { + return null; // TODO + } // getAtIndex() + + /** + * getAfterIndex + * @param value0 TODO + * @param value1 TODO + * @returns String + */ + public String getAfterIndex(int value0, int value1) { + return null; // TODO + } // getAfterIndex() + + /** + * getBeforeIndex + * @param value0 TODO + * @param value1 TODO + * @returns String + */ + public String getBeforeIndex(int value0, int value1) { + return null; // TODO + } // getBeforeIndex() + + + } // AccessibleJTextComponent + + + + public static class KeyBinding + { + public KeyStroke key; + public String actionName; + public KeyBinding(KeyStroke key, String actionName) + { + this.key = key; + this.actionName = actionName; + } + } // class KeyBinding + + int icon_gap; + Icon icon; + int align; + Document doc; + + public JTextComponent() + { + this("", null, 0); + } + + public JTextComponent(Icon image) + { + this("", image, 0); + } + + public JTextComponent(Icon image, int horizontalAlignment) + { + this("", image, horizontalAlignment); + } + + public JTextComponent(String text) + { + this(text, null, 0); + } + + public JTextComponent(String text, int horizontalAlignment) + { + this(text, null, horizontalAlignment); + } + + public JTextComponent(String text, Icon icon, int horizontalAlignment) + { + setDocument(new PlainDocument()); + + // do the work..... + setText(text); + this.icon = icon; + this.align = horizontalAlignment; + + // its an editor, so: + enableEvents(AWTEvent.KEY_EVENT_MASK); + updateUI(); + } + + public void setDocument(Document s) + { + doc = s; + revalidate(); + repaint(); + } + + public Document getDocument() + { + if (doc == null) + System.out.println("doc == null !!!"); + return doc; + } + + protected int checkHorizontalKey(int key, String message) + { + // Verify that key is a legal value for the horizontalAlignment properties. + return 0; + } + protected int checkVerticalKey(int key, String message) + { + // Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties. + return 0; + } + public AccessibleContext getAccessibleContext() + { + // Get the AccessibleContext of this object + return null; + } + public Icon getDisabledIcon() + { + return null; + } + public int getDisplayedMnemonic() + { + // Return the keycode that indicates a mnemonic key. + return 0; + } + public int getHorizontalAlignment() + { + // Returns the alignment of the label's contents along the X axis. + return 0; + } + public int getHorizontalTextPosition() + { + // Returns the horizontal position of the label's text, relative to its image. + return 0; + } + + public Icon getIcon() + { return icon; } + public int getIconTextGap() + { return icon_gap; } + + + Component getLabelFor() + { + // Get the component this is labelling. + return null; + } + + public void setText(String text) + { + getDocument().remove(0,doc.getLength()); + getDocument().insertString(0, text, null); + } + + public String getText() + { + return getDocument().getText(0, + getDocument().getLength()); + } + + public String getUIClassID() + { + // Returns a string that specifies the name of the l&f class that renders this component. + return "JTextComponent"; + } + public int getVerticalAlignment() + { + // Returns the alignment of the label's contents along the Y axis. + return 0; + } + public int getVerticalTextPosition() + { + // Returns the vertical position of the label's text, relative to its image. + return 0; + } + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) + { + // This is overriden to return false if the current Icon's Image is not equal to the passed in Image img. + return (img == icon); + } + protected String paramString() + { + // Returns a string representation of this JTextComponent. + return "JTextComponent"; + } + void setDisabledIcon(Icon disabledIcon) + { + // Set the icon to be displayed if this JTextComponent is "disabled" (JTextComponent.setEnabled(false)). + } + void setDisplayedMnemonic(char aChar) + { + // Specifies the displayedMnemonic as a char value. + } + void setDisplayedMnemonic(int key) + { + // Specify a keycode that indicates a mnemonic key. + } + void setHorizontalAlignment(int alignment) + { + // Sets the alignment of the label's contents along the X axis. + } + void setHorizontalTextPosition(int textPosition) + { + // Sets the horizontal position of the label's text, relative to its image. + } + void setIcon(Icon icon) + { + // Defines the icon this component will display. + } + public void setIconTextGap(int iconTextGap) + { + // If both the icon and text properties are set, this property defines the space between them. + } + + public void setLabelFor(Component c) + { + // Set the component this is labelling. + } + + public void setVerticalAlignment(int alignment) + { + // Sets the alignment of the label's contents along the Y axis. + } + public void setVerticalTextPosition(int textPosition) + { + // Sets the vertical position of the label's text, relative to its image. + } + + public TextUI getUI() + { return (TextUI) ui; + } + + public void updateUI() + { + TextUI b = (TextUI)UIManager.getUI(this); + setUI(b); + } + + public Dimension getPreferredScrollableViewportSize() + { + return null; + } + public int getScrollableUnitIncrement(Rectangle visible, int orientation, + int direction) + { + return 0; + } + public int getScrollableBlockIncrement(Rectangle visible, int orientation, + int direction) + { + return 0; + } +} // class JTextComponent + + + + + + + + + + + + diff --git a/libjava/javax/swing/text/Keymap.java b/libjava/javax/swing/text/Keymap.java new file mode 100644 index 00000000000..1d947123baf --- /dev/null +++ b/libjava/javax/swing/text/Keymap.java @@ -0,0 +1,59 @@ +/* Keymap.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.*; + +public interface Keymap +{ + void addActionForKeyStroke(KeyStroke key, Action a); + Action getAction(KeyStroke key); + Action[] getBoundActions(); + KeyStroke[] getBoundKeyStrokes(); + Action getDefaultAction(); + KeyStroke[] getKeyStrokesForAction(Action a); + String getName(); + Keymap getResolveParent(); + boolean isLocallyDefined(KeyStroke key); + void removeBindings(); + void removeKeyStrokeBinding(KeyStroke keys); + void setDefaultAction(Action a); + void setResolveParent(Keymap parent); +} + + diff --git a/libjava/javax/swing/text/MutableAttributeSet.java b/libjava/javax/swing/text/MutableAttributeSet.java new file mode 100644 index 00000000000..429e6a8a53d --- /dev/null +++ b/libjava/javax/swing/text/MutableAttributeSet.java @@ -0,0 +1,92 @@ +/* MutableAttributeSet.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.util.*; + +/** + * MutableAttributeSet + * @author Andrew Selkirk + * @version 1.0 + */ +public interface MutableAttributeSet extends AttributeSet { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addAttribute + * @param name TODO + * @param value TODO + */ + public void addAttribute(Object name, Object value); + + /** + * addAttributes + * @param attributes TODO + */ + public void addAttributes(AttributeSet attributes); + + /** + * removeAttribute + * @param name TODO + */ + public void removeAttribute(Object name); + + /** + * removeAttributes + * @param names TODO + */ + public void removeAttributes(Enumeration names); + + /** + * removeAttributes + * @param attributes TODO + */ + public void removeAttributes(AttributeSet attributes); + + /** + * setResolveParent + * @param parent TODO + */ + public void setResolveParent(AttributeSet parent); + + +} // MutableAttributeSet diff --git a/libjava/javax/swing/text/PlainDocument.java b/libjava/javax/swing/text/PlainDocument.java new file mode 100644 index 00000000000..45fe5ef01be --- /dev/null +++ b/libjava/javax/swing/text/PlainDocument.java @@ -0,0 +1,58 @@ +/* PlainDocument.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public class PlainDocument extends AbstractDocument +{ + PlainDocument() + { + super(new GapContent()); + } + + public Element getDefaultRootElement() + { + return null; + } + + public Element getParagraphElement(int pos) + { + return null; + } +} + diff --git a/libjava/javax/swing/text/PlainEditorKit.java b/libjava/javax/swing/text/PlainEditorKit.java new file mode 100644 index 00000000000..fbeb91f0888 --- /dev/null +++ b/libjava/javax/swing/text/PlainEditorKit.java @@ -0,0 +1,99 @@ +/* PlainEditorKit.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.*; +import java.io.*; + +public class PlainEditorKit extends EditorKit +{ + public PlainEditorKit() + { + } + + public PlainEditorKit(PlainEditorKit kit) + { + super(kit); + } + + protected Object clone() + { + return new PlainEditorKit(this); + } + void deinstall(JEditorPane c) + { + // Called when the kit is being removed from the JEditorPane. + } + void install(JEditorPane c) + { + } + + Caret createCaret() + { + return null; + } + Document createDefaultDocument() + { + return null; + } + Action[] getActions() + { + return null; + } + String getContentType() + { + return null; + } + ViewFactory getViewFactory() + { + return null; + } + void read(InputStream in, Document doc, int pos) + { + } + void read(Reader in, Document doc, int pos) + { + } + void write(OutputStream out, Document doc, int pos, int len) + { + } + void write(Writer out, Document doc, int pos, int len) + { + } +} + diff --git a/libjava/javax/swing/text/Position.java b/libjava/javax/swing/text/Position.java new file mode 100644 index 00000000000..be5406043f2 --- /dev/null +++ b/libjava/javax/swing/text/Position.java @@ -0,0 +1,48 @@ +/* Position.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public interface Position +{ + static class Bias + { + } + + int getOffset(); +} diff --git a/libjava/javax/swing/text/Segment.java b/libjava/javax/swing/text/Segment.java new file mode 100644 index 00000000000..9d96c05ff24 --- /dev/null +++ b/libjava/javax/swing/text/Segment.java @@ -0,0 +1,110 @@ +/* Segment.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.*; + + +public class Segment implements Cloneable, CharacterIterator +{ + char[] array; + int count; + int offset; + + public Object clone() + { + try { + return super.clone(); + } catch (Exception e) { + System.err.println("Huuuhhh, this class implements cloneable !!!!!!"); + System.err.println("I think there is a bug in this JVM somewhere"); + } + return null; + } + + public char current() + { + return array[getIndex()]; + } + + public char first() + { + offset = getBeginIndex(); + return array[offset]; + } + + public int getBeginIndex() + { + return offset; + } + + public int getEndIndex() + { + return offset + count; + } + public int getIndex() + { + return offset; + } + public char last() + { + offset = getEndIndex() - 1; + return array[offset]; + } + public char next() + { + offset++; + return array[offset]; + } + public char previous() + { + offset--; + return array[offset]; + } + public char setIndex(int position) + { + offset = position; + return array[offset]; + } + + public String toString() + { + return new String(array, offset, count); + } +} + diff --git a/libjava/javax/swing/text/Style.java b/libjava/javax/swing/text/Style.java new file mode 100644 index 00000000000..99c4e329ab5 --- /dev/null +++ b/libjava/javax/swing/text/Style.java @@ -0,0 +1,47 @@ +/* Style.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing.event.*; + +public interface Style +{ + void addChangeListener(ChangeListener l); + String getName(); + void removeChangeListener(ChangeListener l); +} diff --git a/libjava/javax/swing/text/StyledDocument.java b/libjava/javax/swing/text/StyledDocument.java new file mode 100644 index 00000000000..737703f0228 --- /dev/null +++ b/libjava/javax/swing/text/StyledDocument.java @@ -0,0 +1,145 @@ +/* StyledDcoument.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; + +/** + * StyledDocument + * @author Andrew Selkirk + * @version 1.0 + */ +public interface StyledDocument extends Document { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addStyle + * @param nm TODO + * @param rent TODO + * @returns Style + */ + public Style addStyle(String nm, Style parent); + + /** + * removeStyle + * @param nm TODO + */ + public void removeStyle(String nm); + + /** + * getStyle + * @param nm TODO + * @returns Style + */ + public Style getStyle(String nm); + + /** + * setCharacterAttributes + * @param offset TODO + * @param length TODO + * @param set TODO + * @param replace TODO + */ + public void setCharacterAttributes(int offset, int length, + AttributeSet set, boolean replace); + + /** + * setParagraphAttributes + * @param offset TODO + * @param length TODO + * @param set TODO + * @param replace TODO + */ + public void setParagraphAttributes(int offset, int length, + AttributeSet set, boolean replace); + + /** + * getLogicalStyle + * @param position TODO + * @returns Style + */ + public Style getLogicalStyle(int position); + + /** + * setLogicalStyle + * @param position TODO + * @param style TODO + */ + public void setLogicalStyle(int position, Style style); + + /** + * getParagraphElement + * @param position TODO + * @returns Element + */ + public abstract Element getParagraphElement(int position); + + /** + * getCharacterElement + * @param position TODO + * @returns Element + */ + public Element getCharacterElement(int position); + + /** + * getForeground + * @param set TODO + * @returns Color + */ + public Color getForeground(AttributeSet set); + + /** + * getBackground + * @param set TODO + * @returns Color + */ + public Color getBackground(AttributeSet set); + + /** + * getFont + * @param set TODO + * @returns Font + */ + public Font getFont(AttributeSet set); + + +} // StyledDocument diff --git a/libjava/javax/swing/text/StyledEditorKit.java b/libjava/javax/swing/text/StyledEditorKit.java new file mode 100644 index 00000000000..84b27bd11a0 --- /dev/null +++ b/libjava/javax/swing/text/StyledEditorKit.java @@ -0,0 +1,612 @@ +/* StyledEditorKit.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * StyledEditorKit + * @author Andrew Selkirk + * @version 1.0 + */ +public class StyledEditorKit extends DefaultEditorKit { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * UnderlineAction + */ + public static class UnderlineAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UnderlineAction + */ + public UnderlineAction() { + super("TODO"); + // TODO + } // UnderlineAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // UnderlineAction + + /** + * ItalicAction + */ + public static class ItalicAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ItalicAction + */ + public ItalicAction() { + super("TODO"); + // TODO + } // ItalicAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // ItalicAction + + /** + * BoldAction + */ + public static class BoldAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor BoldAction + */ + public BoldAction() { + super("TODO"); + // TODO + } // BoldAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // BoldAction + + /** + * AlignmentAction + */ + public static class AlignmentAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * a + */ + private int a; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AlignmentAction + * @param nm TODO + * @param a TODO + */ + public AlignmentAction(String nm, int a) { + super("TODO"); + // TODO + } // AlignmentAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // AlignmentAction + + /** + * ForegroundAction + */ + public static class ForegroundAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * fg + */ + private Color fg; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ForegroundAction + * @param nm TODO + * @param fg TODO + */ + public ForegroundAction(String nm, Color fg) { + super("TODO"); + // TODO + } // ForegroundAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // ForegroundAction + + /** + * FontSizeAction + */ + public static class FontSizeAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * size + */ + private int size; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FontSizeAction + * @param nm TODO + * @param size TODO + */ + public FontSizeAction(String nm, int size) { + super("TODO"); + // TODO + } // FontSizeAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // FontSizeAction + + /** + * FontFamilyAction + */ + public static class FontFamilyAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * family + */ + private String family; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FontFamilyAction + * @param nm TODO + * @param family TODO + */ + public FontFamilyAction(String nm, String family) { + super("TODO"); + // TODO + } // FontFamilyAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // FontFamilyAction + + /** + * StyledTextAction + */ + public abstract static class StyledTextAction extends TextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StyledTextAction + * @param nm TODO + */ + public StyledTextAction(String nm) { + super(nm); + // TODO + } // StyledTextAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getEditor + * @param event TODO + * @returns JEditorPane + */ + protected final JEditorPane getEditor(ActionEvent event) { + return null; // TODO + } // getEditor() + + /** + * setCharacterAttributes + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + protected final void setCharacterAttributes(JEditorPane value0, AttributeSet value1, boolean value2) { + // TODO + } // setCharacterAttributes() + + /** + * getStyledDocument + * @param value0 TODO + * @returns StyledDocument + */ + protected final StyledDocument getStyledDocument(JEditorPane value0) { + return null; // TODO + } // getStyledDocument() + + /** + * getStyledEditorKit + * @param value0 TODO + * @returns StyledEditorKit + */ + protected final StyledEditorKit getStyledEditorKit(JEditorPane value0) { + return null; // TODO + } // getStyledEditorKit() + + /** + * setParagraphAttributes + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + protected final void setParagraphAttributes(JEditorPane value0, AttributeSet value1, boolean value2) { + // TODO + } // setParagraphAttributes() + + + } // StyledTextAction + + /** + * StyledViewFactory + */ + static class StyledViewFactory implements ViewFactory { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StyledViewFactory + */ + StyledViewFactory() { + // TODO + } // StyledViewFactory() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * create + * @param value0 TODO + * @returns View + */ + public View create(Element value0) { + return null; // TODO + } // create() + + + } // StyledViewFactory + + /** + * AttributeTracker + */ + class AttributeTracker implements CaretListener, PropertyChangeListener, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AttributeTracker + * @param value0 TODO + */ + AttributeTracker(StyledEditorKit value0) { + // TODO + } // AttributeTracker() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * updateInputAttributes + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + void updateInputAttributes(int value0, int value1, JTextComponent value2) { + // TODO + } // updateInputAttributes() + + /** + * propertyChange + * @param value0 TODO + */ + public void propertyChange(PropertyChangeEvent value0) { + // TODO + } // propertyChange() + + /** + * caretUpdate + * @param value0 TODO + */ + public void caretUpdate(CaretEvent value0) { + // TODO + } // caretUpdate() + + + } // AttributeTracker + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * currentRun + */ + Element currentRun; + + /** + * currentParagraph + */ + Element currentParagraph; + + /** + * inputAttributes + */ + MutableAttributeSet inputAttributes; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StyledEditorKit + */ + public StyledEditorKit() { + // TODO + } // StyledEditorKit() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * clone + * @returns Object + */ + public Object clone() { + return null; // TODO + } // clone() + + /** + * getActions + * @returns Action[] + */ + public Action[] getActions() { + return null; // TODO + } // getActions() + + /** + * getInputAttributes + * @returns MutableAttributeSet + */ + public MutableAttributeSet getInputAttributes() { + return null; // TODO + } // getInputAttributes() + + /** + * getCharacterAttributeRun + * @returns Element + */ + public Element getCharacterAttributeRun() { + return null; // TODO + } // getCharacterAttributeRun() + + /** + * createDefaultDocument + * @returns Document + */ + public Document createDefaultDocument() { + return null; // TODO + } // createDefaultDocument() + + /** + * install + * @param component TODO + */ + public void install(JEditorPane component) { + // TODO + } // install() + + /** + * deinstall + * @param component TODO + */ + public void deinstall(JEditorPane component) { + // TODO + } // deinstall() + + /** + * getViewFactory + * @returns ViewFactory + */ + public ViewFactory getViewFactory() { + return null; // TODO + } // getViewFactory() + + /** + * createInputAttributes + * @param element TODO + * @param set TODO + */ + protected void createInputAttributes(Element element, + MutableAttributeSet set) { + // TODO + } // createInputAttributes() + + +} // StyledEditorKit diff --git a/libjava/javax/swing/text/TextAction.java b/libjava/javax/swing/text/TextAction.java new file mode 100644 index 00000000000..5af1ce03445 --- /dev/null +++ b/libjava/javax/swing/text/TextAction.java @@ -0,0 +1,96 @@ +/* TextAction.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +// Imports +import java.awt.event.*; +import javax.swing.*; + +/** + * TextAction + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class TextAction extends AbstractAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TextAction + * @param name TODO + */ + public TextAction(String name) { + // TODO + } // TextAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getTextComponent + * @param event TODO + * @returns JTextComponent + */ + protected final JTextComponent getTextComponent(ActionEvent event) { + return null; // TODO + } // getTextComponent() + + /** + * augmentList + * @param list1 TODO + * @param list2 TODO + * @returns Action[] + */ + public static final Action[] augmentList(Action[] list1, Action[] list2) { + return null; // TODO + } // augmentList() + + /** + * getFocusedComponent + * @returns JTextComponent + */ + protected final JTextComponent getFocusedComponent() { + return null; // TODO + } // getFocusedComponent() + + +} // TextAction diff --git a/libjava/javax/swing/text/View.java b/libjava/javax/swing/text/View.java new file mode 100644 index 00000000000..b09ed7ebeba --- /dev/null +++ b/libjava/javax/swing/text/View.java @@ -0,0 +1,139 @@ +/* View.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.*; +import javax.swing.*; +import java.util.*; + +public abstract class View implements SwingConstants +{ + static int BadBreakWeight; + static int ExcellentBreakWeight; + static int ForcedBreakWeight; + static int GoodBreakWeight; + + public final static int X_AXIS = 0; + public final static int Y_AXIS = 1; + + float width, height; + Element elt; + View parent; + + /** + * this vector contains the views ordered at offsets... + */ + Vector v = new Vector(); + + + public View(Element elem) + { + elt = elem; + } + + public int getViewCount() + { + return v.size(); + } + + public View getView(int a) + { + return (View) v.get(a); + } + + public void remove(int i) + { + v.removeElementAt(i); + } + + public void insert(int off, View view) + { + v.insertElementAt(view, off); + } + + public void append(View view) + { + v.addElement(view); + } + + public void paint(Graphics g, Shape allocation) + { + System.out.println("view.paint() !!!!"); + } + + public void setParent(View a) + { + parent = a; + } + + public View getParent() + { + return parent; + } + + public void setSize(int w, int h) + { + width = w; + height = h; + } + + public Document getDocument() + { + return getElement().getDocument(); + } + + public Element getElement() + { + return elt; + } + + public float getPreferredSpan(int a) + { + switch (a) + { + case X_AXIS: return width; + case Y_AXIS: return height; + default: + { + System.err.println("I sure wish Java had enums !!! "); + return 0; + } + } + } +} + diff --git a/libjava/javax/swing/text/ViewFactory.java b/libjava/javax/swing/text/ViewFactory.java new file mode 100644 index 00000000000..92be8f462fb --- /dev/null +++ b/libjava/javax/swing/text/ViewFactory.java @@ -0,0 +1,44 @@ +/* ViewFactory.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + + +public interface ViewFactory +{ + public View create(Element elem); +} diff --git a/libjava/javax/swing/tree/AbstractLayoutCache.java b/libjava/javax/swing/tree/AbstractLayoutCache.java new file mode 100644 index 00000000000..5be988ca604 --- /dev/null +++ b/libjava/javax/swing/tree/AbstractLayoutCache.java @@ -0,0 +1,371 @@ +/* AbstractLayoutCache.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.*; +import java.util.*; +import javax.swing.event.*; + +/** + * AbstractLayoutCache + * @author Andrew Selkirk + */ +public abstract class AbstractLayoutCache implements RowMapper { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * NodeDimensions + */ + public abstract static class NodeDimensions { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor NodeDimensions + */ + public NodeDimensions() { + // TODO + } // NodeDimensions() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getNodeDimensions + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + * @returns Rectangle + */ + public abstract Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4); + + + } // NodeDimensions + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * nodeDimensions + */ + protected NodeDimensions nodeDimensions; + + /** + * treeModel + */ + protected TreeModel treeModel; + + /** + * treeSelectionModel + */ + protected TreeSelectionModel treeSelectionModel; + + /** + * rootVisible + */ + protected boolean rootVisible; + + /** + * rowHeight + */ + protected int rowHeight; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AbstractLayoutCache + */ + public AbstractLayoutCache() { + // TODO + } // AbstractLayoutCache() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setNodeDimensions + * @param value0 TODO + */ + public void setNodeDimensions(NodeDimensions value0) { + // TODO + } // setNodeDimensions() + + /** + * getNodeDimensions + * @returns NodeDimensions + */ + public NodeDimensions getNodeDimensions() { + return null; // TODO + } // getNodeDimensions() + + /** + * getNodeDimensions + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + * @returns Rectangle + */ + protected Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4) { + return null; // TODO + } // getNodeDimensions() + + /** + * setModel + * @param value0 TODO + */ + public void setModel(TreeModel value0) { + // TODO + } // setModel() + + /** + * getModel + * @returns TreeModel + */ + public TreeModel getModel() { + return null; // TODO + } // getModel() + + /** + * setRootVisible + * @param value0 TODO + */ + public void setRootVisible(boolean value0) { + // TODO + } // setRootVisible() + + /** + * isRootVisible + * @returns boolean + */ + public boolean isRootVisible() { + return false; // TODO + } // isRootVisible() + + /** + * setRowHeight + * @param value0 TODO + */ + public void setRowHeight(int value0) { + // TODO + } // setRowHeight() + + /** + * getRowHeight + * @returns int + */ + public int getRowHeight() { + return 0; // TODO + } // getRowHeight() + + /** + * setSelectionModel + * @param value0 TODO + */ + public void setSelectionModel(TreeSelectionModel value0) { + // TODO + } // setSelectionModel() + + /** + * getSelectionModel + * @returns TreeSelectionModel + */ + public TreeSelectionModel getSelectionModel() { + return null; // TODO + } // getSelectionModel() + + /** + * getPreferredHeight + * @returns int + */ + public int getPreferredHeight() { + return 0; // TODO + } // getPreferredHeight() + + /** + * getPreferredWidth + * @param value0 TODO + * @returns int + */ + public int getPreferredWidth(Rectangle value0) { + return 0; // TODO + } // getPreferredWidth() + + /** + * isExpanded + * @param value0 TODO + * @returns boolean + */ + public abstract boolean isExpanded(TreePath value0); + + /** + * getBounds + * @param value0 TODO + * @param value1 TODO + * @returns Rectangle + */ + public abstract Rectangle getBounds(TreePath value0, Rectangle value1); + + /** + * getPathForRow + * @param value0 TODO + * @returns TreePath + */ + public abstract TreePath getPathForRow(int value0); + + /** + * getRowForPath + * @param value0 TODO + * @returns int + */ + public abstract int getRowForPath(TreePath value0); + + /** + * getPathClosestTo + * @param value0 TODO + * @param value1 TODO + * @returns TreePath + */ + public abstract TreePath getPathClosestTo(int value0, int value1); + + /** + * getVisiblePathsFrom + * @param value0 TODO + * @returns Enumeration + */ + public abstract Enumeration getVisiblePathsFrom(TreePath value0); + + /** + * getVisibleChildCount + * @param value0 TODO + * @returns int + */ + public abstract int getVisibleChildCount(TreePath value0); + + /** + * setExpandedState + * @param value0 TODO + * @param value1 TODO + */ + public abstract void setExpandedState(TreePath value0, boolean value1); + + /** + * getExpandedState + * @param value0 TODO + * @returns boolean + */ + public abstract boolean getExpandedState(TreePath value0); + + /** + * getRowCount + * @returns int + */ + public abstract int getRowCount(); + + /** + * invalidateSizes + */ + public abstract void invalidateSizes(); + + /** + * invalidatePathBounds + * @param value0 TODO + */ + public abstract void invalidatePathBounds(TreePath value0); + + /** + * treeNodesChanged + * @param value0 TODO + */ + public abstract void treeNodesChanged(TreeModelEvent value0); + + /** + * treeNodesInserted + * @param value0 TODO + */ + public abstract void treeNodesInserted(TreeModelEvent value0); + + /** + * treeNodesRemoved + * @param value0 TODO + */ + public abstract void treeNodesRemoved(TreeModelEvent value0); + + /** + * treeStructureChanged + * @param value0 TODO + */ + public abstract void treeStructureChanged(TreeModelEvent value0); + + /** + * getRowsForPaths + * @param value0 TODO + * @returns int[] + */ + public int[] getRowsForPaths(TreePath[] value0) { + return null; // TODO + } // getRowsForPaths() + + /** + * isFixedRowHeight + * @returns boolean + */ + protected boolean isFixedRowHeight() { + return false; // TODO + } // isFixedRowHeight() + + +} // AbstractLayoutCache diff --git a/libjava/javax/swing/tree/DefaultMutableTreeNode.java b/libjava/javax/swing/tree/DefaultMutableTreeNode.java new file mode 100644 index 00000000000..288b0edc1c9 --- /dev/null +++ b/libjava/javax/swing/tree/DefaultMutableTreeNode.java @@ -0,0 +1,1017 @@ +/* DefaultMutableTreeNode.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.io.*; +import java.util.*; + +/** + * DefaultMutableTreeNode + * @author Andrew Selkirk + */ +public class DefaultMutableTreeNode implements Cloneable, MutableTreeNode, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * EMPTY_ENUMERATION + */ + public static final Enumeration EMPTY_ENUMERATION = null; // TODO + + /** + * parent + */ + protected MutableTreeNode parent = null; + + /** + * children + */ + protected Vector children = new Vector(); + + /** + * userObject + */ + protected transient Object userObject = ""; + + /** + * allowsChildren + */ + protected boolean allowsChildren = true; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultMutableTreeNode + */ + public DefaultMutableTreeNode() { + // TODO + } // DefaultMutableTreeNode() + + /** + * Constructor DefaultMutableTreeNode + * @param value0 TODO + */ + public DefaultMutableTreeNode(Object userObject) { + this.userObject = userObject; + } // DefaultMutableTreeNode() + + /** + * Constructor DefaultMutableTreeNode + * @param value0 TODO + * @param value1 TODO + */ + public DefaultMutableTreeNode(Object userObject, boolean allowsChildren) { + this.userObject = userObject; + this.allowsChildren = allowsChildren; + } // DefaultMutableTreeNode() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * clone + * @returns Object + */ + public Object clone() { + return null; // TODO + } // clone() + + /** + * toString + * @returns String + */ + public String toString() { + if (userObject == null) { + return null; + } // if + return userObject.toString(); + } // toString() + + /** + * add + * @param value0 TODO + */ + public void add(MutableTreeNode child) { + children.add(child); + child.setParent(this); + } // add() + + /** + * getParent + * @returns TreeNode + */ + public TreeNode getParent() { + return parent; + } // getParent() + + /** + * remove + * @param value0 TODO + */ + public void remove(int index) { + children.remove(index); + } // remove() + + /** + * remove + * @param value0 TODO + */ + public void remove(MutableTreeNode node) { + children.remove(node); + } // remove() + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * insert + * @param value0 TODO + * @param value1 TODO + */ + public void insert(MutableTreeNode node, int index) { + children.insertElementAt(node, index); + } // insert() + + /** + * getPath + * @returns TreeNode[] + */ + public TreeNode[] getPath() { + + // Variables + TreeNode[] path; + int size; + int index; + TreeNode current; + + // Determine length of Path + size = getLevel() + 1; + + // Create Path + path = new TreeNode[size]; + current = this; + for (index = size - 1; index >= 0; index--) { + path[index] = current; + current = current.getParent(); + } // for + + // Return Path + return path; + + } // getPath() + + /** + * children + * @returns Enumeration + */ + public Enumeration children() { + return children.elements(); + } // children() + + /** + * setParent + * @param value0 TODO + */ + public void setParent(MutableTreeNode node) { + parent = node; + } // setParent() + + /** + * getChildAt + * @param value0 TODO + * @returns TreeNode + */ + public TreeNode getChildAt(int index) { + return (TreeNode) children.elementAt(index); + } // getChildAt() + + /** + * getChildCount + * @returns int + */ + public int getChildCount() { + return children.size(); + } // getChildCount() + + /** + * getIndex + * @param value0 TODO + * @returns int + */ + public int getIndex(TreeNode node) { + return children.indexOf(node); + } // getIndex() + + /** + * setAllowsChildren + * @param value0 TODO + */ + public void setAllowsChildren(boolean allowsChildren) { + this.allowsChildren = allowsChildren; + } // setAllowsChildren() + + /** + * getAllowsChildren + * @returns boolean + */ + public boolean getAllowsChildren() { + return allowsChildren; + } // getAllowsChildren() + + /** + * setUserObject + * @param value0 TODO + */ + public void setUserObject(Object userObject) { + this.userObject = userObject; + } // setUserObject() + + /** + * getUserObject + * @returns Object + */ + public Object getUserObject() { + return userObject; + } // getUserObject() + + /** + * removeFromParent + */ + public void removeFromParent() { + parent = null; + // TODO + } // removeFromParent() + + /** + * removeAllChildren + */ + public void removeAllChildren() { + children.removeAllElements(); + } // removeAllChildren() + + /** + * isNodeAncestor + * @param value0 TODO + * @returns boolean + */ + public boolean isNodeAncestor(TreeNode node) { + + // Variables + TreeNode current; + + // Sanity Check + if (node == null) { + return false; + } // if + + // Search For Ancestor + current = this; + while (current != null && current != node) { + current = current.getParent(); + } // while + + // Check for Ancestor + if (current == node) { + return true; + } // if + + // Otherwise, no + return false; + + } // isNodeAncestor() + + /** + * isNodeDescendant + * @param value0 TODO + * @returns boolean + */ + public boolean isNodeDescendant(DefaultMutableTreeNode node) { + + // Variables + TreeNode current; + + // Sanity Check + if (node == null) { + return false; + } // if + + // Search For Descendant + current = node; + while (current != null && current != this) { + current = current.getParent(); + } // while + + // Check for Descendant + if (current == this) { + return true; + } // if + + // Otherwise, no + return false; + + } // isNodeDescendant() + + /** + * getSharedAncestor + * @param value0 TODO + * @returns TreeNode + */ + public TreeNode getSharedAncestor(DefaultMutableTreeNode node) { + + // Variables + ArrayList list; + TreeNode current; + + // Get List of Path Elements for this node + current = this; + list = new ArrayList(); + while (current != null) { + list.add(current); + current = current.getParent(); + } // while + + // Check if any path element of node are in list + current = node; + while (current != null) { + if (list.contains(current) == true) { + return current; + } // if + current = current.getParent(); + } // while + + // Unable to locate shared ancestor + return null; + + } // getSharedAncestor() + + /** + * isNodeRelated + * @param value0 TODO + * @returns boolean + */ + public boolean isNodeRelated(DefaultMutableTreeNode node) { + + // Sanity Check + if (node == null) { + return false; + } // if + + // Check for the same root + if (node.getRoot() == getRoot()) { + return true; + } // if + + // Nodes are not related + return false; + + } // isNodeRelated() + + /** + * getDepth + * @returns int + */ + public int getDepth() { + + // Variables + TreeNode node; + int depth; + int current; + int size; + Stack stack; + int index; + + // Check for children + if (allowsChildren == false || children.size() == 0) { + return 0; + } // if + + // Process Depths + stack = new Stack(); + stack.push(new Integer(0)); + node = getChildAt(0); +//System.out.println(" * Descend: 0-0"); + depth = 0; + current = 1; + while (stack.empty() == false) { + + // Check if node has children + if (node.getChildCount() != 0) { + node = node.getChildAt(0); + stack.push(new Integer(0)); + current++; +// System.out.println(" * Descend: 0-" + current); + + // Check for next sibling + } else { + + // Check Depth + if (current > depth) { + depth = current; + } // if + + do { + + // Traverse to Parent + node = node.getParent(); + size = node.getChildCount(); + current--; + index = ((Integer) stack.pop()).intValue(); +// System.out.println(" * Ascend from: " + index + "-" + current); + index++; + + } while (index >= size && node != this); + + // Check for child + if (index < size) { + node = node.getChildAt(index); + stack.push(new Integer(index)); + current++; +// System.out.println(" * Descend: " + index + "-" + current); + } // if + + } // if + + } // while + + return depth; + + } // getDepth() + + static Random random = new Random(System.currentTimeMillis()); + + public static void growTree(DefaultMutableTreeNode root) { + + // Variables + int size; + int index; + DefaultMutableTreeNode node; + DefaultMutableTreeNode current; + + current = root; + index = 0; +// while (current != root) { + do { + +// if (random.nextInt(3) < 2) { + if (random.nextBoolean()) { + node = new DefaultMutableTreeNode(String.valueOf(index)); + index++; + current.add(node); + current = node; + } else { + current = (DefaultMutableTreeNode) current.getParent(); + } // if + +// } // while + } while (current != root && current != null); + + System.out.println("Number of nodes: " + index); + +/* + // Calc # children + size = random.nextInt(4); + + for (index = 0; index < size; index++) { + + // Create Node + node = new DefaultMutableTreeNode(String.valueOf(index)); + growTree(node); + + // Add Node to root + root.add(node); + + } // for +*/ + } // growTree() + + public static void main(String[] argv) { +/* + DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("node1"); + DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("node2"); + DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("node3"); + DefaultMutableTreeNode node4 = new DefaultMutableTreeNode("node4"); + DefaultMutableTreeNode node5 = new DefaultMutableTreeNode("node5"); + DefaultMutableTreeNode node6 = new DefaultMutableTreeNode("node6"); + DefaultMutableTreeNode node7 = new DefaultMutableTreeNode("node7"); + DefaultMutableTreeNode node8 = new DefaultMutableTreeNode("node8"); + + node1.add(node2); + node1.add(node3); + node2.add(node4); + node2.add(node5); + node3.add(node6); + node3.add(node7); + node5.add(node8); + + System.out.println("Depth (node1): " + node1.getDepth()); + System.out.println("Depth (node2): " + node2.getDepth()); + System.out.println("Depth (node3): " + node3.getDepth()); +*/ + + System.out.println("Create tree..."); + DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); + growTree(root); + System.out.println("Find depth..."); + System.out.println("Depth (root): " + root.getDepth()); + + } // main + + /** + * getLevel + * @returns int + */ + public int getLevel() { + + // Variables + TreeNode current; + int count; + + // Lookup Parent + count = -1; + current = this; + do { + current = current.getParent(); + count++; + } while (current != null); + + return count; + + } // getLevel() + + /** + * getPathToRoot + * @param value0 TODO + * @param value1 TODO + * @returns TreeNode[] + */ + protected TreeNode[] getPathToRoot(TreeNode value0, int value1) { + return null; // TODO + } // getPathToRoot() + + /** + * getUserObjectPath + * @returns Object[] + */ + public Object[] getUserObjectPath() { + + // Variables + TreeNode[] path; + Object[] object; + int size; + int index; + + // Get Path for Tree Nodes + path = getPath(); + + // Construct Object Path + object = new Object[path.length]; + for (index = 0; index < path.length; index++) { + object[index] = ((DefaultMutableTreeNode) path[index]).getUserObject(); + } // for + + // Return Object Path + return object; + + } // getUserObjectPath() + + /** + * getRoot + * @returns TreeNode + */ + public TreeNode getRoot() { + + // Variables + TreeNode current; + TreeNode check; + + // Lookup Parent + current = this; + check = current.getParent(); + while (check != null) { + current = check; + check = current.getParent(); + } // while + + return current; + + } // getRoot() + + /** + * isRoot + * @returns boolean + */ + public boolean isRoot() { + return (parent == null); + } // isRoot() + + /** + * getNextNode + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getNextNode() { + return null; // TODO + } // getNextNode() + + /** + * getPreviousNode + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getPreviousNode() { + return null; // TODO + } // getPreviousNode() + + /** + * preorderEnumeration + * @returns Enumeration + */ + public Enumeration preorderEnumeration() { + return null; // TODO + } // preorderEnumeration() + + /** + * postorderEnumeration + * @returns Enumeration + */ + public Enumeration postorderEnumeration() { + return null; // TODO + } // postorderEnumeration() + + /** + * breadthFirstEnumeration + * @returns Enumeration + */ + public Enumeration breadthFirstEnumeration() { + return null; // TODO + } // breadthFirstEnumeration() + + /** + * depthFirstEnumeration + * @returns Enumeration + */ + public Enumeration depthFirstEnumeration() { + return null; // TODO + } // depthFirstEnumeration() + + /** + * pathFromAncestorEnumeration + * @param value0 TODO + * @returns Enumeration + */ + public Enumeration pathFromAncestorEnumeration(TreeNode value0) { + return null; // TODO + } // pathFromAncestorEnumeration() + + /** + * isNodeChild + * @param value0 TODO + * @returns boolean + */ + public boolean isNodeChild(TreeNode node) { + + // Variables + TreeNode current; + int index; + + // Sanity Check + if (node == null) { + return false; + } // if + + // Process Path + current = node; + while (current != null) { + if (current == this) { + return true; + } // if + current = current.getParent(); + } // while + + // Node not located in path, not child + return false; + + } // isNodeChild() + + /** + * getFirstChild + * @returns TreeNode + */ + public TreeNode getFirstChild() { + return (TreeNode) children.firstElement(); + } // getFirstChild() + + /** + * getLastChild + * @returns TreeNode + */ + public TreeNode getLastChild() { + return (TreeNode) children.lastElement(); + } // getLastChild() + + /** + * getChildAfter + * @param value0 TODO + * @returns TreeNode + */ + public TreeNode getChildAfter(TreeNode node) { + + // Variables + int index; + + // Check node + if (node == null || node.getParent() != this) { + throw new IllegalArgumentException(); + } // if + + // Get index of child node + index = getIndex(node); + + // Check for child after + index++; + if (index == getChildCount()) { + return null; + } // if + + // Retrieve Child After + return getChildAt(index); + + } // getChildAfter() + + /** + * getChildBefore + * @param value0 TODO + * @returns TreeNode + */ + public TreeNode getChildBefore(TreeNode node) { + + // Variables + int index; + + // Check node + if (node == null || node.getParent() != this) { + throw new IllegalArgumentException(); + } // if + + // Get index of child node + index = getIndex(node); + + // Check for child before + index--; + if (index < 0) { + return null; + } // if + + // Retrieve Child Before + return getChildAt(index); + + } // getChildBefore() + + /** + * isNodeSibling + * @param value0 TODO + * @returns boolean + */ + public boolean isNodeSibling(TreeNode node) { + + // Variables + int index; + + // Check for null + if (node == null) { + return false; + } // if + + // Check if nodes share a parent + if (node.getParent() == getParent() && getParent() != null) { + return true; + } // if + + // Nodes are not siblings + return false; + + } // isNodeSibling() + + /** + * getSiblingCount + * @returns int + */ + public int getSiblingCount() { + + // Variables + + // Check for no parent + if (parent == null) { + return 1; + } // if + + // Calculate sibling count from parent's child count + return parent.getChildCount(); + + } // getSiblingCount() + + /** + * getNextSibling + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getNextSibling() { + + // Variables + int index; + int size; + + // Check for Parent + if (parent == null) { + return null; + } // if + + // Get Index of this node + index = parent.getIndex(this); + + // Check for Next Sibling + size = parent.getChildCount(); + index++; + if (index == size) { + return null; + } // if + + return (DefaultMutableTreeNode) parent.getChildAt(index); + + } // getNextSibling() + + /** + * getPreviousSibling + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getPreviousSibling() { + + // Variables + int index; + + // Check for Parent + if (parent == null) { + return null; + } // if + + // Get Index of this node + index = parent.getIndex(this); + + // Check for Previous Sibling + index--; + if (index < 0) { + return null; + } // if + + return (DefaultMutableTreeNode) parent.getChildAt(index); + + } // getPreviousSibling() + + /** + * isLeaf + * @returns boolean + */ + public boolean isLeaf() { + return (children.size() == 0); // TODO: check allowsChildren?? + } // isLeaf() + + /** + * getFirstLeaf + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getFirstLeaf() { + + // Variables + TreeNode current; + + current = this; + while (current.getChildCount() > 0) { + current = current.getChildAt(0); + } // while + + return (DefaultMutableTreeNode) current; + + } // getFirstLeaf() + + /** + * getLastLeaf + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getLastLeaf() { + + // Variables + TreeNode current; + int size; + + current = this; + size = current.getChildCount(); + while (size > 0) { + current = current.getChildAt(size - 1); + size = current.getChildCount(); + } // while + + return (DefaultMutableTreeNode) current; + + } // getLastLeaf() + + /** + * getNextLeaf + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getNextLeaf() { + return null; // TODO + } // getNextLeaf() + + /** + * getPreviousLeaf + * @returns DefaultMutableTreeNode + */ + public DefaultMutableTreeNode getPreviousLeaf() { + return null; // TODO + } // getPreviousLeaf() + + /** + * getLeafCount + * @returns int + */ + public int getLeafCount() { + + // Variables + Enumeration enum; + int count; + TreeNode current; + + // Get Enumeration of all descendants + enum = depthFirstEnumeration(); + + // Process Nodes + count = 0; + while (enum.hasMoreElements() == true) { + current = (TreeNode) enum.nextElement(); + if (current.isLeaf() == true) { + count++; + } // if + } // if + + return count; + + } // getLeafCount() + + +} // DefaultMutableTreeNode diff --git a/libjava/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/javax/swing/tree/DefaultTreeCellEditor.java new file mode 100644 index 00000000000..732077b3adb --- /dev/null +++ b/libjava/javax/swing/tree/DefaultTreeCellEditor.java @@ -0,0 +1,489 @@ +/* DefaultTreeCellEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; + +/** + * DefaultTreeCellEditor + * @author Andrew Selkirk + */ +public class DefaultTreeCellEditor implements ActionListener, TreeCellEditor, TreeSelectionListener { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * EditorContainer + */ + public class EditorContainer extends Container { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor EditorContainer + * @param value0 TODO + */ + public EditorContainer(DefaultTreeCellEditor value0) { + // TODO + } // EditorContainer() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getPreferredSize + * @returns Dimension + */ + public Dimension getPreferredSize() { + return null; // TODO + } // getPreferredSize() + + /** + * paint + * @param value0 TODO + */ + public void paint(Graphics value0) { + // TODO + } // paint() + + /** + * doLayout + */ + public void doLayout() { + // TODO + } // doLayout() + + + } // EditorContainer + + /** + * DefaultTextField + */ + public class DefaultTextField extends JTextField { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * border + */ + protected Border border; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTextField + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTextField(DefaultTreeCellEditor value0, Border value1) { + // TODO + } // DefaultTextField() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getFont + * @returns Font + */ + public Font getFont() { + return null; // TODO + } // getFont() + + /** + * getBorder + * @returns Border + */ + public Border getBorder() { + return null; // TODO + } // getBorder() + + /** + * getPreferredSize + * @returns Dimension + */ + public Dimension getPreferredSize() { + return null; // TODO + } // getPreferredSize() + + + } // DefaultTextField + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * realEditor + */ + protected TreeCellEditor realEditor; + + /** + * renderer + */ + protected DefaultTreeCellRenderer renderer; + + /** + * editingContainer + */ + protected Container editingContainer; + + /** + * editingComponent + */ + protected transient Component editingComponent; + + /** + * canEdit + */ + protected boolean canEdit; + + /** + * offset + */ + protected transient int offset; + + /** + * tree + */ + protected transient JTree tree; + + /** + * lastPath + */ + protected transient TreePath lastPath; + + /** + * timer + */ + protected transient javax.swing.Timer timer; // TODO + + /** + * lastRow + */ + protected transient int lastRow; + + /** + * borderSelectionColor + */ + protected Color borderSelectionColor; + + /** + * editingIcon + */ + protected transient Icon editingIcon; + + /** + * font + */ + protected Font font; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTreeCellEditor + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1) { + // TODO + } // DefaultTreeCellEditor() + + /** + * Constructor DefaultTreeCellEditor + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1, TreeCellEditor value2) { + // TODO + } // DefaultTreeCellEditor() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * setBorderSelectionColor + * @param value0 TODO + */ + public void setBorderSelectionColor(Color value0) { + // TODO + } // setBorderSelectionColor() + + /** + * getBorderSelectionColor + * @returns Color + */ + public Color getBorderSelectionColor() { + return null; // TODO + } // getBorderSelectionColor() + + /** + * setFont + * @param value0 TODO + */ + public void setFont(Font value0) { + // TODO + } // setFont() + + /** + * getFont + * @returns Font + */ + public Font getFont() { + return null; // TODO + } // getFont() + + /** + * getTreeCellEditorComponent + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + * @param value5 TODO + * @returns Component + */ + public Component getTreeCellEditorComponent(JTree value0, Object value1, boolean value2, boolean value3, boolean value4, int value5) { + return null; // TODO + } // getTreeCellEditorComponent() + + /** + * getCellEditorValue + * @returns Object + */ + public Object getCellEditorValue() { + return null; // TODO + } // getCellEditorValue() + + /** + * isCellEditable + * @param value0 TODO + * @returns boolean + */ + public boolean isCellEditable(EventObject value0) { + return false; // TODO + } // isCellEditable() + + /** + * shouldSelectCell + * @param value0 TODO + * @returns boolean + */ + public boolean shouldSelectCell(EventObject value0) { + return false; // TODO + } // shouldSelectCell() + + /** + * stopCellEditing + * @returns boolean + */ + public boolean stopCellEditing() { + return false; // TODO + } // stopCellEditing() + + /** + * cancelCellEditing + */ + public void cancelCellEditing() { + // TODO + } // cancelCellEditing() + + /** + * addCellEditorListener + * @param value0 TODO + */ + public void addCellEditorListener(CellEditorListener value0) { + // TODO + } // addCellEditorListener() + + /** + * removeCellEditorListener + * @param value0 TODO + */ + public void removeCellEditorListener(CellEditorListener value0) { + // TODO + } // removeCellEditorListener() + + /** + * valueChanged + * @param value0 TODO + */ + public void valueChanged(TreeSelectionEvent value0) { + // TODO + } // valueChanged() + + /** + * actionPerformed + * @param value0 TODO + */ + public void actionPerformed(ActionEvent value0) { + // TODO + } // actionPerformed() + + /** + * setTree + * @param value0 TODO + */ + protected void setTree(JTree value0) { + // TODO + } // setTree() + + /** + * shouldStartEditingTimer + * @param value0 TODO + * @returns boolean + */ + protected boolean shouldStartEditingTimer(EventObject value0) { + return false; // TODO + } // shouldStartEditingTimer() + + /** + * startEditingTimer + */ + protected void startEditingTimer() { + // TODO + } // startEditingTimer() + + /** + * canEditImmediately + * @param value0 TODO + * @returns boolean + */ + protected boolean canEditImmediately(EventObject value0) { + return false; // TODO + } // canEditImmediately() + + /** + * inHitRegion + * @param value0 TODO + * @param value1 TODO + * @returns boolean + */ + protected boolean inHitRegion(int value0, int value1) { + return false; // TODO + } // inHitRegion() + + /** + * determineOffset + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + * @param value5 TODO + */ + protected void determineOffset(JTree value0, Object value1, boolean value2, boolean value3, boolean value4, int value5) { + // TODO + } // determineOffset() + + /** + * prepareForEditing + */ + protected void prepareForEditing() { + // TODO + } // prepareForEditing() + + /** + * createContainer + * @returns Container + */ + protected Container createContainer() { + return null; // TODO + } // createContainer() + + /** + * createTreeCellEditor + * @returns TreeCellEditor + */ + protected TreeCellEditor createTreeCellEditor() { + return null; // TODO + } // createTreeCellEditor() + + +} // DefaultTreeCellEditor diff --git a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java new file mode 100644 index 00000000000..ab534be96a4 --- /dev/null +++ b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java @@ -0,0 +1,450 @@ +/* DefaultTreeCellRenderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.*; +import javax.swing.*; + +/** + * DefaultTreeCellRenderer + * @author Andrew Selkirk + */ +public class DefaultTreeCellRenderer extends JLabel implements TreeCellRenderer { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * selected + */ + protected boolean selected; + + /** + * hasFocus + */ + protected boolean hasFocus; + + /** + * drawsFocusBorderAroundIcon + */ + private boolean drawsFocusBorderAroundIcon; + + /** + * closedIcon + */ + protected transient Icon closedIcon; + + /** + * leafIcon + */ + protected transient Icon leafIcon; + + /** + * openIcon + */ + protected transient Icon openIcon; + + /** + * textSelectionColor + */ + protected Color textSelectionColor; + + /** + * textNonSelectionColor + */ + protected Color textNonSelectionColor; + + /** + * backgroundSelectionColor + */ + protected Color backgroundSelectionColor; + + /** + * backgroundNonSelectionColor + */ + protected Color backgroundNonSelectionColor; + + /** + * borderSelectionColor + */ + protected Color borderSelectionColor; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTreeCellRenderer + */ + public DefaultTreeCellRenderer() { + // TODO + } // DefaultTreeCellRenderer() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getDefaultOpenIcon + * @returns Icon + */ + public Icon getDefaultOpenIcon() { + return null; // TODO + } // getDefaultOpenIcon() + + /** + * getDefaultClosedIcon + * @returns Icon + */ + public Icon getDefaultClosedIcon() { + return null; // TODO + } // getDefaultClosedIcon() + + /** + * getDefaultLeafIcon + * @returns Icon + */ + public Icon getDefaultLeafIcon() { + return null; // TODO + } // getDefaultLeafIcon() + + /** + * setOpenIcon + * @param value0 TODO + */ + public void setOpenIcon(Icon value0) { + // TODO + } // setOpenIcon() + + /** + * getOpenIcon + * @returns Icon + */ + public Icon getOpenIcon() { + return null; // TODO + } // getOpenIcon() + + /** + * setClosedIcon + * @param value0 TODO + */ + public void setClosedIcon(Icon value0) { + // TODO + } // setClosedIcon() + + /** + * getClosedIcon + * @returns Icon + */ + public Icon getClosedIcon() { + return null; // TODO + } // getClosedIcon() + + /** + * setLeafIcon + * @param value0 TODO + */ + public void setLeafIcon(Icon value0) { + // TODO + } // setLeafIcon() + + /** + * getLeafIcon + * @returns Icon + */ + public Icon getLeafIcon() { + return null; // TODO + } // getLeafIcon() + + /** + * setTextSelectionColor + * @param value0 TODO + */ + public void setTextSelectionColor(Color value0) { + // TODO + } // setTextSelectionColor() + + /** + * getTextSelectionColor + * @returns Color + */ + public Color getTextSelectionColor() { + return null; // TODO + } // getTextSelectionColor() + + /** + * setTextNonSelectionColor + * @param value0 TODO + */ + public void setTextNonSelectionColor(Color value0) { + // TODO + } // setTextNonSelectionColor() + + /** + * getTextNonSelectionColor + * @returns Color + */ + public Color getTextNonSelectionColor() { + return null; // TODO + } // getTextNonSelectionColor() + + /** + * setBackgroundSelectionColor + * @param value0 TODO + */ + public void setBackgroundSelectionColor(Color value0) { + // TODO + } // setBackgroundSelectionColor() + + /** + * getBackgroundSelectionColor + * @returns Color + */ + public Color getBackgroundSelectionColor() { + return null; // TODO + } // getBackgroundSelectionColor() + + /** + * setBackgroundNonSelectionColor + * @param value0 TODO + */ + public void setBackgroundNonSelectionColor(Color value0) { + // TODO + } // setBackgroundNonSelectionColor() + + /** + * getBackgroundNonSelectionColor + * @returns Color + */ + public Color getBackgroundNonSelectionColor() { + return null; // TODO + } // getBackgroundNonSelectionColor() + + /** + * setBorderSelectionColor + * @param value0 TODO + */ + public void setBorderSelectionColor(Color value0) { + // TODO + } // setBorderSelectionColor() + + /** + * getBorderSelectionColor + * @returns Color + */ + public Color getBorderSelectionColor() { + return null; // TODO + } // getBorderSelectionColor() + + /** + * setFont + * @param value0 TODO + */ + public void setFont(Font value0) { + // TODO + } // setFont() + + /** + * setBackground + * @param value0 TODO + */ + public void setBackground(Color value0) { + // TODO + } // setBackground() + + /** + * getTreeCellRendererComponent + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + * @param value5 TODO + * @param value6 TODO + * @returns Component + */ + public Component getTreeCellRendererComponent(JTree value0, Object value1, boolean value2, boolean value3, boolean value4, int value5, boolean value6) { + return null; // TODO + } // getTreeCellRendererComponent() + + /** + * paint + * @param value0 TODO + */ + public void paint(Graphics value0) { + // TODO + } // paint() + + /** + * getPreferredSize + * @returns Dimension + */ + public Dimension getPreferredSize() { + return null; // TODO + } // getPreferredSize() + + /** + * validate + */ + public void validate() { + // TODO + } // validate() + + /** + * revalidate + */ + public void revalidate() { + // TODO + } // revalidate() + + /** + * repaint + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + */ + public void repaint(long value0, int value1, int value2, int value3, int value4) { + // TODO + } // repaint() + + /** + * repaint + * @param value0 TODO + */ + public void repaint(Rectangle value0) { + // TODO + } // repaint() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + protected void firePropertyChange(String value0, Object value1, Object value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, byte value1, byte value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, char value1, char value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, short value1, short value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, int value1, int value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, long value1, long value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, float value1, float value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, double value1, double value2) { + // TODO + } // firePropertyChange() + + /** + * firePropertyChange + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void firePropertyChange(String value0, boolean value1, boolean value2) { + // TODO + } // firePropertyChange() + + +} // DefaultTreeCellRenderer diff --git a/libjava/javax/swing/tree/DefaultTreeModel.java b/libjava/javax/swing/tree/DefaultTreeModel.java new file mode 100644 index 00000000000..daf3f1100b5 --- /dev/null +++ b/libjava/javax/swing/tree/DefaultTreeModel.java @@ -0,0 +1,371 @@ +/* DefaultTreeModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.io.*; +import java.util.*; +import javax.swing.event.*; + +/** + * DefaultTreeModel + * @author Andrew Selkirk + */ +public class DefaultTreeModel implements Serializable, TreeModel { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * root + */ + protected TreeNode root = null; + + /** + * listenerList + */ + protected EventListenerList listenerList = new EventListenerList(); + + /** + * asksAllowsChildren + */ + protected boolean asksAllowsChildren; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTreeModel + * @param value0 TODO + */ + public DefaultTreeModel(TreeNode root) { + setRoot(root); + } // DefaultTreeModel() + + /** + * Constructor DefaultTreeModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) { + setRoot(root); + this.asksAllowsChildren = asksAllowsChildren; + } // DefaultTreeModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * asksAllowsChildren + * @returns boolean + */ + public boolean asksAllowsChildren() { + return asksAllowsChildren; + } // asksAllowsChildren() + + /** + * setAsksAllowsChildren + * @param value0 TODO + */ + public void setAsksAllowsChildren(boolean value) { + asksAllowsChildren = value; // TODO + } // setAsksAllowsChildren() + + /** + * setRoot + * @param value0 TODO + */ + public void setRoot(TreeNode root) { + + // Sanity Check + if (root == null) { + throw new IllegalArgumentException("null root"); + } // if + + // Set new root + this.root = root; + + // TODO + } // setRoot() + + /** + * getRoot + * @returns Object + */ + public Object getRoot() { + return root; + } // getRoot() + + /** + * getIndexOfChild + * @param value0 TODO + * @param value1 TODO + * @returns int + */ + public int getIndexOfChild(Object parent, Object child) { + return 0; // TODO + } // getIndexOfChild() + + /** + * getChild + * @param value0 TODO + * @param value1 TODO + * @returns Object + */ + public Object getChild(Object value0, int value1) { + return null; // TODO + } // getChild() + + /** + * getChildCount + * @param value0 TODO + * @returns int + */ + public int getChildCount(Object value0) { + return 0; // TODO + } // getChildCount() + + /** + * isLeaf + * @param value0 TODO + * @returns boolean + */ + public boolean isLeaf(Object value0) { + return false; // TODO + } // isLeaf() + + /** + * reload + */ + public void reload() { + // TODO + } // reload() + + /** + * reload + * @param value0 TODO + */ + public void reload(TreeNode value0) { + // TODO + } // reload() + + /** + * valueForPathChanged + * @param value0 TODO + * @param value1 TODO + */ + public void valueForPathChanged(TreePath value0, Object value1) { + // TODO + } // valueForPathChanged() + + /** + * insertNodeInto + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1, int value2) { + // TODO + } // insertNodeInto() + + /** + * removeNodeFromParent + * @param value0 TODO + */ + public void removeNodeFromParent(MutableTreeNode value0) { + // TODO + } // removeNodeFromParent() + + /** + * nodeChanged + * @param value0 TODO + */ + public void nodeChanged(TreeNode value0) { + // TODO + } // nodeChanged() + + /** + * nodesWereInserted + * @param value0 TODO + * @param value1 TODO + */ + public void nodesWereInserted(TreeNode value0, int[] value1) { + // TODO + } // nodesWereInserted() + + /** + * nodesWereRemoved + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2) { + // TODO + } // nodesWereRemoved() + + /** + * nodesChanged + * @param value0 TODO + * @param value1 TODO + */ + public void nodesChanged(TreeNode value0, int[] value1) { + // TODO + } // nodesChanged() + + /** + * nodeStructureChanged + * @param value0 TODO + */ + public void nodeStructureChanged(TreeNode value0) { + // TODO + } // nodeStructureChanged() + + /** + * getPathToRoot + * @param value0 TODO + * @returns TreeNode[] + */ + public TreeNode[] getPathToRoot(TreeNode value0) { + return null; // TODO + } // getPathToRoot() + + /** + * getPathToRoot + * @param value0 TODO + * @param value1 TODO + * @returns TreeNode[] + */ + protected TreeNode[] getPathToRoot(TreeNode value0, int value1) { + return null; // TODO + } // getPathToRoot() + + /** + * addTreeModelListener + * @param value0 TODO + */ + public void addTreeModelListener(TreeModelListener listener) { + listenerList.add(TreeModelListener.class, listener); + } // addTreeModelListener() + + /** + * removeTreeModelListener + * @param value0 TODO + */ + public void removeTreeModelListener(TreeModelListener listener) { + listenerList.remove(TreeModelListener.class, listener); + } // removeTreeModelListener() + + /** + * fireTreeNodesChanged + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + */ + protected void fireTreeNodesChanged(Object value0, Object[] value1, int[] value2, Object[] value3) { + // TODO + } // fireTreeNodesChanged() + + /** + * fireTreeNodesInserted + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + */ + protected void fireTreeNodesInserted(Object value0, Object[] value1, int[] value2, Object[] value3) { + // TODO + } // fireTreeNodesInserted() + + /** + * fireTreeNodesRemoved + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + */ + protected void fireTreeNodesRemoved(Object value0, Object[] value1, int[] value2, Object[] value3) { + // TODO + } // fireTreeNodesRemoved() + + /** + * fireTreeStructureChanged + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + */ + protected void fireTreeStructureChanged(Object value0, Object[] value1, int[] value2, Object[] value3) { + // TODO + } // fireTreeStructureChanged() + + /** + * getListeners + * @param value0 TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class classType) { + return listenerList.getListeners(classType); + } // getListeners() + + +} // DefaultTreeModel diff --git a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java new file mode 100644 index 00000000000..f772c188c13 --- /dev/null +++ b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java @@ -0,0 +1,451 @@ +/* DefaultTreeSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.beans.*; +import java.io.*; +import java.util.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * DefaultTreeSelectionModel + * @author Andrew Selkirk + */ +public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeSelectionModel { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * SELECTION_MODE_PROPERTY + */ + public static final String SELECTION_MODE_PROPERTY = "selectionMode"; + + /** + * changeSupport + */ + protected SwingPropertyChangeSupport changeSupport; + + /** + * selection + */ + protected TreePath[] selection; + + /** + * listenerList + */ + protected EventListenerList listenerList; + + /** + * rowMapper + */ + protected transient RowMapper rowMapper; + + /** + * listSelectionModel + */ + protected DefaultListSelectionModel listSelectionModel; + + /** + * selectionMode + */ + protected int selectionMode; + + /** + * leadPath + */ + protected TreePath leadPath; + + /** + * leadIndex + */ + protected int leadIndex; + + /** + * leadRow + */ + protected int leadRow; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor DefaultTreeSelectionModel + */ + public DefaultTreeSelectionModel() { + // TODO + } // DefaultTreeSelectionModel() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * clone + * @exception CloneNotSupportedException TODO + * @returns Object + */ + public Object clone() throws CloneNotSupportedException { + return null; // TODO + } // clone() + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * setRowMapper + * @param value0 TODO + */ + public void setRowMapper(RowMapper value0) { + // TODO + } // setRowMapper() + + /** + * getRowMapper + * @returns RowMapper + */ + public RowMapper getRowMapper() { + return null; // TODO + } // getRowMapper() + + /** + * setSelectionMode + * @param value0 TODO + */ + public void setSelectionMode(int value0) { + // TODO + } // setSelectionMode() + + /** + * getSelectionMode + * @returns int + */ + public int getSelectionMode() { + return 0; // TODO + } // getSelectionMode() + + /** + * setSelectionPath + * @param value0 TODO + */ + public void setSelectionPath(TreePath value0) { + // TODO + } // setSelectionPath() + + /** + * setSelectionPaths + * @param value0 TODO + */ + public void setSelectionPaths(TreePath[] value0) { + // TODO + } // setSelectionPaths() + + /** + * addSelectionPath + * @param value0 TODO + */ + public void addSelectionPath(TreePath value0) { + // TODO + } // addSelectionPath() + + /** + * addSelectionPaths + * @param value0 TODO + */ + public void addSelectionPaths(TreePath[] value0) { + // TODO + } // addSelectionPaths() + + /** + * removeSelectionPath + * @param value0 TODO + */ + public void removeSelectionPath(TreePath value0) { + // TODO + } // removeSelectionPath() + + /** + * removeSelectionPaths + * @param value0 TODO + */ + public void removeSelectionPaths(TreePath[] value0) { + // TODO + } // removeSelectionPaths() + + /** + * getSelectionPath + * @returns TreePath + */ + public TreePath getSelectionPath() { + return null; // TODO + } // getSelectionPath() + + /** + * getSelectionPaths + * @returns TreePath[] + */ + public TreePath[] getSelectionPaths() { + return null; // TODO + } // getSelectionPaths() + + /** + * getSelectionCount + * @returns int + */ + public int getSelectionCount() { + return 0; // TODO + } // getSelectionCount() + + /** + * isPathSelected + * @param value0 TODO + * @returns boolean + */ + public boolean isPathSelected(TreePath value0) { + return false; // TODO + } // isPathSelected() + + /** + * isSelectionEmpty + * @returns boolean + */ + public boolean isSelectionEmpty() { + return false; // TODO + } // isSelectionEmpty() + + /** + * clearSelection + */ + public void clearSelection() { + // TODO + } // clearSelection() + + /** + * addTreeSelectionListener + * @param value0 TODO + */ + public void addTreeSelectionListener(TreeSelectionListener value0) { + // TODO + } // addTreeSelectionListener() + + /** + * removeTreeSelectionListener + * @param value0 TODO + */ + public void removeTreeSelectionListener(TreeSelectionListener value0) { + // TODO + } // removeTreeSelectionListener() + + /** + * fireValueChanged + * @param value0 TODO + */ + protected void fireValueChanged(TreeSelectionEvent value0) { + // TODO + } // fireValueChanged() + + /** + * getListeners + * @param value0 TODO + * @returns EventListener[] + */ + public EventListener[] getListeners(Class value0) { + return null; // TODO + } // getListeners() + + /** + * getSelectionRows + * @returns int[] + */ + public int[] getSelectionRows() { + return null; // TODO + } // getSelectionRows() + + /** + * getMinSelectionRow + * @returns int + */ + public int getMinSelectionRow() { + return 0; // TODO + } // getMinSelectionRow() + + /** + * getMaxSelectionRow + * @returns int + */ + public int getMaxSelectionRow() { + return 0; // TODO + } // getMaxSelectionRow() + + /** + * isRowSelected + * @param value0 TODO + * @returns boolean + */ + public boolean isRowSelected(int value0) { + return false; // TODO + } // isRowSelected() + + /** + * resetRowSelection + */ + public void resetRowSelection() { + // TODO + } // resetRowSelection() + + /** + * getLeadSelectionRow + * @returns int + */ + public int getLeadSelectionRow() { + return 0; // TODO + } // getLeadSelectionRow() + + /** + * getLeadSelectionPath + * @returns TreePath + */ + public TreePath getLeadSelectionPath() { + return null; // TODO + } // getLeadSelectionPath() + + /** + * addPropertyChangeListener + * @param value0 TODO + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener value0) { + // TODO + } // addPropertyChangeListener() + + /** + * removePropertyChangeListener + * @param value0 TODO + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener value0) { + // TODO + } // removePropertyChangeListener() + + /** + * insureRowContinuity + */ + protected void insureRowContinuity() { + // TODO + } // insureRowContinuity() + + /** + * arePathsContiguous + * @param value0 TODO + * @returns boolean + */ + protected boolean arePathsContiguous(TreePath[] value0) { + return false; // TODO + } // arePathsContiguous() + + /** + * canPathsBeAdded + * @param value0 TODO + * @returns boolean + */ + protected boolean canPathsBeAdded(TreePath[] value0) { + return false; // TODO + } // canPathsBeAdded() + + /** + * canPathsBeRemoved + * @param value0 TODO + * @returns boolean + */ + protected boolean canPathsBeRemoved(TreePath[] value0) { + return false; // TODO + } // canPathsBeRemoved() + + /** + * notifyPathChange + * @param value0 TODO + * @param value1 TODO + */ + protected void notifyPathChange(Vector value0, TreePath value1) { + // TODO + } // notifyPathChange() + + /** + * updateLeadIndex + */ + protected void updateLeadIndex() { + // TODO + } // updateLeadIndex() + + /** + * insureUniqueness + */ + protected void insureUniqueness() { + // TODO + } // insureUniqueness() + + +} // DefaultTreeSelectionModel diff --git a/libjava/javax/swing/tree/ExpandVetoException.java b/libjava/javax/swing/tree/ExpandVetoException.java new file mode 100644 index 00000000000..5edf09a11e1 --- /dev/null +++ b/libjava/javax/swing/tree/ExpandVetoException.java @@ -0,0 +1,83 @@ +/* ExpandVetoException.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import javax.swing.event.TreeExpansionEvent; + +/** + * ExpandVetoException + * @author Andrew Selkirk + */ +public class ExpandVetoException extends Exception { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * event + */ + protected TreeExpansionEvent event = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ExpandVetoException + * @param event Tree Expansion Event + */ + public ExpandVetoException(TreeExpansionEvent event) { + super(); + this.event = event; + } // ExpandVetoException() + + /** + * Constructor ExpandVetoException + * @param event Tree Expansion Event + * @param message Message + */ + public ExpandVetoException(TreeExpansionEvent event, String message) { + super(message); + this.event = event; + } // ExpandVetoException() + + +} // ExpandVetoException diff --git a/libjava/javax/swing/tree/FixedHeightLayoutCache.java b/libjava/javax/swing/tree/FixedHeightLayoutCache.java new file mode 100644 index 00000000000..279eec0278b --- /dev/null +++ b/libjava/javax/swing/tree/FixedHeightLayoutCache.java @@ -0,0 +1,235 @@ +/* FixedHeightLayoutCache.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.*; +import java.util.*; +import javax.swing.event.*; + +/** + * FixedHeightLayoutCache + * @author Andrew Selkirk + */ +public class FixedHeightLayoutCache extends AbstractLayoutCache { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FixedHeightLayoutCache + */ + public FixedHeightLayoutCache() { + // TODO + } // FixedHeightLayoutCache() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setModel + * @param value0 TODO + */ + public void setModel(TreeModel value0) { + // TODO + } // setModel() + + /** + * setRootVisible + * @param value0 TODO + */ + public void setRootVisible(boolean value0) { + // TODO + } // setRootVisible() + + /** + * setRowHeight + * @param value0 TODO + */ + public void setRowHeight(int value0) { + // TODO + } // setRowHeight() + + /** + * getRowCount + * @returns int + */ + public int getRowCount() { + return 0; // TODO + } // getRowCount() + + /** + * invalidatePathBounds + * @param value0 TODO + */ + public void invalidatePathBounds(TreePath value0) { + // TODO + } // invalidatePathBounds() + + /** + * invalidateSizes + */ + public void invalidateSizes() { + // TODO + } // invalidateSizes() + + /** + * isExpanded + * @param value0 TODO + * @returns boolean + */ + public boolean isExpanded(TreePath value0) { + return false; // TODO + } // isExpanded() + + /** + * getBounds + * @param value0 TODO + * @param value1 TODO + * @returns Rectangle + */ + public Rectangle getBounds(TreePath value0, Rectangle value1) { + return null; // TODO + } // getBounds() + + /** + * getPathForRow + * @param value0 TODO + * @returns TreePath + */ + public TreePath getPathForRow(int value0) { + return null; // TODO + } // getPathForRow() + + /** + * getRowForPath + * @param value0 TODO + * @returns int + */ + public int getRowForPath(TreePath value0) { + return 0; // TODO + } // getRowForPath() + + /** + * getPathClosestTo + * @param value0 TODO + * @param value1 TODO + * @returns TreePath + */ + public TreePath getPathClosestTo(int value0, int value1) { + return null; // TODO + } // getPathClosestTo() + + /** + * getVisibleChildCount + * @param value0 TODO + * @returns int + */ + public int getVisibleChildCount(TreePath value0) { + return 0; // TODO + } // getVisibleChildCount() + + /** + * getVisiblePathsFrom + * @param value0 TODO + * @returns Enumeration + */ + public Enumeration getVisiblePathsFrom(TreePath value0) { + return null; // TODO + } // getVisiblePathsFrom() + + /** + * setExpandedState + * @param value0 TODO + * @param value1 TODO + */ + public void setExpandedState(TreePath value0, boolean value1) { + // TODO + } // setExpandedState() + + /** + * getExpandedState + * @param value0 TODO + * @returns boolean + */ + public boolean getExpandedState(TreePath value0) { + return false; // TODO + } // getExpandedState() + + /** + * treeNodesChanged + * @param value0 TODO + */ + public void treeNodesChanged(TreeModelEvent value0) { + // TODO + } // treeNodesChanged() + + /** + * treeNodesInserted + * @param value0 TODO + */ + public void treeNodesInserted(TreeModelEvent value0) { + // TODO + } // treeNodesInserted() + + /** + * treeNodesRemoved + * @param value0 TODO + */ + public void treeNodesRemoved(TreeModelEvent value0) { + // TODO + } // treeNodesRemoved() + + /** + * treeStructureChanged + * @param value0 TODO + */ + public void treeStructureChanged(TreeModelEvent value0) { + // TODO + } // treeStructureChanged() + + +} // FixedHeightLayoutCache diff --git a/libjava/javax/swing/tree/MutableTreeNode.java b/libjava/javax/swing/tree/MutableTreeNode.java new file mode 100644 index 00000000000..e550459d59b --- /dev/null +++ b/libjava/javax/swing/tree/MutableTreeNode.java @@ -0,0 +1,83 @@ +/* MutableTreeNode.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +/** + * MutableTreeNode interface + * @author Andrew Selkirk + */ +public interface MutableTreeNode extends TreeNode { + + /** + * insert + * @param child MutableTreeNode + * @param index Index + */ + public void insert(MutableTreeNode child, int index); + + /** + * remove + * @param index Index + */ + public void remove(int index); + + /** + * remove + * @param node MutableTreeNode + */ + public void remove(MutableTreeNode node); + + /** + * setUserObject + * @param object Object + */ + public void setUserObject(Object object); + + /** + * removeFromParent + */ + public void removeFromParent(); + + /** + * setParent + * @param parent MutableTreeNode + */ + public void setParent(MutableTreeNode parent); + + +} // MutableTreeNode diff --git a/libjava/javax/swing/tree/RowMapper.java b/libjava/javax/swing/tree/RowMapper.java new file mode 100644 index 00000000000..4cc82fb30cd --- /dev/null +++ b/libjava/javax/swing/tree/RowMapper.java @@ -0,0 +1,54 @@ +/* RowMapper.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +/** + * RowMapper interface + * @author Andrew Selkirk + */ +public interface RowMapper { + + /** + * getRowsForPaths + * @param path TreePath + * @return TODO + */ + public int[] getRowsForPaths(TreePath[] path); + + +} // RowMapper diff --git a/libjava/javax/swing/tree/TreeCellEditor.java b/libjava/javax/swing/tree/TreeCellEditor.java new file mode 100644 index 00000000000..c55b97d339a --- /dev/null +++ b/libjava/javax/swing/tree/TreeCellEditor.java @@ -0,0 +1,65 @@ +/* TreeCellEditor.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.Component; +import javax.swing.JTree; + +/** + * TreeCellEditor interface + * @author Andrew Selkirk + */ +public interface TreeCellEditor { + + /** + * getTreeCellEditorComponent + * @param tree TODO + * @param value TODO + * @param isSelected TODO + * @param expanded TODO + * @param leaf TODO + * @param row TODO + * @returns TODO + */ + public Component getTreeCellEditorComponent(JTree tree, + Object value, boolean isSelected, boolean expanded, + boolean leaf, int row); + + +} // TreeCellEditor diff --git a/libjava/javax/swing/tree/TreeCellRenderer.java b/libjava/javax/swing/tree/TreeCellRenderer.java new file mode 100644 index 00000000000..59c9db1963c --- /dev/null +++ b/libjava/javax/swing/tree/TreeCellRenderer.java @@ -0,0 +1,66 @@ +/* TreeCellRenderer.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.Component; +import javax.swing.JTree; + +/** + * TreeCellRenderer interface + * @author Andrew Selkirk + */ +public interface TreeCellRenderer { + + /** + * getTreeCellRendererComponent + * @param tree TODO + * @param value TODO + * @param selected TODO + * @param expanded TODO + * @param leaf TODO + * @param row TODO + * @param us TODO + * @returns TODO + */ + public Component getTreeCellRendererComponent(JTree tree, + Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus); + + +} // TreeCellRenderer diff --git a/libjava/javax/swing/tree/TreeModel.java b/libjava/javax/swing/tree/TreeModel.java new file mode 100644 index 00000000000..6763544fb9e --- /dev/null +++ b/libjava/javax/swing/tree/TreeModel.java @@ -0,0 +1,109 @@ +/* TreeModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import javax.swing.event.*; + +/** + * TreeModel interface + * @author Andrew Selkirk + */ +public interface TreeModel { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getRoot + * @returns Object + */ + public abstract Object getRoot(); + + /** + * getChild + * @param parent TODO + * @param index TODO + * @returns Object + */ + public abstract Object getChild(Object parent, int index); + + /** + * getChildCount + * @param parent TODO + * @returns int + */ + public abstract int getChildCount(Object parent); + + /** + * isLeaf + * @param node TODO + * @returns boolean + */ + public abstract boolean isLeaf(Object node); + + /** + * valueForPathChanged + * @param path TODO + * @param newvalue TODO + */ + public abstract void valueForPathChanged(TreePath path, Object newvalue); + + /** + * getIndexOfChild + * @param parent TODO + * @param ild TODO + * @returns int + */ + public abstract int getIndexOfChild(Object parent, Object child); + + /** + * addTreeModelListener + * @param listener TODO + */ + public abstract void addTreeModelListener(TreeModelListener listener); + + /** + * removeTreeModelListener + * @param listener TODO + */ + public abstract void removeTreeModelListener(TreeModelListener listener); + + +} // TreeModel diff --git a/libjava/javax/swing/tree/TreeNode.java b/libjava/javax/swing/tree/TreeNode.java new file mode 100644 index 00000000000..46464d2d73e --- /dev/null +++ b/libjava/javax/swing/tree/TreeNode.java @@ -0,0 +1,99 @@ +/* TreeNode.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.util.*; + +/** + * TreeNode interface + * @author Andrew Selkirk + */ +public interface TreeNode { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getParent + * @returns TreeNode + */ + public TreeNode getParent(); + + /** + * getIndex + * @param node TODO + * @returns int + */ + public int getIndex(TreeNode node); + + /** + * getChildAt + * @param index TODO + * @returns TreeNode + */ + public TreeNode getChildAt(int index); + + /** + * getChildCount + * @returns int + */ + public int getChildCount(); + + /** + * getAllowsChildren + * @returns boolean + */ + public abstract boolean getAllowsChildren(); + + /** + * isLeaf + * @returns boolean + */ + public boolean isLeaf(); + + /** + * children + * @returns Enumeration + */ + public Enumeration children(); + + +} // TreeNode + diff --git a/libjava/javax/swing/tree/TreePath.java b/libjava/javax/swing/tree/TreePath.java new file mode 100644 index 00000000000..56899cf9280 --- /dev/null +++ b/libjava/javax/swing/tree/TreePath.java @@ -0,0 +1,295 @@ +/* TreePath.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.io.*; + +/** + * TreePath + * @author Andrew Selkirk + */ +public class TreePath implements Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * path + */ + private Object[] path = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TreePath + * @param path TODO + */ + public TreePath(Object[] path) { + + // Create Path + this.path = new Object[path.length]; + System.arraycopy(path, 0, this.path, 0, path.length); + + } // TreePath() + + /** + * Constructor TreePath + * @param element TODO + */ + public TreePath(Object element) { + + // Create Path + path = new Object[1]; + path[0] = element; + + } // TreePath() + + /** + * Constructor TreePath + * @param path TODO + * @param element TODO + */ + protected TreePath(TreePath path, Object element) { + + // Variables + Object[] treepath; + + // Get Tree Path + treepath = path.getPath(); + + // Create Tree Path + this.path = new Object[treepath.length + 1]; + System.arraycopy(treepath, 0, this.path, 0, treepath.length); + this.path[treepath.length] = element; + + } // TreePath() + + /** + * Constructor TreePath + * @param path TODO + * @param length TODO + */ + protected TreePath(Object[] path, int length) { + + // Create Path + this.path = new Object[length]; + System.arraycopy(path, 0, this.path, 0, length); + + } // TreePath() + + /** + * Constructor TreePath + */ + protected TreePath() { + path = new Object[0]; + } // TreePath() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * hashCode + * @returns int + */ + public int hashCode() { + return getLastPathComponent().hashCode(); + } // hashCode() + + /** + * equals + * @param object TODO + * @returns boolean + */ + public boolean equals(Object object) { + + // Variables + Object[] treepath; + int index; + + // Check for TreePath + if (object instanceof TreePath) { + + // Get Path Elements + treepath = ((TreePath) object).getPath(); + + // Check length + if (treepath.length != path.length) { + return false; + } // if + + // Check Elements + for (index = 0; index < path.length; index++) { + if (treepath[index] != path[index]) { + return false; + } // if + } // for + + // Tree Path's are equals + return true; + + } // if + + // Unequal + return false; + + } // equals() + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException { + // TODO + } // writeObject() + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException { + // TODO + } // readObject() + + /** + * getPath + * @returns Object[] + */ + public Object[] getPath() { + return path; + } // getPath() + + /** + * getLastPathComponent + * @returns Object + */ + public Object getLastPathComponent() { + return path[path.length - 1]; + } // getLastPathComponent() + + /** + * getPathCount + * @returns int + */ + public int getPathCount() { + return path.length; + } // getPathCount() + + /** + * getPathComponent + * @param position TODO + * @returns Object + */ + public Object getPathComponent(int position) { + return path[position]; + } // getPathComponent() + + /** + * isDescendant + * @param path TODO + * @returns boolean + */ + public boolean isDescendant(TreePath path) { + + // Variables + Object[] treepath; + int index; + int index2; + + // Get Descendant path + treepath = path.getPath(); + + // Locate Start Index + index = 0; + index2 = 0; + while (treepath[index] != this.path[index2]) { + index++; + } // while + + // Verify Paths + while (treepath[index] == this.path[index2]) { + index++; + index2++; + } // while + + // Check for descendant + if (index2 != this.path.length) { + return false; + } // if + + // Is Descendant + return true; + + } // isDescendant() + + /** + * pathByAddingChild + * @param element TODO + * @returns TreePath + */ + public TreePath pathByAddingChild(Object element) { + return new TreePath(this, element); + } // pathByAddingChild() + + /** + * getParentPath + * @returns TreePath + */ + public TreePath getParentPath() { + return new TreePath(this.getPath(), path.length - 1); + } // getParentPath() + + +} // TreePath diff --git a/libjava/javax/swing/tree/TreeSelectionModel.java b/libjava/javax/swing/tree/TreeSelectionModel.java new file mode 100644 index 00000000000..ef8e0b44772 --- /dev/null +++ b/libjava/javax/swing/tree/TreeSelectionModel.java @@ -0,0 +1,83 @@ +/* TreeSelectionModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.beans.PropertyChangeListener; +import javax.swing.event.TreeSelectionListener; + +/** + * TreeSelectionModel interface + * @author Andrew Selkirk + */ +public interface TreeSelectionModel { + + public static final int SINGLE_TREE_SELECTION = 1; + public static final int CONTIGUOUS_TREE_SELECTION = 2; + public static final int DISCONTIGUOUS_TREE_SELECTION = 4; + + public void setSelectionMode(int mode); + public int getSelectionMode(); + public void setSelectionPath(TreePath path); + public void setSelectionPaths(TreePath[] paths); + public void addSelectionPath(TreePath path); + public void addSelectionPaths(TreePath[] paths); + public void removeSelectionPath(TreePath path); + public void removeSelectionPaths(TreePath[] paths); + public TreePath getSelectionPath(); + public TreePath[] getSelectionPaths(); + public int getSelectionCount(); + public boolean isPathSelected(TreePath path); + public boolean isSelectionEmpty(); + public void clearSelection(); + public void setRowMapper(RowMapper newMapper); + public RowMapper getRowMapper(); + public int[] getSelectionRows(); + public int getMinSelectionRow(); + public int getMaxSelectionRow(); + public boolean isRowSelected(int row); + public void resetRowSelection(); + public int getLeadSelectionRow(); + public TreePath getLeadSelectionPath(); + public void addPropertyChangeListener(PropertyChangeListener listener); + public void removePropertyChangeListener(PropertyChangeListener listener); + public void addTreeSelectionListener(TreeSelectionListener x); + public void removeTreeSelectionListener(TreeSelectionListener x); + + +} // TreeSelectionModel diff --git a/libjava/javax/swing/tree/VariableHeightLayoutCache.java b/libjava/javax/swing/tree/VariableHeightLayoutCache.java new file mode 100644 index 00000000000..8e9015399a6 --- /dev/null +++ b/libjava/javax/swing/tree/VariableHeightLayoutCache.java @@ -0,0 +1,260 @@ +/* VariableHeightLayoutCache.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.tree; + +// Imports +import java.awt.*; +import java.util.*; +import javax.swing.event.*; + +/** + * VariableHeightLayoutCache + * @author Andrew Selkirk + */ +public class VariableHeightLayoutCache extends AbstractLayoutCache { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor VariableHeightLayoutCache + */ + public VariableHeightLayoutCache() { + // TODO + } // VariableHeightLayoutCache() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * setModel + * @param value0 TODO + */ + public void setModel(TreeModel value0) { + // TODO + } // setModel() + + /** + * setRootVisible + * @param value0 TODO + */ + public void setRootVisible(boolean value0) { + // TODO + } // setRootVisible() + + /** + * setRowHeight + * @param value0 TODO + */ + public void setRowHeight(int value0) { + // TODO + } // setRowHeight() + + /** + * setNodeDimensions + * @param value0 TODO + */ + public void setNodeDimensions(NodeDimensions value0) { + // TODO + } // setNodeDimensions() + + /** + * setExpandedState + * @param value0 TODO + * @param value1 TODO + */ + public void setExpandedState(TreePath value0, boolean value1) { + // TODO + } // setExpandedState() + + /** + * getExpandedState + * @param value0 TODO + * @returns boolean + */ + public boolean getExpandedState(TreePath value0) { + return false; // TODO + } // getExpandedState() + + /** + * getBounds + * @param value0 TODO + * @param value1 TODO + * @returns Rectangle + */ + public Rectangle getBounds(TreePath value0, Rectangle value1) { + return null; // TODO + } // getBounds() + + /** + * getPathForRow + * @param value0 TODO + * @returns TreePath + */ + public TreePath getPathForRow(int value0) { + return null; // TODO + } // getPathForRow() + + /** + * getRowForPath + * @param value0 TODO + * @returns int + */ + public int getRowForPath(TreePath value0) { + return 0; // TODO + } // getRowForPath() + + /** + * getRowCount + * @returns int + */ + public int getRowCount() { + return 0; // TODO + } // getRowCount() + + /** + * invalidatePathBounds + * @param value0 TODO + */ + public void invalidatePathBounds(TreePath value0) { + // TODO + } // invalidatePathBounds() + + /** + * getPreferredHeight + * @returns int + */ + public int getPreferredHeight() { + return 0; // TODO + } // getPreferredHeight() + + /** + * getPreferredWidth + * @param value0 TODO + * @returns int + */ + public int getPreferredWidth(Rectangle value0) { + return 0; // TODO + } // getPreferredWidth() + + /** + * getPathClosestTo + * @param value0 TODO + * @param value1 TODO + * @returns TreePath + */ + public TreePath getPathClosestTo(int value0, int value1) { + return null; // TODO + } // getPathClosestTo() + + /** + * getVisiblePathsFrom + * @param value0 TODO + * @returns Enumeration + */ + public Enumeration getVisiblePathsFrom(TreePath value0) { + return null; // TODO + } // getVisiblePathsFrom() + + /** + * getVisibleChildCount + * @param value0 TODO + * @returns int + */ + public int getVisibleChildCount(TreePath value0) { + return 0; // TODO + } // getVisibleChildCount() + + /** + * invalidateSizes + */ + public void invalidateSizes() { + // TODO + } // invalidateSizes() + + /** + * isExpanded + * @param value0 TODO + * @returns boolean + */ + public boolean isExpanded(TreePath value0) { + return false; // TODO + } // isExpanded() + + /** + * treeNodesChanged + * @param value0 TODO + */ + public void treeNodesChanged(TreeModelEvent value0) { + // TODO + } // treeNodesChanged() + + /** + * treeNodesInserted + * @param value0 TODO + */ + public void treeNodesInserted(TreeModelEvent value0) { + // TODO + } // treeNodesInserted() + + /** + * treeNodesRemoved + * @param value0 TODO + */ + public void treeNodesRemoved(TreeModelEvent value0) { + // TODO + } // treeNodesRemoved() + + /** + * treeStructureChanged + * @param value0 TODO + */ + public void treeStructureChanged(TreeModelEvent value0) { + // TODO + } // treeStructureChanged() + + +} // VariableHeightLayoutCache diff --git a/libjava/javax/swing/undo/AbstractUndoableEdit.java b/libjava/javax/swing/undo/AbstractUndoableEdit.java new file mode 100644 index 00000000000..e98b87cb3ae --- /dev/null +++ b/libjava/javax/swing/undo/AbstractUndoableEdit.java @@ -0,0 +1,214 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +// Imports +import java.io.Serializable; + +/** + * AbstractUndoableEdit + * @author Andrew Selkirk + */ +public class AbstractUndoableEdit extends Object + implements UndoableEdit, + Serializable { + + //------------------------------------------------------------- + // Constants -------------------------------------------------- + //------------------------------------------------------------- + + /** + * String returned by getRedoPresentationName() + */ + protected static String RedoName = "Redo"; + + /** + * String returned by getUndoPresentationName() + */ + protected static String UndoName = "Undo"; + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * TODO + */ + private boolean hasBeenDone = false; + + /** + * The edit is alive + */ + private boolean alive = true; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Create new AbstractUndoableEdit + */ + public AbstractUndoableEdit() { + } // AbstractUndoableEdit() + + + //------------------------------------------------------------- + // Interface: UndoableEdit ------------------------------------ + //------------------------------------------------------------- + + /** + * addEdit + * @param anEdit TODO + * @returns TODO + */ + public boolean addEdit(UndoableEdit anEdit) { + return false; + } // addEdit() + + /** + * canRedo() + * @returns true if redoable, false otherwise + */ + public boolean canRedo() { + if (alive == true && hasBeenDone == false) { + return true; + } // if + return false; + } // canRedo() + + /** + * canUndo() + * @returns true if undoable, false otherwise + */ + public boolean canUndo() { + if (alive == true && hasBeenDone == true) { + return true; + } // if + return false; + } // canUndo() + + /** + * die + */ + public void die() { + alive = false; + } // die() + + /** + * getPresentation + * @returns TODO + */ + public String getPresentationName() { + return ""; + } // getPresentationName() + + /** + * getRedoPresentationName + * @returns TODO + */ + public String getRedoPresentationName() { + if (getPresentationName().equals("") == true) { + return RedoName; + } else { + return RedoName + " " + getPresentationName(); + } + } // getRedoPresentationName() + + /** + * getUndoPresentationName + * @returns TODO + */ + public String getUndoPresentationName() { + if (getPresentationName().equals("") == true) { + return UndoName; + } else { + return UndoName + " " + getPresentationName(); + } + } // getUndoPresentationName() + + /** + * isSignificant + * @returns true + */ + public boolean isSignificant() { + return true; + } // isSignificant() + + /** + * redo + * @throws CannotRedoException TODO + */ + public void redo() throws CannotRedoException { + if (canRedo() == false) { + throw new CannotRedoException(); + } + hasBeenDone = true; + } // redo() + + /** + * replaceEdit + * @param anEdit TODO + * @returns TODO + */ + public boolean replaceEdit(UndoableEdit anEdit) { + return false; + } // replaceEdit() + + /** + * String representation + * @returns String representation + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * undo + * @throws CannotUndoException TODO + */ + public void undo() throws CannotUndoException { + if (canUndo() == false) { + throw new CannotUndoException(); + } + hasBeenDone = false; + } // undo() + + +} // AbstractUndoableEdit diff --git a/libjava/javax/swing/undo/CannotRedoException.java b/libjava/javax/swing/undo/CannotRedoException.java new file mode 100644 index 00000000000..030975d4f1d --- /dev/null +++ b/libjava/javax/swing/undo/CannotRedoException.java @@ -0,0 +1,54 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +/** + * CannotRedoException + * @author Andrew Selkirk + */ +public class CannotRedoException extends RuntimeException { + + /** + * Create exception + */ + public CannotRedoException() { + super(); + } // CannotRedoException() + + +} // CannotRedoException diff --git a/libjava/javax/swing/undo/CannotUndoException.java b/libjava/javax/swing/undo/CannotUndoException.java new file mode 100644 index 00000000000..c039d1bbebd --- /dev/null +++ b/libjava/javax/swing/undo/CannotUndoException.java @@ -0,0 +1,54 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +/** + * CannotUndoException + * @author Andrew Selkirk + */ +public class CannotUndoException extends RuntimeException { + + /** + * Create exception + */ + public CannotUndoException() { + super(); + } // CannotUndoException() + + +} // CannotUndoException diff --git a/libjava/javax/swing/undo/CompoundEdit.java b/libjava/javax/swing/undo/CompoundEdit.java new file mode 100644 index 00000000000..37a7c4ca4eb --- /dev/null +++ b/libjava/javax/swing/undo/CompoundEdit.java @@ -0,0 +1,282 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +// Imports +import java.util.Vector; + +/** + * CompoundEdit + * @author Andrew Selkirk + */ +public class CompoundEdit extends AbstractUndoableEdit { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * The collection of UndoableEdits undone/redone en + * masse by this CompoundEdit + */ + protected Vector edits = new Vector(); + + /** + * TODO + */ + private boolean inProgress = false; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Create new Compound Edit + */ + public CompoundEdit() { + } // CompoundEdit() + + + //------------------------------------------------------------- + // Interface: UndoableEdit ------------------------------------ + //------------------------------------------------------------- + + /** + * addEdit + * @param anEdit TODO + * @returns TODO + */ + public boolean addEdit(UndoableEdit anEdit) { + + // Variables + UndoableEdit lastEdit; + + if (inProgress == true) { + + // Get Last Edit + lastEdit = lastEdit(); + + // Check for null + if (lastEdit != null) { + + if (lastEdit.addEdit(anEdit) == false) { + if (lastEdit.replaceEdit(anEdit) == false) { + edits.add(anEdit); + } + } + + } // if: lastEdit + + return true; + + } else { + return false; + } + } // addEdit() + + /** + * canRedo + * @returns TODO + */ + public boolean canRedo() { + if (isInProgress() == true || super.canRedo() == false) { + return false; + } + return true; + } // canRedo() + + /** + * canUndo + * @returns TODO + */ + public boolean canUndo() { + if (isInProgress() == true || super.canUndo() == false) { + return false; + } + return true; + } // canUndo() + + /** + * die + */ + public void die() { + + // Variables + int index; + UndoableEdit current; + + // Loop through all contained UndoableEdits + for (index = edits.size() - 1; index >= 0; index--) { + current = (UndoableEdit) edits.elementAt(index); + current.die(); + } // for: index + + } // die() + + /** + * end + */ + public void end() { + inProgress = false; + } // end() + + /** + * getPresentationName + * @returns TODO + */ + public String getPresentationName() { + if (edits.size() == 0) { + return super.getPresentationName(); + } else { + return lastEdit().getPresentationName(); + } + } // getPresentationName() + + /** + * getRedoPresentationName + * @returns TODO + */ + public String getRedoPresentationName() { + if (edits.size() == 0) { + return super.getRedoPresentationName(); + } else { + return lastEdit().getRedoPresentationName(); + } + } // getRedoPresentationName() + + /** + * getUndoPresentationName + * @returns TODO + */ + public String getUndoPresentationName() { + if (edits.size() == 0) { + return super.getUndoPresentationName(); + } else { + return lastEdit().getUndoPresentationName(); + } + } // getUndoPresentationName() + + /** + * isInProgress + * @returns TODO + */ + public boolean isInProgress() { + return inProgress; + } // isInProgress() + + + /** + * isSignigicant + * @returns TODO + */ + public boolean isSignificant() { + + // Variables + int index; + UndoableEdit current; + + // Check each edit + for (index = 0; index < edits.size(); index++) { + current = (UndoableEdit) edits.elementAt(index); + if (current.isSignificant() == true) { + return true; + } + } // for: index + + return false; + + } // isSignificant() + + /** + * lastEdit + * @returns TODO + */ + protected UndoableEdit lastEdit() { + if (edits.size() == 0) { + return null; + } + return (UndoableEdit) edits.elementAt(edits.size() - 1); + } // lastEdit() + + /** + * redo + * @throws CannotRedoException TODO + */ + public void redo() throws CannotRedoException { + + // Variables + int index; + UndoableEdit current; + + // Loop through all contained UndoableEdits + for (index = 0; index < edits.size(); index++) { + current = (UndoableEdit) edits.elementAt(index); + current.redo(); + } // for: index + + } // redo() + + /** + * String representation + * @returns String representation + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * undo + * @throws CannotUndoException TODO + */ + public void undo() throws CannotUndoException { + + // Variables + int index; + UndoableEdit current; + + // Loop through all contained UndoableEdits + for (index = edits.size() - 1; index >= 0; index--) { + current = (UndoableEdit) edits.elementAt(index); + current.undo(); + } // for: index + + } // undo() + + +} // CompoundEdit diff --git a/libjava/javax/swing/undo/StateEdit.java b/libjava/javax/swing/undo/StateEdit.java new file mode 100644 index 00000000000..a56564b45fd --- /dev/null +++ b/libjava/javax/swing/undo/StateEdit.java @@ -0,0 +1,151 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +// Imports +import java.util.*; + +/** + * StateEdit + * @author Andrew Selkirk + */ +public class StateEdit extends AbstractUndoableEdit { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * RCSID + */ + protected static final String RCSID = ""; // TODO + + /** + * object + */ + protected StateEditable object; + + /** + * preState + */ + protected Hashtable preState; + + /** + * postState + */ + protected Hashtable postState; + + /** + * undoRedoName + */ + protected String undoRedoName; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StateEdit + * @param value0 TODO + */ + public StateEdit(StateEditable value0) { + // TODO + } // StateEdit() + + /** + * Constructor StateEdit + * @param value0 TODO + * @param value1 TODO + */ + public StateEdit(StateEditable value0, String value1) { + // TODO + } // StateEdit() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * init + * @param value0 TODO + * @param value1 TODO + */ + protected void init(StateEditable value0, String value1) { + // TODO + } // init() + + /** + * end + */ + public void end() { + // TODO + } // end() + + /** + * undo + */ + public void undo() { + // TODO + } // undo() + + /** + * redo + */ + public void redo() { + // TODO + } // redo() + + /** + * getPresentationName + * @returns String + */ + public String getPresentationName() { + return null; // TODO + } // getPresentationName() + + /** + * removeRedundantState + */ + protected void removeRedundantState() { + // TODO + } // removeRedundantState() + + +} // StateEdit diff --git a/libjava/javax/swing/undo/StateEditable.java b/libjava/javax/swing/undo/StateEditable.java new file mode 100644 index 00000000000..1d3eaa29ead --- /dev/null +++ b/libjava/javax/swing/undo/StateEditable.java @@ -0,0 +1,62 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +// Imports +import java.util.Hashtable; + +/** + * StateEditable interface + * @author Andrew Selkirk + */ +public interface StateEditable { + + /** + * Restore State + * @param state State + */ + public void restoreState(Hashtable state); + + /** + * Store State + * @param state State + */ + public void storeState(Hashtable state); + + +} // StateEditable diff --git a/libjava/javax/swing/undo/UndoManager.java b/libjava/javax/swing/undo/UndoManager.java new file mode 100644 index 00000000000..f13cd3b3faa --- /dev/null +++ b/libjava/javax/swing/undo/UndoManager.java @@ -0,0 +1,259 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +// Imports +import javax.swing.event.*; + +/** + * UndoManager + * @author Andrew Selkirk + */ +public class UndoManager extends CompoundEdit implements UndoableEditListener { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * indexOfNextAdd + */ + int indexOfNextAdd; + + /** + * limit + */ + int limit; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UndoManager + */ + public UndoManager() { + // TODO + } // UndoManager() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * end + */ + public synchronized void end() { + // TODO + } // end() + + /** + * getLimit + * @returns int + */ + public synchronized int getLimit() { + return 0; // TODO + } // getLimit() + + /** + * discardAllEdits + */ + public synchronized void discardAllEdits() { + // TODO + } // discardAllEdits() + + /** + * trimForLimit + */ + protected void trimForLimit() { + // TODO + } // trimForLimit() + + /** + * trimEdits + * @param value0 TODO + * @param value1 TODO + */ + protected void trimEdits(int value0, int value1) { + // TODO + } // trimEdits() + + /** + * setLimit + * @param value0 TODO + */ + public synchronized void setLimit(int value0) { + // TODO + } // setLimit() + + /** + * editToBeUndone + * @returns UndoableEdit + */ + protected UndoableEdit editToBeUndone() { + return null; // TODO + } // editToBeUndone() + + /** + * editToBeRedone + * @returns UndoableEdit + */ + protected UndoableEdit editToBeRedone() { + return null; // TODO + } // editToBeRedone() + + /** + * undoTo + * @param value0 TODO + * @exception CannotUndoException TODO + */ + protected void undoTo(UndoableEdit value0) throws CannotUndoException { + // TODO + } // undoTo() + + /** + * redoTo + * @param value0 TODO + * @exception CannotRedoException TODO + */ + protected void redoTo(UndoableEdit value0) throws CannotRedoException { + // TODO + } // redoTo() + + /** + * undoOrRedo + * @exception CannotRedoException TODO + * @exception CannotUndoException TODO + */ + public synchronized void undoOrRedo() throws CannotRedoException, CannotUndoException { + // TODO + } // undoOrRedo() + + /** + * canUndoOrRedo + * @returns boolean + */ + public synchronized boolean canUndoOrRedo() { + return false; // TODO + } // canUndoOrRedo() + + /** + * undo + * @exception CannotUndoException TODO + */ + public synchronized void undo() throws CannotUndoException { + // TODO + } // undo() + + /** + * canUndo + * @returns boolean + */ + public synchronized boolean canUndo() { + return false; // TODO + } // canUndo() + + /** + * redo + * @exception CannotRedoException TODO + */ + public synchronized void redo() throws CannotRedoException { + // TODO + } // redo() + + /** + * canRedo + * @returns boolean + */ + public synchronized boolean canRedo() { + return false; // TODO + } // canRedo() + + /** + * addEdit + * @param value0 TODO + * @returns boolean + */ + public synchronized boolean addEdit(UndoableEdit value0) { + return false; // TODO + } // addEdit() + + /** + * getUndoOrRedoPresentationName + * @returns String + */ + public synchronized String getUndoOrRedoPresentationName() { + return null; // TODO + } // getUndoOrRedoPresentationName() + + /** + * getUndoPresentationName + * @returns String + */ + public synchronized String getUndoPresentationName() { + return null; // TODO + } // getUndoPresentationName() + + /** + * getRedoPresentationName + * @returns String + */ + public synchronized String getRedoPresentationName() { + return null; // TODO + } // getRedoPresentationName() + + /** + * undoableEditHappened + * @param value0 TODO + */ + public void undoableEditHappened(UndoableEditEvent value0) { + // TODO + } // undoableEditHappened() + + +} // UndoManager diff --git a/libjava/javax/swing/undo/UndoableEdit.java b/libjava/javax/swing/undo/UndoableEdit.java new file mode 100644 index 00000000000..a5908ef2185 --- /dev/null +++ b/libjava/javax/swing/undo/UndoableEdit.java @@ -0,0 +1,114 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +/** + * UndoableEdit interface + * @author Andrew Selkirk + */ +public interface UndoableEdit { + + /** + * anEdit + * @param anEdit TODO + * @returns TODO + */ + public boolean addEdit(UndoableEdit anEdit); + + /** + * canRedo + * @returns TODO + */ + public boolean canRedo(); + + /** + * canRedo + * @returns TODO + */ + public boolean canUndo(); + + /** + * die + */ + public void die(); + + /** + * getPresentationName + * @returns TODO + */ + public String getPresentationName(); + + /** + * getRedoPresentationName + * @returns TODO + */ + public String getRedoPresentationName(); + + /** + * getUndoPresentationName + * @returns TODO + */ + public String getUndoPresentationName(); + + /** + * isSignificant + * @returns TODO + */ + public boolean isSignificant(); + + /** + * redo + * @throws CannotRedoException TODO + */ + public void redo() throws CannotRedoException; + + /** + * replaceEdit + * @param anEdit TODO + * @returns TODO + */ + public boolean replaceEdit(UndoableEdit anEdit); + + /** + * undo + * @throws CannotUndoException TODO + */ + public void undo() throws CannotUndoException; + + +} // UndoableEdit diff --git a/libjava/javax/swing/undo/UndoableEditSupport.java b/libjava/javax/swing/undo/UndoableEditSupport.java new file mode 100644 index 00000000000..6f873988e5f --- /dev/null +++ b/libjava/javax/swing/undo/UndoableEditSupport.java @@ -0,0 +1,170 @@ +/* AbstractTableModel.java -- + Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.undo; + +// Imports +import java.util.*; +import javax.swing.event.*; + +/** + * UndoableEditSupport + * @author Andrew Selkirk + */ +public class UndoableEditSupport { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * updateLevel + */ + protected int updateLevel; + + /** + * compoundEdit + */ + protected CompoundEdit compoundEdit; + + /** + * listeners + */ + protected Vector listeners = new Vector(); + + /** + * realSource + */ + protected Object realSource; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UndoableEditSupport + */ + public UndoableEditSupport() { + // TODO + } // UndoableEditSupport() + + /** + * Constructor UndoableEditSupport + * @param object TODO + */ + public UndoableEditSupport(Object object) { + realSource = object; + } // UndoableEditSupport() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * toString + * @returns String + */ + public String toString() { + return null; // TODO + } // toString() + + /** + * addUndoableEditListener + * @param value0 TODO + */ + public synchronized void addUndoableEditListener(UndoableEditListener value0) { + // TODO + } // addUndoableEditListener() + + /** + * removeUndoableEditListener + * @param value0 TODO + */ + public synchronized void removeUndoableEditListener(UndoableEditListener value0) { + // TODO + } // removeUndoableEditListener() + + /** + * _postEdit + * @param value0 TODO + */ + protected void _postEdit(UndoableEdit value0) { + // TODO + } // _postEdit() + + /** + * postEdit + * @param value0 TODO + */ + public synchronized void postEdit(UndoableEdit value0) { + // TODO + } // postEdit() + + /** + * getUpdateLevel + * @returns int + */ + public int getUpdateLevel() { + return 0; // TODO + } // getUpdateLevel() + + /** + * beginUpdate + */ + public synchronized void beginUpdate() { + // TODO + } // beginUpdate() + + /** + * createCompoundEdit + * @returns CompoundEdit + */ + protected CompoundEdit createCompoundEdit() { + return null; // TODO + } // createCompoundEdit() + + /** + * endUpdate + */ + public synchronized void endUpdate() { + // TODO + } // endUpdate() + + +} // UndoableEditSupport |