[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Multiple table editors

Posted on 2004-08-30
14
Medium Priority
?
227 Views
Last Modified: 2013-12-13
Hi how could i solve the following?

There is a JTable for adding dates to:
FROM...            TO...
from date 1       to date 1
from date 2       to date 2
etc.

the dates can be relative or fixed, eg:
today less 5 days at 12:00
or
17-07-2004 @ 12:45

So i think the editor could prove problems, my idea
                     relative selected     *other selected           @time
ComboBox         ComboBox             Text field to             Standard date
-----------          ------------              enter days less        editing formatted
Relative             Today                    value                      text field or JSpinner
Fixed                 less 1 day
                         less 2 day
                         other*

but if fixed is selected then we just have a standard date editing spinner
So the editor is dynamic depending on there choices - is this going to get complicated/require multiple editors etc.?
Any knowledge with similar designs would be greatly appreciated,
Thanks.
-----------
0
Comment
Question by:cathalmchale
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 3
  • 2
14 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 11931318
One way of doing it is hiding a column and then showing the column of your choice.. That will definately work

Other way could be of changing the editor but I think that you may need to reconstruct the table if you need to change the Table editors..

And if you need to know how multiple columns can have multiple cell editors
check this out
http://www.javaworld.com/javaworld/javatips/jw-javatip102.html
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11931334
check this out as well.. This may be of some help
http://www.javaworld.com/javaworld/javatips/jw-javatip116.html
0
 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 11931341
Rough idea:

Date picker      Combo       Edit field    Combo            Time picker
--------------      --------        -----------    ---------            --------------
own design      minus                          days                2 text fields (for hours & minutes) + spinners
                        plus                             weeks
                                                            months
                                                            ...

So,

today less 5 days at 12:00 =   today                minus   5   days   12:00
17-07-2004 @ 12:45           =  17-07-2004       minus   0   days   12:45


so in fact, if the edit field is 0 it is fixed, otherwise relative.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:cathalmchale
ID: 11949656
Hi ya, thanks for the help so far.

I want to make a combo box of daysOfWeek and i want them to be in current locale - simple, but was looking at the Date and Calendar classes to find a method like

public String giveMeTheDay( MONDAY )

but cant find it!!  perhaps its just too early in the morning, but how do i do this???
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11949684
Use the SimpleDateFormat with EEEE as pattern
0
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 500 total points
ID: 11949701
So,

You have the constructor:

SimpleDateFormat(String pattern)
          Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the default locale.

and also

SimpleDateFormat(String pattern, Locale locale)
          Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the given locale.


Give this a try:

SimpleDateFormat fmt = new SimpleDateFormat("EEEE");
Date d = new Date(); // today
String dayName = fmt.format(d);  // Will give you "Wednesday" if you locale uses the English language

So if you feed it with 7 consequtive dates, you'll have all 7 day names
0
 

Author Comment

by:cathalmchale
ID: 11950031
OK cool ;-)
also what do you think is the best component for the user to edit a fixed date or time?
a JSpinner or formatted text field can be a little clumsy and require a lot of validation - or do you think these are the best components to be used??
0
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 500 total points
ID: 11950079
For the time I use
- an hour field + a JSpinner
- an minutes field + a JSpinner

For the date I use my own written Date picker based on the source found at http://www.geocities.com/mschliesman/prog_datechooser.htm
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11950118
Concerning the date picker:
Maybe you're interested in this discussion:
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20800000.html
0
 

Author Comment

by:cathalmchale
ID: 11950120
thanks date chooser looks nice.
Hour field and min field have seperate spinners??  and this looks ok??  and you label them hours: mins: or would a ':' between the 2 make it obvious??  what do u think? :)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11950192
>> Hour field and min field have seperate spinners??  
Yes.
>>and this looks ok??
According to my taste, yes ;°)

>>and you label them hours: mins: or would a ':' between the 2 make it obvious??
I just have them all on one line wihthout anything added.
Of course the corresponding label "Start Date:", "Start Time:" or whatever label make it clear for the user he can give in a date, date + time or just a time.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11950199
>>Thanks date chooser looks nice
But it has some bugs that have to be fixed. (look at the EE link I gave you for some more info)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11962047
Still questions left?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11997367
Thank you :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question