JTree bug ??
Hi all,
I'm coding with the Swing API and I just got this strange bug. Let me try to picture the problem.
I have the following JTree made of a root that is empty. To this root, I add a new entry:
- Root
+ New Entry
Adding is done with the insertNodeInto method. It works fine. I then remove this new entry with the method removeNodeFromParent. The tree goes like this:
- Root
At this point, if I click with the mouse in the scrollpane where the tree is, the event is passed in and I get a NullPointerException in BasicTreeUI. With a little look at the source code I found that the mouse click is identifying a valid TreePath (and I am clicking in the clear withe panel). This path however doesn't have bounds which crashes later in BasicTreeUI.
I managed to overcome this problem doing the following: removing from the root node the "New Entry" using the MutableTreeNode methods. And then calling nodeStructureChanged for the rootNode. However for my application, this isn't desirable.
I am using JDK 1.4.2_07.
Is this a known bug ? I couldn't find it on the internet. Maybe I'm doing something wrong but I can't figure out what.
Sounds like a bug but you need to create a very
simple example that illustrates the problem. If you
then post the example people will be sure to test it
for you.I recreated the scenario using a very simple class, and I didn't get any bug. Maybe it's really a bug in my code that making JTree crashing. I have to dwelve deeper into it.
Thanks anyway :)
Similar Messages
-
Jtree bug fixing - When ?
Has anyone can see in the forum the JTree binding is so buggy that we can't use it.
Binding with the navbar doesn't work, recusrsion gives many problems, if a node is child of more than one parent (n to m relationships) the binding goes mad and so on.
We need to know if theese bugs will be fixed and when in order to take our decisions about that control.
Could JDev team answer about that ?
TIA
Tulliowe have been bug fixing the 904 release but I would really need more specifics to tell you if these bugs are fixed.
Could you describe the problems in detail or send me a simple EMP/DEPT test case and I will check
Thanks
[email protected] -
A bug in the JTree(Missing some nodes)
I have an application which implement a JTree & DnDTree. The left hand side is the original JTee, the right hand size is DnDTree which allows user to Drag and Drop some node from left JTree. The bug is: when I grag some node to right DnDTree, once I then click the left JTree, some nodes will be missing. I try my best for more than one week, but still couldn't fix it, could anybody take time to fina a way to fix it? The piece of code of creating JTree is as follow:
/*public void createTestTree()
DefaultMutableTreeNode rootRight = new DefaultMutableTreeNode("Root");
DefaultMutableTreeNode root = createTreeModel();
treeLeft = new DnDTree(root, true); //JTree(root, true);
treeLeft.putClientProperty("JTree.lineStyle", "Angled");
treeLeft.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
treeLeft.addTreeExpansionListener(new TreeExpansionListener(){
public void treeCollapsed(TreeExpansionEvent e) {
public void treeExpanded(TreeExpansionEvent e) {
UpdateStatus updateThread;
TreePath path = e.getPath();
FileNode node = (FileNode)
path.getLastPathComponent();
if( ! node.isExplored()) {
DefaultTreeModel model = (DefaultTreeModel)treeLeft.getModel();
UpdateStatus us = new UpdateStatus();
us.start();
node.explore();
model.nodeStructureChanged(node);
class UpdateStatus extends Thread {
public void run() {
try { Thread.currentThread().sleep(450); }
catch(InterruptedException e) { }
SwingUtilities.invokeLater(new Runnable() {
public void run() {
treeRight = new DnDTree(rootRight, true); treeRight.putClientProperty("JTree.lineStyle", "Angled");
treeRight.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
treeRight.addTreeExpansionListener(new TreeExpansionListener(){
public void treeCollapsed(TreeExpansionEvent e) {
public void treeExpanded(TreeExpansionEvent e) {
UpdateStatus updateThread;
TreePath path = e.getPath();
FileNode node = (FileNode)
path.getLastPathComponent();
if( ! node.isExplored()) {
DefaultTreeModel model = (DefaultTreeModel)treeRight.getModel();
UpdateStatus us = new UpdateStatus();
us.start();
node.explore();
model.nodeStructureChanged(node);
class UpdateStatus extends Thread {
public void run() {
try { Thread.currentThread().sleep(450); }
catch(InterruptedException e) { }
SwingUtilities.invokeLater(new Runnable() {
public void run() {
My FileNode class is:
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.EventObject;
public class GoodFileTree extends JPanel {
public GoodFileTree() {
final JTree tree = new JTree(createTreeModel());
JScrollPane scrollPane = new JScrollPane(tree);
this.add(scrollPane, BorderLayout.WEST);
//getContentPane().add(scrollPane, BorderLayout.CENTER);
this.add(GJApp.getStatusArea(),BorderLayout.SOUTH);
//getContentPane().add(GJApp.getStatusArea(),BorderLayout.SOUTH);
tree.addTreeExpansionListener(new TreeExpansionListener(){
public void treeCollapsed(TreeExpansionEvent e) {
public void treeExpanded(TreeExpansionEvent e) {
UpdateStatus updateThread;
TreePath path = e.getPath();
FileNode node = (FileNode)
path.getLastPathComponent();
if( ! node.isExplored()) {
DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
GJApp.updateStatus("exploring ...");
UpdateStatus us = new UpdateStatus();
us.start();
node.explore();
model.nodeStructureChanged(node);
class UpdateStatus extends Thread {
public void run() {
try { Thread.currentThread().sleep(450); }
catch(InterruptedException e) { }
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GJApp.updateStatus(" ");
private DefaultMutableTreeNode createTreeModel() {
/*File root = new File("E:/");
FileNode rootNode = new FileNode(root);
rootNode.explore();
return new DefaultTreeModel(rootNode);*/
DefaultMutableTreeNode top = new DefaultMutableTreeNode("Root");
File[] fArr = File.listRoots();
File fDrive;
FileNode driveNode;
for(int i=0; i<fArr.length; ++i)
fDrive = fArr;
driveNode = new FileNode(fDrive);
top.add(driveNode);
return top;
/*public static void main(String args[])
try
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName()
//UIManager.getCrossPlatformLookAndFeelClassName()
catch (Exception e)
GJApp.launch(new GoodFileTree(),"JTree File Explorer",
300,300,450,400);
class FileNode extends DefaultMutableTreeNode {
private boolean explored = false;
public FileNode(File file) {
setUserObject(file);
public boolean getAllowsChildren() { return isDirectory(); }
public boolean isLeaf() { return !isDirectory(); }
public File getFile() { return (File)getUserObject(); }
public boolean isExplored() { return explored; }
public boolean isDirectory() {
File file = getFile();
return file.isDirectory();
public String toString() {
File file = (File)getUserObject();
String filename = file.toString();
int index = filename.lastIndexOf(File.separator);
return (index != -1 && index != filename.length()-1) ?
filename.substring(index+1) :
filename;
public void explore() {
if(!isDirectory())
return;
if(!isExplored()) {
File file = getFile();
File[] children = file.listFiles();
for(int i=0; i < children.length; ++i)
add(new FileNode(children[i]));
explored = true;
class GJApp extends WindowAdapter {
static private JPanel statusArea = new JPanel();
static private JLabel status = new JLabel(" ");
public static void launch(final JFrame f, String title,
final int x, final int y,
final int w, int h) {
f.setTitle(title);
f.setBounds(x,y,w,h);
f.setVisible(true);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
statusArea.add(status);
status.setHorizontalAlignment(JLabel.LEFT);
f.setDefaultCloseOperation(
WindowConstants.DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
static public JPanel getStatusArea() {
return statusArea;
static public void updateStatus(String s) {
status.setText(s);
Thanks in advance.Hi Paul,
sorry for my late reply, but I usually don't work on weekends (this time it was an exception).
OK, then, to your problem:
- at the first look I thought you did NOT follow all the instruction (namely, the constructor of your trees has no info that you want to use model, or whatsoever), but later I realized that your approach: create the tree first and then assign a model to it (or in fact, get the model from the tree via: tree.getModel()) might work as well
- having no debugger I am not able to have much clue about your program / and it seems that you coding suffers from your being in a hurry:
- no comments - don't know which method is expected to do what
- misleading names (createTreeModel does nothing with the model, but creates some new nodes??)
therefore, I'm sorry, but I'm not able to detect exactly where the error is.
- anyway, having a quick glance on your code I have some suspections:
- you have 2 trees (treeLeft, treeRight), but just one model (model)
( it seems that you assign it dynamically when needed - either you take the model of the left or of the right tree)
- however, when this assignment takes place (in createTestTree()), you DO NOT ASSIGN IT to the class' protected attribute model, but to a local variable model (of the same type, however - since you introduce it as:
DefaultTreeModel model you override the model from class' attributes) - therefore, your assignment is no valid when the block in which ot is located is finished
- note, that you NEED the model when you add/delete nodes of the tree (somewhere in DnDTree? - then quite probably your local assignment of model is not valid any longer)
My suggestion, therefore, is:
somehow try to encapsulate the model to your tree (note that I only created the model outside the tree, because I needed it for running the constructor, but all other usages of the model are made WITHIN the class of the tree) - the best, do it the same way - through the constructor
then, in the place when you insert/remove nodes you will have no problem at all
I will e-mail you my whole "project" so that you may observe all parts - how it's written. I trust if you can't figure it out from my writings here (maybe I missed the point) you may get it from that example.
Hope it helps - GOOD LUCK -
A bug exists with JTree rendering where a huge treenode is rendered for no apparent reason. It happens infrequently, but I've noticed that it's happening more frequently since I started using jdk1.4.2.
This seems to be the only place I can find mention of it : http://forum.java.sun.com/thread.jsp?forum=57&thread=217494
One of the solutions mentioned was to setRowHeight() on the tree. I don't like it, but it seems to be the only way around the bug at present.
Does anyone know of any potential problems which might arise from explicitly setting the row height on a JTree?I basically need to be able to edit the rendered JTable as normal.
-
Is there a bug with JTree??
I can't seem to get to the bottom of a problem I'm having.
I have a JTree object, for which I'm using a DefaultTreeModel. I always use TreeModel.insertNodeInto(...), and TreeModel.removeNodeFromParent(...) when inserting and deleting nodes.
But sometimes when I add/modify nodes they don't appear properly - like you can see the dotten lines towards the node, but not the string representation. So if I close the node (ie. unexpand) above the one I can't see, then the one I couldn't see reappears... but then if I re-expand the previous node, I get exceptions like:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.windows.WindowsTreeUI.ensureRowsAreVisible(WindowsTreeUI.java:71)
at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2193)
at javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2176)
at javax.swing.plaf.basic.BasicTreeUI.checkForClickInExpandControl(BasicTreeUI.java:2130)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelectionImpl(BasicTreeUI.java:3495)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3480)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3461)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
at java.awt.Component.processMouseEvent(Component.java:5485)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3889)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)which you can see does not contain any of my own code.
Any suggestions would be greatly appreciated.Well, I tried both of your suggestions. The invokerLater didn't help. But I created a small program, reproduced the error - and then found out my problem.
Here's the thing: don't use expandPath() when wanting to make sure a path is visible. You have to use scrollPathToVisible(). For whatever reason, this solved my problems.
Thanks. -
JTree is bugging :( Pleeeeeeeeeeeeease Help
Hi,
I've created JTree using myTablemodel(which implements TreeModel). Now the problem is whenever I add a new element to any node, all the expanded nodes, except root node, get collapsed. If i manually expand(by clicking on the node) the node to which I added an element the newly added element is there. What's the problem??? I tried,
treemodel.fireTreeStructureChanged(), yet not working.
Some Swing Guru ,Pls HELP!!!!!!!!!!!!!!
Thanks in advance,
NavalI don't get the problem? Is it:
nodes are collapsing?
or newly added element is NOT there?
If it the second it would explain why you are quoting the treemodel.fireTreeStructureChanged() method.
Then you should use or implement this method to insert or add a node
public void valueForPathChanged(javax.swing.tree.TreePath path,java.lang.Object newNode) {
// do something impoartant here
// for example inserting a node ;-)
fireTreeNodesChanged(this, pp, ci, cc);
fireTreeStructureChanged(this, pp, ci, cc); -
JTree setRoot method problem!!! Maybe swing bug???
Hi all,
i have problem with setRoot method of the DefaultTreeModel class. Sometimes when i've switched the root element of my tree (i've called setRoot method) ...swing has fired this exception....
java.lang.NullPointerException
at javax/swing/SizeRequirements.calculateAlignedPositions (SizeRequirements.java:333)
at javax/swing/OverlayLayout.layoutContainer (OverlayLayout.java:214)
at java/awt/Container.layout (Container.java)
at java/awt/Container.doLayout (Container.java)
at java/awt/Container.validateTree (Container.java)
at java/awt/Container.validate (Container.java)
at javax/swing/plaf/basic/BasicTreeUI$NodeDimensionsHandler.getNodeDimensions (BasicTreeUI.java:2509)
at javax/swing/tree/AbstractLayoutCache.getNodeDimensions (AbstractLayoutCache.java:402)
at javax/swing/tree/VariableHeightLayoutCache$TreeStateNode.updatePreferredSize (VariableHeightLayoutCache.java:1289)
at javax/swing/tree/VariableHeightLayoutCache$TreeStateNode.expand (VariableHeightLayoutCache.java:1421)
at javax/swing/tree/VariableHeightLayoutCache$TreeStateNode.expand (VariableHeightLayoutCache.java:1216)
at javax/swing/tree/VariableHeightLayoutCache.rebuild (VariableHeightLayoutCache.java:669)
at javax/swing/tree/VariableHeightLayoutCache.treeStructureChanged (VariableHeightLayoutCache.java:573)
at javax/swing/plaf/basic/BasicTreeUI$TreeModelHandler.treeStructureChanged (BasicTreeUI.java:2286)
at javax/swing/tree/DefaultTreeModel.fireTreeStructureChanged (DefaultTreeModel.java:513)
at javax/swing/tree/DefaultTreeModel.nodeStructureChanged (DefaultTreeModel.java:339)
at javax/swing/tree/DefaultTreeModel.setRoot (DefaultTreeModel.java:115)
Had someone similar problem like me..??????sounds like something in the tree structure is null...
or possibly you are changing it from a different thread then the event dispatch thread, in which case, use SwingUtilities.invokeLater() or invokeAndWait() to change the root, otherwise there could be timing issues with repaints. -
How to expand a JTree depending on a property
Hi I have a JTree that needs to be expandAll if a property in the ini file is true. Can some tell me how I can do it or give me an example. If needed i can post my code. Here the addtreeDisplays() has to expandAll depending on a string(true ).
Can some help me out.
Thanks,
public class TreeDisplayPanel extends JPanel implements QMRequestListener,
TopologySelectionListener,
PropertyChangeListener
/** Creates new TreeDisplayPanel */
//Key to get from property file
String _treeKey = "tree.display.type";
//default display
public final static int TREE_DISPLAY = 0;
public final static int STAR_DISPLAY = 1;
public final static int BOTH_DISPLAY =2;
Properties _displayProp = null;
//Main panel where everything gets put on to be displayed
public JPanel _mainDisplayPanel;
//current default display
private int treeDisplayPreference = STAR_DISPLAY;
private MQETabbedPane _treeTabPane;
private MQETabbedPane _viewTabPane;
private String treeDisplayTitle;
static private final String treeviewKey = "tree.view.text";
static private final String starviewKey = "star.view.text";
static private final String splitviewKey = "split.view.text";
static private final String mergeviewKey = "merge.view.text";
// Default tree displays.
private HyperbolicTreePanel hyperbolicTreePanel = null;
private NavigatorTreePanel navigatorTreePanel = null;
// A store for any queue manager tree displays created
// by the user. This will enable these trees to be
// modified whenever the user invokes a expand/collapse
// all action on a node or whenever the user changes
// the leaf node expansion preference.
private Vector<NavigatorTreePanel> qmgrTreeDisplays =
new Vector<NavigatorTreePanel>();
//HashMap of indexes correspond to indexes in tabbed paned that are merged, it contains
//hashtables of components in those merged indexes
HashMap _qmMergedIndexes = new HashMap();
//Current listeners to this panel on node selections
protected Vector<TopologySelectionListener> _tsListeners =
new Vector<TopologySelectionListener>();
private TopologyModel m_model = null;
private TopologyModelNode m_nnode = null;
private TopologyDisplayPanel tdp = null;
public TreeDisplayPanel(TopologyModel model, Properties prop, String displayTitle) {
super(new BorderLayout());
m_model = model;
_displayProp = prop;
treeDisplayTitle = displayTitle;
initComponent();
initGui();
private void initComponent()
_mainDisplayPanel = ComponentFactory.getInstance().createTitledPanel(treeDisplayTitle);
_mainDisplayPanel.setLayout(new BorderLayout());
add(_mainDisplayPanel, BorderLayout.CENTER);
private void initGui()
if (_displayProp != null)
// Get the current display preference.
String defaultDisplay = Integer.toString(STAR_DISPLAY);
treeDisplayPreference = Integer.parseInt(_displayProp.getProperty(_treeKey, defaultDisplay));
try
//Add according to your display property
_treeTabPane = new MQETabbedPane();
_viewTabPane = new MQETabbedPane(JTabbedPane.BOTTOM);
_viewTabPane.addMouseListener(new MouseListener()
public void mouseClicked(MouseEvent e)
final int tabNum = _viewTabPane.getUI().tabForCoordinate(_viewTabPane,e.getX(),e.getY());
//Only if the mouse click is a right mouse and tab number is not on overview pane or doc pane is the popup valid
if (SwingUtilities.isRightMouseButton(e) && tabNum > 1)
final String tabStr = _viewTabPane.getTitleAt(tabNum);
JPopupMenu popup = new JPopupMenu();
JMenuItem menuItem1 = new JMenuItem(new AbstractAction("Close " + tabStr)
public void actionPerformed(ActionEvent e)
//Remove it from our HashMap of merged panes if it exists
if (_qmMergedIndexes.containsKey(tabStr))
_qmMergedIndexes.remove(tabStr);
// Remove the Qmgr tree display.
NavigatorTreePanel treePanel = (NavigatorTreePanel)_viewTabPane.getComponentAt(tabNum);
ExpandingModelNode model = (ExpandingModelNode)treePanel.getNavigatorTreeModel();
model.getNode().removeTreeModelListener(model);
qmgrTreeDisplays.remove(treePanel);
_viewTabPane.removeTabAt(tabNum);
String mergeview = StringFactory.getString(mergeviewKey);
JMenu merge = new JMenu(mergeview);
merge.setEnabled(false);
int numTabs = _viewTabPane.getTabCount();
//System.out.println("Num of tabs " + numTabs);
//Only allow merging if you have more then 2 panes (1 - Overview, 2 - Qmgr, 3-Qmgr....
//Also if the current pane is not a merge pane already
if (numTabs > 3 && !_qmMergedIndexes.containsKey(tabStr))
//Do not enable this menu if the number of already merged Indexes - the number of tabs
//is greater then two (One Valid pane + Overview pane). The reason is because then there is
//no valid pane to merge with
if ((numTabs - _qmMergedIndexes.size()) > 3)
merge.setEnabled(true);
for (int i = 2; i<numTabs; i++)
//Add only valid tabs and not already merged tabs
if (i != tabNum && !_qmMergedIndexes.containsKey(_viewTabPane.getTitleAt(i)))
//JMenuItem mergeItem = new JMenuItem(new AbstractAction(_viewTabPane.getTitleAt(i))
JMenuItem mergeItem = new JMenuItem(new AbstractAction(_viewTabPane.getToolTipTextAt(i))
public void actionPerformed(ActionEvent e)
try
//System.out.println("Action Name for " + e.getActionCommand());
//Work around for java bug in JTabbedPane
_viewTabPane.setSelectedIndex(0);
_viewTabPane.validate();
//End workaround
//Strip off the fully qualified name to contain only the name of the QM name
String mergeTabName = m_model.getQMgrName(e.getActionCommand());
JPanel splitPanel = new JPanel(new BorderLayout());
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setBorder(null);
splitPane.setOneTouchExpandable(true);
int mergeTabIndex = _viewTabPane.indexOfTab(mergeTabName);
String mergeTabString = _viewTabPane.getTitleAt(mergeTabIndex);
Component mergeComp = _viewTabPane.getComponentAt(mergeTabIndex);
String mergeCompAddress = _viewTabPane.getToolTipTextAt(mergeTabIndex);
splitPane.setLeftComponent(mergeComp);
int currentTabIndex = _viewTabPane.indexOfTab(tabStr);
Component currentComp = _viewTabPane.getComponentAt(currentTabIndex);
String currentCompAddress = _viewTabPane.getToolTipTextAt(currentTabIndex);
splitPane.setRightComponent(currentComp);
splitPanel.add(splitPane, BorderLayout.CENTER);
String mergeName = mergeTabName + "/" + tabStr;
String toolTipName = mergeCompAddress + " | " + currentCompAddress;
//_viewTabPane.addTab(mergeName, splitPanel);
addTabToDisplay(mergeName, toolTipName, splitPanel);
splitPane.setDividerLocation(.5);
int mergeIndex = _viewTabPane.indexOfTab(mergeName);
if (mergeIndex != -1)
//_viewTabPane.setToolTipTextAt(mergeIndex, mergeName);
//_viewTabPane.setSelectedIndex(mergeIndex);
//Now lets update our ongoing vector/hashmap
//Create a hash map with the current merged view
Hashtable mergeViews = new Hashtable();
mergeViews.put(mergeCompAddress,mergeComp);
mergeViews.put(currentCompAddress,currentComp);
_qmMergedIndexes.put(mergeName, mergeViews);
catch (Exception ex)
ex.printStackTrace();
merge.add(mergeItem);
String splitKey = StringFactory.getString(splitviewKey);
JMenu splitMenu = new JMenu(splitKey);
splitMenu.setEnabled(false);
//Only allow to split if the current tab has a merged view
if (_qmMergedIndexes.containsKey(tabStr))
splitMenu.setEnabled(true);
Hashtable mergeHash = (Hashtable)_qmMergedIndexes.get(tabStr);
Enumeration enumeration = mergeHash.keys();
while (enumeration.hasMoreElements())
//Create a new menu item for each QM in View
String node = (String)enumeration.nextElement();
JMenuItem mergeItem = new JMenuItem(new AbstractAction(node)
public void actionPerformed(ActionEvent e)
//Work around for java bug in JTabbedPane
_viewTabPane.setSelectedIndex(0);
_viewTabPane.validate();
//End workaround
String splitTabName = e.getActionCommand();
//Get the merge hash for this tab num
Hashtable splitHash = (Hashtable)_qmMergedIndexes.get(tabStr);
Enumeration enumeration = splitHash.keys();
_viewTabPane.removeTabAt(tabNum);
int iIndexOfSplit = 0;
while (enumeration.hasMoreElements())
//Add new pane for the views in the hashtable
String nodeAddress = (String)enumeration.nextElement();
String nodeName = m_model.getQMgrName(nodeAddress);
NavigatorTreePanel currentComp = (NavigatorTreePanel)splitHash.get(nodeAddress);
addTabToDisplay(nodeName,nodeAddress,currentComp);
//Now if this tab this we just added is equal to the menu item of the split menu,
//store this so that we can give focus to it later
if (splitTabName.equals(nodeAddress))
iIndexOfSplit = _viewTabPane.getTabCount()-1;
//Also remove it from our vector of merged tabs
_qmMergedIndexes.remove(tabStr);
//int mergeIndex = _viewTabPane.indexOfTab(splitTabName);
//if (mergeIndex != -1)
if (iIndexOfSplit != -1)
//_viewTabPane.setSelectedIndex(mergeIndex);
_viewTabPane.setSelectedIndex(iIndexOfSplit);
splitMenu.add(mergeItem);
popup.add(menuItem1);
popup.add(merge);
popup.add(splitMenu);
if (popup != null)
Point p = e.getPoint();
popup.show((Component)e.getSource(), (int)p.getX(), (int)p.getY());
public void mouseEntered(MouseEvent e)
public void mouseExited(MouseEvent e)
public void mousePressed(MouseEvent e)
public void mouseReleased(MouseEvent e)
//Don't forget to add the tree's
addTreeDisplays();
_viewTabPane.addTab(StringFactory.getString("perspective.display.overview.tab"), _treeTabPane);
_viewTabPane.addTab(StringFactory.getString("perspective.display.documentation.tab"), new DocDisplayPanel());
_mainDisplayPanel.add(_viewTabPane, BorderLayout.CENTER);
catch(Exception e)
e.printStackTrace();
private void addTabToDisplay(String nameStr, String toolStr, JComponent c)
if (_viewTabPane == null)
return;
_viewTabPane.addTab(nameStr, c);
int tabNum = _viewTabPane.getTabCount()-1;
if (toolStr != null)
_viewTabPane.setToolTipTextAt(tabNum, toolStr);
_viewTabPane.setSelectedIndex(tabNum);
private void addTreeDisplays()
String starKey = StringFactory.getString(starviewKey);
String treeKey = StringFactory.getString(treeviewKey);
//navigatorTreePanel.expandTreePath(this, true);
String test = MQEPreferencesDialog.getPreferenceValue("expand.leaf.startup");
System.out.println("test{{{{{{{{{{"+test);
//System.out.println("test{{{{{{{{{{"+m_nnode.);
if (treeDisplayPreference == BOTH_DISPLAY)
hyperbolicTreePanel = new HyperbolicTreePanel(m_model);
hyperbolicTreePanel.addQMRequestListener(this);
hyperbolicTreePanel.addTopologySelectionListener(this);
//hyperbolicTreePanel.expandTreePath((TopologyModelNode)m_model.getRoot(), true);
//hyperbolicTreePanel.expandTreePath(m_nnode, true);
_treeTabPane.addTab("", IconFactory.getInstance().getIcon("staricon"), hyperbolicTreePanel, starKey);
navigatorTreePanel = new NavigatorTreePanel(m_model);
navigatorTreePanel.addQMRequestListener(this);
navigatorTreePanel.addTopologySelectionListener(this);
_treeTabPane.addTab("", IconFactory.getInstance().getIcon("treeicon"), navigatorTreePanel, treeKey);
else if (treeDisplayPreference == TREE_DISPLAY)
navigatorTreePanel = new NavigatorTreePanel(m_model);
navigatorTreePanel.addQMRequestListener(this);
navigatorTreePanel.addTopologySelectionListener(this);
_treeTabPane.addTab("", IconFactory.getInstance().getIcon("treeicon"), navigatorTreePanel, treeKey);
else
hyperbolicTreePanel = new HyperbolicTreePanel(m_model);
hyperbolicTreePanel.addQMRequestListener(this);
hyperbolicTreePanel.addTopologySelectionListener(this);
_treeTabPane.addTab("", IconFactory.getInstance().getIcon("staricon"), hyperbolicTreePanel, starKey);
public void addTopologySelectionListener(TopologySelectionListener tsl)
if (tsl != null)
_tsListeners.add(tsl);
public void removeTopologySelectionListener(TopologySelectionListener tsl)
if (tsl != null)
_tsListeners.remove(tsl);
protected void fireTopologySelection(TopologyModelNode node)
for (TopologySelectionListener tsl : _tsListeners)
tsl.receiveTopologySelection(node);
/* TopologySelectionListener methods */
public void receiveTopologySelection(TopologyModelNode node)
//Since this panel can have multiple panels in it's current Tabbed display.
//This class registers to each of the TopologyDisplayPanels as a listener for selections
//This way no matter who is currently active, they will funnel the event to here and it this
//panel will send the event on foward
if (node != null)
fireTopologySelection(node);
/* QMRequestListener methods */
public void receiveQMRequest(TopologyModelNode node)
//Check to see if this node is already in a Tab already
System.out.println("Queue Manager request");
boolean doesExist = false;
int tabNum =0;
//Fix for activity 00033248 TAB PANES FOR IDENTICAL QMANAGERS ON DIFF MACHINES
//The only unique names are in the tooltips so lets just cycle through all the tabs
//and search for this Queue Manager name. Using indexOfTab in JTabbedPane will not
//work here because it will return first location of a matching queue manager name, but
//we could have multiple tabs open with same queue manager name.
for (int i = 0; i < _viewTabPane.getTabCount();i++)
String toolTipStr = _viewTabPane.getToolTipTextAt(i);
//Using the string method for indexOf, covers us when we have a merged tab window
if ((toolTipStr != null) && (toolTipStr.indexOf(((ResourceProxy)node).getAddress().trim()) != -1))
//We already have existing queue manager tab open
doesExist = true;
tabNum = i;
break;
if ( !doesExist)
//Create the tab
NavigatorTreePanel treePanel = new NavigatorTreePanel(new ExpandingModelNode(node));
treePanel.addTopologySelectionListener(this);
// Add the tree panel to a container so that it can be accessed
// for expand/collapse all and tree refresh actions.
qmgrTreeDisplays.add(treePanel);
//Fix for activity 00033248 TAB PANES FOR IDENTICAL QMANAGERS ON DIFF MACHINES
addTabToDisplay(((ResourceProxy)node).getName().trim(), ((ResourceProxy)node).getAddress().trim(), treePanel);
node.getModel().expandNode(node);
else
_viewTabPane.setSelectedIndex(tabNum);
/* PropertyChangeListener methods */
public void propertyChange(PropertyChangeEvent evt){
String propertyChanged = evt.getPropertyName();
if (propertyChanged.equals(MQEDisplayPreferences.treeDisplayProperty)){
int newPreference = ((Integer)evt.getNewValue()).intValue();
changeTreeDisplays(newPreference);
else if (propertyChanged.equals(MQEDisplayPreferences.expandLeafProperty)){
// The enable leaf node preference has changed so update the MQE
// tree displays according to the new preference setting.
refreshTreeDisplays();
else{
// Ignore the property change event.
* Changes the trees displayed by MQE according to
* the preference set by the current user.
* @param the new trees display preference.*/
public void changeTreeDisplays(int preference)
// Assign the new tree display preference.
treeDisplayPreference = preference;
// Recreate the tree display according
// to the new preference.
m_model.removeTreeModelListeners();
_treeTabPane.removeAll();
addTreeDisplays();
refreshTreeDisplays();
* Fully expands the Navigator display trees from the specified node.
* @param the node from which each tree will be fully expanded.
public void expandAll(TopologyModelNode node)
node.expandAll();
final TopologyModelNode fnode = node;
Runnable doTask = new Runnable(){
public void run(){
// Fire a tree structure changed notification for
// the StarTree, (1) because it will not display
// tree nodes correctly without it and (2) it appears
// to be the only tree interested in doing anything
// with it!
fnode.fireTreeStructureChanged(TopologyModel.STRUCTURE_CHANGE);
if (hyperbolicTreePanel != null)
hyperbolicTreePanel.expand(fnode);
if (navigatorTreePanel != null)
navigatorTreePanel.expand(fnode);
for (NavigatorTreePanel navTreePanel : qmgrTreeDisplays){
navTreePanel.expand(fnode);
SwingUtilities.invokeLater(doTask);
* Fully collapses the Navigator display trees from the specified node.
* @param the node from which each tree will be fully collapsed.
public void collapseAll(TopologyModelNode node)
final TopologyModelNode fnode = node;
Runnable doTask = new Runnable(){
public void run(){
if (hyperbolicTreePanel != null)
hyperbolicTreePanel.collapse(fnode);
if (navigatorTreePanel != null)
navigatorTreePanel.collapse(fnode);
for (NavigatorTreePanel navTreePanel : qmgrTreeDisplays){
navTreePanel.collapse(fnode);
SwingUtilities.invokeLater(doTask);
* Will ensure that all tree nodes, starting from the root, are correctly displayed.
public void refreshTreeDisplays()
if (hyperbolicTreePanel != null){
TopologyModel model = hyperbolicTreePanel.getTopologyModel();
if (model != null){
hyperbolicTreePanel.expandTreePath((TopologyModelNode)model.getRoot(), true);
hyperbolicTreePanel.refreshTreeDisplay((TopologyModelNode)model.getRoot());
if (navigatorTreePanel != null){
TopologyModel model = navigatorTreePanel.getTopologyModel();
if (model != null){
navigatorTreePanel.refreshTreeDisplay((TopologyModelNode)model.getRoot());
navigatorTreePanel.repaint();
for (NavigatorTreePanel navTreePanel : qmgrTreeDisplays){
ExpandingModelNode model = (ExpandingModelNode)navTreePanel.getNavigatorTreeModel();
if (model != null){
navigatorTreePanel.expand((TopologyModelNode)model.getRoot());
navTreePanel.refreshTreeDisplay((TopologyModelNode)model.getRoot());
navTreePanel.repaint();
}you really don't need to post all that code, few people will read it, or try to compile/run it.
just a tree in a scrollpane in a frame is all you need, then add the method/problem to the basic,
and post that so its only 20 to 30 lines long.
here's your basic tree/scrollpane/frame, with an expandAll()
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing
public void buildGUI()
JTree tree = new JTree();
expandAll(tree);
JFrame f = new JFrame();
f.getContentPane().add(new JScrollPane(tree));
f.pack();
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
public void expandAll(JTree tree)
int row = 0;
while (row < tree.getRowCount())
tree.expandRow(row);
row++;
public static void main(String[] args)
SwingUtilities.invokeLater(new Runnable(){
public void run(){
new Testing().buildGUI();
}so, is your problem with the expandAll(), or with reading the properties file? -
HI!
I want to add to Creator 2.1 (Windows version) an EJB module that I have created with Netbeans 4.1 using the Facade approach.
To do this I have perfectly verified and deployed the EJB module on deployement server, but when I try to add the ejb module (add set of session ejb) Creator throws the exception that I put below.
Can anybody help me?
Is this an error or a bug?
Thanks!
Regards..
Aldo
CREATOR EXCEPTION
java.lang.reflect.UndeclaredThrowableException
at $Proxy15.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:515)
at java.awt.Dialog.show(Dialog.java:536)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:800)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:843)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:831)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1044)
at org.openide.util.Mutex.readAccess(Mutex.java:170)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:816)
at java.awt.Component.show(Component.java:1300)
at java.awt.Component.setVisible(Component.java:1253)
at com.sun.rave.ejb.ui.AddEjbGroupDialog.showDialog(AddEjbGroupDialog.java:94)
at com.sun.rave.ejb.actions.AddEjbGroupAction.performAction(AddEjbGroupAction.java:40)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:450)
at org.openide.util.actions.CallableSystemAction.doPerformAction(CallableSystemAction.java:116)
at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:448)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:383)
... 64 more
Caused by: java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode
at com.sun.rave.ejb.ui.ConfigureMethodsPanel$1.getTreeCellRendererComponent(ConfigureMethodsPanel.java:56)
at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:2693)
at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:475)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1342)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1469)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
at javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:725)
at javax.swing.tree.VariableHeightLayoutCache.setModel(VariableHeightLayoutCache.java:91)
at javax.swing.plaf.basic.BasicTreeUI.setModel(BasicTreeUI.java:400)
at javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(BasicTreeUI.java:3384)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
at java.awt.Component.firePropertyChange(Component.java:7159)
at javax.swing.JTree.setModel(JTree.java:710)
at com.sun.rave.ejb.ui.ConfigureMethodsPanel.setEjbGroup(ConfigureMethodsPanel.java:81)
at com.sun.rave.ejb.ui.ConfigureMethodsPanel.<init>(ConfigureMethodsPanel.java:73)
at com.sun.rave.ejb.ui.AddEjbGroupDialog$ConfigureMethodWizardPanel.getComponent(AddEjbGroupDialog.java:312)
at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:577)
at org.openide.WizardDescriptor.goToNextStep(WizardDescriptor.java:691)
at org.openide.WizardDescriptor.access$500(WizardDescriptor.java:63)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:1296)
[catch] ... 69 more
==>
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:383)
at $Proxy15.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:515)
at java.awt.Dialog.show(Dialog.java:536)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:800)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:843)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:831)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1044)
at org.openide.util.Mutex.readAccess(Mutex.java:170)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:816)
at java.awt.Component.show(Component.java:1300)
at java.awt.Component.setVisible(Component.java:1253)
at com.sun.rave.ejb.ui.AddEjbGroupDialog.showDialog(AddEjbGroupDialog.java:94)
at com.sun.rave.ejb.actions.AddEjbGroupAction.performAction(AddEjbGroupAction.java:40)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:450)
at org.openide.util.actions.CallableSystemAction.doPerformAction(CallableSystemAction.java:116)
at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:448)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode
at com.sun.rave.ejb.ui.ConfigureMethodsPanel$1.getTreeCellRendererComponent(ConfigureMethodsPanel.java:56)
at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:2693)
at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:475)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1342)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1469)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
at javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:725)
at javax.swing.tree.VariableHeightLayoutCache.setModel(VariableHeightLayoutCache.java:91)
at javax.swing.plaf.basic.BasicTreeUI.setModel(BasicTreeUI.java:400)
at javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(BasicTreeUI.java:3384)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
at java.awt.Component.firePropertyChange(Component.java:7159)
at javax.swing.JTree.setModel(JTree.java:710)
at com.sun.rave.ejb.ui.ConfigureMethodsPanel.setEjbGroup(ConfigureMethodsPanel.java:81)
at com.sun.rave.ejb.ui.ConfigureMethodsPanel.<init>(ConfigureMethodsPanel.java:73)
at com.sun.rave.ejb.ui.AddEjbGroupDialog$ConfigureMethodWizardPanel.getComponent(AddEjbGroupDialog.java:312)
at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:577)
at org.openide.WizardDescriptor.goToNextStep(WizardDescriptor.java:691)
at org.openide.WizardDescriptor.access$500(WizardDescriptor.java:63)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:1296)
[catch] ... 69 more
==>
java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode
at com.sun.rave.ejb.ui.ConfigureMethodsPanel$1.getTreeCellRendererComponent(ConfigureMethodsPanel.java:56)
at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:2693)
at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:475)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1342)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1469)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
at javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:725)
at javax.swing.tree.VariableHeightLayoutCache.setModel(VariableHeightLayoutCache.java:91)
at javax.swing.plaf.basic.BasicTreeUI.setModel(BasicTreeUI.java:400)
at javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(BasicTreeUI.java:3384)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
at java.awt.Component.firePropertyChange(Component.java:7159)
at javax.swing.JTree.setModel(JTree.java:710)
at com.sun.rave.ejb.ui.ConfigureMethodsPanel.setEjbGroup(ConfigureMethodsPanel.java:81)
at com.sun.rave.ejb.ui.ConfigureMethodsPanel.<init>(ConfigureMethodsPanel.java:73)
at com.sun.rave.ejb.ui.AddEjbGroupDialog$ConfigureMethodWizardPanel.getComponent(AddEjbGroupDialog.java:312)
at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:577)
at org.openide.WizardDescriptor.goToNextStep(WizardDescriptor.java:691)
at org.openide.WizardDescriptor.access$500(WizardDescriptor.java:63)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:1296)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:383)
at $Proxy15.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:515)
at java.awt.Dialog.show(Dialog.java:536)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:800)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:843)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:831)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1044)
at org.openide.util.Mutex.readAccess(Mutex.java:170)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:816)
at java.awt.Component.show(Component.java:1300)
at java.awt.Component.setVisible(Component.java:1253)
at com.sun.rave.ejb.ui.AddEjbGroupDialog.showDialog(AddEjbGroupDialog.java:94)
at com.sun.rave.ejb.actions.AddEjbGroupAction.performAction(AddEjbGroupAction.java:40)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:450)
at org.openide.util.actions.CallableSystemAction.doPerformAction(CallableSystemAction.java:116)
at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:448)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)I got answer from j2ee forum.
the bug number is 2700883 -
9.0.3 Bug Report:Attribute Wizard:Control Hints
I've run into a major bug in 9.0.3 Preview.
I was editing the display hints for an EO. I double-clicked on the last attribute in the list and nothing happened for a little while (2 seconds?). So I double-clicked the attribute again. When the Attribute Wizard came back up, it had an unexpected error dialog. Since I'm not on the computer that has the error (not connected to Internet), I'll give you a brief overview of the trace:
java.lang.NullPointerException
java.util.HashMap oracle.jbo.dt.jotx.JtJot.getMapFromMsgBundle(oracle.jdeveloper.jot.JotClass)
JtJot.java:2254
java.util.HashMap oracle.jbo.dt.jotx.JtJavaUtil.getMapFromMsgBundle(java.lang.Object)
JtJavaUtil.java:889
java.util.HashMap oracle.jbo.dt.objects.JboObject.readResourceStrings()
JboObject.java:597
java.lang.String oracle.jbo.dt.objects.JboObject.getResourceString(java.lang.String)
JboObject.java:632
void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)
EventDispatchThread.java:93
void java.awt.EventDispatchThread.run()
EventDispatchThread.java:85
Since the Hints "tab" was pre-selected, I received this error for all further Attributes I tried to open via the Attribute Wizard.
When I exited and re-started JDev 9.0.3, I was able to see other properties of all Attributes except the Hints properties (same error as before). Once the Hints "tab" is selected, moving to any other "tab" reports the error.
If you need further information, please feel free to contact me via e-mail or telephone.
Is there any workaround or fix for this, once it has happened?
Thanks, GeorgeNo upgrade. I started an entire new project from scratch in 9.0.3.
Just checked an un-compromised Attribute in an un-compromised Entity. Same problem. Trace follows:
java.lang.NullPointerException
java.util.HashMap oracle.jbo.dt.jotx.JtJot.getMapFromMsgBundle(oracle.jdeveloper.jot.JotClass)
JtJot.java:2254
java.util.HashMap oracle.jbo.dt.jotx.JtJavaUtil.getMapFromMsgBundle(java.lang.Object)
JtJavaUtil.java:889
java.util.HashMap oracle.jbo.dt.objects.JboObject.readResourceStrings()
JboObject.java:597
java.lang.String oracle.jbo.dt.objects.JboObject.getResourceString(java.lang.String)
JboObject.java:632
java.lang.String oracle.jbo.dt.objects.JboAttribute.getAttributeResourceWithSuffix(java.lang.String)
JboAttribute.java:1689
void oracle.jbo.dt.ui.main.misc.ControlHintsPanel.processFormattingOnEnter()
ControlHintsPanel.java:326
void oracle.jbo.dt.ui.main.misc.ControlHintsPanel.initializeControlsFromContext()
ControlHintsPanel.java:126
void oracle.jbo.dt.ui.main.misc.ControlHintsPanel.enter(oracle.jbo.dt.objects.JboNamedObject)
ControlHintsPanel.java:401
void oracle.jbo.dt.ui.main.dlg.DtuWizard.selectPage(oracle.jbo.dt.ui.main.dlg.DtuWizardPanel)
DtuWizard.java:567
void oracle.jbo.dt.ui.main.dlg.DtuWizard.newMddPageSelected(oracle.jbo.dt.ui.main.dlg.DtuWizardPanel)
DtuWizard.java:580
void oracle.jbo.dt.ui.main.dlg.DtjMddTraversable.onEntry(oracle.ide.panels.TraversableContext)
DtuWizard.java:1677
void oracle.ide.panels.MDDPanel.enterTraversableImpl(oracle.ide.panels.Traversable, oracle.ide.panels.TraversableContext)
MDDPanel.java:649
void oracle.ide.panels.MDDPanel.enterTraversable(oracle.ide.panels.Traversable)
MDDPanel.java:630
void oracle.ide.panels.MDDPanel.access$7000571(oracle.ide.panels.MDDPanel, oracle.ide.panels.Traversable)
MDDPanel.java:86
void oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(javax.swing.JTree, javax.swing.tree.TreePath)
MDDPanel.java:928
void oracle.ide.panels.MDDPanel$Tsl.actionPerformed(java.awt.event.ActionEvent)
MDDPanel.java:803
void javax.swing.Timer.fireActionPerformed(java.awt.event.ActionEvent)
Timer.java:150
void javax.swing.Timer$DoPostEvent.run()
Timer.java:108
void java.awt.event.InvocationEvent.dispatch()
InvocationEvent.java:154
void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)
EventQueue.java:337
boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)
EventDispatchThread.java:131
void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)
EventDispatchThread.java:98
void java.awt.Dialog.show()
Dialog.java:380
void java.awt.Component.show(boolean)
Component.java:946
void java.awt.Component.setVisible(boolean)
Component.java:903
void oracle.jbo.dt.ui.main.dlg.DtjDialog.setVisible(boolean)
DtjDialog.java:137
void oracle.jbo.dt.ui.main.dlg.DtjMddWizardDialog.setVisible(boolean)
DtuWizard.java:1774
boolean oracle.bali.ewt.dialog.JEWTDialog.runDialog()
boolean oracle.jbo.dt.ui.main.dlg.DtjDialog.showDialog()
DtjDialog.java:115
boolean oracle.jbo.dt.ui.main.dlg.DtjMddWizardDialog.showDialog()
DtuWizard.java:1735
void oracle.jbo.dt.ui.main.dlg.DtuWizard.createMddWizard()
DtuWizard.java:386
void oracle.jbo.dt.ui.main.dlg.DtuWizard.setVisible(boolean)
DtuWizard.java:276
boolean oracle.jbo.dt.ui.main.dlg.DtuWizard.showDialog()
DtuWizard.java:254
void oracle.jbo.dt.jdevx.ui.JdxMenuManager.invokeEOAttributeDialog(java.awt.Frame, oracle.jbo.dt.objects.JboApplication, oracle.jbo.dt.objects.JboAttribute)
JdxMenuManager.java:798
void oracle.jbo.dt.jdevx.ui.JdxMenuManager.invokeAttributeDialog(oracle.jbo.dt.objects.JboAttribute)
JdxMenuManager.java:789
void oracle.jbo.dt.ui.main.DtuMenuManager.doEditMenuAction(oracle.jbo.dt.objects.JboNamedObject)
DtuMenuManager.java:1079
void oracle.jbo.dt.ui.main.DtuMenuManager.doMenuAction(java.lang.String)
DtuMenuManager.java:946
void oracle.jbo.dt.jdevx.ui.JdxMenuManager.doMenuAction(java.lang.String)
JdxMenuManager.java:533
void oracle.jbo.dt.ui.main.DtuMenuManager.doAction(java.lang.String)
DtuMenuManager.java:791
void oracle.jbo.dt.ui.main.DtuMenuManager.doAction(oracle.jbo.dt.objects.JboApplication, java.lang.Object, java.lang.String)
DtuMenuManager.java:776
void oracle.jbo.dt.ui.main.bced.BceTreePanel.doMenuAction(java.lang.Object, java.lang.String)
BceTreePanel.java:176
void oracle.jbo.dt.ui.main.bced.BceTreePanel.mouseClicked(java.awt.event.MouseEvent)
BceTreePanel.java:311
void java.awt.AWTEventMulticaster.mouseClicked(java.awt.event.MouseEvent)
AWTEventMulticaster.java:211
void java.awt.Component.processMouseEvent(java.awt.event.MouseEvent)
Component.java:3718
void java.awt.Component.processEvent(java.awt.AWTEvent)
Component.java:3544
void java.awt.Container.processEvent(java.awt.AWTEvent)
Container.java:1164
void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)
Component.java:2593
void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
Container.java:1213
void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
Component.java:2497
void java.awt.LightweightDispatcher.retargetMouseEvent(java.awt.Component, int, java.awt.event.MouseEvent)
Container.java:2451
boolean java.awt.LightweightDispatcher.processMouseEvent(java.awt.event.MouseEvent)
Container.java:2230
boolean java.awt.LightweightDispatcher.dispatchEvent(java.awt.AWTEvent)
Container.java:2125
void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
Container.java:1200
void java.awt.Window.dispatchEventImpl(java.awt.AWTEvent)
Window.java:922
void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
Component.java:2497
void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)
EventQueue.java:339
boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)
EventDispatchThread.java:131
void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)
EventDispatchThread.java:98
void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)
EventDispatchThread.java:93
void java.awt.EventDispatchThread.run()
EventDispatchThread.java:85
Since I can't use this, I won't be evaluating 9.0.3 until this is fixed.
Sorry I can't continue to help find bugs.
Thanks, George -
[Bug: JClient tree binding] Workaround for 'random' collapsing of branches
Hi all.. For those of you who have been bothered by a bug in the JClient tree binding model regarding (seemingly) random collapsing of branches, I have a small workaround which may brighten your day. I know it brightened mine. :)
Anyways, here's my situation:
- A JTree with a master VO ("MasterView", for the top) and a detail VO ("DetailView", for the 'body'), recursively bound.
- A JComboBox bound to a VO ("TopsView" or whatever), which is used to 'select a tree'
- When a the currency of TopsView is changed, the selected row's ID is used to build a new tree. I use my own simple synchronizing mechanism, so I can do some additional checks. I suppose you could make MasterView a detail of TopsView, but that's not really important.
masterView.setWhereClause("ID = " + selID);
masterView.executeQuery();At this point, the tree will automatically be rebuilt.
However, based on my experiences, I figure that this is not really the way the JDev guys pictured how I'd work because there's a pretty huge bug which at some point pretty much makes the tree useless (or 'act weird' to say the least).
Here's a description of how to reproduce the bug and some of my observations. I will refer to the collection of currently displayed nodes/records as 'tree'.
1. When you first expand certain branches in the current tree, all goes well. No problems.
2. Next, you use the JComboBox to select another tree. (The new tree will appear totally collapsed.)
3. At this point, you will also be expanding branches 'in that tree', 'for the first time'.
4. After that, you switch back to the first tree.
5. Now it becomes interesting: when you expand ANY branch that you previously expanded in this tree, the bug will surface (details will follow). When you expand branches that you DID NOT expand during your last visit to this tree, all goes well -- no problems.
Note that re-expanding a branch after manually collapsing it, does not cause the bug. The key is that you expand a branch for the first time during a 'visit' to this tree (ie, so that it has to gather it's child nodes).
Details about the bug:
- The problem surfaces when expanding certain branches. (See above.)
- Effects will vary from collapsing different branches under the same parent node to collapsing the entire tree.
- The selection in the JTree component (or its selection model, if you will) will also be canceled.
Observations:
- It seems that JClient was not designed to handle multiple trees (as described above). It appears that, before the newly selected tree is built, the old tree has not been properly cleaned up. By this I mean the collection of JUTreeNodeBinding objects, which continue to refer to DefaultMutableTreeNodeBinding objects of the destroyed tree. In effect, these orphaned objects continue to work their magic in the background and will influence the JTree and its associated objects in a way so that this problem (and possibly others) surfaces.
The workaround I will present below is designed to suppress this problem. It does not deal with orphaned objects in a proper way, it will merely partially suppress their functionality.
How to suppress the bug:
- In case you haven't done so already, you have to copy the source file of oracle.jbo.uicli.jui.JUTreeNodeBinding into your project directory and then make small modification to it.
- On line 482 (if I'm not mistaken), you will see //if (al.size() > 0) Change it to if (!(mTreeNode.getParent() == null && getParent() != null)) Now the enclosed code will only be executed when the tree is fully synchronized (as in: the 'tree' of JUTreeNodeBinding objects has the same structure as the 'current tree' of DefaultMutableTreeNodeBinding objects).
In a nutshell, it checks whether the parents of this JUTreeNodeBinding object and the associated DefaultMutableTreeNode object are not null. Because in case it concerns an 'orphaned' JUTreeNodeBinding object, the parent of its associated DefaultMutableTreeNode object will be null. However, in case it concerns the tree's root node, both parents will be null, in which case this condition will have to evaluate to true as well.
I hope that this information will be of use to others :) and that possibly someone of the JDev team could comment on this matter. Thanks.One question though. What exactly do you mean by 'copy
the source file of
oracle.jbo.uicli.jui.JUTreeNodeBinding into your
project directory'.. would I need to change the package
name of this binding, and modify the client code
somewhere to have it use my modified version? Or will
it use this local copy instead of the original one?The simplest way to go is to create a new (empty) class in your project, which is to be located in the package "oracle.jbo.uicli.jui", and name it "JUTreeNodeBinding". Next, open the source of the original JUTreeNodeBinding class and copy-paste it into your newly created class in JDeveloper.
Now, when you run your application, it will use your 'custom' version of JUTreeNodeBinding, while it will function exactly the same. You can make any modifications, like the one I suggested in my original post, in this class.
Good luck. -
I created a subclass of JWindow which acts as a popup when the appropriate mousebutton is clicked. A JTree is shown in an etched border and when the user selects an item in the tree it updates the JTextField the popup is connected to. It is similar in concept to a JComboBox but rather then a list, it uses a tree. It is connected to two JTextFields in a subclass of JDialog. This works great when dialog box is run in the applet window under VAJ. However, when the dialog box is created (.show()) from within a JApplet in the browser it appears fine when the right mouse button is pressed in the appropriate JTextField but as soon as a mouse button is pressed within the popped up JTree, the popped up window (JWindow subclass) is forced behind the other window. If the roller on the microsoft mouse is used the jtree can be scrolled but if I try to manipulate the scrollbar the window disappears behind the parent window. How can I lock the window in place until I dispose of it??
Thanks,
WaltThe problem is actually a problem in VAJ. The code generated by the VCE does not allow for creating the popup with a parent window. It is still unclear why when it was created on top of the 'parent' window and the scrollbar should have digested the mouse event, that the mouse event percolated through the popup to the underlying window, causing it to gain focus and be placed on top in the Z order. Anyone that can answer that one get the duke bucks too. What I did was modify the alternative constructors for the popup to initialize the window (set the listeners) which appears to be another bug in VAJ and then manually create the popup as invisible. Normally VAJ uses lazy construction to only construct the object upon first reference. Since that code is automatically regenerated by the VCE I couldn't modify it.
Another question is why does the JWindow appear with the foolish "Java Applet Window" text in a status area. And why does a JWindow even have a status area? The drop down list of a JComboBox doesn't have one. And that was really all I wanted was a JComboBox with a tree instead of a list. So if anyone can address that, there are duke dollars available for it as well.
So the questions are:
1) why does the mouse action percolate through the popup window, which should have captured and digested it, even if only through the scrollbar logic?
2) what does the JWindow based popup get stuck with the "Java Applet Window" text in an unwanted status area.
3) how could this simply be like a JComboBox with a drop down JTree, as opposed to drop down list?
Thanks,
Walt -
Discontiguous selection model on a jtree
Hi Frank
I have a jtree bound to and adf model. i have set the branch accessor rule on the binding.
when i set the selection model to discontiguous then it wont allow me to crtl select all the items .
it does however allow me to select some of the items but i cannot do things such as select mutiple parent nodes.
is there any bug that you know about.
please if any one can help
thanks
GeorgeOur tree binding only supports single selection by default since there is only really the notion in a rowset of a single "current" row. Our developers believe that you can implement your own custom selection model to give some application-specific meaning to what the multiple-select would do in your app, but we have not thoroughly tested custom selection models with the JTree.
-
Hello all,
is there a way to drag row(s) of a JTable to a node in a JTree?
I have a JTree that�s Drag and Drop enabled and wrks fine dragging one node to another (one by one...), but now I want to get data from a table to this tree. I have tried the method setDragEnabled(boolean) in the JTable object, but it didnt work...
thanks
D@zedThis is related to bug 5011850:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5011850
Crashes in the same place. -
JTree rendering failure : big empy space displayed
Hello,
I have a problem using a JTree with jdk 1.5 update 10. I could not find anything in the bug database that seemed to link to this problem.
I have created a JTree that displays the content of a directory under a root node (displayed). I have created my own renderer to customize the labels and i use a TreeModel to add and remove nodes.
The problem (possibly a known bug): sometimes (it actually seems to be completely random), the Ttree "fails" rendering one of the label, resulting in a big white space instead of the usual label (icon + file name). Other labels in the tree are displayed correctly. The "big white label" can be selected and correctly links to the file it represents (information about the file is displayed correctly). All in all, everything works perfectly fine except one item is displayed as a big empty label.
Is there any chance this could be a java bug ? If not is there any way i could know what causes this failure ?
Regards.
NB: some friend of mine that is working on a different project has exactly the same problem and can't find a solution either.I am having the identical problem and its driving me crazy. This started happening to me after I installed new hard drives and reinstalled the OS. I then transfered all the old settings from the old drive. Everything else seems to work perfectly. If you get anywhere with this let me know.
Hy
My goal: To import some pictures into iMovie. Maby
add ken burns efects to them, add a bit of narration
and some music, edit everything and export.
The problem: Let say I use the following method: i
click Media tab, then i click photos, then i select
the photo, and in the Photo Settings click apply.
iMovie then imports the photo, puts it in the
timeline and then the dark red bar bellow apears (the
one that would means rendering). The problem is,
there is no light red getting over it (that would
indicate rendering in progress). It's the same if i
click and drag a photo into the clip browser (only
the dark red is displayed on the bottom of the
thumbnail). If i try to quit iMovie it warns me that
rendering is in progress.
It doesn't matter how big a photo is (i tried
300x200px, 800x500px, 1500x1000px, 3000x2000px) or
what format (jpg, tiff, png).
I tried restarting the application and the sistem. I
created another user to try if anything changes. I
erased the preferences. I even tried copying the
whole application from frend's computer (the same
version and all). The dark red bar doesn't start to
fill red (i checked in the terminal how much
processor does it eat and it's on 7%, so it probablly
means it's doing nothing)
I have a 2Ghz, 2GB of ram Macbook 13" Intel core duo.
I have 67 GB of space left (format: Mac-os extended -
journaled), running OS-X 10.4.8 and updated to the
latest updates. iMovie version is 6.0.3 (267.2).
What else is there to do? Would reinstalling the
whole sistem help and is there a way to keep all of
my preferences and mail accounts and contacts, … in
case i have to do that?
thx in advance
Peter
Macbook 13"
Mac OS X (10.4.8)
Maybe you are looking for
-
Download past purchases in iTunes on Mac
Running iTunes on my Mac and when I try to download past purchases, I get: "This computer is already associated with an Apple ID. You can download past purchases on this computer with just one Apple ID every 90 days. This computer can be used with a
-
Hi, Please refer to the note number SAP Note 1591291 - GRC 10.0 - HR Trigger configuration for HR Trigger configuration. The materials are in below like: https://sapmats-de.sap-ag.de/download/download.cgi?id=5KU0MSXE2SCM78GJU8MM5W3P21VXU8IXYNAYO135V6
-
Jtable in frame is not getting resized
Hi, I am not able to resize the jtable when I resize the frame. When I drag the corner of the frame with mouse , the frame gets resized but the table size remains same. I am using table.setPrefferedscrollableviewportsize to set the size. I don't know
-
Configure sharepoint 2013 with Microsoft exchange 2010
Hi, I am want to configure SharePoint 2013 with Microsoft exchange 2010. Please let me how can I integrate these server to Send/ Receive domain E-mails. Thanks, C Mahone
-
Questioning Adobes Upgrade policies
I have been an Adobe user all the way back to PS5 and I have purchased every upgrade all the way to PS CS3 Design Premium. Same with Illustrator. I've had Lightroom ver 1,2 and 3. Also, Indesign ver 4 thru CS3. When I purchased Adobe CS Standard t