| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return editableAttributes; |
| | |
| | | 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(); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void update(CustomSearchResult sr, boolean isReadOnly, TreePath path) |
| | | { |
| | | boolean sameEntry = false; |
| | |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | | sb.append("dn: "+sr.getDN()); |
| | | sb.append("dn: ").append(sr.getDN()); |
| | | |
| | | if (isReadOnly) |
| | | { |
| | |
| | | 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 ? |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | if ((p1 != null) && (readOnlyScroll.getViewport().contains(p1))) |
| | |
| | | List<Object> values = sr.getAttributeValues(attrName); |
| | | for (Object o : values) |
| | | { |
| | | sb.append("\n"+ getLDIFLine(attrName, o)); |
| | | sb.append("\n").append(getLDIFLine(attrName, o)); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | if ((p1 != null) && (editableScroll.getViewport().contains(p1))) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | if ((p2 != null) && (readOnlyScroll.getViewport().contains(p2))) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected String getDisplayedDN() |
| | | { |
| | | String dn = null; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected List<Object> getValues(String attrName) |
| | | { |
| | | throw new IllegalStateException("This method should not be called."); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Entry getEntry() throws OpenDsException |
| | | { |
| | | Entry entry = null; |
| | |
| | | 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[]) |
| | | { |