Package net.rim.device.api.web

Examples of net.rim.device.api.web.WidgetFeature


            _accessList.put(                WidgetConfig.WIDGET_LOCAL_DOMAIN,       // access:uri (FEATURE nodes stored at the root level are defaulted with access:uri=local, access:sub-domain=true
                                            new WidgetAccess(
                                                WidgetConfig.WIDGET_LOCAL_DOMAIN,   // access:uri
                                                true,                               // access:sub-domain
                                                new WidgetFeature[]                 // features allowed for this access node
                                                    { new WidgetFeature(
                                                        "blackberry",        // feature:id
                                                        true,                       // feature:required
                                                        "1.0.0",                    // feature:version
                                                        null),
                                                      new WidgetFeature(
                                                        "blackberry.pim.Task",
                                                        true,
                                                        "1.0.0",
                                                        null),
                                                      new WidgetFeature(
                                                        "blackberry.system",
                                                        true,
                                                        "1.0.0",
                                                        null) }) );                 // sub-features
            _accessList.put(                "http://awong-xp2/",                    // access:uri (FEATURE nodes stored at the root level are defaulted with access:uri=local, access:sub-domain=true
                                            new WidgetAccess(
                                                "http://awong-xp2/",      // access:uri
                                                true,                               // access:sub-domain
                                                new WidgetFeature[]                 // features allowed for this access node
                                                    { new WidgetFeature(
                                                        "blackberry.app",        // feature:id
                                                        true,                       // feature:required
                                                        "1.0.0",                    // feature:version
                                                        null),
                                                      new WidgetFeature(
                                                        "blackberry.push",
                                                        true,
                                                        "1.0.0",
                                                        null),
                                                      new WidgetFeature(
                                                        "blackberry.push.Data",
                                                        true,
                                                        "1.0.0",
                                                        null) }) );                 // sub-features
            _accessList.put(                "http://rim.net/",                    // access:uri (FEATURE nodes stored at the root level are defaulted with access:uri=local, access:sub-domain=true
                                            new WidgetAccess(
                                                "http://rim.net/",      // access:uri
                                                true,                               // access:sub-domain
                                                new WidgetFeature[]                 // features allowed for this access node
                                                    { new WidgetFeature(
                                                        "blackberry.app",        // feature:id
                                                        true,                       // feature:required
                                                        "1.0.0",                    // feature:version
                                                        null),
                                                new WidgetFeature(
                                                        "blackberry.ui.menu",        // feature:id
                                                        true,                       // feature:required
                                                        "1.0.0",                    // feature:version
                                                        null),                                                       
                                                      new WidgetFeature(
                                                        "blackberry.system",
                                                        true,
                                                        "1.0.0",
                                                        null) }) );                 // sub-features
            /**_accessList.put(                "http://atg05-yyz/",                    // access:uri (FEATURE nodes stored at the root level are defaulted with access:uri=local, access:sub-domain=true
View Full Code Here


    // Override other methods ? documentAborted, documentError, documentLoaded, documentProgress.
    // Synchronized to ensure features are loaded properly
    private synchronized void loadFeatures( WidgetFeature[] features, Document doc, ScriptEngine scriptEngine ) {
        int fSize = features.length;
        WidgetFeature feature = null;
        Object extension = null;
        Hashtable jsExtensionsByFeatureId = new Hashtable();
        // Go through the list of all features, store all JS extension in a map first
        for( int i = 0; i < fSize; i++ ) {
            feature = features[ i ];
            extension = ( (WidgetConfigImpl) _widgetConfig ).getExtensionObjectForFeature( feature.getID() );
            if( extension instanceof IJSExtension ) {
                jsExtensionsByFeatureId.put( feature.getID(), extension );
            }
        }

        // Sort by feature id so that the JS gets loaded in the right order
        if( !jsExtensionsByFeatureId.isEmpty() ) {
            SimpleSortingVector featureIds = new SimpleSortingVector();
            Enumeration keys = jsExtensionsByFeatureId.keys();
            while( keys.hasMoreElements() ) {
                featureIds.addElement( keys.nextElement() );
            }

            featureIds.setSortComparator( JSUtilities.getStringComparator() );
            featureIds.reSort();

            Enumeration sortedFeatureIds = featureIds.elements();
            while( sortedFeatureIds.hasMoreElements() ) {
                IJSExtension jsExtension = (IJSExtension) jsExtensionsByFeatureId.get( sortedFeatureIds.nextElement() );
                jsExtension.loadFeature( feature.getID(), feature.getVersion(), doc, scriptEngine, ( (WidgetConfigImpl) _widgetConfig ).getJSInjectionPaths() );
            }
        }

        // Load widget extensions after all JS extensions are loaded
        for( int i = 0; i < fSize; i++ ) {
            feature = features[ i ];
            extension = ( (WidgetConfigImpl) _widgetConfig ).getExtensionObjectForFeature( feature.getID() );
            if( extension != null && extension instanceof WidgetExtension ) {
                try {
                    ( (WidgetExtension) extension ).loadFeature( feature.getID(), feature.getVersion(), doc, scriptEngine );
                } catch( Exception x ) {
                    // ignore feature
                }
            }
        }      
View Full Code Here

        }      
    }

    private synchronized void unloadFeatures( WidgetFeature[] features ) {
        int fSize = features.length;
        WidgetFeature feature = null;
        Object extension = null;

        for( int i = 0; i < fSize; i++ ) {
            feature = features[ i ];
            extension = ( (WidgetConfigImpl) _widgetConfig ).getExtensionObjectForFeature( feature.getID() );
            if( extension instanceof IJSExtension ) {
                ( (IJSExtension) extension ).unloadFeatures();
            } else if( extension instanceof WidgetExtension ) {
                ( (WidgetExtension) extension ).unloadFeatures( null );
            }
View Full Code Here

TOP

Related Classes of net.rim.device.api.web.WidgetFeature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.