Copyright ã1993 Christopher J. Kane.  All Rights Reserved.

FindPanelClass

Category Of:	Application

Declared In:	FindPanelClass.h

Category Description

The FindPanelClass category of Application simplifies the interfacing of the FindPanel class bundle to an application.  If the FindPanel class is integrated into a project as a self-contained dynamically loaded class bundle and this category is added to the main project, the loading of the FindPanel class and the construction of the FindPanel itself will be delayed until the user (or code in the application) first demands it.  This can reduce the launch time of an application, at the expense of a small extra delay the first time the user asks for the facilities of the FindPanel.

Because the FindPanel class, when it exists in a dynamically loading bundle, is not linked into the main executable of an application, the class cannot be referred to directly in the usual Objective-C way to send it class messages, nor is there anything to which connections can easily be made in a .nib file.  This category of Application solves these problems by providing action methods that will forward the messages to the FindPanel, and methods with which the FindPanel class and instance can be gotten.  It also does the dynamic loading of the class code when it is first needed.

If NXApp's delegate implements one or more of the delegate methods, it will be notified when the FindPanel class has been loaded, or when the FindPanel will be created or has been created.  This functionality is only part of this category; it is not implemented by the FindPanel class.

Instance Methods

enterSelection:
	- enterSelection:sender

Sends the FindPanel its enterSelection: action message, and returns the value returned by that method.

findNext:
	- findNext:sender

Sends the FindPanel its findForward: action message, and returns the value returned by that method.

findPanel
	- (FindPanel *)findPanel

Returns the FindPanel instance, loading the class and creating it if necessary.  If the panel could not be created, nil is returned.

findPanelClass
	- (Class)findPanelClass

Returns the FindPanel class, loading it first if necessary.  If the class could not be loaded, Nil is returned.  This method does not cause the FindPanel instance to be created.

findPrevious:
	- findPrevious:sender

Sends the FindPanel its findBackward: action message, and returns the value returned by that method.

isFindPanelClassLoaded
	- (BOOL)isFindPanelClassLoaded

Returns YES if the FindPanel class has been loaded (or attempted to be loaded), NO otherwise.  This method does not cause the FindPanel class to be loaded.

isFindPanelLoaded
	- (BOOL)isFindPanelLoaded

Returns YES if the FindPanel instance has been created (or attempted to be created), NO otherwise.  This method does not cause the FindPanel instance to be created.

jumpToSelection:
	- jumpToSelection:sender

Sends the FindPanel its jumpToSelection: action message, and returns the value returned by that method.

orderFrontFindPanel:
	- orderFrontFindPanel:sender

Sends the FindPanel the makeKeyAndOrderFront: message, and returns the value returned by that method.

Delegate Methods

findPanelClassWasLoaded:
	- (Class)findPanelClassWasLoaded:(Class)theClass

Notifies NXApp's delegate, if it responds to this message, that the FindPanel class was dynamically loaded (or was at least attempted to be loaded).  The class is passed as the parameter.  If theClass is Nil, then the class could not be loaded.  An implementation of this method is a good place to use the setReplacementEnabled: and setFindPbEnabled: FindPanel class methods.  Note that the FindPanel itself has not yet been created when this method is called; if you wish to manipulate a control in the FindPanel directly, for instance, do that from within an implementation of the findPanelDidLoad: delegate method.

The delegate is given the chance to substitute another class for the class just loaded by returning a different class; theClass should be returned if the delegate does not want to substitute another class.  This functionality is of dubious value, except in cases where the FindPanel class could not be loaded (theClass is Nil).  Then the delegate may choose to try to load the class itself, use a different class (which must be semantically equivalent to the FindPanel class), display an alert panel to the user, or some other appropriate action.  Substituting another class for a succesfully loaded FindPanel class is not recommended.

findPanelDidLoad:
	- (FindPanel *)findPanelDidLoad:(FindPanel *)thePanel

Notifies NXApp's delegate, if it responds to this message, that the FindPanel instance was created (or was at least attempted to be created).  The panel is passed as the parameter.  If thePanel is nil, then the panel could not be created.  This is a good place in which to configure specific controls within the FindPanel.  The delegate may substitute another panel for the loaded FindPanel by returning a value other than thePanel.  If the FindPanel class could not load the FindPanel, the user is always shown an alert panel (by the sharedInstance class method) explaining that.  However, if you have substituted another class for the FindPanel class (see the delegate method findPanelClassWasLoaded:, above), it is up to the substituted class or this method to inform the user.  Note, also, that substituting another panel only "applies" to the methods in this category; the FindPanel class retains the former panel or nil (if there was an error creating the panel).  Substituting another panel for a successfully loaded FindPanel is not recommended.  This method is called from within this category's findPanel method.

findPanelWillLoad:
	- findPanelWillLoad:(Class)theClass

Notifies NXApp's delegate that the class theClass (usually the FindPanel class) is about to create the FindPanel instance.  The FindPanel instance should not be accessed from within this method; use the findPanelDidLoad: method to configure parts of the FindPanel before the panel is put on-screen.  This method is called from within this category's findPanel method.  The return value is ignored.