Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sapphire-dev] Sapphire question

Take a look at CheckBoxListPropertyEditorRenderer. I am in a middle of something right now. Not seeing a listener there on PossibleValuesService, but maybe I missed it. Please confirm, open a bug and work on a fix. Let me review the changes before you push.

- Konstantin


-----Original Message-----
From: Ling Hao [mailto:ling.hao@xxxxxxxxxx] 
Sent: Friday, March 22, 2013 4:37 PM
To: Konstantin Komissarchik
Subject: Re: Sapphire question

I'm trying to fix the bug in which product changes the component in the query page you wrote:

So I'm getting the "handleTypedEvent" when I modify the product. But no one is calling fillPossibleValues(..)


     public static final class ComponentPossibleValuesService extends 
QueryTermsPossibleValuesService
     {
         @Override
         protected void init()
         {
             super.init();

             context( CustomQueryTerms.class ).attach
             (
                 new FilteredListener<PropertyContentEvent>()
                 {
                     @Override
                     protected void handleTypedEvent( final 
PropertyContentEvent event )
                     {
                         System.out.println("handleTypedEvent" + event);
                         broadcast();
                     }
                 },
                 CustomQueryTerms.PROP_PRODUCTS
             );
         }

         @Override
         protected void fillPossibleValues( final Set<String> values )
         {
             final RepositoryConfiguration configuration = configuration();

             if( configuration != null )
             {
                 System.out.println("fillPossibleValues");
                 CustomQueryTerms queryTerms = context( 
CustomQueryTerms.class );
                 for (ProductListEntry entry : queryTerms.getProducts()) {
                     System.out.println("product: " + 
entry.getProduct().getContent());
                     Product product = 
getProduct(entry.getProduct().getContent(), configuration);
                     for( Component component : 
configuration.getComponents(product) )
                     {
                         final String name = component.getName();
                         if (!values.contains(name))
                             values.add( name );
                     }
                 }
//                for( Component component : configuration.getComponents() )
//                {
//                    values.add( component.getName() );
//                }
             }
         }
     }

On 3/22/2013 4:33 PM, Konstantin Komissarchik wrote:
> Calling broadcast() should do the trick. What's not working? Which Sapphire version?
>
> - Konstantin
>
>
> -----Original Message-----
> From: Ling Hao [mailto:ling.hao@xxxxxxxxxx]
> Sent: Friday, March 22, 2013 4:30 PM
> To: Konstantin Komissarchik
> Subject: Sapphire question
>
> I'm trying to update the list of possible values in my custom PossibleValuesService. I added a listener in the init(), at which point I want to update the list of possible values. How? (I tried broadcast(), and refresh() without success)
>
> Thanks,
> Ling
>




Back to the top