mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Ludovic Poitou
12.06.2012 1e66ccf45c723c6e076285f030202f320c2dfd90
opends/src/guitools/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.guitools.controlpanel.ui;
@@ -52,6 +53,7 @@
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.OpenDsException;
import org.opends.server.util.Base64;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.LDIFReader;
/**
@@ -80,6 +82,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Component getPreferredFocusComponent()
  {
    return editableAttributes;
@@ -107,16 +110,19 @@
    editableAttributes = Utilities.createTextArea(Message.EMPTY, 20, 30);
    editableAttributes.getDocument().addDocumentListener(new DocumentListener()
    {
      @Override
      public void insertUpdate(DocumentEvent ev)
      {
        notifyListeners();
      }
      @Override
      public void changedUpdate(DocumentEvent ev)
      {
        notifyListeners();
      }
      @Override
      public void removeUpdate(DocumentEvent ev)
      {
        notifyListeners();
@@ -149,6 +155,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void update(CustomSearchResult sr, boolean isReadOnly, TreePath path)
  {
    boolean sameEntry = false;
@@ -167,7 +174,7 @@
    StringBuilder sb = new StringBuilder();
    sb.append("dn: "+sr.getDN());
    sb.append("dn: ").append(sr.getDN());
    if (isReadOnly)
    {
@@ -177,7 +184,7 @@
        List<Object> values = sr.getAttributeValues(attrName);
        for (Object o : values)
        {
          sb.append("\n"+ getLDIFLine(attrName, o));
          sb.append("\n").append(getLDIFLine(attrName, o));
        }
      }
      final Point p1 = sameEntry ?
@@ -188,6 +195,7 @@
        /**
         * {@inheritDoc}
         */
        @Override
        public void run()
        {
          if ((p1 != null) && (readOnlyScroll.getViewport().contains(p1)))
@@ -208,7 +216,7 @@
          List<Object> values = sr.getAttributeValues(attrName);
          for (Object o : values)
          {
            sb.append("\n"+ getLDIFLine(attrName, o));
            sb.append("\n").append(getLDIFLine(attrName, o));
          }
        }
      }
@@ -223,6 +231,7 @@
        /**
         * {@inheritDoc}
         */
        @Override
        public void run()
        {
          if ((p1 != null) && (editableScroll.getViewport().contains(p1)))
@@ -255,6 +264,7 @@
        /**
         * {@inheritDoc}
         */
        @Override
        public void run()
        {
          if ((p2 != null) && (readOnlyScroll.getViewport().contains(p2)))
@@ -269,6 +279,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public GenericDialog.ButtonType getButtonType()
  {
    return GenericDialog.ButtonType.NO_BUTTON;
@@ -278,6 +289,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  protected String getDisplayedDN()
  {
    String dn = null;
@@ -298,6 +310,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  protected List<Object> getValues(String attrName)
  {
    throw new IllegalStateException("This method should not be called.");
@@ -306,6 +319,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Entry getEntry() throws OpenDsException
  {
    Entry entry = null;
@@ -358,7 +372,16 @@
    String attrValue;
    if (o instanceof String)
    {
      attrValue = (String)o;
      //
      if (Utilities.hasControlCharaters((String)o))
      {
        attrValue = Base64.encode(StaticUtils.getBytes((String)o));
        attrName = attrName+":";
      }
      else
      {
        attrValue = (String)o;
      }
    }
    else if (o instanceof byte[])
    {