Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Converters used in the JGoodies Framework

Thread view: 
srinivas.veeranki@gmail.com - 04 Jul 2006 07:08 GMT
Hi All...

I wrote one converter DateTimeNullableConverter which extends
AbstractConverter. In this class, i overwrite the methods of
convertFromSubject() and setValue() methods. Actually these methods
will invoke when ever i changed in the corresponding components fields
or change of the value in the corresponding attribute. But in my case
these ,methods are firing when ever i press the tab key in that widget
and also firing when ever i minimize the window as well as restoring
the window. This is not require for me. Can i restrict the this type of
firings..?

Thanks in advance... for ur help. Thank you much more....

I am giving the source code for this converter.

package com.calpers.uicommons;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.gtl.ftoj.framework.DateTimeNullable;
import com.jgoodies.binding.value.AbstractConverter;
import com.jgoodies.binding.value.ValueModel;

public class DateTimeNullableConverter extends AbstractConverter {
   /**
    * Constructor
    * @param booleanSubject ValueModel
    */
   public DateTimeNullableConverter(ValueModel booleanSubject) {
       super(booleanSubject);
   }
   /**
    * This method returns the formated date value for the given
objectvalue
    * @param subjectValue Object
    * @return Object
    */
   public Object convertFromSubject(Object subjectValue) {

       DateTimeNullable utlDateObj = null;
       if( subjectValue != null ) {
           utlDateObj = (DateTimeNullable)subjectValue;
       }

       if(utlDateObj != null && utlDateObj.theValue != null) {
           SimpleDateFormat sDf = new SimpleDateFormat("MM/dd/yyyy");
           return sDf.format(new
Date(utlDateObj.theValue.getTimeInMillis()));
       }
       return null;
    }
   /**
    * This method sets the given object value
    * @param newValue Object
    */
   public void setValue(Object newValue) {
       DateTimeNullable date = new DateTimeNullable();
       if(newValue != null)
       {
           if ((((String) newValue).indexOf("*") > 0)) {
               date.setNull(true);
                subject.setValue(date);
                return;
            }

           date = new
DateTimeNullable(date.setDate((String)newValue,"MM/dd/yyyy"));
           subject.setValue(date);

       } else {
           date.setNull(true);
           subject.setValue(date);
       }
   }
   
}
Andrew T. - 04 Jul 2006 14:37 GMT
>  Sub: Converters used in the JGoodies Framework

Two notes based on your subject line..

1.  comp.lang.java.gui is thataway..
http://groups.google.com/group/comp.lang.java.gui

2. JGoodies support (if it should come to it) is thisaway..
http://www.jgoodies.com/downloads/index.html
..see the link near the bottom of that page

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.