Doug,

Our java objects need to have dates set to type Calendar.  So are you 
suggesting that my ActionScript value objects have a setter/getter?  
Something like:

class com.beans.WorkGroupVO {
  public var workGroupID:String;
  public var startDate:Date;
  public var endDate:Date;;
  static var rc:Boolean = Object.registerClass("com.beans.WorkGroup", 
com.beans.WorkGroupVO);
        
  public function CalendarVO() {}
  
  public set startDate( num:Number ):Void {
    startDate = new Date(num);
  }
  
  public get startDate():Number {
    return startDate.getTime();
  }

I don't think I quite get your meaning.

Thanks,
Geoff




--- In flexcoders@yahoogroups.com, "Doug Lowder" <[EMAIL PROTECTED]> 
wrote:
>
> Geoffrey, you may or may not find this to be helpful but I've found 
> it much easier to deal with times as longs than as instances of 
> various date classes (java.util.Date, java.sql.Date, 
> java.util.Calendar, etc).  The timelong can be easily retrieved 
with 
> date.getTime() or calendar.getTime().getTime(), and longs fit 
nicely 
> on the AS side as well.  When displaying time values in datagrids, 
> for instance, I needed the timelong instead of the Date object in 
> order to preserve the default sort behavior regardless of what type 
> of string formatting was applied to the date.
> 
> 
> --- In flexcoders@yahoogroups.com, "Geoffrey" <gtb104@> wrote:
> >
> > Could someone voice an opinion on this?  Please.
> > 
> > --- In flexcoders@yahoogroups.com, "Geoffrey" <gtb104@> wrote:
> > 
> > ENV: Flex 1.5 served from WebSphere6.1
> > 
> > All of our Java objects used to use java.util.Date for date 
> > properties, but we had to convert them to java.util.Calendar.  
> Since 
> > Flex 1.5 doesn't support mapping from AS Date to Java Calendar 
and 
> > vise versa, I came up with another way of doing it.  Obviously it 
> > doesn't work, or else I wouldn't be here! :-P
> > 
> > Here is some code:
> > 
> > WorkgroupVO.as - This is the object I'm trying to send to Java
> > import com.beans.common.*;
> > class com.beans.WorkGroupVO {
> >   public var workGroupID:String;
> >   public var startDate:CalendarVO;
> >   public var endDate:CalendarVO;
> >   static var rc:Boolean = Object.registerClass
> ("com.beans.WorkGroup", 
> > com.beans.WorkGroupVO);
> > 
> >   public function WorkGroupVO(){}
> > }
> > 
> > 
> >  
> > CalendarVO.as - My ActionScript "Calendar" object
> > class com.beans.common.CalendarVO {
> >   public var time:Date;
> >   static var rc:Boolean = Object.registerClass
> ("java.util.Calendar", 
> > com.beans.common.CalendarVO);
> >     
> >   public function CalendarVO(){}
> > }
> > 
> > 
> >  
> > Here's how I use the WorkgroupVO object that is returned from 
> Java.  
> > This works.  I'm populating a DateField with the supplied dates.
> > public function set wg( wg:WorkgroupVO ):Void {
> >   ...
> >   availability.startDate = wg.startDate.time;
> >   availability.endDate = wg.endDate.time;
> >   ...
> > }
> >  
> >  
> >  
> > To save this information for an update, I use the following code:
> > public function saveWorkgroup() {
> >   var newWg:WorkgroupVO = new WorkgroupVO();
> >   newWg.groupName = tiGroupName.text;
> >   // Create a new CalendarVO and set it's time property to the 
> > selectedDate.
> >   var startCal:CalendarVO = new CalendarVO();
> >     startCal.time = dfStartDate.selectedDate;
> >     newWg.startDate = startCal;
> >   var endCal:CalendarVO = new CalendarVO();
> >     endCal.time = dfEndDate.selectedDate;
> >     newWg.endDate = endCal;
> >   ...
> >   // Pass newWg to my RemoteObject at this point
> > }
> >  
> > This does create a Calendar object that is mapped to 
> > java.util.Calendar according to Service Capture, but this is the 
> > error I'm getting:
> > (Message #0 targetURI=/7/onStatus, responseURI=null)
> >     (Object #0)
> >       code = "Server.Processing"
> >       description = "Cannot invoke method 'createWorkgroup'."
> >       type = "flashgateway.GatewayException"
> >       rootcause = (Object #1)
> >         code = null
> >         description = "Could not set object null on class 
> > com.beans.Workgroup's method setStartDate"
> >         type = "flashgateway.translator.ASTranslationException"
> >         level = "error"
> >         details = "
> > flashgateway.translator.ASTranslationException: Could not set 
> object 
> > null on class com.beans.Workgroup's method setStartDate
> >     at 
> > flashgateway.translator.decoder.JavaBeanDecoder.decodeObject
> > (JavaBeanDecoder.java:99)
> > 
> >  
> > I believe I usually get this type of error when my AS objects 
> don't 
> > jive with the Java Bean.  Do you think my AS Calendar object 
isn't 
> > mapping to the Java.util.Calendar class properly?  If this were 
> true, 
> > then why do I receive data correctly?
> > 
> > Also, for debugging purposes I have gateway-config logging set to 
> > Debug, and I'm using Service Capture to see the flow of data back 
> and 
> > forth.  I wish there was more detail coming back from the Flex 
> > Gateway in reguard to the actual mapping process (I saw there is 
a 
> > isDebug property in one of the flexgateway jars, but it's 
> private).  
> > Anyone know of a way to get more information out of the 
> FlexGateway???
> >  
> >  Thanks in advance,
> >  Geoff
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://standraise.corp.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://standraise.corp.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to