<string>NSScroller</string>
<string>NSTableHeaderView</string>
<string>NSButton</string>
+ <string>NSComboBoxCell</string>
<string>NSTextFieldCell</string>
<string>NSScrollView</string>
<string>NSImageView</string>
<reference key="NSBackgroundColor" ref="201284931"/>
<reference key="NSTextColor" ref="328313533"/>
</object>
- <object class="NSTextFieldCell" key="NSDataCell" id="574425450">
- <int key="NSCellFlags">337772096</int>
- <int key="NSCellFlags2">2048</int>
- <string key="NSContents">Text Cell</string>
+ <object class="NSComboBoxCell" key="NSDataCell" id="469414486">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents"/>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="247900786"/>
- <reference key="NSBackgroundColor" ref="465271680"/>
+ <reference key="NSBackgroundColor" ref="349501126"/>
<reference key="NSTextColor" ref="162787576"/>
+ <int key="NSVisibleItemCount">2</int>
+ <bool key="NSHasVerticalScroller">YES</bool>
+ <object class="NSMutableArray" key="NSPopUpListData">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>read</string>
+ <string>write</string>
+ </object>
+ <object class="NSComboTableView" key="NSTableView" id="296811353">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrameSize">{13, 18}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSMutableArray" key="NSTableColumns">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableColumn">
+ <double key="NSWidth">10</double>
+ <double key="NSMinWidth">10</double>
+ <double key="NSMaxWidth">1000</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents"/>
+ <object class="NSFont" key="NSSupport" id="1072536285">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">12</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
+ </object>
+ <reference key="NSTextColor" ref="392809818"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="296811353"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="465271680"/>
+ <reference key="NSTextColor" ref="162787576"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <reference key="NSTableView" ref="296811353"/>
+ </object>
+ </object>
+ <double key="NSIntercellSpacingWidth">3</double>
+ <double key="NSIntercellSpacingHeight">2</double>
+ <reference key="NSBackgroundColor" ref="465271680"/>
+ <reference key="NSGridColor" ref="320747002"/>
+ <double key="NSRowHeight">16</double>
+ <string key="NSAction">tableViewAction:</string>
+ <int key="NSTvFlags">-765427712</int>
+ <reference key="NSDelegate" ref="469414486"/>
+ <reference key="NSDataSource" ref="469414486"/>
+ <reference key="NSTarget" ref="469414486"/>
+ <int key="NSColumnAutoresizingStyle">1</int>
+ <int key="NSDraggingSourceMaskForLocal">15</int>
+ <int key="NSDraggingSourceMaskForNonLocal">0</int>
+ <bool key="NSAllowsTypeSelect">YES</bool>
+ <int key="NSTableViewDraggingDestinationStyle">0</int>
+ </object>
+ <bool key="NSButtonBordered">NO</bool>
</object>
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Revert</string>
- <object class="NSFont" key="NSSupport" id="1072536285">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">12</double>
- <int key="NSfFlags">16</int>
- </object>
+ <reference key="NSSupport" ref="1072536285"/>
<reference key="NSControlView" ref="870983347"/>
<int key="NSButtonFlags">-2038152961</int>
<int key="NSButtonFlags2">164</int>
<string key="NSInitialKey">key</string>
<string key="NSInitialValue">value</string>
</object>
+ <object class="NSDictionaryController" id="86063028">
+ <bool key="NSAvoidsEmptySelection">YES</bool>
+ <bool key="NSPreservesSelection">YES</bool>
+ <bool key="NSSelectsInsertedObjects">YES</bool>
+ <bool key="NSFilterRestrictsInsertion">YES</bool>
+ <object class="NSArray" key="NSSortDescriptors">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSSortDescriptor">
+ <string key="NSKey">key</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
+ </object>
+ <bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
+ <string key="NSInitialKey">key</string>
+ <string key="NSInitialValue">value</string>
+ </object>
<object class="NSCustomObject" id="974608694">
<string key="NSClassName">MetadataKeyFormatter</string>
</object>
+ <object class="NSCustomObject" id="685782685">
+ <string key="NSClassName">SharingNameFormatter</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
</object>
<int key="connectionID">294</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">contentDictionary: node.pithosObject.sharing</string>
+ <reference key="source" ref="86063028"/>
+ <reference key="destination" ref="1001"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="86063028"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">contentDictionary: node.pithosObject.sharing</string>
+ <string key="NSBinding">contentDictionary</string>
+ <string key="NSKeyPath">node.pithosObject.sharing</string>
+ <object class="NSDictionary" key="NSOptions">
+ <string key="NS.key.0">NSValueTransformerName</string>
+ <string key="NS.object.0">SharingDictionaryTransformer</string>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">298</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">content: arrangedObjects</string>
+ <reference key="source" ref="247900786"/>
+ <reference key="destination" ref="86063028"/>
+ <object class="NSNibBindingConnector" key="connector" id="687753622">
+ <reference key="NSSource" ref="247900786"/>
+ <reference key="NSDestination" ref="86063028"/>
+ <string key="NSLabel">content: arrangedObjects</string>
+ <string key="NSBinding">content</string>
+ <string key="NSKeyPath">arrangedObjects</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">299</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">selectionIndexes: selectionIndexes</string>
+ <reference key="source" ref="247900786"/>
+ <reference key="destination" ref="86063028"/>
+ <object class="NSNibBindingConnector" key="connector" id="251663882">
+ <reference key="NSSource" ref="247900786"/>
+ <reference key="NSDestination" ref="86063028"/>
+ <string key="NSLabel">selectionIndexes: selectionIndexes</string>
+ <string key="NSBinding">selectionIndexes</string>
+ <string key="NSKeyPath">selectionIndexes</string>
+ <reference key="NSPreviousConnector" ref="687753622"/>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">301</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">sortDescriptors: sortDescriptors</string>
+ <reference key="source" ref="247900786"/>
+ <reference key="destination" ref="86063028"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="247900786"/>
+ <reference key="NSDestination" ref="86063028"/>
+ <string key="NSLabel">sortDescriptors: sortDescriptors</string>
+ <string key="NSBinding">sortDescriptors</string>
+ <string key="NSKeyPath">sortDescriptors</string>
+ <reference key="NSPreviousConnector" ref="251663882"/>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">303</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: arrangedObjects.key</string>
+ <reference key="source" ref="151509599"/>
+ <reference key="destination" ref="86063028"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="151509599"/>
+ <reference key="NSDestination" ref="86063028"/>
+ <string key="NSLabel">value: arrangedObjects.key</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">arrangedObjects.key</string>
+ <object class="NSDictionary" key="NSOptions">
+ <string key="NS.key.0">NSValidatesImmediately</string>
+ <boolean value="YES" key="NS.object.0"/>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">307</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: arrangedObjects.value</string>
+ <reference key="source" ref="434421234"/>
+ <reference key="destination" ref="86063028"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="434421234"/>
+ <reference key="NSDestination" ref="86063028"/>
+ <string key="NSLabel">value: arrangedObjects.value</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">arrangedObjects.value</string>
+ <object class="NSDictionary" key="NSOptions">
+ <string key="NS.key.0">NSValidatesImmediately</string>
+ <boolean value="YES" key="NS.object.0"/>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">310</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">add:</string>
+ <reference key="source" ref="86063028"/>
+ <reference key="destination" ref="1002056463"/>
+ </object>
+ <int key="connectionID">311</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">remove:</string>
+ <reference key="source" ref="86063028"/>
+ <reference key="destination" ref="218462401"/>
+ </object>
+ <int key="connectionID">312</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: canRemove</string>
+ <reference key="source" ref="218462401"/>
+ <reference key="destination" ref="86063028"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="218462401"/>
+ <reference key="NSDestination" ref="86063028"/>
+ <string key="NSLabel">enabled: canRemove</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">canRemove</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">316</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">metadataDictionaryController</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1051118663"/>
+ </object>
+ <int key="connectionID">319</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sharingDictionaryController</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="86063028"/>
+ </object>
+ <int key="connectionID">320</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">formatter</string>
+ <reference key="source" ref="50414786"/>
+ <reference key="destination" ref="685782685"/>
+ </object>
+ <int key="connectionID">322</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<reference ref="413572703"/>
</object>
<reference key="parent" ref="1006"/>
+ <string key="objectName">Scroll View - Table View - Sharing</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">69</int>
<reference key="object" ref="434421234"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="574425450"/>
+ <reference ref="469414486"/>
</object>
<reference key="parent" ref="247900786"/>
</object>
<reference key="parent" ref="151509599"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">80</int>
- <reference key="object" ref="574425450"/>
- <reference key="parent" ref="434421234"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">81</int>
<reference key="object" ref="1048447927"/>
<reference key="parent" ref="1056330804"/>
<reference key="object" ref="631288671"/>
<reference key="parent" ref="889445631"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">295</int>
+ <reference key="object" ref="86063028"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Dictionary Controller (Sharing)</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">314</int>
+ <reference key="object" ref="469414486"/>
+ <reference key="parent" ref="434421234"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">321</int>
+ <reference key="object" ref="685782685"/>
+ <reference key="parent" ref="0"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<string>27.IBPluginDependency</string>
<string>28.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
+ <string>295.IBPluginDependency</string>
<string>3.IBPluginDependency</string>
<string>30.IBPluginDependency</string>
<string>31.IBPluginDependency</string>
+ <string>314.IBComboBoxObjectValuesKey.objectValues</string>
+ <string>314.IBPluginDependency</string>
<string>32.IBPluginDependency</string>
+ <string>321.IBPluginDependency</string>
<string>33.IBPluginDependency</string>
<string>34.IBPluginDependency</string>
<string>35.IBPluginDependency</string>
<string>78.IBPluginDependency</string>
<string>79.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
- <string>80.IBPluginDependency</string>
<string>81.IBPluginDependency</string>
<string>85.IBPluginDependency</string>
<string>86.IBPluginDependency</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSArray">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>read</string>
+ <string>write</string>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">294</int>
+ <int key="maxID">322</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
--- /dev/null
+//
+// SharingDictionaryTransformer.m
+// pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+//
+// 1. Redistributions of source code must retain the above
+// copyright notice, this list of conditions and the following
+// disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "SharingDictionaryTransformer.h"
+
+@implementation SharingDictionaryTransformer
+
++ (Class)transformedValueClass {
+ return [NSMutableDictionary class];
+}
+
++ (BOOL)allowsReverseTransformation {
+ return YES;
+}
+
+- (id)transformedValue:(id)value {
+ NSMutableDictionary *sharingDictionary = [NSMutableDictionary dictionary];
+
+ if (value == nil)
+ return sharingDictionary;
+
+ NSRange readRange = [(NSString *)value rangeOfString:@"read=" options:NSCaseInsensitiveSearch];
+ NSUInteger readStart = readRange.location + readRange.length;
+ NSRange writeRange = [(NSString *)value rangeOfString:@"write=" options:NSCaseInsensitiveSearch];
+ NSUInteger writeStart = writeRange.location + writeRange.length;
+ if (writeRange.length == 0) {
+ if (readRange.length == 0) {
+ return sharingDictionary;
+ }
+ for (NSString *readUser in [[(NSString *)value substringFromIndex:readStart] componentsSeparatedByString:@","]) {
+ [sharingDictionary setValue:@"read" forKey:readUser];
+ }
+ } else if (readRange.length == 0) {
+ for (NSString *writeUser in [[(NSString *)value substringFromIndex:writeStart] componentsSeparatedByString:@","]) {
+ [sharingDictionary setValue:@"write" forKey:writeUser];
+ }
+ } else if (readRange.location < writeRange.location) {
+ NSRange semicolonRange = [(NSString *)value rangeOfString:@";"];
+ for (NSString *readUser in [[(NSString *)value substringWithRange:NSMakeRange(readStart, semicolonRange.location - readStart)] componentsSeparatedByString:@","]) {
+ [sharingDictionary setValue:@"read" forKey:readUser];
+ }
+ for (NSString *writeUser in [[(NSString *)value substringFromIndex:writeStart] componentsSeparatedByString:@","]) {
+ [sharingDictionary setValue:@"write" forKey:writeUser];
+ }
+ } else {
+ NSRange semicolonRange = [(NSString *)value rangeOfString:@";"];
+ for (NSString *readUser in [[(NSString *)value substringFromIndex:readStart] componentsSeparatedByString:@","]) {
+ [sharingDictionary setValue:@"read" forKey:readUser];
+ }
+ for (NSString *writeUser in [[(NSString *)value substringWithRange:NSMakeRange(writeStart, semicolonRange.location - writeStart)] componentsSeparatedByString:@","]) {
+ [sharingDictionary setValue:@"write" forKey:writeUser];
+ }
+ }
+
+ return sharingDictionary;
+}
+
+- (id)reverseTransformedValue:(id)value {
+ if (value == nil || ([(NSMutableDictionary *)value count] == 0))
+ return nil;
+
+ NSString *readSharingString = nil;
+ NSArray *readUsers = [(NSMutableDictionary *)value allKeysForObject:@"read"];
+ if ([readUsers count])
+ readSharingString = [NSString stringWithFormat:@"read=%@", [readUsers componentsJoinedByString:@","]];
+ NSString *writeSharingString = nil;
+
+ NSArray *writeUsers = [(NSMutableDictionary *)value allKeysForObject:@"write"];
+ if ([writeUsers count])
+ writeSharingString = [NSString stringWithFormat:@"write=%@", [writeUsers componentsJoinedByString:@","]];
+
+
+ if (readSharingString) {
+ if (writeSharingString) {
+ return [NSString stringWithFormat:@"%@;%@", readSharingString, writeSharingString];
+ }
+ return readSharingString;
+ } else {
+ return writeSharingString;
+ }
+}
+
++ (void)initialize {
+ [[NSValueTransformer class] setValueTransformer:[self new] forName:@"SharingDictionaryTransformer"];
+}
+
+@end