/** Opens a dialog that displays the operational attributes of the current entry. */ public void displayOperationalAttributes() { JXplorerBrowser jx = null; if (owner instanceof JXplorerBrowser) jx = (JXplorerBrowser) owner; else return; showingOperationalAttributes = !showingOperationalAttributes; // EJP 17 August 2010. // CB 14 August 2012 - some directories (looking at you Active Directory) don't support the '+' // operator... so do it manually as well... String[] opAttrs = { "+", "createTimeStamp", "creatorsName", "entryFlags", "federationBoundary", "localEntryID", "modifiersName", "modifyTimeStamp", "structuralObjectClass", "subordinateCount", "subschemaSubentry" }; DXEntry entry = null; if (showingOperationalAttributes) { try { entry = (jx.getSearchBroker()).unthreadedReadEntry(currentDN, opAttrs); StringBuffer buffy = new StringBuffer("DN: " + currentDN.toString() + "\n\n"); // Get the attribute values... // EJP 17 August 2010: use the actual attributes returned. NamingEnumeration ne = null; try { ne = entry.getAll(); while (ne.hasMore()) { DXAttribute att = (DXAttribute) ne.next(); buffy.append(att.getName() + ": " + att.get().toString() + "\n"); tableData.insertOperationalAttribute(att); } } finally { if (ne != null) ne.close(); } tableData.fireTableDataChanged(); } catch (NamingException e) { CBUtility.error( TableAttributeEditor.this, CBIntText.get("Unable to read entry " + currentDN), e); } } else { tableData.removeOperationalAttributes(); tableData.fireTableDataChanged(); } }
// Set Value @Override public void setValueAt(Object value, int row, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } String key = (String) model.keys.get(row); boolean readOnly = node.isReadOnly(key); Object oldValue = node.getAttribute(key); model.values.set(row, value); node.setAttribute(key, value); OutlinerDocument doc = view.tree.getDocument(); doc.setModified(true); // undo Undoable undoable = new UndoableDocumentAttributeChange( view.tree, key, oldValue, readOnly, key, value, readOnly); undoable.setName("Edit Document Attribute"); doc.getUndoQueue().add(undoable); model.fireTableDataChanged(); }
// Data Modification @Override public void newAttribute( String key, Object value, boolean isReadOnly, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } model.keys.add(key); model.values.add(value); model.readOnly.add(new Boolean(isReadOnly)); node.setAttribute(key, value); OutlinerDocument doc = view.tree.getDocument(); doc.setModified(true); // undo Undoable undoable = new UndoableDocumentAttributeChange(view.tree, null, null, false, key, value, isReadOnly); undoable.setName("New Document Attribute"); doc.getUndoQueue().add(undoable); model.fireTableDataChanged(); }
// Toggle Editability @Override public void toggleEditability(int row, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } String key = (String) model.keys.get(row); Object oldAndNewValue = node.getAttribute(key); boolean oldReadOnly = node.isReadOnly(key); boolean readOnly = !oldReadOnly; boolean oldValue = true; ImageIcon isReadOnly = (ImageIcon) model.getValueAt(row, 1); if (isReadOnly == OutlineEditableIndicator.ICON_IS_NOT_PROPERTY) { oldValue = true; } else { oldValue = false; } // boolean oldValue = ((Boolean) model.getValueAt(row, 1)).booleanValue(); boolean newValue = !oldValue; model.readOnly.set(row, new Boolean(newValue)); node.setReadOnly(key, newValue); OutlinerDocument doc = view.tree.getDocument(); doc.setModified(true); // undo Undoable undoable = new UndoableDocumentAttributeChange( view.tree, key, oldAndNewValue, oldReadOnly, key, oldAndNewValue, readOnly); undoable.setName("Toggle Document Attribute Editability"); doc.getUndoQueue().add(undoable); model.fireTableDataChanged(); }