Code Snippet: Getting a components preferences

Making your components data driven is a key area of composite applications.  This gives the assembler the ability to change the characteristics of your component at assembly time.

Getting a components preferences

1 thought on “Code Snippet: Getting a components preferences

  1. What is the best practice for updating a preference? I’ve been using this:

    IEditModeController emc = AAFPlugin.getEditModeController();
    IComponentManager cm = emc.getComponentManager();
    String entityId =

    ComponentPreferenceManager cpm = new ComponentPreferenceManager(cm.getComponentAttrList(entityId), entityId);

    ComponentPreference cp = cpm.findPreference(key);

    if (cp != null )
    cpm.addPref(key, value);

    cm.setComponentAttrList(cpm.getValues(), entityId);

    Is there a more streamlined way? Also, ComponentData does not reflect the new/updated preference, so I have to use ComponentPreferenceManager to get preferences after updating them.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.