PageRenderTime 120ms CodeModel.GetById 116ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/ConnectionWindowTitleTransformer.m

http://github.com/bububa/MongoHub-Mac
Objective C | 34 lines | 22 code | 5 blank | 7 comment | 3 complexity | 4dc83985c598c1f5d293c3f99e9e2e09 MD5 | raw file
 1//
 2//  ConnectionWindowTitleTransformer.m
 3//  MongoHub
 4//
 5//  Created by Syd on 10-4-25.
 6//  Copyright 2010 MusicPeace.ORG. All rights reserved.
 7//
 8
 9#import "ConnectionWindowTitleTransformer.h"
10#import "Connection.h"
11
12@implementation ConnectionWindowTitleTransformer
13
14+ (Class)transformedValueClass {
15    return [NSString class];
16}
17+ (BOOL)allowsReverseTransformation {
18    return NO;
19}
20- (id)transformedValue:(id)value 
21{
22    if (value)
23    {
24        if ([[value userepl] intValue] == 1) {
25            return [NSString stringWithFormat:@"%@ [%@]", [value alias], [value repl_name] ];
26        }else {
27            return [NSString stringWithFormat:@"%@ [%@:%@]", [value alias], [value host], [value hostport] ];
28        }
29
30    }
31	return nil;
32}
33
34@end