Hello everyone, I am glad to announce a step has been made in Spec with the introduction of five new models: TreeNodeModel, TreeColumnModel, MenuModel, MenuGroupModel and MenuItemModel.
I. Trees The two first models (TreeNodeModel, TreeColumnModel) are used to build and specify trees (in addition with TreeModel). a) TreeNodeModel TreeNode represent a node of the tree, and hold some basic information like what the children of the node are, or which icon to use. Previously, one could use directly subclasses of MorphTreeNodeModel directly. This has been removed to loose the bonds between Spec and Morphic. If you used direct Morphic nodes in your tree, you will need to replace them by TreeNodeModel instances. You could also have used TreeModel methods used to generically describe your nodes. In this case, the only change you will need is how you access the content of a node. The MorphTreeNodeModel method used for this is #item while in TreeNodeModel it is #content. TreeNodeModel also support filtering out of the box with an extensible mechanism. b) TreeColumnModel TreeColumnModel is used to specify the columns used to render the tree nodes. Where one used to use TreeColumnMorph, now TreeColumnModel have to be use. The mainly behave the same, only the API differs to provide a less morphic oriented set of methods. TreeColumnModel also resolve some some updating issue encountered in TreeColumnMorph. II. Menus The three remaining models are used to build menus for the spec models. The way to build menus has been rethink to provide a more natural way to think menus. a) MenuModel A MenuModel is a quite a simple object with only an optional name, an optional icon and a list of menu groups. A MenuModel can also be turned into an auto-refreshing menu. The main method of MenuModel is #addGroup: which takes a block as argument and build a group before adding it to the menu model groups list. Example: aMenu addGroup: [ :aGroup | aGroup addItem: [ :anItem | anItem name: 'Browse Full'; action: [ self browseSelectedObject ]; shortcut: $b command mac | $b alt win | $b alt unix ]. aGroup addItem: [ :anItem | anItem name: 'Browse Class'; action: [ self browseSelectedObjectClass ] ] ]. b) MenuGroupModel A MenuGroupModel represent a set of menu items which belong to a same logical set by providing related actions. A menu group only hold a list of menu items. The main method of MenuGroupModel is #addItem: , as you have seen in the previous example. Example: aGroup addItem: [ :anItem | anItem name: 'Browse Hierarchy'; action: [ self browseSelectedObjectClassHierarchy ]; shortcut: $h command mac | $h alt win | $h alt unix ] c) MenuItemModel A menu item is the core of a menu. It is the object that can actually perform an action. A MenuItemModel holds multiple information related to this action like the name of the menu entry, the optional icon you want to use, if the action is doable in the current context, and the optional shortcut triggering the action. An interesting feature is that by applying a menu to a spec model, the shortcuts of its items will be used to automatically bind the corresponding key combination to the menu item action (taking in account the context to prevent to fire action when it does not make sense). So far, this feature has been introduced only in NewListModel to fix the possible issues before a global deployment. Thanks for reading this long email, thanks for your support and your feedback, and see you soon :) Ben