Skip to content

Add options to dock/float views in preferences#2297

Open
sol695510 wants to merge 96 commits into
masterfrom
enhancement/docked-or-floated-pref
Open

Add options to dock/float views in preferences#2297
sol695510 wants to merge 96 commits into
masterfrom
enhancement/docked-or-floated-pref

Conversation

@sol695510

Copy link
Copy Markdown
Collaborator

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

  1. Navigate to Setup > Options > CONSTELLATION > View.
  2. Select checkboxes to set views to open views as floating windows, or deselect to open docked.
  3. Select Apply.
  4. When opened, views will open docked or floating as specified in the preferences.

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

@sol695510 sol695510 added the enhancement New feature or request label Apr 30, 2025
Comment on lines +31 to +54
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way for the Views to determined programmatically, rather than having a hard coded list?

@mimosa2 mimosa2 self-requested a review July 1, 2025 23:54

@mimosa2 mimosa2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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? )

TableView_DockFloat

Also help page is not available for this enhancement. Help button displays a default page.

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2025

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@Delphinus8821 Delphinus8821 self-requested a review September 8, 2025 03:40
@sol695510 sol695510 removed the request for review from mimosa2 May 12, 2026 01:45
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.3% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.3% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sol695510 sol695510 requested a review from Quasar985 May 28, 2026 08:28

@Delphinus8821 Delphinus8821 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Image

Will also need to update the date on the what's new entry when it's ready to be merged

@sol695510 sol695510 requested review from Delphinus8821 and mimosa2 and removed request for mimosa2 June 3, 2026 03:47
sol695510 added 2 commits June 3, 2026 17:40
Clean up code and improve readability

dfpFile = new File(filePath);

try (BufferedWriter writer = new BufferedWriter(new FileWriter(dfpFile))) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

final Map<String, Boolean> dfpFromLookUp = getDFPFromLookUp();

for (final Map.Entry<String, Boolean> entry : dfpFromLookUp.entrySet()) {
writer.write(entry.getKey() + ":" + entry.getValue() + "\n");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SeparatorConstants here


dfpFile = new File(filePath);

try (BufferedReader reader = new BufferedReader(new FileReader(dfpFile))) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

protected void componentOpened() {
final WindowManager windowManager = WindowManager.getDefault();

pcl = (PropertyChangeEvent evt) -> { // Fires when a view is floated or docked manually via the context menu.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameter final

final Dimension size;

switch (getModeName()) {
case "leftSlidingSide", "explorer", "navigator" -> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multiple values are to cover the multiple possible docked locations that could be assigned to a top component.

image

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();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread dfp.txt
@@ -0,0 +1,27 @@
Analytic View:false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
25.1% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants