Commit 571c344a authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

[Lorenz] Add option to group class nodes by Java package

Reheat the graph if node grouping criteria changes.

Bug: 1117259
Change-Id: I9be8e2dd6c1ed523fe0ae8a9a71fcb16176bfb18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360495
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799186}
parent 0ff514a1
......@@ -9,6 +9,7 @@
const HullDisplay = {
NONE: 'none',
BUILD_TARGET: 'build-target',
JAVA_PACKAGE: 'java-package',
};
export {
......
......@@ -309,6 +309,10 @@ class GraphView {
this.colorEdgesOnlyOnHover_ = true;
/** @private {string} */
this.graphEdgeColor_ = GraphEdgeColor.DEFAULT;
/** @private {boolean} */
this.reheatRequested_ = false;
/** @private {?string} */
this.lastHullDisplay_ = null;
/** @private {!HoveredNodeManager} */
this.hoveredNodeManager_ = new HoveredNodeManager();
/** @private {!HullColorManager} */
......@@ -731,6 +735,12 @@ class GraphView {
this.colorEdgesOnlyOnHover_ = colorOnlyOnHover;
this.graphEdgeColor_ = graphEdgeColor;
// Reheat if node grouping changed.
if (this.lastHullDisplay_ !== displaySettings.hullDisplay) {
this.lastHullDisplay_ = displaySettings.hullDisplay;
this.reheatRequested_ = true;
}
this.syncEdgeGradients();
this.syncEdgePaths();
this.syncEdgeColors();
......@@ -897,7 +907,8 @@ class GraphView {
// The graph should not be reheated on a no-op (eg. adding a visible node to
// the filter which doesn't add/remove any new nodes).
if (nodesAddedOrRemoved) {
if (this.reheatRequested_ || nodesAddedOrRemoved) {
this.reheatRequested_ = false;
this.simulation_.stop();
this.reheatSimulation(/* shouldEase */ true);
}
......
......@@ -4,7 +4,7 @@
<template>
<div id="hull-settings">
<label>Convex hull display:</label>
<label>Group nodes by:</label>
<div
v-for="hullDisplay in HullDisplay"
:key="hullDisplay"
......@@ -57,6 +57,7 @@ export default ClassGraphHullSettings;
display: flex;
flex-direction: column;
margin-bottom: 10px;
padding-top: 10px;
}
.hull-settings-option {
......
......@@ -117,6 +117,14 @@ function getNodeBuildTarget(node) {
return null;
}
/**
* @param {!ClassNode} node The node to get the Java package of.
* @return {?string} The Java package of the node.
*/
function getNodePackageName(node) {
return node.packageName;
}
// @vue/component
const ClassGraphPage = {
components: {
......@@ -163,6 +171,8 @@ const ClassGraphPage = {
switch (this.displaySettingsData.hullDisplay) {
case HullDisplay.BUILD_TARGET:
return getNodeBuildTarget;
case HullDisplay.JAVA_PACKAGE:
return getNodePackageName;
default:
return () => null;
}
......
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