This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198991 - OutlineView does not react on updates of the display name.
Summary: OutlineView does not react on updates of the display name.
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-30 09:34 UTC by JuliS
Modified: 2011-06-01 13:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
scrennshoot. Outlineview left, BeanTreeView right. (look at the nodes at the bottom) (27.40 KB, image/png)
2011-05-30 09:34 UTC, JuliS
Details
Complete netbeans platform project (14.57 KB, application/octet-stream)
2011-05-30 09:50 UTC, JuliS
Details

Note You need to log in before you can comment on or make changes to this bug.
Description JuliS 2011-05-30 09:34:10 UTC
Created attachment 108587 [details]
scrennshoot. Outlineview left, BeanTreeView right. (look at the nodes at the bottom)

If the display name changes (e.g. by calling setDisplayName() which calls fireDisplayNameChange()) the displayed name doesn't changes only for some nodes.

The BeanTreeView works fine.


Example code:

package example.outline;

import java.awt.BorderLayout;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.view.BeanTreeView;
import org.openide.explorer.view.OutlineView;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Children.Array;
import org.openide.nodes.Node;
import org.openide.util.RequestProcessor;

/**
 */
public class OutlineTestPanel extends JPanel implements ExplorerManager.Provider
{
  private final ExplorerManager em = new ExplorerManager();
  private final Random random = new Random(62354564);

  public OutlineTestPanel()
  {

    this.setLayout(new BorderLayout());
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new OutlineView(), new BeanTreeView());
    splitPane.setDividerLocation(300);
    this.add(splitPane);

    //Simple self updating node stucture:
    Node root = new TestNode(buildChildren(4), 1000, 1);
    em.setRootContext(root);

  }

  //Helper to build some children.
  private Children buildChildren(int level)
  {
    if (level <= 0)
    {
      return Children.LEAF;
    }

    Array children = new Children.Array();
    int count = random.nextInt(10) + 1;

    for (int i = 0; i < count; i++)
    {
      children.add(new Node[]
              {
                new TestNode(buildChildren(level - random.nextInt(4) - 1), (random.nextInt(10) + 1) * 100, i
                                                                                                           + 1)
              });
    }
    return children;
  }

  @Override
  public ExplorerManager getExplorerManager()
  {
    return em;
  }

  private final static RequestProcessor RP = new RequestProcessor(TestNode.class);

  private class TestNode extends AbstractNode implements Runnable
  {
    private final int interval;
    private final int no;
    private int count = 0;

    public TestNode(Children children, int interval, int no)
    {
      super(children);
      this.interval = interval;
      this.no = no;
      updateDisplayName();
      RP.scheduleAtFixedRate(this, interval, interval, TimeUnit.MILLISECONDS);
    }

    @Override
    public void run()
    {
      count++;
      updateDisplayName();
    }

    private void updateDisplayName()
    {
      setDisplayName("Node " + no + " (" + count + "*" + interval + "ms)");
      
    }
  }
}
Comment 1 JuliS 2011-05-30 09:50:22 UTC
Created attachment 108589 [details]
Complete netbeans platform project
Comment 2 Martin Entlicher 2011-05-30 14:31:19 UTC
Thanks for the project, I've reproduced the problem.
Comment 3 Martin Entlicher 2011-05-31 14:21:19 UTC
It was not easy to find out, but was easy to fix. :-)
Fixed by changeset:   194909:59dd1449aef2
http://hg.netbeans.org/main/rev/59dd1449aef2

Merged into release701 branch as changeset:   199638:81ddbc02fd6d
Comment 4 Quality Engineering 2011-06-01 13:12:12 UTC
Integrated into 'main-golden', will be available in build *201106010401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/59dd1449aef2
User: mentlicher@netbeans.org
Log: #198991 The row calculation is corrected.