Class WysiwygConfigurationUpdate


  • public class WysiwygConfigurationUpdate
    extends java.lang.Object
    Define the update to do on the WYSIWYG Configuration.
    This class is to be used in WysiwygPolicyFilter.updateWysiwygConfiguration(String).
    Example:
     public class MyBasicWysiwygPolicyFilter extends BasicWysiwygPolicyFilter {
       @Override
       public List<WysiwygConfigurationUpdate> updateWysiwygConfiguration(String configId) {
         List<WysiwygConfigurationUpdate> list = new ArrayList<WysiwygConfigurationUpdate>();
         
         // Add a new toolbar item before the item 'undo'
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.INSERT_TOOLBAR_ITEM_BEFORE)
                                             .setData("item", "itembefore1").setData("item-before", "undo"));
         
         // Add a new toolbar item after the item 'undo'
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.INSERT_TOOLBAR_ITEM_AFTER)
                                             .setData("item", "itemafter1").setData("item-after", "undo"));
         
         if("config1".equals(configId)) {
           // Remove the item 'aligncenter' from the toolbar
           list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.REMOVE_TOOLBAR_ITEM).setData("item", "aligncenter"));
         }
         
         // Add a new toolbar at first
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.INSERT_TOOLBAR).setData("index", 0).setData("toolbar", "item1 item2 item3"));
         // Add a new toolbar at last
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.INSERT_TOOLBAR).setData("index", -1).setData("toolbar", "item7 item8 item9"));
         
         // Remove the second toolbar
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.REMOVE_TOOLBAR).setData("index", 1));
         
         // Add new item group in the first toolbar at the beginning
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.INSERT_TOOLBAR_GROUP)
                                             .setData("index", 0).setData("toolbar-index", 0).setData("group", "newitem1 newitem2"));
         // Add new item group in the second toolbar at the index 2 (3rd position)
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.INSERT_TOOLBAR_GROUP)
                                             .setData("index", 2).setData("toolbar-index", 1).setData("group", "newitem3 newitem4"));
         
         // Remove the first item group from the first toolbar
         list.add(WysiwygConfigurationUpdate.newInstance(UpdateAction.REMOVE_TOOLBAR_GROUP).setData("index", 0).setData("toolbar-index", 0));
         
         return list;
       }
     }