Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sapphire-dev] refreshing "visible when" conditions

Thanks for the suggestion, updateConditionState() worked great.  From now on I'll use forums for framework usage questions.  

On Thu, Feb 2, 2012 at 3:12 AM, Konstantin Komissarchik <konstantin.komissarchik@xxxxxxxxxx> wrote:

> How do I make sapphire "refresh" the visible when conditions?

 

Your condition should listen on its inputs. In this case, this enum property that you’ve created. When it detects a change, it should call its protected updateConditionState() method to refresh the value of the condition and trigger notices to those who are listening on the condition (the various UI components).

 

> or is there a better way to accomplish this thing without using visible when conditions on child nodes?

 

Yes, there is a better way to do this. You can use a heterogeneous element property instead. You will not need the enum property or the visible-when conditions. See the gallery sample under “Element Properties / Heterogeneous”.

 

I would prefer to use the forum for framework use questions like this one. I know the mailing list can be more convenient, but the forum is more accessible for all adopters. For most adopters, it is easier to search forums as many don’t even know how to locate the mailing list archives.

 

Thanks,

 

- Konstantin

 

 

From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Greg Amerson
Sent: Wednesday, February 01, 2012 2:44 AM
To: Sapphire project
Subject: [sapphire-dev] refreshing "visible when" conditions

 

In my model I have an element called <task> (aka ITask in sapphire model).   This element has as child xml element <assignments> that under it can have 4 possible elements types but they are mutually exclusive (XSD choice).  Only one of those 4 element types can be there at a time.  So I'm trying to figure out how to edit this visually.  What I have right now in my model is on the <task> content outline node I have 4 child content nodes (one for each element type) and each of those child nodes has a "visible when" condition.  The visible when condition just checks to see which of those 4 child types are currently in the model and returns true/false accordingly.  So when you have a task with a particular child node, only that child node shows up in the Content Node outline.

 

The problem is that the user needs to be able to change which of these 4 node types they want to specify.  I tried to do this with a enum type and a custom binding on the enum type (along with enum property editor to let them select which "type" of child they want).  In the custom enum binding I just want to mutate the underlying xmlResource based on which new child type they want to now specify.  The problem is that when the underlying model changes, the "visible when" conditions are not reevaluated to show that a new child node now needs to be displayed.

 

How do I make sapphire "refresh" the visible when conditions?  or is there a better way to accomplish this thing without using visible when conditions on child nodes?

 

Thanks!

 

--

Greg Amerson

Liferay, Inc.


_______________________________________________
sapphire-dev mailing list
sapphire-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/sapphire-dev




--
Greg Amerson
Liferay, Inc.


Back to the top