Package blackberry.web.widget.impl

Examples of blackberry.web.widget.impl.WidgetConfigImpl


        // Disable MDS transcoding since it interferes with whitelist on external sites.
        _bfConfig.setProperty( BrowserFieldConfig.MDS_TRANSCODING_ENABLED, Boolean.FALSE );

        // Enable web inspector debugging if required
        if( _wConfig instanceof WidgetConfigImpl ) {
            WidgetConfigImpl configObj = (WidgetConfigImpl) _wConfig;
            if( DeviceInfo.isCompatibleVersion( 7 ) && configObj.isDebugEnabled() ) {
                _bfConfig.setProperty( "ENABLE_WEB_INSPECTOR", Boolean.TRUE );
            }
        }

        // Check for our Config type and cast.
        if( _wConfig instanceof WidgetConfigImpl ) {
            // Update the transport order.
            updateConnectionFactory();
        }

        // Create Browser field.
        _browserField = new BrowserField( _bfConfig );
        _browserField.addListener( new WidgetBrowserFieldListener( _wConfig ) );

        // Remove animation max value.
        _browserField.getRenderingOptions().setProperty( RenderingOptions.CORE_OPTIONS_GUID,
                RenderingOptions.ANIMATION_COUNT_VALUE, Integer.MAX_VALUE );

        // Enable blackberry.location by default.
        _browserField.getRenderingOptions().setProperty( RenderingOptions.CORE_OPTIONS_GUID,
                RenderingOptions.JAVASCRIPT_LOCATION_ENABLED, true );

        // Add a custom controller to handle requests.
        _browserField.getConfig().setProperty( BrowserFieldConfig.CONTROLLER,
                new WidgetRequestController( _browserField, _wConfig ) );

        // Add a custom error handler.
        _browserField.getConfig().setProperty( BrowserFieldConfig.ERROR_HANDLER,
                new BrowserFieldCustomErrorHandler( _browserField, _wConfig ) );

        // Add custom headers.
        if( _wConfig.getCustomHeaders().size() > 0 ) {
            _browserField.getConfig().setProperty( BrowserFieldConfig.HTTP_HEADERS, _wConfig.getCustomHeaders() );
        }

        // Create field manager.
        if( getAppNavigationMode() ) {
            _manager = new WidgetFieldManager( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Manager.HORIZONTAL_SCROLL
                    | Manager.HORIZONTAL_SCROLLBAR );

            // navController depends on navExtension. Initialize navExtension first
            _navigationJS = new NavigationExtension();
            _navigationExtension = new NavigationNamespace( this, (WidgetFieldManager) _manager );
            _navigationController = new NavigationController( this );
        } else {
            _manager = new VerticalFieldManager( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Manager.HORIZONTAL_SCROLL
                    | Manager.HORIZONTAL_SCROLLBAR );
        }

        // Add BrowserField/Manager to the Screen.
        _manager.add( _browserField );
        add( _manager );

        _bgColor = processColorString( _wConfig.getLoadingScreenColor() );

        // Set background color of the browserfield.
        // -1 denotes an invalid color.
        if( _bgColor != -1 ) {
            Background color = BackgroundFactory.createSolidBackground( _bgColor );
            _browserField.setBackground( color );
            _manager.setBackground( color );
            this.setBackground( color );
            this.getMainManager().setBackground( color );
        }

        // Register extensions.
        Enumeration ext = _wConfig.getExtensions();
        while(ext.hasMoreElements()) {
          Object extension = ext.nextElement();
          if( extension instanceof WidgetExtension ){
            ((WidgetExtension) extension ).register( _wConfig, _browserField );
          }
        }

        // Update the static reference of browser field.
        _browserFieldReference = _browserField;

        // Create the CacheManager to handle caching functions.
        _cacheManager = null;
        if( _wConfig instanceof WidgetConfigImpl ) {
            WidgetConfigImpl wConfigImpl = (WidgetConfigImpl) _wConfig;
            if( wConfigImpl.isCacheEnabled() ) {
                _cacheManager = new CacheManager( wConfigImpl );
            }
            _widgetCacheExtension = new WidgetCacheNamespace( this );
        }
View Full Code Here


    /**
     * Sets the ConnectionFactory to have transport settings from the WidgetConfigImpl.
     */
    private void updateConnectionFactory() {
        // Cast the WidgetConfig to WidgetConfigImpl version.
        WidgetConfigImpl wConfigImpl = (WidgetConfigImpl) _wConfig;
        ConnectionFactory connFact = new ConnectionFactory();

        // Set default transport order.
        connFact.setPreferredTransportTypes( PREFERRED_TRANSPORTS );

        // Set default time out for all connections to 30 seconds.
        connFact.setTimeLimit( 30000L );

        // Set transports if specified in config.xml.
        if( wConfigImpl.getPreferredTransports() != null ) {
            connFact.setPreferredTransportTypes( wConfigImpl.getPreferredTransports() );

            // Set the timeout for transports.
            if( wConfigImpl.getTransportTimeout() != null && wConfigImpl.getTransportTimeout().intValue() >= 0 ) {
                // setTimeLimit sets the max time limit for making a connection.
                connFact.setTimeLimit( wConfigImpl.getTransportTimeout().longValue() );
            }
        }

        // Set options.
        connFact.setTransportTypeOptions( TransportInfo.TRANSPORT_BIS_B, new BisBOptions( "mds-public" ) );
View Full Code Here

        invokeError( t, request.getURL() );
    }

    private void invokeError( Throwable t, String url ) {

        WidgetConfigImpl cfg = (WidgetConfigImpl) _config;

        if( cfg.getForegroundSource().length() == 0 && cfg.getBackgroundSource() != null
                || ApplicationManager.getApplicationManager().inStartup() ) {
            EventLogger.logEvent( Widget.WIDGET_GUID, t.getMessage().getBytes() );
            return;
        }
View Full Code Here

        _wConfig = wConfig;
        initialize();
        _locationURI = locationURI;

        // Set our orientation
        WidgetConfigImpl configImpl = (WidgetConfigImpl) _wConfig;
        if( configImpl.isOrientationDefined() ) {
            int direction;
            if( configImpl.getOrientation() == 0 ) {
                direction = net.rim.device.api.system.Display.DIRECTION_NORTH;
            } else {
                direction = net.rim.device.api.system.Display.DIRECTION_LANDSCAPE;
            }
            net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections( direction );
View Full Code Here

    public void deactivate() {
        EventService.getInstance().fireEvent( ApplicationEventHandler.EVT_APP_BACKGROUND, null, false );
    }

    public static void main( String[] args ) {
        WidgetConfigImpl wConfig = new blackberry.web.widget.autogen.WidgetConfigAutoGen();
        ID.init( wConfig );
        ApplicationRegistry.getInstance().notifyStarted();

        WidgetProperties.getInstance().setGuid( WIDGET_GUID );
        EventLogger.register( WIDGET_GUID, wConfig.getName(), EventLogger.VIEWER_STRING );

        SettingsManager.setFactory( new SettingsStoreFactoryImpl() );

        // push entry
        if( ApplicationRegistry.isDaemon( args ) ) {
View Full Code Here

    }

    private void injectJavaScript( ScriptEngine scriptEngine ) {
        try {
            if( _widgetConfig instanceof WidgetConfigImpl ) {
                WidgetConfigImpl wConfigImpl = (WidgetConfigImpl) _widgetConfig;

                // shared global JS files
                SimpleSortingVector sharedGlobalJSPaths = wConfigImpl.getSharedGlobalJSInjectionPaths();
                sharedGlobalJSPaths.setSortComparator( JSUtilities.getStringComparator() );
                // sort to ensure JS is loaded in correct order
                sharedGlobalJSPaths.reSort();
                Enumeration sharedGlobalJSPathElems = sharedGlobalJSPaths.elements();
                while( sharedGlobalJSPathElems.hasMoreElements() ) {
View Full Code Here

TOP

Related Classes of blackberry.web.widget.impl.WidgetConfigImpl

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.