From 18aafccd2d26525f8ee6b83e57395cd0498e4db7 Mon Sep 17 00:00:00 2001 From: srcarter3 Date: Wed, 24 Aug 2022 22:15:40 -0700 Subject: [PATCH 1/2] Change default d2d startup to 1 pane plugin.xml - changed 1panel to have 0 side panes ChangeD2DLayoutAction - if 0 side panels, make side panel width 0 D2D5Pane - change initial start up to have 0 side panes --- cave/com.raytheon.uf.viz.d2d.ui/plugin.xml | 2 +- .../d2d/ui/actions/ChangeD2DLayoutAction.java | 10 ++++- .../uf/viz/d2d/ui/perspectives/D2D5Pane.java | 41 ++++++++++--------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml index b2bf7b9127..71fd046f17 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml +++ b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml @@ -251,7 +251,7 @@ label="1 Pane Layout"> + value="0"> * * @author mschenke @@ -164,10 +165,15 @@ public class ChangeD2DLayoutAction extends AbstractHandler { */ private void sizeWidth(MElementContainer sideViewsContainer, int nSideViews) { + int width; if (nSideViews > 5) { nSideViews = 5; } - int width = (6 - nSideViews) * 1000; + if (nSideViews == 0) { + width = 0; + } else { + width = (6 - nSideViews) * 1000; + } int diff = 10000 - width; MElementContainer screenContainer = sideViewsContainer .getParent(); diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java index ec089f16a9..4824e11a81 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java @@ -51,7 +51,8 @@ import com.raytheon.viz.ui.UiUtil; * 7/1/06 chammack Initial Creation. * Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d * Oct 10, 2013 2104 mschenke Switched to use MapScalesManager - * + * Aug 24, 2022 srcarter Default to single pane view + * * * * @author chammack @@ -93,30 +94,32 @@ public class D2D5Pane implements IPerspectiveFactory { } } - int numViews = ChangeD2DLayoutAction.getViewCount() == 2 ? 2 - : baseViewsToAdd.size(); + int numViews = 0; String lastAdded = null; Collections.sort(baseViewsToAdd); - for (int i = 0; i < baseViewsToAdd.size(); ++i) { - String baseView = baseViewsToAdd.get(i); - if (baseViewsToAdd.contains(baseView)) { - if (lastAdded == null) { - layout.addStandaloneView( - baseView, - false, - IPageLayout.LEFT, - ChangeD2DLayoutAction.getViewCount() == 2 ? THREE_PANE_WIDTH - : FIVE_PANE_WIDTH, editorArea); - } else { - layout.addStandaloneView(baseView, false, - IPageLayout.BOTTOM, (i >= numViews) ? 1.0f - : 1.0f / (numViews - i + 1), lastAdded); + if (numViews > 0) { + for (int i = 0; i < baseViewsToAdd.size(); ++i) { + String baseView = baseViewsToAdd.get(i); + if (baseViewsToAdd.contains(baseView)) { + if (lastAdded == null) { + layout.addStandaloneView(baseView, false, + IPageLayout.LEFT, + ChangeD2DLayoutAction.getViewCount() == 2 + ? THREE_PANE_WIDTH + : FIVE_PANE_WIDTH, + editorArea); + } else { + layout.addStandaloneView(baseView, false, + IPageLayout.BOTTOM, (i >= numViews) ? 1.0f + : 1.0f / (numViews - i + 1), + lastAdded); + } + lastAdded = baseView; + addedViews.add(lastAdded); } - lastAdded = baseView; - addedViews.add(lastAdded); } } From 470a6bcdfd0d4477327eecd198829b3755f2981a Mon Sep 17 00:00:00 2001 From: srcarter3 Date: Mon, 29 Aug 2022 17:06:35 -0700 Subject: [PATCH 2/2] Continued changes for single pane default view ChangeD2DLayoutAction: - set initial side view number to 0 - added comment for side view resizing (from previous commit) D2D5Pane - removed the THREE_PANE_WIDTH (not used anymore) - added a ZERO_PANE_WIDTH - default to 0 views otherwise use the base views for side views - use the ZERO_PANE_WIDTH when there are zero views --- .../d2d/ui/actions/ChangeD2DLayoutAction.java | 5 ++- .../uf/viz/d2d/ui/perspectives/D2D5Pane.java | 44 +++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ChangeD2DLayoutAction.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ChangeD2DLayoutAction.java index 58e4113ae3..29bcd18382 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ChangeD2DLayoutAction.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ChangeD2DLayoutAction.java @@ -52,6 +52,7 @@ import com.raytheon.viz.ui.EditorUtil; * to resize the display for differing number of * side views * Aug 24, 2022 srcarter If no side panes, make the side width 0 + * Aug 29, 2022 srcarter Set the initial side pane count to 0 * * * @@ -65,7 +66,7 @@ public class ChangeD2DLayoutAction extends AbstractHandler { public static int getViewCount() { Integer views = viewMap .get(PlatformUI.getWorkbench().getActiveWorkbenchWindow()); - return views != null ? views : 4; + return views != null ? views : 0; } @Override @@ -169,6 +170,8 @@ public class ChangeD2DLayoutAction extends AbstractHandler { if (nSideViews > 5) { nSideViews = 5; } + // When switching back to single pane (nSideViews == 0) make sure + // the side panes are completely collapsed if (nSideViews == 0) { width = 0; } else { diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java index 4824e11a81..ff710f98d7 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/perspectives/D2D5Pane.java @@ -51,7 +51,7 @@ import com.raytheon.viz.ui.UiUtil; * 7/1/06 chammack Initial Creation. * Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d * Oct 10, 2013 2104 mschenke Switched to use MapScalesManager - * Aug 24, 2022 srcarter Default to single pane view + * Aug 29, 2022 srcarter Default to single pane view, with zero side panel width * * * @@ -66,10 +66,10 @@ public class D2D5Pane implements IPerspectiveFactory { private static final String BASE_VIEW_ID_PREFIX = SideView.ID + UiUtil.SECONDARY_ID_SEPARATOR + "sideView"; - private static final float THREE_PANE_WIDTH = 0.4f; - private static final float FIVE_PANE_WIDTH = 0.2f; + private static final float ZERO_PANE_WIDTH = 0.0f; + /* * (non-Javadoc) * @@ -94,32 +94,30 @@ public class D2D5Pane implements IPerspectiveFactory { } } - int numViews = 0; + int numViews = ChangeD2DLayoutAction.getViewCount() == 0 ? 0 + : baseViewsToAdd.size(); String lastAdded = null; Collections.sort(baseViewsToAdd); - if (numViews > 0) { - for (int i = 0; i < baseViewsToAdd.size(); ++i) { - String baseView = baseViewsToAdd.get(i); - if (baseViewsToAdd.contains(baseView)) { - if (lastAdded == null) { - layout.addStandaloneView(baseView, false, - IPageLayout.LEFT, - ChangeD2DLayoutAction.getViewCount() == 2 - ? THREE_PANE_WIDTH - : FIVE_PANE_WIDTH, - editorArea); - } else { - layout.addStandaloneView(baseView, false, - IPageLayout.BOTTOM, (i >= numViews) ? 1.0f - : 1.0f / (numViews - i + 1), - lastAdded); - } - lastAdded = baseView; - addedViews.add(lastAdded); + for (int i = 0; i < baseViewsToAdd.size(); ++i) { + String baseView = baseViewsToAdd.get(i); + if (baseViewsToAdd.contains(baseView)) { + if (lastAdded == null) { + layout.addStandaloneView( + baseView, + false, + IPageLayout.LEFT, + ChangeD2DLayoutAction.getViewCount() == 0 ? ZERO_PANE_WIDTH + : FIVE_PANE_WIDTH, editorArea); + } else { + layout.addStandaloneView(baseView, false, + IPageLayout.BOTTOM, (i >= numViews) ? 1.0f + : 1.0f / (numViews - i + 1), lastAdded); } + lastAdded = baseView; + addedViews.add(lastAdded); } }