AW: [opencms-dev] getFieldMethods

Mark Miller mark.miller at hema.ch
Thu Oct 30 09:05:01 CET 2003


Nice one 
 thanks .. I wasn’t sure if that was the way or not, as I
noticed in the news module that this is never done (instance var set),
guess they just decided they didn’t need it.
 
-----Ursprüngliche Nachricht-----
Von: opencms-dev-admin at opencms.org
[mailto:opencms-dev-admin at opencms.org] Im Auftrag von Stephan Hartmann
Gesendet: 29 October 2003 20:52
An: opencms-dev at opencms.org
Betreff: Re: [opencms-dev] getFieldMethods
 
You don`t need that. 
When you edit a content definition it will be instantiated by calling
the constructor that gets a CmsObject and an Integer id. You can store
this CmsObject in a member variable which you can reference from your
getter.
For lists it is up to you. Your filter method that returns the vector of
content definitions can accept a CmsObject. For that you should use a
constructor that gets a CmsObject and all the fields of your content
definition.
 
Bye,
Stephan
 
----- Original Message ----- 
From: Mark Miller <mailto:mark.miller at hema.ch>  
To: 'OpenCMS Mailing List' <mailto:opencms-dev at opencms.org>  
Sent: Wednesday, October 29, 2003 5:20 PM
Subject: [opencms-dev] getFieldMethods
 
Is it possible to pass the cms object to a getXXX method ???
 
Eg.
 
Can I use something like this
 
methods.addElement(AlbumContentDefinition.class.getMethod("getNumberOfIm
ages", new Class[] {CmsObject.class} ));
 
if so 
 how do I let the backoffice template to call the method with
it’s cms object ? 
 I have a getter that requires use of the vfs, ie. it
dynamically works out the number of files in a folder in the VFS 
 hence
why I need a way to pass the cms object so I can then use
 
cms.getResourcesInFolder(getImageLocation()).size();
 
within the getter.
 
Does this make sense ? if so, how do I implement it ?
 
Many thanks in advance,
 
 
mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20031030/b6ec7e72/attachment.htm>


More information about the opencms-dev mailing list