From seam-commits at lists.jboss.org Thu Jan 7 02:39:41 2010 Content-Type: multipart/mixed; boundary="===============8732202022709326721==" MIME-Version: 1.0 From: seam-commits at lists.jboss.org To: seam-commits at lists.jboss.org Subject: [seam-commits] Seam SVN: r11923 - modules/remoting/trunk/examples/model/src/main/webapp. Date: Thu, 07 Jan 2010 02:39:41 -0500 Message-ID: <201001070739.o077dffP013638@svn01.web.mwc.hst.phx2.redhat.com> --===============8732202022709326721== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: shane.bryzak(a)jboss.com Date: 2010-01-07 02:39:41 -0500 (Thu, 07 Jan 2010) New Revision: 11923 Modified: modules/remoting/trunk/examples/model/src/main/webapp/model.html Log: added address add/remove functions Modified: modules/remoting/trunk/examples/model/src/main/webapp/model.html =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- modules/remoting/trunk/examples/model/src/main/webapp/model.html 2010-0= 1-07 07:39:07 UTC (rev 11922) +++ modules/remoting/trunk/examples/model/src/main/webapp/model.html 2010-0= 1-07 07:39:41 UTC (rev 11923) @@ -10,7 +10,7 @@ = = -

Seam Remoting - Model Example

+

Seam Remoting - Model API Example

= @@ -80,8 +80,6 @@ var addressDiv =3D document.getElementById("addresses"); clearElement(addressDiv); = addressDiv.appendChild(createLinkRow("Load addresses", "loadAddresse= s()")); - = - document.getElementById("applyChanges").disabled =3D false; } = function loadAddresses() { @@ -105,8 +103,23 @@ } else { addressDiv.appendChild(document.createTextNode("No addresses found= ")); = } + = + addressDiv.appendChild(createLinkRow("Create new address", "createAd= dress()")); } = + function createAddress() { + var address =3D Seam.createBean("org.jboss.seam.remoting.examples.mo= del.Address"); + address.person =3D model.getValue("person"); + address.streetNo =3D ""; + address.streetName =3D ""; + address.suburb =3D ""; + address.postCode =3D ""; + address.country =3D ""; + address.person.addresses.push(address); + var addressesDiv =3D document.getElementById("addresses"); + addressesDiv.insertBefore(createAddressEditor(address), addressesDiv= .lastChild); = + } + = function createLabel(text) { var lbl =3D document.createElement("label"); lbl.appendChild(document.createTextNode(text)); @@ -122,12 +135,11 @@ return input; } = - function apply() { = - document.getElementById("applyChanges").disabled =3D true; - - // TODO apply person changes here - = - model.applyUpdates(); = + function apply() { + var action =3D new Seam.Action() + .setBeanType("org.jboss.seam.remoting.examples.model.PersonAction") + .setMethod("savePerson"); + model.applyUpdates(action); } = function createDeleteAddressLink(address, div) { @@ -211,7 +223,7 @@ =
- +
=
--===============8732202022709326721==--