Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Review: tik/proxy-view #129

Merged
merged 49 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3b9f865
Initial commit, added properties and hacky fix for fonts
May 23, 2022
8649530
Updated to support the proxy-view API
May 31, 2022
675a8d1
Added a type check
May 31, 2022
4a781d0
add basic semantic structure to create semantic filters
Eddykasp Jun 23, 2022
771e38a
add different concrete building blocks for filters
Eddykasp Jun 24, 2022
74c9fc2
Added a property for hierarchical off-screen depth
fight4day Jun 25, 2022
446ad44
add documentation for semantic filters
Eddykasp Jun 27, 2022
51dc926
Preparation for semantic filtering
fight4day Jun 30, 2022
9ff28c4
Merge remote-tracking branch 'origin/mka/semantic-filtering' into tik…
fight4day Jun 30, 2022
a37ba4c
Added numeric operators to semantic filters. Should mostly be working
fight4day Jul 1, 2022
7485a99
Cleared up javadocs
fight4day Jul 2, 2022
63d55f5
Added some util methods - big operators, constants, etc
fight4day Jul 4, 2022
2f73680
Rename
fight4day Jul 4, 2022
93ea87f
Merge remote-tracking branch 'origin/master' into tik/proxy-view
fight4day Jul 5, 2022
e6b3b68
mka code review first change
fight4day Jul 6, 2022
5251ccf
Some of the code review
fight4day Jul 6, 2022
1f09038
Code review + default values
fight4day Jul 20, 2022
791a1a1
semantic filtering specifics
Eddykasp Jul 25, 2022
d522bbc
add utility connectives and fix bundle version
Eddykasp Jul 26, 2022
aad7110
add properties api to add filter tags and rules to graphs
Eddykasp Jul 26, 2022
0b1faa8
add >=, <= and != numeric connectives
Eddykasp Jul 26, 2022
b9f7fc8
add numeric connectives
Eddykasp Jul 29, 2022
ac1af70
organize imports
Eddykasp Jul 29, 2022
5853dc5
rename numeric connectives
Eddykasp Jul 29, 2022
6614980
Merge remote-tracking branch 'origin/master' into tik/proxy-view
fight4day Aug 2, 2022
7758564
Merge remote-tracking branch 'origin/mka/semantic-filtering-v2' into
fight4day Aug 2, 2022
d829608
make comparator connectives binary
Eddykasp Aug 2, 2022
9f96a57
add numeric constant
Eddykasp Aug 2, 2022
00a7068
Merge remote-tracking branch 'origin/mka/semantic-filtering-v2' into …
fight4day Aug 2, 2022
e41ed10
add parser with tests and update some type checks that were missing
Eddykasp Aug 29, 2022
e21c273
Update buildAndTest.yml
Eddykasp Aug 29, 2022
56c84f4
Update pom.xml
Eddykasp Aug 29, 2022
1725769
Merge pull request #140 from kieler/Eddykasp-patch-1
Eddykasp Aug 29, 2022
b13abc2
Rename
fight4day Aug 29, 2022
4112c91
Merge remote-tracking branch 'origin/mka/semantic-filtering-v2' into …
fight4day Aug 29, 2022
6c2b6e7
Wrote a util for parsing
fight4day Aug 29, 2022
315479c
Merge branch 'tik/semantic-filtering-parse-util' into tik/proxy-view
fight4day Aug 29, 2022
18215bc
klighd: moved example code for semantic filtering rules here.
NiklasRentzCAU Mar 3, 2023
82e3577
removed some unused imports
NiklasRentzCAU Mar 3, 2023
3fd2b14
add documentation for semantic filter rule parser and syntax
Eddykasp Mar 6, 2023
b8cf0c2
add documentation for InvalidSyntaxException
Eddykasp Mar 6, 2023
ba0dc30
Merge remote-tracking branch 'origin/master' into tik/proxy-view
NiklasRentzCAU Mar 15, 2023
5de0dd4
add comment
Eddykasp Mar 15, 2023
dec5607
replaced some Java 9-requiring code in klighd with a Java 8-compatible
NiklasRentzCAU Mar 15, 2023
f3b6b51
make Maven happy, as '<>' cannot be used with anonymous classes.
NiklasRentzCAU Mar 15, 2023
ae58b85
Merge remote-tracking branch 'origin/master' into tik/proxy-view
NiklasRentzCAU Apr 21, 2023
6941984
lsp: calculate size and layout of proxies.
NiklasRentzCAU Apr 25, 2023
28284d1
Merge branch 'master' into tik/proxy-view
Eddykasp Aug 31, 2023
8180323
update javadoc to fix errors
Eddykasp Sep 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import java.util.Map
import static com.google.common.collect.Iterables.filter

import static extension de.cau.cs.kieler.klighd.lsp.utils.SprottyProperties.*
import de.cau.cs.kieler.klighd.util.KlighdProperties
NiklasRentzCAU marked this conversation as resolved.
Show resolved Hide resolved

/**
* Utility class to provide some functionality to persist prepare the rendering of a {@link KGraphElement}.
Expand Down Expand Up @@ -129,6 +130,45 @@ 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) {
KRenderingLibrary: {
// The library needs to generate ids for all later KRenderingRefs to refer to, but no own bounds,
// since these are generic renderings.
for (rendering : data.renderings) {
if (rendering instanceof KRendering) {
KRenderingIdGenerator.generateIdsRecursive(rendering)
}
}
}
NiklasRentzCAU marked this conversation as resolved.
Show resolved Hide resolved
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 KGraphElement) {
handleKRendering(data.eContainer as KGraphElement, data, null, null)
}
}
}
}
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Collection;

Expand Down Expand Up @@ -129,6 +131,11 @@ protected void registerFonts() {
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (int i = 0; i < filePaths.length; ++i) {
try (InputStream fontStream = this.getClass().getResourceAsStream(filePaths[i])) {

// TODO Hacky workaround for opening fonts
String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + ".." + filePaths[i];
InputStream temp = new FileInputStream(new File(path));
NiklasRentzCAU marked this conversation as resolved.
Show resolved Hide resolved

NiklasRentzCAU marked this conversation as resolved.
Show resolved Hide resolved
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, fontStream));
} catch (Throwable e) {
System.out.println("could not load font file " + filePaths[i]);
Expand Down
1 change: 1 addition & 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,7 @@ 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.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
Expand Up @@ -16,14 +16,18 @@
*/
package de.cau.cs.kieler.klighd;

import java.util.Collection;
import java.util.EnumSet;
import java.util.List;

import org.eclipse.elk.core.data.ILayoutMetaDataProvider;
import org.eclipse.elk.core.data.LayoutOptionData;
import org.eclipse.elk.core.math.KVector;
import org.eclipse.elk.graph.properties.IProperty;
import org.eclipse.elk.graph.properties.Property;

import de.cau.cs.kieler.klighd.filtering.SemanticFilterRule;
import de.cau.cs.kieler.klighd.filtering.SemanticFilterTag;
NiklasRentzCAU marked this conversation as resolved.
Show resolved Hide resolved
import de.cau.cs.kieler.klighd.labels.management.LabelManagementResult;
import de.cau.cs.kieler.klighd.util.ExpansionAwareLayoutOption;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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
*
*/
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.name = NAME;
this.leftOperand = leftOperand;
this.rightOperand = rightOperand;
}

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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
*
*/
public abstract class BinaryConnective extends SemanticFilterRule {

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

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

}

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

/**
* Returns a string representation of the rule of the form 'C(R1, R2)'.
* @return the rule string
*/
public String getString() {
return name + "(" + leftOperand + ", " + rightOperand + ")";
}
NiklasRentzCAU marked this conversation as resolved.
Show resolved Hide resolved

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 GreaterThan Connective takes one rule R and evaluates to true
* iff
* R.num > correspondingTag.num.
* @author tik
*
*/
public class GreaterThanConnective extends UnaryConnective {
protected static final String NAME = "GREATERTHAN";

/**
* Constructor for unnamed rule.
* @param operand the operand
*/
public GreaterThanConnective(SemanticFilterTag operand) {
this.name = NAME;
this.operand = operand;
}

/**
* Constructor for named rule.
* @param operand the operand
* @param ruleName rule name
*/
public GreaterThanConnective(SemanticFilterTag operand, String ruleName) {
super(ruleName);
this.name = NAME;
this.operand = operand;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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 IfThen Connective takes two rules R1 and R2 and evaluates to true
* iff
* R1 evaluates to false or R2 evaluates to true.
*
* @author tik
*
*/
public class IfThenConnective extends BinaryConnective {
protected static final String NAME = "IFTHEN";

/**
* Constructor for unnamed rule.
* @param leftOperand left operand
* @param rightOperand right operand
*/
public IfThenConnective(SemanticFilterRule leftOperand, SemanticFilterRule rightOperand) {
this.name = NAME;
this.leftOperand = leftOperand;
this.rightOperand = rightOperand;
}

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 IfThenElse Connective takes three rules R1, R2 and R3 and evaluates to true
* iff
* R1 and R2 evaluate to true or R1 evaluates to false and R3 evaluates to true.
*
* @author tik
*
*/
public class IfThenElseConnective extends TernaryConnective {
protected static final String NAME = "IFTHENELSE";

/**
* Constructor for unnamed rule.
* @param firstOperand first operand
* @param secondOperand second operand
* @param thirdOperand third operand
*/
public IfThenElseConnective(SemanticFilterRule firstOperand, SemanticFilterRule secondOperand,
SemanticFilterRule thirdOperand) {
this.name = NAME;
this.firstOperand = firstOperand;
this.secondOperand = secondOperand;
this.thirdOperand = thirdOperand;
}

/**
* Constructor for named rule.
* @param firstOperand first operand
* @param secondOperand second operand
* @param thirdOperand third operand
* @param ruleName rule name
*/
public IfThenElseConnective(SemanticFilterRule firstOperand, SemanticFilterRule secondOperand,
SemanticFilterRule thirdOperand, String ruleName) {
super(ruleName);
this.name = NAME;
this.firstOperand = firstOperand;
this.secondOperand = secondOperand;
this.thirdOperand = thirdOperand;
}

}
Loading