Search in sources :

Example 1 with NSObject

use of ch.cyberduck.binding.foundation.NSObject in project cyberduck by iterate-ch.

the class AlertController method getFrame.

protected NSRect getFrame(final NSAlert alert, final NSView accessory) {
    final NSRect frame = new NSRect(alert.window().frame().size.width.doubleValue(), accessory.frame().size.height.doubleValue());
    final NSEnumerator enumerator = accessory.subviews().objectEnumerator();
    NSObject next;
    while (null != (next = enumerator.nextObject())) {
        final NSView subview = Rococoa.cast(next, NSView.class);
        frame.size.height = new CGFloat(frame.size.height.doubleValue() + subview.frame().size.height.doubleValue() + SUBVIEWS_VERTICAL_SPACE * 2);
    }
    return frame;
}
Also used : NSEnumerator(ch.cyberduck.binding.foundation.NSEnumerator) NSObject(ch.cyberduck.binding.foundation.NSObject) NSRect(org.rococoa.cocoa.foundation.NSRect) NSView(ch.cyberduck.binding.application.NSView) CGFloat(org.rococoa.cocoa.CGFloat)

Example 2 with NSObject

use of ch.cyberduck.binding.foundation.NSObject in project cyberduck by iterate-ch.

the class AlertController method focus.

protected void focus(final NSAlert alert) {
    NSEnumerator buttons = alert.buttons().objectEnumerator();
    NSObject button;
    while ((button = buttons.nextObject()) != null) {
        final NSButton b = Rococoa.cast(button, NSButton.class);
        b.setTarget(this.id());
        b.setAction(Foundation.selector("closeSheet:"));
    }
    final NSView accessory = this.getAccessoryView(alert);
    if (accessory != null) {
        final NSRect frame = this.getFrame(alert, accessory);
        accessory.setFrameSize(frame.size);
        alert.setAccessoryView(accessory);
        alert.window().makeFirstResponder(accessory);
    }
    // First call layout and then do any special positioning and sizing of the accessory view prior to running the alert
    alert.layout();
    alert.window().recalculateKeyViewLoop();
}
Also used : NSButton(ch.cyberduck.binding.application.NSButton) NSEnumerator(ch.cyberduck.binding.foundation.NSEnumerator) NSObject(ch.cyberduck.binding.foundation.NSObject) NSRect(org.rococoa.cocoa.foundation.NSRect) NSView(ch.cyberduck.binding.application.NSView)

Example 3 with NSObject

use of ch.cyberduck.binding.foundation.NSObject in project cyberduck by iterate-ch.

the class ToolbarWindowController method getContentRect.

/**
 * @return Minimum size to fit content view of currently selected tab.
 */
private NSRect getContentRect() {
    NSRect contentRect = new NSRect(0, 0);
    final NSView view = tabView.selectedTabViewItem().view();
    final NSEnumerator enumerator = view.subviews().objectEnumerator();
    NSObject next;
    while (null != (next = enumerator.nextObject())) {
        final NSView subview = Rococoa.cast(next, NSView.class);
        contentRect = FoundationKitFunctions.library.NSUnionRect(contentRect, subview.frame());
    }
    return contentRect;
}
Also used : NSEnumerator(ch.cyberduck.binding.foundation.NSEnumerator) NSObject(ch.cyberduck.binding.foundation.NSObject) NSRect(org.rococoa.cocoa.foundation.NSRect) NSView(ch.cyberduck.binding.application.NSView)

Example 4 with NSObject

use of ch.cyberduck.binding.foundation.NSObject in project cyberduck by iterate-ch.

the class UserDefaultsPreferences method toList.

/**
 * Convert collection
 *
 * @param array List of properties
 * @return Collection
 */
private List<String> toList(final NSArray array) {
    if (null == array) {
        return Collections.emptyList();
    }
    final List<String> list = new ArrayList<>();
    NSEnumerator ordered = array.objectEnumerator();
    NSObject next;
    while (((next = ordered.nextObject()) != null)) {
        list.add(next.toString());
    }
    return list;
}
Also used : NSEnumerator(ch.cyberduck.binding.foundation.NSEnumerator) NSObject(ch.cyberduck.binding.foundation.NSObject) ArrayList(java.util.ArrayList) NSString(ch.cyberduck.binding.foundation.NSString)

Example 5 with NSObject

use of ch.cyberduck.binding.foundation.NSObject in project cyberduck by iterate-ch.

the class PlistDeserializer method objectForKey.

@Override
public NSDictionary objectForKey(final String key) {
    final NSObject value = dict.objectForKey(key);
    if (null == value) {
        return null;
    }
    if (value.isKindOfClass(NSDictionary.CLASS)) {
        return Rococoa.cast(value, NSDictionary.class);
    }
    log.warn(String.format("Unexpected value type for serialized key %s", key));
    return null;
}
Also used : NSObject(ch.cyberduck.binding.foundation.NSObject)

Aggregations

NSObject (ch.cyberduck.binding.foundation.NSObject)35 NSArray (ch.cyberduck.binding.foundation.NSArray)15 NSEnumerator (ch.cyberduck.binding.foundation.NSEnumerator)15 NSString (ch.cyberduck.binding.foundation.NSString)9 ArrayList (java.util.ArrayList)9 NSInteger (org.rococoa.cocoa.foundation.NSInteger)9 NSPoint (org.rococoa.cocoa.foundation.NSPoint)8 NSUInteger (org.rococoa.cocoa.foundation.NSUInteger)8 NSAttributedString (ch.cyberduck.binding.foundation.NSAttributedString)6 Action (ch.cyberduck.binding.Action)5 NSDictionary (ch.cyberduck.binding.foundation.NSDictionary)5 TransferItem (ch.cyberduck.core.transfer.TransferItem)5 NSView (ch.cyberduck.binding.application.NSView)4 NSNotification (ch.cyberduck.binding.foundation.NSNotification)4 NSURL (ch.cyberduck.binding.foundation.NSURL)4 DefaultMainAction (ch.cyberduck.core.threading.DefaultMainAction)4 UploadTransfer (ch.cyberduck.core.transfer.UploadTransfer)4 NSMutableAttributedString (ch.cyberduck.binding.foundation.NSMutableAttributedString)3 Local (ch.cyberduck.core.Local)3 HashMap (java.util.HashMap)3