package forms.server { import core.AbstractModel; import flash.events.Event; [ResourceBundle("server")] public class ServerModel extends AbstractModel { public const defaultSecurity:String = "none"; public const defaultVersion:String = ""; private var services:XML = ; public function get title() : String { return _node.Title; } [Bindable(event="titlePropertyChange")] [Bindable(event="nodeChange")] public function set title(newTitle:String) : void { _node.Title = newTitle; dispatchEvent(new Event("titlePropertyChange")); } public function get service() : String { return _node.Service; } [Bindable(event="servicePropertyChange")] [Bindable(event="nodeChange")] public function set service(newService:String) : void { if(newService != service) { _node.Service = newService; dispatchEvent(new Event("serviceChange")); } } [Bindable(event="nodeChange")] public function get validServices() : Array { var services:Array = new Array(); for each(var service:XML in this.services.children()) { services.push(service.@label.toString()); } return services; } public function get version() : String { return _node.Version; } [Bindable(event="versionPropertyChange")] [Bindable(event="nodeChange")] public function set version(newVersion:String) : void { _node.Version = newVersion; } [Bindable(event="serviceChange")] [Bindable(event="nodeChange")] public function get validVersions() : Array { var versions:Array = new Array(); for each(var version:XML in services.children().(@label == service).Version) { versions.push(version.@label.toString()); } return versions; } public function get security() : String { return _node.Security; } [Bindable(event="securityPropertyChange")] [Bindable(event="nodeChange")] public function set security(newSecurity:String) : void { _node.Security = newSecurity; dispatchEvent(new Event("securityPropertyChange")); } [Bindable(event="serviceChange")] [Bindable(event="nodeChange")] public function get validSecurities() : Array { var securities:Array = new Array(); for each(var security:XML in services.children().(@label == service).Security) { securities.push(security.@label.toString()); } return securities; } public function get proxy() : Boolean { return _node.Proxy == "t"; } [Bindable(event="proxyPropertyChange")] [Bindable(event="nodeChange")] public function set proxy(newProxy:Boolean) : void { _node.Proxy = newProxy ? "t" : "f"; dispatchEvent(new Event("proxyPropertyChange")); } public function get onlineResource() : String { return _node.Onlineresource; } [Bindable(event="onlineResourcePropertyChange")] [Bindable(event="nodeChange")] public function set onlineResource(newOnlineResource:String) : void { _node.Onlineresource = newOnlineResource; dispatchEvent(new Event("onlineResourcePropertyChange")); } public function get description() : String { return _node.Description; } [Bindable(event="descriptionPropertyChange")] [Bindable(event="nodeChange")] public function set description(newDescription:String) : void { _node.Description = newDescription; dispatchEvent(new Event("descriptionPropertyChange")); } [Bindable(event="nodeChange")] public function get owner() : String { return _node.Owner; } public function get scope() : String { return _node.Scope; } [Bindable(event="scopePropertyChange")] [Bindable(event="nodeChange")] public function set scope(newScope:String) : void { _node.Scope = newScope; dispatchEvent(new Event("scopePropertyChange")); } public function get validScopes() : Array { return ['public', 'private']; } } }