diff options
Diffstat (limited to 'libjava/javax/swing/tree')
-rw-r--r-- | libjava/javax/swing/tree/AbstractLayoutCache.java | 303 | ||||
-rw-r--r-- | libjava/javax/swing/tree/DefaultTreeCellEditor.java | 888 | ||||
-rw-r--r-- | libjava/javax/swing/tree/DefaultTreeCellRenderer.java | 160 | ||||
-rw-r--r-- | libjava/javax/swing/tree/DefaultTreeModel.java | 720 | ||||
-rw-r--r-- | libjava/javax/swing/tree/DefaultTreeSelectionModel.java | 865 | ||||
-rw-r--r-- | libjava/javax/swing/tree/FixedHeightLayoutCache.java | 3 | ||||
-rw-r--r-- | libjava/javax/swing/tree/TreeCellEditor.java | 8 | ||||
-rw-r--r-- | libjava/javax/swing/tree/TreeCellRenderer.java | 5 | ||||
-rw-r--r-- | libjava/javax/swing/tree/TreeSelectionModel.java | 3 | ||||
-rw-r--r-- | libjava/javax/swing/tree/VariableHeightLayoutCache.java | 3 |
10 files changed, 1593 insertions, 1365 deletions
diff --git a/libjava/javax/swing/tree/AbstractLayoutCache.java b/libjava/javax/swing/tree/AbstractLayoutCache.java index 4362684fda3..6fb75f77f69 100644 --- a/libjava/javax/swing/tree/AbstractLayoutCache.java +++ b/libjava/javax/swing/tree/AbstractLayoutCache.java @@ -1,5 +1,5 @@ /* AbstractLayoutCache.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,58 +40,43 @@ package javax.swing.tree; import java.awt.Rectangle; import java.util.Enumeration; + import javax.swing.event.TreeModelEvent; /** - * AbstractLayoutCache + * class AbstractLayoutCache + * * @author Andrew Selkirk */ public abstract class AbstractLayoutCache implements RowMapper { - - //------------------------------------------------------------- - // Classes ---------------------------------------------------- - //------------------------------------------------------------- - /** - * NodeDimensions + * class NodeDimensions */ - public abstract static class NodeDimensions { - - //------------------------------------------------------------- - // Initialization --------------------------------------------- - //------------------------------------------------------------- - + public abstract static class NodeDimensions + { /** - * Constructor NodeDimensions + * Creates <code>NodeDimensions</code> object. */ - public NodeDimensions() { - // TODO - } // NodeDimensions() - - - //------------------------------------------------------------- - // Methods ---------------------------------------------------- - //------------------------------------------------------------- + public NodeDimensions() + { + // Do nothing here. + } /** * getNodeDimensions + * * @param value0 TODO * @param value1 TODO * @param value2 TODO * @param value3 TODO * @param value4 TODO - * @returns Rectangle + * @return Rectangle */ - public abstract Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4); - - - } // NodeDimensions - - - //------------------------------------------------------------- - // Variables -------------------------------------------------- - //------------------------------------------------------------- + public abstract Rectangle getNodeDimensions(Object value0, int value1, + int value2, boolean value3, + Rectangle value4); + } /** * nodeDimensions @@ -118,201 +103,241 @@ public abstract class AbstractLayoutCache implements RowMapper */ protected int rowHeight; - - //------------------------------------------------------------- - // Initialization --------------------------------------------- - //------------------------------------------------------------- - /** * Constructor AbstractLayoutCache */ - public AbstractLayoutCache() { - // TODO - } // AbstractLayoutCache() - - - //------------------------------------------------------------- - // Methods ---------------------------------------------------- - //------------------------------------------------------------- + public AbstractLayoutCache() + { + // Do nothing here. + } /** * setNodeDimensions - * @param value0 TODO + * + * @param dimensions TODO */ - public void setNodeDimensions(NodeDimensions value0) { - // TODO - } // setNodeDimensions() + public void setNodeDimensions(NodeDimensions dimensions) + { + nodeDimensions = dimensions; + } /** * getNodeDimensions - * @returns NodeDimensions + * + * @return NodeDimensions */ - public NodeDimensions getNodeDimensions() { - return null; // TODO - } // getNodeDimensions() + public NodeDimensions getNodeDimensions() + { + return nodeDimensions; + } /** * getNodeDimensions + * * @param value0 TODO * @param value1 TODO * @param value2 TODO * @param value3 TODO * @param value4 TODO - * @returns Rectangle + * + * @return Rectangle */ - protected Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4) { + protected Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4) + { return null; // TODO - } // getNodeDimensions() + } /** - * setModel - * @param value0 TODO + * Sets the model that provides the tree data. + * + * @param the model */ - public void setModel(TreeModel value0) { - // TODO - } // setModel() + public void setModel(TreeModel model) + { + treeModel = model; + } /** - * getModel - * @returns TreeModel + * Returns the model that provides the tree data. + * + * @return the model */ - public TreeModel getModel() { - return null; // TODO - } // getModel() + public TreeModel getModel() + { + return treeModel; + } /** * setRootVisible - * @param value0 TODO + * + * @param visible <code>true</code> if root should be visible, + * <code>false</code> otherwise */ - public void setRootVisible(boolean value0) { - // TODO - } // setRootVisible() + public void setRootVisible(boolean visible) + { + rootVisible = visible; + } /** * isRootVisible - * @returns boolean + * + * @return <code>true</code> if root is visible, + * <code>false</code> otherwise */ - public boolean isRootVisible() { - return false; // TODO - } // isRootVisible() + public boolean isRootVisible() + { + return rootVisible; + } /** * setRowHeight - * @param value0 TODO + * + * @param height the row height */ - public void setRowHeight(int value0) { - // TODO - } // setRowHeight() + public void setRowHeight(int height) + { + rowHeight = height; + } /** * getRowHeight - * @returns int + * + * @return the row height */ - public int getRowHeight() { - return 0; // TODO - } // getRowHeight() + public int getRowHeight() + { + return rowHeight; + } /** * setSelectionModel - * @param value0 TODO + * + * @param model the model */ - public void setSelectionModel(TreeSelectionModel value0) { - // TODO - } // setSelectionModel() + public void setSelectionModel(TreeSelectionModel model) + { + treeSelectionModel = model; + } /** * getSelectionModel - * @returns TreeSelectionModel + * + * @return the model */ - public TreeSelectionModel getSelectionModel() { - return null; // TODO - } // getSelectionModel() + public TreeSelectionModel getSelectionModel() + { + return treeSelectionModel; + } /** * getPreferredHeight - * @returns int + * + * @return int */ - public int getPreferredHeight() { + public int getPreferredHeight() + { return 0; // TODO - } // getPreferredHeight() + } /** * getPreferredWidth + * * @param value0 TODO - * @returns int + * + * @return int */ - public int getPreferredWidth(Rectangle value0) { + public int getPreferredWidth(Rectangle value0) + { return 0; // TODO - } // getPreferredWidth() + } /** * isExpanded + * * @param value0 TODO - * @returns boolean + * + * @return boolean */ public abstract boolean isExpanded(TreePath value0); /** * getBounds + * * @param value0 TODO * @param value1 TODO - * @returns Rectangle + * + * @return Rectangle */ public abstract Rectangle getBounds(TreePath value0, Rectangle value1); /** * getPathForRow - * @param value0 TODO - * @returns TreePath + * + * @param row the row + * + * @return the tree path */ - public abstract TreePath getPathForRow(int value0); + public abstract TreePath getPathForRow(int row); /** * getRowForPath - * @param value0 TODO - * @returns int + * + * @param path the tree path + * + * @return the row */ - public abstract int getRowForPath(TreePath value0); + public abstract int getRowForPath(TreePath path); /** * getPathClosestTo + * * @param value0 TODO * @param value1 TODO - * @returns TreePath + * + * @return the tree path */ public abstract TreePath getPathClosestTo(int value0, int value1); /** * getVisiblePathsFrom - * @param value0 TODO - * @returns Enumeration + * + * @param path the tree path + * + * @return Enumeration */ - public abstract Enumeration getVisiblePathsFrom(TreePath value0); + public abstract Enumeration getVisiblePathsFrom(TreePath path); /** * getVisibleChildCount - * @param value0 TODO - * @returns int + * + * @param path the tree path + * + * @return 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 + * + * @param path the tree path + * + * @return boolean */ - public abstract boolean getExpandedState(TreePath value0); + public abstract boolean getExpandedState(TreePath path); /** * getRowCount - * @returns int + * + * @return the number of rows */ public abstract int getRowCount(); @@ -323,50 +348,58 @@ public abstract class AbstractLayoutCache implements RowMapper /** * invalidatePathBounds - * @param value0 TODO + * + * @param path the tree path */ - public abstract void invalidatePathBounds(TreePath value0); + public abstract void invalidatePathBounds(TreePath path); /** * treeNodesChanged - * @param value0 TODO + * + * @param event the event to send */ - public abstract void treeNodesChanged(TreeModelEvent value0); + public abstract void treeNodesChanged(TreeModelEvent event); /** * treeNodesInserted - * @param value0 TODO + * + * @param event the event to send */ - public abstract void treeNodesInserted(TreeModelEvent value0); + public abstract void treeNodesInserted(TreeModelEvent event); /** * treeNodesRemoved - * @param value0 TODO + * + * @param event the event to send */ - public abstract void treeNodesRemoved(TreeModelEvent value0); + public abstract void treeNodesRemoved(TreeModelEvent event); /** * treeStructureChanged - * @param value0 TODO + * + * @param event the event to send */ - public abstract void treeStructureChanged(TreeModelEvent value0); + public abstract void treeStructureChanged(TreeModelEvent event); /** * getRowsForPaths - * @param value0 TODO - * @returns int[] + * + * @param paths the tree paths + * + * @return an array of rows */ - public int[] getRowsForPaths(TreePath[] value0) { + public int[] getRowsForPaths(TreePath[] paths) + { return null; // TODO - } // getRowsForPaths() + } /** * isFixedRowHeight - * @returns boolean + * + * @return boolean */ - protected boolean isFixedRowHeight() { + protected boolean isFixedRowHeight() + { return false; // TODO - } // isFixedRowHeight() - - -} // AbstractLayoutCache + } +} diff --git a/libjava/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/javax/swing/tree/DefaultTreeCellEditor.java index bebdc6a9e64..af280201bc1 100644 --- a/libjava/javax/swing/tree/DefaultTreeCellEditor.java +++ b/libjava/javax/swing/tree/DefaultTreeCellEditor.java @@ -56,6 +56,7 @@ import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.border.Border; import javax.swing.event.CellEditorListener; +import javax.swing.event.EventListenerList; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; @@ -63,440 +64,453 @@ import javax.swing.event.TreeSelectionListener; * 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 +public class DefaultTreeCellEditor + implements ActionListener, TreeCellEditor, TreeSelectionListener +{ + /** + * EditorContainer + */ + public class EditorContainer extends Container + { + /** + * Creates an <code>EditorContainer</code> object. + */ + public EditorContainer() + { + // Do nothing here. + } + + /** + * This method only exists for API compatibility and is useless as it does + * nothing. It got probably introduced by accident. + */ + public void EditorContainer() + { + // Do nothing here. + } + + /** + * getPreferredSize + * @return Dimension + */ + public Dimension getPreferredSize() + { + return null; // TODO + } + + /** + * paint + * @param value0 TODO + */ + public void paint(Graphics value0) + { + // TODO + } + + /** + * doLayout + */ + public void doLayout() + { + // TODO + } + } + + /** + * DefaultTextField + */ + public class DefaultTextField extends JTextField + { + /** + * border + */ + protected Border border; + + /** + * Creates a <code>DefaultTextField</code> object. + * + * @param border the border to use + */ + public DefaultTextField(Border border) + { + this.border = border; + } + + /** + * getFont + * @return Font + */ + public Font getFont() + { + return null; // TODO + } + + /** + * Returns the border of the text field. + * + * @return the border + */ + public Border getBorder() + { + return border; + } + + /** + * getPreferredSize + * @return Dimension + */ + public Dimension getPreferredSize() + { + return null; // TODO + } + } + + private EventListenerList listenerList = new EventListenerList(); + + /** + * 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; + + /** + * Constructor DefaultTreeCellEditor + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1) + { + // TODO + } + + /** + * Constructor DefaultTreeCellEditor + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1, + TreeCellEditor value2) + { + // TODO + } + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException + { + // TODO + } + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) + throws IOException, ClassNotFoundException + { + // TODO + } + + /** + * setBorderSelectionColor + * @param value0 TODO + */ + public void setBorderSelectionColor(Color value0) + { + // TODO + } + + /** + * getBorderSelectionColor + * @return Color + */ + public Color getBorderSelectionColor() + { + return null; // TODO + } + + /** + * setFont + * @param value0 TODO + */ + public void setFont(Font value0) + { + // TODO + } + + /** + * getFont + * @return Font + */ + public Font getFont() + { + return null; // TODO + } + + /** + * getTreeCellEditorComponent + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + * @param value3 TODO + * @param value4 TODO + * @param value5 TODO + * @return Component + */ + public Component getTreeCellEditorComponent(JTree value0, Object value1, + boolean value2, boolean value3, + boolean value4, int value5) + { + return null; // TODO + } + + /** + * getCellEditorValue + * @return Object + */ + public Object getCellEditorValue() + { + return null; // TODO + } + + /** + * isCellEditable + * @param value0 TODO + * @return boolean + */ + public boolean isCellEditable(EventObject value0) + { + return false; // TODO + } + + /** + * shouldSelectCell + * @param value0 TODO + * @return boolean + */ + public boolean shouldSelectCell(EventObject value0) + { + return false; // TODO + } + + /** + * stopCellEditing + * @return boolean + */ + public boolean stopCellEditing() + { + return false; // TODO + } + + /** + * cancelCellEditing + */ + public void cancelCellEditing() + { + // TODO + } + + /** + * Adds a <code>CellEditorListener</code> object to this editor. + * + * @param listener the listener to add + */ + public void addCellEditorListener(CellEditorListener listener) + { + listenerList.add(CellEditorListener.class, listener); + } + + /** + * Removes a <code>CellEditorListener</code> object. + * + * @param listener the listener to remove + */ + public void removeCellEditorListener(CellEditorListener listener) + { + listenerList.remove(CellEditorListener.class, listener); + } + + /** + * Returns all added <code>CellEditorListener</code> objects to this editor. + * + * @return an array of listeners + * + * @since 1.4 + */ + public CellEditorListener[] getCellEditorListeners() + { + return (CellEditorListener[]) listenerList.getListeners(CellEditorListener.class); + } + + /** + * valueChanged + * @param value0 TODO + */ + public void valueChanged(TreeSelectionEvent value0) + { + // TODO + } + + /** + * actionPerformed + * @param value0 TODO + */ + public void actionPerformed(ActionEvent value0) + { + // TODO + } + + /** + * setTree + * @param value0 TODO + */ + protected void setTree(JTree value0) + { + // TODO + } + + /** + * shouldStartEditingTimer + * @param value0 TODO + * @return boolean + */ + protected boolean shouldStartEditingTimer(EventObject value0) + { + return false; // TODO + } + + /** + * startEditingTimer + */ + protected void startEditingTimer() + { + // TODO + } + + /** + * canEditImmediately + * @param value0 TODO + * @return boolean + */ + protected boolean canEditImmediately(EventObject value0) + { + return false; // TODO + } + + /** + * inHitRegion + * @param value0 TODO + * @param value1 TODO + * @return boolean + */ + protected boolean inHitRegion(int value0, int value1) + { + return false; // TODO + } + + /** + * 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 + } + + /** + * prepareForEditing + */ + protected void prepareForEditing() + { + // TODO + } + + /** + * createContainer + * @return Container + */ + protected Container createContainer() + { + return null; // TODO + } + + /** + * createTreeCellEditor + * @return TreeCellEditor + */ + protected TreeCellEditor createTreeCellEditor() + { + return null; // TODO + } +} diff --git a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java index f0eb454db5c..beae3840b40 100644 --- a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java +++ b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java @@ -1,5 +1,5 @@ /* DefaultTreeCellRenderer.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,9 +44,13 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Rectangle; + import javax.swing.Icon; import javax.swing.JLabel; import javax.swing.JTree; +import javax.swing.UIDefaults; +import javax.swing.UIManager; +import javax.swing.plaf.UIResource; /** * DefaultTreeCellRenderer @@ -124,8 +128,18 @@ public class DefaultTreeCellRenderer * Constructor DefaultTreeCellRenderer */ public DefaultTreeCellRenderer() { - // TODO - } // DefaultTreeCellRenderer() + UIDefaults defaults = UIManager.getLookAndFeelDefaults(); + + setLeafIcon(getDefaultLeafIcon()); + setOpenIcon(getDefaultOpenIcon()); + setClosedIcon(getDefaultClosedIcon()); + + setTextNonSelectionColor(defaults.getColor("Tree.textForeground")); + setTextSelectionColor(defaults.getColor("Tree.selectionForeground")); + setBackgroundNonSelectionColor(defaults.getColor("Tree.textBackground")); + setBackgroundSelectionColor(defaults.getColor("Tree.selectionBackground")); + setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor")); + } //------------------------------------------------------------- @@ -137,168 +151,172 @@ public class DefaultTreeCellRenderer * @returns Icon */ public Icon getDefaultOpenIcon() { - return null; // TODO - } // getDefaultOpenIcon() + return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon"); + } /** * getDefaultClosedIcon * @returns Icon */ public Icon getDefaultClosedIcon() { - return null; // TODO - } // getDefaultClosedIcon() + return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon"); + } /** * getDefaultLeafIcon * @returns Icon */ public Icon getDefaultLeafIcon() { - return null; // TODO - } // getDefaultLeafIcon() + return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon"); + } /** * setOpenIcon * @param value0 TODO */ - public void setOpenIcon(Icon value0) { - // TODO - } // setOpenIcon() + public void setOpenIcon(Icon i) { + openIcon = i; + } /** * getOpenIcon * @returns Icon */ public Icon getOpenIcon() { - return null; // TODO - } // getOpenIcon() + return openIcon; + } /** * setClosedIcon * @param value0 TODO */ - public void setClosedIcon(Icon value0) { - // TODO - } // setClosedIcon() + public void setClosedIcon(Icon i) { + closedIcon = i; + } /** * getClosedIcon * @returns Icon */ public Icon getClosedIcon() { - return null; // TODO - } // getClosedIcon() + return closedIcon; + } /** * setLeafIcon * @param value0 TODO */ - public void setLeafIcon(Icon value0) { - // TODO - } // setLeafIcon() + public void setLeafIcon(Icon i) { + leafIcon = i; + } /** * getLeafIcon * @returns Icon */ public Icon getLeafIcon() { - return null; // TODO - } // getLeafIcon() + return leafIcon; + } /** * setTextSelectionColor * @param value0 TODO */ - public void setTextSelectionColor(Color value0) { - // TODO - } // setTextSelectionColor() + public void setTextSelectionColor(Color c) { + textSelectionColor = c; + } /** * getTextSelectionColor * @returns Color */ public Color getTextSelectionColor() { - return null; // TODO - } // getTextSelectionColor() + return textSelectionColor; + } /** * setTextNonSelectionColor * @param value0 TODO */ - public void setTextNonSelectionColor(Color value0) { - // TODO - } // setTextNonSelectionColor() + public void setTextNonSelectionColor(Color c) { + textNonSelectionColor = c; + } /** * getTextNonSelectionColor * @returns Color */ public Color getTextNonSelectionColor() { - return null; // TODO - } // getTextNonSelectionColor() + return textNonSelectionColor; + } /** * setBackgroundSelectionColor * @param value0 TODO */ - public void setBackgroundSelectionColor(Color value0) { - // TODO - } // setBackgroundSelectionColor() + public void setBackgroundSelectionColor(Color c) { + backgroundSelectionColor = c; + } /** * getBackgroundSelectionColor * @returns Color */ public Color getBackgroundSelectionColor() { - return null; // TODO - } // getBackgroundSelectionColor() + return backgroundSelectionColor; + } /** * setBackgroundNonSelectionColor * @param value0 TODO */ - public void setBackgroundNonSelectionColor(Color value0) { - // TODO - } // setBackgroundNonSelectionColor() + public void setBackgroundNonSelectionColor(Color c) { + backgroundNonSelectionColor = c; + } /** * getBackgroundNonSelectionColor * @returns Color */ public Color getBackgroundNonSelectionColor() { - return null; // TODO - } // getBackgroundNonSelectionColor() + return backgroundNonSelectionColor; + } /** * setBorderSelectionColor * @param value0 TODO */ - public void setBorderSelectionColor(Color value0) { - // TODO - } // setBorderSelectionColor() + public void setBorderSelectionColor(Color c) { + borderSelectionColor = c; + } /** * getBorderSelectionColor * @returns Color */ public Color getBorderSelectionColor() { - return null; // TODO - } // getBorderSelectionColor() + return borderSelectionColor; + } /** * setFont * @param value0 TODO */ - public void setFont(Font value0) { - // TODO - } // setFont() + public void setFont(Font f) { + if (f != null && f instanceof UIResource) + f = null; + super.setFont(f); + } /** * setBackground * @param value0 TODO */ - public void setBackground(Color value0) { - // TODO - } // setBackground() + public void setBackground(Color c) { + if (c != null && c instanceof UIResource) + c = null; + super.setBackground(c); + } /** * getTreeCellRendererComponent @@ -311,17 +329,37 @@ public class DefaultTreeCellRenderer * @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() + public Component getTreeCellRendererComponent(JTree tree, + Object val, + boolean selected, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { + this.selected = selected; + this.hasFocus = hasFocus; + + if (leaf) + setIcon(getLeafIcon()); + else if (expanded) + setIcon(getOpenIcon()); + else + setIcon(getClosedIcon()); + + setText(val.toString()); + setHorizontalAlignment(LEFT); + setVerticalAlignment(TOP); + + return this; + } /** * paint * @param value0 TODO */ - public void paint(Graphics value0) { - // TODO - } // paint() + public void paint(Graphics g) { + super.paint(g); + } /** * getPreferredSize diff --git a/libjava/javax/swing/tree/DefaultTreeModel.java b/libjava/javax/swing/tree/DefaultTreeModel.java index 4f546acca3e..2e34a35223e 100644 --- a/libjava/javax/swing/tree/DefaultTreeModel.java +++ b/libjava/javax/swing/tree/DefaultTreeModel.java @@ -1,5 +1,5 @@ /* DefaultTreeModel.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,335 +43,409 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.EventListener; + import javax.swing.event.EventListenerList; +import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; /** * DefaultTreeModel * @author Andrew Selkirk */ -public class DefaultTreeModel implements Serializable, TreeModel +public class DefaultTreeModel + implements Serializable, TreeModel { static final long serialVersionUID = -2621068368932566998L; - //------------------------------------------------------------- - // 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 + /** + * root + */ + protected TreeNode root = null; + + /** + * listenerList + */ + protected EventListenerList listenerList = new EventListenerList(); + + /** + * asksAllowsChildren + */ + protected boolean asksAllowsChildren; + + /** + * Constructor DefaultTreeModel + * @param value0 TODO + */ + public DefaultTreeModel(TreeNode root) + { + setRoot(root); + } + + /** + * Constructor DefaultTreeModel + * @param value0 TODO + * @param value1 TODO + */ + public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) + { + setRoot(root); + this.asksAllowsChildren = asksAllowsChildren; + } + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException + { + // TODO + } + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) + throws IOException, ClassNotFoundException + { + // TODO + } + + /** + * asksAllowsChildren + * @return boolean + */ + public boolean asksAllowsChildren() + { + return asksAllowsChildren; + } + + /** + * setAsksAllowsChildren + * @param value0 TODO + */ + public void setAsksAllowsChildren(boolean value) + { + asksAllowsChildren = value; // TODO + } + + /** + * setRoot + * @param value0 TODO + */ + public void setRoot(TreeNode root) + { + // Sanity Check + if (root == null) + { + throw new IllegalArgumentException("null root"); + } + // Set new root + this.root = root; + + // TODO + } + + /** + * getRoot + * @return Object + */ + public Object getRoot() + { + return root; + } + + /** + * getIndexOfChild + * @param value0 TODO + * @param value1 TODO + * @return int + */ + public int getIndexOfChild(Object parent, Object child) + { + return 0; // TODO + } + + /** + * getChild + * @param value0 TODO + * @param value1 TODO + * @return Object + */ + public Object getChild(Object node, int idx) + { + if (node instanceof TreeNode) + return ((TreeNode)node).getChildAt(idx); + else + return null; + } + + /** + * getChildCount + * @param value0 TODO + * @return int + */ + public int getChildCount(Object node) + { + if (node instanceof TreeNode) + return ((TreeNode)node).getChildCount(); + else + return 0; + } + + /** + * isLeaf + * @param value0 TODO + * @return boolean + */ + public boolean isLeaf(Object node) + { + if (node instanceof TreeNode) + return ((TreeNode)node).isLeaf(); + else + return true; + } + + /** + * reload + */ + public void reload() + { + // TODO + } + + /** + * reload + * @param value0 TODO + */ + public void reload(TreeNode value0) + { + // TODO + } + + /** + * valueForPathChanged + * @param value0 TODO + * @param value1 TODO + */ + public void valueForPathChanged(TreePath value0, Object value1) + { + // TODO + } + + /** + * insertNodeInto + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1, + int value2) + { + // TODO + } + + /** + * removeNodeFromParent + * @param value0 TODO + */ + public void removeNodeFromParent(MutableTreeNode value0) + { + // TODO + } + + /** + * nodeChanged + * @param value0 TODO + */ + public void nodeChanged(TreeNode value0) + { + // TODO + } + + /** + * nodesWereInserted + * @param value0 TODO + * @param value1 TODO + */ + public void nodesWereInserted(TreeNode value0, int[] value1) + { + // TODO + } + + /** + * nodesWereRemoved + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2) + { + // TODO + } + + /** + * nodesChanged + * @param value0 TODO + * @param value1 TODO + */ + public void nodesChanged(TreeNode value0, int[] value1) + { + // TODO + } + + /** + * nodeStructureChanged + * @param value0 TODO + */ + public void nodeStructureChanged(TreeNode value0) + { + // TODO + } + + /** + * getPathToRoot + * @param value0 TODO + * @return TreeNode[] + */ + public TreeNode[] getPathToRoot(TreeNode value0) + { + return null; // TODO + } + + /** + * getPathToRoot + * @param value0 TODO + * @param value1 TODO + * @return TreeNode[] + */ + protected TreeNode[] getPathToRoot(TreeNode value0, int value1) + { + return null; // TODO + } + + /** + * Registers a listere to the model. + * + * @param listener the listener to add + */ + public void addTreeModelListener(TreeModelListener listener) + { + listenerList.add(TreeModelListener.class, listener); + } + + /** + * Removes a listener from the model. + * + * @param listener the listener to remove + */ + public void removeTreeModelListener(TreeModelListener listener) + { + listenerList.remove(TreeModelListener.class, listener); + } + + /** + * Returns all registered <code>TreeModelListener</code> listeners. + * + * @return an array of listeners. + * + * @since 1.4 + */ + public TreeModelListener[] getTreeModelListeners() + { + return (TreeModelListener[]) listenerList.getListeners(TreeModelListener.class); + } + + /** + * fireTreeNodesChanged + * + * @param source the node being changed + * @param path the path to the root node + * @param childIndices the indices of the changed elements + * @param children the changed elements + */ + protected void fireTreeNodesChanged(Object source, Object[] path, + int[] childIndices, Object[] children) + { + TreeModelEvent event = + new TreeModelEvent(source, path, childIndices, children); + TreeModelListener[] listeners = getTreeModelListeners(); + + for (int i = listeners.length - 1; i >= 0; --i) + listeners[i].treeNodesChanged(event); + } + + /** + * fireTreeNodesInserted + * + * @param source the node where new nodes got inserted + * @param path the path to the root node + * @param childIndices the indices of the new elements + * @param children the new elements + */ + protected void fireTreeNodesInserted(Object source, Object[] path, + int[] childIndices, Object[] children) + { + TreeModelEvent event = + new TreeModelEvent(source, path, childIndices, children); + TreeModelListener[] listeners = getTreeModelListeners(); + + for (int i = listeners.length - 1; i >= 0; --i) + listeners[i].treeNodesInserted(event); + } + + /** + * fireTreeNodesRemoved + * + * @param source the node where nodes got removed- + * @param path the path to the root node + * @param childIndices the indices of the removed elements + * @param children the removed elements + */ + protected void fireTreeNodesRemoved(Object source, Object[] path, + int[] childIndices, Object[] children) + { + TreeModelEvent event = + new TreeModelEvent(source, path, childIndices, children); + TreeModelListener[] listeners = getTreeModelListeners(); + + for (int i = listeners.length - 1; i >= 0; --i) + listeners[i].treeNodesRemoved(event); + } + + /** + * fireTreeStructureChanged + * + * @param source the node where the model has changed + * @param path the path to the root node + * @param childIndices the indices of the affected elements + * @param children the affected elements + */ + protected void fireTreeStructureChanged(Object source, Object[] path, + int[] childIndices, Object[] children) + { + TreeModelEvent event = + new TreeModelEvent(source, path, childIndices, children); + TreeModelListener[] listeners = getTreeModelListeners(); + + for (int i = listeners.length - 1; i >= 0; --i) + listeners[i].treeStructureChanged(event); + } + + /** + * Returns the registered listeners of a given type. + * + * @param listenerType the listener type to return + * + * @return an array of listeners + * + * @since 1.3 + */ + public EventListener[] getListeners(Class listenerType) + { + return listenerList.getListeners(listenerType); + } +} diff --git a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java index 79f642afc28..4fe69f4fb14 100644 --- a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java +++ b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java @@ -1,5 +1,5 @@ /* DefaultTreeSelectionModel.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,9 +45,10 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.EventListener; import java.util.Vector; + import javax.swing.DefaultListSelectionModel; -import javax.swing.event.SwingPropertyChangeSupport; import javax.swing.event.EventListenerList; +import javax.swing.event.SwingPropertyChangeSupport; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; @@ -60,402 +61,464 @@ public class DefaultTreeSelectionModel { static final long serialVersionUID = 3288129636638950196L; - //------------------------------------------------------------- - // 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 + /** + * 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; + + /** + * Constructor DefaultTreeSelectionModel + */ + public DefaultTreeSelectionModel() + { + // TODO + } + + /** + * clone + * @exception CloneNotSupportedException TODO + * @return Object + */ + public Object clone() throws CloneNotSupportedException + { + return null; // TODO + } + + /** + * toString + * @return String + */ + public String toString() + { + return null; // TODO + } + + /** + * writeObject + * @param value0 TODO + * @exception IOException TODO + */ + private void writeObject(ObjectOutputStream value0) throws IOException + { + // TODO + } + + /** + * readObject + * @param value0 TODO + * @exception IOException TODO + * @exception ClassNotFoundException TODO + */ + private void readObject(ObjectInputStream value0) + throws IOException, ClassNotFoundException + { + // TODO + } + + /** + * setRowMapper + * @param value0 TODO + */ + public void setRowMapper(RowMapper value0) + { + // TODO + } + + /** + * getRowMapper + * @return RowMapper + */ + public RowMapper getRowMapper() + { + return null; // TODO + } + + /** + * setSelectionMode + * @param value0 TODO + */ + public void setSelectionMode(int value0) + { + // TODO + } + + /** + * getSelectionMode + * @return int + */ + public int getSelectionMode() + { + return 0; // TODO + } + + /** + * setSelectionPath + * @param value0 TODO + */ + public void setSelectionPath(TreePath value0) + { + // TODO + } + + /** + * setSelectionPaths + * @param value0 TODO + */ + public void setSelectionPaths(TreePath[] value0) + { + // TODO + } + + /** + * addSelectionPath + * @param value0 TODO + */ + public void addSelectionPath(TreePath value0) + { + // TODO + } + + /** + * addSelectionPaths + * @param value0 TODO + */ + public void addSelectionPaths(TreePath[] value0) + { + // TODO + } + + /** + * removeSelectionPath + * @param value0 TODO + */ + public void removeSelectionPath(TreePath value0) + { + // TODO + } + + /** + * removeSelectionPaths + * @param value0 TODO + */ + public void removeSelectionPaths(TreePath[] value0) + { + // TODO + } + + /** + * getSelectionPath + * @return TreePath + */ + public TreePath getSelectionPath() + { + return null; // TODO + } + + /** + * getSelectionPaths + * @return TreePath[] + */ + public TreePath[] getSelectionPaths() + { + return null; // TODO + } + + /** + * getSelectionCount + * @return int + */ + public int getSelectionCount() + { + return 0; // TODO + } + + /** + * isPathSelected + * @param value0 TODO + * @return boolean + */ + public boolean isPathSelected(TreePath value0) + { + return false; // TODO + } + + /** + * isSelectionEmpty + * @return boolean + */ + public boolean isSelectionEmpty() + { + return false; // TODO + } + + /** + * clearSelection + */ + public void clearSelection() + { + // TODO + } + + /** + * Adds a <code>TreeSelectionListener</code> object to this model. + * + * @param listener the listener to add + */ + public void addTreeSelectionListener(TreeSelectionListener listener) + { + listenerList.add(TreeSelectionListener.class, listener); + } + + /** + * Removes a <code>TreeSelectionListener</code> object from this model. + * + * @param listener the listener to remove + */ + public void removeTreeSelectionListener(TreeSelectionListener listener) + { + listenerList.remove(TreeSelectionListener.class, listener); + } + + /** + * Returns all <code>TreeSelectionListener</code> added to this model. + * + * @return an array of listeners + * + * @since 1.4 + */ + public TreeSelectionListener[] getTreeSelectionListeners() + { + return (TreeSelectionListener[]) listenerList.getListeners(TreeSelectionListener.class); + } + + /** + * fireValueChanged + * + * @param event the event to fire. + */ + protected void fireValueChanged(TreeSelectionEvent event) + { + TreeSelectionListener[] listeners = getTreeSelectionListeners(); + + for (int i = listeners.length - 1; i >= 0; --i) + listeners[i].valueChanged(event); + } + + /** + * Returns all added listeners of a special type. + * + * @param listenerType the listener type + * + * @return an array of listeners + * + * @since 1.3 + */ + public EventListener[] getListeners(Class listenerType) + { + return listenerList.getListeners(listenerType); + } + + /** + * getSelectionRows + * @return int[] + */ + public int[] getSelectionRows() + { + return null; // TODO + } + + /** + * getMinSelectionRow + * @return int + */ + public int getMinSelectionRow() + { + return 0; // TODO + } + + /** + * getMaxSelectionRow + * @return int + */ + public int getMaxSelectionRow() + { + return 0; // TODO + } + + /** + * isRowSelected + * @param value0 TODO + * @return boolean + */ + public boolean isRowSelected(int value0) + { + return false; // TODO + } + + /** + * resetRowSelection + */ + public void resetRowSelection() + { + // TODO + } + + /** + * getLeadSelectionRow + * @return int + */ + public int getLeadSelectionRow() + { + return 0; // TODO + } + + /** + * getLeadSelectionPath + * @return TreePath + */ + public TreePath getLeadSelectionPath() + { + return null; // TODO + } + + /** + * Adds a <code>PropertyChangeListener</code> object to this model. + * + * @param listener the listener to add. + */ + public void addPropertyChangeListener(PropertyChangeListener listener) + { + changeSupport.addPropertyChangeListener(listener); + } + + /** + * Removes a <code>PropertyChangeListener</code> object from this model. + * + * @param listener the listener to remove. + */ + public void removePropertyChangeListener(PropertyChangeListener listener) + { + changeSupport.removePropertyChangeListener(listener); + } + + /** + * Returns all added <code>PropertyChangeListener</code> objects. + * + * @return an array of listeners. + * + * @since 1.4 + */ + public PropertyChangeListener[] getPropertyChangeListeners() + { + return changeSupport.getPropertyChangeListeners(); + } + + /** + * insureRowContinuity + */ + protected void insureRowContinuity() + { + // TODO + } + + /** + * arePathsContiguous + * @param value0 TODO + * @return boolean + */ + protected boolean arePathsContiguous(TreePath[] value0) + { + return false; // TODO + } + + /** + * canPathsBeAdded + * @param value0 TODO + * @return boolean + */ + protected boolean canPathsBeAdded(TreePath[] value0) + { + return false; // TODO + } + + /** + * canPathsBeRemoved + * @param value0 TODO + * @return boolean + */ + protected boolean canPathsBeRemoved(TreePath[] value0) + { + return false; // TODO + } + + /** + * notifyPathChange + * @param value0 TODO + * @param value1 TODO + */ + protected void notifyPathChange(Vector value0, TreePath value1) + { + // TODO + } + + /** + * updateLeadIndex + */ + protected void updateLeadIndex() + { + // TODO + } + + /** + * insureUniqueness + */ + protected void insureUniqueness() + { + // TODO + } +} diff --git a/libjava/javax/swing/tree/FixedHeightLayoutCache.java b/libjava/javax/swing/tree/FixedHeightLayoutCache.java index dae34229c3a..5cb6d3a2a9f 100644 --- a/libjava/javax/swing/tree/FixedHeightLayoutCache.java +++ b/libjava/javax/swing/tree/FixedHeightLayoutCache.java @@ -1,5 +1,5 @@ /* FixedHeightLayoutCache.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,6 +40,7 @@ package javax.swing.tree; import java.awt.Rectangle; import java.util.Enumeration; + import javax.swing.event.TreeModelEvent; /** diff --git a/libjava/javax/swing/tree/TreeCellEditor.java b/libjava/javax/swing/tree/TreeCellEditor.java index bdc0b5d6468..d9de676dd8d 100644 --- a/libjava/javax/swing/tree/TreeCellEditor.java +++ b/libjava/javax/swing/tree/TreeCellEditor.java @@ -1,5 +1,5 @@ /* TreeCellEditor.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,14 +39,16 @@ exception statement from your version. */ package javax.swing.tree; import java.awt.Component; + +import javax.swing.CellEditor; import javax.swing.JTree; /** * TreeCellEditor public interface * @author Andrew Selkirk */ -public interface TreeCellEditor { - +public interface TreeCellEditor extends CellEditor +{ /** * getTreeCellEditorComponent * @param tree TODO diff --git a/libjava/javax/swing/tree/TreeCellRenderer.java b/libjava/javax/swing/tree/TreeCellRenderer.java index 3be8870ece5..ebd173efa3d 100644 --- a/libjava/javax/swing/tree/TreeCellRenderer.java +++ b/libjava/javax/swing/tree/TreeCellRenderer.java @@ -1,5 +1,5 @@ /* TreeCellRenderer.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,10 +35,11 @@ this exception to your version of the library, but you 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; /** diff --git a/libjava/javax/swing/tree/TreeSelectionModel.java b/libjava/javax/swing/tree/TreeSelectionModel.java index 85dfe29a9cc..c72617bff81 100644 --- a/libjava/javax/swing/tree/TreeSelectionModel.java +++ b/libjava/javax/swing/tree/TreeSelectionModel.java @@ -1,5 +1,5 @@ /* TreeSelectionModel.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,6 +39,7 @@ exception statement from your version. */ package javax.swing.tree; import java.beans.PropertyChangeListener; + import javax.swing.event.TreeSelectionListener; /** diff --git a/libjava/javax/swing/tree/VariableHeightLayoutCache.java b/libjava/javax/swing/tree/VariableHeightLayoutCache.java index 445faa9c230..14e6ea9025e 100644 --- a/libjava/javax/swing/tree/VariableHeightLayoutCache.java +++ b/libjava/javax/swing/tree/VariableHeightLayoutCache.java @@ -1,5 +1,5 @@ /* VariableHeightLayoutCache.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,6 +40,7 @@ package javax.swing.tree; import java.awt.Rectangle; import java.util.Enumeration; + import javax.swing.event.TreeModelEvent; /** |