ElementTreePanel.java revision 4378
39135a3e07243519dbe40a68e86a7ef524eb3f1bmfloryan * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * Redistribution and use in source and binary forms, with or without
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * modification, are permitted provided that the following conditions
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * - Redistributions of source code must retain the above copyright
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * notice, this list of conditions and the following disclaimer.
241ef7771aef53c1e27e4c8c1a721dec6d206509Kris * - Redistributions in binary form must reproduce the above copyright
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * notice, this list of conditions and the following disclaimer in the
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * documentation and/or other materials provided with the distribution.
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * - Neither the name of Oracle nor the names of its
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * contributors may be used to endorse or promote products derived
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * from this software without specific prior written permission.
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20d0349a1f3c4b7ec90f29c36e56481e2f8c0147apenner * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6b464dfa85f56bbe7e0ff053bcb709fe346a5e2cJazzyNico * This source code is provided to illustrate the usage of a given feature
6b464dfa85f56bbe7e0ff053bcb709fe346a5e2cJazzyNico * or technique and has been deliberately simplified. Additional steps
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * required for a production-quality application, such as security checks,
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * input validation and proper error handling, might not be present in
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Penner * this sample code.
e7bafc69cc367122b93ff2659a151d2792e387a7Alvin Pennerimport javax.swing.tree.DefaultTreeCellRenderer;
protected boolean updatingSelection;
if (e.isLeaf()) {
return retValue;
updateTree(e);
updateTree(e);
updateTree(e);
if (!updatingSelection) {
start++;
updatingSelection = true;
updatingSelection = false;
updatingSelection = true;
updatingSelection = false;
return tree;
return editor;
return treeModel;
updatingSelection = true;
counter--) {
updatingSelection = false;
removed);
startIndex--;
position));
return path;
counter--) {
return counter;
return null;
depth++;
return retNodes;