Reformat dates. Surprisingly limited options for parsing and displaying dates.
[potlatch2.git] / net / systemeD / potlatch2 / controller / SelectedMarker.as
1 package net.systemeD.potlatch2.controller {
2         import flash.events.*;
3         import flash.ui.Keyboard;
4     import net.systemeD.potlatch2.EditController;
5     import net.systemeD.halcyon.connection.*;
6     import net.systemeD.halcyon.VectorLayer;
7         import net.systemeD.halcyon.Globals;
8
9     public class SelectedMarker extends ControllerState {
10         protected var initMarker:Marker;
11         protected var layer:VectorLayer;
12
13         public function SelectedMarker(marker:Marker, layer:VectorLayer) {
14             initMarker = marker;
15             this.layer = layer;
16         }
17
18         protected function selectMarker(marker:Marker):void {
19             if ( firstSelected is Marker && Marker(firstSelected)==marker )
20                 return;
21
22             clearSelection(this);
23             controller.map.setHighlight(marker, { selected: true });
24             selection = [marker];
25             controller.updateSelectionUI(layer);
26             initMarker = marker;
27         }
28
29         protected function clearSelection(newState:ControllerState):void {
30             if ( selectCount ) {
31                 controller.map.setHighlight(firstSelected, { selected: false });
32                 selection = [];
33                 if (!newState.isSelectionState()) { controller.updateSelectionUI(); }
34             }
35         }
36
37         override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
38                         if (event.type==MouseEvent.MOUSE_MOVE) { return this; }
39             if (event.type==MouseEvent.MOUSE_UP) { return this; }
40                         var cs:ControllerState = sharedMouseEvents(event, entity);
41                         return cs ? cs : this;
42         }
43
44                 override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
45                         switch (event.keyCode) {
46                         }
47                         var cs:ControllerState = sharedKeyboardEvents(event);
48                         return cs ? cs : this;
49                 }
50
51                 public function deletePOI():ControllerState {
52                         return new NoSelection();
53                 }
54
55         override public function enterState():void {
56             selectMarker(initMarker);
57                         controller.map.setPurgable(selection,false);
58                         Globals.vars.root.addDebug("**** -> "+this);
59         }
60
61         override public function exitState(newState:ControllerState):void {
62                         controller.clipboards['marker']=firstSelected.getTagsCopy();
63                         controller.map.setPurgable(selection,true);
64             clearSelection(newState);
65                         Globals.vars.root.addDebug("**** <- "+this);
66         }
67
68         override public function toString():String {
69             return "SelectedMarker";
70         }
71
72     }
73 }