...
 
Commits (33)
......@@ -17,6 +17,8 @@ Export-Package: org.fortiss.af3.component.ui,
org.fortiss.af3.component.ui.editor,
org.fortiss.af3.component.ui.editor.code,
org.fortiss.af3.component.ui.editor.datastate,
org.fortiss.af3.component.ui.editor.fx,
org.fortiss.af3.component.ui.editor.fx.visual,
org.fortiss.af3.component.ui.editpart,
org.fortiss.af3.component.ui.editpart.figure,
org.fortiss.af3.component.ui.examples,
......
ComponentControllerFactory.java 8de3dc95e8a981f93dc179ef510062cc7a112901 YELLOW
ComponentModelFactory.java 9141373b9498b8e947ef1ca8921128bdf66ec308 YELLOW
ComponentStructureFXEditor.java 2d7c0f40fffb4cfb918b60da5de3d5fc0c067916 YELLOW
ComponentStructureFXEditorBinding.java 82516f6e6855be6336116f0ea5563f461d163fc5 YELLOW
ComponentVisualFactory.java 5422167d12bb5553ed816363d41e0288fe481056 YELLOW
ComponentControllerFactory.java 57c48af3d6c2d51a9040a8b754a8b19b73525777 GREEN
ComponentModelFactory.java 9141373b9498b8e947ef1ca8921128bdf66ec308 GREEN
ComponentStructureFXEditor.java 2d7c0f40fffb4cfb918b60da5de3d5fc0c067916 GREEN
ComponentStructureFXEditorBinding.java 82516f6e6855be6336116f0ea5563f461d163fc5 GREEN
ComponentVisualFactory.java 5422167d12bb5553ed816363d41e0288fe481056 GREEN
......@@ -28,7 +28,7 @@ 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;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLineLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController;
/**
......@@ -59,7 +59,7 @@ public final class ComponentControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedLinkBendPointController<>(modelBundle, Channel.class);
return new LayoutedLineLinkBendPointController<>(modelBundle, Channel.class);
}
/** {@inheritDoc} */
......
ContentComponentPortVisual.java 6e398120650316a0649173efd70c508efd3b5d09 YELLOW
ContentComponentVisual.java 1343052af19542e4860043c0bcfb2b3e997d0422 YELLOW
DiagramComponentPortVisual.java 918915c5801064ebfb2bb6028f4e588256b1aefe YELLOW
ContentComponentPortVisual.java 6e398120650316a0649173efd70c508efd3b5d09 GREEN
ContentComponentVisual.java 1343052af19542e4860043c0bcfb2b3e997d0422 GREEN
DiagramComponentPortVisual.java 918915c5801064ebfb2bb6028f4e588256b1aefe GREEN
......@@ -67,13 +67,25 @@
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mode.ui.editor.ModeComponentStructureBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeComponentStructureSpecification">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mode.ui.editor.fx.ModeAutomatonFXEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeAutomaton">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mode.ui.editor.fx.ModeComponentStructureSpecificationFXEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeComponentStructureSpecification">
</modelElementClass>
</modelEditorBinding>
</extension>
......@@ -188,4 +200,14 @@
</extension>
<extension
point="org.fortiss.tooling.kernel.migrationProvider">
<migrationProvider
migrationProvider="org.fortiss.af3.mode.ui.migration.BezierCurveMigrator">
<objectClass
objectClass="org.fortiss.af3.mode.model.ModeAutomaton">
</objectClass>
</migrationProvider>
</extension>
</plugin>
ModeAutomatonControllerFactory.java 3e60fb8432aef914d0c63e8dfeb18b6ac57ddb6f GREEN
ModeAutomatonFXEditor.java 2d70d6f9ad225ebb767d20009f3d7f9f9dda2be2 GREEN
ModeAutomatonFXEditorBinding.java af89d0d7698e7098a409bdced91f01953c1cef2c GREEN
ModeAutomatonModelFactory.java 90826e0ff88b73784e41cc71f473c11daa6bc36d GREEN
ModeAutomatonVisualFactory.java a9b82127b572bf9533474bcf22168e79922b2f16 GREEN
ModeComponentStructureSpecificationFXEditorBinding.java 7f17fdb5186f7cc370b549faac96e0721a49db01 GREEN
ModeComponentStructureSpecificationModelFactory.java 2f81c1c64e51d7a27daf534c34457002f5c6fe9f GREEN
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IControllerFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.mode.model.SwitchSegment;
import org.fortiss.af3.mode.model.SwitchSegmentConnector;
import org.fortiss.tooling.base.ui.editor.fx.controller.CurvedLinkLayoutedContentAnchorangeController;
import org.fortiss.tooling.base.ui.editor.fx.controller.EObjectDiagramController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedCurveLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedDiagramAnchorageController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedEllipticResizableContentController;
/**
* Implementation of the {@link IControllerFactory} for the {@link ModeAutomaton} editor.
*
* @author munaro
*/
public class ModeAutomatonControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentController(IContentMVCBundle model) {
return new LayoutedEllipticResizableContentController<Mode>(model, Mode.class);
}
/** {@inheritDoc} */
@Override
public IController createDiagramAnchorageController(IDiagramAnchorageMVCBundle modelBundle) {
return new LayoutedDiagramAnchorageController<SwitchSegmentConnector>(modelBundle,
SwitchSegmentConnector.class);
}
/** {@inheritDoc} */
@Override
public IController createContentAnchorageController(IContentAnchorageMVCBundle modelBundle) {
return new CurvedLinkLayoutedContentAnchorangeController<SwitchSegmentConnector>(
modelBundle, SwitchSegmentConnector.class);
}
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedCurveLinkBendPointController<SwitchSegment>(modelBundle,
SwitchSegment.class);
}
/** {@inheritDoc} */
@Override
public IController createDiagramController(IDiagramMVCBundle diagramBundle) {
return new EObjectDiagramController<Mode>(diagramBundle, Mode.class);
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import static javafx.scene.paint.Color.LIGHTGRAY;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures.IndicatorType;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.mode.model.SwitchSegment;
import org.fortiss.af3.mode.model.SwitchSegmentConnector;
import org.fortiss.tooling.kernel.ui.extension.base.LWFXEFEditorBase;
/**
* Graphical editor for mode automata based on JavaFX.
*
* @author munaro
*/
public class ModeAutomatonFXEditor extends LWFXEFEditorBase<ModeAutomaton> {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public Class<? extends EObject>[] getVisibleEObjectTypes() {
return new Class[] {Mode.class, SwitchSegment.class, SwitchSegmentConnector.class};
}
/** {@inheritDoc} */
@Override
protected void customizeViewer() {
DiagramViewerFeatures features = viewer.getFeatures();
features.setIndicatorType(IndicatorType.INVISIBLE);
features.setUseSnapToGrid(false);
features.setBackgroundColor(LIGHTGRAY.brighter());
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IControllerFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisualFactory;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
/**
* Binding for the JavaFX-based {@link ModeAutomaton} editor.
*
* @author munaro
*/
public class ModeAutomatonFXEditorBinding extends ModelEditorBindingBase<ModeAutomaton> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return ModeAutomatonFXEditor.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return ModeAutomatonModelFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IVisualFactory> getVisualFactory() {
return ModeAutomatonVisualFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IControllerFactory> getControllerFactory() {
return ModeAutomatonControllerFactory.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "Mode Automaton (FX)";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return 100;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import static java.util.Collections.emptyList;
import static java.util.Objects.requireNonNull;
import java.util.List;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelFactory;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.mode.model.SwitchSegment;
/**
* Implementation of the {@link IModelFactory} for the {@link ModeAutomaton} editor.
*
* @author munaro
*/
public class ModeAutomatonModelFactory implements IModelFactory {
/** The currently edited state. */
private final Mode rootElement;
/** Constructor. */
public ModeAutomatonModelFactory(Mode root) {
this.rootElement = requireNonNull(root);
}
/** Constructor. */
public ModeAutomatonModelFactory(ModeAutomaton root) {
this.rootElement = requireNonNull(root.getRootMode());
}
/** {@inheritDoc} */
@Override
public Object getRootModel() {
return rootElement;
}
/** {@inheritDoc} */
@Override
public List<?> getContentModels() {
return rootElement.getSubModes();
}
/** {@inheritDoc} */
@Override
public List<?> getDiagramAnchorageModels() {
return rootElement.getConnectors();
}
/** {@inheritDoc} */
@Override
public List<?> getContentAnchorageModels(Object parent) {
if(parent instanceof Mode) {
Mode mode = (Mode)parent;
return mode.getConnectors();
}
return emptyList();
}
/** {@inheritDoc} */
@Override
public List<?> getLinkModels() {
return rootElement.getConnections();
}
/** {@inheritDoc} */
@Override
public Object getLinkStart(Object link) {
if(link instanceof SwitchSegment) {
return ((SwitchSegment)link).getSource();
}
return null;
}
/** {@inheritDoc} */
@Override
public Object getLinkEnd(Object link) {
if(link instanceof SwitchSegment) {
return ((SwitchSegment)link).getTarget();
}
return null;
}
/** {@inheritDoc} */
@Override
public Object getParent(Object element) {
return null;
}
/** {@inheritDoc} */
@Override
public void update() {
// ignored
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.mode.model.SwitchSegment;
import org.fortiss.af3.mode.model.SwitchSegmentConnector;
import org.fortiss.af3.mode.ui.editor.fx.visual.ModeVisual;
import org.fortiss.af3.mode.ui.editor.fx.visual.SwitchSegmentContentConnectorVisual;
import org.fortiss.af3.mode.ui.editor.fx.visual.SwitchSegmentDiagramConnectorVisual;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedCurveLinkVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IContentAnchorageVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IContentVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IDiagramAnchorageVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.ILinkVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisualFactory;
/**
* Implementation of the {@link IVisualFactory} for the {@link ModeAutomaton} editor.
*
* @author munaro
*/
public class ModeAutomatonVisualFactory implements IVisualFactory {
/** {@inheritDoc} */
@Override
public IContentVisual createContentVisual(IContentMVCBundle modelBundle) {
Object modelObj = modelBundle.getModel();
if(modelObj instanceof Mode) {
return new ModeVisual(modelBundle);
}
return null;
}
/** {@inheritDoc} */
@Override
public IDiagramAnchorageVisual
createDiagramAnchorageVisual(IDiagramAnchorageMVCBundle modelBundle) {
Object anchorageObj = modelBundle.getModel();
if(anchorageObj instanceof SwitchSegmentConnector) {
return new SwitchSegmentDiagramConnectorVisual(modelBundle);
}
return null;
}
/** {@inheritDoc} */
@Override
public IContentAnchorageVisual
createContentAnchorageVisual(IContentAnchorageMVCBundle modelBundle) {
Object anchorageObj = modelBundle.getModel();
if(anchorageObj instanceof SwitchSegmentConnector) {
return new SwitchSegmentContentConnectorVisual(modelBundle);
}
return null;
}
/** {@inheritDoc} */
@Override
public ILinkVisual createLinkVisual(ILinkMVCBundle modelBundle) {
Object linkObj = modelBundle.getModel();
if(linkObj instanceof SwitchSegment) {
return new NamedLayoutedCurveLinkVisual<SwitchSegment>(modelBundle,
SwitchSegment.class);
}
return null;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IControllerFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisualFactory;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.component.ui.editor.fx.ComponentControllerFactory;
import org.fortiss.af3.component.ui.editor.fx.ComponentStructureFXEditor;
import org.fortiss.af3.component.ui.editor.fx.ComponentVisualFactory;
import org.fortiss.af3.mode.model.ModeComponentStructureSpecification;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
/**
* Binding for the JavaFX-based {@link ModeComponentStructureSpecification} editor.
*
* @author munaro
*/
public class ModeComponentStructureSpecificationFXEditorBinding
extends ModelEditorBindingBase<ModeComponentStructureSpecification> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return ComponentStructureFXEditor.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return ModeComponentStructureSpecificationModelFactory.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() {
return "Mode Component Structure (FX)";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return -100;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx;
import static java.util.Collections.emptyList;
import static java.util.Objects.requireNonNull;
import static org.fortiss.tooling.common.util.LambdaUtils.filterList;
import java.util.List;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelFactory;
import org.fortiss.af3.component.model.Channel;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.mode.model.ModeComponentStructureSpecification;
import org.fortiss.tooling.base.model.element.IConnection;
/**
* Implementation of the {@link IModelFactory} for the {@link ModeComponentStructureSpecification}
* editor.
*
* @author munaro
*/
public class ModeComponentStructureSpecificationModelFactory implements IModelFactory {
/** The currently edited component. */
private final Component rootElement;
/** Constructor. */
public ModeComponentStructureSpecificationModelFactory(
ModeComponentStructureSpecification root) {
this.rootElement = requireNonNull(root.getTopComponent());
}
/** {@inheritDoc} */
@Override
public Object getRootModel() {
return rootElement;
}
/** {@inheritDoc} */
@Override
public List<?> getContentModels() {
return rootElement.getSubComponents();
}
/** {@inheritDoc} */
@Override
public List<?> getDiagramAnchorageModels() {
return rootElement.getConnectors();
}
/** {@inheritDoc} */
@Override
public List<?> getContentAnchorageModels(Object parent) {
if(parent instanceof Component) {
return ((Component)parent).getConnectors();
}
return emptyList();
}
/** {@inheritDoc} */
@Override
public List<?> getLinkModels() {
return filterList(rootElement.getConnections(),
c -> filterPartiallyInitializedConnections(c));
}
/** Checks whether the given connection is only partially initialized. */
private boolean filterPartiallyInitializedConnections(IConnection c) {
return c.getSource() != null && c.getTarget() != null && c.eContainer() != null;
}
/** {@inheritDoc} */
@Override
public Object getLinkStart(Object link) {
if(link instanceof Channel) {
return ((Channel)link).getSource();
}
return null;
}
/** {@inheritDoc} */
@Override
public Object getLinkEnd(Object link) {
if(link instanceof Channel) {
return ((Channel)link).getTarget();
}
return null;
}
/** {@inheritDoc} */
@Override
public Object getParent(Object element) {
return null;
}
/** {@inheritDoc} */
@Override
public void update() {
// ignored
}
}
ModeVisual.java 68adf9e5fa791a8185b182b8232b4e415c440b56 GREEN
SwitchSegmentContentConnectorVisual.java 20eeb1739a1fbc5449253463916b2fcfdd5b51d5 GREEN
SwitchSegmentDiagramConnectorVisual.java 501de4255c1e66249eb3d9a023b654d532dbad68 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx.visual;
import static org.fortiss.af3.component.ui.DefaultStyle.STRONGLY_CAUSAL_COMPONENT_BACKGROUND;
import static org.fortiss.af3.mode.ui.AF3ModeUIActivator.PLUGIN_ID;
import static org.fortiss.tooling.common.ui.javafx.util.GraphicUtils.convertColor;
import static org.fortiss.tooling.common.ui.javafx.util.GraphicUtils.getFXImage;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedEllipticContentVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IContentVisual;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
/**
* {@link IContentVisual} for {@link Mode}s of a {@link ModeAutomaton} displayed in the diagram.
*
* @author munaro
*/
public class ModeVisual extends NamedLayoutedEllipticContentVisual<Mode> {
/** The fill color used by initial states. */
private static final Color INITIAL_STATE_COLOR =
convertColor(STRONGLY_CAUSAL_COMPONENT_BACKGROUND);
/** The fill color used by non-initial states. */
private static final Color STATE_COLOR = new Color(0, 1, 1, 1);
/** The icon image. */
private static final Image ICON = getFXImage(PLUGIN_ID, "/icons/mode.png");
/** Constructor. */
public ModeVisual(IContentMVCBundle mvcb) {
super(mvcb, Mode.class);
}
/** {@inheritDoc} */
@Override
protected Image getIcon() {
return ICON;
}
/** {@inheritDoc} */
@Override
protected Paint getFillColor() {
if(getModelElement().isInitial()) {
return INITIAL_STATE_COLOR;
}
return STATE_COLOR;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx.visual;
import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.paint.Color.WHITE;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IContentVisual;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.SwitchSegmentConnector;
import org.fortiss.af3.state.model.TransitionSegmentEntryConnector;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedCircularAnchorageContentVisual;
import javafx.scene.paint.Paint;
/**
* {@link IContentVisual} for {@link SwitchSegmentConnector}s attached to {@link Mode}s.
*
* @author munaro
*/
public class SwitchSegmentContentConnectorVisual
extends NamedLayoutedCircularAnchorageContentVisual<SwitchSegmentConnector> {
/** Constructor. */
public SwitchSegmentContentConnectorVisual(IContentAnchorageMVCBundle mvcb) {
super(mvcb, SwitchSegmentConnector.class);
}
/** {@inheritDoc} */
@Override
protected Paint getFillColor() {
SwitchSegmentConnector c = getModelElement();
if(c instanceof TransitionSegmentEntryConnector) {
return WHITE;
}
return BLACK;
}
/** {@inheritDoc} */
@Override
protected String getHoverText() {
return getModelElement().getName();
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.editor.fx.visual;
import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.paint.Color.WHITE;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IContentVisual;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.SwitchSegmentConnector;
import org.fortiss.af3.state.model.TransitionSegmentEntryConnector;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedCircularAnchorageDiagramVisual;
import javafx.scene.paint.Paint;
/**
* {@link IContentVisual} for {@link SwitchSegmentConnector}s displayed on {@link Mode}s.
*
* @author munaro
*/
public class SwitchSegmentDiagramConnectorVisual
extends NamedLayoutedCircularAnchorageDiagramVisual<SwitchSegmentConnector> {
/** Constructor. */
public SwitchSegmentDiagramConnectorVisual(IDiagramAnchorageMVCBundle mvcb) {
super(mvcb, SwitchSegmentConnector.class);
}
/** {@inheritDoc} */
@Override
protected Paint getFillColor() {
SwitchSegmentConnector c = getModelElement();
if(c instanceof TransitionSegmentEntryConnector) {
return BLACK;
}
return WHITE;
}
/** {@inheritDoc} */
@Override
protected String getHoverText() {
return getModelElement().getName();
}
}
BezierCurveMigrator.java c4471a954ad5b165d955039e575f60c3643ab7b7 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2020 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.mode.ui.migration;
import static java.lang.Math.floorDiv;
import static java.util.Collections.emptyMap;
import static java.util.stream.Collectors.toSet;
import static org.fortiss.tooling.base.ui.utils.EllipseLayoutUIUtils.getAbsoluteConnectorBounds;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addBendPointToConnection;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectionPoints;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.removeConnectionPoint;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.fortiss.af3.mode.model.SwitchSegment;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.kernel.extension.IMigrationProvider;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
/**
* Migrates {@link SwitchSegment}s to the new representation based on Bezier curves.
*
* @author munaro
*/
public class BezierCurveMigrator implements IMigrationProvider {
/** {@inheritDoc} */
@Override
public boolean needMigration(ITopLevelElement modelElement,
Map<EObject, AnyType> unknownFeatures) {
return !getSegmentsToMigrate(modelElement).isEmpty();
}
/** {@inheritDoc} */
@Override
public Map<EObject, AnyType> migrate(ITopLevelElement modelElement,
Map<EObject, AnyType> unknownFeatures) {
getSegmentsToMigrate(modelElement).forEach(segment -> {
int numberOfPoints = getConnectionPoints(segment).getPoints().size();
while(numberOfPoints < 2) {
if(numberOfPoints == 0) {
org.eclipse.draw2d.geometry.Point source =
getAbsoluteConnectorBounds(segment.getSourceConnector(),
segment.getSourceConnector().getMode()).getCenter();
org.eclipse.draw2d.geometry.Point target =
getAbsoluteConnectorBounds(segment.getTargetConnector(),
segment.getTargetConnector().getMode()).getCenter();
addBendPointToConnection(segment, (source.x + target.x) / 2,
(source.y + target.y) / 2);
} else {
Point point = getConnectionPoints(segment).getPoints().get(0);
addBendPointToConnection(segment, point.getX(), point.getY());
}
numberOfPoints++;
}
if(numberOfPoints % 3 != 2) {
int middle = floorDiv(numberOfPoints, 2);
removeConnectionPoint(segment, middle);
}
});
return emptyMap();
}
/** Filters the {@link SwitchSegment}s to migrate. */
private static Collection<SwitchSegment> getSegmentsToMigrate(ITopLevelElement modelElement) {
EList<SwitchSegment> transitionSegments =
getChildrenWithType(modelElement.getRootModelElement(), SwitchSegment.class);
return transitionSegments.stream().filter(segment -> {
int numberOfPoints = getConnectionPoints(segment).getPoints().size();
return numberOfPoints < 2 || numberOfPoints % 3 != 2;
}).collect(toSet());
}
}
PartitionControllerFactory.java 01c6c9ccc9c4674af9227ec67db5e07d28037d14 YELLOW
PartitionModelFactory.java 3ef78670e39599c365f79c4c12926d1cdbb244dd YELLOW
PartitionStructureFXEditor.java 7f3b68fcb866336bf55b7b3dbc0e504dea83ff49 YELLOW
PartitionStructureFXEditorBinding.java 6456324614722b9c627d6d52e49e588ab51ca56a YELLOW
PartitionVisualFactory.java f9bf5e8e98c2ae4c8d1bc8829d2dc1163f972e09 YELLOW
PartitionControllerFactory.java 4344a25817d430e2e311354cf87b0753107f9e79 GREEN
PartitionModelFactory.java 3ef78670e39599c365f79c4c12926d1cdbb244dd GREEN
PartitionStructureFXEditor.java 7f3b68fcb866336bf55b7b3dbc0e504dea83ff49 GREEN
PartitionStructureFXEditorBinding.java 6456324614722b9c627d6d52e49e588ab51ca56a GREEN
PartitionVisualFactory.java f9bf5e8e98c2ae4c8d1bc8829d2dc1163f972e09 GREEN
......@@ -30,7 +30,7 @@ import org.fortiss.af3.partition.model.PartitionChannel;
import org.fortiss.af3.partition.model.PartitionPort;
import org.fortiss.tooling.base.ui.editor.fx.controller.EObjectDiagramController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedDiagramAnchorageController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLineLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController;
/**
......@@ -72,9 +72,9 @@ public final class PartitionControllerFactory implements IControllerFactory {
public IController createLinkController(ILinkMVCBundle modelBundle) {
Object linkObj = modelBundle.getModel();
if(linkObj instanceof PartitionChannel) {
return new LayoutedLinkBendPointController<>(modelBundle, PartitionChannel.class);
return new LayoutedLineLinkBendPointController<>(modelBundle, PartitionChannel.class);
} else if(linkObj instanceof MemoryAreaChannel) {
return new LayoutedLinkBendPointController<>(modelBundle, MemoryAreaChannel.class);
return new LayoutedLineLinkBendPointController<>(modelBundle, MemoryAreaChannel.class);
}
return null;
......
MemoryAreaVisual.java 395de12c220dc484aa295129081d420ca4b70748 YELLOW
PartitionPortVisual.java 147d1c0e3d77b467057b57d6685bd68c5821a6d6 YELLOW
PartitionVisual.java de703f92df6600826591fd9d1d7b6b307f652e40 YELLOW
MemoryAreaVisual.java 395de12c220dc484aa295129081d420ca4b70748 GREEN
PartitionPortVisual.java 147d1c0e3d77b467057b57d6685bd68c5821a6d6 GREEN
PartitionVisual.java de703f92df6600826591fd9d1d7b6b307f652e40 GREEN
PlatformArchitectureControllerFactory.java fc6ff1477620155baeefeabd3a5a72dd29083b43 YELLOW
PlatformArchitectureFXEditorBinding.java 9c3419eb7d878032840911feb79b2f78e958ec6a YELLOW
PlatformComponentControllerFactory.java 3eed2d301cbf21b6e558ba184e483f7fa77f2d2e YELLOW
PlatformArchitectureControllerFactory.java fc6ff1477620155baeefeabd3a5a72dd29083b43 GREEN
PlatformArchitectureFXEditorBinding.java 9c3419eb7d878032840911feb79b2f78e958ec6a GREEN
PlatformComponentControllerFactory.java c353602118a17bdb9e78ad3d97ed9dbca5297a7f GREEN
PlatformComponentFXEditor.java 579bda140d6d490e40c49386957bf63af345f373 GREEN
PlatformComponentFXEditorBinding.java 2898d366f4fbbe7f6f974ac312f6c160cda714b2 YELLOW
PlatformComponentModelFactory.java 2075ee98896f6d26c3bf24045ccc8b3eb8f0d6aa YELLOW
PlatformComponentVisualFactory.java e0a773856f7d037ff0f21234ed1884a49c1161c4 YELLOW
PlatformComponentFXEditorBinding.java 2898d366f4fbbe7f6f974ac312f6c160cda714b2 GREEN
PlatformComponentModelFactory.java 2075ee98896f6d26c3bf24045ccc8b3eb8f0d6aa GREEN
PlatformComponentVisualFactory.java e0a773856f7d037ff0f21234ed1884a49c1161c4 GREEN
......@@ -29,7 +29,7 @@ import org.fortiss.af3.platform.model.TransmissionConnection;
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;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLineLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController;
/**
......@@ -61,7 +61,7 @@ public class PlatformComponentControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedLinkBendPointController<>(modelBundle, TransmissionConnection.class);
return new LayoutedLineLinkBendPointController<>(modelBundle, TransmissionConnection.class);
}
/** {@inheritDoc} */
......
DirectedPlatformConnectorContentVisual.java 4212cd4583fa7cf2ba8c61ff94843e7f0522f34d YELLOW
DirectedPlatformConnectorDiagramVisual.java b752a6fc089fb0457409a16f8446349b32131c43 YELLOW
PlatformClusterVisual.java 119c9931b1674451e99ab5a3df090369de3ac629 YELLOW
PlatformExecutionUnitVisual.java 6ca5f83416416e2e4576689199f9ed8375fb2118 YELLOW
PlatformGatewayUnitVisual.java 7b22801b13863f972ab46eb4cd87853801ac7ce8 YELLOW
PlatformMemoryUnitVisual.java 12ced545e8aadcc4a413ad8f939b3528bcc1422a YELLOW
PlatformTransmissionUnitVisual.java b2dee9a83c2bf9bbf082c042d3a712a91ed3feb6 YELLOW
DirectedPlatformConnectorContentVisual.java 4212cd4583fa7cf2ba8c61ff94843e7f0522f34d GREEN
DirectedPlatformConnectorDiagramVisual.java b752a6fc089fb0457409a16f8446349b32131c43 GREEN
PlatformClusterVisual.java 119c9931b1674451e99ab5a3df090369de3ac629 GREEN
PlatformExecutionUnitVisual.java 6ca5f83416416e2e4576689199f9ed8375fb2118 GREEN
PlatformGatewayUnitVisual.java 7b22801b13863f972ab46eb4cd87853801ac7ce8 GREEN
PlatformMemoryUnitVisual.java 12ced545e8aadcc4a413ad8f939b3528bcc1422a GREEN
PlatformTransmissionUnitVisual.java b2dee9a83c2bf9bbf082c042d3a712a91ed3feb6 GREEN
PlatformArchitectureFXEditor.java b82ff79834fec792ad19a89ee594a9473e51f253 GREEN
PlatformArchitectureFXEditorBinding.java 54a5f10f5f6526a3ae3d418979bd8703226c4c7a YELLOW
PlatformControllerFactory.java 17e79987631044efc78cea8e64e0edb1c0f50d93 YELLOW
PlatformModelFactory.java 45e11ea2eb8b8b6a69a1548f1dc8847e45d5a5fa YELLOW
PlatformVisualFactory.java 99853f446d5d94a0cfee2a9b95590626566caf3c YELLOW
PlatformArchitectureFXEditorBinding.java 54a5f10f5f6526a3ae3d418979bd8703226c4c7a GREEN
PlatformControllerFactory.java 4532d4e47238dc20caa31477991404869d1665dd GREEN
PlatformModelFactory.java 45e11ea2eb8b8b6a69a1548f1dc8847e45d5a5fa GREEN
PlatformVisualFactory.java 99853f446d5d94a0cfee2a9b95590626566caf3c GREEN
......@@ -31,7 +31,7 @@ import org.fortiss.af3.platform.model.generic.GenericTransmissionUnit;
import org.fortiss.af3.platform.model.generic.GenericTransmitter;
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.LayoutedLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLineLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController;
/**
......@@ -78,7 +78,7 @@ public class PlatformControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedLinkBendPointController<>(modelBundle, TransmissionConnection.class);
return new LayoutedLineLinkBendPointController<>(modelBundle, TransmissionConnection.class);
}
/** {@inheritDoc} */
......
GenericExecutionUnitVisual.java ce39732a97b73d66f8d3258c7e8b7844d3c15597 YELLOW
GenericReceiverVisual.java 95c07c670aae89dd1ac6d459a81c4e5912825b58 YELLOW
GenericTransceiverVisual.java e0e4760776567abba6f10f3b72c9db41414f73dc YELLOW
GenericTransmissionUnitVisual.java 8cf5f7ccd17f317c20a9a8ccb12165d0ab1a5946 YELLOW
GenericTransmitterVisual.java 39285f3f297c0b62b63245394df91b844807a201 YELLOW
TransmissionConnectionVisual.java 20241cf824eef41b73e38238f10379a21aed6a24 YELLOW
GenericExecutionUnitVisual.java ce39732a97b73d66f8d3258c7e8b7844d3c15597 GREEN
GenericReceiverVisual.java 95c07c670aae89dd1ac6d459a81c4e5912825b58 GREEN
GenericTransceiverVisual.java e0e4760776567abba6f10f3b72c9db41414f73dc GREEN
GenericTransmissionUnitVisual.java 8cf5f7ccd17f317c20a9a8ccb12165d0ab1a5946 GREEN
GenericTransmitterVisual.java 39285f3f297c0b62b63245394df91b844807a201 GREEN
TransmissionConnectionVisual.java 20241cf824eef41b73e38238f10379a21aed6a24 GREEN
......@@ -70,6 +70,18 @@
modelElementClass="org.fortiss.af3.state.model.StateAutomaton">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.state.ui.editor.fx.StateAutomatonFXEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.state.model.StateAutomaton">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.state.ui.editor.fx.StateFXEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.state.model.State">
</modelElementClass>
</modelEditorBinding>
</extension>
<extension
......@@ -158,4 +170,13 @@
contributor="org.fortiss.af3.state.ui.editor.StateAutomatonEditorBase$NewMenu">
</contextMenuContribution>
</extension>
<extension
point="org.fortiss.tooling.kernel.migrationProvider">
<migrationProvider
migrationProvider="org.fortiss.af3.state.ui.migration.BezierCurveMigrator">
<objectClass
objectClass="org.fortiss.af3.state.model.StateAutomaton">
</objectClass>
</migrationProvider>
</extension>
</plugin>
StateAutomatonControllerFactory.java 03d624ad560508280c01898da29eac0450bbb237 GREEN
StateAutomatonFXEditor.java eea88e496c873ec92f6b2a0735cbd3d542a3063f GREEN
StateAutomatonFXEditorBase.java 788601b7fa8ba9bb9ca0b5d946d78ec4db220fbe GREEN
StateAutomatonFXEditorBinding.java 5fae7a8e04236c07d176a2b1ed22f7043e3a09fe GREEN
StateAutomatonFXEditorBindingBase.java 840654754a8ba240762cd8ebf7d4ed5b94450a87 GREEN
StateAutomatonModelFactory.java 07989fa95608fc8ce25e977cba898cf94932e0ae GREEN
StateAutomatonVisualFactory.java c6a118c966f2ac5692a3077b168501ba12267cf9 GREEN
StateFXEditor.java 88e2e7b328650f045c9465b314c30b271edebda3 GREEN
StateFXEditorBinding.java 999bb18112d5ffe35642b475e2cc7d231b822d02 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2020 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.state.ui.editor.fx;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IControllerFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.af3.state.model.State;
import org.fortiss.af3.state.model.StateAutomaton;
import org.fortiss.af3.state.model.TransitionSegment;
import org.fortiss.af3.state.model.TransitionSegmentConnector;
import org.fortiss.tooling.base.ui.editor.fx.controller.CurvedLinkLayoutedContentAnchorangeController;
import org.fortiss.tooling.base.ui.editor.fx.controller.EObjectDiagramController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedCurveLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedDiagramAnchorageController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedEllipticResizableContentController;
/**
* The implementation of the {@link IControllerFactory} for a {@link StateAutomaton}.
*
* @author munaro
*/
public class StateAutomatonControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentController(IContentMVCBundle model) {
return new LayoutedEllipticResizableContentController<State>(model, State.class);
}
/** {@inheritDoc} */
@Override
public IController createDiagramAnchorageController(IDiagramAnchorageMVCBundle modelBundle) {
return new LayoutedDiagramAnchorageController<TransitionSegmentConnector>(modelBundle,
TransitionSegmentConnector.class);
}
/** {@inheritDoc} */
@Override
public IController createContentAnchorageController(IContentAnchorageMVCBundle modelBundle) {
return new CurvedLinkLayoutedContentAnchorangeController<TransitionSegmentConnector>(
modelBundle, TransitionSegmentConnector.class);
}
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedCurveLinkBendPointController<>(modelBundle, TransitionSegment.class);
}
/** {@inheritDoc} */
@Override
public IController createDiagramController(IDiagramMVCBundle diagramBundle) {
return new EObjectDiagramController<>(diagramBundle, State.class);
}
}
/*-------------------------------------------------------------------------+
| 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.state.ui.editor.fx;
import org.fortiss.af3.state.model.StateAutomaton;
/**
* LWFXEF editor for {@link StateAutomaton}s.
*
* @author hoelzl
*/
public final class StateAutomatonFXEditor extends StateAutomatonFXEditorBase<StateAutomaton> {
// nothing to do here
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.state.ui.editor.fx;
import static javafx.scene.paint.Color.LIGHTGRAY;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures.IndicatorType;
import org.fortiss.af3.state.model.State;
import org.fortiss.af3.state.model.TransitionSegmentEntryConnector;
import org.fortiss.af3.state.model.TransitionSegmentExitConnector;
import org.fortiss.tooling.kernel.ui.extension.base.LWFXEFEditorBase;
/**
* Graphical editor for state automata based on JavaFX.
*
* @author hoelzl
*/
public abstract class StateAutomatonFXEditorBase<T extends EObject> extends LWFXEFEditorBase<T> {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public Class<? extends EObject>[] getVisibleEObjectTypes() {
return new Class[] {State.class, TransitionSegmentEntryConnector.class,
TransitionSegmentExitConnector.class};
}
/** {@inheritDoc} */
@Override
protected void customizeViewer() {
DiagramViewerFeatures features = viewer.getFeatures();
features.setIndicatorType(IndicatorType.INVISIBLE);
features.setUseSnapToGrid(false);
features.setBackgroundColor(LIGHTGRAY.brighter());
}
}
/*-------------------------------------------------------------------------+
| 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.state.ui.editor.fx;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.state.model.StateAutomaton;
/**
* Binding for the editor for {@link StateAutomaton} instances.
*
* @author hoelzl
*/
public final class StateAutomatonFXEditorBinding
extends StateAutomatonFXEditorBindingBase<StateAutomaton> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return StateAutomatonFXEditor.class;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 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.state.ui.editor.fx;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IControllerFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisualFactory;
import org.fortiss.af3.state.model.State;
import org.fortiss.af3.state.model.StateAutomaton;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
/**
* Base class for editor bindings related to {@link StateAutomaton} instances and their
* {@link State}s.
*
* @author munaro
*/
public abstract class StateAutomatonFXEditorBindingBase<T extends EObject>
extends ModelEditorBindingBase<T> {
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return StateAutomatonModelFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IVisualFactory> getVisualFactory() {
return StateAutomatonVisualFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IControllerFactory> getControllerFactory() {
return StateAutomatonControllerFactory.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "State Automaton (FX)";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return 100;
}
}
/*-------------------------------------------------------------------------+
| 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 |