001: /***
002: * jwma Java WebMail
003: * Copyright (c) 2000-2003 jwma team
004: *
005: * jwma is free software; you can distribute and use this source
006: * under the terms of the BSD-style license received along with
007: * the distribution.
008: ***/package dtw.webmail.model;
009:
010: import dtw.webmail.util.config.JwmaConfiguration;
011:
012: import javax.servlet.http.HttpSession;
013: import java.util.Date;
014: import java.util.ResourceBundle;
015:
016: /**
017: * An interface defining the contract for interaction with
018: * the JwmaHtmlHelper model.
019: * <p>
020: * The JwmaHtmlHelper helps a view programmer constructing
021: * certain reuseable HTML elements on one hand, and to obtain
022: * information important for views on the other hand (i.e.
023: * the controller URL).
024: *
025: * @author Dieter Wimberger
026: * @version 0.9.7 07/02/2003
027: *
028: */
029: public interface JwmaHtmlHelper {
030:
031: /**
032: * Returns a <tt>String</tt> representing the URL
033: * of the main controller.
034: * <p>
035: * The URL is installation specific, this helper method
036: * allows to make views more "portable".
037: *
038: * @return the URL of the main controller as String.
039: */
040: public String getControllerUrl();
041:
042: /**
043: * Returns a <tt>String</tt> representing the URL
044: * of the SendMailController.
045: * <p>
046: * The URL is installation specific, this helper method
047: * allows to make views more "portable".
048: *
049: * @return the URL of the SendMailController as String.
050: */
051: public String getSendMailControllerUrl();
052:
053: /**
054: * Returns a <tt>String</tt> representing the URL
055: * of the ContactsController.
056: * <p>
057: * The URL is installation specific, this helper method
058: * allows to make views more "portable".
059: *
060: * @return the URL of the ContactsController as String.
061: */
062: public String getContactsControllerUrl();
063:
064: /**
065: * Returns a selection of configured post offices.
066: * <p>
067: * This routine constructs a select with all given
068: * post office names for the view programmer,
069: * and is supposed to be used for selecting a
070: * post office on login.
071: *
072: * @return a post offices select (HTML) as <tt>String</tt>.
073: *
074: * @see dtw.webmail.util.config.JwmaConfiguration
075: * @see dtw.webmail.util.config.PostOffice
076: */
077: public String getPostOfficeSelect(String postoffice);
078:
079: /**
080: * Returns a <tt>String</tt> representing a
081: * path navigator in HTML.
082: * <p>
083: * This routine allows to navigate a more complex
084: * folder tree very fast and efficient. It handles
085: * the path using the actual folder separator char.
086: *
087: * @param storeinfo a reference to the actual store info instance.
088: * @param path the path to be translated into a navigator.
089: *
090: * @return a path navigator (HTML) as String.
091: */
092: public String getPathHierarchyNavigator(JwmaStoreInfo storeinfo,
093: JwmaFolder folder);
094:
095: /**
096: * Returns a <tt>String</tt> representing the
097: * installation specific reference URL for displaying
098: * the given folder.
099: * <p>
100: * The String will not include the anchor tag, but
101: * represent the href attribute value.<br>
102: * This method is supposed to help making views more
103: * portable and simple to write.
104: *
105: * @param folder the <tt>JwmaFolder</tt> to be used for the
106: * display action.
107: * @return the URL for displaying the folder as <tt>String</tt>.
108: *
109: * @see dtw.webmail.model.JwmaFolder
110: */
111: public String getFolderDisplayAction(JwmaFolder folder);
112:
113: /**
114: * Convenience method returning the URL for displaying
115: * the inbox folder.
116: *
117: * @param folder the <tt>JwmaFolder</tt> to be used for the
118: * display action.
119: * @return the URL for displaying the folder as <tt>String</tt>.
120: *
121: * @see #getFolderDisplayAction(JwmaFolder)
122: * @see dtw.webmail.model.JwmaInboxInfo
123: */
124: public String getFolderDisplayAction(JwmaInboxInfo info);
125:
126: /**
127: * Convenience method returning the URL for displaying
128: * the trash folder.
129: *
130: * @param folder the <tt>JwmaFolder</tt> to be used for the
131: * display action.
132: * @return the URL for displaying the folder as <tt>String</tt>.
133: *
134: * @see #getFolderDisplayAction(JwmaFolder)
135: * @see dtw.webmail.model.JwmaInboxInfo
136: */
137: public String getFolderDisplayAction(JwmaTrashInfo info);
138:
139: /**
140: * Returns a <tt>JwmaFolder[]</tt>containing a
141: * destination select in HTML.
142: * <p>
143: * This routine constructs a select with all given
144: * paths for the view programmer, and is supposed
145: * to be used for selecting a destination for certain
146: * folder, mailbox or message move operations.<br>
147: * Lists of paths of move targets can be obtained from
148: * JwmaStoreInfo.
149: *
150: * @param folders a <tt>JwmaFolder[]</tt> to be used as
151: * options for the select.
152: * @return a destinations select (HTML) as String.
153: *
154: * @see dtw.webmail.model.JwmaFolder
155: * @see dtw.webmail.model.JwmaStoreInfo#listFolderMoveTargets()
156: * @see dtw.webmail.model.JwmaStoreInfo#listMessageMoveTargets()
157: */
158: public String getDestinationsSelect(JwmaFolder[] folders);
159:
160: /**
161: * Returns a <tt>String</tt> representing a
162: * frequent recipient select in HTML.
163: * <p>
164: * This routine constructs a select with all given
165: * frequent recipient nicks for the view programmer,
166: * and is supposed to be used for selecting a
167: * frequent recipient very quick.<br>
168: *
169: * @param contacts the JwmaContacts instance.
170: * @param eventhandler added to the select.
171: *
172: * @return a frequent recipient select (HTML) as String.
173: *
174: * @see dtw.webmail.model.JwmaContacts
175: */
176: public String getFrequentSelect(JwmaContacts contacts,
177: String eventhandler);
178:
179: /**
180: * Returns a <tt>String</tt> representing a
181: * category select in HTML.
182: * <p>
183: * This routine constructs a select with all given
184: * categories for the view programmer,
185: * and is supposed to be used for selecting a
186: * (user defined) category for a contact.<br>
187: * If the user did not define any category, the
188: * select will only have the new category option.
189: *
190: * @param contact the <tt>JwmaContact</tt> instance.
191: * @param categories the categories to be listed as options.
192: * @param viewcontent the <tt>ResourceBundle</tt> containing the
193: * localized view content strings.
194: *
195: * @return a categories select (HTML) as String.
196: *
197: * @see dtw.webmail.model.JwmaContacts
198: */
199: public String getCategoriesSelect(JwmaContact ct,
200: String[] categories, ResourceBundle viewcontent);
201:
202: /**
203: * Returns a <tt>String</tt> representing a
204: * proper language select in HTML.
205: * <p>
206: * This routine constructs a select with all available
207: * languages.<br>
208: *
209: * @param prefs the users preferences as <tt>JwmaPreferences</tt>.
210: * @return a language select (HTML) as String.
211: */
212: public String getLanguageSelect(JwmaPreferences prefs);
213:
214: /**
215: * Returns a <tt>String</tt> representing a
216: * proper sorting criteria select in HTML.
217: * <p>
218: * This routine constructs a select with all available
219: * message sorting criterias.<br>
220: *
221: * @param prefs the users preferences as <tt>JwmaPreferences</tt>.
222: * @param eventhandler added to the select.
223: * @param viewcontent the <tt>ResourceBundle</tt> containing the
224: * localized view content strings.
225: *
226: * @return a sorting criteria select (HTML) as String.
227: */
228: public String getSortCriteriaSelect(JwmaPreferences prefs,
229: String eventhandler, ResourceBundle viewcontent);
230:
231: /**
232: * Returns a <tt>String</tt> representing a
233: * MailIdentity select in HTML.
234: * <p>
235: * This routine constructs a select with the users available
236: * mail identities, the default selected.<br>
237: *
238: * @param prefs the users preferences as <tt>JwmaPreferences</tt>.
239: * @return a mail identity select (HTML) as String.
240: */
241: public String getMailIdentitySelect(JwmaPreferences prefs);
242:
243: /**
244: * Returns a <tt>String</tt> representing a
245: * MessageProcessor select in HTML.
246: * <p>
247: * This routine constructs a select with the available
248: * message processors, with the user's one selected.<br>
249: *
250: * @param prefs the users preferences as <tt>JwmaPreferences</tt>.
251: * @return a message processor select (HTML) as String.
252: */
253: public String getMessageProcessorSelect(JwmaPreferences prefs);
254:
255: /**
256: * Returns a <tt>String</tt> representing a
257: * DateFormat select in HTML.
258: * <p>
259: * This routine constructs a select with date format
260: * patterns, with the user's one selected.<br>
261: *
262: * @param prefs the users preferences as <tt>JwmaPreferences</tt>.
263: * @return a date format select (HTML) as String.
264: */
265: public String getDateFormatSelect(JwmaPreferences prefs);
266:
267: /**
268: * Returns a <tt>String</tt> representing a
269: * random append types select in HTML.
270: * <p>
271: * This routine constructs a select with the available
272: * random append types, with the user's one selected.<br>
273: *
274: * @param prefs the users preferences as <tt>JwmaPreferences</tt>.
275: * @param mid a <tt>JwmaMailIdentity</tt> instance.
276: *
277: * @return a random append type select (HTML) as String.
278: */
279: public String getRandomAppendTypesSelect(JwmaPreferences prefs,
280: JwmaMailIdentity mid);
281:
282: /**
283: * Returns a <tt>String</tt> representing a
284: * group members select in HTML.
285: * <p>
286: * This routine constructs a select with all
287: * contacts which are in the given contact group.
288: *
289: * @param group the JwmaContactGroup instance.
290: *
291: * @return a group members select (HTML) as String.
292: *
293: * @see dtw.webmail.model.JwmaContactGroup
294: */
295: public String getGroupMembersSelect(JwmaContactGroup group);
296:
297: /**
298: * Returns a <tt>String</tt> representing a
299: * non group members select in HTML.
300: * <p>
301: * This routine constructs a select with all
302: * contacts which are not in the given contact group.
303: *
304: * @param group the JwmaContactGroup instance.
305: * @param ctdb the contact database.
306: *
307: * @return a non members contact select (HTML) as String.
308: *
309: * @see dtw.webmail.model.JwmaContactGroup
310: * @see dtw.webmail.model.JwmaContacts
311: */
312: public String getNonMembersSelect(JwmaContactGroup group,
313: JwmaContacts ctdb);
314:
315: /**
316: * Returns a <tt>String</tt> representing a
317: * message part description in HTML.
318: * <p>
319: * This routine constructs a description with all given
320: * information about the part for the view programmer,
321: * and is supposed to simplify writing a view.
322: *
323: * @param part the part to be described in HTML.
324: * @param viewcontent the <tt>ResourceBundle</tt> containing the
325: * localized view content strings.
326: *
327: * @return a message part description (HTML) as String.
328: *
329: * @see dtw.webmail.model.JwmaMessagePart
330: */
331: public String getPartDescription(JwmaMessagePart part,
332: ResourceBundle viewcontent);
333:
334: /**
335: * Returns a <tt>String</tt> representing the size
336: * in human readable form.
337: *
338: * @param size the size (in bytes) to be described in
339: * human readable form.
340: * @return the human readable size as String.
341: */
342: public String getSizeString(int size);
343:
344: /**
345: * Returns a <tt>String</tt> representing a
346: * HTML tag for embedding the message parts into
347: * the view.
348: * <p>
349: * This routine constructs an inline view of all
350: * given message parts in HTML. Unknown content types
351: * will be output in form of a description, others
352: * inlined by adding a proper HTML tag.
353: *
354: * @param session the session to store possible contact import.
355: * @param parts the parts to be inlined as inlining HTML.
356: * @param prefs the user's preferences.
357: * @param viewcontent the <tt>ResourceBundle</tt> containing the
358: * localized view content strings.
359: *
360: * @return a HTML document part inlining the parts as String.
361: *
362: * @see #getPartDescription(JwmaMessagePart part, ResourceBundle viewcontent)
363: * @see dtw.webmail.model.JwmaMessagePart
364: */
365: public String displayPartInlined(HttpSession session,
366: JwmaMessagePart part, JwmaPreferences prefs,
367: ResourceBundle viewcontent);
368:
369: /**
370: * Returns a <tt>String</tt> representing a HTML
371: * list of all first characters of the contact's lastnames.
372: * The selected character will be used for the filter,
373: * as well as displayed non-selectable; an option to remove
374: * the filter is appended (ALL).
375: *
376: * @param contacts the actual session's contact database as
377: * <tt>JwmaContacts</tt>.
378: * @param viewcontent the <tt>ResourceBundle</tt> containing the
379: * localized view content strings.
380: *
381: * @return the filter list as <tt>String</tt> (HTML).
382: */
383: public String getAlphabeticFilter(JwmaContacts contacts,
384: ResourceBundle viewcontent);
385:
386: /**
387: * Returns a <tt>String</tt> representing a
388: * category filter select in HTML.
389: * <p>
390: * This routine constructs a select with all used
391: * categories.<br>
392: *
393: * @param contacts the actual session's contact database as
394: * <tt>JwmaContacts</tt>.
395: * @param eventhandler added to the select.
396: * @param viewcontent the <tt>ResourceBundle</tt> containing the
397: * localized view content strings.
398: *
399: * @return a sorting criteria select (HTML) as String.
400: */
401: public String getCategoryFilterSelect(JwmaContacts ctdb,
402: String eventhandler, ResourceBundle viewcontent);
403:
404: }//interface JwmaHtmlHelper
|