javaextensions/location/tsrc/vipertest/src/ViperPreferences.java
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 import javax.microedition.lcdui.*;
       
    18 import javax.microedition.location.*;
       
    19 
       
    20 class ViperPreferences extends Form implements CommandListener
       
    21 {
       
    22     int iInterval = -1;
       
    23 
       
    24     int iTimeout = 10;
       
    25 
       
    26     int iMaxAge = -1;
       
    27 
       
    28     int iCoordFormat = 0;
       
    29 
       
    30     private Command iOkCmd = new Command("OK", Command.OK, 1);
       
    31 
       
    32     private Display iDisplay;
       
    33 
       
    34     private Displayable iPreviousScreen;
       
    35 
       
    36     private TextField iIntervalField = new TextField("Interval",
       
    37             "" + iInterval, 5, TextField.NUMERIC);
       
    38 
       
    39     private TextField iTimeoutField = new TextField("Timeout", "" + iTimeout,
       
    40             5, TextField.NUMERIC);
       
    41 
       
    42     private TextField iMaxAgeField = new TextField("Max age", "" + iMaxAge, 5,
       
    43             TextField.NUMERIC);
       
    44 
       
    45     // private ChoiceGroup iCoordFormatChoice =
       
    46     // new ChoiceGroup("Coordinate display format",
       
    47     // Choice.POPUP,
       
    48     // new String[] {"DD",
       
    49     // "DD MM",
       
    50     // "DD MM SS"},
       
    51     // null);
       
    52 
       
    53     ViperPreferences(Display aDisplay, Displayable aPreviousScreen)
       
    54     {
       
    55         super("Preferences");
       
    56         iDisplay = aDisplay;
       
    57         iPreviousScreen = aPreviousScreen;
       
    58         addCommand(iOkCmd);
       
    59         setCommandListener(this);
       
    60         append(iIntervalField);
       
    61         append(iTimeoutField);
       
    62         append(iMaxAgeField);
       
    63         // append(iCoordFormatChoice);
       
    64     }
       
    65 
       
    66     public void commandAction(Command c, Displayable d)
       
    67     {
       
    68         if (c == iOkCmd)
       
    69         {
       
    70             iInterval = Integer.parseInt(iIntervalField.getString());
       
    71             iTimeout = Integer.parseInt(iTimeoutField.getString());
       
    72             iMaxAge = Integer.parseInt(iMaxAgeField.getString());
       
    73             // iCoordFormat = 0;
       
    74             // switch (iCoordFormatChoice.getSelectedIndex())
       
    75             // {
       
    76             // case 1:
       
    77             // iCoordFormat = Coordinates.DD_MM;
       
    78             // break;
       
    79             // case 2:
       
    80             // iCoordFormat = Coordinates.DD_MM_SS;
       
    81             //                break;
       
    82             //            }
       
    83             iDisplay.setCurrent(iPreviousScreen);
       
    84         }
       
    85     }
       
    86 }