Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
36cf13d4
Commit
36cf13d4
authored
Jul 12, 2012
by
Stefanie Gareis
Browse files
Oscilloscope with swt charts implemented
parent
fa8bd2fa
Changes
15
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.operatorpanel.ui/trunk/.classpath
View file @
36cf13d4
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
exported=
"true"
kind=
"lib"
path=
"lib/org.swtchart_0.8.0.v20120301.jar"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.pde.core.requiredPlugins"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
...
...
org.fortiss.af3.operatorpanel.ui/trunk/META-INF/MANIFEST.MF
View file @
36cf13d4
...
...
@@ -3,7 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Name: AF3 Operatorpanel UI
Bundle-SymbolicName: org.fortiss.af3.operatorpanel.ui;singleton:=true
Bundle-Version: 2.2.0.qualifier
Bundle-ClassPath: .
Bundle-ClassPath: .,
lib/org.swtchart_0.8.0.v20120301.jar
Bundle-Vendor: fortiss GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
...
...
org.fortiss.af3.operatorpanel.ui/trunk/build.properties
View file @
36cf13d4
...
...
@@ -5,6 +5,7 @@
bin.includes
=
.,
\
META-INF/,
\
plugin.xml
plugin.xml,
\
lib/org.swtchart_0.8.0.v20120301.jar
source..
=
src/
output..
=
build/
org.fortiss.af3.operatorpanel.ui/trunk/lib/org.swtchart_0.8.0.v20120301.jar
0 → 100644
View file @
36cf13d4
File added
org.fortiss.af3.operatorpanel.ui/trunk/plugin.xml
View file @
36cf13d4
...
...
@@ -53,6 +53,12 @@
modelElementClass=
"org.fortiss.af3.operatorpanel.model.OPITermInput"
>
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler=
"org.fortiss.af3.operatorpanel.ui.handler.OPOsciHandler"
>
<modelElementClass
modelElementClass=
"org.fortiss.af3.operatorpanel.model.OPOscilloscope"
>
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler=
"org.fortiss.af3.operatorpanel.ui.handler.OPAreaInputHandler"
>
<modelElementClass
...
...
@@ -109,6 +115,9 @@
<modelElementClass
modelElementClass=
"org.fortiss.af3.operatorpanel.model.OperatorPanelSpecification"
>
</modelElementClass>
<modelElementClass
modelElementClass=
"org.fortiss.af3.operatorpanel.model.OPOscilloscope"
>
</modelElementClass>
<modelElementClass
modelElementClass=
"org.fortiss.af3.operatorpanel.model.OPAreaInput"
>
</modelElementClass>
...
...
@@ -186,6 +195,15 @@
type=
"org.fortiss.af3.operatorpanel.model.OPToggleButton"
>
</input>
</propertySection>
<propertySection
class=
"org.fortiss.af3.operatorpanel.ui.properties.OPOsciReactionsPropertySection"
enablesFor=
"1"
id=
"org.fortiss.af3.operatorpanel.ui.property.OPOsciPropertySection"
tab=
"org.fortiss.af3.operatorpanel.ui.property.tab.reactions"
>
<input
type=
"org.fortiss.af3.operatorpanel.model.OPOscilloscope"
>
</input>
</propertySection>
<propertySection
afterSection=
"org.fortiss.af3.operatorpanel.ui.property.InputOPItemPropertySection"
class=
"org.fortiss.af3.operatorpanel.ui.properties.AreaInputPropertySection"
...
...
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/editpart/OperatorPanelEditPartFactory.java
View file @
36cf13d4
...
...
@@ -23,6 +23,7 @@ import org.fortiss.af3.operatorpanel.model.OPButton;
import
org.fortiss.af3.operatorpanel.model.OPColorDisplay
;
import
org.fortiss.af3.operatorpanel.model.OPITermInput
;
import
org.fortiss.af3.operatorpanel.model.OPLabel
;
import
org.fortiss.af3.operatorpanel.model.OPOscilloscope
;
import
org.fortiss.af3.operatorpanel.model.OPTextDisplay
;
import
org.fortiss.af3.operatorpanel.model.OperatorPanelSpecification
;
import
org.fortiss.tooling.kernel.ui.extension.IEditPartFactory
;
...
...
@@ -52,8 +53,12 @@ public class OperatorPanelEditPartFactory implements IEditPartFactory {
if
(
model
instanceof
OPColorDisplay
)
{
return
new
OPGenericItemEditPart
((
OPColorDisplay
)
model
);
}
if
(
model
instanceof
OPOscilloscope
)
{
return
new
OPGenericItemEditPart
((
OPOscilloscope
)
model
);
}
if
(
model
instanceof
OPButton
)
{
return
new
OPButtonEditPart
((
OPButton
)
model
);
}
if
(
model
instanceof
OPITermInput
)
{
return
new
OPGenericItemEditPart
((
OPITermInput
)
model
);
...
...
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/handler/OPOsciHandler.java
0 → 100644
View file @
36cf13d4
/*--------------------------------------------------------------------------+
$Id: OperatorPanelItemHandler.java 2646 2012-01-05 13:05:28Z hoelzl $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.operatorpanel.ui.handler
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
ui
.
AF3OperatorpanelUIActivator
.
getImageDescriptor
;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.fortiss.af3.operatorpanel.model.OPColorDisplay
;
import
org.fortiss.af3.operatorpanel.model.OPOscilloscope
;
import
org.fortiss.tooling.kernel.ui.extension.IModelElementHandler
;
import
org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase
;
/**
* {@link IModelElementHandler} for {@link OPOscilloscope}s.
*
* @author doebber
* @author $Author: hoelzl $
* @version $Rev: 2646 $
* @ConQAT.Rating GREEN Hash: D0B23CDC9BFBCF7CF5CDC14A3CCAAF7B
*/
public
class
OPOsciHandler
extends
NamedCommentedModelElementHandlerBase
<
OPColorDisplay
>
{
/** {@inheritDoc} */
@Override
public
ImageDescriptor
getIconImageDescriptor
()
{
return
getImageDescriptor
(
"icons/light.png"
);
}
/** {@inheritDoc} */
@Override
public
boolean
hiddenInNonExpertView
()
{
return
true
;
}
}
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/properties/OPOsciReactionsPropertySection.java
0 → 100644
View file @
36cf13d4
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2012 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.operatorpanel.ui.properties
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.swt.SWT
;
import
org.fortiss.af3.component.ui.behavior.GuardToStringConverter
;
import
org.fortiss.af3.component.ui.behavior.StringToGuardConverter
;
import
org.fortiss.af3.component.ui.behavior.StringToGuardValidator
;
import
org.fortiss.af3.expression.model.terms.impl.VarStaticImpl
;
import
org.fortiss.af3.expression.ui.databinding.convert.ITermToStringConverter
;
import
org.fortiss.af3.expression.ui.databinding.convert.StringToIExpressionTermConverter
;
import
org.fortiss.af3.expression.ui.databinding.validate.StringToIExpressionTermValidator
;
import
org.fortiss.af3.operatorpanel.model.AF3OperatorPanelFactory
;
import
org.fortiss.af3.operatorpanel.model.AF3OperatorPanelPackage
;
import
org.fortiss.af3.operatorpanel.model.OPOsciReaction
;
import
org.fortiss.af3.operatorpanel.model.OPOscilloscope
;
/**
* Property section for oscilloscope reactions.
*
* @author doebber
* @author $Author: hoelzlf $
* @version $Rev: 5260 $
* @ConQAT.Rating GREEN Hash: E021513702187457B76B245D46490B78
*/
public
class
OPOsciReactionsPropertySection
extends
ListPropertySectionBase
<
OPOsciReaction
>
{
/** {@inheritDoc} */
@Override
protected
void
addViewerColumns
(
EObject
currentObject
)
{
createComplexTableColumn
(
"Guards"
,
350
,
SWT
.
LEFT
,
AF3OperatorPanelPackage
.
Literals
.
OP_REACTION__GUARD
,
new
GuardToStringConverter
(),
new
StringToGuardConverter
(),
new
StringToGuardValidator
(
currentObject
));
createComplexTableColumn
(
"Item input"
,
120
,
SWT
.
LEFT
,
AF3OperatorPanelPackage
.
Literals
.
OP_OSCI_REACTION__ITEM_INPUT
,
new
ITermToStringConverter
(),
new
StringToIExpressionTermConverter
(),
new
StringToIExpressionTermValidator
(
currentObject
));
}
/** {@inheritDoc} */
@Override
protected
OPOsciReaction
createListItem
()
{
OPOsciReaction
reaction
=
AF3OperatorPanelFactory
.
eINSTANCE
.
createOPOsciReaction
();
reaction
.
setItemInput
(
VarStaticImpl
.
create
(
"var"
));
return
reaction
;
}
/** {@inheritDoc} */
@Override
protected
EList
<
OPOsciReaction
>
getList
(
EObject
eo
)
{
return
((
OPOscilloscope
)
eo
).
getReactionsList
();
}
}
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/prototypes/PrototypeProvider.java
View file @
36cf13d4
...
...
@@ -21,6 +21,7 @@ import static org.fortiss.af3.operatorpanel.utils.OperatorPanelModelElementFacto
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPColorDisplay
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPITermInput
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPLabel
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPOscilloscope
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPPushButton
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPTextDisplay
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
utils
.
OperatorPanelModelElementFactory
.
createOPToggleButton
;
...
...
@@ -56,6 +57,8 @@ public final class PrototypeProvider extends PrototypeProviderBase {
CATEGORY_NAME
);
registerPrimaryPrototype
(
"Text Display"
,
createOPTextDisplay
(
"Text Display"
),
CATEGORY_NAME
);
registerPrimaryPrototype
(
"Term Input"
,
createOPITermInput
(
"Term Input"
),
CATEGORY_NAME
);
registerPrimaryPrototype
(
"Oscilloscope"
,
createOPOscilloscope
(
"Oscilloscope"
),
CATEGORY_NAME
);
registerPrimaryPrototype
(
"Area Input"
,
createOPAreaInput
(
"Area Input"
),
CATEGORY_NAME
);
}
}
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/simulator/views/OPVCOscilloscope.java
0 → 100644
View file @
36cf13d4
/*--------------------------------------------------------------------------+
$Id: OPVCColorDisplay.java 3278 2012-02-02 10:36:57Z wandinger $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.operatorpanel.ui.simulator.views
;
import
static
org
.
fortiss
.
tooling
.
base
.
ui
.
utils
.
LayoutDataUtils
.
getNodeBounds
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.swt.widgets.Label
;
import
org.fortiss.af3.operatorpanel.model.OPOsciReaction
;
import
org.fortiss.af3.operatorpanel.model.OPOscilloscope
;
import
org.fortiss.af3.operatorpanel.simulator.ExecutableOperatorPanelSpecification
;
import
org.swtchart.Chart
;
import
org.swtchart.IAxis
;
import
org.swtchart.IAxisSet
;
import
org.swtchart.ILineSeries
;
import
org.swtchart.ILineSeries.PlotSymbolType
;
import
org.swtchart.ISeries.SeriesType
;
import
org.swtchart.LineStyle
;
import
org.swtchart.Range
;
/**
* Control for colors.
*
* @author hummel
* @author hoelzl
* @author $Author: wandinger $
* @version $Rev: 3278 $
* @ConQAT.Rating GREEN Hash: 3B658B2F9CBBBE49B806BA99462506BF
*/
/* package */
class
OPVCOscilloscope
extends
OPVCOutputControlBase
<
OPOscilloscope
,
Label
,
OPOsciReaction
>
{
/** The background color. */
private
Color
background
;
/** Constructor. */
public
OPVCOscilloscope
(
OPOscilloscope
item
,
Composite
parent
)
{
super
(
item
,
parent
);
background
=
new
Color
(
null
,
0
,
0
,
0
);
this
.
item
=
item
;
}
// SWTChart
Chart
chart
;
IAxisSet
axis
;
IAxis
xAxis
;
IAxis
yAxis
;
// line for the values
ILineSeries
line
;
// array containing the values
double
[]
series
;
double
[]
timeSeries
;
OPOscilloscope
item
;
/** {@inheritDoc} */
@Override
protected
Label
createControl
(
Composite
parent
)
{
// oscilloscope timeline-length = series.length
series
=
new
double
[
100
];
// time series
timeSeries
=
new
double
[
series
.
length
];
for
(
int
i
=
0
;
i
<
timeSeries
.
length
;
i
++)
timeSeries
[
i
]
=
i
-
100
;
chart
=
new
Chart
(
parent
,
SWT
.
NONE
);
// make it look like an onscilloscope
Color
backgroundColor
=
new
Color
(
Display
.
getDefault
(),
0
,
0
,
0
);
Color
lineColor
=
new
Color
(
Display
.
getDefault
(),
0
,
255
,
0
);
Color
gridColor
=
new
Color
(
Display
.
getDefault
(),
125
,
125
,
125
);
chart
.
setBounds
(
getNodeBounds
(
modelItem
).
x
,
getNodeBounds
(
modelItem
).
y
,
getNodeBounds
(
modelItem
).
width
,
getNodeBounds
(
modelItem
).
height
);
chart
.
setBackgroundInPlotArea
(
backgroundColor
);
chart
.
getTitle
().
setText
(
modelItem
.
getName
());
chart
.
getTitle
().
setForeground
(
backgroundColor
);
chart
.
getLegend
().
setVisible
(
false
);
axis
=
chart
.
getAxisSet
();
// Properties for x axis
xAxis
=
axis
.
getXAxis
(
0
);
xAxis
.
getGrid
().
setForeground
(
gridColor
);
xAxis
.
getTitle
().
setText
(
"time"
);
xAxis
.
getTitle
().
setForeground
(
backgroundColor
);
xAxis
.
getTick
().
setForeground
(
backgroundColor
);
// Properties for y axis
yAxis
=
axis
.
getYAxis
(
0
);
yAxis
.
getGrid
().
setForeground
(
gridColor
);
yAxis
.
getTitle
().
setText
(
"value"
);
yAxis
.
getTitle
().
setForeground
(
backgroundColor
);
yAxis
.
getTick
().
setForeground
(
backgroundColor
);
line
=
(
ILineSeries
)
chart
.
getSeriesSet
().
createSeries
(
SeriesType
.
LINE
,
"Line Series"
);
line
.
setLineColor
(
lineColor
);
line
.
setLineWidth
(
2
);
line
.
setLineStyle
(
LineStyle
.
SOLID
);
line
.
setSymbolType
(
PlotSymbolType
.
NONE
);
// set chart size matching the prototype size
chart
.
setSize
(
getNodeBounds
(
modelItem
).
width
,
getNodeBounds
(
modelItem
).
height
);
// initialize graph
line
.
setYSeries
(
series
);
axis
.
getXAxis
(
0
).
adjustRange
();
axis
.
getYAxis
(
0
).
adjustRange
();
return
new
Label
(
parent
,
SWT
.
NONE
);
}
/** {@inheritDoc} */
@Override
public
void
dispose
()
{
background
.
dispose
();
super
.
dispose
();
}
// Maximum and Minimum value for the Osci-range. Range in y-Axis is oriented on the
// highest(=max)/lowest(=min) value
double
max
=
0
;
double
min
=
0
;
/** {@inheritDoc} */
@Override
public
void
updateDisplayInternal
(
ExecutableOperatorPanelSpecification
simulation
,
OPOsciReaction
reaction
)
{
if
(
reaction
==
null
)
{
return
;
}
// new value in every simulation step.
double
value
=
simulation
.
computeOsciValue
(
item
);
// determine new maximum/minimum
max
=
value
>
max
?
value
:
max
;
min
=
value
<
min
?
value
:
min
;
// update oscilloscope series. New value appears on the right end, others get moved one step
// to the left
for
(
int
i
=
0
;
i
<
series
.
length
-
1
;
i
++)
{
series
[
i
]
=
series
[
i
+
1
];
timeSeries
[
i
]++;
}
series
[
series
.
length
-
1
]
=
value
;
timeSeries
[
series
.
length
-
1
]++;
line
.
setYSeries
(
series
);
line
.
setXSeries
(
timeSeries
);
xAxis
.
adjustRange
();
yAxis
.
setRange
(
new
Range
(
min
-
1
,
max
+
1
));
chart
.
redraw
();
}
}
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/simulator/views/OperationPanelSimulationComposite.java
View file @
36cf13d4
...
...
@@ -20,7 +20,6 @@ package org.fortiss.af3.operatorpanel.ui.simulator.views;
import
static
org
.
eclipse
.
swt
.
SWT
.
DEFAULT
;
import
static
org
.
eclipse
.
swt
.
SWT
.
NONE
;
import
static
org
.
fortiss
.
tooling
.
base
.
ui
.
utils
.
LayoutDataUtils
.
getNodeBounds
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
TransformationUtils
.
createTransformedObjectWithoutExceptionFor
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -34,6 +33,7 @@ import org.fortiss.af3.operatorpanel.model.OPAreaInput;
import
org.fortiss.af3.operatorpanel.model.OPColorDisplay
;
import
org.fortiss.af3.operatorpanel.model.OPITermInput
;
import
org.fortiss.af3.operatorpanel.model.OPLabel
;
import
org.fortiss.af3.operatorpanel.model.OPOscilloscope
;
import
org.fortiss.af3.operatorpanel.model.OPPushButton
;
import
org.fortiss.af3.operatorpanel.model.OPTextDisplay
;
import
org.fortiss.af3.operatorpanel.model.OPToggleButton
;
...
...
@@ -41,7 +41,6 @@ import org.fortiss.af3.operatorpanel.model.OperatorPanelItem;
import
org.fortiss.af3.operatorpanel.model.OperatorPanelSpecification
;
import
org.fortiss.af3.operatorpanel.simulator.ExecutableOperatorPanelSpecification
;
import
org.fortiss.tooling.base.model.layout.ILayoutedModelElement
;
import
org.fortiss.tooling.kernel.extension.data.ITransformationContext
;
/**
* Composite for operator panels.
...
...
@@ -50,9 +49,13 @@ import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
* @author hoelzl
* @author $Author$
* @version $Rev$
<<<<<<< .mine
* @ConQAT.Rating GREEN Hash: 783F9B9442AAF5C3FF7FD2F0AB1B362B
=======
* @ConQAT.Rating YELLOW Hash: F49AE1BBDE1E267D48C149E3299E775E
>>>>>>> .r4927
*/
public
class
OperationPanelSimulationComposite
extends
Composite
{
/* package */
class
OperationPanelSimulationComposite
extends
Composite
{
/** The key storing the OP item. */
public
static
final
String
ITEM_KEY
=
"OPItem"
;
...
...
@@ -92,6 +95,9 @@ public class OperationPanelSimulationComposite extends Composite {
if
(
item
instanceof
OPColorDisplay
)
{
return
new
OPVCColorDisplay
((
OPColorDisplay
)
item
,
this
);
}
if
(
item
instanceof
OPOscilloscope
)
{
return
new
OPVCOscilloscope
((
OPOscilloscope
)
item
,
this
);
}
if
(
item
instanceof
OPTextDisplay
)
{
return
new
OPVCTextDisplay
((
OPTextDisplay
)
item
,
this
);
}
...
...
@@ -102,8 +108,7 @@ public class OperationPanelSimulationComposite extends Composite {
return
new
OPVCAreaInput
((
OPAreaInput
)
item
,
this
);
}
// try transformation service
return
createTransformedObjectWithoutExceptionFor
(
item
,
OPViewControlBase
.
class
,
new
OperatorPanelTransformationContext
(
this
));
return
null
;
}
/** Determines the size of the composite. */
...
...
@@ -169,15 +174,4 @@ public class OperationPanelSimulationComposite extends Composite {
}
}
}
/** Transformation context for operator panel item extensions. */
public
class
OperatorPanelTransformationContext
implements
ITransformationContext
{
/** The simulation composite. */
public
OperationPanelSimulationComposite
composite
;
/** Constructor. */
public
OperatorPanelTransformationContext
(
OperationPanelSimulationComposite
composite
)
{
this
.
composite
=
composite
;
}
}
}
org.fortiss.af3.operatorpanel/trunk/model/operatorpanel.ecore
View file @
36cf13d4
...
...
@@ -78,6 +78,14 @@
containment=
"true"
/>
</eClassifiers>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"OPPushButton"
eSuperTypes=
"#//OPButton"
/>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"OPOscilloscope"
eSuperTypes=
"#//OutputOperatorPanelItem"
>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"reactions"
upperBound=
"-1"
eType=
"#//OPOsciReaction"
containment=
"true"
/>
</eClassifiers>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"OPOsciReaction"
eSuperTypes=
"#//OPReaction"
>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"itemInput"
eType=
"ecore:EClass platform:/plugin/org.fortiss.af3.expression/model/expression.ecore#//terms/IExpressionTerm"
containment=
"true"
/>
</eClassifiers>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"OPAreaInput"
eSuperTypes=
"#//InputOperatorPanelItem platform:/plugin/org.fortiss.af3.project/model/project.ecore#//typesystem/IVariableScope"
>
<eOperations
name=
"getDefinitionElement"
eType=
"ecore:EClass platform:/plugin/org.fortiss.af3.project/model/project.ecore#//typesystem/IVariableDefinition"
>
<eAnnotations
source=
"http://www.eclipse.org/emf/2002/GenModel"
>
...
...
org.fortiss.af3.operatorpanel/trunk/model/operatorpanel.genmodel
View file @
36cf13d4
...
...
@@ -55,6 +55,12 @@
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference operatorpanel.ecore#//OPToggleButton/onDeselect"
/>
</genClasses>
<genClasses
ecoreClass=
"operatorpanel.ecore#//OPPushButton"
/>
<genClasses
ecoreClass=
"operatorpanel.ecore#//OPOscilloscope"
>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference operatorpanel.ecore#//OPOscilloscope/reactions"
/>
</genClasses>
<genClasses
ecoreClass=
"operatorpanel.ecore#//OPOsciReaction"
>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference operatorpanel.ecore#//OPOsciReaction/itemInput"
/>
</genClasses>
<genClasses
ecoreClass=
"operatorpanel.ecore#//OPAreaInput"
>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference operatorpanel.ecore#//OPAreaInput/output"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference operatorpanel.ecore#//OPAreaInput/type"
/>
...
...
org.fortiss.af3.operatorpanel/trunk/src/org/fortiss/af3/operatorpanel/simulator/ExecutableOperatorPanelSpecification.java
View file @
36cf13d4
...
...
@@ -17,23 +17,29 @@ $Id$
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.operatorpanel.simulator
;
import
static
org
.
fortiss
.
af3
.
component
.
utils
.
ComponentArchitectureUtils
.
getDefinitionElement
;
import
static
org
.
fortiss
.
af3
.
expression
.
language
.
evaluation
.
BoolValue
.
FALSE
;
import
static
org
.
fortiss
.
af3
.
expression
.
language
.
evaluation
.
BoolValue
.
TRUE
;
import
static
org
.
fortiss
.
af3
.
expression
.
language
.
evaluation
.
NoVal
.
NOVAL
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
model
.
impl
.
OPAreaInputStaticImpl
.
THIS_X_VARIABLE
;
import
static
org
.
fortiss
.
af3
.
operatorpanel
.
model
.
impl
.
OPAreaInputStaticImpl
.
THIS_Y_VARIABLE
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
KernelModelElementUtils
.
getParentElement
;
import
java.util.List
;
import
org.conqat.lib.commons.collections.Pair
;
import
org.fortiss.af3.component.model.ComponentArchitecture
;
import
org.fortiss.af3.component.model.OutputPort
;
import
org.fortiss.af3.component.model.behavior.common.Action
;
import
org.fortiss.af3.component.simulator.ExecutableAtomicComponentBase
;
import
org.fortiss.af3.component.simulator.ExecutableComponent
;
import
org.fortiss.af3.expression.language.evaluation.BoolValue
;
import
org.fortiss.af3.expression.language.evaluation.DoubleValue
;
import
org.fortiss.af3.expression.language.evaluation.EnumerationValue
;
import
org.fortiss.af3.expression.language.evaluation.IntValue
;
import
org.fortiss.af3.expression.language.evaluation.NoVal
;
import
org.fortiss.af3.expression.model.definitions.EnumerationMember
;
import
org.fortiss.af3.expression.model.terms.FunctionCall
;
import
org.fortiss.af3.expression.model.terms.Var
;
import
org.fortiss.af3.expression.model.terms.impl.VarStaticImpl
;
import
org.fortiss.af3.expression.model.types.TBool
;
...
...
@@ -43,6 +49,8 @@ import org.fortiss.af3.operatorpanel.model.InputOperatorPanelItem;
import
org.fortiss.af3.operatorpanel.model.OPAreaInput
;
import
org.fortiss.af3.operatorpanel.model.OPColorDisplay
;
import
org.fortiss.af3.operatorpanel.model.OPITermInput
;
import
org.fortiss.af3.operatorpanel.model.OPOsciReaction
;
import
org.fortiss.af3.operatorpanel.model.OPOscilloscope
;
import
org.fortiss.af3.operatorpanel.model.OPPushButton
;
import
org.fortiss.af3.operatorpanel.model.OPReaction
;
import
org.fortiss.af3.operatorpanel.model.OPTextDisplay
;
...
...
@@ -51,6 +59,7 @@ import org.fortiss.af3.operatorpanel.model.OPToggleButton;
import
org.fortiss.af3.operatorpanel.model.OperatorPanelItem
;
import
org.fortiss.af3.operatorpanel.model.OperatorPanelSpecification
;
import
org.fortiss.af3.operatorpanel.model.OutputOperatorPanelItem
;
import
org.fortiss.af3.project.model.typesystem.IFunctionDefinition
;
import
org.fortiss.af3.project.model.typesystem.ITerm
;
import
org.fortiss.af3.project.typesystem.evaluation.Term
;
...
...
@@ -133,14 +142,68 @@ public class ExecutableOperatorPanelSpecification extends
return
getTermValue
(
reaction
.
getItemInput
()).
toString
();
}
/**
* Returns the display value for the given reaction using the current
* simulation values.
*/
public
double
computeOsciValue
(
OPOscilloscope
item
)
{