root/gaphor/tags/gaphor-0.2.0/doc/capabilities.txt

Revision 173, 2.1 kB (checked in by arjanmol, 6 years ago)

*** empty log message ***

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 Gaphor capabilities
2 ~~~~~~~~~~~~~~~~~~~
3
4 One nice feature of user interfaces is the ability to disable options that
5 don't do anything useful in a specific context. For example: it's useles to
6 enable a 'undo' button when there's no information to undo.
7
8 To solve this two possible solutions can be provided:
9   1. special listeners are installed to intercept state changes and act
10   2. declarative: a (limited) set of 'capabilities' is provided. Each command
11      supports one or more capabilities.
12
13
14 Standard capabilities:
15   All UML metamodel classes can act as capability. Commands can only be
16   useful for a limited set of data elements (for example for Namespace like
17   elements). These capabilities can be assigned by giving the name of the
18   elements(s) that can be affected using a command as a string ('Namespace').
19   This option is most useful for popup menus.
20  
21 Main window capabilities:
22   Some actions are quite useless to do, like saving a model, while there is
23   no model.
24   For a start we will distinguish the following caps.:
25   - 'element': there are model elements defined in the main element factory.
26
27 Diagram window capabilities:
28   - 'focus': there is an item selected in a diagram and it has the focus.
29   - 'select': one ot more items in the diagram are selected.
30   - 'undo': there is undo information present in the diagram.
31   - 'redo': there is redo information present in the diagram.
32  
33   DiagramItems can not be used as capability. The reason is that the UML
34   model has a stable design, while the implementation of diagrams and diagram
35   items is likely to change much often.
36
37 Implementation
38 ~~~~~~~~~~~~~~
39 All windows are inherited from AbstractWindow. This class has a set_capability()
40 method. this method can be used to activate and deactivate capabilities. If
41 capabilities are (de)activated, all commands within a specific context (such
42 as 'main' or 'diagram') are verified. If their capabilities are not met, the
43 command in made insensitive (grayed out). Capabilities are desctibed as simple
44 text strings, such as 'undo' and 'snap_to_grid'. The capabilities themselves are
45 set by signal handlers which are attached during the window's construction.
46
Note: See TracBrowser for help on using the browser.