JDK-8236411 : BasicTreeUI contains getters/setters with unclear spec
  • Type: CSR
  • Component: client-libs
  • Sub-Component: javax.swing
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 15
  • Submitted: 2019-12-20
  • Updated: 2020-01-22
  • Resolved: 2020-01-22
Related Reports
CSR :  
Description
Summary
-------

Documentation of some API's is inconsistent & incomplete that should be corrected.

Problem
-------

Class javax.swing.plaf.basic.BasicTreeUI https://docs.oracle.com/en/java/javase/13/docs/api/java.desktop/javax/swing/plaf/basic/BasicTreeUI.html

contains some getters/setters that are not consistent and have specification that says nothing about how they should be used and how do they behave in BasicTreeUI.

Solution
--------

Add the requested specs clarifications to javadoc.

Specification
-------------

          /**
    -     * Updates the componentListener, if necessary.
    +     * Sets the {@code largeModel}.
          *
    -     * @param largeModel the new value
    +     * Called when the {@code largeModel} property is changed in the drawn tree
    +     * component.
    +     *
    +     * @param largeModel the new value of the {@code largeModel} property
          */
         protected void setLargeModel(boolean largeModel) {
    
         /**
          * Sets the row height, this is forwarded to the treeState.
          *
    -     * @param rowHeight the row height
    +     * Called when the {@code rowHeight} property is changed in
    +     * the drawn tree component.
    +     *
    +     * @param rowHeight the new value of the {@code rowHeight} property
          */
         protected void setRowHeight(int rowHeight) {
    
         /**
    -     * Returns the row height.
    +     * Returns the height of each row in the drawn tree component. If the
    +     * returned value is less than or equal to 0 the height for each row is
    +     * determined by the renderer.
          *
    -     * @return the row height
    +     * @return the height of each row, in pixels
          */
         protected int getRowHeight() {
    
          * Sets the {@code TreeCellRenderer} to {@code tcr}. This invokes
          * {@code updateRenderer}.
          *
    -     * @param tcr the new value
    +     * Called when the {@code cellRenderer} property is changed in
    +     * the drawn tree component.
    +     *
    +     * @param tcr the new value of the {@code cellRenderer} property
          */
         protected void setCellRenderer(TreeCellRenderer tcr) {
    
         /**
    -     * Return {@code currentCellRenderer}, which will either be the trees
    -     * renderer, or {@code defaultCellRenderer}, which ever wasn't null.
    +     * Returns the current instance of the {@link TreeCellRenderer} that is
    +     * rendering each cell.
          *
    -     * @return an instance of {@code TreeCellRenderer}
    +     * @return the {@link TreeCellRenderer} instance
          */
         protected TreeCellRenderer getCellRenderer() {
    
         /**
          * Sets the root to being visible.
          *
    -     * @param newValue the new value
    +     * Called when the {@code rootVisible} property is changed in the drawn tree
    +     * component.
    +     *
    +     * @param newValue the new value of the {@code rootVisible} property
          */
         protected void setRootVisible(boolean newValue) {
    
         /**
    -     * Returns {@code true} if the tree root is visible.
    +     * Returns whether the root node of the drawn tree component should be displayed.
          *
    -     * @return {@code true} if the tree root is visible
    +     * @return {@code true} if the root node of the tree is displayed
          */
         protected boolean isRootVisible() {
    
         /**
          * Determines whether the node handles are to be displayed.
          *
    -     * @param newValue the new value
    +     * Called when the {@code showsRootHandles} property is changed in the drawn
    +     * tree component.
    +     *
    +     * @param newValue the new value of the {@code showsRootHandles} property
          */
         protected void setShowsRootHandles(boolean newValue) {
    
         /**
          * Sets the cell editor.
          *
    -     * @param editor the new cell editor
    +     * Called when the {@code cellEditor} property is changed in the drawn tree
    +     * component.
    +     *
    +     * @param editor the new value of the {@code cellEditor} property
          */
         protected void setCellEditor(TreeCellEditor editor) {
    
         /**
    -     * Returns an instance of {@code TreeCellEditor}.
    +     * Returns the editor used to edit entries in the drawn tree component, or
    +     * {@code null} if the tree cannot be edited.
          *
    -     * @return an instance of {@code TreeCellEditor}
    +     * @return the {@link TreeCellEditor} instance, or {@code null}
          */
         protected TreeCellEditor getCellEditor() {
    
         /**
          * Configures the receiver to allow, or not allow, editing.
          *
    -     * @param newValue the new value
    +     * Called when the {@code editable} property is changed in the drawn tree
    +     * component.
    +     *
    +     * @param newValue the new value of the {@code editable} property
          */
         protected void setEditable(boolean newValue) {
    
         /**
    -     * Returns {@code true} if the tree is editable.
    +     * Returns whether the drawn tree component should be enabled for editing.
          *
          * @return {@code true} if the tree is editable
          */
         protected boolean isEditable() {
    
          * Resets the selection model. The appropriate listener are installed
          * on the model.
          *
    -     * @param newLSM new selection model
    +     * Called when the {@code selectionModel} property is changed in the drawn tree
    +     * component.
    +     *
    +     * @param newLSM the new value of the {@code selectionModel} property
          */
         protected void setSelectionModel(TreeSelectionModel newLSM) {
    
         /**
    -     * Returns the tree selection model.
    +     * Returns the current instance of the {@link TreeSelectionModel} which is
    +     * the model for selections.
          *
    -     * @return the tree selection model
    +     * @return the {@link TreeSelectionModel} instance
          */
         protected TreeSelectionModel getSelectionModel() {


Comments
Changing scope to SE and moving to Approved.
22-01-2020

Reviewed webrev: http://cr.openjdk.java.net/~trebari/swing/7020860/webrev2/
20-12-2019