PATH  Documentation > Mac OS X > Application Kit Reference: Java

Table of Contents

NSPageLayout


Inherits from:
NSPanel : NSWindow : NSResponder : NSObject
Package:
com.apple.yellow.application


Class Description


NSPageLayout is a panel that queries the user for information such as paper type and orientation. This information is stored in an NSPrintInfo object, and is later used when printing. The NSPageLayout panel is created, displayed, and run (in a modal loop) when a runPageLayout message is sent to the NSApplication object. By default, this message is sent up the responder chain when the user chooses the Page Layout menu item.

Typically, you access an NSPageLayout panel by invoking the pageLayout method. When the class receives a pageLayout message, it returns an existing panel rather than create a new one. If a panel is reused, its attributes are reset to the default values so that the effect is the same as receiving a new panel. Because the NSPageLayout object returned by pageLayout may be reused, you should only modify it using methods explicitly declared by NSPageLayout. If you must modify an NSPageLayout object in other ways, don't modify the object returned by pageLayout; instead, create and manage your own instance.

In most cases it is unnecessary to subclass NSPageLayout-you can customize an NSPageLayout by specifying your own accessory view. You can add your own controls to an NSPageLayout through the setAccessoryView method. The panel is automatically resized to accommodate the NSView that you've added. Note that NSPageLayout does not have accessor methods to obtain the state of its controls. If controls you add through an accessory view need to know the values of existing controls (or vice versa) use the viewWithTag method. You obtain a specific control object by sending viewWithTag to the NSPageLayout object passing one of the following tags:

The value can then be obtained by sending an appropriate accessor message to the returned control object.




Method Types


Constructors
NSPageLayout
Creating an NSPageLayout
pageLayout
Running an NSPageLayout
runModal
runModalWithPrintInfo
Customizing an NSPageLayout
accessoryView
setAccessoryView
Accessing the NSPrintInfo
printInfo
readPrintInfo
writePrintInfo
Updating the display
pickedButton
pickedOrientation
pickedPaperSize
pickedUnits


Constructors



NSPageLayout

public NSPageLayout()

Description forthcoming.

public NSPageLayout( NSRect aRect, int anInt, int anInt, boolean aBoolean)

Description forthcoming.

public NSPageLayout( NSRect aRect, int anInt, int anInt, boolean aBoolean, NSScreen aScreen)

Description forthcoming.


Static Methods



pageLayout

public static NSPageLayout pageLayout()

Returns a shared NSPageLayout object or a newly created one if it doesn't already exist.


Instance Methods



accessoryView

public NSView accessoryView()

Returns the receiver's accessory view (used to customize the receiver).

See Also: setAccessoryView



pickedButton

public void pickedButton(Object sender)

Invoked when either the OK or Cancel buttons are clicked, and stops the receiver's modal loop. If the OK button was clicked, this method verifies that the height, width and scale entries are acceptable (they must hold positive numbers). If not, the unacceptable entry is selected and the panel isn't stopped. Subclasses should override this method to verify that the controls on the accessory view contain acceptable values.

See Also: pickedOrientation, pickedPaperSize, pickedUnits



pickedOrientation

public void pickedOrientation(Object sender)

Invoked when the user selects a page orientation (i.e., portrait or landscape). This method updates the height and width fields, and redraws the paper view.

See Also: pickedButton, pickedPaperSize, pickedUnits



pickedPaperSize

public void pickedPaperSize(Object sender)

Invoked when the user selects a paper size from the paper size list. Updates the height and width fields, redraws the paper view, and may switch the portrait/landscape orientation.

See Also: pickedButton, pickedOrientation, pickedUnits



pickedUnits

public void pickedUnits(Object sender)

Invoked when the user selects a new unit of measurement from the Units list. The height and width fields are updated.

Subclasses should override this method to update controls in the accessory view that contain unit values.

See Also: pickedButton, pickedOrientation, pickedPaperSize



printInfo

public NSPrintInfo printInfo()

Returns the NSPrintInfo object used when the receiver is run (set using the runModal or runModalWithPrintInfo methods).

See Also: readPrintInfo, writePrintInfo



readPrintInfo

public void readPrintInfo()

Sets the receiver's values to those stored in the NSPrintInfo object used when the receiver is run.

See Also: printInfo, writePrintInfo, runModal, runModalWithPrintInfo



runModal

public int runModal()

Displays the receiver and begins the modal loop. The receiver's values are recorded in the shared NSPrintInfo object. Returns CancelButton if the user clicks the Cancel button, otherwise returns OKButton.

See Also: pickedButton, runModalWithPrintInfo



runModalWithPrintInfo

public int runModalWithPrintInfo(NSPrintInfo printInfo)

Displays the receiver and begins the modal loop. The receiver's values are recorded in printInfo. Returns CancelButton if the user clicks the Cancel button, otherwise returns OKButton.

See Also: pickedButton, runModal



setAccessoryView

public void setAccessoryView(NSView aView)

Adds an NSView to the receiver. Invoke this method to add a custom view containing your controls. The receiver is automatically resized to accommodate aView. This method can be invoked repeatedly to change the accessory view depending on the situation. If aView is null, then the receiver's current accessory view, if any, is removed.

See Also: accessoryView



writePrintInfo

public void writePrintInfo()

Writes the receiver's values to the NSPrintInfo object used when the receiver is run.

See Also: printInfo, readPrintInfo, runModal, runModalWithPrintInfo




Table of Contents