diff Lib/IMPL/DOM/Schema/Node.pm @ 381:ced5937ff21a

Custom getters/setters support method names in theirs definitions Initial support for localizable labels in DOM schemas
author cin
date Wed, 22 Jan 2014 16:56:10 +0400
parents 4ddb27ff4a0b
children 2f16f13b000c
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/Node.pm	Fri Jan 17 15:58:57 2014 +0400
+++ b/Lib/IMPL/DOM/Schema/Node.pm	Wed Jan 22 16:56:10 2014 +0400
@@ -6,32 +6,35 @@
 use IMPL::Class::Property;
 use IMPL::DOM::Property qw(_dom);
 
-BEGIN {
-    public _dom _direct property minOccur => prop_all;
-    public _dom _direct property maxOccur => prop_all;
-    public _dom _direct property type => prop_all;
-    public _dom _direct property name => prop_all;
-    public _dom _direct property display => prop_all;
-    public _dom _direct property display_no => prop_all;
-    public _dom _direct property display_blame => prop_all;
-}
+use IMPL::Const qw(:prop);
+use IMPL::declare {
+	base => [
+		'IMPL::DOM::Node' => sub {
+	        my %args = @_;
+	        delete @args{qw(
+	            minOccur
+	            maxOccur
+	            type
+	            name
+	        )} ;
+	        $args{nodeName} ||= 'Node';
+	        %args
+	    }
+	],
+	props => [
+		minOccur => { get => 1, set => 1, direct => 1, dom => 1},
+		maxOccur => { get => 1, set => 1, direct => 1, dom => 1},
+		type => { get => 1, set => 1, direct => 1, dom => 1},
+		name => { get => 1, set => 1, direct => 1, dom => 1},
+		label => { get => '_getLabel', direct => 1 }
+	]
+};
 
-our %CTOR = (
-    'IMPL::DOM::Node' => sub {
-        my %args = @_;
-        delete @args{qw(
-            minOccur
-            maxOccur
-            type
-            name
-            display
-            display_no
-            display_blame
-        )} ;
-        $args{nodeName} ||= 'Node';
-        %args
-    }
-);
+sub _getLabel {
+	my ($this) = @_;
+	
+	
+}
 
 sub CTOR {
     my ($this,%args) = @_;
@@ -40,9 +43,6 @@
     $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1;
     $this->{$type} = $args{type};
     $this->{$name} = $args{name} or die new IMPL::InvalidArgumentException('Argument is required','name');
-    $this->{$display} = $args{display} if $args{display};
-    $this->{$display_no} = $args{display_no} if $args{display};
-    $this->{$display_blame} = $args{display_blame} if $args{display};
 }
 
 sub Validate {