JTree adding nodes
Hello all,
I have two questions concerning Trees,
1. I have created the Tree by the JTree(Vector) method, initially the vector does have some elements but i have to add some more later, so when my vector gets updated how can I add the same element to the tree in the form of a node?
2. The Tree being created like this, has automatically generated names for the nodes (i guess it shows the memory address) but i want to change the name of all of my nodes, what is the method for renaming nodes?
There are two pieces of Trees that you have not yet found. The first is the TreeModel, which is accessible through myTree.getModel(). You can use this model to create the data structure; the JTree object is simply a view of that model.
The second piece is the TreeCellRenderer, accessible through myTree.getCellRenderer(). This renderer is used to draw the nodes of the tree and, by default, one is used that renders the Strings returned by the toString() method of the objects in the model. To display different strings, you can either (1) replace the renderer or (2) override the toString() method on the objects in your model. The first is recommended if the strings vary radically from the desired result of toString() or if toString() is being used for something else; the second is recommended for simplistic models or for situations in which the display properly reflects the nature of the object.
Replacing the renderer also allows you to use any JComponent for rendering you wish. This can give you the ability to present gradient backgrouns, dynamically loaded icons, etc.
Many objects in Swing use this format in which there are three portions of an object: the view (which is the standard object, like an instance of JTree, JList, or JTable), the model (which contains the actual data structure), and the renderer (which acts like a rubber stamp to draw the objects without causing more than one object to be instantiated to render thousand-element lists).
Similar Messages
-
How can I view the newly added node in a JTree
Hi! I have a problem with my project. I set up a JTree. At first it has a node that contains FARInfo object. When I click this node, the other program in the package will pop up a form to let user input and submit, then it will add a new node into the other node. The new node will contain FilledInfo object. But I cannot view this newly added node. The source code related with the 2 different object is as following:
tree.addTreeSelectionListener( new TreeSelectionListener()
public void valueChanged(TreeSelectionEvent e4)
DefaultMutableTreeNode node = ( DefaultMutableTreeNode )
(tree.getLastSelectedPathComponent ());
Object nodeInfo = node.getUserObject();
if (node.isLeaf())
if ( nodeInfo instanceof FARInfo )
FARInfo category = (FARInfo) nodeInfo;
displayURL ( category.categoryURL );
displayForm ( category.farFormName );
if ( DEBUG )
System.out.print ( category.categoryURL + ":\n" );
else if ( nodeInfo instanceof FilledInfo )
FilledInfo category2 = ( FilledInfo ) nodeInfo;
displayFilledForm ( category2.num );
}else
return;
My question is: how to deal with the nodes containing 2 different objects: FARInfo and FilledInfo? FilledInfo is created by the other program in the package. Thanks for your help!I used insertNodeInto() to inser a new node into the tree, and it can be displayed. But when I used addTreeSelectionListener() to click on the newly added node, it cann not reaspond the click. Following is my original addTreeSelectionListener(). You see, if you click a node of FARInfo, then it will open a form, and after user filled in and submit it, a new node will be added into the Jtree. If you click a node of FilledInfo, then the user should view the content of this new node. But now, it seems that the sencond click cannot work. Thanks for your help.
tree.addTreeSelectionListener( new TreeSelectionListener()
public void valueChanged(TreeSelectionEvent e4)
DefaultMutableTreeNode node = ( DefaultMutableTreeNode )
(tree.getLastSelectedPathComponent ());
Object nodeInfo = node.getUserObject();
if (node.isLeaf())
if ( nodeInfo instanceof FARInfo )
FARInfo category = (FARInfo) nodeInfo;
displayURL ( category.categoryURL );
displayForm ( category.farFormName );
if ( DEBUG )
System.out.print ( category.categoryURL + ":\n" );
else if ( nodeInfo instanceof FilledInfo )
FilledInfo category2 = ( FilledInfo ) nodeInfo;
displayFilledForm ( category2.num );
}else
return; -
Dynamically adding nodes without a TreeModel
Hi,
I am adding nodes dynamically after the tree is visible. It's adding
the first child node I create and it is showing it. When I add a second
node, it doesn't show the that. And when I debug the code I found that
the node was added to the tree but it is not visible. I tried by
expanding and collapsing the tree manually, but it didn't work.
I am not using any TreeModel as such. So, how do I make the change
visible??? I am even calling the repaint() method of JTree, what could
be the problem and is it better if I create my own TreeModel class and
use it???
Thank you,
Srikanth...you can post the code for start.
try to get the model and fire
fireTreeStructureChanged(that will collapse all)
or try to fire fireTreeNodesInserted
for my point of view
implamenting the TreeModel is always better and simple -
JTree, adding all directories to my tree
Hi, i'm creating a JTree to look at all the files on my computer, but i dont know how to add all of the files on my computer. I can add folders and all of their subfolders, but what i want to do is make it look, or have the same functionality as Windows Explorer more or less, so that right when i open my program, i have access to all files/folders on my hard drive or the network.
If i run my own algorithm it takes forever to build the tree, or crashes..
Does anyone know if there is some default setting or some method i should run?
This is how i am declaring my tree:
top = new DefaultMutableTreeNode("...");
jTree = new JTree(top); jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);and then i just add to it by adding nodes to "top";
Thanks!you need to write a tree model to represent the file system and then load that in to the jtree.
if you just load entire structure in to a default structure it will take a long time to start if your disk has lots of files.
if you take a look at TreeNode or TreeModel interfaces in the documentation you will beable to figure out where to start -
Adding node back into cluster after removal...
Hi,
I removed a cluster node using "scconf -r -h <node>" (carried out all the other usual removal steps before getting this command to work).
Because this is a pair+1 cluster and the node i was trying to remove was physically attached to the quroum device (scsi), I had to create a dummy node before the removal command above would work.
I reinstalled solaris, SC3.1u4 framwork, patches etc. and then tried to run scsinstall again on the node (reintroduced the node to the cluster again first using scconf -a -T node=<node>).
However! during the scsinstall i got the following problem:
Updating file ("ntp.conf.cluster") on node n20-2-sup ... done
Updating file ("hosts") on node n20-2-sup ... done
Updating file ("ntp.conf.cluster") on node n20-3-sup ... done
Updating file ("hosts") on node n20-3-sup ... done
scrconf: RPC: Unknown host
scinstall: Failed communications with "bogusnode"
scinstall: scinstall did NOT complete successfully!
Press Enter to continue:
Was not sure what to do at this point, but since the other clusternodes could now see my 'new' node again, i removed the dummy node, rebooted the new node and said a little prayer...
Now, my node will not boot as part of the cluster:
Rebooting with command: boot
Boot device: /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w21000004cfa3e691,0:a File and args:
SunOS Release 5.10 Version Generic_127111-06 64-bit
Copyright 1983-2007 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: n20-1-sup
/usr/cluster/bin/scdidadm: Could not load DID instance list.
Cannot open /etc/cluster/ccr/did_instances.
Booting as part of a cluster
NOTICE: CMM: Node n20-1-sup (nodeid = 1) with votecount = 0 added.
NOTICE: CMM: Node n20-2-sup (nodeid = 2) with votecount = 2 added.
NOTICE: CMM: Node n20-3-sup (nodeid = 3) with votecount = 1 added.
NOTICE: CMM: Node bogusnode (nodeid = 4) with votecount = 0 added.
NOTICE: clcomm: Adapter qfe5 constructed
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-2-sup:qfe5 being constructed
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-3-sup:qfe5 being constructed
NOTICE: clcomm: Adapter qfe1 constructed
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-2-sup:qfe1 being constructed
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-3-sup:qfe1 being constructed
NOTICE: CMM: Node n20-1-sup: attempting to join cluster.
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-2-sup:qfe1 being initiated
NOTICE: CMM: Node n20-2-sup (nodeid: 2, incarnation #: 1205318308) has become reachable.
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-2-sup:qfe1 online
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-3-sup:qfe5 being initiated
NOTICE: CMM: Node n20-3-sup (nodeid: 3, incarnation #: 1205265086) has become reachable.
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-3-sup:qfe5 online
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-3-sup:qfe1 being initiated
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-3-sup:qfe1 online
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-2-sup:qfe5 being initiated
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-2-sup:qfe5 online
NOTICE: CMM: Cluster has reached quorum.
NOTICE: CMM: Node n20-1-sup (nodeid = 1) is up; new incarnation number = 1205346037.
NOTICE: CMM: Node n20-2-sup (nodeid = 2) is up; new incarnation number = 1205318308.
NOTICE: CMM: Node n20-3-sup (nodeid = 3) is up; new incarnation number = 1205265086.
NOTICE: CMM: Cluster members: n20-1-sup n20-2-sup n20-3-sup.
NOTICE: CMM: node reconfiguration #18 completed.
NOTICE: CMM: Node n20-1-sup: joined cluster.
NOTICE: CMM: Node (nodeid = 4) with votecount = 0 removed.
NOTICE: CMM: Cluster members: n20-1-sup n20-2-sup n20-3-sup.
NOTICE: CMM: node reconfiguration #19 completed.
WARNING: clcomm: per node IP config clprivnet0:-1 (349): 172.16.193.1 failed with 19
WARNING: clcomm: per node IP config clprivnet0:-1 (349): 172.16.193.1 failed with 19
cladm: CLCLUSTER_ENABLE: No such device
UNRECOVERABLE ERROR: Sun Cluster boot: Could not initialize cluster framework
Please reboot in non cluster mode(boot -x) and Repair
syncing file systems... done
WARNING: CMM: Node being shut down.
Program terminated
{1} ok
Any ideas how i can recover this situation without having to reinstall the node again?
(have a flash with OS, sc3.1u4 framework etc... so not the end of the world but...)
Thanks a mil if you can help here!
- headwreckedHi - got sorted with this problem...
basically just removed (scinstall -r) the sc3.1u4 software from the node which was not booting, and then re-installed the software (this time the dummy node had been removed so it did not try to contact this node and the scinstall completed without any errors)
I think the only problem with the procedure i used to remove and readd the node was that i forgot to remove the dummy node before re-adding the actaul cluster node again...
If anyone can confirm this to be the case then great - if not... well its working now so this thread can be closed.
root@n20-1-sup # /usr/cluster/bin/scinstall -r
Verifying that no unexpected global mounts remain in /etc/vfstab ... done
Verifying that no device services still reference this node ... done
Archiving the following to /var/cluster/uninstall/uninstall.1036/archive:
/etc/cluster ...
/etc/path_to_inst ...
/etc/vfstab ...
/etc/nsswitch.conf ...
Updating vfstab ... done
The /etc/vfstab file was updated successfully.
The original entry for /global/.devices/node@1 has been commented out.
And, a new entry has been added for /globaldevices.
Mounting /dev/dsk/c3t0d0s6 on /globaldevices ... done
Attempting to contact the cluster ...
Trying "n20-2-sup" ... okay
Trying "n20-3-sup" ... okay
Attempting to unconfigure n20-1-sup from the cluster ... failed
Please consider the following warnings:
scrconf: Failed to remove node (n20-1-sup).
scrconf: All two-node clusters must have at least one shared quorum device.
Additional housekeeping may be required to unconfigure
n20-1-sup from the active cluster.
Removing the "cluster" switch from "hosts" in /etc/nsswitch.conf ... done
Removing the "cluster" switch from "netmasks" in /etc/nsswitch.conf ... done
** Removing Sun Cluster framework packages **
Removing SUNWkscspmu.done
Removing SUNWkscspm..done
Removing SUNWksc.....done
Removing SUNWjscspmu.done
Removing SUNWjscspm..done
Removing SUNWjscman..done
Removing SUNWjsc.....done
Removing SUNWhscspmu.done
Removing SUNWhscspm..done
Removing SUNWhsc.....done
Removing SUNWfscspmu.done
Removing SUNWfscspm..done
Removing SUNWfsc.....done
Removing SUNWescspmu.done
Removing SUNWescspm..done
Removing SUNWesc.....done
Removing SUNWdscspmu.done
Removing SUNWdscspm..done
Removing SUNWdsc.....done
Removing SUNWcscspmu.done
Removing SUNWcscspm..done
Removing SUNWcsc.....done
Removing SUNWscrsm...done
Removing SUNWscspmr..done
Removing SUNWscspmu..done
Removing SUNWscspm...done
Removing SUNWscva....done
Removing SUNWscmasau.done
Removing SUNWscmasar.done
Removing SUNWmdmu....done
Removing SUNWmdmr....done
Removing SUNWscvm....done
Removing SUNWscsam...done
Removing SUNWscsal...done
Removing SUNWscman...done
Removing SUNWscgds...done
Removing SUNWscdev...done
Removing SUNWscnmu...done
Removing SUNWscnmr...done
Removing SUNWscscku..done
Removing SUNWscsckr..done
Removing SUNWscu.....done
Removing SUNWscr.....done
Removing the following:
/etc/cluster ...
/dev/did ...
/devices/pseudo/did@0:* ...
The /etc/inet/ntp.conf file has not been updated.
You may want to remove it or update it after uninstall has completed.
The /var/cluster directory has not been removed.
Among other things, this directory contains
uninstall logs and the uninstall archive.
You may remove this directory once you are satisfied
that the logs and archive are no longer needed.
Log file - /var/cluster/uninstall/uninstall.1036/log
root@n20-1-sup #
Ran the scinstall again:
>>> Confirmation <<<
Your responses indicate the following options to scinstall:
scinstall -ik \
-C N20_Cluster \
-N n20-2-sup \
-M patchdir=/var/cluster/patches \
-A trtype=dlpi,name=qfe1 -A trtype=dlpi,name=qfe5 \
-m endpoint=:qfe1,endpoint=switch1 \
-m endpoint=:qfe5,endpoint=switch2
Are these the options you want to use (yes/no) [yes]?
Do you want to continue with the install (yes/no) [yes]?
Checking device to use for global devices file system ... done
Installing patches ... failed
scinstall: Problems detected during extraction or installation of patches.
Adding node "n20-1-sup" to the cluster configuration ... skipped
Skipped node "n20-1-sup" - already configured
Adding adapter "qfe1" to the cluster configuration ... skipped
Skipped adapter "qfe1" - already configured
Adding adapter "qfe5" to the cluster configuration ... skipped
Skipped adapter "qfe5" - already configured
Adding cable to the cluster configuration ... skipped
Skipped cable - already configured
Adding cable to the cluster configuration ... skipped
Skipped cable - already configured
Copying the config from "n20-2-sup" ... done
Copying the postconfig file from "n20-2-sup" if it exists ... done
Copying the Common Agent Container keys from "n20-2-sup" ... done
Setting the node ID for "n20-1-sup" ... done (id=1)
Verifying the major number for the "did" driver with "n20-2-sup" ... done
Checking for global devices global file system ... done
Updating vfstab ... done
Verifying that NTP is configured ... done
Initializing NTP configuration ... done
Updating nsswitch.conf ...
done
Adding clusternode entries to /etc/inet/hosts ... done
Configuring IP Multipathing groups in "/etc/hostname.<adapter>" files
IP Multipathing already configured in "/etc/hostname.qfe2".
Verifying that power management is NOT configured ... done
Ensure that the EEPROM parameter "local-mac-address?" is set to "true" ... done
Ensure network routing is disabled ... done
Updating file ("ntp.conf.cluster") on node n20-2-sup ... done
Updating file ("hosts") on node n20-2-sup ... done
Updating file ("ntp.conf.cluster") on node n20-3-sup ... done
Updating file ("hosts") on node n20-3-sup ... done
Log file - /var/cluster/logs/install/scinstall.log.938
Rebooting ...
Mar 13 13:59:13 n20-1-sup reboot: rebooted by root
Terminated
root@n20-1-sup # syncing file systems... done
rebooting...
R
LOM event: +103d+20h44m26s host reset
screen not found.
keyboard not found.
Keyboard not present. Using lom-console for input and output.
Sun Netra T4 (2 X UltraSPARC-III+) , No Keyboard
Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved.
OpenBoot 4.10.1, 4096 MB memory installed, Serial #52960491.
Ethernet address 0:3:ba:28:1c:eb, Host ID: 83281ceb.
Initializing 15MB Rebooting with command: boot
Boot device: /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w21000004cfa3e691,0:a File and args:
SunOS Release 5.10 Version Generic_127111-06 64-bit
Copyright 1983-2007 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: n20-1-sup
Configuring devices.
devfsadm: minor_init failed for module /usr/lib/devfsadm/linkmod/SUNW_scmd_link.so
Loading smf(5) service descriptions: 24/24
/usr/cluster/bin/scdidadm: Could not load DID instance list.
Cannot open /etc/cluster/ccr/did_instances.
Booting as part of a cluster
NOTICE: CMM: Node n20-1-sup (nodeid = 1) with votecount = 0 added.
NOTICE: CMM: Node n20-2-sup (nodeid = 2) with votecount = 2 added.
NOTICE: CMM: Node n20-3-sup (nodeid = 3) with votecount = 1 added.
NOTICE: clcomm: Adapter qfe5 constructed
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-2-sup:qfe5 being constructed
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-3-sup:qfe5 being constructed
NOTICE: clcomm: Adapter qfe1 constructed
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-2-sup:qfe1 being constructed
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-3-sup:qfe1 being constructed
NOTICE: CMM: Node n20-1-sup: attempting to join cluster.
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-2-sup:qfe1 being initiated
NOTICE: CMM: Node n20-2-sup (nodeid: 2, incarnation #: 1205318308) has become reachable.
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-2-sup:qfe1 online
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-3-sup:qfe5 being initiated
NOTICE: CMM: Node n20-3-sup (nodeid: 3, incarnation #: 1205265086) has become reachable.
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-3-sup:qfe5 online
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-2-sup:qfe5 being initiated
NOTICE: clcomm: Path n20-1-sup:qfe5 - n20-2-sup:qfe5 online
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-3-sup:qfe1 being initiated
NOTICE: clcomm: Path n20-1-sup:qfe1 - n20-3-sup:qfe1 online
NOTICE: CMM: Cluster has reached quorum.
NOTICE: CMM: Node n20-1-sup (nodeid = 1) is up; new incarnation number = 1205416931.
NOTICE: CMM: Node n20-2-sup (nodeid = 2) is up; new incarnation number = 1205318308.
NOTICE: CMM: Node n20-3-sup (nodeid = 3) is up; new incarnation number = 1205265086.
NOTICE: CMM: Cluster members: n20-1-sup n20-2-sup n20-3-sup.
NOTICE: CMM: node reconfiguration #23 completed.
NOTICE: CMM: Node n20-1-sup: joined cluster.
ip: joining multicasts failed (18) on clprivnet0 - will use link layer broadcasts for multicast
NOTICE: CMM: Votecount changed from 0 to 1 for node n20-1-sup.
NOTICE: CMM: Cluster members: n20-1-sup n20-2-sup n20-3-sup.
NOTICE: CMM: node reconfiguration #24 completed.
Mar 13 14:02:23 in.ndpd[351]: solicit_event: giving up on qfe1
Mar 13 14:02:23 in.ndpd[351]: solicit_event: giving up on qfe5
did subpath /dev/rdsk/c1t3d0s2 created for instance 2.
did subpath /dev/rdsk/c2t3d0s2 created for instance 12.
did subpath /dev/rdsk/c1t3d1s2 created for instance 3.
did subpath /dev/rdsk/c1t3d2s2 created for instance 6.
did subpath /dev/rdsk/c1t3d3s2 created for instance 7.
did subpath /dev/rdsk/c1t3d4s2 created for instance 8.
did subpath /dev/rdsk/c1t3d5s2 created for instance 9.
did subpath /dev/rdsk/c1t3d6s2 created for instance 10.
did subpath /dev/rdsk/c1t3d7s2 created for instance 11.
did subpath /dev/rdsk/c2t3d1s2 created for instance 13.
did subpath /dev/rdsk/c2t3d2s2 created for instance 14.
did subpath /dev/rdsk/c2t3d3s2 created for instance 15.
did subpath /dev/rdsk/c2t3d4s2 created for instance 16.
did subpath /dev/rdsk/c2t3d5s2 created for instance 17.
did subpath /dev/rdsk/c2t3d6s2 created for instance 18.
did subpath /dev/rdsk/c2t3d7s2 created for instance 19.
did instance 20 created.
did subpath n20-1-sup:/dev/rdsk/c0t6d0 created for instance 20.
did instance 21 created.
did subpath n20-1-sup:/dev/rdsk/c3t0d0 created for instance 21.
did instance 22 created.
did subpath n20-1-sup:/dev/rdsk/c3t1d0 created for instance 22.
Configuring DID devices
t_optmgmt: System error: Cannot assign requested address
obtaining access to all attached disks
n20-1-sup console login: -
Can't start EM after adding node to cluster
Hi, I don't know if i choose the right forum. I have a problem with OEM after adding node to the cluster: It gives me an error:
[oracle@nodedc3 bin]$ emctl start dbconsole
Can't do setuid (cannot exec sperl)I think i can be a permissions issue like it was in my second thread. ThanksHi, i have this package installed:
[root@nodedc3 ~]# yum install perl-suidperl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirror.linuxwerk.com
* extras: ftp.plusline.de
* updates: mirror.optimate-server.de
Setting up Install Process
Package 4:perl-suidperl-5.8.8-40.el5_9.x86_64 already installed and latest version
Nothing to doOEM on other nodes works perfectlly. Thanks -
Adding nodes to cluster in 10g r2 10.1.0.3
I apologize if this is a repeat but my browser crashed before I could watch my post. I am asking a hypothetical question regarding adding nodes to the cluster. I am trying to get a feel for how much risk is involved in the operation and if there is any chance we could corrupt the current configuration?
I was reading the article from Murali Vallath and notice that he made it a point to say that you should make a full cold backup before you perfrom step 6...
Step 6: Add New Instance(s)
DBCA has all the required options to add additional instances to the cluster.
Requirements:
Make a full cold backup of the database before commencing the upgrade process.
Is there risk of corrupting the database during this step?
We are running 10.2.0.3 on linux Itanium on RHEL4 and we are running a 2 node cluster. We are using OCFS2 for the OCR and Voting devices and we are using ASM and also ASMLIB for our shared storage option. We also are running EMC Powerpath on our hosts.
Any tips or heads up would be greatly appreciated.
Thanks.Duplicate post :- adding nodes to cluster in 10g r2 10.1.0.3
-
Not able to start DB after adding node
Hi all,
I have successfully added node RAC3 in 11gR2 RAC in RHEL5 Platfiorm
while starting DB I am getting the below error
[root@rac1 bin]# ./srvctl status database -d dev
Instance dev1 is not running on node rac1
Instance dev2 is not running on node rac2
Instance dev3 is not running on node rac3
[root@rac1 bin]# ./srvctl start database -d dev
PRCR-1079 : Failed to start resource ora.dev.db
ORA-29760: instance_number parameter not specified
CRS-2674: Start of 'ora.dev.db' on 'rac3' failed
CRS-2632: There are no more servers to try to place resource 'ora.dev.db' on that would satisfy its placement policy
[root@rac1 bin]# ./srvctl status database -d dev
Instance dev1 is running on node rac1
Instance dev2 is running on node rac2
Instance dev3 is not running on node rac3
[root@rac1 bin]#
[root@rac1 bin]# ./srvctl start database -d dev
PRCR-1079 : Failed to start resource ora.dev.db
ORA-29760: instance_number parameter not specified
CRS-2674: Start of 'ora.dev.db' on 'rac3' failed
CRS-2632: There are no more servers to try to place resource 'ora.dev.db' on that would satisfy its placement policyPlease suggest me...I m getting the below :
[grid@rac3 ~]$ srvctl start database -d dev
PRCR-1079 : Failed to start resource ora.dev.db
ORA-01078: failure in processing system parameters
CRS-2674: Start of 'ora.dev.db' on 'rac2' failed
ORA-01078: failure in processing system parameters
CRS-2674: Start of 'ora.dev.db' on 'rac3' failed
ORA-01078: failure in processing system parameters
CRS-2674: Start of 'ora.dev.db' on 'rac1' failed
CRS-2632: There are no more servers to try to place resource 'ora.dev.db' on that would satisfy its placement policy
[grid@rac3 ~]$ srvctl status database -d dev
Instance dev1 is not running on node rac1
Instance dev2 is not running on node rac2
Instance dev3 is not running on node rac3
[grid@rac3 ~]$ Parameter file
[oracle@rac3 dbs]$ cat init_dev2.ora
dev3.__db_cache_size=272629760
dev2.__db_cache_size=272629760
dev1.__db_cache_size=281018368
dev3.__java_pool_size=4194304
dev2.__java_pool_size=4194304
dev1.__java_pool_size=4194304
dev3.__large_pool_size=4194304
dev2.__large_pool_size=4194304
dev1.__large_pool_size=4194304
dev1.__oracle_base='/raczone/11.2.0'#ORACLE_BASE set from environment
dev2.__oracle_base='/raczone/11.2.0'#ORACLE_BASE set from environment
dev3.__oracle_base='/raczone/11.2.0'#ORACLE_BASE set from environment
dev3.__pga_aggregate_target=343932928
dev2.__pga_aggregate_target=343932928
dev1.__pga_aggregate_target=343932928
dev3.__sga_target=507510784
dev2.__sga_target=507510784
dev1.__sga_target=507510784
dev3.__shared_io_pool_size=0
dev2.__shared_io_pool_size=0
dev1.__shared_io_pool_size=0
dev3.__shared_pool_size=218103808
dev2.__shared_pool_size=218103808
dev1.__shared_pool_size=209715200
dev3.__streams_pool_size=0
dev2.__streams_pool_size=0
dev1.__streams_pool_size=0
*.audit_file_dest='/raczone/11.2.0/admin/dev/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA1/dev/controlfile/current.260.786380999','+FRA/dev/controlfile/current.256.786380999'
*.db_block_size=8192
*.db_create_file_dest='+DATA1'
*.db_domain=''
*.db_name='dev'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/raczone/11.2.0'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=devXDB)'
dev1.instance_number=1
dev2.instance_number=2
dev3.instance_number=3
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=848297984
*.open_cursors=300
*.processes=150
*.remote_listener='scan-cluster.raczone.com:1521'
*.remote_login_passwordfile='exclusive'
dev3.thread=3
dev1.thread=1
dev2.thread=1
dev3.undo_tablespace='UNDOTBS3'
dev2.undo_tablespace='UNDOTBS2'
dev1.undo_tablespace='UNDOTBS1'
[oracle@rac3 dbs]$ -
Remove background in JTree's node
How to remove colored background in JTree's node?
http://www.builder.cz/images/client-tree.gif - here is example how it looks like...from reading understand white would be best...
You may have misunderstood.
In the image you posted there seems to be a problem with a part that strongly reflects the background for example.
The »ideal« color for efficient clipping depends on the object being photographed, even a green screen would be problematic with an object of a similar green.
What is the file format you need anyway? psd with transparency or eps with Clipping Path or …?
Like Silkrooster pointed out Actions and Image Processor, but also Scripts, can help with automising the task with Photoshop – but quite frankly I expect results so bad that each image would likely have to be checked and improved manually. -
Have a problem with JTree
A node I call folderNode will normally contain sub-nodes with names lik subnode1,subnode2,subnode3 etc. (Just examples)
The folder node will then represent the range, so for one with the mentioned subnodes, name would be "subnode1- subnode3".
To update this foldername after I have deleted say nr 3, I use "theFolderNode.setUserObject("new name here")), and then treeModel.nodeChanged(theFolderNode); I would then expect "subnode1- subnode2". (Don't mind the method of finding the correct label..)
If I then try to get the new userObject and checking by typing:
System.out.println(theFolderNode.getUserObject().toString()); - I actually get out what I want, but the label of the FolderNode is still not updated..
What am I missing here??Here is an excert from an article from javaworld
"The Java programmer must keep in mind that it is the garbage collector that runs finalizers on objects. Because it is not generally possible to predict exactly when unreferenced objects will be garbage collected, it is not possible to predict when object finalizers will be run. Java programmers, therefore, should avoid writing code for which program correctness depends upon the timely finalization of objects. For example, if a finalizer of an unreferenced object releases a resource that is needed again later by the program, the resource will not be made available until after the garbage collector has run the object finalizer. If the program needs the resource before the garbage collector has gotten around to finalizing the unreferenced object, the program is out of luck."
http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
Generally without any tweaking the GC only runs when it has to, so your memory with be recycled then.
You can call System.gc() but that doesn't cause garbage recycling, but rather tells the JVM that you would like to do it, and then it will do it sometime after that. -
Adding nodes to specific positions of JTree
Hi guys, I have a JTree that basically represents a file explorer with all the folders and files in a drive. I want to automatically refresh the tree if there are any new files added to that drive. What my idea was to:
1. Set a timer to check the list of files in that directory every 1 second
2. If there are any changes, I would obtain the path of the file
3. Create a new DefaultMutableTreeNode for that file
4. Add this node into the JTree.
The problem I have right now is that all the debug checks are printing the right stuffs. However, JTree doesn't add the new node if files are placed in a sub folder, or a folder is copied into the directory. The code is not ready to detect file deletion yet.
Here is my code:
public static void refresh(final File dir, final JTree fileTree)
//Start the timer
final Timer timer = new Timer(1000, new ActionListener()
//Get a list of the files
List<File> listA = new ArrayList<File>(listAllFiles(null, dir, 2));
public void actionPerformed(ActionEvent ae)
int c = 0;
List<File> listB = new ArrayList<File>(listAllFiles(null, dir, 2));
//Files added
if (listA.size() < listB.size())
File[] files = new File[listB.size() - listA.size()];
//Find out which file is it
for (int i = 0; i < listB.size(); i++)
//File found
if (!listA.contains(listB.get(i)))
//Get all the new files into an array
files[c] = (File) listB.get(i);
c++;
//Update the list first
listA = listB;
//Update each file into the file tree
for (int i = 0; i < files.length; i++)
//Remove user.dir path
String filePath = files.getAbsolutePath();
String userDir = System.getProperty("user.dir");
filePath = filePath.substring(userDir.length() + 1, filePath.length());
//Convert path separator to / for splitting
if (System.getProperty("os.name").contains("Windows"))
filePath = filePath.replaceAll("\\\\", "/");
//Convert it to tree path
Object root = ((DefaultTreeModel)fileTree.getModel()).getRoot();
String str[] = filePath.split("/");
Object obj[] = new Object[str.length];
obj[0] = root;
for (int j = 0; j < str.length - 1; j++)
obj[j + 1] = new DefaultMutableTreeNode(str[j]);
TreePath path = new TreePath(obj);
//New node to be added into the fileTree
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(files[i].getName());
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode)path.getLastPathComponent();
((DefaultTreeModel)fileTree.getModel()).insertNodeInto(newNode, parentNode, parentNode.getChildCount());
timer.start();bumps..
-
JTree adding to expanded nodes
Hey,
I'm writing a program that contains a JTree with two parent nodes and child nodes that are added/removed on demand.
Basically I can't add child nodes while the parent node is expanded. Following the code it actually does add it, just does not update the display.
I've tried validate/repaint/anything I could find that may be of some help with no luck.
Any ideas?
Thanks in advance :)What do you think about the library I created which
addresses this issue?
Denis Krukovsky
http://dotuseful.sourceforge.net/
I looked at your site and spent 20 minutes trying to figure out why your classes are useful. It's not at all clear why someone should use them. I also looked over your previous posts, but you never seem to explain why someone should use them. -
Problems adding nodes to JTree on runtime
I have added a popup menu to my tree, and would like to be able to add new nodes by right clicking, so I have this code in my event listener:
void newFolderFolderPopup_mousePressed(MouseEvent e) {
System.out.println("WEEEEEEEEEEEEEEEEEEEEEEEE");
FolderDO folder = new FolderDO("New Folder");
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(folder);
TreePath treePath = foldersTree.getSelectionPath();
DefaultMutableTreeNode slectedNode = (DefaultMutableTreeNode)treePath.getLastPathComponent();
treeModel.insertNodeInto(newNode,slectedNode,slectedNode.getChildCount());
foldersTree.scrollPathToVisible(new TreePath(newNode.getPath()));
}If the slected node is a leaf, it works just fine every time I do it. But if the selected node has children and it has once been expanded, the new node is not displayed (but something strange is happening to the tree). If however the selected node has children and has not been expanded it works fine...???
Any ideas?I have added a popup menu to my tree, and would like to be able to add new nodes by right clicking, so I have this code in my event listener:
void newFolderFolderPopup_mousePressed(MouseEvent e) {
System.out.println("WEEEEEEEEEEEEEEEEEEEEEEEE");
FolderDO folder = new FolderDO("New Folder");
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(folder);
TreePath treePath = foldersTree.getSelectionPath();
DefaultMutableTreeNode slectedNode = (DefaultMutableTreeNode)treePath.getLastPathComponent();
treeModel.insertNodeInto(newNode,slectedNode,slectedNode.getChildCount());
foldersTree.scrollPathToVisible(new TreePath(newNode.getPath()));
}If the slected node is a leaf, it works just fine every time I do it. But if the selected node has children and it has once been expanded, the new node is not displayed (but something strange is happening to the tree). If however the selected node has children and has not been expanded it works fine...???
Any ideas? -
JTree doesn't refresh when adding node in a node
Hello,
I have a strange problem
I have a JTree, with a root, and two nodes, which have nodes...
I have one node that is expanded, and the other is collapsed.
I made a method that enables me to add a sub node to the node selected by the mouse.
If I select the collapsed node and use my "add" method, and then expand the node, the node is here. No problem.
If I do the same thing on the expanded node, the tree doesn't seem to be willing to refresh. I can use some refresh(), expandPath()...and other methods to make it refreshed, but it doesn't care... is there some particular method that I must use, a listener that I must add to the tree....?
Any help would be appreciated
Thanks 4 help
PhilippeYou need to call nodeStructureChanged(parentNode) on the model.
-
Adding nodes to JTree (algorithm needed)...
Hi,
I hope someone can give me a solution or at least a hint on how to solve the following problem:
I've a JTree with a DefaultMutableTreeNode as the root node. Now I'll have to add nodes dynamically in a specified order. The numbers in brackets are node ids. Here's an example:
[73691178][73691179]
[73691178][73691179][73359970]
[73691178][73691179][73359970][1762]
[73691178][73691179][73359970][3092]
[73691178][73691179][73359970][1396]
[73691178][73691179][73359970][2301]
[73691178][73691180]
[73691178][73691180][73359972]
[73691178][73691180][73359972][1762]
[73691178][73691180][73359972][3092]
[73691178][61262304]
...The first part specifies the root node (73691178) of my JTree, the next part specifies the node directly below the root node etc. - now I'll have to collect these values and build up my tree accordingly.
private void buildUpTreeNodes(DefaultMutableTreeNode root) {
if (root != null) {
List childTreeNodes = new NamedQueriesDAOHibernate().fetchChildTreeNodes(_rootNodeId, _mcId);
for (Iterator treeNodesIter = childTreeNodes.iterator(); treeNodesIter.hasNext();) {
NodeBean bean = (NodeBean) treeNodesIter.next();
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(bean);
List nodeIds = SwingUtil.extractNodeIdsFromNpath(bean.getNPathChild());
for (Iterator nodeIdsIter = nodeIds.iterator(); nodeIdsIter.hasNext();) {
Long nodeId = (Long) nodeIdsIter.next();
if (!_rootNodeId.equals(nodeId)) {
// not sure, what to do...
root.add(newNode);
childTreeNodes is a list with beans which contain the path information ([73691178][73691180], see above) among other things. The posting above adds every node to the root node which is not correct (the root node has to be changed according to the path information). Perhaps recursion is the only way to solve the problem but I'm not quite sure...
Can anyone show some kind of algorithm on how to build up my tree in correct order?
Thanks a lot and best regards
- Stephanassuming you want to read in the ids from a text file (in the format shown),
perhaps something like this might do
import java.awt.*;
import java.io.*;
import javax.swing.*;
import javax.swing.tree.*;
class Testing
java.util.Map<String,DefaultMutableTreeNode> nodes = new java.util.HashMap<String,DefaultMutableTreeNode>();
JTree tree;
public void buildGUI()
String rootNode = "73691178";
nodes.put(rootNode,new DefaultMutableTreeNode(rootNode));
tree = new JTree(nodes.get(rootNode));
loadTree();
tree.expandRow(0);
JFrame f = new JFrame();
f.getContentPane().add(new JScrollPane(tree));
f.setSize(200,200);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
public void loadTree()
try
BufferedReader br = new BufferedReader(new FileReader("NodeIDs.txt"));
String line = "";
while ((line = br.readLine()) != null)
String[] ids = line.replaceAll("\\[","").split("\\]");
String newID = ids[ids.length-1];
String parentID = ids[ids.length-2];
nodes.put(newID,new DefaultMutableTreeNode(newID));
nodes.get(parentID).add(nodes.get(newID));
br.close();
catch(IOException ioe){ioe.printStackTrace();}
public static void main(String[] args)
SwingUtilities.invokeLater(new Runnable(){
public void run(){
new Testing().buildGUI();
}
Maybe you are looking for
-
How do I use iCloud for non-iCloud apps
I have a password manager app on both my iPhone 4S and iPad2. According to the description in the App Store and the About/Settings/Help section of the app, I can use iCloud to sync between the two, meaning that what I put on one will show up on the o
-
Installing Photoshop on something other than C drive?
Ok...I have a new PC and I am installing PS CS6 and LR5. I installed it on a different drive because my C drive only has 8gig left (my C drive is an SSD and I only have the OS on it). Now when I try to open PS, it gives me this error: "The applicati
-
After hard drive failure Premiere Elements 9 loads with only tool bar at top & grey screen below
I have uninstalled & reinstalled. Tried to load project but program tells me it has to close
-
I have never used another computer to sync my phone or ipod too. I do not want to lose everything. I am quite frankly at the end of my rope and thoroughly regret the fact that I am stuck with an iphone 4 for 2 years. Someone, anyone...help??!
-
In mail, why does entire email address show up instead of just person's name
When I address most emails (to persons who are in my contacts), only their names show up in the "To:" window. But with certain people, their name plus their <full email address> all show up in the window. I've tried re-entering their names in my cont