/ConnectionWindowTitleTransformer.m
http://github.com/bububa/MongoHub-Mac · Objective C · 34 lines · 22 code · 5 blank · 7 comment · 3 complexity · 4dc83985c598c1f5d293c3f99e9e2e09 MD5 · raw file
- //
- // ConnectionWindowTitleTransformer.m
- // MongoHub
- //
- // Created by Syd on 10-4-25.
- // Copyright 2010 MusicPeace.ORG. All rights reserved.
- //
- #import "ConnectionWindowTitleTransformer.h"
- #import "Connection.h"
- @implementation ConnectionWindowTitleTransformer
- + (Class)transformedValueClass {
- return [NSString class];
- }
- + (BOOL)allowsReverseTransformation {
- return NO;
- }
- - (id)transformedValue:(id)value
- {
- if (value)
- {
- if ([[value userepl] intValue] == 1) {
- return [NSString stringWithFormat:@"%@ [%@]", [value alias], [value repl_name] ];
- }else {
- return [NSString stringWithFormat:@"%@ [%@:%@]", [value alias], [value host], [value hostport] ];
- }
- }
- return nil;
- }
- @end