concrete 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/CHANGELOG +32 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +87 -0
  4. data/concrete/basic_inline_editor.js +73 -0
  5. data/concrete/clipboard.js +72 -0
  6. data/concrete/concrete.js +58 -0
  7. data/concrete/constraint_checker.js +297 -0
  8. data/concrete/editor.js +964 -0
  9. data/concrete/element_extension.js +68 -0
  10. data/concrete/external_identifier_provider.js +112 -0
  11. data/concrete/helper.js +63 -0
  12. data/concrete/identifier_provider.js +168 -0
  13. data/concrete/inline_editor.js +55 -0
  14. data/concrete/metamodel_provider.js +171 -0
  15. data/concrete/model_interface.js +429 -0
  16. data/concrete/scroller.js +106 -0
  17. data/concrete/selector.js +302 -0
  18. data/concrete/template_provider.js +141 -0
  19. data/concrete/ui/abstract_dialog.js +80 -0
  20. data/concrete/ui/concrete_ui.js +28 -0
  21. data/concrete/ui/create_module_dialog.js +55 -0
  22. data/concrete/ui/images/close.png +0 -0
  23. data/concrete/ui/images/document-new.png +0 -0
  24. data/concrete/ui/images/document-save.png +0 -0
  25. data/concrete/ui/images/edit-find-replace.png +0 -0
  26. data/concrete/ui/images/emblem-symbolic-link.png +0 -0
  27. data/concrete/ui/images/help-browser.png +0 -0
  28. data/concrete/ui/images/minus_11px.png +0 -0
  29. data/concrete/ui/images/plus_11px.png +0 -0
  30. data/concrete/ui/images/preferences-system.png +0 -0
  31. data/concrete/ui/images/process-stop.png +0 -0
  32. data/concrete/ui/images/system-search.png +0 -0
  33. data/concrete/ui/layout_manager.js +54 -0
  34. data/concrete/ui/module_browser.js +88 -0
  35. data/concrete/ui/module_editor.js +217 -0
  36. data/concrete/ui/open_element_dialog.js +90 -0
  37. data/concrete/ui/preferences_dialog.js +75 -0
  38. data/concrete/ui/proceed_dialog.js +52 -0
  39. data/concrete/ui/search_replace_dialog.js +323 -0
  40. data/concrete/ui/style.css +296 -0
  41. data/concrete/ui/toolbar.js +74 -0
  42. data/concrete/ui/workbench.js +165 -0
  43. data/doc/concrete_developers_guide.html +1054 -0
  44. data/doc/concrete_developers_guide.txt +502 -0
  45. data/doc/concrete_users_guide.html +694 -0
  46. data/doc/concrete_users_guide.txt +223 -0
  47. data/example/formula_editor/example_data/example1.json +11 -0
  48. data/example/formula_editor/formula_editor.html +83 -0
  49. data/example/formula_editor/sqrt_horz.png +0 -0
  50. data/example/formula_editor/sqrt_vert.png +0 -0
  51. data/example/formula_editor/style.css +31 -0
  52. data/example/metamodel_editor/edit.rb +54 -0
  53. data/example/metamodel_editor/example_data/formula_metamodel.json +18 -0
  54. data/example/metamodel_editor/example_data/meta_metamodel.json +22 -0
  55. data/example/metamodel_editor/example_data/statemachine_metamodel.json +32 -0
  56. data/example/metamodel_editor/metamodel_editor.html +120 -0
  57. data/example/metamodel_editor/metamodel_editor2.html +135 -0
  58. data/example/metamodel_editor/metamodel_editor3.html +151 -0
  59. data/example/metamodel_editor/style.css +8 -0
  60. data/example/metamodel_editor/style2.css +19 -0
  61. data/example/metamodel_editor/style3.css +35 -0
  62. data/example/minimal_editor/minimal_editor.html +43 -0
  63. data/example/statemachine_editor/example_data/example1.json +11 -0
  64. data/example/statemachine_editor/state_background.png +0 -0
  65. data/example/statemachine_editor/statemachine_editor0.html +55 -0
  66. data/example/statemachine_editor/statemachine_editor1.html +62 -0
  67. data/example/statemachine_editor/statemachine_editor2.html +103 -0
  68. data/example/statemachine_editor/style0.css +8 -0
  69. data/example/statemachine_editor/style1.css +32 -0
  70. data/example/statemachine_editor/style2.css +43 -0
  71. data/example/themes/cobalt.css +176 -0
  72. data/example/themes/dialog-error.png +0 -0
  73. data/example/themes/dialog-information.png +0 -0
  74. data/example/themes/dialog-warning.png +0 -0
  75. data/example/themes/dots_12px.png +0 -0
  76. data/example/themes/fold_button_dots_when_hidden.css +18 -0
  77. data/example/themes/fold_button_plus_minus.css +21 -0
  78. data/example/themes/fold_button_plus_when_hidden.css +18 -0
  79. data/example/themes/light_blue.css +177 -0
  80. data/example/themes/minus_11px.png +0 -0
  81. data/example/themes/minus_13px.png +0 -0
  82. data/example/themes/minus_9px.png +0 -0
  83. data/example/themes/plus_11px.png +0 -0
  84. data/example/themes/plus_13px.png +0 -0
  85. data/example/themes/plus_9px.png +0 -0
  86. data/example/themes/white.css +177 -0
  87. data/lib/concrete/concrete_syntax_provider.rb +63 -0
  88. data/lib/concrete/config.rb +36 -0
  89. data/lib/concrete/file_cache_map.rb +88 -0
  90. data/lib/concrete/index_builder.rb +108 -0
  91. data/lib/concrete/metamodel/concrete_mmm.rb +45 -0
  92. data/lib/concrete/metamodel/ecore_to_concrete.rb +80 -0
  93. data/lib/concrete/server.rb +92 -0
  94. data/lib/concrete/util/logger.rb +24 -0
  95. data/lib/concrete/util/string_writer.rb +17 -0
  96. data/lib/concrete/working_set.rb +41 -0
  97. data/rakefile +33 -0
  98. data/redist/prototype.js +4320 -0
  99. data/redist/scriptaculous/builder.js +136 -0
  100. data/redist/scriptaculous/controls.js +991 -0
  101. data/redist/scriptaculous/dragdrop.js +975 -0
  102. data/redist/scriptaculous/effects.js +1130 -0
  103. data/redist/scriptaculous/scriptaculous.js +60 -0
  104. data/redist/scriptaculous/slider.js +275 -0
  105. data/redist/scriptaculous/sound.js +55 -0
  106. data/redist/scriptaculous/unittest.js +568 -0
  107. data/test/concrete_test.rb +5 -0
  108. data/test/file_cache_map_test.rb +90 -0
  109. data/test/file_cache_map_test/testdir/fileA +1 -0
  110. data/test/index_builder_test.rb +68 -0
  111. data/test/index_builder_test/ecore_index.js +85 -0
  112. data/test/index_builder_test/ecore_index_expected.js +85 -0
  113. data/test/integration/external_elements_test.html +114 -0
  114. data/test/metamodel_test.rb +40 -0
  115. data/test/metamodel_test/concrete_mmm_expected.js +19 -0
  116. data/test/metamodel_test/concrete_mmm_generated.js +19 -0
  117. data/test/metamodel_test/concrete_mmm_regenerated.js +19 -0
  118. data/test/unit/external_identifier_provider_test.html +138 -0
  119. data/test/unit/identifier_provider_test.html +269 -0
  120. data/test/unit/metamodel_provider_test.html +318 -0
  121. data/test/unit/model_interface_test.html +257 -0
  122. data/test/unit/template_provider_test.html +171 -0
  123. data/test/unit/test.css +90 -0
  124. data/test/working_set_test.rb +54 -0
  125. data/test/working_set_test/file1.txt +0 -0
  126. data/test/working_set_test/file2 +0 -0
  127. data/test/working_set_test/subdir/file3.xml +0 -0
  128. metadata +201 -0
@@ -0,0 +1,19 @@
1
+
2
+ /* Metamodel Specific Styles
3
+ *****************************************************************************/
4
+
5
+ body {
6
+ font-family: verdana;
7
+ }
8
+
9
+ /* add some space around the classes to make reading easier */
10
+ .ctc_Class {
11
+ padding: 2px 0 2px 0;
12
+ border: 1px solid grey;
13
+ display: inline-block;
14
+ margin: 10px;
15
+ }
16
+
17
+ .ctn_superTypes .ct_value {
18
+ display: block;
19
+ }
@@ -0,0 +1,35 @@
1
+
2
+ /* Metamodel Specific Styles
3
+ *****************************************************************************/
4
+
5
+ /* add some space around the classes to make reading easier */
6
+ .ctc_Class {
7
+ padding: 2px 0 2px 0;
8
+ }
9
+
10
+ .ctn_features table {
11
+ font-family: "courier new";
12
+ font-size: 12;
13
+ border-collapse: collapse;
14
+ border-spacing: 0px;
15
+ margin: 2px;
16
+ margin-left: 10px;
17
+ }
18
+
19
+ .ctn_features thead {
20
+ color: black;
21
+ background-color: #bbb;
22
+ }
23
+
24
+ .ctn_features table td {
25
+ border: 1px solid #777;
26
+ padding: 2px;
27
+ }
28
+
29
+ .ctn_features .ct_error {
30
+ border-left: 5px solid #F77;
31
+ }
32
+
33
+ .ctn_features .ct_element.ct_empty {
34
+ margin: 0;
35
+ }
@@ -0,0 +1,43 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" href="../../example/themes/cobalt.css" type="text/css" />
4
+ <link rel="stylesheet" href="../../example/metamodel_editor/style.css" type="text/css" />
5
+ <script src="../../redist/prototype.js" type="text/javascript"></script>
6
+ <script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
7
+ <script src="../../concrete/concrete.js" type="text/javascript"></script>
8
+ </head>
9
+ <body>
10
+ <div id="templates1" style="display: none">
11
+ </div>
12
+
13
+ <div id="metamodel1" style="display: none">
14
+ [{"_class": "Class", "name": "Dummy"}]
15
+ </div>
16
+
17
+ <div class="ct_editor" id="editor1">
18
+ </div>
19
+
20
+ <br/>
21
+ <textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
22
+
23
+ <script type="text/javascript" language="javascript" charset="utf-8">
24
+ // <![CDATA[
25
+ var tp = new Concrete.TemplateProvider($("templates1"), {identifierAttribute: "name"});
26
+ var mp = new Concrete.MetamodelProvider($("metamodel1").textContent.evalJSON());
27
+ var ip = new Concrete.QualifiedNameBasedIdentifierProvider({nameAttribute: "name"});
28
+ var cb = new Concrete.Clipboard($("clipboard1"));
29
+ var ed = new Concrete.Editor($("editor1"), tp, mp, ip, {clipboard: cb});
30
+
31
+ Event.observe(window, 'click', function(event) {
32
+ ed.handleEvent(event);
33
+ });
34
+ Event.observe(window, 'keydown', function(event) {
35
+ ed.handleEvent(event);
36
+ });
37
+ Event.observe(window, 'mousemove', function(event) {
38
+ ed.handleEvent(event);
39
+ });
40
+ // ]]>
41
+ </script>
42
+ </body>
43
+ </html>
@@ -0,0 +1,11 @@
1
+ [{"_class": "Statemachine", "name": "AC", "triggers": [
2
+ {"_class": "Trigger", "name": "OnButton"},
3
+ {"_class": "Trigger", "name": "ModeButton"}], "states": [
4
+ {"_class": "SimpleState", "name": "Off", "transitions":
5
+ {"_class": "Transition", "targetState": "/AC/On", "trigger": "/AC/OnButton"}},
6
+ {"_class": "CompositeState", "name": "On", "subStates": [
7
+ {"_class": "SimpleState", "name": "Heating", "transitions":
8
+ {"_class": "Transition", "targetState": "/AC/On/Cooling", "trigger": "/AC/ModeButton"}},
9
+ {"_class": "SimpleState", "name": "Cooling", "transitions":
10
+ {"_class": "Transition", "targetState": "/AC/On/Heating", "trigger": "/AC/ModeButton"}}], "transitions":
11
+ {"_class": "Transition", "targetState": "/AC/Off", "trigger": "/AC/OnButton"}}]}]
@@ -0,0 +1,55 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" href="style0.css" type="text/css" />
4
+ <link rel="stylesheet" href="../themes/light_blue.css" type="text/css" />
5
+ <link rel="stylesheet" href="../themes/fold_button_dots_when_hidden.css" type="text/css" />
6
+ <script src="../../redist/prototype.js" type="text/javascript"></script>
7
+ <script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
8
+ <script src="../../concrete/concrete.js" type="text/javascript"></script>
9
+ </head>
10
+ <body>
11
+ <div id="templates1" style="display: none">
12
+ </div>
13
+
14
+ <div id="metamodel1" style="display: none">
15
+ [{"_class": "Datatype", "name": "String"},
16
+ {"_class": "Class", "name": "Statemachine", "features": [
17
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
18
+ {"_class": "Feature", "name": "states", "kind": "containment", "type": "State"}]},
19
+ {"_class": "Class", "name": "State", "abstract": true, "features": [
20
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
21
+ {"_class": "Feature", "name": "transitions", "kind": "containment", "upperLimit": -1, "type": "Transition"}]},
22
+ {"_class": "Class", "name": "SimpleState", "superTypes": "State"},
23
+ {"_class": "Class", "name": "CompositeState", "superTypes": "State", "features":
24
+ {"_class": "Feature", "name": "subStates", "kind": "containment", "upperLimit": -1, "type": "State"}},
25
+ {"_class": "Class", "name": "Transition", "features":
26
+ {"_class": "Feature", "name": "targetState", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "State"}}]
27
+ </div>
28
+
29
+ <div class="ct_editor" id="editor1">
30
+ </div>
31
+
32
+ <br/>
33
+ <textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
34
+
35
+ <script type="text/javascript" language="javascript" charset="utf-8">
36
+ // <![CDATA[
37
+ var tp = new Concrete.TemplateProvider($("templates1"), {identifierAttribute: "name"});
38
+ var mp = new Concrete.MetamodelProvider($("metamodel1").textContent.evalJSON());
39
+ var ip = new Concrete.QualifiedNameBasedIdentifierProvider({nameAttribute: "name"});
40
+ var cb = new Concrete.Clipboard($("clipboard1"));
41
+ var ed = new Concrete.Editor($("editor1"), tp, mp, ip, {clipboard: cb});
42
+
43
+ Event.observe(window, 'click', function(event) {
44
+ ed.handleEvent(event);
45
+ });
46
+ Event.observe(window, 'keydown', function(event) {
47
+ ed.handleEvent(event);
48
+ });
49
+ Event.observe(window, 'mousemove', function(event) {
50
+ ed.handleEvent(event);
51
+ });
52
+ // ]]>
53
+ </script>
54
+ </body>
55
+ </html>
@@ -0,0 +1,62 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" href="style1.css" type="text/css" />
4
+ <link rel="stylesheet" href="../themes/light_blue.css" type="text/css" />
5
+ <link rel="stylesheet" href="../themes/fold_button_dots_when_hidden.css" type="text/css" />
6
+ <script src="../../redist/prototype.js" type="text/javascript"></script>
7
+ <script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
8
+ <script src="../../concrete/concrete.js" type="text/javascript"></script>
9
+ </head>
10
+ <body>
11
+ <div id="templates1" style="display: none" >
12
+ <div class="ct_element ctc_SimpleState" style="display: inline-block">
13
+ <div style="text-align: center; padding: 5px"><span class="ct_fold_button"></span> <span class="ct_handle">SimpleState</span> <span class="ct_attribute ct_identifier_attribute ctn_name"><span class="ct_slot"></span></span></div>
14
+ <div class="ct_containment ctn_transitions" style="padding: 5px; border-top: 1px solid black"><span class="ct_feature_name">transitions:</span> <div class="ct_slot"></div></div>
15
+ </div>
16
+ <div class="ct_element ctc_CompositeState" style="display: inline-block">
17
+ <div style="text-align: center; padding: 5px"><span class="ct_fold_button"></span> <span class="ct_handle">CompositeState</span> <span class="ct_attribute ct_identifier_attribute ctn_name"><span class="ct_slot"></span></span></div>
18
+ <div class="ct_containment ctn_subStates" style="border-top: 1px solid black; padding: 5px"><span class="ct_feature_name">substates:</span> <div class="ct_slot"></div></div>
19
+ <div class="ct_containment ctn_transitions" style="padding: 5px; border-top: 1px solid black"><span class="ct_feature_name">transitions</span>: <div class="ct_slot"></div></div>
20
+ </div>
21
+ </div>
22
+ <div id="metamodel1" style="display: none" >
23
+ [{"_class": "Datatype", "name": "String"},
24
+ {"_class": "Class", "name": "Statemachine", "features": [
25
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
26
+ {"_class": "Feature", "name": "states", "kind": "containment", "type": "State"}]},
27
+ {"_class": "Class", "name": "State", "abstract": true, "features": [
28
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
29
+ {"_class": "Feature", "name": "transitions", "kind": "containment", "upperLimit": -1, "type": "Transition"}]},
30
+ {"_class": "Class", "name": "SimpleState", "superTypes": "State"},
31
+ {"_class": "Class", "name": "CompositeState", "superTypes": "State", "features":
32
+ {"_class": "Feature", "name": "subStates", "kind": "containment", "upperLimit": -1, "type": "State"}},
33
+ {"_class": "Class", "name": "Transition", "features":
34
+ {"_class": "Feature", "name": "targetState", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "State"}}]
35
+ </div>
36
+ <div class="ct_editor" id="editor1">
37
+ </div>
38
+ <br/>
39
+ <textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
40
+ </div>
41
+ <script type="text/javascript" language="javascript" charset="utf-8">
42
+ // <![CDATA[
43
+ var tp = new Concrete.TemplateProvider($("templates1"), {identifierAttribute: "name"});
44
+ var mp = new Concrete.MetamodelProvider($("metamodel1").textContent.evalJSON());
45
+ var ip = new Concrete.QualifiedNameBasedIdentifierProvider({nameAttribute: "name", separator: "/", leadingSeparator: true});
46
+ var cb = new Concrete.Clipboard($("clipboard1"));
47
+ var ed = new Concrete.Editor($("editor1"), tp, mp, ip, {clipboard: cb,
48
+ rootClasses: mp.metaclasses.select(function(c) { return ["Statemachine"].include(c.name)})});
49
+
50
+ Event.observe(window, 'click', function(event) {
51
+ ed.handleEvent(event);
52
+ });
53
+ Event.observe(window, 'keydown', function(event) {
54
+ ed.handleEvent(event);
55
+ });
56
+ Event.observe(window, 'mousemove', function(event) {
57
+ ed.handleEvent(event);
58
+ });
59
+ // ]]>
60
+ </script>
61
+ </body>
62
+ </html>
@@ -0,0 +1,103 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" href="style2.css" type="text/css" />
4
+ <link rel="stylesheet" href="../themes/light_blue.css" type="text/css" />
5
+ <link rel="stylesheet" href="../themes/fold_button_dots_when_hidden.css" type="text/css" />
6
+ <script src="../../redist/prototype.js" type="text/javascript"></script>
7
+ <script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
8
+ <script src="../../concrete/concrete.js" type="text/javascript"></script>
9
+ </head>
10
+ <body>
11
+ <div id="templates1" style="display: none" >
12
+ <div class="ct_element ctc_SimpleState" style="display: inline-block">
13
+ <div style="text-align: center; padding: 5px"><span class="ct_fold_button"></span> <span class="ct_handle">SimpleState</span> <span class="ct_attribute ct_identifier_attribute ctn_name"><span class="ct_slot"></span></span></div>
14
+ <div class="ct_containment ctn_transitions" style="padding: 5px; border-top: 1px solid black"><span class="ct_feature_name">transitions:</span> <div class="ct_slot"></div></div>
15
+ </div>
16
+ <div class="ct_element ctc_CompositeState" style="display: inline-block">
17
+ <div style="text-align: center; padding: 5px"><span class="ct_fold_button"></span> <span class="ct_handle">CompositeState</span> <span class="ct_attribute ct_identifier_attribute ctn_name"><span class="ct_slot"></span></span></div>
18
+ <div class="ct_containment ctn_subStates" style="border-top: 1px solid black; padding: 5px"><span class="ct_feature_name">substates:</span> <div class="ct_slot"></div></div>
19
+ <div class="ct_containment ctn_transitions" style="padding: 5px; border-top: 1px solid black"><span class="ct_feature_name">transitions</span>: <div class="ct_slot"></div></div>
20
+ </div>
21
+ <span class="ct_element ctc_AndExpression" style="">
22
+ (<span class="ct_containment ctn_expr1" style="padding: 0px"><span class="ct_slot" style="padding: 0px"></span></span><span class="ct_handle">&&</span><span class="ct_containment ctn_expr2" style="padding: 0px"><span class="ct_slot"></span></span>)
23
+ </span>
24
+ <span class="ct_element ctc_OrExpression" style="">
25
+ (<span class="ct_containment ctn_expr1" style="padding: 0px"><span class="ct_slot"></span></span><span class="ct_handle">||</span><span class="ct_containment ctn_expr2" style="padding: 0px"><span class="ct_slot"></span></span>)
26
+ </span>
27
+ <span class="ct_element ctc_NotExpression" style="">
28
+ <span class="ct_handle">!</span><span class="ct_containment ctn_expr" style="padding: 0px"><span class="ct_slot"></span></span>
29
+ </span>
30
+ <span class="ct_element ctc_VarRef" style="">
31
+ <span class="ct_handle">var</span>(<span class="ct_reference ctn_variable" style="padding: 0px"><span class="ct_slot"></span></span>)
32
+ </span>
33
+ </div>
34
+ <div id="metamodel1" style="display: none" >
35
+ [{"_class": "Datatype", "name": "String"},
36
+ {"_class": "Class", "name": "Statemachine", "features": [
37
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
38
+ {"_class": "Feature", "name": "variables", "kind": "containment", "type": "Variable"},
39
+ {"_class": "Feature", "name": "triggers", "kind": "containment", "type": "Trigger"},
40
+ {"_class": "Feature", "name": "states", "kind": "containment", "type": "State"}]},
41
+ {"_class": "Class", "name": "Variable", "features":
42
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"}},
43
+ {"_class": "Class", "name": "Trigger", "features":
44
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"}},
45
+ {"_class": "Class", "name": "State", "abstract": true, "features": [
46
+ {"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
47
+ {"_class": "Feature", "name": "transitions", "kind": "containment", "upperLimit": -1, "type": "Transition"}]},
48
+ {"_class": "Class", "name": "SimpleState", "superTypes": "State"},
49
+ {"_class": "Class", "name": "CompositeState", "superTypes": "State", "features":
50
+ {"_class": "Feature", "name": "subStates", "kind": "containment", "upperLimit": -1, "type": "State"}},
51
+ {"_class": "Class", "name": "Transition", "features": [
52
+ {"_class": "Feature", "name": "targetState", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "State"},
53
+ {"_class": "Feature", "name": "trigger", "kind": "reference", "upperLimit": -1, "type": "Trigger"},
54
+ {"_class": "Feature", "name": "condition", "kind": "containment", "upperLimit": 1, "type": "Expression"}]},
55
+ {"_class": "Class", "name": "Expression"},
56
+ {"_class": "Class", "name": "AndExpression", "superTypes": "Expression", "features": [
57
+ {"_class": "Feature", "name": "expr1", "kind": "containment", "lowerLimit": 1, "upperLimit": -1, "type": "Expression"},
58
+ {"_class": "Feature", "name": "expr2", "kind": "containment", "lowerLimit": 1, "upperLimit": -1, "type": "Expression"}]},
59
+ {"_class": "Class", "name": "OrExpression", "superTypes": "Expression", "features": [
60
+ {"_class": "Feature", "name": "expr1", "kind": "containment", "lowerLimit": 1, "upperLimit": -1, "type": "Expression"},
61
+ {"_class": "Feature", "name": "expr2", "kind": "containment", "lowerLimit": 1, "upperLimit": -1, "type": "Expression"}]},
62
+ {"_class": "Class", "name": "NotExpression", "superTypes": "Expression", "features":
63
+ {"_class": "Feature", "name": "expr", "kind": "containment", "lowerLimit": 1, "upperLimit": -1, "type": "Expression"}},
64
+ {"_class": "Class", "name": "VarRef", "superTypes": "Expression", "features":
65
+ {"_class": "Feature", "name": "variable", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "Variable"}}]
66
+ </div>
67
+ <div class="ct_editor" id="editor1">
68
+ </div>
69
+ <br/>
70
+ <textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
71
+ </div>
72
+ <script type="text/javascript" language="javascript" charset="utf-8">
73
+ // <![CDATA[
74
+ var tp = new Concrete.TemplateProvider($("templates1"), {identifierAttribute: "name"});
75
+ var mp = new Concrete.MetamodelProvider($("metamodel1").textContent.evalJSON());
76
+ var ip = new Concrete.QualifiedNameBasedIdentifierProvider({nameAttribute: "name", separator: "/", leadingSeparator: true});
77
+ var cb = new Concrete.Clipboard($("clipboard1"));
78
+ var ed = new Concrete.Editor($("editor1"), tp, mp, ip, {clipboard: cb,
79
+ rootClasses: mp.metaclasses.select(function(c) { return ["Statemachine"].include(c.name)})});
80
+
81
+ // only show the last part of reference identifiers
82
+ ed.modelInterface.setDisplayValueProvider(function(text, feature) {
83
+ if (feature.mmFeature.isReference()) {
84
+ return text.toString().split("/").last();
85
+ }
86
+ else {
87
+ return text;
88
+ }
89
+ });
90
+
91
+ Event.observe(window, 'click', function(event) {
92
+ ed.handleEvent(event);
93
+ });
94
+ Event.observe(window, 'keydown', function(event) {
95
+ ed.handleEvent(event);
96
+ });
97
+ Event.observe(window, 'mousemove', function(event) {
98
+ ed.handleEvent(event);
99
+ });
100
+ // ]]>
101
+ </script>
102
+ </body>
103
+ </html>
@@ -0,0 +1,8 @@
1
+
2
+ /* Metamodel Specific Styles
3
+ *****************************************************************************/
4
+
5
+ /* add some space around the classes to make reading easier */
6
+ .ctc_Class {
7
+ padding: 2px 0 2px 0;
8
+
@@ -0,0 +1,32 @@
1
+
2
+ /* Metamodel Specific Styles
3
+ *****************************************************************************/
4
+
5
+ .ctc_Statemachine {
6
+ border: 1px solid black;
7
+ padding: 10px;
8
+ margin: 10px;
9
+ }
10
+
11
+ .ctc_SimpleState {
12
+ border: 1px solid black;
13
+ -moz-border-radius: 0.5em;
14
+ margin: 10px;
15
+ background: url(state_background.png) no-repeat top right #fcf2e3;
16
+ }
17
+
18
+ .ctc_SimpleState.ct_selected, .ct_selected .ctc_SimpleState {
19
+ background: #aaf;
20
+ }
21
+
22
+ .ctc_CompositeState {
23
+ border: 1px solid black;
24
+ -moz-border-radius: 0.5em;
25
+ margin: 10px;
26
+ background: url(state_background.png) no-repeat top right #fcf2e3;
27
+ }
28
+
29
+ .ctc_CompositeState.ct_selected, .ct_selected .ctc_CompositeState {
30
+ background: #aaf;
31
+ }
32
+
@@ -0,0 +1,43 @@
1
+
2
+ /* Metamodel Specific Styles
3
+ *****************************************************************************/
4
+
5
+ .ctc_Statemachine {
6
+ border: 1px solid black;
7
+ padding: 10px;
8
+ margin: 10px;
9
+ }
10
+
11
+ .ctc_SimpleState {
12
+ border: 1px solid black;
13
+ -moz-border-radius: 0.5em;
14
+ margin: 10px;
15
+ background: url(state_background.png) no-repeat top right #fcf2e3;
16
+ }
17
+
18
+ .ctc_SimpleState.ct_selected, .ct_selected .ctc_SimpleState {
19
+ background: #aaf;
20
+ }
21
+
22
+ .ctc_CompositeState {
23
+ border: 1px solid black;
24
+ -moz-border-radius: 0.5em;
25
+ margin: 10px;
26
+ background: url(state_background.png) no-repeat top right #fcf2e3;
27
+ }
28
+
29
+ .ctc_CompositeState.ct_selected, .ct_selected .ctc_CompositeState {
30
+ background: #aaf;
31
+ }
32
+
33
+ .ctc_AndExpression .ct_containment { padding: 0; }
34
+ .ctc_AndExpression .ct_containment .ct_element { margin: 0; }
35
+ .ctc_AndExpression .ct_containment > .ct_slot > .ct_inline_editor { margin: 0; }
36
+
37
+ .ctc_OrExpression .ct_containment { padding: 0; }
38
+ .ctc_OrExpression .ct_containment .ct_element { margin: 0; }
39
+ .ctc_OrExpression .ct_containment > .ct_slot > .ct_inline_editor { margin: 0; }
40
+
41
+ .ctc_NotExpression .ct_containment { padding: 0; }
42
+ .ctc_NotExpression .ct_containment .ct_element { margin: 0; }
43
+ .ctc_NotExpression .ct_containment > .ct_slot > .ct_inline_editor { margin: 0; }
@@ -0,0 +1,176 @@
1
+
2
+ /* General Editor
3
+ *****************************************************************************/
4
+
5
+ body {
6
+ background-color: #002240;
7
+ color: #fff;
8
+ font-family: "courier new";
9
+ font-size: 12;
10
+ cursor: default;
11
+ }
12
+
13
+ /* editor */
14
+ .ct_editor {
15
+ padding: 10px;
16
+ border: 1px solid #555;
17
+ }
18
+
19
+ /* editor when focused */
20
+ .ct_editor.ct_focus {
21
+ border: 1px solid #888;
22
+ }
23
+
24
+ /* Inline Editor
25
+ *****************************************************************************/
26
+
27
+ /* text input element */
28
+ .ct_inline_editor input {
29
+ font-family: "courier new";
30
+ font-size: 12;
31
+ color: #fff;
32
+ background-color: transparent;
33
+ border: 0;
34
+ }
35
+
36
+ /* dropdown list */
37
+ .ct_inline_editor ul {
38
+ padding: 0;
39
+ margin: 0;
40
+ }
41
+
42
+ /* dropdown list item */
43
+ .ct_inline_editor ul li {
44
+ padding: 0;
45
+ margin: 0;
46
+ list-style-type: none;
47
+ color: black;
48
+ text-align: left;
49
+ }
50
+
51
+ /* dropdown list element when selected */
52
+ .ct_inline_editor ul li.selected {
53
+ background-color: #ccf;
54
+ }
55
+
56
+ /* General Syntax Highlighting
57
+ *****************************************************************************/
58
+
59
+ /* these styles are mainly intended for textual representations of the model */
60
+
61
+ /* Class name */
62
+ .ct_class_name {
63
+ color: #ff9d00;
64
+ }
65
+
66
+ /* Feature name */
67
+ .ct_feature_name {
68
+ color: #80ffbb;
69
+ }
70
+
71
+ /* Element name */
72
+ .ct_identifier_attribute .ct_value {
73
+ color: #ffdd00;
74
+ }
75
+
76
+ /* don't show feature name for identifier attributes */
77
+ .ct_identifier_attribute .ct_feature_name {
78
+ display: none;
79
+ }
80
+
81
+ /* indentation of containment features */
82
+ .ct_containment {
83
+ padding-left: 10px;
84
+ }
85
+
86
+ /* indentation of contained elements */
87
+ .ct_containment .ct_element {
88
+ margin-left: 10px;
89
+ }
90
+
91
+ /* indentation of inline editor when editing a contained element */
92
+ /* won't work in case a template is putting something around the slot */
93
+ .ct_containment > .ct_slot > .ct_inline_editor {
94
+ margin-left: 10px;
95
+ }
96
+
97
+ /* space between references and attributes */
98
+ .ct_value {
99
+ margin-right: 5px;
100
+ }
101
+
102
+ /* empty element/value used to insert new elements/values */
103
+ .ct_empty {
104
+ background-color: #777;
105
+ }
106
+
107
+ /* Selection
108
+ *****************************************************************************/
109
+
110
+ /* element/value selected */
111
+ .ct_selected {
112
+ background-color: #001120;
113
+ }
114
+
115
+ /* cursor */
116
+ .ct_cursor {
117
+ width: 4px;
118
+ height: 4px;
119
+ background-color: #ff0;
120
+ }
121
+
122
+ /* Errors
123
+ *****************************************************************************/
124
+
125
+ /* element/feature with an error */
126
+ .ct_error {
127
+ border-left: 5px solid #700;
128
+ }
129
+
130
+ /* inline editor showing an error while editing */
131
+ .inline_editor.ct_error {
132
+ background-color: #700;
133
+ }
134
+
135
+ /* Message Popup
136
+ *****************************************************************************/
137
+
138
+ /* popup shown when hovering over an element/feature */
139
+ .ct_message_popup {
140
+ background-color: #FFD;
141
+ border: 1px solid #777;
142
+ color: black;
143
+ }
144
+
145
+ .ct_error_message {
146
+ padding-left: 19px;
147
+ background: url("dialog-error.png") no-repeat;
148
+ min-height: 16px;
149
+ margin: 3px;
150
+ }
151
+
152
+ .ct_info_message {
153
+ padding-left: 19px;
154
+ background: url("dialog-information.png") no-repeat;
155
+ min-height: 16px;
156
+ margin: 3px;
157
+ }
158
+
159
+ /* References
160
+ *****************************************************************************/
161
+
162
+ /* target of a reference when hovering over the source */
163
+ .ct_ref_target {
164
+ background: #77F;
165
+ }
166
+
167
+ /* source of a reference when hovering over it */
168
+ .ct_ref_source {
169
+ text-decoration: underline;
170
+ color: #77F;
171
+ }
172
+
173
+ /* source when within target */
174
+ .ct_ref_target .ct_ref_source {
175
+ color: #FFF;
176
+ }