@Override public void setWindow(final NSWindow window) { window.setContentMinSize(window.frame().size); super.setWindow(window); }
/** * 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()); }
@Override public void setWindow(final NSWindow window) { window.setContentMinSize(window.frame().size); super.setWindow(window); }
@Override public void windowWillClose(final NSNotification notification) { // Convert from lower left to top left coordinates cascade = new NSPoint(this.window().frame().origin.x.doubleValue(), this.window().frame().origin.y.doubleValue() + this.window().frame().size.height.doubleValue()); super.windowWillClose(notification); }
public NSSize windowWillResize_toSize(final NSWindow window, final NSSize newSize) { // Only allow horizontal sizing return new NSSize(newSize.width.doubleValue(), window.frame().size.height.doubleValue()); }
@Override public void setWindow(final NSWindow window) { window.setContentMinSize(window.frame().size); window.setContentMaxSize(new NSSize(600, window.frame().size.height.doubleValue())); this.addObserver(new BookmarkObserver() { @Override public void change(final Host bookmark) { window.setTitle(BookmarkNameProvider.toString(bookmark)); } }); super.setWindow(window); cascade = this.cascade(cascade); }
@Override public void setWindow(NSWindow window) { window.setContentMinSize(window.frame().size); window.setTitle(LocaleFactory.localizedString("Activity")); super.setWindow(window); }
@Override public void setWindow(final NSWindow window) { window.setFrameAutosaveName("Info"); window.setHidesOnDeactivate(false); window.setShowsResizeIndicator(true); window.setContentMinSize(window.frame().size); window.setContentMaxSize(new NSSize(600, window.frame().size.height.doubleValue())); super.setWindow(window); if(!preferences.getBoolean("browser.info.inspector")) { cascade = this.cascade(cascade); } }
private double toolbarHeightForWindow(final NSWindow window) { NSRect windowFrame = NSWindow.contentRectForFrameRect_styleMask(window.frame(), window.styleMask()); return windowFrame.size.height.doubleValue() - window.contentView().frame().size.height.doubleValue(); }
@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); }
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; }
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); }
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; }
@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; }
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; }