Codota Logo
NSRect.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.rococoa.cocoa.foundation.NSRect
constructor

Best Java code snippets using org.rococoa.cocoa.foundation.NSRect.<init> (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: iterate-ch/cyberduck

if(event != null) {
  NSPoint dragPosition = view.convertPoint_fromView(event.locationInWindow(), null);
  NSRect imageRect = new NSRect(new NSPoint(dragPosition.x.doubleValue() - 16, dragPosition.y.doubleValue() - 16), new NSSize(32, 32));
  view.dragPromisedFilesOfTypes(NSMutableArray.arrayWithObject(fileTypes.iterator().next()), imageRect, this.id(), true, event);
origin: iterate-ch/cyberduck

/**
 * Overlay badge image.
 *
 * @param badge Overlay
 * @param icon  Icon
 * @return Cached icon
 */
@Override
protected NSImage badge(final NSImage badge, final NSImage icon) {
  NSImage f = NSImage.imageWithSize(icon.size());
  f.lockFocus();
  icon.drawInRect(new NSRect(new NSPoint(0, 0), icon.size()),
    NSZeroRect, NSGraphics.NSCompositeSourceOver, 1.0f);
  badge.drawInRect(new NSRect(new NSPoint(0, 0), badge.size()),
    NSZeroRect, NSGraphics.NSCompositeSourceOver, 1.0f);
  f.unlockFocus();
  return f;
}
origin: iterate-ch/cyberduck

@Override
public void loadBundle(final NSAlert alert) {
  this.inputField = NSTextField.textfieldWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 22));
  this.inputField.cell().setPlaceholderString(alert.informativeText());
  super.loadBundle(alert);
}
origin: iterate-ch/cyberduck

  /**
   * @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 = FoundationKitFunctionsLibrary.NSUnionRect(contentRect, subview.frame());
    }
    return contentRect;
  }
}
origin: iterate-ch/cyberduck

public NSView getAccessoryView(final NSAlert alert) {
  if(this.hasLocation()) {
    view = NSView.create(new NSRect(alert.window().frame().size.width.doubleValue(), 0));
    regionPopup = NSPopUpButton.buttonWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 26));
    regions.stream().sorted(Comparator.comparing(Location.Name::toString)).forEach(region -> {
      regionPopup.addItemWithTitle(region.toString());
      regionPopup.itemWithTitle(region.toString()).setRepresentedObject(region.getIdentifier());
      if(region.getIdentifier().equals(PreferencesFactory.get().getProperty("s3.location"))) {
        regionPopup.selectItem(regionPopup.lastItem());
      }
    });
    // Override accessory view with location menu added
    regionPopup.setFrameOrigin(new NSPoint(0, 0));
    view.addSubview(regionPopup);
    inputField.setFrameOrigin(new NSPoint(0, this.getFrame(alert, view).size.height.doubleValue() + view.subviews().count().doubleValue() * SUBVIEWS_VERTICAL_SPACE));
    view.addSubview(inputField);
    return view;
  }
  return super.getAccessoryView(alert);
}
origin: iterate-ch/cyberduck

public NSView getAccessoryView(final NSAlert alert) {
  view = NSView.create(new NSRect(alert.window().frame().size.width.doubleValue(), 0));
  regionPopup = NSPopUpButton.buttonWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 26));
  regionPopup.setFrameOrigin(new NSPoint(0, 0));
  for(Location.Name region : regions) {
    regionPopup.addItemWithTitle(region.toString());
    regionPopup.itemWithTitle(region.toString()).setRepresentedObject(region.getIdentifier());
    if(region.getIdentifier().equals(PreferencesFactory.get().getProperty("s3.location"))) {
      regionPopup.selectItem(regionPopup.lastItem());
    }
  }
  // Override accessory view with location menu added
  view.addSubview(regionPopup);
  return view;
}
origin: iterate-ch/cyberduck

public GotoController(final BrowserController parent, final Cache<Path> cache) {
  this.parent = parent;
  this.cache = cache;
  folderCombobox = NSComboBox.textfieldWithFrame(new NSRect(0, 26));
  folderCombobox.setCompletes(true);
  folderCombobox.setUsesDataSource(true);
  folderComboboxModel = new FolderComboboxModel(parent.workdir());
  folderCombobox.setDataSource(folderComboboxModel.id());
  folderCombobox.setStringValue(parent.workdir().getAbsolute());
}
origin: iterate-ch/cyberduck

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;
}
origin: iterate-ch/cyberduck

@Override
public NSView getAccessoryView(final NSAlert alert) {
  view = NSView.create(new NSRect(alert.window().frame().size.width.doubleValue(), 0));
  if(options.keychain) {
    keychainCheckbox = NSButton.buttonWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 18));
    keychainCheckbox.setTitle(LocaleFactory.localizedString("Save Password", "Keychain"));
    keychainCheckbox.setAction(Foundation.selector("keychainCheckboxClicked:"));
    keychainCheckbox.setTarget(this.id());
    keychainCheckbox.setButtonType(NSButton.NSSwitchButton);
    keychainCheckbox.setState(options.save ? NSCell.NSOnState : NSCell.NSOffState);
    keychainCheckbox.sizeToFit();
    // Override accessory view with location menu added
    keychainCheckbox.setFrameOrigin(new NSPoint(0, this.getFrame(alert, view).size.height.doubleValue()));
    view.addSubview(keychainCheckbox);
  }
  inputField = NSSecureTextField.textfieldWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 22));
  inputField.cell().setPlaceholderString(options.getPasswordPlaceholder());
  inputField.setFrameOrigin(new NSPoint(0, this.getFrame(alert, view).size.height.doubleValue() + view.subviews().count().doubleValue() * SUBVIEWS_VERTICAL_SPACE));
  view.addSubview(inputField);
  return view;
}
origin: iterate-ch/cyberduck

/**
 * Resize window frame to fit the content view of the currently selected tab.
 */
private void resize() {
  final NSRect windowFrame = NSWindow.contentRectForFrameRect_styleMask(window.frame(), window.styleMask());
  final double height = this.getMinWindowHeight();
  final NSRect frameRect = new NSRect(
    new NSPoint(windowFrame.origin.x.doubleValue(), windowFrame.origin.y.doubleValue() + windowFrame.size.height.doubleValue() - height),
    new NSSize(windowFrame.size.width.doubleValue(), height)
  );
  window.setFrame_display_animate(NSWindow.frameRectForContentRect_styleMask(frameRect, window.styleMask()),
    true, window.isVisible());
}
origin: iterate-ch/cyberduck

  return false;
final NSPopUpButton bookmarksPopup = NSPopUpButton.buttonWithFrame(new NSRect(0, 26));
bookmarksPopup.setToolTip(LocaleFactory.localizedString("Bookmarks", "Browser"));
for(Host b : bookmarks) {
origin: iterate-ch/cyberduck

public NSView getAccessoryView(final NSAlert alert) {
  view = NSView.create(new NSRect(alert.window().frame().size.width.doubleValue(), 0));
  confirmField = NSSecureTextField.textfieldWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 22));
  confirmField.cell().setPlaceholderString(LocaleFactory.localizedString("Confirm Passphrase", "Cryptomator"));
  confirmField.setFrameOrigin(new NSPoint(0, 0));
  view.addSubview(confirmField);
  strengthIndicator = NSLevelIndicator.levelIndicatorWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 18));
  if(strengthIndicator.respondsToSelector(Foundation.selector("setLevelIndicatorStyle:"))) {
    strengthIndicator.setLevelIndicatorStyle(NSLevelIndicator.NSDiscreteCapacityLevelIndicatorStyle);
  }
  strengthIndicator.setFrameOrigin(new NSPoint(0, this.getFrame(alert, view).size.height.doubleValue() + view.subviews().count().doubleValue() * SUBVIEWS_VERTICAL_SPACE));
  view.addSubview(strengthIndicator);
  passwordField = NSSecureTextField.textfieldWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 22));
  passwordField.cell().setPlaceholderString(LocaleFactory.localizedString("Passphrase", "Cryptomator"));
  notificationCenter.addObserver(this.id(),
      Foundation.selector("passwordFieldTextDidChange:"),
      NSControl.NSControlTextDidChangeNotification,
    passwordField.id());
  passwordField.setFrameOrigin(new NSPoint(0, this.getFrame(alert, view).size.height.doubleValue() + view.subviews().count().doubleValue() * SUBVIEWS_VERTICAL_SPACE));
  view.addSubview(passwordField);
  final NSView accessory = super.getAccessoryView(alert);
  accessory.setFrameSize(this.getFrame(alert, accessory).size);
  accessory.setFrameOrigin(new NSPoint(0, this.getFrame(alert, view).size.height.doubleValue() + view.subviews().count().doubleValue() * SUBVIEWS_VERTICAL_SPACE));
  view.addSubview(accessory);
  return view;
}
origin: iterate-ch/cyberduck

/**
 * @param rowIndexes is the list of row numbers that will be participating in the drag.
 * @return To refuse the drag, return false. To start a drag, return true and place
 * the drag data onto pboard (data, owner, and so on).
 * @see NSTableView.DataSource
 * Invoked by view after it has been determined that a drag should begin, but before the drag has been started.
 * The drag image and other drag-related information will be set up and provided by the table view once this call
 * returns with true.
 */
@Override
public boolean tableView_writeRowsWithIndexes_toPasteboard(final NSTableView view, final NSIndexSet rowIndexes,
                              final NSPasteboard pboard) {
  for(NSUInteger index = rowIndexes.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = rowIndexes.indexGreaterThanIndex(index)) {
    pasteboard.add(this.getSource().get(index.intValue()));
  }
  NSEvent event = NSApplication.sharedApplication().currentEvent();
  if(event != null) {
    NSPoint dragPosition = view.convertPoint_fromView(event.locationInWindow(), null);
    NSRect imageRect = new NSRect(new NSPoint(dragPosition.x.doubleValue() - 16, dragPosition.y.doubleValue() - 16), new NSSize(32, 32));
    // Writing a promised file of the host as a bookmark file to the clipboard
    view.dragPromisedFilesOfTypes(NSArray.arrayWithObject("duck"), imageRect, this.id(), true, event);
    return true;
  }
  return false;
}
origin: iterate-ch/cyberduck

final NSPopUpButton button = NSPopUpButton.buttonWithFrame(new NSRect(52, 26));
button.setImage(bandwidth.image());
button.setMenu(bandwidthMenu);
final NSPopUpButton button = NSPopUpButton.buttonWithFrame(new NSRect(52, 26));
button.setImage(connections.image());
button.setMenu(connectionsMenu);
item.setTarget(controller.id());
item.setAction(type.action());
final NSButton button = NSButton.buttonWithFrame(new NSRect(0, 0));
button.setBezelStyle(NSButtonCell.NSTexturedRoundedBezelStyle);
button.setImage(type.image());
origin: iterate-ch/cyberduck

@Action
public void uploadButtonClicked(final ID sender) {
  uploadPanel = NSOpenPanel.openPanel();
  uploadPanel.setCanChooseDirectories(true);
  uploadPanel.setCanChooseFiles(pool.getFeature(Touch.class).isSupported(
    new UploadTargetFinder(workdir).find(this.getSelectedPath())
  ));
  uploadPanel.setCanCreateDirectories(false);
  uploadPanel.setTreatsFilePackagesAsDirectories(true);
  uploadPanel.setAllowsMultipleSelection(true);
  uploadPanel.setPrompt(LocaleFactory.localizedString("Upload", "Transfer"));
  if(uploadPanel.respondsToSelector(Foundation.selector("setShowsHiddenFiles:"))) {
    uploadPanelHiddenFilesCheckbox = NSButton.buttonWithFrame(new NSRect(0, 0));
    uploadPanelHiddenFilesCheckbox.setTitle(LocaleFactory.localizedString("Show Hidden Files"));
    uploadPanelHiddenFilesCheckbox.setTarget(this.id());
    uploadPanelHiddenFilesCheckbox.setAction(Foundation.selector("uploadPanelSetShowHiddenFiles:"));
    uploadPanelHiddenFilesCheckbox.setButtonType(NSButton.NSSwitchButton);
    uploadPanelHiddenFilesCheckbox.setState(NSCell.NSOffState);
    uploadPanelHiddenFilesCheckbox.sizeToFit();
    uploadPanel.setAccessoryView(uploadPanelHiddenFilesCheckbox);
  }
  uploadPanel.beginSheetForDirectory(new UploadDirectoryFinder().find(pool.getHost()).getAbsolute(),
    null, this.window,
    this.id(),
    Foundation.selector("uploadPanelDidEnd:returnCode:contextInfo:"),
    null);
}
origin: iterate-ch/cyberduck

item.setPaletteLabel(quickconnect.label());
item.setToolTip(quickconnect.tooltip());
final NSComboBox button = NSComboBox.textfieldWithFrame(new NSRect(170, 26));
button.setTarget(controller.id());
button.setAction(quickconnect.action());
final NSPopUpButton button = NSPopUpButton.buttonWithFrame(new NSRect(120, 26));
button.setImage(encoding.image());
button.setMenu(charsetMenu);
editMenu.setDelegate(controller.getEditMenuDelegate().id());
toolbarMenu.setSubmenu(editMenu);
final NSButton button = NSButton.buttonWithFrame(new NSRect(0, 0));
button.setBezelStyle(NSButtonCell.NSTexturedRoundedBezelStyle);
button.setImage(edit.image());
item.setTarget(controller.id());
item.setAction(terminal.action());
final NSButton button = NSButton.buttonWithFrame(new NSRect(0, 0));
button.setBezelStyle(NSButtonCell.NSTexturedRoundedBezelStyle);
button.setImage(terminal.image());
item.setLabel(BrowserToolbarItem.quicklook.label());
item.setPaletteLabel(BrowserToolbarItem.quicklook.label());
final NSButton button = NSButton.buttonWithFrame(new NSRect(0, 0));
button.setBezelStyle(NSButtonCell.NSTexturedRoundedBezelStyle);
button.setImage(BrowserToolbarItem.quicklook.image());
item.setToolTip(type.tooltip());
org.rococoa.cocoa.foundationNSRect<init>

Popular methods of NSRect

    Popular in Java

    • Updating database using SQL prepared statement
    • startActivity (Activity)
    • getSystemService (Context)
    • getResourceAsStream (ClassLoader)
      Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
    • HttpServer (com.sun.net.httpserver)
      This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
    • Container (java.awt)
      A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
    • Selector (java.nio.channels)
      A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
    • Collection (java.util)
      Collection is the root of the collection hierarchy. It defines operations on data collections and t
    • TimerTask (java.util)
      A task that can be scheduled for one-time or repeated execution by a Timer.
    • JButton (javax.swing)
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now