Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added buttons to example editors for loading an example model

  • Loading branch information...
commit 93a3e1138da5fdcec99eefa0624610319fe41067 1 parent e8d17c4
@mthiede authored
View
1  CHANGELOG
@@ -42,4 +42,5 @@
* Added support for cursor styles depeding its relative position (left/right/top/bottom)
* Added editor method to show a hidden feature
* Don't accept invalid JSON in setModel()
+* Added buttons to example editors for loading example models
View
2  example/formula_editor/example_data/example1.json → example/formula_editor/example_data/example1.js
@@ -1,3 +1,4 @@
+ExampleData = Object.toJSON(
[{"_class": "Sqrt", "expr":
{"_class": "Fraction", "expr1":
{"_class": "Mult", "expr1":
@@ -9,3 +10,4 @@
{"_class": "Value", "value": "100"}, "expr2":
{"_class": "Value", "value": "7"}}}}}, "expr2":
{"_class": "Value", "value": "6"}}}]
+);
View
5 example/formula_editor/formula_editor.html
@@ -5,6 +5,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/example1.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none">
@@ -57,7 +58,9 @@
</div>
<div class="ct_editor" id="editor1">
</div>
- <br/>
+
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
+
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
</div>
<script type="text/javascript" language="javascript" charset="utf-8">
View
3  ...amodel_editor/example_data/formula_metamodel.json → ...etamodel_editor/example_data/formula_metamodel.js
@@ -1,3 +1,4 @@
+ExampleData = Object.toJSON(
[{"_class": "Datatype", "name": "String"},
{"_class": "Class", "name": "Expression", "abstract": true},
{"_class": "Class", "name": "Sqrt", "superTypes": "Expression", "features":
@@ -15,4 +16,4 @@
{"_class": "Feature", "name": "expr", "kind": "containment", "lowerLimit": 1, "upperLimit": 1, "type": "Expression"}},
{"_class": "Class", "name": "Value", "superTypes": "Expression", "features":
{"_class": "Feature", "name": "value", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"}}]
-
+);
View
2  ...metamodel_editor/example_data/meta_metamodel.json → ...e/metamodel_editor/example_data/meta_metamodel.js
@@ -1,3 +1,4 @@
+ExampleData = Object.toJSON(
[
{"_class": "Datatype", "name": "String"},
{"_class": "Datatype", "name": "Integer"},
@@ -19,4 +20,5 @@
{"_class": "Feature", "name": "type", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "Classifier"}
]}
]
+);
View
2  ...l_editor/example_data/statemachine_metamodel.json → ...del_editor/example_data/statemachine_metamodel.js
@@ -1,3 +1,4 @@
+ExampleData = Object.toJSON(
[{"_class": "Datatype", "name": "String"},
{"_class": "Class", "name": "Statemachine", "features": [
{"_class": "Feature", "name": "name", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
@@ -29,4 +30,5 @@
{"_class": "Feature", "name": "expr", "kind": "containment", "lowerLimit": 1, "upperLimit": -1, "type": "Expression"}},
{"_class": "Class", "name": "VarRef", "superTypes": "Expression", "features":
{"_class": "Feature", "name": "variable", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "Variable"}}]
+);
View
4 example/metamodel_editor/metamodel_editor.html
@@ -6,6 +6,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/statemachine_metamodel.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none">
@@ -48,7 +49,8 @@
<input type="button" style="margin: 10px" value="Exit" onclick="exitEditor();"/>
</div>
- <br/>
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
+
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
<script type="text/javascript" language="javascript" charset="utf-8">
View
4 example/metamodel_editor/metamodel_editor2.html
@@ -6,6 +6,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/statemachine_metamodel.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none">
@@ -57,13 +58,14 @@
<div class="ct_editor" id="editor1">
</div>
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
+
<div id="controlbuttons" style="display: none">
<!-- the buttons will only be shown in ajax mode -->
<input type="button" style="margin: 10px" value="Save" onclick="saveModel();"/>
<input type="button" style="margin: 10px" value="Exit" onclick="exitEditor();"/>
</div>
- <br/>
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
<script type="text/javascript" language="javascript" charset="utf-8">
View
4 example/metamodel_editor/metamodel_editor3.html
@@ -6,6 +6,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/statemachine_metamodel.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none">
@@ -72,13 +73,14 @@
<div class="ct_editor" id="editor1">
</div>
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
+
<div id="controlbuttons" style="display: none">
<!-- the buttons will only be shown in ajax mode -->
<input type="button" style="margin: 10px" value="Save" onclick="saveModel();"/>
<input type="button" style="margin: 10px" value="Exit" onclick="exitEditor();"/>
</div>
- <br/>
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
<script type="text/javascript" language="javascript" charset="utf-8">
View
2  ...le/statemachine_editor/example_data/example1.json → example/statemachine_editor/example_data/example1.js
@@ -1,3 +1,4 @@
+ExampleData = Object.toJSON(
[{"_class": "Statemachine", "name": "AC", "triggers": [
{"_class": "Trigger", "name": "OnButton"},
{"_class": "Trigger", "name": "ModeButton"}], "states": [
@@ -9,3 +10,4 @@
{"_class": "SimpleState", "name": "Cooling", "transitions":
{"_class": "Transition", "targetState": "/AC/On/Heating", "trigger": "/AC/ModeButton"}}], "transitions":
{"_class": "Transition", "targetState": "/AC/Off", "trigger": "/AC/OnButton"}}]}]
+);
View
4 example/statemachine_editor/statemachine_editor0.html
@@ -6,6 +6,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/example1.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none">
@@ -29,7 +30,8 @@
<div class="ct_editor" id="editor1">
</div>
- <br/>
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
+
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
<script type="text/javascript" language="javascript" charset="utf-8">
View
3  example/statemachine_editor/statemachine_editor1.html
@@ -6,6 +6,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/example1.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none" >
@@ -35,7 +36,7 @@
</div>
<div class="ct_editor" id="editor1">
</div>
- <br/>
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
</div>
<script type="text/javascript" language="javascript" charset="utf-8">
View
3  example/statemachine_editor/statemachine_editor2.html
@@ -6,6 +6,7 @@
<script src="../../redist/prototype.js" type="text/javascript"></script>
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script src="../../concrete/concrete.js" type="text/javascript"></script>
+ <script src="example_data/example1.js" type="text/javascript"></script>
</head>
<body>
<div id="templates1" style="display: none" >
@@ -66,7 +67,7 @@
</div>
<div class="ct_editor" id="editor1">
</div>
- <br/>
+ <p><input type="button" onclick="ed.setModel(ExampleData);" value="Load example" /> Discards existing model!</p>
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
</div>
<script type="text/javascript" language="javascript" charset="utf-8">
Please sign in to comment.
Something went wrong with that request. Please try again.