--- old/jdk/src/share/classes/javax/swing/JTree.java 2014-08-11 11:51:21.010286600 +0400 +++ new/jdk/src/share/classes/javax/swing/JTree.java 2014-08-11 11:51:20.583262200 +0400 @@ -22,12 +22,15 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.awt.*; import java.awt.event.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.ConstructorProperties; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.*; import java.util.*; import javax.swing.event.*; @@ -35,11 +38,11 @@ import javax.swing.tree.*; import javax.swing.text.Position; import javax.accessibility.*; + import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; - /** * * A control that displays a set of hierarchical data as an outline. @@ -134,15 +137,14 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. *

- * @beaninfo - * attribute: isContainer false - * description: A component that displays a set of hierarchical data as an outline. * * @author Rob Davis * @author Ray Ryan * @author Scott Violet * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component that displays a set of hierarchical data as an outline.") +@SwingContainer(false) @SuppressWarnings("serial") public class JTree extends JComponent implements Scrollable, Accessible { @@ -687,12 +689,9 @@ * * @param ui the TreeUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(TreeUI ui) { if (this.ui != ui) { settingUI = true; @@ -728,6 +727,7 @@ * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -750,11 +750,9 @@ * This is a bound property. * * @param x the TreeCellRenderer that is to render each cell - * @beaninfo - * bound: true - * description: The TreeCellRenderer that will be used to draw - * each cell. */ + @BeanProperty(description + = "The TreeCellRenderer that will be used to draw each cell.") public void setCellRenderer(TreeCellRenderer x) { TreeCellRenderer oldValue = cellRenderer; @@ -771,10 +769,9 @@ * This is a bound property. * * @param flag a boolean value, true if the tree is editable - * @beaninfo - * bound: true - * description: Whether the tree is editable. */ + @BeanProperty(description + = "Whether the tree is editable.") public void setEditable(boolean flag) { boolean oldValue = this.editable; @@ -806,11 +803,9 @@ * This is a bound property. * * @param cellEditor the TreeCellEditor to use - * @beaninfo - * bound: true - * description: The cell editor. A null value implies the tree - * cannot be edited. */ + @BeanProperty(description + = "The cell editor. A null value implies the tree cannot be edited.") public void setCellEditor(TreeCellEditor cellEditor) { TreeCellEditor oldEditor = this.cellEditor; @@ -844,10 +839,9 @@ * This is a bound property. * * @param newModel the TreeModel that is to provide the data - * @beaninfo - * bound: true - * description: The TreeModel that will provide the data. */ + @BeanProperty(description + = "The TreeModel that will provide the data.") public void setModel(TreeModel newModel) { clearSelection(); @@ -901,11 +895,9 @@ * * @param rootVisible true if the root node of the tree is to be displayed * @see #rootVisible - * @beaninfo - * bound: true - * description: Whether or not the root node - * from the TreeModel is visible. */ + @BeanProperty(description + = "Whether or not the root node from the TreeModel is visible.") public void setRootVisible(boolean rootVisible) { boolean oldValue = this.rootVisible; @@ -930,11 +922,9 @@ * otherwise, false * @see #showsRootHandles * @see #getShowsRootHandles - * @beaninfo - * bound: true - * description: Whether the node handles are to be - * displayed. */ + @BeanProperty(description + = "Whether the node handles are to be displayed.") public void setShowsRootHandles(boolean newValue) { boolean oldValue = showsRootHandles; TreeModel model = getModel(); @@ -968,10 +958,9 @@ * This is a bound property. * * @param rowHeight the height of each cell, in pixels - * @beaninfo - * bound: true - * description: The height of each cell. */ + @BeanProperty(description + = "The height of each cell.") public void setRowHeight(int rowHeight) { int oldValue = this.rowHeight; @@ -999,6 +988,7 @@ * * @return true if the height of each row is a fixed size */ + @BeanProperty(bound = false) public boolean isFixedRowHeight() { return (rowHeight > 0); @@ -1013,11 +1003,9 @@ * * @param newValue true to suggest a large model to the UI * @see #largeModel - * @beaninfo - * bound: true - * description: Whether the UI should use a - * large model. */ + @BeanProperty(description + = "Whether the UI should use a large model.") public void setLargeModel(boolean newValue) { boolean oldValue = largeModel; @@ -1046,12 +1034,10 @@ * @param newValue true means that stopCellEditing is invoked * when editing is interrupted, and data is saved; false means that * cancelCellEditing is invoked, and changes are lost - * @beaninfo - * bound: true - * description: Determines what happens when editing is interrupted, - * selecting another node in the tree, a change in the - * tree's data, or some other means. */ + @BeanProperty(description + = "Determines what happens when editing is interrupted, selecting another node in the tree, " + + "a change in the tree's data, or some other means.") public void setInvokesStopCellEditing(boolean newValue) { boolean oldValue = invokesStopCellEditing; @@ -1088,11 +1074,9 @@ * @param newValue false to disable scrolling on expansion; * true to enable it * @see #getScrollsOnExpand - * - * @beaninfo - * bound: true - * description: Indicates if a node descendant should be scrolled when expanded. */ + @BeanProperty(description + = "Indicates if a node descendant should be scrolled when expanded.") public void setScrollsOnExpand(boolean newValue) { boolean oldValue = scrollsOnExpand; @@ -1119,10 +1103,9 @@ * * @param clickCount the number of mouse clicks to get a node expanded or closed * @since 1.3 - * @beaninfo - * bound: true - * description: Number of clicks before a node will expand/collapse. */ + @BeanProperty(description + = "Number of clicks before a node will expand/collapse.") public void setToggleClickCount(int clickCount) { int oldCount = toggleClickCount; @@ -1158,11 +1141,9 @@ * @param newValue the new value for expandsSelectedPaths * * @since 1.3 - * @beaninfo - * bound: true - * description: Indicates whether changes to the selection should make - * the parent of the path visible. */ + @BeanProperty(description + = "Indicates whether changes to the selection should make the parent of the path visible.") public void setExpandsSelectedPaths(boolean newValue) { boolean oldValue = expandsSelectedPaths; @@ -1210,11 +1191,9 @@ * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; @@ -1496,6 +1475,7 @@ * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } @@ -1626,6 +1606,7 @@ * * @return the number of viewable nodes */ + @BeanProperty(bound = false) public int getRowCount() { TreeUI tree = getUI(); @@ -1668,10 +1649,9 @@ * * @param newPath the new lead path * @since 1.3 - * @beaninfo - * bound: true - * description: Lead selection path */ + @BeanProperty(description + = "Lead selection path") public void setLeadSelectionPath(TreePath newPath) { TreePath oldValue = leadPath; @@ -1696,10 +1676,9 @@ * * @param newPath the new anchor path * @since 1.3 - * @beaninfo - * bound: true - * description: Anchor selection path */ + @BeanProperty(description + = "Anchor selection path") public void setAnchorSelectionPath(TreePath newPath) { TreePath oldValue = anchorPath; @@ -1819,6 +1798,7 @@ * null if nothing is selected * @see TreePath#getLastPathComponent */ + @BeanProperty(bound = false) public Object getLastSelectedPathComponent() { TreePath selPath = getSelectionModel().getSelectionPath(); @@ -1885,6 +1865,7 @@ * * @return the number of nodes selected */ + @BeanProperty(bound = false) public int getSelectionCount() { return selectionModel.getSelectionCount(); } @@ -1895,6 +1876,7 @@ * * @return the smallest selected row */ + @BeanProperty(bound = false) public int getMinSelectionRow() { return getSelectionModel().getMinSelectionRow(); } @@ -1905,6 +1887,7 @@ * * @return the largest selected row */ + @BeanProperty(bound = false) public int getMaxSelectionRow() { return getSelectionModel().getMaxSelectionRow(); } @@ -1916,6 +1899,7 @@ * where 0 is the first row in the display; or -1 * if leadPath is null */ + @BeanProperty(bound = false) public int getLeadSelectionRow() { TreePath leadPath = getLeadSelectionPath(); @@ -2189,6 +2173,7 @@ * null if row < 0 * or row >= getRowCount() */ + @BeanProperty(bound = false) public TreePath getPathForRow(int row) { TreeUI tree = getUI(); @@ -2359,6 +2344,7 @@ * @return true if the user is currently editing a node * @see #getSelectionPath */ + @BeanProperty(bound = false) public boolean isEditing() { TreeUI tree = getUI(); @@ -2421,6 +2407,7 @@ * * @return the TreePath for the node being edited */ + @BeanProperty(bound = false) public TreePath getEditingPath() { TreeUI tree = getUI(); @@ -2448,10 +2435,9 @@ * @param selectionModel the TreeSelectionModel to use, * or null to disable selections * @see TreeSelectionModel - * @beaninfo - * bound: true - * description: The tree's selection model. */ + @BeanProperty(description + = "The tree's selection model.") public void setSelectionModel(TreeSelectionModel selectionModel) { if(selectionModel == null) selectionModel = EmptySelectionModel.sharedInstance(); @@ -2691,6 +2677,7 @@ * * @return true if the selection is currently empty */ + @BeanProperty(bound = false) public boolean isSelectionEmpty() { return getSelectionModel().isSelectionEmpty(); } @@ -2729,6 +2716,7 @@ * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public TreeExpansionListener[] getTreeExpansionListeners() { return listenerList.getListeners(TreeExpansionListener.class); } @@ -2761,6 +2749,7 @@ * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public TreeWillExpandListener[] getTreeWillExpandListeners() { return listenerList.getListeners(TreeWillExpandListener.class); } @@ -2920,6 +2909,7 @@ * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public TreeSelectionListener[] getTreeSelectionListeners() { return listenerList.getListeners(TreeSelectionListener.class); } @@ -2971,10 +2961,9 @@ * This is a bound property. * * @param newCount the number of rows to display - * @beaninfo - * bound: true - * description: The number of rows that are to be displayed. */ + @BeanProperty(description + = "The number of rows that are to be displayed.") public void setVisibleRowCount(int newCount) { int oldCount = visibleRowCount; @@ -3448,6 +3437,7 @@ * * @return a Dimension object containing the preferred size */ + @BeanProperty(bound = false) public Dimension getPreferredScrollableViewportSize() { int width = getPreferredSize().width; int visRows = getVisibleRowCount(); @@ -3554,6 +3544,7 @@ * @return whether the tree should track the width of the viewport * @see Scrollable#getScrollableTracksViewportWidth */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -3571,6 +3562,7 @@ * @return whether the tree should track the height of the viewport * @see Scrollable#getScrollableTracksViewportHeight */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -4146,6 +4138,7 @@ * @return an AccessibleJTree that serves as the * AccessibleContext of this JTree */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTree();