Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed error with Save Window and context

  • Loading branch information...
commit f6286cc3392dd7931f10213cb99a9ccf697ac356 1 parent 32fa692
Ed Moore authored
BIN  bin-debug/StructureCreator.swf
View
Binary file not shown
4 src/com/structurecreator/MainContext.as
View
@@ -85,8 +85,10 @@ package com.structurecreator
{
//TODO open save profile box.
var _viewport:SaveProfileWindow = new SaveProfileWindow();
- //mediatorMap.createMediator(_viewport);
+ //
_viewport.open();
+
+ mediatorMap.createMediator(_viewport);
}
/**
19 src/com/structurecreator/events/DatabaseEvent.as
View
@@ -0,0 +1,19 @@
+package com.structurecreator.events
+{
+ import flash.events.Event;
+
+ public class DatabaseEvent extends Event
+ {
+ public static const DATABASE_UPDATED:String = 'databaseUpdated';
+
+ public function DatabaseEvent(type:String)
+ {
+ super(type);
+ }
+
+ override public function clone():Event
+ {
+ return new DatabaseEvent(type);
+ }
+ }
+}
4 src/com/structurecreator/services/DatabaseService.as
View
@@ -1,5 +1,6 @@
package com.structurecreator.services
{
+ import com.structurecreator.events.DatabaseEvent;
import com.structurecreator.model.CustomVariableModel;
import com.structurecreator.model.vo.CustomVariableVO;
@@ -59,6 +60,7 @@ package com.structurecreator.services
addStatement("INSERT INTO profiles (name) SELECT '" + name +"' WHERE NOT EXISTS (SELECT 1 FROM profiles WHERE name = '" + name + "');");
trace("Add Profile " + name);
execute();
+ eventDispatcher.dispatchEvent(new DatabaseEvent(DatabaseEvent.DATABASE_UPDATED));
}
/**
@@ -69,6 +71,7 @@ package com.structurecreator.services
currentProfileId = id;
addStatement("UPDATE profiles SET schema_file='" + schema_file + "' WHERE profile_id='" + id + "';");
execute();
+ eventDispatcher.dispatchEvent(new DatabaseEvent(DatabaseEvent.DATABASE_UPDATED));
}
/**
@@ -107,6 +110,7 @@ package com.structurecreator.services
}
execute();
+ eventDispatcher.dispatchEvent(new DatabaseEvent(DatabaseEvent.DATABASE_UPDATED));
}
/**
12 src/com/structurecreator/view/ProfileSelectMediator.as
View
@@ -1,5 +1,8 @@
package com.structurecreator.view
{
+ import com.structurecreator.events.DatabaseEvent;
+ import com.structurecreator.services.DatabaseService;
+
import flash.events.Event;
import org.robotlegs.mvcs.Mediator;
@@ -11,6 +14,9 @@ package com.structurecreator.view
[Inject]
public var view:ProfileSelect;
+ [Inject]
+ public var model:DatabaseService;
+
public function ProfileSelectMediator()
{
}
@@ -18,6 +24,12 @@ package com.structurecreator.view
override public function onRegister():void
{
eventMap.mapListener(view, Event.CHANGE, onChange);
+ eventDispatcher.addEventListener(DatabaseEvent.DATABASE_UPDATED, onDatabaseUpdated);
+ }
+
+ private function onDatabaseUpdated(e:DatabaseEvent):void
+ {
+
}
/**
3  src/com/structurecreator/view/saveprofile/SaveProfileWindowMediator.as
View
@@ -8,7 +8,7 @@ package com.structurecreator.view.saveprofile
public class SaveProfileWindowMediator extends Mediator
{
- [Iinject]
+ [Inject]
public var view:SaveProfileWindow;
public function SaveProfileWindowMediator()
@@ -18,6 +18,7 @@ package com.structurecreator.view.saveprofile
override public function onRegister():void
{
+ trace("Save Profile Window registered");
view.saveBtn.addEventListener(MouseEvent.CLICK, onSaveClick);
}
Please sign in to comment.
Something went wrong with that request. Please try again.