Fix transcript in transfer window.
[cyberduck.git] / source / ch / cyberduck / ui / cocoa / SyncPromptModel.java
blob7cabeabac77af32221ed87babddbf61a4ec42c3b
1 package ch.cyberduck.ui.cocoa;
3 /*
4 * Copyright (c) 2007 David Kocher. All rights reserved.
5 * http://cyberduck.ch/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * Bug fixes, suggestions and comments should be sent to:
18 * dkocher@cyberduck.ch
21 import ch.cyberduck.binding.application.NSImage;
22 import ch.cyberduck.binding.foundation.NSObject;
23 import ch.cyberduck.core.Cache;
24 import ch.cyberduck.core.Session;
25 import ch.cyberduck.core.resources.IconCacheFactory;
26 import ch.cyberduck.core.synchronization.Comparison;
27 import ch.cyberduck.core.transfer.SyncTransfer;
28 import ch.cyberduck.core.transfer.TransferItem;
29 import ch.cyberduck.core.transfer.TransferStatus;
31 /**
32 * @version $Id$
34 public class SyncPromptModel extends TransferPromptModel {
36 private SyncTransfer transfer;
38 public SyncPromptModel(final TransferPromptController c, final Session session,
39 final SyncTransfer transfer, final Cache<TransferItem> cache) {
40 super(c, session, transfer, cache);
41 this.transfer = transfer;
44 public enum Column {
45 /**
46 * A column indicating if the file will be uploaded or downloaded
48 sync,
49 /**
50 * A column indicating if the file is missing and will be created
52 create
55 @Override
56 protected NSObject objectValueForItem(final TransferItem item, final String identifier) {
57 if(identifier.equals(Column.sync.name())) {
58 final Comparison compare = transfer.compare(item);
59 if(compare.equals(Comparison.remote)) {
60 return IconCacheFactory.<NSImage>get().iconNamed("transfer-download.tiff", 16);
62 if(compare.equals(Comparison.local)) {
63 return IconCacheFactory.<NSImage>get().iconNamed("transfer-upload.tiff", 16);
65 return null;
67 if(identifier.equals(Column.create.name())) {
68 final TransferStatus status = this.getStatus(item);
69 if(!status.isExists()) {
70 return IconCacheFactory.<NSImage>get().iconNamed("plus.tiff", 16);
72 return null;
74 return super.objectValueForItem(item, identifier);