Commit 49ffcec0 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

JFX Platform editor: Extend use of generic controllers

Issue-Ref: 3883
Issue-Url: https://af3-developer.fortiss.org/issues/3883

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 6bf4c995
ControllerFactory.java cde934400d374918e92d284a962b39577018d7ea YELLOW
GenericConnectorController.java e74ecc9cd7215c58200e804562991659862924d0 YELLOW
ControllerFactory.java d3986a1a6f78a91e4f1da37152a5155da6df06b9 YELLOW
ModelFactory.java e6da34b65eb552fb146cee9cce04f6c02361bf72 GREEN
PlatformArchitectureFXEditor.java ac4a1033ad9682c664c82182cb6fbf09d5646f5d GREEN
PlatformArchitectureFXEditorBinding.java ea41c84736bee613f92c4a05b571a7838c4445d5 GREEN
......
......@@ -22,10 +22,14 @@ 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.platform.model.IPlatformArchitectureElement;
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.GenericReceiver;
import org.fortiss.af3.platform.model.generic.GenericTransceiver;
import org.fortiss.af3.platform.model.generic.GenericTransmissionUnit;
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.LayoutedRectangularResizableContentController;
......@@ -38,9 +42,16 @@ public class ControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentController(IContentMVCBundle model) {
return new LayoutedRectangularResizableContentController<>(model,
GenericExecutionUnit.class);
public IController createContentController(IContentMVCBundle modelBundle) {
Object model = modelBundle.getModel();
if(model instanceof GenericExecutionUnit) {
return new LayoutedRectangularResizableContentController<>(modelBundle,
GenericExecutionUnit.class);
} else if(model instanceof GenericTransmissionUnit) {
return new LayoutedRectangularResizableContentController<>(modelBundle,
GenericTransmissionUnit.class);
}
return null;
}
/** {@inheritDoc} */
......@@ -52,7 +63,15 @@ public class ControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentAnchorageController(IContentAnchorageMVCBundle modelBundle) {
return new GenericConnectorController(modelBundle);
Object model = modelBundle.getModel();
if(model instanceof GenericReceiver) {
return new LayoutedContentAnchorageController<>(modelBundle, GenericReceiver.class);
} else if(model instanceof GenericTransceiver) {
return new LayoutedContentAnchorageController<>(modelBundle, GenericTransceiver.class);
} else if(model instanceof GenericTransceiver) {
return new LayoutedContentAnchorageController<>(modelBundle, GenericTransceiver.class);
}
return null;
}
/** {@inheritDoc} */
......@@ -64,6 +83,6 @@ public class ControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createDiagramController(IDiagramMVCBundle diagramBundle) {
return new EObjectDiagramController<>(diagramBundle, IPlatformArchitectureElement.class);
return new EObjectDiagramController<>(diagramBundle, PlatformArchitecture.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.platform.ui.editor.fx;
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.PlatformConnectorUnit;
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.controller.LayoutedContentAnchorageController;
/**
* {@link IController} for connectors on {@link GenericExecutionUnit}s and
* {@link GenericTransmissionUnit}s.
*
* @author ponce
*/
public class GenericConnectorController
extends LayoutedContentAnchorageController<PlatformConnectorUnit> {
/** Constructor. */
public GenericConnectorController(IContentAnchorageMVCBundle mvcb) {
super(mvcb, PlatformConnectorUnit.class);
Object model = mvcb.getModel();
if(!(model instanceof GenericReceiver || model instanceof GenericTransmitter ||
model instanceof GenericTransceiver)) {
throw new IllegalArgumentException(
"Expected model of type " + GenericReceiver.class.getSimpleName() + ", " +
GenericTransmitter.class.getSimpleName() + " or " +
GenericTransceiver.class.getSimpleName() + ", but was " +
model.getClass().getSimpleName());
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment