hide parent controls on hover

This commit is contained in:
jmillman
2015-10-14 12:28:54 -04:00
parent 334e1ae8d4
commit 79f490a2cc
4 changed files with 24 additions and 18 deletions
@@ -116,6 +116,12 @@ public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentT
abstract void setDescriptionVisibility(DescriptionVisibility get);
void showHoverControls(final boolean showControls) {
if (showControls && parentNode != null) {
parentNode.showHoverControls(false);
}
}
final EventType getEventType() {
return getEventBundle().getEventType();
}
@@ -86,7 +86,6 @@ final public class EventClusterNode extends EventBundleNodeBase<EventCluster, Ev
clusterRegion.setBackground(defaultBackground);
clusterRegion.setMaxHeight(USE_COMPUTED_SIZE);
clusterRegion.setMinHeight(24);
// clusterRegion.prefHeightProperty().bind(subNodePane.prefHeightProperty().add(24));
clusterRegion.setMaxWidth(USE_PREF_SIZE);
clusterRegion.setMinWidth(1);
@@ -101,11 +100,11 @@ final public class EventClusterNode extends EventBundleNodeBase<EventCluster, Ev
* impact on speed of loading the chart
*/
installTooltip();
showDescriptionLoDControls(true);
showHoverControls(true);
chart.requestChartLayout();
});
setOnMouseExited((MouseEvent event) -> {
showDescriptionLoDControls(false);
showHoverControls(false);
chart.requestChartLayout();
});
configureLoDButton(plusButton);
@@ -124,11 +123,12 @@ final public class EventClusterNode extends EventBundleNodeBase<EventCluster, Ev
getChildren().addAll(vBox);
}
void showDescriptionLoDControls(final boolean showControls) {
@Override
void showHoverControls(final boolean showControls) {
super.showHoverControls(showControls);
show(plusButton, showControls);
show(minusButton, showControls);
}
@Override
@@ -146,7 +146,6 @@ final public class EventClusterNode extends EventBundleNodeBase<EventCluster, Ev
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
void setDescriptionWidth(double max) {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
@@ -580,7 +580,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
if (oneEventPerRow.get()) {
// if onePerRow, just put it at end
yTop = (localMax + 2);
yTop = (localMax + MINIMUM_GAP);
yBottom = yTop + h;
} else {
boolean overlapping = true;
@@ -590,11 +590,11 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
//check each pixel from bottom to top.
for (double y = yBottom; y >= yTop; y--) {
final Double maxX = maxXatY.get((int) y);
if (maxX != null && maxX >= xLeft - 4) {
if (maxX != null && maxX >= xLeft - MINIMUM_GAP) {
//if that pixel is already used
//jump top to this y value and repeat until free slot is found.
overlapping = true;
yTop = y + 4;
yTop = y + MINIMUM_GAP;
yBottom = yTop + h;
break;
}
@@ -607,7 +607,6 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
}
localMax = Math.max(yBottom, localMax);
// bundleNode.relocate(xLeft, yTop);
Timeline tm = new Timeline(new KeyFrame(Duration.seconds(.5),
new KeyValue(bundleNode.layoutXProperty(), xLeft),
new KeyValue(bundleNode.layoutYProperty(), yTop)));
@@ -617,6 +616,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
}
return localMax;
}
private static final int MINIMUM_GAP = 4;
private void layoutProjectionMap() {
for (final Map.Entry<EventCluster, Line> entry : projectionMap.entrySet()) {
@@ -106,7 +106,7 @@ final public class EventStripeNode extends EventBundleNodeBase<EventStripe, Even
public EventStripeNode(EventDetailChart chart, EventStripe eventStripe, EventClusterNode parentNode) {
super(chart, eventStripe, parentNode);
minWidthProperty().bind(subNodePane.widthProperty());
if (eventStripe.getEventIDsWithHashHits().isEmpty()) {
@@ -146,28 +146,30 @@ final public class EventStripeNode extends EventBundleNodeBase<EventStripe, Even
//set up mouse hover effect and tooltip
setOnMouseEntered((MouseEvent e) -> {
/*
* w
* defer tooltip creation till needed, this had a surprisingly large
* impact on speed of loading the chart
*/
installTooltip();
showDescriptionLoDControls(true);
showHoverControls(true);
// toFront();
});
setOnMouseExited((MouseEvent e) -> {
showDescriptionLoDControls(false);
showHoverControls(false);
});
}
void showDescriptionLoDControls(final boolean showControls) {
@Override
void showHoverControls(final boolean showControls) {
super.showHoverControls(showControls);
DropShadow dropShadow = dropShadowMap.computeIfAbsent(getEventType(),
eventType -> new DropShadow(10, eventType.getColor()));
subNodePane.setEffect(showControls ? dropShadow : null);
show(hideButton, showControls);
}
}
public EventStripe getEventStripe() {
return getEventBundle();
@@ -333,5 +335,4 @@ final public class EventStripeNode extends EventBundleNodeBase<EventStripe, Even
}
}
}