| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.ViewPositions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The pane that is displayed when the user clicks on 'Browse Indexes'. |
| | | * |
| | | */ |
| | | /** The pane that is displayed when the user clicks on 'Browse Indexes'. */ |
| | | public class BrowseIndexPanel extends StatusGenericPanel |
| | | implements IndexModifiedListener |
| | | { |
| | |
| | | |
| | | private boolean firstTreeRepopulate = true; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BrowseIndexPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | setBackground(ColorAndFontConstants.greyBackground); |
| | |
| | | backends.setModel(new DefaultComboBoxModel(new String[]{})); |
| | | ItemListener comboListener = new ItemListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void itemStateChanged(ItemEvent ev) |
| | | { |
| | | if (!ignoreSelectionEvents && |
| | |
| | | newIndex.setOpaque(false); |
| | | newIndex.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newIndexClicked(); |
| | |
| | | newVLVIndex.setOpaque(false); |
| | | newVLVIndex.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newVLVIndexClicked(); |
| | |
| | | add(createSplitPane(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_MANAGE_INDEXES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return backends; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void closeClicked() |
| | | { |
| | | super.closeClicked(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.CLOSE; |
| | |
| | | |
| | | entryPane.addIndexSelectionListener(new IndexSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void indexSelected(IndexSelectionEvent ev) |
| | | { |
| | | AbstractIndexDescriptor index = ev.getIndex(); |
| | |
| | | |
| | | treePane.getTree().addTreeSelectionListener(new TreeSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void valueChanged(TreeSelectionEvent ev) |
| | | { |
| | | if (!ignoreSelectionEvents) |
| | |
| | | return pane; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | |
| | | info.addIndexModifiedListener(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | ignoreSelectionEvents = true; |
| | |
| | | refreshContents(desc); |
| | | } |
| | | |
| | | /** |
| | | * Adds a pop up menu. |
| | | * |
| | | */ |
| | | /** Adds a pop up menu. */ |
| | | private void addPopupMenu() |
| | | { |
| | | final JPopupMenu popup = new JPopupMenu(); |
| | |
| | | INFO_CTRL_PANEL_NEW_INDEX_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newIndexClicked(); |
| | |
| | | INFO_CTRL_PANEL_NEW_VLV_INDEX_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newVLVIndexClicked(); |
| | |
| | | INFO_CTRL_PANEL_DELETE_INDEX_MENU.get()); |
| | | deleteMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteClicked(); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | repopulateTree(treePane.getTree()); |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void indexModified(IndexModifiedEvent ev) |
| | | { |
| | | refreshContents(getInfo().getServerDescriptor()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backendIndexesModified(IndexModifiedEvent ev) |
| | | { |
| | | refreshContents(getInfo().getServerDescriptor()); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (firstTreeRepopulate) |
| | |
| | | ignoreSelectionEvents = false; |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the right panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the right panel. */ |
| | | private void updateEntryPane() |
| | | { |
| | | ViewPositions pos = Utilities.getViewPositions(entryPane); |
| | |
| | | newIndexPanel.addConfigurationElementCreatedListener( |
| | | new ConfigurationElementCreatedListener() |
| | | { |
| | | @Override |
| | | public void elementCreated(ConfigurationElementCreatedEvent ev) |
| | | { |
| | | Object o = ev.getConfigurationObject(); |
| | |
| | | newVLVIndexPanel.addConfigurationElementCreatedListener( |
| | | new ConfigurationElementCreatedListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void elementCreated(ConfigurationElementCreatedEvent ev) |
| | | { |
| | | Object o = ev.getConfigurationObject(); |
| | |
| | | |
| | | private static final long serialVersionUID = -6953837045703643228L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTreeCellRendererComponent(JTree tree, Object value, |
| | | boolean isSelected, boolean isExpanded, boolean isLeaf, int row, |
| | | boolean hasFocus) |