Skip to content

Control indentation of nested projects by UIManager properties - #9627

Open
jtulach wants to merge 4 commits into
apache:masterfrom
jtulach:jtulach/UIManagerForNestedProjects
Open

jtulach wants to merge 4 commits into
apache:masterfrom
jtulach:jtulach/UIManagerForNestedProjects

Conversation

@jtulach

@jtulach jtulach commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@jtulach jtulach self-assigned this Sep 18, 2026
@jtulach jtulach added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Project UI View labels Sep 18, 2026
Comment thread ide/projectui/src/org/netbeans/modules/project/ui/ProjectsLaF.java Outdated
Comment thread ide/projectui/src/org/netbeans/modules/project/ui/ProjectsLaF.java Outdated
Comment thread ide/projectui/src/org/netbeans/modules/project/ui/ProjectsLaF.java Outdated

@neilcsmith-net neilcsmith-net left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Looks good on reading. Not tested yet. Probably needs squashing before merge.

Handles my concerns about customization / disabling the display. I still think the node prefixing approach is flawed against filtering the hierarchy, but if everyone else is on the board with the current approach then this is good to go.

Please don't merge this until @mbien has followed up here or on the sorting review though, just in case that gets complicated in master.

@mbien mbien added this to the NB32 milestone Sep 21, 2026
@mbien

mbien commented Sep 21, 2026

Copy link
Copy Markdown
Member

tested:

# no indentation (use quotes otherwise it is null)
nb.project.indentation=""

# friendship mode worked too
nb.project.indentation=""

while testing I was wondering if we should split it into three properties: prefix, repeat and postfix?

e.g a user could customize it like:

image

added bonus is that even without using a prefix, this can produce very compact indentation since there is no need to add whitespace to the arrow. The whitespace can be in the postfix.

nb.project.indentation.prefix=""
nb.project.indentation.repeat="»"
nb.project.indentation.postfix=" "
image

pipleline symbols:

nb.project.indentation.prefix=""
nb.project.indentation.repeat=""
nb.project.indentation.postfix=" "
image

dark theme / expanded:

image

dots with space in repeat (just like with the arrow now):

nb.project.indentation.prefix=""
nb.project.indentation.repeat=""
nb.project.indentation.postfix=""
image

pacman would work too but my font doesn't support that symbol :(
pacman

code ( + formatted using 4 spaces):

Details
    static String indentationPrefix(boolean html, int depth) {
        String prefix = UIManager.getString("nb.project.indentation.prefix"); // NOI18N
        if (prefix == null) {
            prefix = "";
        }
        String repeat = UIManager.getString("nb.project.indentation.repeat"); // NOI18N
        if (repeat == null) {
            repeat = "\u00bb";
        }
        String postfix = UIManager.getString("nb.project.indentation.postfix"); // NOI18N
        if (postfix == null) {
            postfix = " ";
        }
        if (depth <= 0 || (prefix.isEmpty() && repeat.isEmpty() && postfix.isEmpty())) {
            return "";
        }
        if (html) {
            try {
                String xml = XMLUtil.toElementContent(prefix + repeat.repeat(depth) + postfix);
                return "<font color='!controlShadow'>" + xml + "</font>";
            } catch (CharConversionException ex) {
                throw new IllegalStateException(ex);
            }
        } else {
            return prefix + repeat.repeat(depth) + postfix;
        }
    }

just an idea - is this too much flexibility?

@neilcsmith-net

Copy link
Copy Markdown
Member

just an idea - is this too much flexibility?

I'm tempted to say, yes too much, except that pipeline example does look quite nice!

I'm curious where the null is coming from for the empty String. FlatLaf issue?

@mbien

mbien commented Sep 21, 2026

Copy link
Copy Markdown
Member

I'm curious where the null is coming from for the empty String. FlatLaf issue?

likely. Something seems to equate "" with null during parsing. Plain old properties don't do that usually.

I'm tempted to say, yes too much, except that pipeline example does look quite nice!

yeah I like that one too. The reason I experimented with this is because it looked like the symbol+space pattern appears to be fairly limiting in what symbols you can use. Sometimes you want to repeat a symbol and postfix a space, other times you want to repeat the space and add a symbol at the end - or use different symbols like in that pipeline.

@neilcsmith-net

Copy link
Copy Markdown
Member

Something seems to equate "" with null during parsing. Plain old properties don't do that usually.

Yes, I know. I was surprised reading that as I thought that was how we'd tell people to switch it off. Still, as long as we know, we can explain.

At a guess it's due to the code at https://github.com/JFormDesigner/FlatLaf/blob/e735c4898e6772c734229c688976faceab1bdfc8/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java#L461 Makes sense given the values are typed I suppose, or maybe intended to allow override removal.

@jtulach

jtulach commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, the pipeline symbol looks pretty nice:

nb.project.indentation.prefix=""
nb.project.indentation.repeat=""
nb.project.indentation.postfix=" "
image image

I don't mind changing the algorithm to use prefix, repeat and postfix UI manager keys. Done in bb682d9

@mbien mbien added the UI User Interface label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Need Squashing Project UI View UI User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants