This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new ac017a7  Finally found the cause of header row sometime not showing.
ac017a7 is described below

commit ac017a78b38ff525f8302f74a09f39cd1b44ced0
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Sat Feb 1 15:46:00 2020 +0100

    Finally found the cause of header row sometime not showing.
---
 .../main/java/org/apache/sis/gui/coverage/GridViewSkin.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridViewSkin.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridViewSkin.java
index e40f577..cb77f92 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridViewSkin.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridViewSkin.java
@@ -112,6 +112,12 @@ final class GridViewSkin extends 
VirtualContainerBase<GridView, GridRow> {
     double cellInnerWidth;
 
     /**
+     * Whether a new image has been set, in which case we should recompute 
everything
+     * including the labels in header row.
+     */
+    private boolean layoutAll;
+
+    /**
      * Whether the grid view contains at least one tile that we failed to 
fetch.
      */
     private boolean hasErrors;
@@ -205,6 +211,7 @@ final class GridViewSkin extends 
VirtualContainerBase<GridView, GridRow> {
         if (all) {
             updateItemCount();
             getChildren().removeIf((node) -> (node instanceof GridError));
+            layoutAll = true;
             hasErrors = false;
         }
         /*
@@ -339,7 +346,7 @@ final class GridViewSkin extends 
VirtualContainerBase<GridView, GridRow> {
         final double  headerHeight = flow.getFixedCellSize() + 2*cellSpacing;
         final double  dataY        = y + headerHeight;
         final double  dataHeight   = height - headerHeight;
-        final boolean resized      = (flow.getWidth() != width) || 
(flow.getHeight() != dataHeight);
+        layoutAll |= (flow.getWidth() != width) || (flow.getHeight() != 
dataHeight);
         flow.resizeRelocate(x, dataY, width, dataHeight);
         /*
          * Recompute all values which will be needed by GridRowSkin. They are 
mostly information about
@@ -374,7 +381,7 @@ final class GridViewSkin extends 
VirtualContainerBase<GridView, GridRow> {
          * detected (in which case values changed), or because the view size 
changed (in which case cells
          * may need to be added or removed).
          */
-        if (resized || oldPos != leftPosition) {
+        if (layoutAll || oldPos != leftPosition) {
             layoutInArea(headerRow, x, y, width, headerHeight, 
Node.BASELINE_OFFSET_SAME_AS_HEIGHT, HPos.LEFT, VPos.TOP);
             final ObservableList<Node> children = headerRow.getChildren();
             final int count   = children.size();
@@ -401,6 +408,7 @@ final class GridViewSkin extends 
VirtualContainerBase<GridView, GridRow> {
                 pos += cellWidth;
             }
         }
+        layoutAll = false;
         if (hasErrors) {
             computeErrorBounds(flow);
         }

Reply via email to