LDIFViewEntryPanel.java revision e1cd6c2bc4addf80537e31f929118ac8f908ea63
/*
* 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 2012-2015 ForgeRock AS
*/
/**
* The panel displaying an LDIF view of an entry.
*/
public class LDIFViewEntryPanel extends ViewEntryPanel
{
/** Callback that sets the viewport's view position. */
private static final class SetViewPosition implements Runnable
{
private final Point p;
private final JScrollPane scroll;
{
this.p = p;
}
/** {@inheritDoc} */
public void run()
{
{
}
}
}
private static final long serialVersionUID = 2775960608128921072L;
private JScrollPane editableScroll;
private JScrollPane readOnlyScroll;
private JTextArea editableAttributes;
private JTextArea readOnlyAttributes;
private CustomSearchResult searchResult;
/** Default constructor. */
public LDIFViewEntryPanel()
{
createLayout();
}
/** {@inheritDoc} */
public Component getPreferredFocusComponent()
{
return editableAttributes;
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
addTitlePanel(this, gbc);
{
{
}
{
}
{
}
});
}
/** {@inheritDoc} */
{
boolean sameEntry = false;
{
}
searchResult = sr;
if (isReadOnly)
{
editableScroll.setVisible(false);
{
{
}
}
}
else
{
editableScroll.setVisible(true);
{
{
{
}
}
}
ignoreEntryChangeEvents = true;
ignoreEntryChangeEvents = false;
// Read-only attributes
boolean oneLineAdded = false;
sb = new StringBuilder();
{
{
if (oneLineAdded)
{
}
oneLineAdded = true;
}
}
}
}
/** {@inheritDoc} */
{
}
/** {@inheritDoc} */
protected String getDisplayedDN()
{
// Do it fast, this is called to update the dn displayed in the title.
if (index != -1)
{
if (index2 != -1)
{
}
}
return dn;
}
/** {@inheritDoc} */
{
throw new IllegalStateException("This method should not be called.");
}
/** {@inheritDoc} */
{
try
{
return entry;
}
catch (IOException ioe)
{
throw new OfflineUpdateException(
}
finally
{
if (ldifImportConfig != null)
{
}
}
}
/**
* Returns the LDIF representation of the entry, only returns the editable
* attributes.
* @return the LDIF representation of the entry.
*/
{
return editableAttributes.getText();
}
/**
* Returns the equivalent LDIF line for a given attribute and value.
* @param attrName the attribute name.
* @param o the value.
* @return the equivalent LDIF line for the provided attribute and value.
*/
{
if (o instanceof String)
{
{
}
else
{
}
}
else if (o instanceof byte[])
{
// To indicate that is base64 encoded
}
else
{
}
}
}