summaryrefslogtreecommitdiff
path: root/demos/composer/protected
diff options
context:
space:
mode:
Diffstat (limited to 'demos/composer/protected')
-rw-r--r--demos/composer/protected/pages/Home.page51
-rw-r--r--demos/composer/protected/pages/Home.php28
2 files changed, 67 insertions, 12 deletions
diff --git a/demos/composer/protected/pages/Home.page b/demos/composer/protected/pages/Home.page
index 65391bd5..e7d7eea0 100644
--- a/demos/composer/protected/pages/Home.page
+++ b/demos/composer/protected/pages/Home.page
@@ -14,6 +14,9 @@ implements <com:TTextBox ID="Interfaces" CssClass="slTextBox"/>
</com:TPanel>
<com:TPanel GroupingText="Property Definitions">
+<com:TRepeater ID="PropertyList" ItemCommand="itemAction">
+
+<prop:HeaderTemplate>
<table>
<tr>
<th>Name</th>
@@ -24,7 +27,12 @@ implements <com:TTextBox ID="Interfaces" CssClass="slTextBox"/>
<th>Comments</th>
<th>Actions</th>
</tr>
-<com:TRepeater ID="PropertyList" ItemCommand="itemAction">
+</prop:HeaderTemplate>
+
+<prop:FooterTemplate>
+</table>
+</prop:FooterTemplate>
+
<prop:ItemTemplate>
<tr>
<td>
@@ -58,29 +66,49 @@ implements <com:TTextBox ID="Interfaces" CssClass="slTextBox"/>
<com:TTextBox ID="Comments" Text=<%# $this->Parent->DataItem->Comments %> CssClass="slTextBox"/>
</td>
<td>
- <com:TButton ID="AddButton"
- Text="Add"
- CommandName="add"
- CommandParameter=<%# $this->Parent->ItemIndex %> />
- <com:TButton ID="RemoveButton"
+ <com:TButton
Text="Remove"
CommandName="remove"
- CommandParameter=<%# $this->Parent->ItemIndex %> />
+ CommandParameter=<%# $this->Parent->ItemIndex %>
+ />
+ <com:TButton
+ Text="Up"
+ CommandName="up"
+ CommandParameter=<%# $this->Parent->ItemIndex %>
+ Enabled=<%# $this->Parent->ItemIndex > 0%>
+ />
+ <com:TButton
+ Text="Down"
+ CommandName="down"
+ CommandParameter=<%# $this->Parent->ItemIndex %>
+ Enabled=<%# $this->Parent->ItemIndex < $this->Page->ClassDefinition->Properties->Count-1 %>
+ />
</td>
</tr>
</prop:ItemTemplate>
+
</com:TRepeater>
-</table>
+
+<com:TButton Text="New Property" Click="addProperty" />
+
</com:TPanel>
<com:TPanel GroupingText="Event Definitions">
+<com:TRepeater ID="EventList" ItemCommand="itemAction">
+
+<prop:HeaderTemplate>
<table>
<tr>
<th>Name</th>
<th>Comments</th>
<th>Actions</th>
</tr>
-<com:TRepeater ID="EventList" ItemCommand="itemAction">
+</prop:HeaderTemplate>
+
+<prop:FooterTemplate>
+</table>
+</prop:FooterTemplate>
+
<prop:ItemTemplate>
<tr>
<td>
@@ -101,8 +129,11 @@ implements <com:TTextBox ID="Interfaces" CssClass="slTextBox"/>
</td>
</tr>
</prop:ItemTemplate>
+
</com:TRepeater>
-</table>
+
+<com:TButton Text="New Event" Click="addEvent" />
+
</com:TPanel>
<br/>
diff --git a/demos/composer/protected/pages/Home.php b/demos/composer/protected/pages/Home.php
index ddeeb2fe..10e86582 100644
--- a/demos/composer/protected/pages/Home.php
+++ b/demos/composer/protected/pages/Home.php
@@ -28,6 +28,7 @@ class Home extends TPage
protected function refresh()
{
$this->PropertyList->DataSource=$this->ClassDefinition->Properties;
+ $this->EventList->DataSource=$this->ClassDefinition->Events;
$this->dataBind();
}
@@ -37,10 +38,26 @@ class Home extends TPage
{
$this->ClassDefinition->Properties->removeAt($param->CommandParameter);
}
- else if($param->CommandName==='add')
+ else if($param->CommandName==='up')
{
- $this->ClassDefinition->Properties->insert($param->CommandParameter+1,new PropertyDefinition);
+ //$this->ClassDefinition->Properties->insert($param->CommandParameter+1,new PropertyDefinition);
}
+ else if($param->CommandName==='down')
+ {
+ //$this->ClassDefinition->Properties->insert($param->CommandParameter+1,new PropertyDefinition);
+ }
+ $this->refresh();
+ }
+
+ public function addProperty($sender,$param)
+ {
+ $this->ClassDefinition->Properties->add(new PropertyDefinition);
+ $this->refresh();
+ }
+
+ public function addEvent($sender,$param)
+ {
+ $this->ClassDefinition->Events->add(new EventDefinition);
$this->refresh();
}
@@ -70,6 +87,13 @@ class Home extends TPage
$property->Storage=$item->Storage->Text;
$def->Properties[]=$property;
}
+ foreach($this->EventList->Items as $item)
+ {
+ $event=new EventDefinition;
+ $event->Name=$item->EventName->Text;
+ $event->Comments=$item->Comments->Text;
+ $def->Events[]=$event;
+ }
}
}