| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import java.awt.Dimension; |
| | | import java.awt.GridBagConstraints; |
| | | import java.awt.Insets; |
| | | import java.awt.Point; |
| | | import java.awt.event.ActionEvent; |
| | | import java.awt.event.ActionListener; |
| | | import java.awt.event.ItemEvent; |
| | |
| | | import org.opends.guitools.controlpanel.ui.nodes.VLVIndexTreeNode; |
| | | import org.opends.guitools.controlpanel.ui.renderer.TreeCellRenderer; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.guitools.controlpanel.util.ViewPositions; |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | |
| | | private IndexBrowserRightPanel entryPane; |
| | | private TreePanel treePane; |
| | | |
| | | private JScrollPane treeScroll; |
| | | |
| | | private JButton newIndex; |
| | | private JButton newVLVIndex; |
| | | |
| | |
| | | Utilities.setBorder(treePane, new EmptyBorder(10, 0, 10, 0)); |
| | | |
| | | entryPane = new IndexBrowserRightPanel(); |
| | | JScrollPane treeScroll = Utilities.createScrollPane(treePane); |
| | | treeScroll = Utilities.createScrollPane(treePane); |
| | | |
| | | entryPane.addIndexSelectionListener(new IndexSelectionListener() |
| | | { |
| | |
| | | private void repopulateTree(JTree tree) |
| | | { |
| | | ignoreSelectionEvents = true; |
| | | |
| | | final Point currentPosition = treeScroll.getViewport().getViewPosition(); |
| | | DefaultMutableTreeNode root = getRoot(tree); |
| | | |
| | | TreePath path = tree.getSelectionPath(); |
| | |
| | | |
| | | updateEntryPane(); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | if (firstTreeRepopulate) |
| | | { |
| | | treeScroll.getViewport().setViewPosition(new Point(0, 0)); |
| | | } |
| | | else |
| | | { |
| | | treeScroll.getViewport().setViewPosition(currentPosition); |
| | | } |
| | | } |
| | | }); |
| | | firstTreeRepopulate = false; |
| | | ignoreSelectionEvents = false; |
| | | } |
| | |
| | | */ |
| | | private void updateEntryPane() |
| | | { |
| | | ViewPositions pos = Utilities.getViewPositions(entryPane); |
| | | TreePath[] paths = treePane.getTree().getSelectionPaths(); |
| | | TreePath path = null; |
| | | if ((paths != null) && (paths.length == 1)) |
| | |
| | | entryPane.displayVoid(); |
| | | } |
| | | } |
| | | Utilities.updateViewPositions(pos); |
| | | } |
| | | |
| | | private DefaultMutableTreeNode getRoot(JTree tree) |