CVS: Tapestry/framework/src/net/sf/tapestry/util/io ComponentAddressAdaptor.java,1.3,1.4
Mind Bridge <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/util/io
In directory sc8-pr-cvs1:/tmp/cvs-serv1370/framework/src/net/sf/tapestry/util/io
Modified Files:
ComponentAddressAdaptor.java
Log Message:
modifications of ComponentAddress to work well with pages
and addition of corresponding unit tests
Index: ComponentAddressAdaptor.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/util/io/ComponentAddressAdaptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ComponentAddressAdaptor.java 27 Nov 2002 17:58:44 -0000 1.3
--- ComponentAddressAdaptor.java 3 Jan 2003 17:53:15 -0000 1.4
***************
*** 23,39 ****
{
ComponentAddress address = (ComponentAddress) data;
! return PREFIX + address.getPageName() + SEPARATOR + address.getIdPath();
}
public Object unsqueeze(DataSqueezer squeezer, String string) throws IOException
{
! int nSeparator = string.indexOf(SEPARATOR);
! if (nSeparator < 0)
throw new IOException(Tapestry.getString("ComponentAddressAdaptor.no-separator"));
! String strPageName = string.substring(1, nSeparator);
! String strIdPath = string.substring(nSeparator + 1);
! return new ComponentAddress(strPageName, strIdPath);
}
--- 23,47 ----
{
ComponentAddress address = (ComponentAddress) data;
!
! // a 'null' id path is encoded as an empty string
! String idPath = address.getIdPath();
! if (idPath == null)
! idPath = "";
!
! return PREFIX + address.getPageName() + SEPARATOR + idPath;
}
public Object unsqueeze(DataSqueezer squeezer, String string) throws IOException
{
! int separator = string.indexOf(SEPARATOR);
! if (separator < 0)
throw new IOException(Tapestry.getString("ComponentAddressAdaptor.no-separator"));
! String pageName = string.substring(1, separator);
! String idPath = string.substring(separator + 1);
! if (idPath.equals(""))
! idPath = null;
! return new ComponentAddress(pageName, idPath);
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf