TableCellEditor that Supports Both Date and Calendar

Hi,
I'm trying to write a TableCellEditor that supports both the Date and Calendar Classes (i.e., my table could have either Dates or Calendar objects, and I want this cell editor to work seamlessly with either one).
Here is a simplified version of my code:
public class DateCellEditor extends AbstractCellEditor implements TableCellEditor {
/** The editor component. */
private DateChooser editor;
private Calendar cal;
public DateCellEditor() {
super();
editor = new DateChooser();
cal = Calendar.getInstance();
public Object getCellEditorValue() {
cal.setTime(editor.getDateValue());
return cal;
public Component getTableCellEditorComponent (JTable table,
                                                                                                                        Object value,
                                                                                                                        boolean isSelected,
                                                                                                                        int row,
                                                                                                                        int column) {
if (value != null) {
if (value instanceof Calendar)
     editor.setDateValue(((Calendar)value).getTime());
     else if (value instanceof Date)
     editor.setDateValue((Date)value);
return editor;
As you can see, I've already modified getTableCellEditorComponent to accepted object of class Date or Calendar. My problem arises in the getCellEditorValue method. How do I know which type of object to return? In the code sample above, I'm returning a Calendar object, but I'm not sure how to code this method to return either Calendar OR Date.
By the way, editor.getDateValue() returns a Date object.
I could easily write two separate TableCellEditors, but I would prefer a more elegant solution. Any ideas?
Thanks!
Karen Prengaman

If you really must have both objects and don't want to convert one into another, you could add a function like
setMode(int modetype) {}
where modetype is either DATE or CALENDAR, and then return the set type when the user calls getValueAt

Similar Messages

  • Any GPUs for Windows that support both CUDA and Open CL?

    Hi everyone,
    I was looking at this list:  http://www.adobe.com/products/premiere/tech-specs.html
    while trying to decide which graphics card to buy to take advantage of Mercury playback.  I couldn't help but notice that there is not a single card listed that is compatible for both CUDA and Open CL in windows.  Do I really have to pick one or the other?  In that case, which would be more beneficial to a Premiere Pro workflow that utilizes a lot of dynamic links to After Effects?  As a side note, I use Photoshop a ton, and would love to keep my GPU acceleration in that arena as well.
    Thanks!
    -Charlie

    I believe they write OpenCL separately.  They're two different APIs.
    They are not that different, while 'porting' doesn't imply completely automatic process. Rewriting existing libraries from one language to another is something almost any developer is familiar with.
    I'm not sure I understand the point you're trying to make here.  Right now, you cannot use OpenCL processing with an nVidia card on Windows.
    The point is simple: both CUDA and OpenCL are supported by NVIDIA cards. The fact that Adobe engineers haven't ported libraries for GPU acceleration in MPE on Windows from CUDA to OpenCL so far doesn't mean they never will. Hence the statement that a user-side choice between AMD and NVIDIA equals to choice between OpenCL and CUDA is incorrect.

  • NLS_LANG that supports both Japanese and Spanish

    Hi All,
    I need to insert Japanese scripts into my custom table. So I did setup the NLS_LANG to support the Japanese scripts as American_America.JA16SJIS.
    The japanese data got inserted into the table.
    Now, the spanish characters, which i have shows up as junk characters.
    I tried setting the NLS_LANG to UTF8. It didnt help me inserting the japanese characters thought it did insert the spanish properly.
    Can you please let me know, which supports these.
    Thanks,
    LR

    When you convert to Shift-JIS, if you also have spanish characters these need to be defined in the character set too. Is the client side Windows? Which shift-jis standard does the code page you are using support, and does it include all the characters?

  • Trying to create an abstract service that supports both DataService(LCDS) and RemoteObject

    I am trying to create a generic service processor in ActionScript that would be able to use a DataService(from LCDS) or a RemoteObject, depending on a property setting. The intent is to be able to change a setting during installation to control whether DataServices would be used, or RemoteObjects. I understand that the server side logic would need to be written differently for each of the implementations.
    The challenge is that accessing a DataService is synchronous, but a RemoteObject access is asynchronous.
    For the synchronous access, I can just call a service and return the result directly to an object which can be passed back to the client.
    For the asynchronous support, extra code must be written on the client side to listen for the return of a requested result (for example, the results of a database quesy). This code must be placed outside of the service itself, thus making the generic service non-generic.
    Are there any examples available that accomplish what I am trying to do?

    Hi. As far as I know both DataService and RemoteObject are asynchronous APIs. If you call a DataService method such as fill() or call a method on your RemoteObject, code in your Flex application will continue to execute and the result from the RemoteObject or DataService request will be received asynchrounously. I don't believe there is any way currently to make synchronous or blocking calls in Flex because of the Flash Player's execution model.
    How are you planning on using the DataService and RemoteObject in your application? Is it to do something like populate a DataGrid? Do you plan on updating the data retrieved from the DataService or RemoteObject such as adding, updating or deleting records?
    The DataService API is much more powerful than the RemoteObject API, in that if you bind an ArrayCollection that is populated from a DataService to your DataGrid, when you update data in the DataGrid, the data on the server is updated and all other clients that have the same view of the data will also get the updates. You don't currently get this functionality with RemoteObjects.
    My point here is that if you wanted to write an abstract service that supports both DataService and RemoteObject and you need to be able to add, update or delete records you are going to need to write a lot of custom code to listen for collection change events when data on the client is modified and translate these change events into RemoteObject requests. Even if you did do that, other clients would not get these updates.
    If all you want to do is something simple like populate a DataGrid with data from the DataService or RemoteObject, then sure, writing an abstraction layer on the client that supports both of these wouldn't be hard.  
    -Alex

  • Page size that I have to put my site to see the same on a computer supports both laptop and a desktop computer ?

    page size that I have to put my site to see the same on a computer supports both laptop and a desktop computer ?

    The viewport on a computer is adjustable by the user. iWeb sets the viewport width to the page width that you chose in the layout menu. No matter what the end user does, the page width is static and a reasonable compromise for the width of a web page that will be viewed on these devices is 980 to 1024 px.
    Safari on iOS devices cannot set the viewport. The viewport on mobile devices is fixed and its width depends on the orientation of the device. The iPhone in portrait mode has a viewport width of 320px. This means that the 980px wide iWeb built page will be squashed down to about one third of its desired size making it unreadable and difficult to navigate.
    Setting the viewport meta tag so that width equals the device width is a futile gesture since Safari on iOS will do that anyway. Its only useful if you add some initial scaling like...
    <meta name = "viewport" content="initial-scale=0.7">
    In the case of a 980px wide website, the initial scale is about 0.3 so any value higher than this will magnify the initial view of the site.
    Here's an example of a 980px wide page that has been given and initial scale of 0.7 which allows an iPhone user to see one column of a two column layout...

  • [svn:osmf:] 15252: 1) SMILPlugin - SMILMediaGenerator class modified to support both live and vod smil files .

    Revision: 15252
    Revision: 15252
    Author:   [email protected]
    Date:     2010-04-06 16:57:34 -0700 (Tue, 06 Apr 2010)
    Log Message:
    1) SMILPlugin - SMILMediaGenerator class modified to support both live and vod smil files. SMILLoader modified to retain original resource metadata.
    2) AkamaiBasicStreamingPlugin refactored. This includes improved support for all types of streams while the plugin is loaded, added support for plugin metadata that can override built in defaults for a) live stream time out; b) whether or not the plugin should try to reconnect to a live stream if both primary and secondary encoders fail; c) the interval at which the retry should occur.  Added support for resource metadata for specifying connect-level and stream-level auth tokens so that these tokens do not need to be part of the URL (although this is acceptable also).
    3) AkamaiPluginSample app updated to support auth tokens which are not part of the URL (these are passed to the Akamai plugin via resource metadata).
    Modified Paths:
        osmf/trunk/apps/samples/plugins/AkamaiPluginSample/.actionScriptProperties
        osmf/trunk/apps/samples/plugins/AkamaiPluginSample/src/AkamaiPluginSample.mxml
        osmf/trunk/plugins/SMILPlugin/org/osmf/smil/loader/SMILLoader.as
        osmf/trunk/plugins/SMILPlugin/org/osmf/smil/media/SMILMediaGenerator.as
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/.actionScriptProperties
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/AkamaiBasicStreamingPlugin.as
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/com/akamai/osmf/AkamaiBasicStreaming PluginInfo.as
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/com/akamai/osmf/net/AkamaiNetConnect ion.as
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/com/akamai/osmf/net/AkamaiNetConnect ionFactory.as
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/com/akamai/osmf/net/AkamaiNetLoader. as
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/com/akamai/osmf/net/AkamaiNetStream. as
    Removed Paths:
        osmf/trunk/plugins/akamai/AkamaiBasicStreamingPlugin/com/akamai/osmf/events/

  • Mini DisplayPort to support both audio and video coming soon?

    So I notice that Apple updated the MacBook Pro Mini DisplayPort implementation to support BOTH audio AND video.
    Think this will make it’s way to the Mac mini soon, or an update still a long way off?

    Probably in the next refresh, but the mini was refreshed twice last year, so another refresh in less than a year would probably be too much for which to hope!
    There is always this US$49 wonder;
    http://www.monoprice.com/products/product.asp?cid=104&cp_id=10428&cs_id=1042802&pid=6331&seq=1&format=2
    Dah•veed

  • Searching for pictures by both date and keyword

    When I have the calendar tab up and a date with pictures is highlighted, when I go to select a keyword the calendar goes away and then I am back to my library. How do I search for pictures by both date and keyword?
    Thank You, Margaret

    Margaret:
    You can use a Smart Album to do the job. Just use the criteria:
    Keyword is "xxxx" and Date is "dd/mm/yyyy"
    Be sure to select All in the Match menu.
    Or you can use the text find box at the bottom in this undocumented way:
    1 - click on the library icon and in the text box type any character.
    2 - select the library icon again and type Command-I
    3 - in the Find window (the same as what you get for a Smart Album) set your criteria: Keyword is "xxx" and Date is "dd/mm/yyyy" and set "All" as the Match criteria.
    4 - hit the search button and those pictures will show up in the thumbnail window.
    5 - when complete clear the text box at the bottom of the window to get all of the photos back.
    Either way you'll get those photos with the keyword and particular date.

  • Which handheld devices support both J2ME and Wi-Fi?

    Which handheld devices support both J2ME and Wi-Fi?

    Hi,
    Got the Lumia CYan update yesterday hoping that it would fix my bluetooth problem. I have Cortana on my Hong Kong country variant but still bluetooth issue is not resolved.
    After pairing instance, the bluetooth does not re-connect on subsequent attempts (it does try to reconnect). On reconnect attempt it fails and presents "tap to pair" under the bluetooth network.
    Please help.
    Daman
    Lumia 1520
    Past: Icon, 928, 720, N9, N97(ugh)

  • Overview of Dates and Calendar

    hi,
    does anyone know some good links that explain what is going on with Date and Calendar etc..
    It seems quite complicated - is there any docs on the general idea/framework? (and why things have been deprecated etc..)
    I don't know anything about different world calendars, but theres lot on the web, so its more the java specifics I'm interested in!
    thanks,
    asjf

    Don't use Date at all, use Calendar instead (unless you need to use dates in databases). What parts of the Calendar docs aren't clear? The general idea is each instance of Calendar represents a point in time, with methods to change and retrieve various datetime fields.

  • Can a MacBook (Early 2008) Support both sound and video to 1080p HDTV by Mini-DVI to HDMI cable?

    Can a MacBook (Early 2008) Support both sound and video to 1080p HDTV by Mini-DVI to HDMI cable?

    The mini dvi on the MacBook will only support video, in order to get audio you'll need to a cable from the sound out port to the sound in port on the TV.

  • Adobe Acrobat Message : ''To view the flash technology content in this PDF, please install the version of flash player that supports Adobe reader and acrobat "

    I am using interop acrobat dll in one of my client , when trying to open a pdf file in acrobat X the following message appears :
    ''To view the flash technology content in this PDF, please install the version of flash player that supports Adobe reader and acrobat "
    Is there any workaround to fix this issue ?...
    will installing the flash player fix the issue ?
    thanks

    i am trying to convert the pdf to tiff image using
    //Using ACROBAT PRO
                AcroAppClass app = new AcroAppClass();
                AcroAVDoc doc = new AcroAVDocClass();
    i tried downloading the flash player ,now the error does not appear but for those pdf that displays this flash message error i am not getting the pdf converted to tiff file , instead i get an image with message
    What could be the cause of this issue ?

  • HT201338 adaptor that accepts both VGA and ethernet cables at the same time that can be plugged into the Thunderbolt port

    I have my Apple cinema display connected to my MacBook Air via the Thunderbolt port, but I also want to connect an ethernet cable.
    Is there an adaptor that accepts both VGA and ethernet cables at the same time that can be plugged into the Thunderbolt port

    I have my Apple cinema display connected to my MacBook Air via the Thunderbolt port, but I also want to connect an ethernet cable.
    Is there an adaptor that accepts both VGA and ethernet cables at the same time that can be plugged into the Thunderbolt port

  • I just updated to Pages 5.0 and I am writing a document that uses both, Spanish and English...I used to use the inspector to change spelling and languages. How do I do that in this new version?

    I just updated to Pages 5.0 and I am writing a document that uses both, Spanish and English...I used to use the inspector to change spelling and languages. How do I do that in this new version?...HELP!!!

    jedimaster Master wrote:
    how do I do both?
    By choosing SET UP for the "automatic" item at the bottom of the list I referred you to earlier

  • I recently lost my iphone.......and i have some confidencial data and pics in it....I want to make that are my data and pics secure r not?

    I recently lost my iphone.......and i have some confidencial data and pics in it....I want to make that are my data and pics secure r not?

    Well, if it is locked with a passcode; the only way for someone to use it would be for them to guess your passcode or restore it as new in iTunes. If they restore it, it wipes out all your information and puts the device back to factory settings.
     if you have iCloud setup; you can go to iCloud.com on a computer and sign in with your Apple Id and Password and you can possible track the device; also give the option to send a sound or message to the device; also you can remotely lock it with a passcode or remotely wipe it to factory settings;
    Hope this helps!!

Maybe you are looking for

  • Had problems with Snow Leopard from the get-go.....

    .....but I was finally able to take my desktop to a local Genius Bar today and the fix was found within minutes. The problem I was having was that iCal wouldn't open in Snow Leopard. It would just bounce in the dock a few times and then slam shut. Tu

  • New Billing and Payment Pages

    Good news! I'm happy to announce that we've launched our shiny new Billing and Payment pages.  You can view them now, here: http://ee.co.uk/help/accounts-billing-and-topping-up/billing-and-payment A few things to keep an eye on include: Separated con

  • Tip to get Search to work in "All messages" in Leopard

    I've discovered that upgrading to Leopard has stopped Mail Search working for anything in the main body of the message (From & To & Subject etc, they all work ok). Although it takes a little longer to do, creating a Smart Mailbox using Entire Message

  • Query Filter on attribute

    Hi, I am designing the BEx Query that requires the data to be filtered based on the attribute value of an infoobject - both are available in the BEx Query. However when I apply the Filter on the same infoobject in the BEx Query, it does not return me

  • Mount Notification problem?

    If you are having an annoying file open up when you rebot called Mount Notification, here is the simple solution. 1.) You probably downloaded an NTFS program called Paragon NTFS and deleted the file or it crashed for some weird reason, so the first s