javaextensions/pim/javasrc/com/nokia/mj/impl/pim/Calendar.java
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
child 84 0553e2305d00
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Abstract PIMExtension class.
       
    15  *
       
    16 */
       
    17 
       
    18 // PACKAGE
       
    19 package com.nokia.mj.impl.pim;
       
    20 
       
    21 // CLASS DEFINITION
       
    22 /**
       
    23  * <p>
       
    24  * Nokia propritery class for holding the calendar file name and calendar display name.
       
    25  * </p>
       
    26 
       
    27  * <h3>General</h3>
       
    28  * The object of the class will be returned to user when listcalendars is called from the MIDlet.
       
    29  * Using the object user can obtain either calendar file name or calendar display name. These names should be used in appropriate places.
       
    30  * <ul>
       
    31  * <li>
       
    32  * <h3>Sample MIDlet code snippet</h3>
       
    33  *
       
    34  * <h4>Opening a Memo List from a calendar name Personal available on C drive</h4>
       
    35  *
       
    36  * <code>
       
    37  * import javax.microedition.pim.*; <br>
       
    38  * import com.nokia.mid.pimextension.PIMExtension; <br>
       
    39  * import com.nokia.mid.pimextension.calendar;<br>
       
    40  * <pre>
       
    41  *     ...
       
    42  *     // Gets a PIMExtended class instance
       
    43  *     PIM pim = PIM.getInstance();
       
    44  *     try {
       
    45  *     PIMExtension pimExtension = (PIMExtension) pim;
       
    46  *     }
       
    47  *     catch (ClassCastException e){
       
    48  *     // extension is not avaialable
       
    49  *     }
       
    50  *
       
    51  *     // Gets the list of calendars available on the device
       
    52  *     calendar[] calList = pimExtension.listCalendars();
       
    53  *
       
    54  *     // Opens the memo list from the "Personal" calendar
       
    55  *     EventList memoList = ( EventList )
       
    56  *         calPIM.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE, "Memos", calList.getCalendarFileName);
       
    57  *  ...
       
    58  *  </pre>
       
    59  * </code>
       
    60  */
       
    61 public final class Calendar
       
    62 {
       
    63     /*
       
    64     *
       
    65     * two strings to hold calendar File Name and Calendar name. These should not be accesible, hence they are private.
       
    66     *
       
    67     */
       
    68     private String calendarFileName;
       
    69     private String calendarName;
       
    70     /*
       
    71     *
       
    72     *constructor accessed by jrt implementation to construct the object with the 2 different names of the calendar.
       
    73     *
       
    74     */
       
    75     public Calendar(String fileName, String userName)
       
    76     {
       
    77         calendarFileName = fileName;
       
    78         calendarName = userName;
       
    79     }
       
    80     /*
       
    81     *
       
    82     *
       
    83     * This functions getCalendarFileName() returns the calendar file name in the database.
       
    84     * This string should be passed to all the operations on calendar.
       
    85     *
       
    86     */
       
    87     public String getCalendarFileName()
       
    88     {
       
    89         return calendarFileName;
       
    90     }
       
    91 
       
    92     /*
       
    93     *
       
    94     *
       
    95     * This functions getCalendarName() returns the display name of the calendar.
       
    96     * This should be used for user display purposes.
       
    97     * Note: When user creates a calendar from java side, both the names will be same.
       
    98     * The file created will be named as the string passed by user.
       
    99     * The calendar will also be named with the string.
       
   100     *
       
   101     */
       
   102     public String getCalendarName()
       
   103     {
       
   104         return calendarName;
       
   105     }
       
   106 }