From d1ef73c6f6067808982ccece140cdf37f7c26dc1 Mon Sep 17 00:00:00 2001 From: shmyga Date: Mon, 7 Jul 2014 13:53:58 +0400 Subject: [PATCH] - --- res/layout/main.json | 4 ++-- .../ru/m/armageddon/client/frames/PersonFrame.hx | 8 +++----- .../client/frames/person/PersonRenderer.hx | 16 ---------------- .../client/frames/person/PersonView.hx | 14 ++++++++------ 4 files changed, 13 insertions(+), 29 deletions(-) delete mode 100755 src/client/haxe/ru/m/armageddon/client/frames/person/PersonRenderer.hx diff --git a/res/layout/main.json b/res/layout/main.json index 10a4083..5406fca 100755 --- a/res/layout/main.json +++ b/res/layout/main.json @@ -57,8 +57,8 @@ "views":[ { "id":"list", "type":"haxework.gui.list.VListView", - "renderer":{ - "type":"ru.m.armageddon.client.frames.person.PersonRenderer" + "factory":{ + "type":"~ru.m.armageddon.client.frames.person.PersonView" }, "scroll":{ "type":"haxework.gui.list.VScrollView", diff --git a/src/client/haxe/ru/m/armageddon/client/frames/PersonFrame.hx b/src/client/haxe/ru/m/armageddon/client/frames/PersonFrame.hx index 7c02d81..8f90445 100755 --- a/src/client/haxe/ru/m/armageddon/client/frames/PersonFrame.hx +++ b/src/client/haxe/ru/m/armageddon/client/frames/PersonFrame.hx @@ -1,7 +1,6 @@ package ru.m.armageddon.client.frames; import haxework.frame.IFrameSwitcher; -import protohx.MessageUtils; import ru.m.armageddon.proto.PersonSelectResponse; import ru.m.armageddon.proto.PersonSelectRequest; import haxework.gui.list.ListView; @@ -13,15 +12,14 @@ import haxework.provider.Provider; import ru.m.armageddon.proto.Person; import haxework.gui.list.VListView; import haxework.gui.HGroupView; -import ru.m.armageddon.client.frames.person.PersonRenderer; -class PersonFrame extends HGroupView implements IPacketHandler implements ListViewListener { +class PersonFrame extends HGroupView implements IPacketHandler implements ListViewListener { private static inline var TAG = "PersonFrame"; public static inline var ID = "person"; - private var list:VListView; + private var list:VListView; public function new() { super(); @@ -37,7 +35,7 @@ class PersonFrame extends HGroupView implements IPacketHandler implements ListVi Provider.get(IConnection).packetHandler = this; } - public function onListItemClick(item:ListItem):Void { + public function onListItemClick(item:IListItemView):Void { Provider.get(IConnection).send(new PersonSelectRequest().setPersonId(item.data.id)); } diff --git a/src/client/haxe/ru/m/armageddon/client/frames/person/PersonRenderer.hx b/src/client/haxe/ru/m/armageddon/client/frames/person/PersonRenderer.hx deleted file mode 100755 index af48c93..0000000 --- a/src/client/haxe/ru/m/armageddon/client/frames/person/PersonRenderer.hx +++ /dev/null @@ -1,16 +0,0 @@ -package ru.m.armageddon.client.frames.person; - -import ru.m.armageddon.proto.Person; -import haxework.gui.list.VListView; -import haxework.gui.list.ListView; - -class PersonRenderer implements IRenderer, PersonView, Person> { - - public function factory():ListItem { - return {view:new PersonView()}; - } - - public function render(list:VListView, item:ListItem):Void { - item.view.person = item.data; - } -} \ No newline at end of file diff --git a/src/client/haxe/ru/m/armageddon/client/frames/person/PersonView.hx b/src/client/haxe/ru/m/armageddon/client/frames/person/PersonView.hx index 1b57f21..549dadb 100755 --- a/src/client/haxe/ru/m/armageddon/client/frames/person/PersonView.hx +++ b/src/client/haxe/ru/m/armageddon/client/frames/person/PersonView.hx @@ -1,13 +1,15 @@ package ru.m.armageddon.client.frames.person; +import haxework.gui.list.ListView.IListItemView; import haxework.gui.LabelView; import ru.m.armageddon.proto.Person; import haxework.gui.skin.ColorSkin; import haxework.gui.HGroupView; -class PersonView extends HGroupView { +class PersonView extends HGroupView implements IListItemView { - public var person(default,set):Person; + public var item_index(default, default):Int; + public var data(default, set):Person; private var nameLabel:LabelView; @@ -21,9 +23,9 @@ class PersonView extends HGroupView { addView(nameLabel); } - private function set_person(value:Person):Person { - this.person = value; - nameLabel.text = this.person.name; - return this.person; + private function set_data(value:Person):Person { + this.data = value; + nameLabel.text = this.data.name; + return this.data; } } \ No newline at end of file