Gk browser editing arrays

Makes it possible to 

*add or delete one or more object in a table
*create and insert one or more objects at selected rows in array
*remove one or more objects from array at selected rows
*ditto plus delete
*move one or more objects within an array by dragging

The created objects are filled with default values set in my code. Should probably check if defaults exist for the classes and use that when possible. The logic for letting the browser produce the default values is that the user might want to customise this, and the browser user might not have access to the model classes.

I know this is a big merge, but there isn't really any good way to split it into smaller merges. I will provide a  flow chart for the actions, since each interaction involves around half a dozen methods in 3 or 4 classes.
> it starts out trying with a random 8 bit int, then 9 bits etc.

Wouldn't it be better to show a popup where the user can enter the key?
Then we can manually check if it is unique before adding the object. I
think that inserting random values could be really confusing to the user.


On Thursday, November 20, 2014, Gustaf Kugelberg <notifications@github.com>
wrote:

> In
> tools/RealmBrowser/RealmBrowser/Classes/RLMInstanceTableViewController.m:
>
> >      RLMRealm *realm = self.parentWindowController.modelDocument.presentedRealm.realm;
> > -    RLMTypeNode *displayedType = self.displayedType;
> > -    RLMObjectSchema *objectSchema = displayedType.schema;
> > -
> > -    NSUInteger rowsToInsert = MAX(rowIndexes.count, 1);
> > -    NSUInteger rowToInsertAt = rowIndexes.firstIndex;
> > -
> > -    if (rowToInsertAt == -1) {
> > -        rowToInsertAt = 0;
> > +
> > +    NSMutableDictionary *objectBlueprint = [NSMutableDictionary dictionary];
> > +    for (RLMProperty *property in self.displayedType.schema.properties) {
> > +        objectBlueprint[property.name] = [self defaultValueForPropertyType:property.type];
>
> I added some methods that create unique objects in the presence of primary
> keys. They will need to be updated of if we add new types of primary keys,
> but for now they make it possible to add new objects in primary keyed
> tables. The time punishment for this is less than millisecond for int keys,
> and much less for string keys.
>
> In order not to increase the size of the column unnecessarily for ints, it
> starts out trying with a random 8 bit int, then 9 bits etc.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/realm/realm-cocoa/pull/1056/files#r20639607>.
>