summaryrefslogtreecommitdiff
path: root/demos/composer/protected/pages/Home.php
diff options
context:
space:
mode:
authorxue <>2006-01-12 03:22:03 +0000
committerxue <>2006-01-12 03:22:03 +0000
commite126c0067e9efee6542d08bf649588e2cf3a5924 (patch)
treee1b14841cfdf8f05ce307ff9d63e8d2a466999a7 /demos/composer/protected/pages/Home.php
parenta06e326f247bff617191b1c87a7b004414495275 (diff)
Fixed several issues about viewstate handling. Prado Composer is nearly completed.
Diffstat (limited to 'demos/composer/protected/pages/Home.php')
-rw-r--r--demos/composer/protected/pages/Home.php67
1 files changed, 36 insertions, 31 deletions
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);