mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-22 23:11:15 +00:00
* GSWDatabase/WODisplayGroup.m
compiles without warning cleanup, removed logs, added exceptions * GSWDatabase/WODisplayGroup.h cleanup includes * Examples/WebBookStore1/Main.m removed create and drop tables. * Examples/WebBookStore1/WebBookStore1_main.m adapt to WO naming * Examples/WebBookStore1/Main.gswc -> Main.wo * Examples/WebBookStore1/GNUmakefile updated * Examples/WebBookStore1/Application.h * Examples/WebBookStore1/DirectAction.h * Examples/WebBookStore1/DirectAction.m * Examples/WebBookStore1/Session.h * Examples/WebBookStore1/Main.h WO naming * Examples/WebBookStore1/README new file * Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld added more sample data to connection dictionary * GNUmakefile add GSWDatabase to main project makefile git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@30643 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0a3ed96e5e
commit
705f8cb1cf
18 changed files with 335 additions and 345 deletions
|
@ -1,7 +1,7 @@
|
|||
#ifndef INC_Application_h_
|
||||
#define INC_Application_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
#include <WebObjects/WebObjects.h>
|
||||
|
||||
@interface Application : GSWApplication
|
||||
{
|
||||
|
|
|
@ -1,15 +1,36 @@
|
|||
{
|
||||
EOModelVersion = 2;
|
||||
adaptorName = PostgreSQL;
|
||||
EOModelVersion = 2;
|
||||
adaptorName = PostgreSQL;
|
||||
connectionDictionary = {
|
||||
databaseName = BookStore;
|
||||
};
|
||||
adaptorName = PostgreSQLEOAdaptor;
|
||||
databaseEncoding = NSUTF8StringEncoding;
|
||||
databaseName = BookStore;
|
||||
databaseServer = "172.16.2.10";
|
||||
password = XXXX;
|
||||
userName = XXXX;
|
||||
};
|
||||
entities = (
|
||||
{className = EOGenericRecord; name = Author; },
|
||||
{className = EOGenericRecord; name = Book; },
|
||||
{className = EOGenericRecord; name = Customer; },
|
||||
{className = EOGenericRecord; name = Order; },
|
||||
{className = EOGenericRecord; name = OrderPos; }
|
||||
);
|
||||
internalInfo = {};
|
||||
{
|
||||
className = EOGenericRecord;
|
||||
name = Author;
|
||||
},
|
||||
{
|
||||
className = EOGenericRecord;
|
||||
name = Book;
|
||||
},
|
||||
{
|
||||
className = EOGenericRecord;
|
||||
name = Customer;
|
||||
},
|
||||
{
|
||||
className = EOGenericRecord;
|
||||
name = Order;
|
||||
},
|
||||
{
|
||||
className = EOGenericRecord;
|
||||
name = OrderPos;
|
||||
}
|
||||
);
|
||||
storedProcedures = (
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#ifndef INC_DirectAction_h_
|
||||
#define INC_DirectAction_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
#include <WebObjects/WODirectAction.h>
|
||||
|
||||
@class GSWComponent;
|
||||
@class WOComponent;
|
||||
|
||||
@interface DirectAction : GSWDirectAction
|
||||
@interface DirectAction : WODirectAction
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (GSWComponent *)defaultAction;
|
||||
- (WOComponent *)defaultAction;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "DirectAction.h"
|
||||
#include <GSWeb/GSWeb.h>
|
||||
#include <WebObjects/WebObjects.h>
|
||||
|
||||
@implementation DirectAction : GSWDirectAction
|
||||
@implementation DirectAction : WODirectAction
|
||||
|
||||
- (GSWComponent *)defaultAction
|
||||
{
|
||||
|
|
|
@ -38,7 +38,23 @@ WebBookStore1_RESOURCE_FILES = BookStore.eomodeld
|
|||
WebBookStore1_WEBSERVER_RESOURCE_FILES = Insert.png Delete.png Save.png \
|
||||
CreateTables.png DropTables.png
|
||||
|
||||
WebBookStore1_COMPONENTS = Main.gswc
|
||||
WebBookStore1_COMPONENTS = Main.wo
|
||||
|
||||
SRCS = $(GSWAPP_NAME:=.m)
|
||||
|
||||
HDRS =
|
||||
|
||||
DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble
|
||||
|
||||
ifneq ($(FOUNDATION_LIB),gnu)
|
||||
AUXILIARY_GSW_LIBS = -framework WebObjects -framework WOExtensions \
|
||||
-framework GSWDatabase -framework EOAccess -framework EOControl \
|
||||
-framework PostgreSQLEOAdaptor
|
||||
else
|
||||
AUXILIARY_GSW_LIBS += -lWebObjects -lWOExtensions -lGSWDatabase -lEOAccess \
|
||||
-lEOControl
|
||||
endif
|
||||
|
||||
|
||||
-include Makefile.preamble
|
||||
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
QueryForm: GSWForm {};
|
||||
|
||||
firstNameQueryField: GSWTextField
|
||||
{
|
||||
value = authorDG.queryMatch.firstName;
|
||||
};
|
||||
|
||||
lastNameQueryField: GSWTextField
|
||||
{
|
||||
value = authorDG.queryMatch.lastName;
|
||||
};
|
||||
|
||||
ExecuteQuery: GSWSubmitButton
|
||||
{
|
||||
action = authorDG.qualifyDataSource;
|
||||
value = "Search";
|
||||
};
|
||||
|
||||
SelectionList: GSWRepetition
|
||||
{
|
||||
item = author;
|
||||
list = authorDG.displayedObjects;
|
||||
};
|
||||
|
||||
SelectObjectLink: GSWHyperlink
|
||||
{
|
||||
action = selectObject;
|
||||
};
|
||||
|
||||
ObjectIdentifier: GSWString
|
||||
{
|
||||
value = author.lastName;
|
||||
};
|
||||
|
||||
ModificationForm: GSWForm {};
|
||||
|
||||
lastNameField: GSWTextField
|
||||
{
|
||||
value = authorDG.selectedObject.lastName;
|
||||
};
|
||||
|
||||
firstNameField: GSWTextField
|
||||
{
|
||||
value = authorDG.selectedObject.firstName;
|
||||
};
|
||||
|
||||
InsertButton: GSWImageButton
|
||||
{
|
||||
action = authorDG.insert;
|
||||
filename = "Insert.png";
|
||||
};
|
||||
UpdateButton: GSWImageButton
|
||||
{
|
||||
action = saveChanges;
|
||||
filename = "Save.png";
|
||||
};
|
||||
DeleteButton: GSWImageButton
|
||||
{
|
||||
action = authorDG.delete;
|
||||
filename = "Delete.png";
|
||||
};
|
||||
|
||||
CreateTablesButton: GSWImageButton
|
||||
{
|
||||
action = createTables;
|
||||
filename = "CreateTables.png";
|
||||
};
|
||||
|
||||
DropTablesButton: GSWImageButton
|
||||
{
|
||||
action = dropTables;
|
||||
filename = "DropTables.png";
|
||||
};
|
|
@ -1,50 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Authors</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<!-- Query section -->
|
||||
<CENTER>
|
||||
<H2>Search for Authors</H2>
|
||||
<P>Specify which authors to display below:</P>
|
||||
<GSWEB name=QueryForm>
|
||||
<P>
|
||||
First Name: <GSWEB name=firstNameQueryField></GSWEB> <BR/>
|
||||
Last Name: <GSWEB name=lastNameQueryField></GSWEB> <BR/>
|
||||
</P>
|
||||
<GSWEB name=ExecuteQuery></GSWEB>
|
||||
</GSWEB >
|
||||
</CENTER>
|
||||
|
||||
<!-- Selection section -->
|
||||
<CENTER>
|
||||
<P>Click a link to select that author.</P>
|
||||
<P><GSWEB name=SelectionList>
|
||||
<GSWEB name=SelectObjectLink>
|
||||
<GSWEB name=ObjectIdentifier></GSWEB>
|
||||
</GSWEB>
|
||||
<BR>
|
||||
</GSWEB></P>
|
||||
</CENTER>
|
||||
<HR>
|
||||
|
||||
<!-- Displayed objects section -->
|
||||
<GSWEB name=ModificationForm>
|
||||
<TABLE BORDER=0>
|
||||
<TR><TD>First Name: </TD> <TD> <GSWEB name=firstNameField></GSWEB> </TD></TR>
|
||||
<TR><TD>Last Name: </TD> <TD> <GSWEB name=lastNameField></GSWEB> </TD></TR>
|
||||
</TABLE>
|
||||
<CENTER>
|
||||
<GSWEB name=InsertButton></GSWEB>
|
||||
<GSWEB name=UpdateButton></GSWEB>
|
||||
<GSWEB name=DeleteButton></GSWEB>
|
||||
</CENTER>
|
||||
<CENTER>
|
||||
<GSWEB name=CreateTablesButton></GSWEB>
|
||||
<GSWEB name=DropTablesButton></GSWEB>
|
||||
</CENTER>
|
||||
</GSWEB>
|
||||
<HR>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,15 +1,15 @@
|
|||
#ifndef INC_Main_h_
|
||||
#define INC_Main_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
#include <WebObjects/WebObjects.h>
|
||||
|
||||
@class GSWDisplayGroup;
|
||||
@class WODisplayGroup;
|
||||
|
||||
@interface Main : GSWComponent
|
||||
@interface Main : WOComponent
|
||||
{
|
||||
id author; /* Custom objects or EOGenericRecord. */
|
||||
GSWDisplayGroup *authorDG; /* Initiilaized by [GSWComponent-init]
|
||||
via the components .gswi file. */
|
||||
WODisplayGroup *authorDG; /* Initiilaized by [GSWComponent-init]
|
||||
via the components .wod file. */
|
||||
}
|
||||
|
||||
- (void)selectObject;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include <EOControl/EOControl.h>
|
||||
#include <EOAccess/EOAccess.h>
|
||||
|
||||
#include <GSWDatabase/WODisplayGroup.h>
|
||||
|
||||
#include "Main.h"
|
||||
|
||||
@implementation Main
|
||||
|
@ -15,80 +17,15 @@
|
|||
[[[self session] defaultEditingContext] saveChanges];
|
||||
}
|
||||
|
||||
- (void)createTables
|
||||
- (void) setAuthorDG:(WODisplayGroup*) dg
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
EODatabaseDataSource *dataSource = (id)[authorDG dataSource];
|
||||
EOEntity *entity = [dataSource entity];
|
||||
EOModel *model = [entity model];
|
||||
NSArray *entities = [model entities];
|
||||
EOAdaptor *adaptor = [EOAdaptor adaptorWithModel: model];
|
||||
Class exprClass = [adaptor expressionClass];
|
||||
NSDictionary *createOptDict
|
||||
= [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"NO", @"EODropTablesKey",
|
||||
@"NO", @"EODropPrimaryKeySupportKey", nil];
|
||||
|
||||
EOAdaptorContext *context = [adaptor createAdaptorContext];
|
||||
EOAdaptorChannel *channel = [context createAdaptorChannel];
|
||||
NSArray *exprs;
|
||||
EOSQLExpression *expr;
|
||||
unsigned i,c;
|
||||
|
||||
exprs = [exprClass schemaCreationStatementsForEntities: entities
|
||||
options: createOptDict];
|
||||
|
||||
[channel openChannel];
|
||||
for (i=0, c=[exprs count]; i<c; i++)
|
||||
{
|
||||
expr = [exprs objectAtIndex: i];
|
||||
[channel evaluateExpression: expr];
|
||||
}
|
||||
[channel closeChannel];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)dropTables
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
EODatabaseDataSource *dataSource = (id)[authorDG dataSource];
|
||||
EOEntity *entity = [dataSource entity];
|
||||
EOModel *model = [entity model];
|
||||
NSArray *entities = [model entities];
|
||||
EOAdaptor *adaptor = [EOAdaptor adaptorWithModel: model];
|
||||
Class exprClass = [adaptor expressionClass];
|
||||
NSDictionary *dropOptDict
|
||||
= [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"NO", @"EOPrimaryKeyConstraintsKey",
|
||||
@"NO", @"EOCreatePrimaryKeySupportKey",
|
||||
@"NO", @"EOCreateTablesKey",
|
||||
nil];
|
||||
|
||||
EOAdaptorContext *context = [adaptor createAdaptorContext];
|
||||
EOAdaptorChannel *channel = [context createAdaptorChannel];
|
||||
NSArray *exprs;
|
||||
EOSQLExpression *expr;
|
||||
unsigned i,c;
|
||||
|
||||
exprs = [exprClass schemaCreationStatementsForEntities: entities
|
||||
options: dropOptDict];
|
||||
|
||||
[channel openChannel];
|
||||
for (i=0, c=[exprs count]; i<c; i++)
|
||||
{
|
||||
expr = [exprs objectAtIndex: i];
|
||||
[channel evaluateExpression: expr];
|
||||
}
|
||||
[channel closeChannel];
|
||||
|
||||
[pool release];
|
||||
ASSIGN(authorDG, dg);
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
/* These variables were set via EOKeyValueCoding (KVC) from
|
||||
the gswi initialization or */
|
||||
the wod initialization or */
|
||||
DESTROY(author);
|
||||
DESTROY(authorDG);
|
||||
|
||||
|
|
53
Examples/WebBookStore1/Main.wo/Main.html
Normal file
53
Examples/WebBookStore1/Main.wo/Main.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Authors</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Query section -->
|
||||
<center>
|
||||
<h2>Search for Authors</h2>
|
||||
<p>Specify which authors to display below:</p>
|
||||
<webobject name=QueryForm>
|
||||
<p>
|
||||
First Name: <webobject name=firstNameQueryField></webobject> <BR/>
|
||||
Last Name: <webobject name=lastNameQueryField></webobject> <BR/>
|
||||
</p>
|
||||
<webobject name=ExecuteQuery></webobject>
|
||||
</webobject>
|
||||
</center>
|
||||
|
||||
<!-- Selection section -->
|
||||
<center>
|
||||
<p>Click a link to select that author.</p>
|
||||
<p><webobject name=SelectionList>
|
||||
<webobject name=SelectObjectLink>
|
||||
<webobject name=ObjectIdentifier></webobject>
|
||||
</webobject>
|
||||
<BR>
|
||||
</webobject></p>
|
||||
</center>
|
||||
<HR>
|
||||
|
||||
<!-- Displayed objects section -->
|
||||
<webobject name=ModificationForm>
|
||||
<table border=0>
|
||||
<tr><td>First Name: </td> <td> <webobject name=firstNameField></webobject> </td></tr>
|
||||
<tr><td>Last Name: </td> <td> <webobject name=lastNameField></webobject> </td></tr>
|
||||
</table>
|
||||
<center>
|
||||
<webobject name=InsertButton></webobject>
|
||||
<webobject name=UpdateButton></webobject>
|
||||
<webobject name=DeleteButton></webobject>
|
||||
</center>
|
||||
<center>
|
||||
<!--
|
||||
<webobject name=CreateTablesButton></webobject>
|
||||
<webobject name=DropTablesButton></webobject>
|
||||
-->
|
||||
</center>
|
||||
</webobject>
|
||||
<HR>
|
||||
|
||||
</body>
|
||||
</html>
|
79
Examples/WebBookStore1/Main.wo/Main.wod
Normal file
79
Examples/WebBookStore1/Main.wo/Main.wod
Normal file
|
@ -0,0 +1,79 @@
|
|||
QueryForm: WOForm {};
|
||||
|
||||
firstNameQueryField: WOTextField
|
||||
{
|
||||
value = authorDG.queryMatch.firstName;
|
||||
};
|
||||
|
||||
lastNameQueryField: WOTextField
|
||||
{
|
||||
value = authorDG.queryMatch.lastName;
|
||||
};
|
||||
|
||||
ExecuteQuery: WOSubmitButton
|
||||
{
|
||||
action = authorDG.qualifyDataSource;
|
||||
value = "Search";
|
||||
};
|
||||
|
||||
SelectionList: WORepetition
|
||||
{
|
||||
item = author;
|
||||
list = authorDG.displayedObjects;
|
||||
};
|
||||
|
||||
SelectObjectLink: WOHyperlink
|
||||
{
|
||||
action = selectObject;
|
||||
};
|
||||
|
||||
ObjectIdentifier: WOString
|
||||
{
|
||||
value = author.lastName;
|
||||
};
|
||||
|
||||
ModificationForm: WOForm {
|
||||
multipleSubmit = YES;
|
||||
};
|
||||
|
||||
lastNameField: WOTextField
|
||||
{
|
||||
value = authorDG.selectedObject.lastName;
|
||||
};
|
||||
|
||||
firstNameField: WOTextField
|
||||
{
|
||||
value = authorDG.selectedObject.firstName;
|
||||
};
|
||||
|
||||
InsertButton: WOSubmitButton
|
||||
{
|
||||
action = authorDG.insert;
|
||||
/* filename = "Insert.png"; */
|
||||
value = "Insert";
|
||||
};
|
||||
UpdateButton: WOSubmitButton
|
||||
{
|
||||
action = saveChanges;
|
||||
/* filename = "Save.png"; */
|
||||
value = "Save";
|
||||
};
|
||||
DeleteButton: WOSubmitButton
|
||||
{
|
||||
action = authorDG.delete;
|
||||
/* filename = "Delete.png";*/
|
||||
value = "Delete";
|
||||
};
|
||||
/*
|
||||
CreateTablesButton: WOImageButton
|
||||
{
|
||||
action = createTables;
|
||||
filename = "CreateTables.png";
|
||||
};
|
||||
|
||||
DropTablesButton: WOImageButton
|
||||
{
|
||||
action = dropTables;
|
||||
filename = "DropTables.png";
|
||||
};
|
||||
*/
|
65
Examples/WebBookStore1/README
Normal file
65
Examples/WebBookStore1/README
Normal file
|
@ -0,0 +1,65 @@
|
|||
This is how you can get started.
|
||||
|
||||
Create the database:
|
||||
|
||||
createdb BookStore
|
||||
|
||||
psql BookStore
|
||||
|
||||
copy/paste this stuff in:
|
||||
|
||||
CREATE TABLE BSAUTHOR (FNAME varchar(30), LNAME varchar(30), PID integer NOT NULL);
|
||||
CREATE TABLE BSBOOK (FK_AUTHOR integer, PID integer NOT NULL, TITLE varchar(30));
|
||||
CREATE TABLE BSCUSTOMER (FNAME varchar(30), LNAME varchar(30), PID integer NOT NULL);
|
||||
CREATE TABLE BSORDER (FK_CUSTOMER integer, PID integer NOT NULL);
|
||||
CREATE TABLE BSORDERPOS (FK_ORDER integer, PID integer NOT NULL);
|
||||
CREATE SEQUENCE BSAUTHOR_SEQ;
|
||||
CREATE SEQUENCE BSBOOK_SEQ;
|
||||
CREATE SEQUENCE BSCUSTOMER_SEQ;
|
||||
CREATE SEQUENCE BSORDER_SEQ;
|
||||
CREATE SEQUENCE BSORDERPOS_SEQ;
|
||||
ALTER TABLE BSAUTHOR ADD PRIMARY KEY (PID);
|
||||
ALTER TABLE BSBOOK ADD PRIMARY KEY (PID);
|
||||
ALTER TABLE BSCUSTOMER ADD PRIMARY KEY (PID);
|
||||
ALTER TABLE BSORDER ADD PRIMARY KEY (PID);
|
||||
ALTER TABLE BSORDERPOS ADD PRIMARY KEY (PID);
|
||||
ALTER TABLE BSBOOK ADD CONSTRAINT BSBOOK_author_FK FOREIGN KEY (FK_AUTHOR) REFERENCES BSAUTHOR (PID) DEFERRABLE INITIALLY DEFERRED;
|
||||
ALTER TABLE BSORDER ADD CONSTRAINT BSORDER_customer_FK FOREIGN KEY (FK_CUSTOMER) REFERENCES BSCUSTOMER (PID) DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
%----------------------
|
||||
|
||||
check what we created:
|
||||
|
||||
BookStore=# \d
|
||||
List of relations
|
||||
Schema | Name | Type | Owner
|
||||
--------+----------------+----------+-------
|
||||
public | bsauthor | table | dave
|
||||
public | bsauthor_seq | sequence | dave
|
||||
public | bsbook | table | dave
|
||||
public | bsbook_seq | sequence | dave
|
||||
public | bscustomer | table | dave
|
||||
public | bscustomer_seq | sequence | dave
|
||||
public | bsorder | table | dave
|
||||
public | bsorder_seq | sequence | dave
|
||||
public | bsorderpos | table | dave
|
||||
public | bsorderpos_seq | sequence | dave
|
||||
(10 rows)
|
||||
|
||||
check .../pgsql/data/pg_hba.conf
|
||||
The machine running your program should be able to access your database.
|
||||
This works for me:
|
||||
|
||||
host all all 172.16.112.1/32 password
|
||||
(you might have to change the IP)
|
||||
|
||||
if needed make pgsql load the new config.
|
||||
|
||||
adjust the connection dictionary in BookStore.eomodeld/index.eomodeld
|
||||
|
||||
Especially these fields. You can use any text editor or the EOModelEditor.
|
||||
|
||||
databaseServer = hostname;
|
||||
password = pw;
|
||||
userName = dave;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef INC_Session_h_
|
||||
#define INC_Session_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
#include <WebObjects/WebObjects.h>
|
||||
|
||||
@interface Session : GSWSession
|
||||
{
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
#include <GSWeb/GSWeb.h>
|
||||
#ifndef GNUSTEP
|
||||
#include <GNUstepBase/GNUstep.h>
|
||||
#endif
|
||||
|
||||
#include <WebObjects/WebObjects.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
/* GSWApplicationMain passes the arguments to process any
|
||||
default settings and instantiates the class named as the
|
||||
first parameter to make it the application object.
|
||||
This should be the name of the principal class of the application.
|
||||
The application object should implement it initialization in its
|
||||
-init method. It will be sent -run to start the default run loop.
|
||||
The run loop will listen for requests from the current web adaptor. */
|
||||
/* WOApplicationMain passes the arguments to process any
|
||||
default settings and instantiates the class named as the
|
||||
first parameter to make it the application object.
|
||||
This should be the name of the principal class of the application.
|
||||
The application object should implement it initialization in its
|
||||
-init method. It will be sent -run to start the default run loop.
|
||||
The run loop will listen for requests from the current web adaptor. */
|
||||
int ret=0;
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
||||
ret = WOApplicationMain(@"Application", argc, argv);
|
||||
[arp release];
|
||||
|
||||
return GSWApplicationMain(@"Application", argc, argv);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ include ./config.mak
|
|||
SUBPROJECTS = GSWeb.framework \
|
||||
GSWExtensions.framework \
|
||||
GSWExtensionsGSW.framework \
|
||||
GSWDatabase
|
||||
|
||||
#GSWAdaptors
|
||||
|
||||
|
|
|
@ -32,21 +32,20 @@
|
|||
#ifndef _GSWDisplayGroup_h__
|
||||
#define _GSWDisplayGroup_h__
|
||||
|
||||
#ifdef TCSDB
|
||||
#include <TCSimpleDB/TCSimpleDB.h>
|
||||
#include <TCSimpleDB/EODefines.h>
|
||||
#else
|
||||
#include <EOControl/EOQualifier.h>
|
||||
#include <EOControl/EOEditingContext.h>
|
||||
#include <EOControl/EODataSource.h>
|
||||
#include <EOControl/EODetailDataSource.h>
|
||||
#include <EOControl/EOKeyValueArchiver.h>
|
||||
#include <EOControl/EONull.h>
|
||||
#include <EOControl/EODeprecated.h>
|
||||
#include <EOAccess/EODatabaseDataSource.h>
|
||||
#include <EOControl/EOQualifier.h>
|
||||
#include <EOControl/EOEditingContext.h>
|
||||
#include <EOControl/EODataSource.h>
|
||||
#include <EOControl/EODetailDataSource.h>
|
||||
#include <EOControl/EOKeyValueArchiver.h>
|
||||
#include <EOControl/EONull.h>
|
||||
#include <EOControl/EODeprecated.h>
|
||||
#include <EOAccess/EODatabaseDataSource.h>
|
||||
|
||||
#ifndef GSWDisplayGroup
|
||||
#define GSWDisplayGroup WODisplayGroup
|
||||
#endif
|
||||
|
||||
@interface GSWDisplayGroup : NSObject <NSCoding>
|
||||
@interface WODisplayGroup : NSObject <NSCoding>
|
||||
{
|
||||
id _delegate;
|
||||
/*
|
||||
|
|
|
@ -35,7 +35,11 @@
|
|||
|
||||
@class EOUndoManager;
|
||||
|
||||
#if HAVE_GDL2 // GDL2 implementation
|
||||
#ifndef GNUSTEP
|
||||
#include <GNUstepBase/NSObject+GNUstepBase.h>
|
||||
#endif
|
||||
|
||||
#include <WebObjects/WebObjects.h>
|
||||
#include <EOControl/EOSortOrdering.h>
|
||||
#include <EOControl/EOClassDescription.h>
|
||||
|
||||
|
@ -60,7 +64,6 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
operatorSelector:(SEL)sel;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
@interface NSArray (Indexes)
|
||||
-(NSArray*)indexesOfObjectsIdenticalTo:(NSArray*)objects;
|
||||
|
@ -70,8 +73,6 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
//====================================================================
|
||||
@implementation WODisplayGroup
|
||||
|
||||
#if HAVE_GDL2 // GDL2 implementation
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self == [WODisplayGroup class])
|
||||
|
@ -123,9 +124,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
_queryMinMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
_queryMax = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
_queryMaxMatch = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
NSDebugMLLog(@"WODisplayGroup",@"_queryOperator=%@",_queryOperator);
|
||||
_queryOperator = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
NSDebugMLLog(@"WODisplayGroup",@"_queryOperator=%@",_queryOperator);
|
||||
_queryKeyValueQualifierClassName
|
||||
= [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
|
||||
|
@ -137,10 +136,6 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
[[self class]globalDefaultStringMatchOperator]);
|
||||
ASSIGN(_defaultStringMatchFormat,
|
||||
[[self class]globalDefaultStringMatchFormat]);
|
||||
NSDebugMLLog(@"WODisplayGroup",@"_defaultStringMatchOperator=%@",
|
||||
_defaultStringMatchOperator);
|
||||
NSDebugMLLog(@"WODisplayGroup",@"_defaultStringMatchFormat=%@",
|
||||
_defaultStringMatchFormat);
|
||||
|
||||
[self setFetchesOnLoad:YES];
|
||||
[self setSelectsFirstObjectAfterFetch:YES];
|
||||
|
@ -152,7 +147,6 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
{
|
||||
if ((self=[self init]))
|
||||
{
|
||||
NSDebugMLLog(@"WODisplayGroup",@"WODisplayGroup %p",self);
|
||||
[self setNumberOfObjectsPerBatch:
|
||||
[unarchiver decodeIntForKey:@"numberOfObjectsPerBatch"]];
|
||||
[self setFetchesOnLoad:
|
||||
|
@ -178,24 +172,23 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
[self setQueryOperator:[unarchiver decodeObjectForKey:@"queryOperator"]];
|
||||
[self setQueryKeyValueQualifierClassName:[unarchiver decodeObjectForKey:@"queryKeyValueQualifierClassName"]];
|
||||
[self finishInitialization];
|
||||
NSDebugMLLog(@"WODisplayGroup",@"WODisplayGroup %p : %@",self,self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)unableToSetNilForKey:(NSString*)key
|
||||
- (void)setNilValueForKey:(NSString *)key
|
||||
{
|
||||
if ([key isEqualToString:@"numberOfObjectsPerBatch"])
|
||||
[self setNumberOfObjectsPerBatch:0];
|
||||
else
|
||||
[super unableToSetNilForKey:key];
|
||||
[super setNilValueForKey:key];
|
||||
}
|
||||
|
||||
-(NSString*)description
|
||||
{
|
||||
NSString* dscr=nil;
|
||||
dscr=[NSString stringWithFormat:@"<%s %p - \n",
|
||||
object_get_class_name(self),
|
||||
object_getClassName(self),
|
||||
(void*)self];
|
||||
|
||||
dscr=[dscr stringByAppendingFormat:@"numberOfObjectsPerBatch:[%d]\n",
|
||||
|
@ -477,7 +470,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
}
|
||||
else
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
}
|
||||
return self; //??
|
||||
}
|
||||
|
@ -486,7 +479,7 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO;
|
|||
-(id)_notify:(SEL)selector
|
||||
with:(id)object
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -722,7 +715,7 @@ shouldRedisplayForEditingContextChangeNotification:notification];
|
|||
|
||||
-(BOOL)buildsQualifierFromInput
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -1097,7 +1090,7 @@ shouldRedisplayForEditingContextChangeNotification:notification];
|
|||
|
||||
-(id)executeQuery
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return nil;//return nil for direct .gswd actions ==> same page
|
||||
}
|
||||
|
||||
|
@ -1142,7 +1135,6 @@ shouldRedisplayForEditingContextChangeNotification:notification];
|
|||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"%@ (%@)",localException,[localException reason]);
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
RETAIN(localException);
|
||||
DESTROY(arp);
|
||||
AUTORELEASE(localException);
|
||||
|
@ -1189,7 +1181,7 @@ shouldRedisplayForEditingContextChangeNotification:notification];
|
|||
|
||||
-(NSMutableDictionary*)inputObjectForQualifier
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -1258,7 +1250,6 @@ shouldRedisplayForEditingContextChangeNotification:notification];
|
|||
index=max(0,index);
|
||||
index=min(count,index);
|
||||
|
||||
NSDebugMLog(@"INSERT Index=%d",index);
|
||||
[self insertObjectAtIndex:index];
|
||||
[self displayBatchContainingSelectedObject];
|
||||
|
||||
|
@ -1394,7 +1385,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
|
||||
-(EOQualifier*)lastQualifierFromInputValues
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -1408,7 +1399,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
|
||||
-(BOOL)usesOptimisticRefresh
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -1416,12 +1407,12 @@ createObjectFailedForDataSource:_dataSource];
|
|||
|
||||
-(void)setUsesOptimisticRefresh:(id)object_
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
}
|
||||
|
||||
-(void)awakeFromNib
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
}
|
||||
|
||||
|
||||
|
@ -1465,7 +1456,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
|
||||
-(EOQualifier*)qualifierFromInputValues
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -1537,17 +1528,14 @@ createObjectFailedForDataSource:_dataSource];
|
|||
if (setQualifierSel)
|
||||
[_dataSource performSelector:setQualifierSel
|
||||
withObject:qualifier];
|
||||
|
||||
NSDebugMLLog0(@"gswdisplaygroup",@"Will fetch");
|
||||
|
||||
[self fetch];
|
||||
NSDebugMLLog0(@"gswdisplaygroup",@"End fetch");
|
||||
|
||||
[self setCurrentBatchIndex:1];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"%@ (%@)",localException,[localException reason]);
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
|
@ -1660,7 +1648,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
|
||||
-(NSMutableDictionary*)secondObjectForQualifier
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -1823,7 +1811,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
|
||||
- (void)setBuildsQualifierFromInput:(BOOL)flag
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -1832,31 +1820,28 @@ createObjectFailedForDataSource:_dataSource];
|
|||
- (void)setCurrentBatchIndex:(unsigned)index
|
||||
{
|
||||
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"index=%d",index);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_numberOfObjectsPerBatch=%d",_numberOfObjectsPerBatch);
|
||||
if(_numberOfObjectsPerBatch>0)
|
||||
{
|
||||
int batchCount=[self batchCount];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"batchCount=%d",batchCount);
|
||||
|
||||
if (index<1)
|
||||
_batchIndex=(batchCount>0 ? batchCount : 1);
|
||||
else if (index>batchCount)
|
||||
_batchIndex=1;
|
||||
else
|
||||
_batchIndex=index;
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_batchIndex=%d",_batchIndex);
|
||||
}
|
||||
}
|
||||
|
||||
-(void)_checkSelectedBatchConsistency
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)_allowsNullForKey:(id)key
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
[self notImplemented: _cmd]; //TODOFN
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -1880,7 +1865,6 @@ createObjectFailedForDataSource:_dataSource];
|
|||
{
|
||||
ASSIGN(_defaultStringMatchFormat, format);
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -1889,7 +1873,6 @@ createObjectFailedForDataSource:_dataSource];
|
|||
- (void)setDefaultStringMatchOperator:(NSString *)operator
|
||||
{
|
||||
ASSIGN(_defaultStringMatchOperator, operator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchOperator=%@",_defaultStringMatchOperator);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -1997,17 +1980,15 @@ createObjectFailedForDataSource:_dataSource];
|
|||
- (void)setMasterObject:(id)masterObject
|
||||
{
|
||||
EODetailDataSource *source=nil;
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"masterObject=%@",masterObject);
|
||||
|
||||
if([self hasDetailDataSource] == YES)
|
||||
{
|
||||
source = (EODetailDataSource *)_dataSource;
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"source=%@",source);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[source detailKey]=%@",[source detailKey]);
|
||||
|
||||
[_dataSource qualifyWithRelationshipKey:[source detailKey]
|
||||
ofObject:masterObject];
|
||||
if ([self fetchesOnLoad])
|
||||
{
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"will fetch");
|
||||
[self fetch];
|
||||
}
|
||||
}
|
||||
|
@ -2139,9 +2120,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
retValue=YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_selection count]=%d",[_selection count]);
|
||||
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
@ -2198,35 +2177,24 @@ createObjectFailedForDataSource:_dataSource];
|
|||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_qualifier=%d",
|
||||
_qualifier);
|
||||
// Filter ?
|
||||
if (_qualifier)
|
||||
{
|
||||
newDisplayedObjects=[newDisplayedObjects
|
||||
filteredArrayUsingQualifier:_qualifier];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
|
||||
[newDisplayedObjects count]);
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_sortOrdering=%d",
|
||||
_sortOrdering);
|
||||
// Sort ?
|
||||
if (_sortOrdering)
|
||||
{
|
||||
newDisplayedObjects=[newDisplayedObjects
|
||||
sortedArrayUsingKeyOrderArray:_sortOrdering];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[newDisplayedObjects count]=%d",
|
||||
[newDisplayedObjects count]);
|
||||
}
|
||||
}
|
||||
ASSIGN(_displayedObjects,([NSMutableArray arrayWithArray:newDisplayedObjects]));
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[_displayedObjects count]=%d",
|
||||
[_displayedObjects count]);
|
||||
|
||||
[self selectObjectsIdenticalTo:selectedObjects
|
||||
selectFirstOnNoMatch:NO];
|
||||
[self redisplay];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"STOP updateDisplayedObjects");
|
||||
/*
|
||||
NSEnumerator *objsEnum=nil;
|
||||
id object=nil;
|
||||
|
@ -2288,11 +2256,10 @@ createObjectFailedForDataSource:_dataSource];
|
|||
[self notImplemented:_cmd];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#if HAVE_GDL2 // GDL2 implementation
|
||||
//#if HAVE_GDL2 // GDL2 implementation
|
||||
//====================================================================
|
||||
@implementation GSWDisplayGroup (Private)
|
||||
-(void)finishInitialization
|
||||
|
@ -2359,25 +2326,21 @@ createObjectFailedForDataSource:_dataSource];
|
|||
{
|
||||
NSEnumerator *enumerator=nil;
|
||||
NSString *key=nil;
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"values=%@",values);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)sel,
|
||||
NSStringFromSelector(sel));
|
||||
|
||||
enumerator = [values keyEnumerator];
|
||||
|
||||
while((key = [enumerator nextObject]))
|
||||
{
|
||||
EOQualifier* qualifier=nil;
|
||||
id value=[values objectForKey:key];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"key=%@ value=%@",key,value);
|
||||
|
||||
qualifier=[self _qualifierForKey:key
|
||||
value:value
|
||||
operatorSelector:sel];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
|
||||
if (qualifier)
|
||||
[array addObject:qualifier];
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"array=%@",array);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2388,19 +2351,13 @@ createObjectFailedForDataSource:_dataSource];
|
|||
EOClassDescription* cd=nil;
|
||||
EOQualifier* qualifier=nil;
|
||||
NSException* validateException=nil;
|
||||
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"value=%@",value);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)operatorSelector,
|
||||
NSStringFromSelector(operatorSelector));
|
||||
|
||||
|
||||
// Get object class description
|
||||
cd=[_dataSource classDescriptionForObjects];
|
||||
|
||||
// Validate the value against object class description
|
||||
validateException=[cd validateValue:&value
|
||||
forKey:key];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"validateException=%@",validateException);
|
||||
|
||||
if (validateException)
|
||||
{
|
||||
|
@ -2410,9 +2367,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
{
|
||||
NSString* qualifierClassName=[_queryKeyValueQualifierClassName objectForKey:key];
|
||||
Class qualifierClass=Nil;
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"key=%@",key);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryKeyValueQualifierClassName=%@",_queryKeyValueQualifierClassName);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifierClassName=%@",qualifierClassName);
|
||||
|
||||
if ([qualifierClassName length]>0)
|
||||
{
|
||||
qualifierClass=NSClassFromString(qualifierClassName);
|
||||
|
@ -2423,23 +2378,12 @@ createObjectFailedForDataSource:_dataSource];
|
|||
}
|
||||
else
|
||||
qualifierClass=[EOKeyValueQualifier class];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)operatorSelector,
|
||||
NSStringFromSelector(operatorSelector));
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"EOQualifierOperatorEqual=%p: %@",
|
||||
(void*)EOQualifierOperatorEqual,
|
||||
NSStringFromSelector(EOQualifierOperatorEqual));
|
||||
|
||||
// If the selector is the equal operator
|
||||
if (sel_eq(operatorSelector, EOQualifierOperatorEqual))
|
||||
if (sel_isEqual(operatorSelector, EOQualifierOperatorEqual))
|
||||
{
|
||||
// Search if there's a specific defined operator for it
|
||||
NSString* operatorString=[_queryOperator objectForKey:key];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"key=%@",key);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_queryOperator=%@",_queryOperator);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorString=%@",operatorString);
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"[value isKindOfClass:[NSString class]]=%d",
|
||||
[value isKindOfClass:[NSString class]]);
|
||||
|
||||
// If value is a string, try to do handle string specific operators
|
||||
if([value isKindOfClass:[NSString class]])
|
||||
|
@ -2453,7 +2397,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
{
|
||||
NSString* stringValue = (NSString*)value;
|
||||
// Other string operators don't care about empry string
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"stringValue=%@",stringValue);
|
||||
|
||||
if ([stringValue length]==0)
|
||||
{
|
||||
// So ends here and we'll return a nil qualifier
|
||||
|
@ -2463,7 +2407,6 @@ createObjectFailedForDataSource:_dataSource];
|
|||
}
|
||||
else if ([operatorString length]==0) // ==> defaultStringMatchOperator with defaultStringMatchFormat
|
||||
{
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"_defaultStringMatchFormat=%@",_defaultStringMatchFormat);
|
||||
value=[NSString stringWithFormat:_defaultStringMatchFormat,
|
||||
value];
|
||||
operatorString = _defaultStringMatchOperator;
|
||||
|
@ -2490,20 +2433,12 @@ createObjectFailedForDataSource:_dataSource];
|
|||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"! string value");
|
||||
if ([operatorString length]==0)
|
||||
operatorString = @"=";
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorString=%@",operatorString);
|
||||
operatorSelector = [qualifierClass operatorSelectorForString:operatorString];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"operatorSelector=%p: %@",
|
||||
(void*)operatorSelector,
|
||||
NSStringFromSelector(operatorSelector));
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"%@ %@ %@",
|
||||
key,
|
||||
NSStringFromSelector(operatorSelector),
|
||||
value);
|
||||
|
||||
if (key || operatorSelector || value) // qualifier returned will be nil when we have to discard it
|
||||
{
|
||||
if (operatorSelector)
|
||||
|
@ -2512,7 +2447,6 @@ createObjectFailedForDataSource:_dataSource];
|
|||
initWithKey:key
|
||||
operatorSelector:operatorSelector
|
||||
value:value] autorelease];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2521,13 +2455,12 @@ createObjectFailedForDataSource:_dataSource];
|
|||
}
|
||||
}
|
||||
}
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"qualifier=%@",qualifier);
|
||||
return qualifier;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
@implementation NSArray (Indexes)
|
||||
-(NSArray*)indexesOfObjectsIdenticalTo:(NSArray*)objects
|
||||
|
@ -2546,7 +2479,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
for(i=0;i<objectsCount;i++)
|
||||
{
|
||||
id object=[objects objectAtIndex:i];
|
||||
unsigned int index=[self indexOfObjectIdenticalTo:object];
|
||||
NSUInteger index=[self indexOfObjectIdenticalTo:object];
|
||||
if (index!=NSNotFound)
|
||||
{
|
||||
NSNumber* indexObject=GSWIntNumber((int)index);
|
||||
|
@ -2562,7 +2495,7 @@ createObjectFailedForDataSource:_dataSource];
|
|||
}
|
||||
if (!indexes)
|
||||
indexes=[NSArray array];
|
||||
NSDebugMLLog(@"GSWDisplayGroup",@"indexes count]=%d",[indexes count]);
|
||||
|
||||
return indexes;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue