public static void newTest(BrowserPanel panel) throws Exception {
   panel.navigate(getNewURL());
   System.gc();
   Thread.sleep(5000);
   System.out.println("### Free memory: " + Runtime.getRuntime().freeMemory());
   System.out.println("### Total memory: " + Runtime.getRuntime().totalMemory());
   CacheInfo cacheInfo = CacheManager.getInstance().getTransientCacheInfo();
   System.out.println("### RAM cache entries: " + cacheInfo.getNumEntries());
   System.out.println("### RAM cache size: " + cacheInfo.getApproximateSize());
 }
Exemplo n.º 2
0
  public ContentObjectDemo() throws Exception {
    this.setTitle("Lobo Content Object Demo");

    // Create a BrowserPanel and set a default home page.
    final BrowserPanel bp = new BrowserPanel();
    this.browserPanel = bp;
    // The response listener will tell us when a page
    // has finished loading.
    bp.addResponseListener(new LocalResponseListener());
    bp.navigate("http://www.google.com");

    // Create a links panel containing a combo box and a button.
    JPanel linksPanel = new JPanel();
    linksPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
    linksPanel.setLayout(new BoxLayout(linksPanel, BoxLayout.X_AXIS));
    JComboBox linksComboBox = new JComboBox();
    this.linksComboBox = linksComboBox;
    JButton linksButton = new JButton();
    linksButton.setAction(new LinksAction());
    linksButton.setText("Go");
    linksPanel.add(linksComboBox);
    linksPanel.add(linksButton);

    // Add top-level components to window.
    this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
    this.add(linksPanel);
    this.add(bp);

    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // This needs to be called in order
            // to inform extensions about the
            // window closing.
            bp.windowClosing();
          }
        });
  }
Exemplo n.º 3
0
  private void handleDocumentRenderingImpl(
      final NavigatorFrame frame,
      final ClientletResponse response,
      final ComponentContent content) {
    if (frame == this.framePanel) {
      final String title = BrowserPanel.getWindowTitle(response, content);
      this.setDocumentTitle(title);
    }

    final NavigatorWindowEvent event =
        new NavigatorWindowEvent(
            this,
            NavigatorEventType.DOCUMENT_RENDERING,
            frame,
            response,
            response.getRequestType());
    this.latestAccessedFrame = event.getNavigatorFrame();
    if (!EVENT.fireEvent(event)) {
      logger.warning("handleDocumentRendering(): Did not deliver event to any window: " + event);
    }
  }