Exemplo n.º 1
0
  public void processConnection(HttpConnection connection, Object e) {
    BrowserContent browserContent = null;

    try {
      if (connection.getResponseCode() != HttpConnection.HTTP_NOT_MODIFIED)
        browserContent = _renderingSession.getBrowserContent(connection, this, (Event) e);

      if (browserContent != null) {
        browserContent.finishLoading();

        Field field = browserContent.getDisplayableContent();
        if (field != null) {

          synchronized (Application.getEventLock()) {
            m_oMainScreen.deleteAll();
            m_oMainScreen.add(field);

            /*if ( m_oMainScreen.getFieldCount() > 0 )
            {
            	Field old = m_oMainScreen.getField(0);
            	m_oMainScreen.add(field);
            	m_oMainScreen.delete(old);
            }else
            	m_oMainScreen.add(field);*/
            /*
            _mainScreen.doPaint();
            if ( e == null )
            {//This should awake screen in case of long network response
             KeyCodeEvent inject1 = 	new KeyCodeEvent( KeyCodeEvent.KEY_DOWN, (char)Keypad.KEY_ESCAPE, 0);
             KeyCodeEvent inject2 =  new KeyCodeEvent( KeyCodeEvent.KEY_UP, (char)Keypad.KEY_ESCAPE, 0);
             inject1.post();
             inject2.post();
             m_bSkipKeyPress = true;
            }*/
          }
        }
      }
    } catch (Exception re) {
      LOG.ERROR("processConnection failed.", re);
    } finally {
      SecondaryResourceFetchThread.doneAddingImages();
    }
  }