Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Trigger ValueImageService programmatically
Trigger ValueImageService programmatically [message #1075516] Mon, 29 July 2013 11:09 Go to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey,

I was wondering if could trigger programmatically the revalidation of my ValueImageService implementation for a certain property.

I have two properties that depend on each other - lets say A and B. Both have a ValueImageService implementation. If I update A, its ValueImageService implementation is called property. Unfortunately, the ValueImageService of B is not called.

I specified the @DependsOn between A and B.

Thank you.

Kon
Re: Trigger ValueImageService programmatically [message #1075554 is a reply to message #1075516] Mon, 29 July 2013 12:21 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
ValueImageService is not designed to be dynamic (change its output for a given value over time). Your scenario may be a better fit for the ImageService, that you attach to an element as opposed to a property. Take a look at ContactImageService for an example on how to write an implementation that reacts to the state of the model.
Re: Trigger ValueImageService programmatically [message #1075851 is a reply to message #1075554] Tue, 30 July 2013 03:41 Go to previous messageGo to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey Konstantin,

thank you for your reply. I've checked the ImageService and it is recomputed on every change. In my model also dependent properties need to be updated as well.

I have a custom validation service that proofs for uniqueness against other dependent properties.

index.php/fa/15757/0/

If I change the content of the second element, my custom validation service will notice that the first element also has the same content and return Status.createErrorStatus(....). The transparent row icon will be replaced with the error icon.

index.php/fa/15758/0/

My custom validation service is also performed on the first element then I specified @DependsOn on this. It recognizes that the second element also has the same content and also returns Status.createErrorStatus(....). Unfortunately the transparent icon is still shown.

And this is actually what I'm trying to achieve. I clicked on the column header, it apparently triggers the row icon to be redrawn.

index.php/fa/15759/0/

This is the value property that is used within a ListProperty.

@Image(path = "icons/transparent.gif")
public interface IDType extends Element {
    ElementType TYPE = new ElementType(IDType.class);

    // *** Id (ATTRIBUTE) ***

    @XmlBinding(path = "@id")
    @Label(standard = "Id")
    @Whitespace(trim = true)
    @Required
    @DependsOn({ "/Id", "/a/Id", "/a/b/Id" })
    @Service(impl = IDValidationService.class)
    ValueProperty PROP_ID = new ValueProperty(TYPE, "Id");

    Value<String> getId();

    void setId(String value);
}


How can I trigger a refresh on the first element? Thank you! Smile

Kon
Re: Trigger ValueImageService programmatically [message #1075916 is a reply to message #1075851] Tue, 30 July 2013 06:20 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
I am not following what you are trying to do and I've never seen image refresh being affected by clicking on the column header. Could you attach a full repro?
Re: Trigger ValueImageService programmatically [message #1075963 is a reply to message #1075916] Tue, 30 July 2013 08:11 Go to previous messageGo to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey Konstantin,

I attached my sample project as zip file and made a further screen shot showing the refreshed list after clicking the column header:

index.php/fa/15768/0/

Thank you.

Kon
Re: Trigger ValueImageService programmatically [message #1076106 is a reply to message #1075963] Tue, 30 July 2013 14:12 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
This appears to be a bug in the list property editor. It provides the row-level validation marker, but doesn't actually listen for validation events. The image is only updated when the content of one of the column properties changes.
Re: Trigger ValueImageService programmatically [message #1076218 is a reply to message #1076106] Tue, 30 July 2013 20:38 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
Thanks for the repro. I have fixed the issue. Please verify.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=414077
Re: Trigger ValueImageService programmatically [message #1076316 is a reply to message #1076218] Wed, 31 July 2013 02:48 Go to previous messageGo to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey Konstantin,

now it is working. Thank you for the fix.

Kon

Re: Trigger ValueImageService programmatically [message #1076542 is a reply to message #1076316] Wed, 31 July 2013 11:03 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
Would you mind changing the bug status as verified with a brief note of what you did to confirm the behavior.
Re: Trigger ValueImageService programmatically [message #1079932 is a reply to message #1076542] Mon, 05 August 2013 04:52 Go to previous message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
I just did. Thank you Smile
Previous Topic:How to programmatically call "Sapphire.Add" or "Sapphire.Browse"
Next Topic:SapphireEditor never dirty without SourceEditor
Goto Forum:
  


Current Time: Sat Aug 02 02:36:04 EDT 2014

Powered by FUDForum. Page generated in 0.07051 seconds