Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mka/topdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddykasp committed Sep 5, 2023
2 parents 10a3007 + 870286c commit 1ffce45
Show file tree
Hide file tree
Showing 36 changed files with 2,615 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import de.cau.cs.kieler.klighd.microlayout.DecoratorPlacementUtil
import de.cau.cs.kieler.klighd.microlayout.DecoratorPlacementUtil.Decoration
import de.cau.cs.kieler.klighd.microlayout.GridPlacementUtil
import de.cau.cs.kieler.klighd.microlayout.PlacementUtil
import de.cau.cs.kieler.klighd.util.KlighdProperties
import java.awt.geom.Point2D
import java.util.ArrayList
import java.util.HashMap
Expand Down Expand Up @@ -130,6 +131,42 @@ final class RenderingPreparer {
prepareRendering(port)
}
}

// Also calculate the sizes of all proxy-renderings
val proxyRendering = element.getProperty(KlighdProperties.PROXY_VIEW_PROXY_RENDERING)
if (element.getProperty(KlighdProperties.PROXY_VIEW_RENDER_NODE_AS_PROXY) && proxyRendering !== null) {
for (data : proxyRendering) {
switch(data) {
KRenderingRef: {
// all references to KRenderings need to place a map with the ids of the renderings and their
// sizes and their decoration in this case in the properties of the reference.
var boundsMap = new HashMap<String, Bounds>
var decorationMap = new HashMap<String, Decoration>
handleKRendering(element, data.rendering, boundsMap, decorationMap)
// add new Property to contain the boundsMap
data.properties.put(CALCULATED_BOUNDS_MAP, boundsMap)
// and the decorationMap
data.properties.put(CALCULATED_DECORATION_MAP, decorationMap)
// remember the id of the rendering in the reference
data.renderingId = data.rendering.renderingId

}
KRendering: {
// every rendering needs an ID, generate it here
KRenderingIdGenerator.generateIdsRecursive(data)
if (data.eContainer instanceof KNode) {
// Calculate the size and layout of the proxy first.
val parent = data.eContainer as KNode
val minSize = parent.getProperty(KlighdProperties.MINIMAL_NODE_SIZE)
val bounds = PlacementUtil.basicEstimateSize(data, new Bounds(minSize.x, minSize.y))
parent.width = bounds.width
parent.height = bounds.height
handleKRendering(parent, data, null, null)
}
}
}
}
}
}

/**
Expand Down Expand Up @@ -466,7 +503,7 @@ final class RenderingPreparer {
static val StyleModificationContext singletonModContext = new StyleModificationContext();

/**
* @see de.cau.cs.kieler.klighd.piccolo.internal.controller.AbstractKGERenderingController#processModifiableStyles
* See {@code de.cau.cs.kieler.klighd.piccolo.internal.controller.AbstractKGERenderingController#processModifiableStyles}
*/
private static def void processModifiableStyles(KRendering rendering, KGraphElement parent) {
val styles = if (rendering instanceof KRenderingRef)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Draw2DConnectionNode(final Connection theFigure) {
public void setPoints(final PointList pts) {
@SuppressWarnings("unchecked")
final
List<IFigure> children = this.getChildren();
List<IFigure> children = (List<IFigure>) this.getChildren();
for (final Connection child : Iterables.filter(children, Connection.class)) {
child.setPoints(pts);
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/de.cau.cs.kieler.klighd/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Bundle-ActivationPolicy: lazy
Bundle-Activator: de.cau.cs.kieler.klighd.KlighdPlugin
Export-Package: de.cau.cs.kieler.klighd,
de.cau.cs.kieler.klighd.actions,
de.cau.cs.kieler.klighd.filtering,
de.cau.cs.kieler.klighd.filtering.parser,
de.cau.cs.kieler.klighd.internal;x-friends:="de.cau.cs.kieler.klighd.piccolo,de.cau.cs.kieler.klighd.ui,de.cau.cs.kieler.klighd.lsp",
de.cau.cs.kieler.klighd.internal.macrolayout;x-friends:="de.cau.cs.kieler.klighd.ui,de.cau.cs.kieler.klighd.piccolo",
de.cau.cs.kieler.klighd.internal.preferences;x-internal:=true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2022 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
package de.cau.cs.kieler.klighd.filtering;

/**
* An And Connective takes two rules R1 and R2 and evaluates to true
* iff
* R1 and R2 evaluate to true.
*
* @author mka
* @author tik
*
*/
public class AndConnective extends BinaryConnective {
protected static final String NAME = "AND";

/**
* Constructor for unnamed rule.
* @param leftOperand left operand
* @param rightOperand right operand
*/
public AndConnective(SemanticFilterRule leftOperand, SemanticFilterRule rightOperand) {
this(leftOperand, rightOperand, null, null);
}

/**
* Constructor for unnamed rule with default value.
* @param leftOperand left operand
* @param rightOperand right operand
* @param defaultValue the default value
*/
public AndConnective(SemanticFilterRule leftOperand, SemanticFilterRule rightOperand, Boolean defaultValue) {
this(leftOperand, rightOperand, defaultValue, null);
}

/**
* Constructor for named rule.
* @param leftOperand left operand
* @param rightOperand right operand
* @param ruleName rule name
*/
public AndConnective(SemanticFilterRule leftOperand, SemanticFilterRule rightOperand, String ruleName) {
this(leftOperand, rightOperand, null, ruleName);
}

/**
* Constructor for named rule with default value.
* @param leftOperand left operand
* @param rightOperand right operand
* @param defaultValue the default value
* @param ruleName rule name
*/
public AndConnective(SemanticFilterRule leftOperand, SemanticFilterRule rightOperand, Boolean defaultValue, String ruleName) {
super(defaultValue, ruleName);
this.name = NAME;
this.leftOperand = leftOperand;
this.rightOperand = rightOperand;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2022 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
package de.cau.cs.kieler.klighd.filtering;

/**
* A binary connective C takes two filter rules R1 and R2 as operands and creates the new rule R1 C R2.
* @author mka
* @author tik
*
*/
public abstract class BinaryConnective extends SemanticFilterRule {

protected String name;
protected SemanticFilterRule leftOperand;
protected SemanticFilterRule rightOperand;

/**
* {@inheritDoc}
*/
public BinaryConnective() {

}

/**
* {@inheritDoc}
*/
public BinaryConnective(Boolean defaultValue) {
super(defaultValue);
}

/**
* {@inheritDoc}
*/
public BinaryConnective(String ruleName) {
super(ruleName);
}

/**
* {@inheritDoc}
*/
public BinaryConnective(Boolean defaultValue, String ruleName) {
super(defaultValue, ruleName);
}

/**
* Returns a string representation of the rule of the form 'C(R1, R2)'.
* @return the rule string
*/
public String toString() {
return name + "(" + leftOperand + ", " + rightOperand + ")";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2022 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
package de.cau.cs.kieler.klighd.filtering;

/**
* A False Connective always evaluates to false.
*
* @author mka
*
*/
public class FalseConnective extends NullaryConnective {

protected static final String NAME = "FALSE";

/**
* Constructor for unnamed rule.
*/
public FalseConnective() {
this(null, null);
}

/**
* Constructor for unnamed rule with default value.
* @param defaultValue
*/
public FalseConnective(Boolean defaultValue) {
this(defaultValue, null);
}

/**
* Constructor for named rule.
* @param ruleName
*/
public FalseConnective(String ruleName) {
this(null, ruleName);
}

/**
* Constructor for named rule with default value.
* @param defaultValue
* @param ruleName
*/
public FalseConnective(Boolean defaultValue, String ruleName) {
super(defaultValue, ruleName);
this.name = NAME;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2022 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
package de.cau.cs.kieler.klighd.filtering;

/**
* A GreaterEquals Connective takes two numeric rules R1 and R2 and evaluates to true
* iff
* R1 >= R2
*
* @author mka
*
*/
public class GreaterEqualsConnective extends BinaryConnective {
protected static final String NAME = "GREATEREQUALS";

/**
* Constructor for unnamed rule.
* @param leftOperand left operand
* @param rightOperand right operand
*/
public GreaterEqualsConnective(NumericResult leftOperand, NumericResult rightOperand) {
this(leftOperand, rightOperand, null, null);
}

/**
* Constructor for unnamed rule with default value.
* @param leftOperand left operand
* @param rightOperand right operand
* @param defaultValue the default value
*/
public GreaterEqualsConnective(NumericResult leftOperand, NumericResult rightOperand, Boolean defaultValue) {
this(leftOperand, rightOperand, defaultValue, null);
}

/**
* Constructor for named rule.
* @param leftOperand left operand
* @param rightOperand right operand
* @param ruleName rule name
*/
public GreaterEqualsConnective(NumericResult leftOperand, NumericResult rightOperand, String ruleName) {
this(leftOperand, rightOperand, null, ruleName);
}

/**
* Constructor for named rule with default value.
* @param leftOperand left operand
* @param rightOperand right operand
* @param defaultValue the default value
* @param ruleName rule name
*/
public GreaterEqualsConnective(NumericResult leftOperand, NumericResult rightOperand, Boolean defaultValue, String ruleName) {
super(defaultValue, ruleName);
this.name = NAME;
this.leftOperand = (SemanticFilterRule) leftOperand;
this.rightOperand = (SemanticFilterRule) rightOperand;
}

}
Loading

0 comments on commit 1ffce45

Please sign in to comment.