javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/taskmanager/SchemeHandler.java
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
child 84 0553e2305d00
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
       
     2 * Copyright (c) 2010 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: java://taskmanager scheme handler.
       
    15 *
       
    16 */
       
    17 package com.nokia.mj.impl.rt.taskmanager;
       
    18 
       
    19 import javax.microedition.io.ConnectionNotFoundException;
       
    20 
       
    21 import com.nokia.mj.impl.coreui.CoreUi;
       
    22 import com.nokia.mj.impl.rt.midp.SchemeHandlerBase;
       
    23 
       
    24 /**
       
    25  * TaskManager platform request scheme handler. These are java: taskmanager?hide
       
    26  * java: taskmanager?show. Using hide URL query application is hided
       
    27  * from the TaskManager and brought visible using show query.
       
    28  */
       
    29 public class SchemeHandler extends SchemeHandlerBase
       
    30 {
       
    31 
       
    32     /*** ----------------------------- PUBLIC ------------------------------ */
       
    33 
       
    34     /**
       
    35      * Execute scheme. If url contains query ?hide application is removed
       
    36      * from the TaskManager and if it contains ?show application is shown on
       
    37      * TaskManager.
       
    38      *
       
    39      * @return false. Since MIDlet needs never be closed before content fetch.
       
    40      * @throws ConnectionNotFoundException if URL was invalid.
       
    41      */
       
    42     public boolean execute(String url) throws ConnectionNotFoundException
       
    43     {
       
    44         if (url.indexOf("?hide") != -1)
       
    45         {
       
    46             CoreUi.hideApplication(true);
       
    47         }
       
    48         else if (url.indexOf("?show") != -1)
       
    49         {
       
    50             CoreUi.hideApplication(false);
       
    51         }
       
    52         else
       
    53         {
       
    54             throw new ConnectionNotFoundException("Invalid URL");
       
    55         }
       
    56 
       
    57         return false;
       
    58     }
       
    59 }
       
    60