|
Class: WindowBuilder
Object
|
+--WindowBuilder
|
+--UIBuilder
- Package:
- stx:libview2
- Category:
- Interface-Framework
- Version:
- rev:
1.191
date: 2024/02/09 11:44:05
- user: stefan
- file: WindowBuilder.st directory: libview2
- module: stx stc-classLibrary: libview2
an abstract class, providing general support for window building.
Concrete subclasses know how to create a view (with components) from
some interface spec (i.e. a windowSpec).
More subclasses are possible reading different spec formats (eg. XML based specs).
Also, subclasses may decide to build their view manually (programatically),
by redefining #setupWindowFor:.
The order of the lookup sequence to access an aspect is defined:
application
application class
additional class (applicationClass).
Methods to access any aspect are located in the 'spec creation aspect fetch' category.
Currently, the only well supported subclass is UIBuilder, which builds according an uiSpec,
as typically returned by the #windowSpec method of the application.
This used to be VisualWorks compatible in its format, and many older VW specs can be used
out of the box. However, VW decided to expose the namespace of widgets in the spec,
and thus newer VW specs will need a slight massage to work.
More may be added in the future (for example, to parse different UI
specs - thinking of motif's UIL specs, Windows DialogSpecs, YAML etc.).
[instance variables:]
window <View>
the view into which the components
are (have been) created from the specification.
Usually, this is a TopView instance, but might as well be
a subView (so apps can be embedded into other apps)
application <ApplicationModel>
the application object (typically an instance
of a subclass of ApplicationModel).
That one is usually supposed to provide
valueHolders for aspects, action methods
menuSpecs and possibly more windowSpecs.
Usually means, that most of those can also be
provided to the builder via a set of bindings,
which overrides those.
bindings <Dictionary>
can be set (or filled) with bindings for
aspects to be used when setting up the models
for components. Useful either to overwrite
corresponding appModel aspects or if the appModel
does not want to procide those.
(for example, to open a dialog and provide the
bindings in a dictionary - as opposed to
providing them via aspect methods)
visuals not yet used - for compatibility
focusSequence <Collection>
maintained during the build process;
contains tabable components.
This will be replaced by a more intelligent
mechanism in the near future.
namedComponents <Dictionary>
contains name->component associations for
all components which have a non-nil component
name. Created during the build process.
componentCreationHook <BlockOrNil>
can be set before the components are built
from the spec, to provide an arbitrary
callBacks-hook which will be invoked after
a component has been created from a spec.
The UIPainter uses this to maintain its
component<->spec assiciations.
Can be set by the app, to catch creation of
components and fiddle around during the
creation process (change extents, colors or whatever)
applicationClass <ClassOrNil>
can be set to provide an additional class which
is asked for aspects during the build process.
If not set, the app is asked, which itself asks
its class.
keyboardProcessor not yet used - for compatibility
Will eventually takeover the functionality
of the focusSequence, shortcuts & provide a hook
for the app.
subCanvasSpecs <Dictionary>
can be set by the app to provide subcanvas
specs (much like the bindings dictionary)
copyrightCOPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
class initialization
-
initialize
-
(comment from inherited method)
called only once - initialize signals
constants
-
windowTypeDialog
-
-
windowTypeNormal
-
-
windowTypePartner
-
-
windowTypePopUp
-
-
windowTypePopUpNotModal
-
-
windowTypePopUpWithFrame
-
-
windowTypeSlave
-
-
windowTypeToolDialog
-
-
windowTypeUndecorated
-
-
windowTypeUndecoratedResizable
-
debugging
-
stopOnError: aBoolean
-
enable/disable debug halt when aspects are missing.
Useful during development, to detect missing aspects.
The default is false.
-
verbose: aBoolean
-
enable/disable debug messages on the Transcript.
Useful during development, to detect missing aspects.
The default is off.
queries
-
isAbstract
-
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.
Compatibility-VW
-
source
-
same as #application, for ST-80 compatibility
-
source: anApplicationModel
-
same as #application:, for ST-80 compatibility
accessing
-
addBindings: moreBindings
-
used with subDialogs, which provide local bindings.
All bindings from moreBindings overwrite any local bindings.
-
application
-
return the application (an ApplicationModel),
for which the view is built.
This one is supposed to provide the aspects, menus etc.
-
application: anApplicationModel
-
set the application (an ApplicationModel),
for which the view is built.
This one is supposed to provide the aspects, menus etc.
-
applicationClass
-
return the value of the instance variable 'applicationClass' (automatically generated).
WARNING:
This is a private interface for the UIPainter to pass down the app-class
to the specs when editing.
-
applicationClass: aClass
-
set the value of the instance variable 'applicationClass'.
WARNING:
This is a private interface for the UIPainter to pass down the app-class
to the specs when editing.
-
aspectAt: aSymbol
-
return the aspect for a symbol or nil.
-
aspectAt: aSymbol ifAbsent: exceptionBlock
-
return the aspect for a symbol or the value from exceptionBlock.
-
aspectAt: aSymbol put: aModel
-
store an aspect identified by its symbol and its value.
Returns the stored aspect !
-
bindingAt: aSymbol
-
return the binding for a symbol or nil if there is none
-
bindingAt: aSymbol ifAbsentPut: anAspectOrBlock
-
return the binding for a symbol or nil if there is none
-
bindings
-
return my bindings
-
bindings: aDictionary
-
set bindings to a dictionary
-
componentAt: name
-
return a component identified by its name
Usage example(s):
^ appBuilder componentAt:name
|
Usage example(s):
^ masterBuilder componentAt:name
|
-
componentAt: name put: aComponent
-
store a component identified by its name.
-
componentCreationHook: aThreeArgBlock
-
set the value of the instance variable 'componentCreationHook'
-
componentToSpecMappingAt: aView
-
-
componentToSpecMappingAt: aView put: aSpec
-
self assert:(aSpec isKindOf:UISpecification).
-
findComponentAt: name
-
recursively search for a component identified by its name in myself
and all of my subApplications.
-
findComponentAt: name forWhichViewConformsTo: viewCheck ignoringViews: triedViews
-
recursively search for a visible component identified by its name in myself
and all of my subApplications.
As a builders applications view might be different from the builders view,
we must be careful to avoid endless recursion if a subview refers to the topviews builder,
(sigh)
-
findVisibleComponentAt: name
-
recursively search for a visible component identified by its name in myself
and all of my subApplications.
Be careful: this also searches for components in unmapped canvases.
-
helpKeyFor: aComponent
-
return the helpkey for a component or nil
-
helpKeyFor: aComponent put: aKey
-
assign a key for a component which is used to access the help text
from the application.
-
keyboardProcessor
-
return my keyboard processor
-
keyboardProcessor: aKeyboardProcessor
-
set my keyboard processor
-
labelAt: name
-
-
labelAt: name put: aLabelString
-
-
menuAt: aKey
-
Find a binding for the menu named aKey, either in the bindings
or from the source
-
menuAt: aSymbol put: someMenuOrHolder
-
add someMenuOrHolder as the binding for the menu named aSymbol to the bindings
-
namedComponents
-
return a list of named components
-
namedComponentsDo: aBlock
-
-
resources
-
return the application's resources -
that's a ResourcePack containing national language strings
-
subCanvasAt: majorKey at: minorKey
-
get the subCanvas or subSpec specification from major and minor key.
Here, we first look for a spec in the private subCanvasSpecs dictionary,
which can be filled via #specificationAt:at:put: messages.
If not present, or none is found there, we bounce back trying
#specificationFor: (if majorKey is nil) or by sending the minorKey
message to the class named as majorKey.
Notice, that the class named majorKey is first searched in the
application classes namespace - allowing private classes as majorKey.
-
subCanvasAt: majorKey at: minorKey put: aSpec
-
deposit an interfaceSpecification for major and minor key
in my private subCanvasSpecs dictionary.
This will be used later, when building,
to provide an interfaceSpec for a subcanvas or subSpecification
(or possibly override an application provided interfaceSpec).
See #subCanvasAt:at:.
-
visualAt: name
-
-
visualAt: name put: aVisual
-
-
visuals
-
-
visuals: aDictionary
-
-
window
-
return the window (view), for which an interface is (being) built.
Usually, this is tha application's top window; however, it is also possible
to build components inside a subview (such as a subCanvas)
-
window: aView
-
set the top window (view), for which an interface
is (being) built
-
windowGroup
-
-
windowTitle: aString
-
if the window is already created, change its title.
Otherwise, remember the title to be set when the window is created later
aspect access support
-
booleanValueAspectFor: aKey
-
helper (common code) to generate a boolean aspect if required.
If no binding exists for aKey, a valueHolder holding false
is created and added to the bindings.
Otherwise, the existing binding is returned.
-
listAspectFor: aKey
-
helper (common code) to generate a list model aspect if required.
If no binding exists for aKey, a new List is
created and added to the bindings.
Otherwise, the existing binding is returned.
-
nilValueAspectFor: aKey
-
helper (common code) to generate a valueHolder aspect if required.
If no binding exists for aKey, a valueHolder holding nil is
created and added to the bindings.
Otherwise, the existing binding is returned.
-
valueAspectFor: aKey
-
helper (common code) to generate a valueHolder aspect if required.
If no binding exists for aKey, a valueHolder holding nil is
created and added to the bindings.
Otherwise, the existing binding is returned.
-
valueAspectFor: aKey computeInitialValueWith: initialValueBlock
-
helper (common code) to generate a valueHolder aspect if required.
If no binding exists for aKey, a valueHolder holding initialValue is
created and added to the bindings.
Otherwise, the existing binding is returned.
The initial value is computed by evaluating initialValueBlock
-
valueAspectFor: aKey initialValue: initialValue
-
helper (common code) to generate a valueHolder aspect if required.
If no binding exists for aKey, a valueHolder holding initialValue is
created and added to the bindings.
Otherwise, the existing binding is returned.
building
-
buildFromSpec: aSpec
-
** This method must be redefined in concrete classes (subclassResponsibility) **
-
makeTabable: aComponent
-
add a component to the list of tabable components
-
setupWindowFor: aWindow
-
** This method must be redefined in concrete classes (subclassResponsibility) **
error handling
-
aspectNotFound: anAspect error: errorString
-
show error message on transcript (if Verbose is true)
and/or stop (if StopOnError) is true
message sending
-
safelyPerform: aSelector ifNone: aBlock
-
send the message aSelector to the application;
the result returned from the send or nil is returned
-
safelyPerform: aSelector with: anArgument ifNone: aBlock
-
send the one-arg-message aSelector to the application;
the result returned from the send or nil is returned
-
safelyPerform: aSelector with: arg1 with: arg2 ifNone: aBlock
-
send the two-arg-message aSelector to the application;
the result returned from the send or nil is returned
-
safelyPerform: aSelector with: arg1 with: arg2 with: arg3 ifNone: aBlock
-
send the 3-arg-message aSelector to the application;
the result returned from the send or nil is returned
-
safelyPerform: aSelector withArguments: arguments ifNone: aBlock
-
send the one-arg-message aSelector to the application;
the result returned from the send or aBlock is returned
queries
-
isEditing
-
true if building from a GUI builder resource ( UIPainter, ... ),
false if building for the real thing.
If true, no models or actions should be set (no application is running).
(i.e. the widgets have been built to be shown in the UIPainter, with no app instance)
resolving fonts
-
resolveFont: fontOrSymbolOrStyle
-
resolve fontOrSymbol to a real font
spec creation aspect fetch
-
actionFor: aKey
-
return an action for aKey. This is invoked during window building
(by the builder) to ask for an ActionButtons actionBlock.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a block.
-
actionFor: aKey withValue: aValue
-
return an action for aKey/value combonation.
This is invoked during window building
(by the builder) to ask for an ActionButtons actionBlock if that button
specified an action with an argument value.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a block.
-
actionFor: aKey withValue: arg1 withValue: arg2
-
return an action for aKey/value combination.
This is invoked during window building
(by the builder) to ask for an ActionButtons actionBlock if that button
specified an action with an argument value.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a block.
-
aspectFor: aKey
-
return a model for aKey. This is invoked during window building
(by the builder) to ask for an Editfield's, a Toggle's etc. model.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a valueHolder.
-
aspectFor: aKey ifAbsent: exceptionBlock
-
return a model for aKey. This is invoked during window building
(by the builder) to ask for an Editfield's, a Toggle's etc. model.
Here, first the local bindings are searched, then the application and
finally the application's class is asked for a corresponding action.
The returned object is typically a valueHolder.
-
componentFor: aKey
-
return a component for aKey. This is invoked during window building
(by the builder) to ask for an ArbitraryComponents view.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a view.
-
labelFor: aKey
-
return a label for aKey. This is invoked during window building
(by the builder) to ask for a ???'s label.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a string.
-
listFor: aKey
-
return a list for aKey. This is invoked during window building
(by the builder) to ask for a ???'s label.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically a list.
-
menuFor: aKey
-
Find a binding for the menu named aKey, either in the bindings
or from the source
-
specificationFor: aKey
-
return a specification for aKey. This is invoked during window building
(by the builder) to ask for the interfaceSpec for a subCanvas or subSpecification.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding interfaceSPec.
The returned object is typically an interfaceSpec array.
-
visualFor: aKey
-
return a visual (icon, image) for aKey. This is invoked during window building
(by the builder) to ask for some graphical labels.
Here, first the local bindings are searched, then the application and
finally the applications class is asked for a corresponding action.
The returned object is typically an image or form.
spec creation callbacks
-
createdComponent: aView forSpec: spec named: name
-
callback from the UISpec after a view has been
created for a spec.
If it has a name, add it to the namedComponents dictionary;
if I have a creationHook (application callBack), evaluate it.
startup
-
closeRequest
-
-
open
-
open my topView, as previously created
-
openAt: aPoint
-
open my topView at some location
-
openDialog
-
open my topView, as previously created as a modal view,
blocking interaction to the currently active view.
-
openDialogAt: aPoint
-
open my topView, as previously created as a modal view,
blocking interaction to the currently active view.
-
openDialogAt: aPoint withExtent: ext
-
open my topView, as previously created as a modal view,
blocking interaction to the currently active view.
-
openDialogWithExtent: ext
-
open my topView, as previously created as a modal view,
blocking interaction to the currently active view.
-
openModal
-
open my topView as a modal dialog, as previously created,
blocking interaction to the currently active view.
-
openPopUpAt: aPoint
-
open my topView, as previously created as a popUp view,
blocking interaction to the currently active view.
-
openPopUpIn: aRectangle
-
open my topView, as previously created as a popUp view,
blocking interaction to the currently active view.
-
openWindow
-
open my topView
-
openWindowAt: aPoint
-
open my topView at some location
-
openWindowAt: origin withExtent: ext andType: type
-
open my window, as previously created, optionally defining the
windows origin and/or extent.
The type argument may be #dialog or #normal, and specifies if the view
should be opened as a modal view, blocking interaction to the currently
active view, or as a normal view.
-
openWindowCenter
-
open my topView centered on the screen (dialog & normal only)
-
openWithExtent: aPoint
-
open my topView, as previously created, but override
the extent.
-
openWithExtent: ext andType: type
-
open my window, as previously created. The type argument
may be #dialog or #normal, and specifies if the view should
be opened as a modal view, blocking interaction to the currently
active view, or as a normal view.
startup-basic
-
openAt: origin withExtent: ext andType: type
-
open my window, as previously created, optionally defining the
windows origin and/or extent.
The type argument may be
#normal, #dialog, #popUp,
#toolDialog, #popupWithFrame, #slave, #partner, #popUpNotModal
#undecorated or #undecoratedResizable
and specifies how the view should be opened.
Most common are
#dialog: modal view (blocking interaction to the currently active view),
#popUp: blocking, undecorated
#normal: a standard view
testing
-
isWebPageBuilder
-
translating
-
translateString: aString
-
translate aString to the current language.
If there is an application, it knows best what to do
|