From e126c0067e9efee6542d08bf649588e2cf3a5924 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 12 Jan 2006 03:22:03 +0000 Subject: Fixed several issues about viewstate handling. Prado Composer is nearly completed. --- demos/composer/protected/pages/Home.page | 45 ++++++++++++++------- demos/composer/protected/pages/Home.php | 67 +++++++++++++++++--------------- 2 files changed, 67 insertions(+), 45 deletions(-) (limited to 'demos/composer') diff --git a/demos/composer/protected/pages/Home.page b/demos/composer/protected/pages/Home.page index b446abd2..ae4149ee 100644 --- a/demos/composer/protected/pages/Home.page +++ b/demos/composer/protected/pages/Home.page @@ -2,29 +2,31 @@ -class -extends +class +Page->ClassDefinition->ClassName%> + CssClass="slTextBox"/> +extends +Page->ClassDefinition->ParentClass%> + CssClass="slTextBox"/> implements - + - + - @@ -49,11 +51,21 @@ implements + @@ -65,13 +77,18 @@ Event Definitions:
Comments -( -Author Name: -Author Email: -)

+Author Name +Page->ClassDefinition->Author%> + CssClass="slTextBox"/> +Author Email +Page->ClassDefinition->Email%> + CssClass="slTextBox"/> +
 
diff --git a/demos/composer/protected/pages/Home.php b/demos/composer/protected/pages/Home.php
index 3c2b4d22..e0112fd7 100644
--- a/demos/composer/protected/pages/Home.php
+++ b/demos/composer/protected/pages/Home.php
@@ -20,24 +20,29 @@ class Home extends TPage
 			$properties[]=new PropertyDefinition;
 			$properties[]=new PropertyDefinition;
 			$properties[]=new PropertyDefinition;
-			$this->PropertyList->setDataSource($properties);
+			$this->PropertyList->DataSource=$properties;
 			$this->dataBind();
 		}
 	}
 
-	/*
-	public function onLoad($param)
+	protected function refresh()
 	{
-		parent::onLoad($param);
-		if(!$this->IsPostBack)
+		$this->PropertyList->DataSource=$this->ClassDefinition->Properties;
+		$this->dataBind();
+	}
+
+	public function itemAction($sender,$param)
+	{
+		if($param->CommandName==='remove')
 		{
-			$this->PropertyList->setDataSource($this->getInitialProperties());
-			$this->PropertyList->dataBind();
+			$this->ClassDefinition->Properties->removeAt($param->CommandParameter);
 		}
-		else
-			$this->PropertyList->ensureChildControls();
+		else if($param->CommandName==='add')
+		{
+			$this->ClassDefinition->Properties->insert($param->CommandParameter+1,new PropertyDefinition);
+		}
+		$this->refresh();
 	}
-	*/
 
 	public function onLoad($param)
 	{
@@ -45,32 +50,32 @@ class Home extends TPage
 		//if($this->IsPostBack && $this->IsValid)
 		if($this->IsPostBack)
 		{
-			$this->PropertyList->ensureChildControls();
+			$def=$this->ClassDefinition;
+			$def->reset();
+			$def->ClassName=$this->ClassName->Text;
+			$def->ParentClass=$this->ParentClass->Text;
+			$def->Interfaces=$this->Interfaces->Text;
+			$def->Comments=$this->Comments->Text;
+			$def->Author=$this->AuthorName->Text;
+			$def->Email=$this->AuthorEmail->Text;
+			foreach($this->PropertyList->Items as $item)
+			{
+				$property=new PropertyDefinition;
+				$property->Name=$item->PropertyName->Text;
+				$property->Type=$item->PropertyType->Text;
+				$property->DefaultValue=$item->DefaultValue->Text;
+				$property->ReadOnly=$item->ReadOnly->Checked;
+				$property->IsProtected=$item->IsProtected->Checked;
+				$property->Comments=$item->Comments->Text;
+				$property->Storage=$item->Storage->Text;
+				$def->Properties[]=$property;
+			}
 		}
 	}
 
 	public function generateCode($sender,$param)
 	{
-		$def=$this->ClassDefinition;
-		$def->reset();
-		$def->ClassName=$this->ClassName->Text;
-		$def->ParentClass=$this->ParentClass->Text;
-		$def->Interfaces=$this->Interfaces->Text;
-		$def->Comments=$this->Comments->Text;
-		$def->Author=$this->AuthorName->Text;
-		$def->Email=$this->AuthorEmail->Text;
-		foreach($this->PropertyList->Items as $item)
-		{
-			$property=new PropertyDefinition;
-			$property->Name=$item->PropertyName->Text;
-			$property->Type=$item->PropertyType->Text;
-			$property->DefaultValue=$item->DefaultValue->Text;
-			$property->ReadOnly=$item->ReadOnly->Checked;
-			$property->IsProtected=$item->IsProtected->Checked;
-			$property->Comments=$item->Comments->Text;
-			$property->Storage=$item->Storage->Text;
-			$def->Properties[]=$property;
-		}
+		$this->refresh();
 		$writer=Prado::createComponent('System.IO.TTextWriter');
 		$this->ClassDefinition->render($writer);
 		$this->SourceCode->Text=highlight_string($writer->flush(),true);
-- 
cgit v1.2.3

Accessibility Name Type Default Value Storage ModeAccessibility Comments Actions
- Parent->DataItem->IsProtected %> /> - Parent->DataItem->ReadOnly %> /> - Parent->DataItem->Name %> CssClass="slTextBox"/> + Parent->DataItem->IsProtected %> /> + Parent->DataItem->ReadOnly %> /> + Parent->DataItem->Comments %> CssClass="slTextBox"/> - - + Parent->ItemIndex %> /> + Parent->ItemIndex %> />