PRCommandsWidget: problem with collecting available commands?
renggli at iam.unibe.ch
Wed Aug 15 21:03:47 MEST 2007
> - What's the point of the inheritance check?
You are right, the inheritance check is completely useless in the
current version of Pier. A few years ago the commands to add and edit
different structure classes were different subclasses of an abstract
add and edit command. Luckily this is no longer the case and therefor
this method can be simplified to:
| commands |
commands := self context commands.
^ self commandClasses select: [ :each | commands includes: each ]
I applied the same refactoring to PRViewsWidget which does the same
unnecessary and complicated checks.
> - Shouldn't the list of commands in the widget be a subset of the
> commands allowed in the context?
Exactly, this is what the new code is doing. It takes the selected
classes in the selected order, and then removes all that are not
useable in the current context.
> - Why shouldnt the widget just show the commands that the context
To allow people to customize (see the settings of the widget) what
commands to show in what order. For example by using two different
PRCommandsWidget's you can logically split commands like Login/Logout
and Add/Edit/Remove page from each other.
Time: 15 August 2007, 9:03:35 pm
- Fixed PRCommandsWidget>>items and PRViewsWidget>>items that was
doing far too much expecting a different command model that has been
dropped from pier a long time ago
- Kudos to Matthias Berth that reported this problem
More information about the smallwiki