• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI design

 
Maksym Odintsov
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have the following requirement on my GUI :
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.

I designed GUI in such a way :

JTextField that holds name
JTextField that holds location
search button

If both fields are blank than pressing the search button will give you all the records, if one is blank and another is not then it will give you only the records that match the filed that is not blank, and if both fields are not blank that the result will be all the records that match both fields.
But there can be one more way, when both fields are not blank pressing search can give all records that match to one field and records that match to another(name or location fields exactly match values specified by the user).

Do I need to provide this way ? And if I do what is the better way to do it ?
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My GUI has 3 radio buttons: Name AND Location, Name OR Location and All Records.
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mine has 2 combo boxes, each populated from the file, and each with "any" added to the list. The "any" is the default value for each. "Any" and "any" returns all records. A name and a location can be specified or a name and "any" or a location and "any". There are lots of ways to implement your GUI.
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anne Crace wrote:Mine has 2 combo boxes, each populated from the file, and each with "any" added to the list. The "any" is the default value for each. "Any" and "any" returns all records. A name and a location can be specified or a name and "any" or a location and "any". There are lots of ways to implement your GUI.

So you have no support to search for name or location ?
 
Mahesh Kumaraguru
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anne Crace wrote:Mine has 2 combo boxes, each populated from the file, and each with "any" added to the list. The "any" is the default value for each.


How would you distinguish between "Any" the default and a location called "Any" ?
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My approach is the same as Anne using the 2 combo boxes.

I populate with "---ANY---".

If there's a city with this name I'd sure like to go there
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
So you have no support to search for name or location ?

Name and "any" matches name only.
Location and "any" matches location only.
From my instructions: 'It must allow the user to search the data for all records ("any", "any"), or where the name and/or location fields exactly match values specified by the user. The above situations take care of the "or". Choosing a specific value under both name and location takes care of the "and".
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anne,

my instructions are the same, but it all depends in how you interprete the or. My interpretation was if user selects name = "Hilton" + location = "Paris" and chooses to or the criteria, then user will get a list with all hilton-hotels and all hotels in Paris.

but your approach keeps the gui more simple and user friendly, so i'll implement a similar search-function.

Kind regards,
Roel
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "simple" aspect is why I chose this approach. I got the idea from the red Exam Cram book (Alain Trottier is the author - not sure of this). He suggested it as sparing the user from his/her own typos. The combo boxes are populated from the database, so they are an exact match and spelled correctly. Matching regular expressions to me are just cryptic and ugly in any language. I've had to use them in javascript and it is done the same way as it is in Java. I really didn't enjoy it too much. I'm sure I will have to do it again
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anne Crace wrote:Matching regular expressions to me are just cryptic and ugly in any language.

But they are very powerful and useful, if used correctly.

I had two textfields, and for each textfield a checkbox ("All" - or "any", in your case). Checkbox selected -> text field disabled. I also had a separate checkbox "only bookable".
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anne Crace wrote:He suggested it as sparing the user from his/her own typos. The combo boxes are populated from the database, so they are an exact match and spelled correctly.


Agree. I guess you load the content of those comboboxes when application starts. But did you also handle the possibility to reload the content of those combos?
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Agree. I guess you load the content of those comboboxes when application starts. But did you also handle the possibility to reload the content of those combos?

Since you brought it up, I need to give more thought to that. Currently, if a record is booked (write CSR number to owner field), the record still shows up in the table with the owner field populated with the number. My GUI won't allow it to be overwritten, however. The items still show up in the Combo boxes, too. I haven't checked the delete situation. That one should NOT show up in the table, and should not show up in the Combo boxes either. I suppose I have more work to do on my Combo Box Model and its listeners. I'm sure it is doable as there are several remove() methods in the various box models.
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anne

I adopted the same approach as you and looked into the delete/insert and updating of the combo boxes.

I couldn't see a way that you could signal the combo box if say for instance a user in another application decides to delete a record using the DBAcess
interface method.

I suppose you could implement an observer to let the combo box know but then it all starts getting complicated.

The only other way I could find was to update the combo box on any key press in the gui, which seems terribly inefficient.

I then plumped for refreshing the combo boxes when the user presses the "SearchAll" button which in my gui resets both combo boxes to show
"---ANY---".

I used a cache to hold my contractor records so this isn't such an I/O hit.

I am sure there's a more elegant solution, but at this stage of the project I was knackered

Cheers Kevin
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kevin Florish wrote:

I then plumped for refreshing the combo boxes when the user presses the "SearchAll" button which in my gui resets both combo boxes to show
"---ANY---".
I am opting for the "Reserve" button for the removal. I do call refresh() from my Search button. Not sure if it works, though. I haven't really tested this part of the functionality yet. I am flummoxed right now, too. I am not going to bother with it any more over the weekend. Maybe the answer will come to me in my sleep.
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have combo boxes with a list of possible names and locations where the user can choose from, you won't expect to find no records at all. so when a search result in no records at all, you inform the user that the search data may be out of date and that a refresh will take place.

The only problem with this approach is: if a new hotel is added, user can't search on it. so maybe a menu option to refresh combo's should also be added.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic