Re: Acceesing History and Profile in Mozilla through Jrex

Jean-Philippe Leboeuf <[email protected]> Wed, 09 Aug 2006 11:14:45 +0200
Newsgroups gmane.comp.mozilla.jrex
Message-ID <[email protected]>
Jeet Kulkarni wrote:

>Hello,
>
>  
>
Hello,

>I meant History instead of bookmarks in my previous mail.
>But now that the History thing is sorted out , i would also like to use
>the Bookmarking feature. Is there a way to handle bookmarks?
>  
>
Personally I do not use Mozilla bookmarks but my own bookmarks manager 
(XBEL is the main format).
Netscape/Mozilla bookmarks are stored in HTML, so are easy to manipulate 
directly...

>Also from your reply can i assume that the there is no API for
>creating/accessing user profiles through Jrex?
>  
>
I do not know how to do that with JRex.
I would prepare a dummy profile with Mozilla profile manager and use 
jrex.profile.path and jrex.profile.name to set it at startup.
You would just have to restore it clean each time.
Maybe there is a better answer...

>Thanks,
>Jeet.
>  
>
++jpl

>On Tue, 8 Aug 2006, Jean-Philippe Leboeuf wrote:
>
>  
>
>>Hello,
>>
>>did you mean "History" or "Bookmarks"?
>>
>>1) For history,
>>
>>* You have to create a listener for window events, associated with the
>>window manager:
>>
>>JRexWindowManager winManager = (JRexWindowManager)
>>JRexFactory.getInstance().getImplInstance(JRexFactory.WINDOW_MANAGER);
>>
>>        class OdysseusWindowListener implements
>>org.mozilla.jrex.event.window.WindowListener {
>>          JRexWindowManager winManager;
>>          public OdysseusWindowListener(JRexWindowManager winManager) {
>>            this.winManager = winManager;
>>          }
>>          public void windowCreated(int jrexPeerID) {
>>              logger.debug("windowCreated (jrexPeerID <" + jrexPeerID +
>>">)");
>>              JRexCanvas browser = winManager.getBrowser(jrexPeerID);
>>              browser.addHistoryListener(new
>>OdysseusHistory(browser.getNavigator()));
>>          }
>>          public void windowDisposing(int jrexPeerID) {
>>              logger.debug("windowDisposing (jrexPeerID <" + jrexPeerID
>>+ ">)");
>>          }
>>        }
>>
>>winManager.addJRexWindowListener(new OdysseusWindowListener(winManager));
>>
>>* And here is an example of history listener:
>>
>>/*
>> * Created on 14 sept. 2005
>> */
>>package org.wittycube.projects.odysseus;
>>
>>import java.util.HashMap;
>>import java.net.URI;
>>import org.apache.log4j.Logger;
>>import org.mozilla.jrex.event.history.HistoryEvent;
>>import org.mozilla.jrex.event.history.HistoryListener;
>>import org.mozilla.jrex.exception.JRexException;
>>import org.mozilla.jrex.navigation.WebNavigation;
>>
>>/**
>> * @author jpleboeuf
>> */
>>public class OdysseusHistory implements HistoryListener {
>>
>>  private static Logger logger = Odysseus.logger;
>>
>>  private WebNavigation navigator = null;
>>
>>  public OdysseusHistory(WebNavigation navigator) {
>>    this.navigator = navigator;
>>  }
>>
>>  public void addEntry(HistoryEvent event) {
>>//      logger.debug("URL: " + event.getEventParam().toString().trim());
>>    try {
>>      URI refURI = navigator.getReferringURI();
>>      URI curURI = navigator.getCurrentURI();
>>//      logger.debug("RefURI: " + refURI);
>>//      logger.debug("CurURI: " + curURI);
>>    } catch (JRexException jrexe) {
>>      logger.error(jrexe);
>>    }
>>  }
>>
>>  public boolean reload(HistoryEvent event) {
>>    return true;
>>  }
>>  public boolean goBack(HistoryEvent event) {
>>    return true;
>>  }
>>  public boolean goForward(HistoryEvent event) {
>>    return true;
>>  }
>>  public boolean goToIndex(HistoryEvent event) {
>>    return true;
>>  }
>>  public boolean purge(HistoryEvent event) {
>>    return true;
>>  }
>>
>>}
>>
>>2) I am interested in the problem of creating a temporary profile too.
>>(JDIC, has the same kind of problems: without profile BUT Mozilla
>>installed, JDIC crashes...)
>>
>>++jpl
>>
>>jeet kulkarni wrote:
>>
>>    
>>
>>>I am developing an application where i need to access the History of Mozilla.
>>>I tried using the Histoty class of Jrex and its associated methods ,but
>>>found that the History wasnt getting populated. Alslo i need a way to handle
>>>profiles in Mozilla. I would like to create a profile at run- time and load
>>>the appropriate if possible. Is there an API to achieve this?
>>>
>>>Thanks in Advance.
>>>
>>>- Jeet Kulkarni
>>>Tel No: 631 512 0286.
>>>
>>>
>>>      
>>>
>>_______________________________________________
>>JRex mailing list
>>[email protected]
>>http://mozdev.org/mailman/listinfo/jrex
>>
>>    
>>
>_______________________________________________
>JRex mailing list
>[email protected]
>http://mozdev.org/mailman/listinfo/jrex
>
>
>  
>

_______________________________________________
JRex mailing list
[email protected]
http://mozdev.org/mailman/listinfo/jrex