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

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