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


One 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

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s