Commit 8a54633e authored by Alexander Diewald's avatar Alexander Diewald
Browse files

JFX diagram editors: Adjust factories for delegation mechanism

See kernel commit e3901471e736a156e2928c89e16c176a8719f224

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

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 49ffcec0
ComponentStructureFXEditor.java d097c17a4ebc5bc2a87659544d3dd15f2afde254 GREEN
ComponentStructureFXEditorBinding.java 230337d9526109ee2a9df599c370b0b3f2ec0b40 GREEN
ControllerFactory.java 1e674544cd5bec3ebc883710ab50bfa87a072870 YELLOW
ModelFactory.java d97242e6b8c69ccaad9fbb6adf80ffdb40520f80 GREEN
ComponentControllerFactory.java debf3bb80cb56197d4dd0c84f38e466f99da9a34 YELLOW
ComponentModelFactory.java 7e58831949f50a9887bcbf31959f887a87f703cb YELLOW
ComponentStructureFXEditor.java d662863a84c9e3f24e46de19dad1d750a1462cd3 YELLOW
ComponentStructureFXEditorBinding.java 370fe5c458f15bd8299364f858250d5c2bda6729 YELLOW
ComponentVisualFactory.java 555cd71b98895e4d0c1146a5393bf3848f5fa43d YELLOW
SubComponentController.java e7361eb33367c160f9a7502721bca13f1ee85128 YELLOW
VisualFactory.java 94d24732b7b3c737ccfdfcb7d981d2edeadd8527 YELLOW
......@@ -36,7 +36,7 @@ import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLinkBendPointCon
* @author hoelzl
* @author diewald
*/
final class ControllerFactory implements IControllerFactory {
public final class ComponentControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentController(IContentMVCBundle model) {
......
......@@ -31,12 +31,12 @@ import org.fortiss.tooling.base.model.element.IConnection;
*
* @author hoelzl
*/
final class ModelFactory implements IModelFactory {
public final class ComponentModelFactory implements IModelFactory {
/** The currently edited component. */
private final Component rootElement;
/** Constructor. */
public ModelFactory(Component root) {
public ComponentModelFactory(Component root) {
this.rootElement = requireNonNull(root);
}
......
......@@ -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();
}
}
......@@ -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() {
......
......@@ -38,7 +38,7 @@ import org.fortiss.tooling.base.ui.editor.fx.visual.LayoutedLineLinkVisual;
* @author hoelzl
* @author diewald
*/
final class VisualFactory implements IVisualFactory {
public final class ComponentVisualFactory implements IVisualFactory {
/** {@inheritDoc} */
@Override
public IContentVisual createContentVisual(IContentMVCBundle modelBundle) {
......
......@@ -71,13 +71,13 @@
<modelElementClass
modelElementClass="org.fortiss.af3.platform.model.PlatformArchitecture"></modelElementClass>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.fx.HierarchicPlatformFXEditorBinding">
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.fx.PlatformComponentFXEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.hierarchic.model.cluster.Cluster"/>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.fx.HierarchicPlatformFXEditorBinding">
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.fx.PlatformComponentFXEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.hierarchic.model.node.Node"/>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.fx.HierarchicPlatformFXEditorBinding">
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.fx.PlatformComponentFXEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.hierarchic.model.tile.Tile"/>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.hierarchic.ui.editor.ClusterStructureEditorBinding">
......
......@@ -2,7 +2,7 @@
bin.includes = .,\
META-INF/,\
plugin.xml, \
src/org/fortiss/af3/component/ui/editpart/plugin.xml,\
icons/
source.. = src/
output.. = build/
HierarchicPlatformFXEditorBinding.java 0270918548bb3f616699d5755f1ca8de98b69402 YELLOW
PlatformArchitectureControllerFactory.java c49e4fb96ca1cbb796163cf0dcd6da97b650c13b YELLOW
PlatformArchitectureFXEditor.java f1146b069bd182be7e71b65b51c14d9936e37ed2 YELLOW
PlatformArchitectureFXEditor.java e5596e3c2f94bfc7a7461e22206fe97640ff6d2b YELLOW
PlatformArchitectureFXEditorBinding.java 5937356c5bffb7089a20392fe146cfe1159c3d84 YELLOW
PlatformComponentControllerFactory.java b9e09906c0d5428d507d3affd879f30d9ed7d697 YELLOW
PlatformComponentFXEditor.java 610ea3aa678a33a6e780b3c50a1dd432c1a05d33 YELLOW
PlatformComponentFXEditor.java 579bda140d6d490e40c49386957bf63af345f373 YELLOW
PlatformComponentFXEditorBinding.java 8f60633fa717afbb80e0f3b672a6de83042c85e1 RED
PlatformComponentModelFactory.java c834311e842c9e7638e70dac6d095ce0c7595637 YELLOW
PlatformComponentVisualFactory.java 716c16155a90740e7ed9e28100a2814dc151b46d YELLOW
PlatformElementModelFactory.java 89f1ed401dd43b78b8102cd4930cbb86d10df40b YELLOW
......@@ -15,9 +15,6 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.hierarchic.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.hierarchic.compose.HierarchicalCompositionRules;
import org.fortiss.af3.platform.hierarchic.compose.base.IArchitectureDomainDependant;
import org.fortiss.af3.platform.hierarchic.compose.base.IPlatformHierarchicalCompositionRules;
......@@ -40,24 +37,6 @@ final class PlatformArchitectureFXEditor extends LWFXEFEditorBase<PlatformArchit
return HierarchicalCompositionRules.INSTANCE;
}
/** {@inheritDoc} */
@Override
protected IModelFactory createModelFactory() {
return new PlatformElementModelFactory<>(getEditedObject());
}
/** {@inheritDoc} */
@Override
protected IVisualFactory createVisualFactory() {
return new PlatformComponentVisualFactory();
}
/** {@inheritDoc} */
@Override
protected IControllerFactory createControllerFactory() {
return new PlatformArchitectureControllerFactory();
}
/** {@inheritDoc} */
@Override
public Class<? extends IArchitectureDomain> getArchitectureDomain() {
......
/*-------------------------------------------------------------------------+
| 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.hierarchic.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.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.tooling.kernel.ui.extension.IModelEditorBinding;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
import com.google.common.reflect.TypeToken;
/**
* Generic {@link IModelEditorBinding} for the multiple layers of hierarchical
* {@link PlatformArchitecture}s.
*
* @author diewald
*/
public class PlatformArchitectureFXEditorBinding<T extends IPlatformArchitectureElement>
extends ModelEditorBindingBase<T> {
/** Token of the generic parameter defining the type of the edited element. */
TypeToken<T> token = new TypeToken<>(getClass()) { /**/
};
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return PlatformArchitectureFXEditor.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return PlatformComponentModelFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IVisualFactory> getVisualFactory() {
return PlatformComponentVisualFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IControllerFactory> getControllerFactory() {
return PlatformArchitectureControllerFactory.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return token.getRawType().getSimpleName() + " Structure (FX)";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return -100;
}
}
......@@ -22,16 +22,12 @@ import java.util.List;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
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.hierarchic.compose.HierarchicalCompositionRules;
import org.fortiss.af3.platform.hierarchic.compose.base.IArchitectureDomainDependant;
import org.fortiss.af3.platform.hierarchic.compose.base.IPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.model.IArchitectureDomain;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.utils.PlatformArchitectureUtils;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.IPrototypeService;
......@@ -114,22 +110,4 @@ public class PlatformComponentFXEditor<T extends IHierarchicElementContainer & I
public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() {
return HierarchicalCompositionRules.INSTANCE;
}
/** {@inheritDoc} */
@Override
protected IModelFactory createModelFactory() {
return new PlatformElementModelFactory<>((IHierarchicElement)getEditedObject());
}
/** {@inheritDoc} */
@Override
protected IVisualFactory createVisualFactory() {
return new PlatformComponentVisualFactory();
}
/** {@inheritDoc} */
@Override
protected IControllerFactory createControllerFactory() {
return new PlatformComponentControllerFactory();
}
}
......@@ -15,6 +15,9 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.hierarchic.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.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.PlatformArchitecture;
......@@ -29,7 +32,7 @@ import com.google.common.reflect.TypeToken;
*
* @author diewald
*/
public class HierarchicPlatformFXEditorBinding<T extends IPlatformArchitectureElement>
public class PlatformComponentFXEditorBinding<T extends IPlatformArchitectureElement>
extends ModelEditorBindingBase<T> {
/** Token of the generic parameter defining the type of the edited element. */
......@@ -44,6 +47,25 @@ public class HierarchicPlatformFXEditorBinding<T extends IPlatformArchitectureEl
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return PlatformComponentModelFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IVisualFactory> getVisualFactory() {
return PlatformComponentVisualFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IControllerFactory> getControllerFactory() {
return PlatformComponentControllerFactory.class;
}
/** {@inheritDoc} */
@Override
// TODO(AD): This does not correctly name the editor as of now...
public String getLabel() {
return token.getRawType().getSimpleName() + " Structure (FX)";
}
......
......@@ -30,18 +30,18 @@ import org.fortiss.af3.platform.model.MemoryUnit;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.TransmissionUnit;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.ui.editor.fx.factory.HierarchicElementModelFactoryBase;
import org.fortiss.tooling.base.ui.editor.fx.model.HierarchicElementModelFactoryBase;
/**
* {@link IModelFactory} for the elements of hierarchical {@link PlatformArchitecture}s.
*
* @author diewald
*/
public class PlatformElementModelFactory<T extends IHierarchicElement>
public class PlatformComponentModelFactory<T extends IHierarchicElement>
extends HierarchicElementModelFactoryBase<T> {
/** Constructor. */
public PlatformElementModelFactory(T root) {
public PlatformComponentModelFactory(T root) {
super(root);
}
......
ControllerFactory.java d3986a1a6f78a91e4f1da37152a5155da6df06b9 YELLOW
ModelFactory.java e6da34b65eb552fb146cee9cce04f6c02361bf72 GREEN
PlatformArchitectureFXEditor.java ac4a1033ad9682c664c82182cb6fbf09d5646f5d GREEN
PlatformArchitectureFXEditorBinding.java ea41c84736bee613f92c4a05b571a7838c4445d5 GREEN
VisualFactory.java 35bd0d4bdf576b5cdd3f993546bb8cbe5eb224f6 YELLOW
PlatformArchitectureFXEditor.java b82ff79834fec792ad19a89ee594a9473e51f253 YELLOW
PlatformArchitectureFXEditorBinding.java 83443520dbb4a213347849b6dddee2d019987fdb YELLOW
PlatformControllerFactory.java e18a2a49ef7f1a69a86f35ba0279216e6e902ba5 YELLOW
PlatformModelFactory.java edb928e305b44b1a65ab8b69a1163b20b00de6c9 YELLOW
PlatformVisualFactory.java 619b59ab8b262766c131f7fd9b10e5adfd8b55b4 YELLOW
......@@ -15,9 +15,6 @@
+--------------------------------------------------------------------------*/
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;
......@@ -27,22 +24,5 @@ import org.fortiss.tooling.kernel.ui.extension.base.LWFXEFEditorBase;
* @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();
}
// No impl needed. This class exists just for being referenced from a plugin.xml file.
}
......@@ -15,6 +15,9 @@
+--------------------------------------------------------------------------*/
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.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
......@@ -26,13 +29,31 @@ import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
*/
public class PlatformArchitectureFXEditorBinding
extends ModelEditorBindingBase<PlatformArchitecture> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return PlatformArchitectureFXEditor.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return PlatformModelFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IVisualFactory> getVisualFactory() {
return PlatformVisualFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IControllerFactory> getControllerFactory() {
return PlatformControllerFactory.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
......
......@@ -28,6 +28,7 @@ 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.EObjectDiagramController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedContentAnchorageController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLinkBendPointController;
......@@ -38,7 +39,7 @@ import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResiz
*
* @author ponce
*/
public class ControllerFactory implements IControllerFactory {
public class PlatformControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
......@@ -68,8 +69,8 @@ public class ControllerFactory implements IControllerFactory {
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);
} else if(model instanceof GenericTransmitter) {
return new LayoutedContentAnchorageController<>(modelBundle, GenericTransmitter.class);
}
return null;
}
......
......@@ -33,13 +33,13 @@ import org.fortiss.tooling.base.model.element.IConnection;
*
* @author ponce
*/
public class ModelFactory implements IModelFactory {
public class PlatformModelFactory implements IModelFactory {
/** The currently edited platform architecture. */
private final PlatformArchitecture rootElement;
/** Constructor. */
public ModelFactory(PlatformArchitecture root) {
public PlatformModelFactory(PlatformArchitecture root) {
this.rootElement = requireNonNull(root);
}
......
......@@ -42,7 +42,7 @@ import org.fortiss.af3.platform.ui.editor.fx.visual.GenericTransmitterVisual;
*
* @author ponce
*/
public class VisualFactory implements IVisualFactory {
public class PlatformVisualFactory implements IVisualFactory {
/** {@inheritDoc} */
@Override
......
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