Re DisplayGroups. Inserting and deleting objs
Re DisplayGroups. Inserting and deleting objs
- Subject: Re DisplayGroups. Inserting and deleting objs
- From: Jevon Hills <email@hidden>
- Date: Wed, 15 Jan 2003 10:03:25 -0700
I am creating a tool which will allow the associating of a CardKey to 0
or More Consoles.
Back ground -
will be using card keys for security. A card key can only access a
console if it is associated with it. This is a many to Many relation
ship modeled in the database by a table of CardKeys, a table of
Consoles and a linktable between the 2. the link table contains cardid
and consoleid.
so when I add a Console to a Card I just add a row to the link table
and, obviously when I remove an association I delete a row.
Practical -
You select which cardKey you want to add/remove associations from and
then move to the ConsoleCardKey associations page. For the visual
interface I have chosen 2 WOBrowser list boxes with buttons between
them.
[demime 0.98b removed an attachment of type multipart/appledouble]
I have several objects on this page, but the one I am having trouble
with is the ConsoleCardKeyDisplayGroup. This display group is a list
of all rows in the 'link' table. When Consoles are added or removed it
is this display group that I wish to update so that the database is
modified correctly.
Add console -
The add console code seems to add rows to the database, although this
may not be the correct way to do it:
associateConsoles - the console(s) selected on the left when the add
button was pressed
for (int icount = 0; icount < associateConsoles.count(); icount++)
{
con = (Console) associateConsoles.objectAtIndex(icount);
if (!selectedSCConsoles.containsObject(con))
{
selectedSCConsoles.addObject((Console) con);
// build smplt and add to groups
ConsoleSmartCardLinkTable csclt = new
ConsoleSmartCardLinkTable(selectedCard, con);
ConsoleSmartCardLinkTableDisplayGroup.insert();
ConsoleSmartCardLinkTable temp = (ConsoleSmartCardLinkTable)
ConsoleSmartCardLinkTableDisplayGroup.selectedObject();
temp.setConsoleid(csclt.consoleid());
temp.setSmartcardid(csclt.smartcardid());
}
}
try
{
saveChanges();
}
The remove console appears to work and visually it is removed from the
list on the right hand side, but the database is not updated and no SQL
is generated behind the scene:
selectedSCSelectedConsoles - the console(s) selected on the right when
the remove button was pressed
while(selectedSCSelectedConsoles.count() > 0)
{
currentConsole = (Console) selectedSCSelectedConsoles.objectAtIndex(0);
//these 2 lines remove the console from arrays on the page.
selectedSCConsoles.removeObject(currentConsole);
selectedSCSelectedConsoles.removeObject(currentConsole);
ConsoleSmartCardLinkTable smplt = new
ConsoleSmartCardLinkTable(selectedCard, currentConsole);
ConsoleSmartCardLinkTableDisplayGroup.selectObject(smplt);
boolean isDeleted =
ConsoleSmartCardLinkTableDisplayGroup.deleteSelection();
try
{
saveChanges();
}
}
What parts am i missing???? I have printed out the isDeleted and it is
always true, but the row is never removed from the table.....
I appologize for the lengthy email, but I wanted to be clear about what
was happening.
tia
Jevon K. Hills
Intern - Zymeta Media Promotion Systems
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.