Commit 276d2e4f authored by Simon Barner's avatar Simon Barner
Browse files

Move PortCompositorBase to tooling.base (as ConnectorCompositorBase)

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

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 4d491196
ComponentToPartitionAllocationTableCollectionCompositor.java 9898197cab2b19dc6cfdc4d145507e99e2a3df06 GREEN
MemoryAreaAllocationTableCompositor.java 22e95b2ed2b5f7d29559eb49327a25f6f507a27a GREEN
MemoryAreaConnectionCompositor.java 8889c5571b59cb46fd47b9176fb89b3feaa6312b GREEN
MemoryAreaPortCompositor.java bf86b3479ed6d582888cf9c8cd503fe9dec3d7e9 GREEN
MemoryAreaPortCompositor.java b42181178c62365d6d42d9a9b4a467b66201bb55 YELLOW
PartitionArchitectureCompositor.java 131fff07f8678d712fc35dc41832c5eb64aac6fb GREEN
PartitionArchitectureFileProjectCompositor.java e3b4479fabbb7eba3cb269bede656c921d4a0f8a GREEN
PartitionConnectionCompositor.java 49f3f3e4423d67db1adf3997750fd6cd868529cb GREEN
PartitionPortCompositor.java 574d1bb9d9733f23830437ac56cd19b1d36dc7e7 GREEN
PartitionPortCompositor.java 57dccb06b1f1b58617bab6f7d57dd9438b02a510 YELLOW
PartitionToExecutionUnitAllocationTableCollectionCompositor.java 3a2e468c847c91859ef19b88119c09e2b344c908 GREEN
PortCompositorBase.java 877b2b6dac018f3068e0ea7db49e5ef31c178c2e RED
TaskToPartitionAllocationTableCollectionCompositor.java 098939da5b43572e89c4fcfc20fac94eb4b59616 GREEN
......@@ -18,13 +18,14 @@ package org.fortiss.af3.partition.compositor;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.partition.model.MemoryArea;
import org.fortiss.af3.partition.model.MemoryAreaInputPort;
import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
/**
* Compositor class for {@link MemoryArea}s.
*
* @author barner
*/
public class MemoryAreaPortCompositor extends PortCompositorBase<MemoryArea> {
public class MemoryAreaPortCompositor extends ConnectorCompositorBase<MemoryArea> {
/** {@inheritDoc} */
@Override
......
......@@ -19,13 +19,14 @@ import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.partition.model.MemoryAreaInputPort;
import org.fortiss.af3.partition.model.Partition;
import org.fortiss.af3.partition.model.PartitionPort;
import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
/**
* Compositor class for {@link Partition}s.
*
* @author barner
*/
public class PartitionPortCompositor extends PortCompositorBase<Partition> {
public class PartitionPortCompositor extends ConnectorCompositorBase<Partition> {
/** {@inheritDoc} */
@Override
......
/*-------------------------------------------------------------------------+
| Copyright 2017 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.partition.compositor;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.partition.model.PartitionPort;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* Compositor base class for {@link PartitionPort}s.
*
* @author zverlov
*/
// TODO(AD): Move to kernel.base.
public abstract class PortCompositorBase<T extends IHierarchicElement & ILayoutedModelElement>
extends HierarchicElementCompositorBase<T> {
/** {@inheritDoc} */
@Override
public boolean canCompose(T container, EObject contained, IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** {@inheritDoc} */
@Override
public boolean compose(T container, EObject contained, IElementCompositionContext context) {
super.compose(container, contained, context);
if(isCorrectElementClass(contained)) {
PartitionPort pPort = (PartitionPort)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
Point ctxPosition = ctx.getPosition();
if(((ElementDropContext)context).isRootFigureCanvas()) {
ctxPosition.translate(ctx.getViewLocationZoomed());
}
layoutConnectorInRectangle(pPort, container, ctxPosition);
}
container.getConnectors().add(pPort);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return isCorrectElementClass(contained);
}
/** Returns whether the given element is of an acceptable class. */
protected abstract boolean isCorrectElementClass(EObject element);
}
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