= selections.dataProvider.length) return;
if (newIndex != selections.selectedIndex) {
reordering = true;
var list: ArrayCollection = selections.dataProvider as ArrayCollection;
var sel: Object = list.removeItemAt(selections.selectedIndex);
list.addItemAt(sel, newIndex);
selections.selectedIndex = -1;
}
}
private function addEntry(): void
{
if (availLists.selectedIndex < 0) return;
//TODO: post event to model instead of just updating dataprovider
newCount++;
var list: ArrayCollection = selections.dataProvider as ArrayCollection;
var newEntry: CodeSelectionVO = new CodeSelectionVO();
newEntry.displayName = "new" + newCount;
newEntry.id = 0;
list.addItem(newEntry);
setModifiedFlags();
if (AccessibilityTools.isAccessibilityActive()) InfoDialog.show("New Item Added", "Message", true);
var newIndex: int = list.length - 1;
selections.scrollToIndex(newIndex);
selections.selectedIndex = newIndex;
}
private function saveChanges(): void
{
for each (var selectionList:SelectionListDescriptor in selectionLists) {
for each (var code:CodeSelectionVO in selectionList.list) {
if (code.displayName == null || code.displayName.length == 0) {
InfoDialog.show("There are selection list items with blank names which must be corrected before saving.\n"
, "Required Names", false, btnSaveSelectionChanges);
return;
}
}
}
var e:ConfigurationEvent =
new ConfigurationEvent(ConfigurationEvent.EVENT_SAVE_SELECTION_CONFIG);
e.dispatch();
}
private function handleEscKey(event:KeyboardEvent): void {
if (event.keyCode == Keyboard.ESCAPE) {
selections.selectedIndex = -1;
availLists.selectedIndex = -1;
if (btnSaveSelectionChanges.enabled)
btnSaveSelectionChanges.setFocus();
else
availLists.setFocus();
}
}
private function done():void {
selections.selectedIndex = -1;
if (btnSaveSelectionChanges.enabled)
btnSaveSelectionChanges.setFocus();
else
selections.setFocus();
}
private function doDragDrop(event:DragEvent):void {
reordering = true;
}
]]>