Commit 090e5e91 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Merge remote-tracking branch 'origin/master' into 3883

parents 69332305 c7a426a6
......@@ -14,6 +14,9 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: fortiss GmbH
Export-Package: org.fortiss.af3.platform.ui,
org.fortiss.af3.platform.ui.editor,
org.fortiss.af3.platform.ui.editor.fx,
org.fortiss.af3.platform.ui.editor.fx.controller,
org.fortiss.af3.platform.ui.editor.fx.visual,
org.fortiss.af3.platform.ui.editpart,
org.fortiss.af3.platform.ui.editpart.generic,
org.fortiss.af3.platform.ui.editpart.generic.figure,
......@@ -21,5 +24,6 @@ Export-Package: org.fortiss.af3.platform.ui,
org.fortiss.af3.platform.ui.generator,
org.fortiss.af3.platform.ui.handler,
org.fortiss.af3.platform.ui.handler.generic,
org.fortiss.af3.platform.ui.menu,
org.fortiss.af3.platform.ui.properties,
org.fortiss.af3.platform.ui.prototypes
......@@ -46,6 +46,9 @@
<modelEditorBinding binding="org.fortiss.af3.platform.ui.editor.PlatformArchitectureEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.model.PlatformArchitecture"/>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.ui.editor.fx.PlatformArchitectureFXEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.model.PlatformArchitecture"/>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.ui.editor.ComponentToExecutionUnitTableEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable"/>
</modelEditorBinding>
......@@ -58,6 +61,7 @@
<modelEditorBinding binding="org.fortiss.af3.platform.ui.editor.OutputPortToTransmitterTableEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable"/>
</modelEditorBinding>
</extension>
<extension point="org.fortiss.tooling.kernel.ui.editPartFactory">
......
ControllerFactory.java d8e4cbbe87ef0fd48aa69c07149e11c7d797ef8c GREEN
ModelFactory.java e6da34b65eb552fb146cee9cce04f6c02361bf72 GREEN
PlatformArchitectureFXEditor.java ac4a1033ad9682c664c82182cb6fbf09d5646f5d GREEN
PlatformArchitectureFXEditorBinding.java ea41c84736bee613f92c4a05b571a7838c4445d5 GREEN
VisualFactory.java f2764a48b36e55a4ae374ea23cffa46b2d4ba505 GREEN
/*-------------------------------------------------------------------------+
| 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.platform.ui.editor.fx;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IController;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IControllerFactory;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
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.platform.ui.editor.fx.controller.DiagramController;
import org.fortiss.af3.platform.ui.editor.fx.controller.GenericConnectionController;
import org.fortiss.af3.platform.ui.editor.fx.controller.GenericConnectorController;
import org.fortiss.af3.platform.ui.editor.fx.controller.GenericUnitController;
/**
* The implementation of the {@link IControllerFactory} for the platform architecture editor.
*
* @author ponce
*/
public class ControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentController(IContentMVCBundle model) {
return new GenericUnitController(model);
}
/** {@inheritDoc} */
@Override
public IController createDiagramAnchorageController(IDiagramAnchorageMVCBundle modelBundle) {
return null;
}
/** {@inheritDoc} */
@Override
public IController createContentAnchorageController(IContentAnchorageMVCBundle modelBundle) {
return new GenericConnectorController(modelBundle);
}
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new GenericConnectionController(modelBundle);
}
/** {@inheritDoc} */
@Override
public IController createDiagramController(IDiagramMVCBundle diagramBundle) {
return new DiagramController(diagramBundle);
}
}
/*-------------------------------------------------------------------------+
| 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.platform.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.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.IModelFactory;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.TransmissionConnection;
import org.fortiss.af3.platform.model.generic.GenericExecutionUnit;
import org.fortiss.af3.platform.model.generic.GenericTransmissionUnit;
import org.fortiss.tooling.base.model.element.IConnection;
/**
* The implementation of the {@link IModelFactory} for the platform architecture editor.
*
* @author ponce
*/
public class ModelFactory implements IModelFactory {
/** The currently edited platform architecture. */
private final PlatformArchitecture rootElement;
/** Constructor. */
public ModelFactory(PlatformArchitecture root) {
this.rootElement = requireNonNull(root);
}
/** {@inheritDoc} */
@Override
public Object getRootModel() {
return rootElement;
}
/** {@inheritDoc} */
@Override
public List<?> getContentModels() {
return rootElement.getContainedElements();
}
/** {@inheritDoc} */
@Override
public List<?> getDiagramAnchorageModels() {
return emptyList();
}
/** {@inheritDoc} */
@Override
public List<?> getContentAnchorageModels(Object parent) {
if(parent instanceof GenericExecutionUnit) {
return ((GenericExecutionUnit)parent).getConnectors();
}
if(parent instanceof GenericTransmissionUnit) {
return ((GenericTransmissionUnit)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 TransmissionConnection) {
return ((TransmissionConnection)link).getSource();
}
return null;
}
/** {@inheritDoc} */
@Override
public Object getLinkEnd(Object link) {
if(link instanceof TransmissionConnection) {
return ((TransmissionConnection)link).getTarget();
}
return null;
}
/** {@inheritDoc} */
@Override
public Object getParent(Object element) {
return null;
}
/** {@inheritDoc} */
@Override
public void update() {
// Nothing to do
}
}
/*-------------------------------------------------------------------------+
| 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.platform.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.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.tooling.kernel.ui.extension.base.LWFXEFEditorBase;
/**
* Graphical editor for platform architectures based on JavaFX.
*
* @author ponce
*/
public class PlatformArchitectureFXEditor extends LWFXEFEditorBase<PlatformArchitecture> {
/** {@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();
}
}
/*-------------------------------------------------------------------------+
| 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.platform.ui.editor.fx;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
/**
* Editor binding for the JavaFX-based platform architecture editor.
*
* @author ponce
*/
public class PlatformArchitectureFXEditorBinding
extends ModelEditorBindingBase<PlatformArchitecture> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return PlatformArchitectureFXEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "Platform Architecture (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 |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.ui.editor.fx;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IContentAnchorageVisual;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IContentVisual;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IDiagramAnchorageVisual;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.ILinkVisual;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IVisualFactory;
import org.fortiss.af3.platform.model.TransmissionConnection;
import org.fortiss.af3.platform.model.generic.GenericExecutionUnit;
import org.fortiss.af3.platform.model.generic.GenericReceiver;
import org.fortiss.af3.platform.model.generic.GenericTransceiver;
import org.fortiss.af3.platform.model.generic.GenericTransmissionUnit;
import org.fortiss.af3.platform.model.generic.GenericTransmitter;
import org.fortiss.af3.platform.ui.editor.fx.visual.GenericConnectionVisual;
import org.fortiss.af3.platform.ui.editor.fx.visual.GenericExecutionUnitVisual;
import org.fortiss.af3.platform.ui.editor.fx.visual.GenericReceiverVisual;
import org.fortiss.af3.platform.ui.editor.fx.visual.GenericTransceiverVisual;
import org.fortiss.af3.platform.ui.editor.fx.visual.GenericTransmissionUnitVisual;
import org.fortiss.af3.platform.ui.editor.fx.visual.GenericTransmitterVisual;
/**
* The implementation of the {@link IVisualFactory} for the platform architecture editor.
*
* @author ponce
*/
public class VisualFactory implements IVisualFactory {
/** {@inheritDoc} */
@Override
public IContentVisual createContentVisual(IContentMVCBundle modelBundle) {
Object modelObj = modelBundle.getModel();
if(modelObj instanceof GenericExecutionUnit) {
return new GenericExecutionUnitVisual(modelBundle);
}
if(modelObj instanceof GenericTransmissionUnit) {
return new GenericTransmissionUnitVisual(modelBundle);
}
return null;
}
/** {@inheritDoc} */
@Override
public IDiagramAnchorageVisual
createDiagramAnchorageVisual(IDiagramAnchorageMVCBundle modelBundle) {
return null;
}
/** {@inheritDoc} */
@Override
public IContentAnchorageVisual
createContentAnchorageVisual(IContentAnchorageMVCBundle modelBundle) {
Object modelObj = modelBundle.getModel();
if(modelObj instanceof GenericTransmitter) {
return new GenericTransmitterVisual(modelBundle);
}
if(modelObj instanceof GenericTransceiver) {
return new GenericTransceiverVisual(modelBundle);
}
if(modelObj instanceof GenericReceiver) {
return new GenericReceiverVisual(modelBundle);
}
return null;
}
/** {@inheritDoc} */
@Override
public ILinkVisual createLinkVisual(ILinkMVCBundle modelBundle) {
Object modelObj = modelBundle.getModel();
if(modelObj instanceof TransmissionConnection) {
return new GenericConnectionVisual(modelBundle);
}
return null;
}
}
DiagramController.java 2d2a546cd1bac9d556fdbe156228983faf8218fd GREEN
GenericConnectionController.java f2bc1babff90fa730d594b7b7d18d90920731e06 GREEN
GenericConnectorController.java e6d50b3177381c56ac2a7e131cfc15b5510b30a1 GREEN
GenericUnitController.java 1db566fc925051264970183427d23bf18f06f581 GREEN
/*-------------------------------------------------------------------------+
| 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.platform.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 ponce
*/
public class DiagramController extends EObjectBasedDiagramControllerBase {
/** Constructor. */
public DiagramController(IMVCBundle mvcb) {
super(mvcb);
}
}
/*-------------------------------------------------------------------------+
| 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.platform.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.ILinkMVCBundle;
import org.fortiss.af3.platform.model.TransmissionConnection;
import org.fortiss.tooling.base.ui.editor.fx.LayoutedModelElementBasedLinkBendPointController;
/**
* {@link IController} for {@link TransmissionConnection}s.
*
* @author ponce
*/
public class GenericConnectionController extends LayoutedModelElementBasedLinkBendPointController {
/** Constructor. */
public GenericConnectionController(ILinkMVCBundle mvcb) {
super(mvcb);
Object model = mvcb.getModel();
if(!(model instanceof TransmissionConnection)) {
throw new IllegalArgumentException(
"Expected model of type TransmissionConnection, but was " +
model.getClass().getSimpleName());
}
}
}
/*-------------------------------------------------------------------------+
| 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.platform.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.IContentAnchorageMVCBundle;
import org.fortiss.af3.platform.model.generic.GenericExecutionUnit;
import org.fortiss.af3.platform.model.generic.GenericReceiver;
import org.fortiss.af3.platform.model.generic.GenericTransceiver;
import org.fortiss.af3.platform.model.generic.GenericTransmissionUnit;
import org.fortiss.af3.platform.model.generic.GenericTransmitter;
import org.fortiss.tooling.base.ui.editor.fx.LayoutedModelElementBasedContentAnchorageController;
/**
* {@link IController} for connectors on {@link GenericExecutionUnit}s and
* {@link GenericTransmissionUnit}s.
*
* @author ponce
*/
public class GenericConnectorController
extends LayoutedModelElementBasedContentAnchorageController {
/** Constructor. */
public GenericConnectorController(IContentAnchorageMVCBundle mvcb) {
super(mvcb);
Object model = mvcb.getModel();
if(!(model instanceof GenericReceiver || model instanceof GenericTransmitter ||
model instanceof GenericTransceiver)) {
throw new IllegalArgumentException(
"Expected model of type GenericReceiver, GenericTransmitter or GenericTransceiver, but was " +
model.getClass().getSimpleName());
}
}
}
/*-------------------------------------------------------------------------+
| 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.platform.ui.editor.fx.controller;
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;