GeneralTool


Inherits From:
NSObject
Conforms To:
WTool
Declared In:
GeneralTool.h


Class Description

GeneralTool is a useful superclass for basing tools upon. It manages a ParseManager for use by the subclasses, and stores away the WToolBox that is passed into wakeupBundle:toolbox. It provides outlets to the main view, the three predefined drawers, and the initial first responder, and implements the accessors to those drawers.

Most importantly, the class contains "empty" definitions of most of the methods required by the WTool protocol. Only dealloc and wakeupBundle:toolbox should inherit the behavior of super.


Instance Variables

IBOutlet NSView *oMainView;
IBOutlet NSView *oInitialFirstResponder;
IBOutlet NSDrawer *oDetailDrawer;
IBOutlet NSDrawer *oConfigurationDrawer;
WToolbox *mWToolbox;
ParseManager *mParseManager;

oMainViewOutlet to main view
oInitialFirstResponderOutlet to initial first responder in view
oDetailDrawerOutlet to the detail drawer
oConfigurationDrawerOutlet to the configuration drawer
mWToolboxReference to the toolbox object
mParseManagerReference to the ParseManager created for you


Method Types

Methods that are part of GeneralTool and are not part of the WTool protocol.
- toolbox
- parseManager
- loadSuccess:handle:parameter:
- loadSuccess:parameter:
- loadCancelledParameter:
- loadError:parameter:
Methods dealing with creation, selection, and deselection of a tool
- wakeupBundle:toolbox:
- wakeupBundle:toolbox:loaders:capacity:
- initialFirstResponder
- needsConfiguration
- toolSelected
- toolDeselected
Built-in periodic events
- toolPeriodic
Views and drawers
- configurationDrawer
- detailDrawer
- mainView
Selection opening and saving
- canOpenSelection
- canSaveSelection
- openSelection:
- selectedItemName
- selectedItemExtension
- saveSelectedItemToPath:hideExtension:
Filling menus
- multiParsers
- addHomePagesToDictionary:
New as of 1.5
- loadMore
- stopLoading

Instance Methods

addHomePagesToDictionary:

- (void)addHomePagesToDictionary:(NSMutableDictionary *)inDictionary

don't add anything to the home page list.


canOpenSelection

- (BOOL)canOpenSelection

Empty method that returns NO; subclasses can override this if desired.


canSaveSelection

- (BOOL)canSaveSelection

Empty method that returns NO; subclasses can override this if desired.


configurationDrawer

- (id)configurationDrawer

Return the configuration drawer from the outlet. That drawer should have its content view set.


detailDrawer

- (id)detailDrawer

Return the detail drawer from the outlet. That drawer should have its content view set.


initialFirstResponder

- (id)initialFirstResponder

Return the initial first responder from the outlet. If this is not hooked up, a warning will be logged. If this is hooked up to something invalid (such as an item inside a tab view that is not visible, a strange menu behavior where certain menus (Close, Customize Toolbar, etc.) are disabled.


loadCancelledParameter:

- (void)loadCancelledParameter:(id)inParam

Empty method; subclasses may override this if they use the built-in ParseManager


loadError:parameter:

- (void)loadError:(id)inError parameter:(id)inParam

Generic method that just shows an alert; subclasses may override this if they use the built-in ParseManager


loadMore

- (void)loadMore

Load more results, from clicking the More button. New as of 1.2.


loadSuccess:handle:parameter:

- (void)loadSuccess:(id)inData handle:(id)inURLHandle parameter:(id)inParam

General method that just invokes loadSuccess:parameter: and ignores the handle parameter. For backward compatibility, since most tools are written not needing the handle.


loadSuccess:parameter:

- (void)loadSuccess:(id)inData parameter:(id)inParam

Empty method; subclasses must override this if they use the built-in ParseManager. Or, they can override loadSuccess:handle:parameter:


mainView

- (id)mainView

Return the main view from the outlet


multiParsers

- (NSArray *)multiParsers

No multiparsers associated with the tool unless overridden.


needsConfiguration

- (BOOL)needsConfiguration

Return NO; subclasses can override this if configuration may be needed when the tool is chosen.


openSelection:

- (IBAction)openSelection:(id)sender

Empty method; subclasses should override this if canOpenSelection overridden.


parseManager

- (ParseManager *)parseManager

Return the ParseManager that is automatically managed for all subclasses of GeneralTool.


saveSelectedItemToPath:hideExtension:

- (BOOL)saveSelectedItemToPath:(NSString *)inPath hideExtension:(BOOL)inHideExtension

Empty method that returns NO; subclasses should override this canSaveSelection is overridden.


selectedItemExtension

- (NSString *)selectedItemExtension

Empty method that returns nil; subclasses should override this canSaveSelection is overridden.


selectedItemName

- (NSString *)selectedItemName

Empty method that returns nil; subclasses should override this canSaveSelection is overridden.


stopLoading

- (void)stopLoading

Stop loading, from clicking the Stop button. This handles the parseManager here; subclasses must implement any other functionality. New as of 1.2.


toolDeselected

- (void)toolDeselected

Stop any loading in progress; subclasses can override this if desired to do additional deeds.


toolPeriodic

- (NSString *)toolPeriodic

Empty method that returns nil; subclasses can override this if desired.


toolSelected

- (void)toolSelected

Empty method; subclasses can override this if desired.


toolbox

- (WToolbox *)toolbox

Return the toolbox associated with the window that the tool is displayed on.


wakeupBundle:toolbox:

- (BOOL)wakeupBundle:(NSBundle *)inBundle toolbox:(WToolbox *)inToolbox

Store the toolbox away, and create a ParseManager for use by these subclasses. Subclasses should invoke super in order to make use of the toolbox and parseManager methods.


wakeupBundle:toolbox:loaders:capacity:

- (BOOL)wakeupBundle:(NSBundle *)inBundle toolbox:(WToolbox *)inToolbox loaders:(int)inLoaders capacity:(int)inCapacity

Store the toolbox away, and create a ParseManager for use by these subclasses. Subclasses should invoke super in order to make use of the toolbox and parseManager methods. This variant creates a URLStackManager behind the scenes with the given number of concurrent loaders and max capacity.


Version 1.1 Copyright ©2003 by Karelia Software, LLC. All Rights Reserved.