Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354411

Summary: Sapphire properties page should support "visible when" condition
Product: z_Archived Reporter: Shenxue Zhou <shenxue.zhou>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Shenxue Zhou CLA 2011-08-10 12:35:37 EDT
I'm running into a use case where I need to show/hide certain properties pages depending on certain conditions on the selected diagram node. While we can attach a visible condition to a property editor, there is currently no mechanism to show/hide properties pages.
Comment 1 Konstantin Komissarchik CLA 2011-09-12 13:42:41 EDT
Enhancement implemented in 0.3.1 and 0.4 streams. See content in the enhancements doc and the architecture sample (the provider properties view page under component).

Please verify.
Comment 2 Shenxue Zhou CLA 2011-09-14 14:07:49 EDT
I just tried this new feature. It works on simple cases. But I encountered a problem with my diagram properties page. It has the following pages:

1. general
2. description
3. managed beans
4. parameters
5. return values
6. behavior
7. metadata resources

Page 4, 5, 6 and 7 all have <visible-when> expressions. Page 4, 5 and 6's expression happen to be the toggle of page 7's expression. When page 4, 5 and 6 don't display, page 7 will display. But what's displayed for page 7 is page 4's content.

I was very puzzled by this behavior and it took me more than an hour trying to understand what's going on. Finally I realized there must be a logic error in determining what's displayed for a page when there are a few visible-when expressions.
Comment 3 Konstantin Komissarchik CLA 2011-09-14 14:17:53 EDT
Could you provide a repro as the scenario that I setup doesn't exhibit this problem?
Comment 4 Shenxue Zhou CLA 2011-09-14 14:41:01 EDT
(In reply to comment #3)
> Could you provide a repro as the scenario that I setup doesn't exhibit this
> problem?

If you change the architecture sample diagram's properties pages to the following:

        <properties-view>
            <page>
                <label>general</label>
                <content>
                    <property-editor>DetailLevel</property-editor>
                    <property-editor>
                        <property>Description</property>
                        <hint>
                            <name>expand.vertically</name>
                            <value>true</value>
                        </hint>
                    </property-editor>
                </content>
            </page>
            <page>
                <label>Detail</label>
                <visible-when>${false}</visible-when>
                <content>
                    <property-editor>DetailLevel</property-editor>
                </content>
            </page>
            <page>
                <label>Description</label>
                <visible-when>${true}</visible-when>
                <content>
                    <property-editor>Description</property-editor>
                </content>
            </page>
        </properties-view>

You'll see what's displayed for Detail page is actually Description
Comment 5 Shenxue Zhou CLA 2011-09-14 14:44:43 EDT
In my previous comment, I meant what's displayed for Description page is Detail
Comment 6 Konstantin Komissarchik CLA 2011-09-15 21:32:56 EDT
Thanks for an easy repro. Fixed in 0.3.1 and 0.4 streams.
Comment 7 Shenxue Zhou CLA 2011-09-16 13:53:47 EDT
Verified the fix