Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 16a657ecba0fdcf417193cfef84f99ea002e0950 (plain) (blame)
1
2
3
4
<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body><h1 id="A_simple_Example_and_Tutorial">A simple Example and Tutorial</h1><p>In this example, we create a class diagram with 3 classes (class1, class2, class3), and a LayersStack with 3 layers (layer2, layer1, bottom). The bottom layer control the 3 classes and all the available properties. The layer1 control Class1 and Class2. The layer2 control Class2 and Class3.</p><p>This example is also a tutorial, if you follow it step by step.</p><h2 id="Create_a_new_Class_Diagram">Create a new Class Diagram</h2><p>Start by creating a Papyrus Class Diagram with 3 classes:</p><ul><li>Create a new ClassDiagram in a Papyrus model</li><li>Create three classes: Class1, Class2, Class3</li><li>Open the Papyrus ModelExplorer and the Property View.</li></ul><p>You should have a diagram and model explorer like in the following figure:</p><p><img border="0" src="simpleTutorialImages/diagramWith3Classes.png"/></p><h2 id="Open_the_LayersExplorer">Open the LayersExplorer</h2><p>To open the LayersExplorer:</p><ul><li>In the diagram, Right Click-&gt;Layers-&gt;Open LayersExplorer</li></ul><p><img border="0" src="simpleTutorialImages/opnLayersExplorer.png"/></p><ul><li>The explorer should open (not necessarly at the same position as in the following snapshoot):</li></ul><p><img border="0" src="simpleTutorialImages/OpenedLayersExplorer.png"/></p><h2 id="Attach_a_LayersStack_to_your_diagram">Attach a LayersStack to your diagram</h2><p>To attach a LayersStack to your diagram:</p><ul><li>Click in the diagram, then Right Click-&gt;Layers-&gt;Attach Layer Stack</li></ul><p><img border="0" src="simpleTutorialImages/attachLayersStack.png"/></p><ul><li>The LayersExplorer should show the layers attached to the LayersStack. By default, there is a 'Layer Operator' of type 'Top Layer'. The 'Top Layer Operator' contains layers that are ordered from top to bottom. When computing the value for a particular (view, property type) couple, it search the first layer that define a value for the couple, and return this value.</li></ul><p><img border="0" src="simpleTutorialImages/attachedLayersStack.png"/></p><h2 id="Create_a_new_Layer_in_the_LayersStack">Create a new Layer in the LayersStack</h2><p>We need now to create a layer in the stack.</p><p>To create a new Layer in the LayersStack:</p><ul><li>In the LayerExplorer, select the Top Layer Operator</li><li>right click-&gt;Layers-&gt;Create Layers ...-&gt;Create Layer</li></ul><p><img border="0" src="simpleTutorialImages/createLayer.png"/></p><ul><li>A new layer is created:<ul><li>Open the tree node to see the layer (1)</li><li>Select the layers tab in the Property view (2)</li><li>Change the name of the layer to 'bottomLayer' (3)</li></ul></li></ul><p><img border="0" src="simpleTutorialImages/createdLayer.png"/></p><h2 id="Attach_Classes_to_the_Layer">Attach Classes to the Layer</h2><p>Attaching some classes (also called views) to a layer means that this layer will partially control the value of some properties for this attached classes.
Here, we attach the 3 classes.
To Attach the classes to the Layer:</p><ul><li>Select the layer 'bottomLayer', right click-&gt;Layers-&gt;Attach Views</li></ul><p><img border="0" src="simpleTutorialImages/attachViewsToLayer.png"/> </p><ul><li>A window open, select the 3 classes (1) and click 'ok (2)'.:</li></ul><p><img border="0" src="simpleTutorialImages/attachViewWindowSelectClasses.png"/></p><h2 id="Attach_some_properties_to_the_layer">Attach some properties to the layer</h2><p>A layer is used to control some properties of the attached views. It is necessary to attach the properties
controled by the layer. Once attached, it is possible to modify the values of this properties.</p><p>To attach some properties to the layer:</p><ul><li>In the LayersExplorer, select the defaul layer, right click-&gt;Layers-&gt;Attach Properties</li></ul><p><img border="0" src="simpleTutorialImages/openAttachPropertiesWindow.png"/></p><ul><li>The Attach Properties window open. Select properties as in the screenshot, and then 'ok'.</li></ul><p><img border="0" src="simpleTutorialImages/attachPropertiesWindow.png"/></p><ul><li>The properties and the views are now attached to the layers. Properties for these views are computed according to the layer, and as a resul the fill color change. This is because the default value for 'fill color' of the layer property is different from the Papyrus value.<ul><li>You can open the property node in the LayersExplorer, select a property, and change its value in the Property view.</li></ul></li></ul><p><img border="0" src="simpleTutorialImages/defaulLayerProperties.png"/></p><h2 id="Add_more_layers">Add more layers</h2><p>Now, add a new Layer in the Top Layer Operator:</p><ul><li>Select the Top Layer Operator, </li><li>right click-&gt;Layers-&gt;Create Layers ...-&gt;Create Layer</li><li>The new layer shoul appear as the first layer of the top layer operator.</li><li>Attach the class1 and class2</li><li>Attach the fill property</li></ul><h2 id="Change_the_value_of_an_attached_property">Change the value of an attached property</h2><p>You can change the value of the fill property color for the layer.</p><ul><li>Open the node 'Color' of the 'Fill Property' </li><li>click on the color picker in the Property view. </li><li>Choose a new color (blue).</li><li>The color should be applied on the 2 classes attached to the layer (Class1 and Class2). </li><li>Class3 still have the color of the 'bottom' layer.</li></ul><p><img border="0" src="simpleTutorialImages/changeFillColorValue.png"/></p><ul><li>Note that Class1 and Class2 color change to 'blue' because when computing the color for Class1, the first layer that attach both Class1and Property Fill is the Layer1. In this layer, the value for the Property Fill is 'blue', so it is for Class1. The same happen for class2.</li></ul><h2 id="Add_the_3rd_layer">Add the 3rd layer</h2><ul><li>Add a 3rd layer<ul><li>Attach the 2 classes Class2 and Class3 to this layer.</li><li>Attach the property 'Fill Color'</li><li>Change the value of 'Fill Color' to orange<ul><li>Class2 and Class3 should change to orange.</li></ul></li></ul></li></ul><p><img border="0" src="simpleTutorialImages/layer2.png"/></p><h2 id="Disabling_a_Layer">Disabling a Layer</h2><p>It is possible to disable a layer without deleting it. A disabled layer do not participate in layer stack.</p><p>To disable a layer, select it in the LayersExplorer.</p><ul><li>Then in the PropertyView, open the Layers tab</li><li>select or unselect the layer with 'Is Layer Enable".<ul><li>Note that in our example, disabling the Layer2 will change the color of the Class2 and Class3. Class2 take the color specified by layer1, and Class3 the color specified by bottomLayer.</li></ul></li></ul><p><img border="0" src="simpleTutorialImages/disableLayer.png"/></p><h1 id="Layer_Operators">Layer Operators</h1><p>Layer Operators are a kind of layer that can contain other Layers.</p><p>A layer operator is called like this because it is used to apply an 'operator' on its nested layers. The operator compute the property values for attached layers.</p><p>It is not possible to attach directly views or properties to a layer operator. But a layer operator still have a set of attached views and a set of attached properties. The values of these properties are the results of applying the operator on the properties of the nested layers. The set of the attached views is generally the union of the views attached to the nested layers.</p><p>There is different kind of 'layer operators', each one proposing a different way of computing the property values.</p><h2 id="Top_Layer_Operator">Top Layer Operator</h2><p>The 'Top Layer Operator' contains layers that are ordered from top to bottom. It is called 'Top Layer Operator' because it return the top most value for a particular (view, property type) couple. </p><p>When computing the property value for a specified (view, property type), the Top Layer Operator return the first value found for this couple. It start from the top layer, and stop as soon as a layer as a value set for the specified (view, property type).</p></body></html>

Back to the top