BrowseIndexPanel.java revision ca669ae54f86dbeea277280690584d9f591c7571
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* The pane that is displayed when the user clicks on 'Browse Indexes'.
*
*/
public class BrowseIndexPanel extends StatusGenericPanel
implements IndexModifiedListener
{
private static final long serialVersionUID = 4560020571983291585L;
private JLabel lNoBackendsFound;
private IndexBrowserRightPanel entryPane;
private JScrollPane treeScroll;
private JButton newVLVIndex;
private AbstractIndexDescriptor lastCreatedIndex;
private TreePath lastIndexTreePath;
private CategoryTreeNode[] categoryNodes = {
};
private JMenuItem deleteMenuItem;
private GenericDialog newIndexDialog;
private NewIndexPanel newIndexPanel;
private GenericDialog newVLVIndexDialog;
private NewVLVIndexPanel newVLVIndexPanel;
private boolean ignoreSelectionEvents;
private boolean firstTreeRepopulate = true;
/**
* Default constructor.
*
*/
public BrowseIndexPanel()
{
super();
createLayout();
}
/**
* {@inheritDoc}
*/
public boolean requiresBorder()
{
return false;
}
/**
* {@inheritDoc}
*/
public boolean requiresScroll()
{
return false;
}
/**
* {@inheritDoc}
*/
public void toBeDisplayed(boolean visible)
{
super.toBeDisplayed(visible);
if (w instanceof GenericDialog)
{
}
else if (w instanceof GenericFrame)
{
}
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
{
/**
* {@inheritDoc}
*/
{
if (!ignoreSelectionEvents &&
{
}
}
};
lNoBackendsFound.setVisible(false);
{
/**
* {@inheritDoc}
*/
{
}
});
newVLVIndex.setOpaque(false);
{
/**
* {@inheritDoc}
*/
{
}
});
}
/**
* {@inheritDoc}
*/
public LocalizableMessage getTitle()
{
return INFO_CTRL_PANEL_MANAGE_INDEXES_TITLE.get();
}
/**
* {@inheritDoc}
*/
public Component getPreferredFocusComponent()
{
return backends;
}
/**
* {@inheritDoc}
*/
public void closeClicked()
{
super.closeClicked();
}
/**
* {@inheritDoc}
*/
public void okClicked()
{
// No ok button
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
private Component createSplitPane()
{
entryPane = new IndexBrowserRightPanel();
{
/**
* {@inheritDoc}
*/
{
if (index instanceof IndexDescriptor)
{
}
else
{
}
for (int i=0; i<n; i++)
{
{
break;
}
}
}
});
// Create a split pane
{
/**
* {@inheritDoc}
*/
{
if (!ignoreSelectionEvents)
{
if (entryPane.mustCheckUnsavedChanges())
{
ignoreSelectionEvents = true;
switch (entryPane.checkUnsavedChanges())
{
case DO_NOT_SAVE:
break;
case SAVE:
break;
case CANCEL:
ignoreSelectionEvents = false;
return;
}
{
}
else
{
}
ignoreSelectionEvents = false;
}
boolean deletableElementsSelected = false;
boolean nonDeletableElementsSelected = false;
{
{
if (node instanceof IndexTreeNode)
{
if (index.isDatabaseIndex())
{
nonDeletableElementsSelected = true;
}
else
{
deletableElementsSelected = true;
}
}
else if (node instanceof VLVIndexTreeNode)
{
deletableElementsSelected = true;
}
}
}
}
}
});
{
}
tree.setRootVisible(false);
addPopupMenu();
return pane;
}
/**
* {@inheritDoc}
*/
{
info.addIndexModifiedListener(this);
}
/**
* {@inheritDoc}
*/
{
ignoreSelectionEvents = true;
desc);
}
/**
* Adds a pop up menu.
*
*/
private void addPopupMenu()
{
{
/**
* {@inheritDoc}
*/
{
}
});
{
/**
* {@inheritDoc}
*/
{
}
});
{
/**
* {@inheritDoc}
*/
{
}
});
deleteMenuItem.setEnabled(false);
}
/**
* Refresh the contents of the tree.
* @param desc the descriptor containing the index configuration.
*/
{
{
/**
* {@inheritDoc}
*/
public void run()
{
ignoreSelectionEvents = false;
if (!userBackendsDefined)
{
errorPane.setVisible(true);
}
else
{
errorPane.setVisible(false);
}
}
});
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Repopulates the contents of the tree.
* @param tree the tree to be repopulated.
*/
{
ignoreSelectionEvents = true;
{
}
if (backendName != null)
{
{
{
backend = b;
break;
}
}
}
new ArrayList<IndexTreeNode>();
new ArrayList<VLVIndexTreeNode>();
{
{
}
{
}
}
int i = 0;
int positionUnderRoot = 0;
{
{
{
}
}
else
{
boolean expand = true;
{
}
else
{
}
{
if ((newSelectionPath == null) &&
{
if (lastCreatedIndex != null)
{
if ((node instanceof IndexTreeNode) &&
(lastCreatedIndex instanceof IndexDescriptor))
{
{
}
}
else if (node instanceof VLVIndexTreeNode
&& lastCreatedIndex instanceof VLVIndexDescriptor
{
}
}
{
}
}
}
if (expand)
{
}
}
i++;
}
{
}
if (newSelectionPath != null)
{
}
{
public void run()
{
if (firstTreeRepopulate)
{
}
else
{
}
}
});
firstTreeRepopulate = false;
ignoreSelectionEvents = false;
}
/**
* Updates the contents of the right panel.
*
*/
private void updateEntryPane()
{
{
}
{
if (node instanceof IndexTreeNode)
{
}
else if (node instanceof VLVIndexTreeNode)
{
}
else if (node == standardIndexes)
{
}
else if (node == vlvIndexes)
{
}
else
{
}
}
else
{
{
}
else
{
}
}
}
{
}
private void newIndexClicked()
{
if (newIndexPanel == null)
{
Utilities.getParentDialog(this));
Utilities.getParentDialog(this));
{
{
if (o instanceof AbstractIndexDescriptor)
{
}
}
});
}
else if (!newIndexDialog.isVisible())
{
for (BackendDescriptor backend :
{
{
break;
}
}
}
newIndexDialog.setVisible(true);
}
private void newVLVIndexClicked()
{
if (newVLVIndexPanel == null)
{
Utilities.getParentDialog(this));
Utilities.getParentDialog(this));
{
/**
* {@inheritDoc}
*/
{
if (o instanceof AbstractIndexDescriptor)
{
}
}
});
}
else if (!newVLVIndexDialog.isVisible())
{
for (BackendDescriptor backend :
{
{
break;
}
}
}
newVLVIndexDialog.setVisible(true);
}
private void deleteClicked()
{
new ArrayList<AbstractIndexDescriptor>();
{
{
if (node instanceof IndexTreeNode)
{
}
else if (node instanceof VLVIndexTreeNode)
{
}
}
}
else
{
}
{
}
{
Utilities.getParentDialog(this),
{
}
{
backendName)))
{
null,
dlg);
dlg.setVisible(true);
}
}
}
{
}
}
{
{
}
{
}
};
/**
* Specific class used to render the nodes in the tree. It uses specific
* icons for the nodes.
*
*/
protected class IndexTreeCellRenderer extends TreeCellRenderer
{
private ImageIcon readOnlyIndexIcon =
private static final long serialVersionUID = -6953837045703643228L;
/**
* {@inheritDoc}
*/
boolean hasFocus)
{
return this;
}
{
if (value instanceof IndexTreeNode
{
}
{
{
}
}
return icon;
}
}
}