From: Andy D. <an...@ma...> - 2004-05-19 17:52:26
|
With Spring RCP being so new, it appears the only documentation is the source. :-) So, after reading the source, let me see if I'm getting the idea (btw, I don't have any experience with Eclipse, so any concepts spring-rcp borrows from Eclipse I've learned only through spring-rcp source). If I'm getting this wrong, please let me know. An Application consists of one or more windows (ApplicationWindow), managed by WindowManager. An application has at least one window (a main window). A Window displays a single page (ApplicationPage) at a time. A page contains a View registry. This means a Page can contain multiple Views. So, if my application's main window consists of a single Page (which is really the only option, right?), then I can swap out the contents of the main window by swapping pages? I'm guessing an example of this would be "workbenches" in the IDE world? For example, if I am in Edit mode, then I have several views open on my page: maybe a folder view, an edit view, and an output view. In Debug mode, I have a "watches" view, breakpoint view, source code view, stack view, etc. With this understanding, I'm having trouble figuring out where the Perspective class fits in, as it seems to be a one-to-one relationshipship with a View (though it is by the view's ID and not a reference to a View itself). OK. On to Actions. In rcp, you have VisualActions and ActionHandlers. A VisualAction defines only the visual representation and keyboard access (menu item, toolbar item, icon, text, mnemonic, accelerator, etc). The actual functionality of the action is provided separately in an ActionHandler. Actions are registered in a global ActionRegistry, and ActionHandlers are registered with views (via the ViewContext). Well, I guess it is also possible to associate an ActionHandler directly with an Action (for those actions that are not view dependent). So, when a View becomes active, spring-rcp will query the view against every registered global Action to see if that View provides an ActionHandler for the Action. This means that the functionality of a particular Action can be dynamically implemented per-view (kinda cool, actually). It looks like for this to work, your Actions must also implement TargetableVisualAction (which is implemented by DefaultVisualAction). The org.springframework.rcp.action.contribution package seems to be all about building menus and toolbars. I'm not sure I have this right, since I haven't played around with it. Since an Application can present the user with multiple ways to do actions (menus, toolbars, pop up menus. etc), spring-rcp provides an abstraction that allows you to group such actions logically and automatically represent that group as any of these more concrete implementations. So, a ContributionItem is an abstraction on top of a menu item, toolbar button, etc and a ContributionItemManager is an abstraction on top of a menu bar, toolbar set, etc. ContributionItemManager allows you to group ContributionItems (via group id) - each group becoming a different menu along a menubar, or a different toolbar in a toolbar set(?) I'm not too sure about this actually. ContributionItem seems similar in many ways to an Action... but I guess it needs to be different because some menu items (such as seperators) are not actions? In fact, ActionContributionItem seems to be no more than a wrapper (adapter) that makes an Action look like a ContributionItem. A ContributionItem can create menu items and toolbar controls just like an Action can. Some questions on my exploration of the source so far: What is the preferred way for creating/configuring controls from spring-rcp? I don't see a common Page interface... it looks like dialogs get their own idea of what a page is and windows get another. Is this intentional? Well, that's about all the further I've gotten so far. BTW, if anyone has any example configuration files used with spring-rcp, I'd love to see them. Thanks, Andy |