public void setPaletteCustomization(PaletteCustomization prefs) { try { JSONObject jsonObject = null; if (prefs != null) { jsonObject = new JSONObject(); if (prefs.drawers != null) { jsonObject.put(PaletteCustomization.DRAWERS, prefs.drawers); } if (prefs.drawerEntries != null && prefs.drawerEntries.size() > 0) { jsonObject.put(PaletteCustomization.DRAWER_ENTRIES, prefs.drawerEntries); } if (prefs.entryProperties != null && prefs.entryProperties.size() > 0) { jsonObject.put(PaletteCustomization.ENTRY_PROPERTIES, prefs.entryProperties); } } if (jsonObject != null && jsonObject.keys().hasNext()) { setProperty( PALETTE_CUSTOMIZATION_SETTING, ServoyJSONObject.toString(jsonObject, false, false, false)); } else { removeProperty(PALETTE_CUSTOMIZATION_SETTING); } } catch (JSONException e) { ServoyLog.logError("Could not save palette preferences", e); } }