6321N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This is the object which manages the header of the <code>JTable</code>. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @author Alan Chung 0N/A * @author Philip Milne 0N/A * @see javax.swing.JTable 0N/A * @see #getUIClassID 0N/A// Instance Variables 0N/A * The table for which this object is the header; 0N/A * the default is <code>null</code>. 0N/A * The <code>TableColumnModel</code> of the table header. 0N/A * If true, reordering of columns are allowed by the user; 0N/A * the default is true. 0N/A * If true, resizing of columns are allowed by the user; 0N/A * the default is true. 0N/A * Obsolete as of Java 2 platform v1.3. Real time repaints, in response 0N/A * to column dragging or resizing, are now unconditional. 0N/A * If this flag is true, then the header will repaint the table as 0N/A * a column is dragged or resized; the default is true. 0N/A /** The index of the column being resized. <code>null</code> if not resizing. */ 0N/A /** The index of the column being dragged. <code>null</code> if not dragging. */ 0N/A /** The distance from its original position the column has been dragged. */ 0N/A * The default renderer to be used when a <code>TableColumn</code> 0N/A * does not define a <code>headerRenderer</code>. 0N/A * Constructs a <code>JTableHeader</code> with a default 0N/A * <code>TableColumnModel</code>. 0N/A * @see #createDefaultColumnModel 0N/A * Constructs a <code>JTableHeader</code> which is initialized with 0N/A * <code>cm</code> as the column model. If <code>cm</code> is 0N/A * <code>null</code> this method will initialize the table header 0N/A * with a default <code>TableColumnModel</code>. 0N/A * @param cm the column model for the table 0N/A * @see #createDefaultColumnModel 0N/A //setFocusable(false); // for strict win/mac compatibility mode, 0N/A // this method should be invoked 0N/A // Initialize local ivars 0N/A// Local behavior attributes 0N/A * Sets the table associated with this header. 0N/A * @param table the new table 0N/A * description: The table associated with this header. 0N/A * Returns the table associated with this header. 0N/A * @return the <code>table</code> property 0N/A * Sets whether the user can drag column headers to reorder columns. 0N/A * @param reorderingAllowed true if the table view should allow 0N/A * reordering; otherwise false 0N/A * @see #getReorderingAllowed 0N/A * description: Whether the user can drag column headers to reorder columns. 0N/A * Returns true if the user is allowed to rearrange columns by 0N/A * dragging their headers, false otherwise. The default is true. You can 0N/A * rearrange columns programmatically regardless of this setting. 0N/A * @return the <code>reorderingAllowed</code> property 0N/A * @see #setReorderingAllowed 0N/A * Sets whether the user can resize columns by dragging between headers. 0N/A * @param resizingAllowed true if table view should allow 0N/A * @see #getResizingAllowed 0N/A * description: Whether the user can resize columns by dragging between headers. 0N/A * Returns true if the user is allowed to resize columns by dragging 0N/A * between their headers, false otherwise. The default is true. You can 0N/A * resize columns programmatically regardless of this setting. 0N/A * @return the <code>resizingAllowed</code> property 0N/A * @see #setResizingAllowed 0N/A * Returns the the dragged column, if and only if, a drag is in 0N/A * process, otherwise returns <code>null</code>. 0N/A * @return the dragged column, if a drag is in 0N/A * process, otherwise returns <code>null</code> 0N/A * @see #getDraggedDistance 0N/A * Returns the column's horizontal distance from its original 0N/A * position, if and only if, a drag is in process. Otherwise, the 0N/A * the return value is meaningless. 0N/A * @return the column's horizontal distance from its original 0N/A * position, if a drag is in process, otherwise the return 0N/A * value is meaningless 0N/A * @see #getDraggedColumn 0N/A * Returns the resizing column. If no column is being 0N/A * resized this method returns <code>null</code>. 0N/A * @return the resizing column, if a resize is in process, otherwise 0N/A * returns <code>null</code> 0N/A * Obsolete as of Java 2 platform v1.3. Real time repaints, in response to 0N/A * column dragging or resizing, are now unconditional. 0N/A * Sets whether the body of the table updates in real time when 0N/A * a column is resized or dragged. 0N/A * @param flag true if tableView should update 0N/A * the body of the table in real time 0N/A * @see #getUpdateTableInRealTime 0N/A * Obsolete as of Java 2 platform v1.3. Real time repaints, in response to 0N/A * column dragging or resizing, are now unconditional. 0N/A * Returns true if the body of the table view updates in real 0N/A * time when a column is resized or dragged. User can set this flag to 0N/A * false to speed up the table's response to user resize or drag actions. 0N/A * The default is true. 0N/A * @return true if the table updates in real time 0N/A * @see #setUpdateTableInRealTime 0N/A * Sets the default renderer to be used when no <code>headerRenderer</code> 0N/A * is defined by a <code>TableColumn</code>. 0N/A * @param defaultRenderer the default renderer 0N/A * Returns the default renderer used when no <code>headerRenderer</code> 0N/A * is defined by a <code>TableColumn</code>. 0N/A * @return the default renderer 0N/A * Returns the index of the column that <code>point</code> lies in, or -1 if it 0N/A * lies out of bounds. 0N/A * @return the index of the column that <code>point</code> lies in, or -1 if it 0N/A * lies out of bounds 0N/A * Returns the rectangle containing the header tile at <code>column</code>. 0N/A * When the <code>column</code> parameter is out of bounds this method uses the 0N/A * same conventions as the <code>JTable</code> method <code>getCellRect</code>. 0N/A * @return the rectangle containing the header tile at <code>column</code> 0N/A * @see JTable#getCellRect 0N/A * Allows the renderer's tips to be used if there is text set. 0N/A * @param event the location of the event identifies the proper 0N/A * renderer and, therefore, the proper tip 0N/A * @return the tool tip for this component 0N/A // Locate the renderer under the event location 0N/A // Now have to see if the component is a JComponent before 0N/A // Convert the event to the renderer's coordinate system // No tip from the renderer get our own tip // Managing TableHeaderUI * Returns the look and feel (L&F) object that renders this component. * @return the <code>TableHeaderUI</code> object that renders this component * Sets the look and feel (L&F) object that renders this component. * @param ui the <code>TableHeaderUI</code> L&F object * Notification from the <code>UIManager</code> that the look and feel * Replaces the current UI object with the latest version from the * <code>UIManager</code>. * @see JComponent#updateUI * Returns the suffix used to construct the name of the look and feel * (L&F) class used to render this component. * @return the string "TableHeaderUI" * @return "TableHeaderUI" * @see JComponent#getUIClassID * Sets the column model for this table to <code>newModel</code> and registers * for listener notifications from the new column model. * @param columnModel the new data source for this table * @exception IllegalArgumentException * if <code>newModel</code> is <code>null</code> * description: The object governing the way columns appear in the view. * Returns the <code>TableColumnModel</code> that contains all column information * @return the <code>columnModel</code> property // Implementing TableColumnModelListener interface * Invoked when a column is added to the table column model. * Application code will not use these methods explicitly, they * are used internally by <code>JTable</code>. * @param e the event received * @see TableColumnModelListener * Invoked when a column is removed from the table column model. * Application code will not use these methods explicitly, they * are used internally by <code>JTable</code>. * @param e the event received * @see TableColumnModelListener * Invoked when a column is repositioned. * Application code will not use these methods explicitly, they * are used internally by <code>JTable</code>. * @param e the event received * @see TableColumnModelListener * Invoked when a column is moved due to a margin change. * Application code will not use these methods explicitly, they * are used internally by <code>JTable</code>. * @param e the event received * @see TableColumnModelListener // --Redrawing the header is slow in cell selection mode. // --Since header selection is ugly and it is always clear from the // --view which columns are selected, don't redraw the header. * Invoked when the selection model of the <code>TableColumnModel</code> * is changed. This method currently has no effect (the header is not * Application code will not use these methods explicitly, they * are used internally by <code>JTable</code>. * @param e the event received * @see TableColumnModelListener * Returns the default column model object which is * a <code>DefaultTableColumnModel</code>. A subclass can override this * method to return a different column model object * @return the default column model object * Returns a default renderer to be used when no header renderer * is defined by a <code>TableColumn</code>. * @return the default table column renderer * Initializes the local variables and properties with default values. * Used by the constructor methods. // I'm registered to do tool tips so we can draw tips for the * Sizes the header and marks it as needing display. Equivalent * to <code>revalidate</code> followed by <code>repaint</code>. * Sets the header's <code>draggedColumn</code> to <code>aColumn</code>. * Application code will not use this method explicitly, it is used * internally by the column dragging mechanism. * @param aColumn the column being dragged, or <code>null</code> if * no column is being dragged * Sets the header's <code>draggedDistance</code> to <code>distance</code>. * @param distance the distance dragged * Sets the header's <code>resizingColumn</code> to <code>aColumn</code>. * Application code will not use this method explicitly, it * is used internally by the column sizing mechanism. * @param aColumn the column being resized, or <code>null</code> if * no column is being resized * See <code>readObject</code> and <code>writeObject</code> in * <code>JComponent</code> for more * information about serialization in Swing. * Returns a string representation of this <code>JTableHeader</code>. This method * is intended to be used only for debugging purposes, and the * content and format of the returned string may vary between * implementations. The returned string may be empty but may not * Overriding <code>paramString</code> to provide information about the * specific new aspects of the JFC components. * @return a string representation of this <code>JTableHeader</code> * Gets the AccessibleContext associated with this JTableHeader. * For JTableHeaders, the AccessibleContext takes the form of an * AccessibleJTableHeader. * A new AccessibleJTableHeader instance is created if necessary. * @return an AccessibleJTableHeader that serves as the * AccessibleContext of this JTableHeader // *** should also implement AccessibleSelection? * This class implements accessibility support for the * <code>JTableHeader</code> class. It provides an implementation of the * Java Accessibility API appropriate to table header user-interface * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans<sup><font size="-2">TM</font></sup> * has been added to the <code>java.beans</code> package. * Get the role of this object. * @return an instance of AccessibleRole describing the role of the * Returns the Accessible child, if one exists, contained at the local * @param p The point defining the top-left corner of the Accessible, * given in the coordinate space of the object's parent. * @return the Accessible, if it exists, at the specified location; // Locate the renderer under the Point * Returns the number of accessible children in the object. If all * of the children of this object implement Accessible, than this * method should return the number of children of this object. * @return the number of accessible children in the object. * Return the nth Accessible child of the object. * @param i zero-based index of child * @return the nth Accessible child of the object * This class provides an implementation of the Java Accessibility * API appropropriate for JTableHeader entries. * Constructs an AccessiblJTableHeaaderEntry * Get the AccessibleContext associated with this object. * In the implementation of the Java Accessibility API * for this class, returns this object, which serves as * its own AccessibleContext. // Fixes 4772355 - ArrayOutOfBoundsException in // Fixes 4772355 - ArrayOutOfBoundsException in // AccessibleContext methods // return the cell renderer's AccessibleName // fall back to the client property // *** should check toolTip text for desc. (needs MouseEvent) * Get the AccessibleComponent associated with this object. In the * implementation of the Java Accessibility API for this class, * return this object, which is responsible for implementing the * AccessibleComponent interface on behalf of itself. return this;
// to override getBounds() // AccessibleComponent methods // if ((parent != null) && (parent.contains(p))) { // ensureIndexIsVisible(indexInParent); // AccessibleContext ac = getCurrentAccessibleContext(); // if (ac instanceof AccessibleComponent) { // return ((AccessibleComponent) ac).getBounds(); // Component c = getCurrentComponent(); // Rectangle r = table.getCellRect(-1, column, false); // AccessibleContext ac = getCurrentAccessibleContext(); // if (ac instanceof AccessibleComponent) { // Rectangle r = ((AccessibleComponent) ac).getBounds(); // Component c = getCurrentComponent(); // Rectangle r = c.getBounds(); // return getBounds().getSize(); }
// inner class AccessibleJTableHeaderElement }
// inner class AccessibleJTableHeader}
// End of Class JTableHeader