1 | /* ConfigChangeColumnCommand.as */
|
---|
2 |
|
---|
3 | package 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.control.config.ConfigChangeColumnEvent;
|
---|
9 | import gov.va.med.edp.model.TrackingModelLocator;
|
---|
10 | import gov.va.med.edp.vo.ColumnSpecVO;
|
---|
11 | import gov.va.med.edp.util.BoardTools;
|
---|
12 |
|
---|
13 | public class ConfigChangeColumnCommand implements ICommand
|
---|
14 | {
|
---|
15 | private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
|
---|
16 |
|
---|
17 | public function execute(event:CairngormEvent):void
|
---|
18 | {
|
---|
19 | var changeEvent: ConfigChangeColumnEvent = ConfigChangeColumnEvent(event);
|
---|
20 | if (changeEvent.type == ConfigChangeColumnEvent.EVENT_CONFIG_CHANGE_COLUMN_SEQ) {
|
---|
21 | var colSpec: Object = model.config.columns.removeItemAt(changeEvent.oldIndex);
|
---|
22 | model.config.columns.addItemAt(colSpec, changeEvent.newIndex);
|
---|
23 | }
|
---|
24 | if (changeEvent.type == ConfigChangeColumnEvent.EVENT_CONFIG_CHANGE_COLUMN_WIDTH) {
|
---|
25 | for (var i:int = 0; i < changeEvent.widths.length; i++) {
|
---|
26 | ColumnSpecVO(model.config.columns[i]).width = changeEvent.widths[i];
|
---|
27 | }
|
---|
28 | }
|
---|
29 | if (changeEvent.type == ConfigChangeColumnEvent.EVENT_CONFIG_CHANGE_ROW_COLOR) {
|
---|
30 | model.config.rowColorMap =
|
---|
31 | BoardTools.locateColorMap(changeEvent.rowColor, model.config.colorMaps);
|
---|
32 | }
|
---|
33 | model.config.boardMods = true;
|
---|
34 | trace("change column");
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|