diff Lib/IMPL/Web/View/Metadata/BaseMeta.pm @ 367:608e74bc309f

form metadata, mostly done
author cin
date Tue, 03 Dec 2013 17:55:36 +0400
parents 935629bf80df
children 010ceafd0c5a
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/Metadata/BaseMeta.pm	Mon Dec 02 17:44:38 2013 +0400
+++ b/Lib/IMPL/Web/View/Metadata/BaseMeta.pm	Tue Dec 03 17:55:36 2013 +0400
@@ -6,7 +6,8 @@
 use IMPL::declare {
 	require => {
 		Exception => 'IMPL::Exception',
-		ArgException => '-IMPL::InvalidArgumentException'
+		ArgException => '-IMPL::InvalidArgumentException',
+		NotImplException => '-IMPL::NotImplementedException'
 	},
 	base => [
 		'IMPL::Object' => undef
@@ -14,8 +15,6 @@
 	props => [
 		model => PROP_RO,
 		modelType => PROP_RO,
-		holdingType => PROP_RO,
-		provider => PROP_RO,
 		name => PROP_RO,
 		label => PROP_RO,
 		container => PROP_RO,
@@ -27,27 +26,22 @@
 };
 
 sub CTOR {
-	my ($this,$provider,$model,$type,$args) = @_;
-	
-	$type ||= typeof($model);
+	my ($this,$model,$type,$args) = @_;
 	
-	die ArgException->new(provider => 'A provider must be specified');
-	
-	$this->provider($provider);
 	$this->model($model);
 	$this->modelType($type);
-	$this->childMap({});
+	$this->_childMap({});
 	
 	#mixin other args
 	if ($args) {
-		$this->$_($args->{$_}) foreach grep $args->{$_}, qw(name label container template holdingType);
+		$this->$_($args->{$_}) foreach grep $args->{$_}, qw(name label container template);
 	}
 }
 
 sub GetProperty {
 	my ($this,$name) = @_;
 	
-	$this->_PopulateProperties()
+	$this->GetProperties()
 		unless $this->_childNames;
 	
 	return $this->_childMap->{$name};
@@ -59,38 +53,38 @@
 	if ($this->_childNames) {
 		return [ map $this->_childMap->{$_}, @{$this->_childNames} ];
 	} else {
-		return $this->_PopulateProperties;
+		my @childNames;
+		my %childMap;
+		my @result; 
+	
+		foreach my $child (@{$this->PopulateProperties($this)}) {
+			$childMap{$child->name} = $child;
+			push @childNames, $child->name;
+			push @result, $child;
+		}
+		
+		$this->_childMap(\%childMap);
+		$this->_childNames(\@childNames);
+		return \@result;
 	}	
 }
 
-sub _PopulateProperties {
+sub PopulateProperties {
 	my ($this) = @_;
 	
-	my @childNames;
-	my %childMap;
-	my @result; 
-
-	foreach my $child (@{$this->provider->PopulateProperties($this)}) {
-		$childMap{$child->name} = $child;
-		push @childNames, $child->name;
-		push @result, $child;
-	}
-	
-	$this->_childMap(\%childMap);
-	$this->_childNames(\@childNames);
-	return \@result;
+	die NotImplException->new();
 }
 
 sub GetItems {
 	my ($this) = @_;
 	
-	return $this->provider->GetItems($this);
+	die NotImplException->new();
 }
 
 sub GetItem {
 	my ($this,$index) = @_;
 	
-	return $this->provider->GetItem($this,$index);
+	die NotImplException->new();
 }
 
 1;