001         package com.croftsoft.apps.agoracast.c2p;
002    
003         import java.awt.Color;
004         import java.awt.Font;
005    
006         import com.croftsoft.core.lang.Pair;
007    
008         /*********************************************************************
009         * Static constants for Agoracast C2P.
010         *
011         * <p />
012         *
013         * @version
014         *   2002-01-29
015         * @since
016         *   2001-07-22
017         * @author
018         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
019         *********************************************************************/
020    
021         public interface  AgoracastConstants
022         //////////////////////////////////////////////////////////////////////
023         //////////////////////////////////////////////////////////////////////
024         {
025    
026         public static final String  DOCUMENTATION_URL
027           = "https://www.croftsoft.com/agoracast/doc/";
028    
029         //
030    
031         public static final String  LICENSE_FILENAME = "/license.txt";
032    
033         public static final String  LICENSE_FRAME_TITLE
034           = "Agoracast License Agreement";
035    
036         public static final String  LICENSE_FRAME_ICON_IMAGE_NAME
037           = "/icon.gif";
038    
039         public static final String  SPLASH_IMAGE_NAME
040           = "/splash.jpg";
041    
042         //
043    
044         public static final String  FRAME_TITLE
045           = "Agoracast";
046    
047         public static final String  FRAME_ICON_IMAGE_NAME
048           = LICENSE_FRAME_ICON_IMAGE_NAME;
049    
050         //
051    
052         public static final String  CONFIG_FILENAME   = ".agoracast_config";
053    
054         public static final String  DATABASE_FILENAME = ".agoracast_database";
055    
056         public static final String  NEWSRC_FILENAME   = ".agoracast_newsrc";
057    
058         //
059    
060         public static final String  CONFIG_EMAIL     = "E-Mail Address";
061    
062         public static final String  CONFIG_SERVER    = "News Server";
063    
064         public static final String  CONFIG_USERNAME  = "Username";
065    
066         public static final String  CONFIG_NEWSGROUP = "Newsgroup";
067    
068         public static final String  DEFAULT_NEWSGROUP = "alt.marketplace";
069    
070         //
071    
072         public static final String  CONFIG_HELP_EMAIL
073           = "<h3>" + CONFIG_EMAIL + "</h3>"
074           + "<p>"
075           + "All newsgroup messages need an associated e-mail address.  "
076           + "Enter your e-mail address in this field in order to post "
077           + "messages."
078           + "</p>"
079           + "<p>"
080           + "You will not be able to post messages until you enter an "
081           + "e-mail address."
082           + "</p>";
083    
084         public static final String  CONFIG_HELP_SERVER
085           = "<h3>" + CONFIG_SERVER + "</h3>"
086           + "<p>"
087           + "Provide the name of your local newsgroup server, "
088           + "usually provided to you by your Internet Service Provider"
089           + " (ISP) or campus network administrator."
090           + "</p>"
091           + "<p>"
092           + "You will not be able to browse or post messages until you"
093           + " select a server."
094           + "</p>";
095    
096         public static final String  CONFIG_HELP_USERNAME
097           = "<h3>" + CONFIG_USERNAME + "</h3>"
098           + "<p>"
099           + "Some newsgroup servers require a username and password.  "
100           + "If your newsgroup server requires authentication, Agoracast "
101           + "will prompt you for your password the first time you connect "
102           + "to a server."
103           + "</p>"
104           + "<p>"
105           + "Not all newsgroup servers require an authenticated account "
106           + "in order to use them.  Querying a search engine for "
107           + "\"open newsgroup servers\" will yield lists of publicly "
108           + "accessible newsgroup servers."
109           + "</p>";
110    
111         public static final String  CONFIG_HELP_NEWSGROUP
112           = "<h3>" + CONFIG_NEWSGROUP + "</h3>"
113           + "<p>"
114           + "This is the topic you will use for your uploaded and "
115           + "downloaded messages.  "
116           + "You will generally want to leave this at the default value "
117           + "of \"alt.marketplace\", a well-established newsgroup that is "
118           + "carried on most newsgroup servers.  You might want to change "
119           + "this, however, if alt.marketplace is not carried on your "
120           + "newsgroup server."
121           + "</p>"
122           + "<p>"
123           + "You might also you wish to change this if you want to use a "
124           + "more local, focused, or private newsgroup in order to "
125           + "participate in a more local, focused, or private electronic "
126           + "marketplace.  If you are the first one to select a specialized "
127           + "newsgroup instead of the default, you need to let other Agoracast "
128           + "users know that you are posting and scanning for messages there.  "
129           + "As there is currently no automated means of advertising these "
130           + "specialty newsgroups, it is recommended that you use the common "
131           + "default newsgroup instead."
132           + "</p>";
133    
134         public static final String  CONFIG_HELP_TEXT
135           = "<h2>Configuration</h2>"
136           + "The configuration panel is used to edit your newsgroup "
137           + "server connection settings.  These settings are changed "
138           + "when you click on the \"Update\" button."
139           + "Clicking on \"Restore\" will restore the previously saved "
140           + "values as read from a local file."
141           + CONFIG_HELP_SERVER
142           + CONFIG_HELP_EMAIL
143           + CONFIG_HELP_USERNAME
144           + CONFIG_HELP_NEWSGROUP;
145    
146         //
147    
148         public static final int  TAB_INDEX_BROWSE   = 2;
149    
150         public static final int  TAB_INDEX_DEFAULTS = 3;
151    
152         public static final int  TAB_INDEX_POST     = 4;
153    
154         public static final int  TAB_INDEX_LOG      = 5;
155    
156         //
157    
158         public static final String  FIELD_NAME_AGE      = "age";
159    
160         public static final String  FIELD_NAME_ASKING   = "asking";
161    
162         public static final String  FIELD_NAME_BIDDING  = "bidding";
163    
164         public static final String  FIELD_NAME_CATEGORY = "category";
165    
166         public static final String  FIELD_NAME_CITY     = "city";
167    
168         public static final String  FIELD_NAME_COUNTRY  = "country";
169    
170         public static final String  FIELD_NAME_EMAIL    = "email";
171    
172         public static final String  FIELD_NAME_GENDER   = "gender";
173    
174         public static final String  FIELD_NAME_ISBN     = "isbn";
175    
176         public static final String  FIELD_NAME_MANUFACTURER
177           = "manufacturer";
178    
179         public static final String  FIELD_NAME_MODEL
180           = "model";
181    
182         public static final String  FIELD_NAME_NAME     = "name";
183    
184         public static final String  FIELD_NAME_PHONE    = "phone";
185    
186         public static final String  FIELD_NAME_RACE     = "race";
187    
188         public static final String  FIELD_NAME_RATE     = "rate";
189    
190         public static final String  FIELD_NAME_RELIGION = "religion";
191    
192         public static final String  FIELD_NAME_RENT     = "rent";
193    
194         public static final String  FIELD_NAME_STATE    = "state";
195    
196         public static final String  FIELD_NAME_TITLE    = "title";
197    
198         public static final String  FIELD_NAME_URL      = "url";
199    
200         public static final String  FIELD_NAME_YEAR
201           = "year";
202    
203         public static final String  FIELD_NAME_ZIPCODE  = "zipcode";
204    
205         //
206    
207         public static final AgoracastCategory  CATEGORY_ALL
208           = new AgoracastCategory (
209             "-- ALL --",
210             "All categories.",
211             new String [ ] {
212               FIELD_NAME_ASKING,
213               FIELD_NAME_BIDDING,
214               FIELD_NAME_NAME,
215               FIELD_NAME_ZIPCODE },
216             new String [ ] {
217               FIELD_NAME_ASKING,
218               FIELD_NAME_BIDDING,
219               FIELD_NAME_CATEGORY,
220               FIELD_NAME_NAME,
221               FIELD_NAME_ZIPCODE } );
222    
223         public static final AgoracastCategory [ ]  CATEGORIES
224           = new AgoracastCategory [ ] {
225           new AgoracastCategory (
226             "book-for-sale",
227             "Book for sale.",
228             new String [ ] {
229               FIELD_NAME_ASKING,
230               FIELD_NAME_EMAIL,
231               FIELD_NAME_ISBN,
232               FIELD_NAME_TITLE,
233               FIELD_NAME_ZIPCODE },
234             new String [ ] {
235               FIELD_NAME_ASKING,
236               FIELD_NAME_ISBN,
237               FIELD_NAME_TITLE,
238               FIELD_NAME_ZIPCODE } ),
239           new AgoracastCategory (
240             "car-for-sale",
241             "Car for sale.",
242             new String [ ] {
243               FIELD_NAME_MANUFACTURER,
244               FIELD_NAME_MODEL,
245               FIELD_NAME_YEAR,
246               FIELD_NAME_ASKING,
247               FIELD_NAME_EMAIL,
248               FIELD_NAME_CITY,
249               FIELD_NAME_STATE,
250               FIELD_NAME_COUNTRY,
251               FIELD_NAME_ZIPCODE },
252             new String [ ] {
253               FIELD_NAME_MANUFACTURER,
254               FIELD_NAME_MODEL,
255               FIELD_NAME_YEAR,
256               FIELD_NAME_ASKING,
257               FIELD_NAME_CITY,
258               FIELD_NAME_STATE,
259               FIELD_NAME_COUNTRY,
260               FIELD_NAME_ZIPCODE } ),
261           new AgoracastCategory (
262             "carpool",
263             "Ride sharing.",
264             new String [ ] {
265               FIELD_NAME_EMAIL,
266               FIELD_NAME_CITY,
267               FIELD_NAME_STATE,
268               FIELD_NAME_COUNTRY,
269               FIELD_NAME_ZIPCODE },
270             new String [ ] {
271               FIELD_NAME_EMAIL,
272               FIELD_NAME_CITY,
273               FIELD_NAME_STATE,
274               FIELD_NAME_COUNTRY,
275               FIELD_NAME_ZIPCODE } ),
276           new AgoracastCategory (
277             "domain-name",
278             "Domain name for sale.",
279             new String [ ] {
280               FIELD_NAME_NAME,
281               FIELD_NAME_ASKING,
282               FIELD_NAME_EMAIL },
283             new String [ ] {
284               FIELD_NAME_NAME,
285               FIELD_NAME_ASKING,
286               FIELD_NAME_EMAIL } ),
287           new AgoracastCategory (
288             "firearm-for-sale",
289             "Firearm for sale.",
290             new String [ ] {
291               FIELD_NAME_ASKING,
292               FIELD_NAME_EMAIL,
293               FIELD_NAME_NAME,
294               FIELD_NAME_ZIPCODE },
295             new String [ ] {
296               FIELD_NAME_ASKING,
297               FIELD_NAME_NAME,
298               FIELD_NAME_ZIPCODE } ),
299           new AgoracastCategory (
300             "for-sale",
301             "Miscellaneous item for sale.",
302             new String [ ] {
303               FIELD_NAME_NAME,
304               FIELD_NAME_ASKING,
305               FIELD_NAME_EMAIL },
306             new String [ ] {
307               FIELD_NAME_NAME,
308               FIELD_NAME_ASKING,
309               FIELD_NAME_EMAIL } ),
310           new AgoracastCategory (
311             "job-offered",
312             "Job openings.",
313             new String [ ] {
314               FIELD_NAME_TITLE,
315               FIELD_NAME_BIDDING,
316               FIELD_NAME_RATE,
317               FIELD_NAME_EMAIL,
318               FIELD_NAME_CITY,
319               FIELD_NAME_STATE,
320               FIELD_NAME_COUNTRY,
321               FIELD_NAME_ZIPCODE },
322             new String [ ] {
323               FIELD_NAME_TITLE,
324               FIELD_NAME_BIDDING,
325               FIELD_NAME_RATE,
326               FIELD_NAME_CITY,
327               FIELD_NAME_STATE } ),
328           new AgoracastCategory (
329             "job-wanted",
330             "Job seekers.",
331             new String [ ] {
332               FIELD_NAME_ASKING,
333               FIELD_NAME_CITY,
334               FIELD_NAME_COUNTRY,
335               FIELD_NAME_EMAIL,
336               FIELD_NAME_NAME,
337               FIELD_NAME_PHONE,
338               FIELD_NAME_RATE,
339               FIELD_NAME_STATE,
340               FIELD_NAME_TITLE,
341               FIELD_NAME_ZIPCODE },
342             new String [ ] {
343               FIELD_NAME_ASKING,
344               FIELD_NAME_CITY,
345               FIELD_NAME_COUNTRY,
346               FIELD_NAME_PHONE,
347               FIELD_NAME_RATE,
348               FIELD_NAME_STATE,
349               FIELD_NAME_TITLE } ),
350           new AgoracastCategory (
351             "house-for-rent",
352             "House for rent.",
353             new String [ ] {
354               FIELD_NAME_RENT,
355               FIELD_NAME_EMAIL,
356               FIELD_NAME_CITY,
357               FIELD_NAME_STATE,
358               FIELD_NAME_COUNTRY,
359               FIELD_NAME_ZIPCODE },
360             new String [ ] {
361               FIELD_NAME_RENT,
362               FIELD_NAME_CITY,
363               FIELD_NAME_STATE,
364               FIELD_NAME_COUNTRY,
365               FIELD_NAME_ZIPCODE } ),
366           new AgoracastCategory (
367             "house-for-sale",
368             "House for sale.",
369             new String [ ] {
370               FIELD_NAME_ASKING,
371               FIELD_NAME_EMAIL,
372               FIELD_NAME_CITY,
373               FIELD_NAME_STATE,
374               FIELD_NAME_COUNTRY,
375               FIELD_NAME_ZIPCODE },
376             new String [ ] {
377               FIELD_NAME_ASKING,
378               FIELD_NAME_CITY,
379               FIELD_NAME_STATE,
380               FIELD_NAME_COUNTRY,
381               FIELD_NAME_ZIPCODE } ),
382           new AgoracastCategory (
383             "personal-ad",
384             "Personal ad.",
385             new String [ ] {
386               FIELD_NAME_NAME,
387               FIELD_NAME_AGE,
388               FIELD_NAME_GENDER,
389               FIELD_NAME_RACE,
390               FIELD_NAME_RELIGION,
391               FIELD_NAME_EMAIL,
392               FIELD_NAME_CITY,
393               FIELD_NAME_STATE,
394               FIELD_NAME_COUNTRY,
395               FIELD_NAME_ZIPCODE },
396             new String [ ] {
397               FIELD_NAME_AGE,
398               FIELD_NAME_GENDER,
399               FIELD_NAME_RACE,
400               FIELD_NAME_RELIGION,
401               FIELD_NAME_CITY,
402               FIELD_NAME_STATE,
403               FIELD_NAME_COUNTRY,
404               FIELD_NAME_ZIPCODE } ),
405           new AgoracastCategory (
406             "wanted",
407             "Miscellaneous item wanted.",
408             new String [ ] {
409               FIELD_NAME_NAME,
410               FIELD_NAME_BIDDING,
411               FIELD_NAME_EMAIL },
412             new String [ ] {
413               FIELD_NAME_NAME,
414               FIELD_NAME_BIDDING,
415               FIELD_NAME_EMAIL } ) };
416    
417         public static final String [ ]  CHOICES_CATEGORY
418           = AgoracastCategory.getNames ( CATEGORIES );
419    
420         public static final String [ ]  CHOICES_GENDER = {
421           "male",
422           "female",
423           "other" };
424    
425         public static final AgoracastField [ ]  DEFAULT_FIELDS
426           = new AgoracastField [ ] {
427             new AgoracastField (
428               FIELD_NAME_AGE,      // name
429               null,                // value
430               AgoracastField.TYPE_NUMBER,
431               false,               // isReverse
432               null,                // choices
433               "Age in years" ),    // semantic
434             new AgoracastField (
435               FIELD_NAME_ASKING,   // name
436               null,                // value
437               AgoracastField.TYPE_NUMBER,
438               false,               // isReverse
439               null,                // choices
440               "Asking price ($)" ), // semantic
441             new AgoracastField (
442               FIELD_NAME_BIDDING,  // name
443               null,                // value
444               AgoracastField.TYPE_NUMBER,
445               false,               // isReverse
446               null,                // choices
447               "Bidding price ($)" ), // semantic
448             new AgoracastField (
449               FIELD_NAME_CATEGORY, // name
450               null,                // value
451               AgoracastField.TYPE_STRING,
452               false,               // isReverse
453               CHOICES_CATEGORY,    // choices
454               "message type" ),    // semantic
455             new AgoracastField (
456               FIELD_NAME_CITY,     // name
457               null,                // value
458               AgoracastField.TYPE_STRING,
459               false,               // isReverse
460               null,                // choices
461               "City" ),            // semantic
462             new AgoracastField (
463               FIELD_NAME_COUNTRY,  // name
464               null,                // value
465               AgoracastField.TYPE_STRING,
466               false,               // isReverse
467               null,                // choices
468               "Country (US=United States)" ), // semantic
469             new AgoracastField (
470               FIELD_NAME_EMAIL,    // name
471               null,                // value
472               AgoracastField.TYPE_STRING,
473               false,               // isReverse
474               null,                // choices
475               "contact e-mail" ),  // semantic
476             new AgoracastField (
477               FIELD_NAME_GENDER,   // name
478               null,                // value
479               AgoracastField.TYPE_STRING,
480               false,               // isReverse
481               CHOICES_GENDER,      // choices
482               "Gender (sex)" ),    // semantic
483             new AgoracastField (
484               FIELD_NAME_ISBN,     // name
485               null,                // value
486               AgoracastField.TYPE_STRING,
487               false,               // isReverse
488               null,                // choices
489               "International Standard Book Number" ),    // semantic
490             new AgoracastField (
491               FIELD_NAME_MANUFACTURER, // name
492               null,                // value
493               AgoracastField.TYPE_STRING,
494               false,               // isReverse
495               null,                // choices
496               "Manufacturer" ),    // semantic
497             new AgoracastField (
498               FIELD_NAME_MODEL,    // name
499               null,                // value
500               AgoracastField.TYPE_STRING,
501               false,               // isReverse
502               null,                // choices
503               "Model" ),           // semantic
504             new AgoracastField (
505               FIELD_NAME_NAME,     // name
506               null,                // value
507               AgoracastField.TYPE_STRING,
508               false,               // isReverse
509               null,                // choices
510               "Product or service name" ), // semantic
511             new AgoracastField (
512               FIELD_NAME_PHONE,    // name
513               null,                // value
514               AgoracastField.TYPE_STRING,
515               false,               // isReverse
516               null,                // choices
517               "contact phone number" ),  // semantic
518             new AgoracastField (
519               FIELD_NAME_RACE,     // name
520               null,                // value
521               AgoracastField.TYPE_STRING,
522               false,               // isReverse
523               null,                // choices
524               "Race" ), // semantic
525             new AgoracastField (
526               FIELD_NAME_RATE,   // name
527               null,                // value
528               AgoracastField.TYPE_NUMBER,
529               false,               // isReverse
530               null,                // choices
531               "Hourly rate ($)" ), // semantic
532             new AgoracastField (
533               FIELD_NAME_RELIGION, // name
534               null,                // value
535               AgoracastField.TYPE_STRING,
536               false,               // isReverse
537               null,                // choices
538               "Religion" ), // semantic
539             new AgoracastField (
540               FIELD_NAME_RENT,     // name
541               null,                // value
542               AgoracastField.TYPE_NUMBER,
543               false,               // isReverse
544               null,                // choices
545               "monthly rent" ),  // semantic
546             new AgoracastField (
547               FIELD_NAME_STATE,    // name
548               null,                // value
549               AgoracastField.TYPE_STRING,
550               false,               // isReverse
551               null,                // choices
552               "State (TX=Texas)" ), // semantic
553             new AgoracastField (
554               FIELD_NAME_TITLE,    // name
555               null,                // value
556               AgoracastField.TYPE_STRING,
557               false,               // isReverse
558               null,                // choices
559               "Title" ),           // semantic
560             new AgoracastField (
561               FIELD_NAME_URL,      // name
562               null,                // value
563               AgoracastField.TYPE_STRING,
564               false,               // isReverse
565               null,                // choices
566               "URL for more info" ), // semantic
567             new AgoracastField (
568               FIELD_NAME_YEAR,     // name
569               null,                // value
570               AgoracastField.TYPE_STRING,
571               false,               // isReverse
572               null,                // choices
573               "Year" ),            // semantic
574             new AgoracastField (
575               FIELD_NAME_ZIPCODE,  // name
576               null,                // value
577               AgoracastField.TYPE_STRING,
578               false,               // isReverse
579               null,                // choices
580               "Zip or Postal Code" ) }; // semantic
581    
582         //
583    
584         public static final String  DOCUMENTATION_FILENAME = "/doc.html";
585    
586         //
587     
588         public static final String  SUBJECT_PREFIX = "[Agoracast]";
589    
590         public static final String  SUBJECT_PREFIX_LOWER_CASE
591           = SUBJECT_PREFIX.toLowerCase ( );
592    
593         public static final String  FOOTER
594           = "--" + "\r\n"
595           + "Agoracast:  "
596           + "Building the World Wide Exchange (http://agoracast.com/)";
597    
598         //
599    
600         public static final int  LOG_TEXT_LENGTH_MAX = 10000;
601    
602         public static final String  IDENTIFIER_DIALOG_TITLE = FRAME_TITLE;
603    
604         //
605    
606         public static final Font  LOG_FONT
607           = new Font ( "Monospaced", Font.PLAIN, 12 );
608    
609         //
610    
611         public static final String  DESCRIBE_TEXT
612           = "Description (optional):";
613    
614         public static final String  TABLE_TEXT
615           = "Click on a column name to sort.  "
616           + "Double-click on a row to view the message.";
617    
618         //
619    
620         public static final int  DOWNLOAD_MAX = 500;
621    
622         //
623    
624         public static final Color  SELECTED_FOREGROUND_COLOR = Color.black;
625    
626         public static final Color  SELECTED_BACKGROUND_COLOR
627           = new Color ( 204, 255, 204 );
628    
629         public static final Color  ODD_FOREGROUND_COLOR      = Color.black;
630    
631         public static final Color  ODD_BACKGROUND_COLOR     
632           = new Color ( 230, 230, 190 );
633    
634         public static final Color  EVEN_FOREGROUND_COLOR     = Color.black;
635    
636         public static final Color  EVEN_BACKGROUND_COLOR     = Color.white;
637    
638         //
639    
640         public static final Color  DEFAULT_PANEL_BACKGROUND_COLOR
641           = null;
642    
643         public static final Color  DEFAULT_TEXTFIELD_BACKGROUND_COLOR
644           = null;
645    
646         //////////////////////////////////////////////////////////////////////
647         //////////////////////////////////////////////////////////////////////
648         }