Commit 041236b0 authored by Martin Eisenmann's avatar Martin Eisenmann
Browse files

YELLOW

Updated PropertySection and code-generation

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

Signed-off-by: Martin Eisenmann's avatarEisenmann <eisenmann@fortiss.org>
parent 835d1c90
......@@ -38,6 +38,21 @@
</modelElementClass>
</modelElementHandler>
</extension>
<extension point="org.fortiss.tooling.kernel.ui.modelEditorBinding">
<modelEditorBinding
binding="org.fortiss.af3.platform.raspberry.ui.editor.PlatformRaspberryPiArchitectureFXEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.platform.model.PlatformArchitecture"></modelElementClass>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.raspberry.ui.editor.PlatformRaspberryPiArchitectureFXEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.raspberry.model.RaspberryPi"/>
</modelEditorBinding>
<modelEditorBinding binding="org.fortiss.af3.platform.raspberry.ui.editor.PlatformRaspberryPiArchitectureFXEditorBinding">
<modelElementClass modelElementClass="org.fortiss.af3.platform.raspberry.model.CanBus"/>
</modelEditorBinding>
</extension>
<extension
point="org.fortiss.tooling.kernel.ui.editPartFactory">
<editPartFactory
......
PlatformRaspberryPiArchitectureFXEditorBinding.java 0ea5a5a11bbff57c6cc55676ed97ebb892e6e97a YELLOW
PlatformRaspberryPiControllerFactory.java 6f2bab5eeacfe749832bf5900b80a3b291d38786 YELLOW
PlatformRaspberryPiModelFactory.java bc6a14c7d7d7c44dc31717da9401efc7e905c182 YELLOW
PlatformRaspberryPiVisualFactory.java da6ef86989791215d9f7f3c57d3e1825b999af76 YELLOW
/*-------------------------------------------------------------------------+
| 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.raspberry.ui.editor;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.ui.editor.fx.PlatformArchitectureFXEditor;
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;
/**
* Editor binding for the JavaFX-based platform architecture editor.
*
* @author eisenmann
*/
public class PlatformRaspberryPiArchitectureFXEditorBinding
extends ModelEditorBindingBase<PlatformArchitecture> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return PlatformArchitectureFXEditor.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IModelFactory> getModelFactory() {
return PlatformRaspberryPiModelFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IVisualFactory> getVisualFactory() {
return PlatformRaspberryPiVisualFactory.class;
}
/** {@inheritDoc} */
@Override
public Class<? extends IControllerFactory> getControllerFactory() {
return PlatformRaspberryPiControllerFactory.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "Platform Architecture";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return 0;
}
}
/*-------------------------------------------------------------------------+
| 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.raspberry.ui.editor;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.TransmissionConnection;
import org.fortiss.af3.platform.raspberry.model.CanBus;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.raspberry.model.RaspberryPiReceiverBase;
import org.fortiss.af3.platform.raspberry.model.RaspberryPiTransmitterBase;
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.LayoutedLineLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController;
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;
/**
* The implementation of the {@link IControllerFactory} for the platform architecture editor.
*
* @author ponce
*/
public class PlatformRaspberryPiControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createContentController(IContentMVCBundle modelBundle) {
Object model = modelBundle.getModel();
if(model instanceof RaspberryPi) {
return new LayoutedRectangularResizableContentController<>(modelBundle,
RaspberryPi.class);
} else if(model instanceof CanBus) {
return new LayoutedRectangularResizableContentController<>(modelBundle, CanBus.class);
}
return null;
}
/** {@inheritDoc} */
@Override
public IController createDiagramAnchorageController(IDiagramAnchorageMVCBundle modelBundle) {
return null;
}
/** {@inheritDoc} */
@Override
public IController createContentAnchorageController(IContentAnchorageMVCBundle modelBundle) {
Object model = modelBundle.getModel();
if(model instanceof RaspberryPiReceiverBase) {
return new LayoutedContentAnchorageController<>(modelBundle,
RaspberryPiReceiverBase.class);
} else if(model instanceof RaspberryPiTransmitterBase) {
return new LayoutedContentAnchorageController<>(modelBundle,
RaspberryPiTransmitterBase.class);
}
return null;
}
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedLineLinkBendPointController<>(modelBundle, TransmissionConnection.class);
}
/** {@inheritDoc} */
@Override
public IController createDiagramController(IDiagramMVCBundle diagramBundle) {
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.raspberry.ui.editor;
import static java.util.Collections.emptyList;
import java.util.List;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.raspberry.model.CanBus;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.ui.editor.fx.PlatformModelFactory;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelFactory;
/**
* The implementation of the {@link IModelFactory} for the RaspberryPi platform architecture editor.
*
* @author ponce
*/
public class PlatformRaspberryPiModelFactory extends PlatformModelFactory {
/** Constructor. */
public PlatformRaspberryPiModelFactory(PlatformArchitecture root) {
super(root);
}
/** {@inheritDoc} */
@Override
public List<?> getContentAnchorageModels(Object parent) {
if(parent instanceof RaspberryPi) {
return ((RaspberryPi)parent).getConnectors();
}
if(parent instanceof CanBus) {
return ((CanBus)parent).getConnectors();
}
return emptyList();
}
}
/*-------------------------------------------------------------------------+
| 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.raspberry.ui.editor;
import org.fortiss.af3.platform.model.TransmissionConnection;
import org.fortiss.af3.platform.raspberry.model.CanBus;
import org.fortiss.af3.platform.raspberry.model.CanConnector;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.raspberry.model.RaspberryPiReceiverBase;
import org.fortiss.af3.platform.raspberry.model.RaspberryPiTransmitterBase;
import org.fortiss.af3.platform.raspberry.model.brick.UIDReceiver;
import org.fortiss.af3.platform.raspberry.model.brick.UIDTtransmitter;
import org.fortiss.af3.platform.raspberry.model.gamepad.GamepadReceiverBase;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumbleMagnitudeStrong;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumbleMagnitudeWeak;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumblepadReceiverBase;
import org.fortiss.af3.platform.raspberry.ui.editor.visual.CanBusTransmissionUnitVisual;
import org.fortiss.af3.platform.raspberry.ui.editor.visual.RaspberryPiExecutionUnitVisual;
import org.fortiss.af3.platform.raspberry.ui.editor.visual.RaspberryPiReceiverVisual;
import org.fortiss.af3.platform.raspberry.ui.editor.visual.RaspberryPiTransceiverVisual;
import org.fortiss.af3.platform.raspberry.ui.editor.visual.RaspberryPiTransmitterVisual;
import org.fortiss.af3.platform.ui.editor.fx.visual.TransmissionConnectionVisual;
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;
/**
* The implementation of the {@link IVisualFactory} for the platform architecture editor.
*
* @author ponce
*/
public class PlatformRaspberryPiVisualFactory implements IVisualFactory {
/** {@inheritDoc} */
@Override
public IContentVisual createContentVisual(IContentMVCBundle modelBundle) {
Object modelObj = modelBundle.getModel();
if(modelObj instanceof RaspberryPi) {
return new RaspberryPiExecutionUnitVisual(modelBundle);
}
if(modelObj instanceof CanBus) {
return new CanBusTransmissionUnitVisual(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 RaspberryPiTransmitterBase ||
modelObj instanceof RumbleMagnitudeStrong ||
modelObj instanceof RumbleMagnitudeWeak || modelObj instanceof UIDTtransmitter) {
return new RaspberryPiTransmitterVisual(modelBundle);
}
if(modelObj instanceof RaspberryPiReceiverBase || modelObj instanceof GamepadReceiverBase ||
modelObj instanceof RumblepadReceiverBase || modelObj instanceof UIDReceiver) {
return new RaspberryPiReceiverVisual(modelBundle);
}
if(modelObj instanceof CanConnector) {
return new RaspberryPiTransceiverVisual(modelBundle);
}
return null;
}
/** {@inheritDoc} */
@Override
public ILinkVisual createLinkVisual(ILinkMVCBundle modelBundle) {
Object modelObj = modelBundle.getModel();
if(modelObj instanceof TransmissionConnection) {
return new TransmissionConnectionVisual(modelBundle);
}
return null;
}
}
CanBusTransmissionUnitVisual.java 395b4f9d61a7b806e08a1f1544515622a70ca0c3 YELLOW
RaspberryPiExecutionUnitVisual.java d47903f7a97b53e12dcd1192cf6c707d6f35d137 YELLOW
RaspberryPiReceiverVisual.java f37bec7e78993ea43931a7c32af114e6cb047671 YELLOW
RaspberryPiTransceiverVisual.java d8b3b1a177f2d19962292c5dfea16cf08b9836d0 YELLOW
RaspberryPiTransmitterVisual.java c03eb1911574de68af736de7b0594eb8cd76ea67 YELLOW
/*-------------------------------------------------------------------------+
| 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.raspberry.ui.editor.visual;
import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.text.TextAlignment.CENTER;
import static org.fortiss.af3.platform.ui.AF3PlatformUIActivator.PLUGIN_ID;
import static org.fortiss.af3.platform.ui.DefaultStyle.EU_BACKGROUND;
import static org.fortiss.af3.platform.ui.DefaultStyle.EU_FOREGROUND;
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.platform.raspberry.model.CanBus;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedRectangularContentVisual;
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;
import javafx.scene.text.TextAlignment;
/**
* {@link IContentVisual} for {@link CanBus}s displayed in the diagram.
*
* @author ponce
*/
public final class CanBusTransmissionUnitVisual
extends NamedLayoutedRectangularContentVisual<CanBus> {
/** The icon image. */
private static final Image ICON = getFXImage(PLUGIN_ID, "/icons/unknown.png");
/** The fill color used by CanBusTransmissionUnitVisual. */
private static final Color FILL_COLOR = convertColor(EU_BACKGROUND);
/** The foreground color used by CanBusTransmissionUnitVisual. */
private static final Color BORDER_COLOR = convertColor(EU_FOREGROUND);
/** Constructor. */
public CanBusTransmissionUnitVisual(IContentMVCBundle mvcb) {
super(mvcb, CanBus.class);
}
/** {@inheritDoc} */
@Override
protected TextAlignment getHorizontalTextAlignment() {
return CENTER;
}
/** {@inheritDoc} */
@Override
protected Color getSelectedFocusedColor() {
return BLACK;
}
/** {@inheritDoc} */
@Override
protected Paint getFillColor() {
return FILL_COLOR;
}
/** {@inheritDoc} */
@Override
protected Paint getBorderColor() {
return BORDER_COLOR;
}
/** {@inheritDoc} */
@Override
protected Image getIcon() {
return ICON;
}
}
/*-------------------------------------------------------------------------+
| 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.raspberry.ui.editor.visual;
import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.text.TextAlignment.CENTER;
import static org.fortiss.af3.platform.ui.AF3PlatformUIActivator.PLUGIN_ID;
import static org.fortiss.af3.platform.ui.DefaultStyle.EU_BACKGROUND;
import static org.fortiss.af3.platform.ui.DefaultStyle.EU_FOREGROUND;
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.platform.raspberry.model.RaspberryPi;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedRectangularContentVisual;
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;
import javafx.scene.text.TextAlignment;
/**
* {@link IContentVisual} for {@link RaspberryPi}s displayed in the diagram.
*
* @author ponce
*/
public final class RaspberryPiExecutionUnitVisual
extends NamedLayoutedRectangularContentVisual<RaspberryPi> {
/** The icon image. */
private static final Image ICON = getFXImage(PLUGIN_ID, "/icons/unknown.png");
/** The fill color used by RaspberryPis. */
private static final Color FILL_COLOR = convertColor(EU_BACKGROUND);
/** The foreground color used by RaspberryPis. */
private static final Color BORDER_COLOR = convertColor(EU_FOREGROUND);
/** Constructor. */
public RaspberryPiExecutionUnitVisual(IContentMVCBundle mvcb) {
super(mvcb, RaspberryPi.class);
}
/** {@inheritDoc} */
@Override
protected TextAlignment getHorizontalTextAlignment() {
return CENTER;
}
/** {@inheritDoc} */
@Override
protected Color getSelectedFocusedColor() {
return BLACK;
}
/** {@inheritDoc} */
@Override
protected Paint getFillColor() {
return FILL_COLOR;
}
/** {@inheritDoc} */
@Override
protected Paint getBorderColor() {
return BORDER_COLOR;
}
/** {@inheritDoc} */
@Override
protected Image getIcon() {
return ICON;
}
}
/*-------------------------------------------------------------------------+
| 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.raspberry.ui.editor.visual;
import static javafx.scene.paint.Color.WHITE;
import org.fortiss.af3.platform.model.Receiver;
import org.fortiss.tooling.base.ui.editor.fx.visual.NamedLayoutedCircularAnchorageContentVisual;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IContentVisual;
import javafx.scene.paint.Paint;
/**