source: EDIS/tags/ed/tracking-ui-core/src/main/flex/gov/va/med/edp/command/config/AddBoardCommand.as@ 1240

Last change on this file since 1240 was 1240, checked in by George Lilly, 13 years ago

new version from the VA

File size: 1.1 KB
Line 
1/* AddBoardCommand.as */
2
3package gov.va.med.edp.command.config
4{
5 import com.adobe.cairngorm.commands.ICommand;
6 import com.adobe.cairngorm.control.CairngormEvent;
7
8 import gov.va.med.edp.model.TrackingModelLocator;
9 import gov.va.med.edp.vo.LookupVO;
10
11 public class AddBoardCommand implements ICommand
12 {
13 private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
14
15 public function execute(event:CairngormEvent):void
16 {
17 // make sure we have a unique temporary name
18 var boardName: String;
19 for (var i: int = 1; i < 1000; i++) {
20 boardName = "New-" + i;
21 var dupFound: Boolean = false;
22 for each (var board: LookupVO in model.config.boards) {
23 if (board.label == boardName) {
24 dupFound = true;
25 break;
26 }
27 }
28 if (!dupFound) break;
29 }
30
31 // add a new board entry (config will be based on last selected board)
32 var newBoard: LookupVO = new LookupVO;
33 newBoard.data = 0;
34 newBoard.label = boardName;
35 model.config.boards.addItem(newBoard);
36 model.config.boardIndex = model.config.boards.getItemIndex(newBoard);
37 model.config.boardMods = true;
38 }
39 }
40}
Note: See TracBrowser for help on using the repository browser.