LDAPEntrySelectionPanel.java revision 9826be98262b6a91cfbe1eee4de88c78789d9e8d
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
* Portions Copyright 2013 ForgeRock AS.
*/
/**
* A basic panel that contains a browser. It is used in general in panels that
* require to provide some DNs of existing entries: we allow the user to launch
* a browser to select entries.
*
*/
public class LDAPEntrySelectionPanel extends AbstractBrowseEntriesPanel
{
private Filter f;
/**
* The values of the filters that will be used when opening the dialog where
* this panel is contained. For instance if the filter is set to Filter.USERS
* the panel will display only users when the dialog appears.
*
*/
public enum Filter
{
/**
* Display users.
*/
/**
* Display groups.
*/
/**
* Display Dynamic Groups.
*/
/**
* Display Static Groups.
*/
/**
* Default filter (all entries).
*/
}
private static final long serialVersionUID = -8140540064410029902L;
/**
* Default constructor.
*
*/
public LDAPEntrySelectionPanel()
{
super();
}
/**
* Updates the tree selection model to allow multiple selection or not.
* @param multiple whether the tree should allow multiple selection or not.
*/
public void setMultipleSelection(boolean multiple)
{
}
/**
* {@inheritDoc}
*/
public void toBeDisplayed(boolean visible)
{
super.toBeDisplayed(visible);
if (visible)
{
}
}
/**
* {@inheritDoc}
*/
{
return title;
}
/**
* {@inheritDoc}
*/
public void okClicked()
{
dns = retrieveDNs();
super.closeClicked();
}
/**
* Returns the selected DN's in an array of Strings. The array is never
* <CODE>null</CODE> but might be empty.
* @return the selected DN's.
*/
{
return dns;
}
private String[] retrieveDNs()
{
{
{
}
}
else
{
}
return dns;
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
protected Component createMainPanel()
{
JComponent p = createTreePane();
new TreeSelectionListener()
{
/**
* {@inheritDoc}
*/
{
}
});
/**
* {@inheritDoc}
*/
public void mousePressed(MouseEvent e) {
{
okClicked();
}
}
};
return treeScroll;
}
/**
* Returns the last filter set with the setFilter method.
* @return the last filter set with the setFilter method.
*/
{
return f;
}
/**
* Sets the filter to be used when the panel is displayed.
* @param filter the filter.
*/
{
f = filter;
switch (f)
{
case USERS:
break;
case GROUPS:
break;
case DYNAMIC_GROUPS:
break;
case STATIC_GROUPS:
"(objectClass=groupOfEntries)(objectClass=groupOfUniqueNames))");
break;
case DEFAULT:
break;
}
if (controller != null)
{
}
}
/**
* Sets the title that will be displayed in the dialog containing this panel.
* @param title the title.
*/
{
if (w instanceof GenericDialog)
{
((GenericDialog)w).updateTitle();
}
else if (w instanceof GenericFrame)
{
((GenericFrame)w).updateTitle();
}
}
}