Add options to dock/float views in preferences#2297
Conversation
| public static final Map<String, Boolean> DEFAULT_VIEW_OPTIONS = Collections.unmodifiableMap(new TreeMap<>(Map.ofEntries( | ||
| entry("Analytic View", Boolean.FALSE), | ||
| entry("Attribute Editor", Boolean.FALSE), | ||
| entry("Conversation View", Boolean.FALSE), | ||
| entry("Data Access View", Boolean.FALSE), | ||
| entry("Error Report", Boolean.FALSE), | ||
| entry("Find and Replace", Boolean.TRUE), | ||
| entry("Histogram", Boolean.FALSE), | ||
| entry("Layers View", Boolean.FALSE), | ||
| entry("Map View", Boolean.FALSE), | ||
| entry("Named Selections", Boolean.FALSE), | ||
| entry("Notes View", Boolean.FALSE), | ||
| entry("Plugin Reporter", Boolean.FALSE), | ||
| entry("Quality Control View", Boolean.FALSE), | ||
| entry("Scatter Plot", Boolean.FALSE), | ||
| entry("Schema View", Boolean.FALSE), | ||
| entry("Scripting View", Boolean.FALSE), | ||
| entry("Table View", Boolean.FALSE), | ||
| entry("Timeline", Boolean.FALSE), | ||
| entry("Simple Graph", Boolean.FALSE), | ||
| entry("Perspective Bookmarks", Boolean.FALSE), | ||
| entry("Plane Manager", Boolean.FALSE), | ||
| entry("Memory Manager", Boolean.FALSE), | ||
| entry("Word Cloud View", Boolean.FALSE) |
There was a problem hiding this comment.
Is there a way for the Views to determined programmatically, rather than having a hard coded list?
There was a problem hiding this comment.
I did try this. Some views don't float correctly. I tried with Attribute editor and Table view since these are in the selection list. After dragging them to a new location they seem to dock even after the change in setting.
I have also noticed that float/dock options available (Netbeans functionality) by right clicking each view tabs. The changes are remembered when opening Constellation next time. (see attached)
So there may be a possibility of having two different settings for a same view ? (e.g. float setting from Netbeans and dock setting from Constellation -> Preferences. Which one take the precedence? )
Also help page is not available for this enhancement. Help button displays a default page.
|
|
|
There was a problem hiding this comment.
Looks like it is working a lot better now, it's nice that it's remembering where all of the views were.
Was having some issues with resizing the views when they are floating. Looks like the full length views, e.g. the Data Access View, cannot be made any shorter but they can be adjusted to be wider, and then the Find View was opened at this full size and cannot be changed at all
Will also need to update the date on the what's new entry when it's ready to be merged
Clean up code and improve readability
|
|
||
| dfpFile = new File(filePath); | ||
|
|
||
| try (BufferedWriter writer = new BufferedWriter(new FileWriter(dfpFile))) { |
| final Map<String, Boolean> dfpFromLookUp = getDFPFromLookUp(); | ||
|
|
||
| for (final Map.Entry<String, Boolean> entry : dfpFromLookUp.entrySet()) { | ||
| writer.write(entry.getKey() + ":" + entry.getValue() + "\n"); |
There was a problem hiding this comment.
Use SeparatorConstants here
|
|
||
| dfpFile = new File(filePath); | ||
|
|
||
| try (BufferedReader reader = new BufferedReader(new FileReader(dfpFile))) { |
| protected void componentOpened() { | ||
| final WindowManager windowManager = WindowManager.getDefault(); | ||
|
|
||
| pcl = (PropertyChangeEvent evt) -> { // Fires when a view is floated or docked manually via the context menu. |
| final Dimension size; | ||
|
|
||
| switch (getModeName()) { | ||
| case "leftSlidingSide", "explorer", "navigator" -> { |
There was a problem hiding this comment.
Can some of these modes be made constants (or potentially an enum is appropriate)? I note these values are being used elsewhere as well.
Also in this case, I note this is the only place where getModeName() is actually called. Given that, is there a reason why we have multiple values possible for each case? Could modes be simplified so we only need to account for one per case? (e.g. do we need to have separate values of "leftSlidingSide", "explorer" and "navigator" if there is no difference between them in the way they are handled)
There was a problem hiding this comment.
The multiple values are to cover the multiple possible docked locations that could be assigned to a top component.
The leftSlidingSide, explorer and navigator modes all preside on the left side when docked so they all share the same code to float them on the left. Similarly for the cases for the right side and bottom.
| return new HelpCtx(getClass().getName()); | ||
| } | ||
|
|
||
| public abstract Map<String, Boolean> getDefaultFloatingPreference(); |
There was a problem hiding this comment.
I noted most of the implementations of this only returned a map size 1. Is there a situation where it makes sense to return more than one? If not, this should probably be changed to a Tuple (could even be made a primitive pair like ObjectBooleanPair<String> if we're never using null for the boolean)
| @@ -0,0 +1,27 @@ | |||
| Analytic View:false | |||
There was a problem hiding this comment.
is there a way to get this all working without requiring this file? Noting this would need to be manually updated, which will add overhead if any other views are added on top of this (not to mention views which could be created in custom modules built on top of Core couldn't be included here)
Implement change to retrieve preferences without the use of reading and writing from a stored file.
|




Prerequisites
Reviewed the checklist
Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
for the "CI / Unit Tests") to complete first. Failed Unit tests can be
debugged by adding the label "verbose logging" to the GitHub PR.
Description of the Change
Added a tab in the options for Constellation preferences to set whether a view is docked or a floating window when opened.
Alternate Designs
N/A
Why Should This Be In Core?
Adds functionality to Core.
Benefits
Allows users to customize their Constellation start up setup.
Possible Drawbacks
N/A
Verification Process
Additionally during Step 2 if the selections are altered the Apply button will enable, then if the selections are returned to how they appeared when the options menu was opened, the Apply button will disable.
Applicable Issues
#1970