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
67c688cb
Commit
67c688cb
authored
Dec 19, 2019
by
Simon Barner
Browse files
Merge branch 'master' of
https://git.fortiss.org/af3/af3.git
into 3884
parents
a3977363
a8a703f9
Changes
73
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/.ratings
View file @
67c688cb
ComponentStructureFXEditor.java d097c17a4ebc5bc2a87659544d3dd15f2afde254 GREEN
ComponentStructureFXEditorBinding.java 230337d9526109ee2a9df599c370b0b3f2ec0b40 GREEN
ControllerFactory.java 0adaa2e7ab2e3bc73bae21aec736842a5abeb9a1 GREEN
ModelFactory.java d97242e6b8c69ccaad9fbb6adf80ffdb40520f80 GREEN
VisualFactory.java c3f9acf01cb627f07dca673631a4c8f632d2c4a9 GREEN
ComponentControllerFactory.java debf3bb80cb56197d4dd0c84f38e466f99da9a34 GREEN
ComponentModelFactory.java 7e58831949f50a9887bcbf31959f887a87f703cb GREEN
ComponentStructureFXEditor.java d662863a84c9e3f24e46de19dad1d750a1462cd3 GREEN
ComponentStructureFXEditorBinding.java 370fe5c458f15bd8299364f858250d5c2bda6729 GREEN
ComponentVisualFactory.java 4b5f4e36726d65422719d628765d176aa077b673 GREEN
SubComponentController.java e7361eb33367c160f9a7502721bca13f1ee85128 GREEN
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/ControllerFactory.java
→
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/
Component
ControllerFactory.java
View file @
67c688cb
...
...
@@ -22,18 +22,21 @@ import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBun
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IDiagramMVCBundle
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle
;
import
org.fortiss.af3.component.ui.editor.fx.controller.ChannelController
;
import
org.fortiss.af3.component.ui.editor.fx.controller.DiagramComponentPortController
;
import
org.fortiss.af3.component.ui.editor.fx.controller.DiagramController
;
import
org.fortiss.af3.component.ui.editor.fx.controller.SubComponentController
;
import
org.fortiss.af3.component.ui.editor.fx.controller.SubComponentPortController
;
import
org.fortiss.af3.component.model.Channel
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.tooling.base.ui.editor.fx.controller.EObjectDiagramController
;
import
org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedContentAnchorageController
;
import
org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedDiagramAnchorageController
;
import
org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLinkBendPointController
;
/**
* The implementation of the {@link IControllerFactory} for the component editor.
*
* @author hoelzl
* @author diewald
*/
final
class
ControllerFactory
implements
IControllerFactory
{
public
final
class
Component
ControllerFactory
implements
IControllerFactory
{
/** {@inheritDoc} */
@Override
public
IController
createContentController
(
IContentMVCBundle
model
)
{
...
...
@@ -43,24 +46,24 @@ final class ControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public
IController
createDiagramAnchorageController
(
IDiagramAnchorageMVCBundle
modelBundle
)
{
return
new
DiagramComponentPort
Controller
(
modelBundle
);
return
new
LayoutedDiagramAnchorage
Controller
<>
(
modelBundle
,
Port
.
class
);
}
/** {@inheritDoc} */
@Override
public
IController
createContentAnchorageController
(
IContentAnchorageMVCBundle
modelBundle
)
{
return
new
SubComponentPort
Controller
(
modelBundle
);
return
new
LayoutedContentAnchorage
Controller
<>
(
modelBundle
,
Port
.
class
);
}
/** {@inheritDoc} */
@Override
public
IController
createLinkController
(
ILinkMVCBundle
modelBundle
)
{
return
new
Channel
Controller
(
modelBundle
);
return
new
LayoutedLinkBendPoint
Controller
<>
(
modelBundle
,
Channel
.
class
);
}
/** {@inheritDoc} */
@Override
public
IController
createDiagramController
(
IDiagramMVCBundle
diagramBundle
)
{
return
new
DiagramController
(
diagramBundle
);
return
new
EObject
DiagramController
<>
(
diagramBundle
,
Component
.
class
);
}
}
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/ModelFactory.java
→
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/
Component
ModelFactory.java
View file @
67c688cb
...
...
@@ -31,12 +31,12 @@ import org.fortiss.tooling.base.model.element.IConnection;
*
* @author hoelzl
*/
final
class
ModelFactory
implements
IModelFactory
{
public
final
class
Component
ModelFactory
implements
IModelFactory
{
/** The currently edited component. */
private
final
Component
rootElement
;
/** Constructor. */
public
ModelFactory
(
Component
root
)
{
public
Component
ModelFactory
(
Component
root
)
{
this
.
rootElement
=
requireNonNull
(
root
);
}
...
...
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/ComponentStructureFXEditor.java
View file @
67c688cb
...
...
@@ -19,9 +19,6 @@ import static javafx.scene.paint.Color.LIGHTGRAY;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramViewerFeatures
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IControllerFactory
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.IModelFactory
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IVisualFactory
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.InputPort
;
import
org.fortiss.af3.component.model.OutputPort
;
...
...
@@ -49,22 +46,4 @@ public class ComponentStructureFXEditor extends LWFXEFEditorBase<Component> {
features
.
setIndicatorSpacing
(
new
Dimension2D
(
12
,
12
));
features
.
setBackgroundColor
(
LIGHTGRAY
);
}
/** {@inheritDoc} */
@Override
protected
IModelFactory
createModelFactory
()
{
return
new
ModelFactory
(
editedObject
);
}
/** {@inheritDoc} */
@Override
protected
IVisualFactory
createVisualFactory
()
{
return
new
VisualFactory
();
}
/** {@inheritDoc} */
@Override
protected
IControllerFactory
createControllerFactory
()
{
return
new
ControllerFactory
();
}
}
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/ComponentStructureFXEditorBinding.java
View file @
67c688cb
...
...
@@ -15,6 +15,9 @@
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.component.ui.editor.fx
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IControllerFactory
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.IModelFactory
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IVisualFactory
;
import
org.eclipse.ui.IEditorPart
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase
;
...
...
@@ -31,6 +34,24 @@ public final class ComponentStructureFXEditorBinding extends ModelEditorBindingB
return
ComponentStructureFXEditor
.
class
;
}
/** {@inheritDoc} */
@Override
public
Class
<?
extends
IModelFactory
>
getModelFactory
()
{
return
ComponentModelFactory
.
class
;
}
/** {@inheritDoc} */
@Override
public
Class
<?
extends
IVisualFactory
>
getVisualFactory
()
{
return
ComponentVisualFactory
.
class
;
}
/** {@inheritDoc} */
@Override
public
Class
<?
extends
IControllerFactory
>
getControllerFactory
()
{
return
ComponentControllerFactory
.
class
;
}
/** {@inheritDoc} */
@Override
public
String
getLabel
()
{
...
...
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/VisualFactory.java
→
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/
Component
VisualFactory.java
View file @
67c688cb
...
...
@@ -27,23 +27,24 @@ import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IVisualFact
import
org.fortiss.af3.component.model.Channel
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.af3.component.ui.editor.fx.visual.ChannelVisual
;
import
org.fortiss.af3.component.ui.editor.fx.visual.ContentComponentPortVisual
;
import
org.fortiss.af3.component.ui.editor.fx.visual.ContentComponentVisual
;
import
org.fortiss.af3.component.ui.editor.fx.visual.DiagramComponentPortVisual
;
import
org.fortiss.af3.component.ui.editor.fx.visual.SubComponentPortVisual
;
import
org.fortiss.af3.component.ui.editor.fx.visual.SubComponentVisual
;
import
org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedLineLinkVisual
;
/**
* The implementation of the {@link IVisualFactory} for the component editor.
*
* @author hoelzl
* @author diewald
*/
final
class
VisualFactory
implements
IVisualFactory
{
public
final
class
Component
VisualFactory
implements
IVisualFactory
{
/** {@inheritDoc} */
@Override
public
IContentVisual
createContentVisual
(
IContentMVCBundle
modelBundle
)
{
Object
modelObj
=
modelBundle
.
getModel
();
if
(
modelObj
instanceof
Component
)
{
return
new
Sub
ComponentVisual
(
modelBundle
);
return
new
Content
ComponentVisual
(
modelBundle
);
}
return
null
;
}
...
...
@@ -65,7 +66,7 @@ final class VisualFactory implements IVisualFactory {
createContentAnchorageVisual
(
IContentAnchorageMVCBundle
modelBundle
)
{
Object
anchorageObj
=
modelBundle
.
getModel
();
if
(
anchorageObj
instanceof
Port
)
{
return
new
Sub
ComponentPortVisual
(
modelBundle
);
return
new
Content
ComponentPortVisual
(
modelBundle
);
}
return
null
;
}
...
...
@@ -75,7 +76,7 @@ final class VisualFactory implements IVisualFactory {
public
ILinkVisual
createLinkVisual
(
ILinkMVCBundle
modelBundle
)
{
Object
linkObj
=
modelBundle
.
getModel
();
if
(
linkObj
instanceof
Channel
)
{
return
new
Channel
Visual
(
modelBundle
);
return
new
NamedLayoutedLineLink
Visual
<>
(
modelBundle
,
Channel
.
class
);
}
return
null
;
}
...
...
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/
controller/Diagram
Component
Port
Controller.java
→
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/
Sub
ComponentController.java
View file @
67c688cb
...
...
@@ -13,28 +13,37 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.component.ui.editor.fx
.controller
;
package
org.fortiss.af3.component.ui.editor.fx
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IController
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IMVCBundle
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBundle
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.tooling.base.ui.editor.fx.LayoutedModelElementBasedDiagramAnchorageController
;
import
org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController
;
import
javafx.geometry.Side
;
/**
* {@link IController} for the ports of the component displayed in the diagram (i.e. on the
* background).
* {@link IController} for sub-components of the component displayed in the diagram.
*
* @author hoelzl
* @author diewald
*/
public
final
class
Diagram
Component
Port
Controller
extends
Layouted
ModelElementBasedDiagramAnchorageController
{
public
final
class
Sub
ComponentController
extends
Layouted
RectangularResizableContentController
<
Component
>
{
/** Constructor. */
public
DiagramComponentPortController
(
IMVCBundle
mvcb
)
{
super
(
mvcb
);
Object
model
=
mvcb
.
getModel
();
if
(!(
model
instanceof
Port
))
{
throw
new
IllegalArgumentException
(
"Expected model of type Port, but was "
+
model
.
getClass
().
getSimpleName
());
public
SubComponentController
(
IContentMVCBundle
mvcb
)
{
super
(
mvcb
,
Component
.
class
);
}
/** {@inheritDoc} */
@Override
protected
void
moveAnchorageToSideOffset
(
IContentAnchorageMVCBundle
anchorage
,
Side
side
,
double
offset
)
{
Object
portObj
=
anchorage
.
getModel
();
if
(
portObj
instanceof
Port
)
{
super
.
moveAnchorageToSideOffset
(
anchorage
,
side
,
offset
);
}
}
}
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/controller/.ratings
deleted
100644 → 0
View file @
a3977363
ChannelController.java fe3fd8b71f320e93fa8581298581af6a9d5f8aee GREEN
DiagramComponentPortController.java c99d075a9bc6b9c4214dee19aa5fd634ca5be379 GREEN
DiagramController.java 74e96ce04d715a8084eb5d20b74567bc0168910d GREEN
SubComponentController.java 3fe6f80d4fec036983523b78a8a1892c7716cbda GREEN
SubComponentPortController.java ce6b20088baeb1ddd5c98111316f707f71cd133e GREEN
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/controller/DiagramController.java
deleted
100644 → 0
View file @
a3977363
/*-------------------------------------------------------------------------+
| Copyright 2019 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.component.ui.editor.fx.controller
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IController
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IMVCBundle
;
import
org.fortiss.tooling.base.ui.editor.fx.EObjectBasedDiagramControllerBase
;
/**
* {@link IController} for the diagram model element.
*
* @author hoelzl
*/
public
final
class
DiagramController
extends
EObjectBasedDiagramControllerBase
{
/** Constructor. */
public
DiagramController
(
IMVCBundle
mvcb
)
{
super
(
mvcb
);
}
}
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/controller/SubComponentController.java
deleted
100644 → 0
View file @
a3977363
/*-------------------------------------------------------------------------+
| Copyright 2019 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.component.ui.editor.fx.controller
;
import
static
org
.
fortiss
.
tooling
.
base
.
layout
.
DefaultLayoutConstants
.
DEFAULT_SHAPE_MINIMUM_HEIGHT
;
import
static
org
.
fortiss
.
tooling
.
base
.
layout
.
DefaultLayoutConstants
.
DEFAULT_SHAPE_MINIMUM_WIDTH
;
import
static
org
.
fortiss
.
tooling
.
base
.
ui
.
utils
.
LWFXEditorUtils
.
convertSideToEOrientation
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
LayoutDataUtils
.
getNodeSize
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
LayoutDataUtils
.
moveNode
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
LayoutDataUtils
.
setNodeSize
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
LayoutDataUtils
.
setStickyConnectorLayoutData
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.FeedbackChange
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IController
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IDragController
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.rectangular.RectangularContentAnchorageMoveController
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle
;
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBundle
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.tooling.base.model.layout.Dimension
;
import
org.fortiss.tooling.base.ui.editor.fx.EObjectBasedRectangularResizableContentControllerBase
;
import
javafx.geometry.Dimension2D
;
import
javafx.geometry.Side
;
/**
* {@link IController} for sub-components of the component displayed in the diagram.
*
* @author hoelzl
*/
public
final
class
SubComponentController
extends
EObjectBasedRectangularResizableContentControllerBase
{
/** Constructor. */
public
SubComponentController
(
IContentMVCBundle
mvcb
)
{
super
(
mvcb
);
Object
model
=
mvcb
.
getModel
();
if
(!(
model
instanceof
Component
))
{
throw
new
IllegalArgumentException
(
"Expected model of type Component, but was "
+
model
.
getClass
().
getSimpleName
());
}
}
/** Returns the component. */
private
Component
getComponent
()
{
// wild cast works: see constructor
return
(
Component
)
getModel
();
}
/** {@inheritDoc} */
@Override
protected
IDragController
createAnchorageMoveController
(
IContentAnchorageMVCBundle
anchorage
)
{
// we need an overridden port move controller due to the frameworks default snapping
// behavior, which snaps to anchorage size while AF3 ports snap to half their size
return
new
RectangularContentAnchorageMoveController
(
this
,
anchorage
)
{
/** {@inheritDoc} */
@Override
protected
Dimension2D
overrideBorderSnap
(
Dimension2D
anchorageSize
)
{
// this override is required because ports can be moved by half their size
// while the default implementation would only allow for full size of the port
return
new
Dimension2D
(
anchorageSize
.
getWidth
()
/
2
,
anchorageSize
.
getHeight
()
/
2
);
}
};
}
/** {@inheritDoc} */
@Override
protected
void
moveAnchorageToSideOffset
(
IContentAnchorageMVCBundle
anchorage
,
Side
side
,
double
offset
)
{
Object
portObj
=
anchorage
.
getModel
();
if
(
portObj
instanceof
Port
)
{
Port
port
=
(
Port
)
portObj
;
// the following correction compensates for SubComponentPortVisual.getOffset()
Dimension2D
portDim
=
anchorage
.
getVisual
().
getDimensions
();
int
correction
;
if
(
side
==
Side
.
TOP
||
side
==
Side
.
BOTTOM
)
{
correction
=
(
int
)
portDim
.
getWidth
()
/
2
;
}
else
{
correction
=
(
int
)
portDim
.
getHeight
()
/
2
;
}
int
corrected
=
(
int
)
offset
+
correction
;
setStickyConnectorLayoutData
(
port
,
convertSideToEOrientation
(
side
),
corrected
);
}
}
/** {@inheritDoc} */
@Override
protected
void
move
(
FeedbackChange
deltaChange
)
{
moveNode
(
getComponent
(),
(
int
)
deltaChange
.
getDeltaX
(),
(
int
)
deltaChange
.
getDeltaY
());
}
/** {@inheritDoc} */
@Override
protected
void
resize
(
FeedbackChange
delta
)
{
Component
component
=
getComponent
();
Dimension
d
=
getNodeSize
(
component
);
int
w
=
d
.
getWidth
()
+
(
int
)
delta
.
getDeltaW
();
int
h
=
d
.
getHeight
()
+
(
int
)
delta
.
getDeltaH
();
setNodeSize
(
component
,
w
,
h
);
}
/** {@inheritDoc} */
@Override
protected
Dimension2D
getMinimumSize
()
{
return
new
Dimension2D
(
DEFAULT_SHAPE_MINIMUM_WIDTH
,
DEFAULT_SHAPE_MINIMUM_HEIGHT
);
}
}
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/controller/package.html
deleted
100644 → 0
View file @
a3977363
<!-- (c) 2019 fortiss GmbH -->
<body>
Package for controllers of the JavaFX-based editors of the AF3 component language.
</body>
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/visual/.ratings
View file @
67c688cb
ChannelVisual.java b381c8ff8d3c807b0efc0408f873a96d5db865a6 GREEN
DiagramComponentPortVisual.java 604db6f8979fdb307247fdce9aa1ca28837b55a4 GREEN
SubComponentPortVisual.java 5ccd54942b0306bc1354611856e9103fb174b0a8 GREEN
SubComponentVisual.java 88d6a2aa0a161d3f869b48c25eed93672092f986 YELLOW
ContentComponentPortVisual.java 8c4b9e27d3bd314c9e11fd544dd2ff9ecd7b70d6 GREEN
ContentComponentVisual.java 9e3e2dbc823722a34c5b1e5fe1268e26ec5f8c38 GREEN
DiagramComponentPortVisual.java bbee9f118b4f6c6077f58d144643ac974c8526fe GREEN
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/visual/
Sub
ComponentPortVisual.java
→
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/visual/
Content
ComponentPortVisual.java
View file @
67c688cb
...
...
@@ -22,7 +22,7 @@ import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentAnchor
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IContentVisual
;
import
org.fortiss.af3.component.model.InputPort
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.tooling.base.ui.editor.fx.visual
s
.LayoutedCircular
Content
AnchorageVisual
Base
;
import
org.fortiss.tooling.base.ui.editor.fx.visual.
Named
LayoutedCircularAnchorage
Content
Visual
;
import
javafx.scene.paint.Paint
;
...
...
@@ -32,36 +32,20 @@ import javafx.scene.paint.Paint;
*
* @author hoelzl
* @author munaro
* @author diewald
*/
public
final
class
Sub
ComponentPortVisual
extends
LayoutedCircular
Content
Anchorage
VisualBase
{
public
final
class
Content
ComponentPortVisual
extends
Named
LayoutedCircularAnchorage
ContentVisual
<
Port
>
{
/** Constructor. */
public
SubComponentPortVisual
(
IContentAnchorageMVCBundle
mvcb
)
{
super
(
mvcb
);
Object
model
=
mvcb
.
getModel
();
if
(!(
model
instanceof
Port
))
{
throw
new
IllegalArgumentException
(
"Expected model of type Port, but was "
+
model
.
getClass
().
getSimpleName
());
}
}
/** Returns the port model element. */
private
Port
getPort
()
{
// wild cast works: see constructor.
return
(
Port
)
super
.
getModel
();
}
/** {@inheritDoc} */
@Override
protected
String
getHoverText
()
{
return
getPort
().
getName
();
public
ContentComponentPortVisual
(
IContentAnchorageMVCBundle
mvcb
)
{
super
(
mvcb
,
Port
.
class
);
}
/** {@inheritDoc} */
@Override
protected
Paint
getFillColor
()
{
Port
p
=
get
Por
t
();
Port
p
=
get
ModelElemen
t
();
if
(
p
instanceof
InputPort
)
{
return
WHITE
;
}
...
...
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/visual/
Sub
ComponentVisual.java
→
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/visual/
Content
ComponentVisual.java
View file @
67c688cb
...
...
@@ -25,7 +25,7 @@ import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBun
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IContentVisual
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.ui.AF3ComponentUIActivator
;
import
org.fortiss.tooling.base.ui.editor.fx.visual
s
.LayoutedRectangularContentVisual
Base
;
import
org.fortiss.tooling.base.ui.editor.fx.visual.
Named
LayoutedRectangularContentVisual
;
import
javafx.scene.image.Image
;
import
javafx.scene.paint.Color
;
...
...
@@ -36,8 +36,9 @@ import javafx.scene.paint.Paint;
*
* @author hoelzl
* @author munaro
* @author diewald
*/
public
final
class
Sub
ComponentVisual
extends
LayoutedRectangularContentVisual
Base
{
public
final
class
Content
ComponentVisual
extends
Named
LayoutedRectangularContentVisual
<
Component
>
{
/** The plug-in ID. */
public
static
final
String
PLUGIN_ID
=
AF3ComponentUIActivator
.
class
.
getPackage
().
getName
();
...
...
@@ -53,25 +54,14 @@ public final class SubComponentVisual extends LayoutedRectangularContentVisualBa
convertColor
(
WEAKLY_CAUSAL_COMPONENT_BACKGROUND
);
/** Constructor. */
public
SubComponentVisual
(
IContentMVCBundle
mvcb
)
{
super
(
mvcb
);
Object
model
=
mvcb
.
getModel
();
if
(!(
model
instanceof
Component
))
{
throw
new
IllegalArgumentException
(
"Expected model of type Component, but was "
+
model
.
getClass
().
getSimpleName
());
}
}
/** Returns the component model element. */
private
Component
getComponent
()
{
// wild cast works: see constructor
return
(
Component
)
getModel
();
public
ContentComponentVisual
(
IContentMVCBundle
mvcb
)
{
super
(
mvcb
,
Component
.
class
);
}
/** {@inheritDoc} */
@Override
protected
Paint
getFillColor
()
{
Component
cmp
=
get
Compon
ent
();
Component
cmp
=
get
ModelElem
ent
();
if
(
cmp
.
getSubComponents
().
isEmpty
())
{
if
(
cmp
.
isStronglyCausal
())
{
return
STRONGLY_CAUSAL_COLOR
;
...
...
@@ -86,10 +76,4 @@ public final class SubComponentVisual extends LayoutedRectangularContentVisualBa
protected
Image
getIcon
()
{
return
ICON
;
}
/** {@inheritDoc} */
@Override
protected
String
getName
()
{
return
getComponent
().
getName
();
}
}
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/editor/fx/visual/DiagramComponentPortVisual.java
View file @
67c688cb
...
...
@@ -22,7 +22,7 @@ import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IDiagramAnchor
import
org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IContentVisual
;
import
org.fortiss.af3.component.model.InputPort
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.tooling.base.ui.editor.fx.visual
s
.LayoutedCircular
Diagram
AnchorageVisual
Base
;
import
org.fortiss.tooling.base.ui.editor.fx.visual.
Named
LayoutedCircularAnchorage
Diagram
Visual
;
import
javafx.scene.paint.Paint
;
...
...
@@ -32,29 +32,20 @@ import javafx.scene.paint.Paint;
*
* @author hoelzl
* @author munaro
* @author diewald
*/
public
final
class
DiagramComponentPortVisual