/*
* 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 ForgeRock AS.
*/
/**
* The panel displaying a table view of an LDAP entry.
*
*/
{
private boolean isReadOnly;
/**
* Default constructor.
*
*/
public TableViewEntryPanel()
{
super();
createLayout();
}
/**
* {@inheritDoc}
*/
{
return table;
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
addTitlePanel(this, gbc);
{
/**
* {@inheritDoc}
*/
{
}
});
tableModel = new LDAPEntryTableModel();
renderer = new LDAPEntryTableCellRenderer();
editor = new AttributeCellEditor();
}
/**
* {@inheritDoc}
*/
{
boolean sameEntry = false;
{
}
searchResult = sr;
this.isReadOnly = isReadOnly;
ignoreEntryChangeEvents = true;
{
public void run()
{
{
}
ignoreEntryChangeEvents = false;
}
});
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
{
}
else
{
try
{
{
public void run()
{
}
});
}
catch (Throwable t)
{
}
}
try
{
}
catch (IOException ioe)
{
throw new OnlineUpdateException(
ioe);
}
finally
{
if (ldifImportConfig != null)
{
}
}
return entry;
}
/**
* Returns the LDIF representation of the displayed entry.
* @return the LDIF representation of the displayed entry.
*/
{
{
{
}
}
}
/**
* {@inheritDoc}
*/
{
try
{
{
{
{
{
{
v = v.trim();
if (v.length() > 0)
{
firstNonEmpty = v;
break;
}
}
if (firstNonEmpty != null)
{
attr, firstNonEmpty));
}
}
}
else
{
}
}
{
// Check the attributes in the order that we display them and use
// the first one.
{
{
if (isPassword(attrName) ||
{
continue;
}
if (o instanceof String)
{
{
}
break;
}
}
}
}
{
{
}
else
{
}
}
else
{
{
}
}
}
}
catch (Throwable t)
{
throw new RuntimeException("Unexpected error: "+t, t);
}
}
{
{
{
if (o instanceof String)
{
}
}
}
return values;
}
private void updateAttributeVisibility()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* The table model used by the tree in the panel.
*
*/
implements Comparator<AttributeValuePair>
{
new ArrayList<AttributeValuePair>();
new TreeSet<AttributeValuePair>(this);
private boolean sortAscending = true;
/**
* Updates the contents of the table model with the
* {@code TableViewEntryPanel.searchResult} object.
*/
public void displayEntry()
{
}
/**
* Updates the table model contents and sorts its contents depending on the
* sort options set by the user.
*/
public void forceResort()
{
}
/**
* {@inheritDoc}
*/
{
int result;
int[] possibleResults = {
if (result == 0)
{
for (int i : possibleResults)
{
if (i != 0)
{
result = i;
break;
}
}
}
if (!sortAscending)
{
}
return result;
}
{
{
{
return 0;
}
else
{
return -1;
}
}
{
return 1;
}
if (o1 instanceof ObjectClassValue)
{
}
else if (o1 instanceof BinaryValue)
{
}
else if (o1 instanceof byte[])
{
}
if (o2 instanceof ObjectClassValue)
{
}
else if (o2 instanceof BinaryValue)
{
}
else if (o2 instanceof byte[])
{
}
{
{
}
{
}
{
}
else
{
}
}
else
{
}
}
/**
* {@inheritDoc}
*/
public int getColumnCount()
{
return COLUMN_NAMES.length;
}
/**
* {@inheritDoc}
*/
public int getRowCount()
{
}
/**
* {@inheritDoc}
*/
{
if (col == 0)
{
}
else
{
}
}
/**
* {@inheritDoc}
*/
return COLUMN_NAMES[col];
}
/**
* Returns whether the sort is ascending or descending.
* @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE>
* otherwise.
*/
public boolean isSortAscending()
{
return sortAscending;
}
/**
* Sets whether to sort ascending of descending.
* @param sortAscending whether to sort ascending or descending.
*/
{
this.sortAscending = sortAscending;
}
/**
* Returns the column index used to sort.
* @return the column index used to sort.
*/
public int getSortColumn()
{
return sortColumn;
}
/**
* Sets the column index used to sort.
* @param sortColumn column index used to sort..
*/
{
this.sortColumn = sortColumn;
}
/**
* {@inheritDoc}
*/
if (col == 0)
{
return false;
}
else
{
if (!isReadOnly)
{
}
else
{
return false;
}
}
}
/**
* {@inheritDoc}
*/
{
if (value instanceof ObjectClassValue)
{
}
else
{
}
}
private void updateDataArray()
{
{
if (attrName.equalsIgnoreCase(
{
{
}
}
else
{
{
}
}
}
{
{
if (objectClass != null)
{
{
{
{
new byte[]{}));
}
else
{
}
}
}
{
{
{
new byte[]{}));
}
else
{
}
}
}
}
}
}
{
if (!showOnlyAttrsWithValues.isSelected() ||
{
}
}
}
/**
* Checks if we have to display all the attributes or only those that
* contain a value and updates the contents of the model accordingly. Note
* that even if the required attributes have no value they will be
* displayed.
*
*/
void updateAttributeVisibility()
{
{
if (!showOnlyAttrsWithValues.isSelected() ||
{
}
}
}
/**
* Returns the list of values associated with a given attribute.
* @param attrName the name of the attribute.
* @return the list of values associated with a given attribute.
*/
{
{
{
{
{
{
}
}
else
{
}
}
}
}
return values;
}
{
{
{
}
}
ignoreEntryChangeEvents = true;
{
{
}
{
}
{
if (objectClass != null)
{
{
}
{
}
}
}
{
}
{
{
continue;
}
else if (!schemaReadOnlyAttributesLowerCase.contains(
{
}
}
}
ignoreEntryChangeEvents = false;
}
{
return requiredAttrs.contains(
}
{
if (hasValue)
{
{
}
{
}
}
return hasValue;
}
}
/**
* A simple class that contains an attribute name and a single value. It is
* used by the table model to be able to retrieve more easily all the values
* for a given attribute.
*
*/
class AttributeValuePair
{
/**
* The attribute name.
*/
/**
* The value.
*/
/**
* Constructor.
* @param attrName the attribute name.
* @param value the value.
*/
{
}
}
}