• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOPopUpButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOPopUpButton


  • Subject: Re: WOPopUpButton
  • From: Ray Kiddy <email@hidden>
  • Date: Sun, 24 Jun 2007 18:13:46 -0700


On Jun 21, 2007, at 11:15 AM, Sigurður E. Vilhelmsson wrote:

Hi all,

I'm a relative newbie to the Java and WebObjects world (actually the
world of programming in general), and have been playing around with
Eclipse and WOLips, using the tutorials on the objectstyle wiki and
the excellent new tutorial by Janine Sisk.  Now I'm starting to
experiment on my own.  I've gone through most of Apple's materials and
Googled my brains out, but a WOPopUpButton has me stomped.

I have a model with two tables, Course and Course_description.  I have
a to-one relationship in the Course table, called course_descriptions,
with a source attribute course_descriptionID in table Course, and a
destination attribute course_descriptionID in table
Course_description.

I am trying to build a form for entering new Courses, where I want to
include a WOPopUpButton where the user can select from the "name"
attributes in table Course_description to populate the
course_descriptionID in table Course.

I figure I need to build an NSArray and populate it with the values
from the Course_description table and then use that to populate the
course_descriptionID in the Course table, but exactly how to do that
is just out of my reach.

Anyone up for a little WO 101?

Best regards,
Sigurdur

Did you ever get an answer to any of your original question? Not the question involving typography?


Why is it that Course and CourseDescription are separate entities. Would it not be that a Course is an entity and that entity has attributes, such as "description"?

Does the course description change every time the course is offered? Even though it is the same course? This seems odd.

(Just FYI, some of the WO tools complain about actually using "description" as an attribute. This is a holdover from the old ObjC days, where 'description' was a method that everyone inherited (if I recall correctly) from NSObject. So, you might want to come up with another name, like "desc".)

Usually, when this has been done before, people have a schema like:

Course:
	name
	desc
	numCredits
	>> CoursesOffered

CourseOffered:
	startDate
	endDate
	location
	>> Professor(s)
	>> Students
	> Course

Professor:
	name
	contactInfo
	>> CourseOffered

Student:
	name
	>> CourseOffered
	etc...

For extra credit, the Professor and the Student can actually come from the same table, a People table. Then "Professor" and "Student" entities can be defined via single-table entity inheritance.

The significant thing to realize about the WOPopupButton is that you are selecting an object from a list of objects. The "displayName" binding can decide how the object gets displayed, but only that. The name of something is not usually a stand-alone thing. It is usually an attribute of the object.

So, you build an array of the objects from which one should choose, bound to "list". Then have an ivar for the list to iterate with, bound to item. Then you have an ivar for the object that gets selected.

Google searches on WOPopupButton may show you examples. I always get confused about whether to use "selected" or "selectedObject" for the chosen thing. I just look it up and see that for a session-based app, one should use "selection". Direct actions are for later.

- ray

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: WOPopUpButton
      • From: "Sigurður E. Vilhelmsson" <email@hidden>
References: 
 >WOPopUpButton (From: "Sigurður E. Vilhelmsson" <email@hidden>)

  • Prev by Date: Re: Java Programming Conventions, was Re: WOPopUpButton
  • Next by Date: Keep WebObjects, Remove cgi-bin
  • Previous by thread: Re: Java Programming Conventions, was Re: WOPopUpButton
  • Next by thread: Re: WOPopUpButton
  • Index(es):
    • Date
    • Thread