I implemented a picklist in my Project.
I tried to change the logic of this view to fit my actions. I want to leave the SourceList as it is and only change the targetList if the given itemScope isn't already in targetList.
My approach:
public void onTransfer(TransferEvent event) {
// wenn wir eine Sprache aktivieren möchten, sollte die sprache nicht
// aus der source entfernt werden
if (event.isAdd()) {
List<String> itemsInScope = (List<String>) event.getItems();
itemsInScope.addAll(languages.getSource());
languages.setSource(itemsInScope);
for(String s : languages.getSource())
System.out.println(s);
}
settingsObject.setActiveLanguages(languages.getTarget());
settingsObject.setSupportedLanguages(languages.getSource());
TranslationConfig conf1 = new TranslationConfigManager().getSettings();
conf1.setActiveLanguages(languages.getTarget());
conf1.setSupportedLanguages(languages.getSource());
new TranslationConfigManager().updateSetting(conf1);
}
This works logically with the DualList because it returns the right filled List, but its kinda a workaround and dirty. The Problem here is it still removes the Item in the view.
Is my approach even possible?