/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Contributor(s):
* C.N Medappa <jrex_moz@yahoo.com><>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.mozilla.jrex.ui;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
import org.mozilla.jrex.exception.JRexException;
import org.mozilla.jrex.log.JRexL;
import org.mozilla.jrex.navigation.*;
import org.mozilla.jrex.selection.*;
import org.mozilla.jrex.event.history.*;
import org.mozilla.jrex.event.uricontent.*;
import org.mozilla.jrex.event.progress.*;
import org.mozilla.jrex.event.context.*;
import org.mozilla.jrex.event.tooltip.*;
import org.w3c.dom.Element;
import org.mozilla.jrex.event.window.WindowEventConstants;
/**
* JRexCanvas is the browser component. This component wraps the <b>nsWebBrowser</b>
* and related interfaces of mozilla embedding.
* It allows listening to follwing events:
* <ul>
* <li><b>ProgressListener</b></li>
* <li><b>ContextMenuListener</b></li>
* <li><b>HistoryListener</b></li>
* <li><b>KeyListener</b></li>
* <li><b>MouseListener</b></li>
* <li><b>MouseMotionListener</b></li>
* <li><b>URIContentListener</b></li>
* </ul>
*
* The Mouse and Key events are posted directly into Java's SystemEvent queue. So there is
* no specific Mouse and Key Listener for JRexCanvas.
* All the event except URIContentListener are mulitcast events. i.e only one URIContentListener
* can be added to a browser component.
* Listening to ToolTip events not enabled at present. It is used only for internal use.
* It allows operation related to Navigation, Edit and Print actions.
*
* @author <a href="mailto:jrex_moz@yahoo.com">C.N.Medappa</a>
* @version 1.0
* @see org.mozilla.jrex.navigation.WebNavigation
*/
public class JRexCanvas extends java.awt.Canvas {
private static final String className = JRexCanvas.class.getName();
/**
* PrintPreview Navigation Constants
*/
private static final int PRINTPREVIEW_GOTO_PAGENUM = 0;
private static final int PRINTPREVIEW_PREV_PAGE = 1;
private static final int PRINTPREVIEW_NEXT_PAGE = 2;
private static final int PRINTPREVIEW_HOME = 3;
private static final int PRINTPREVIEW_END = 4;
/**
* Persist flags:
*/
/** No special persistence behaviour.
*/
public static final int PERSIST_FLAGS_NONE = 0;
/** Only use cached data (could result in failure if data is not cached).
*/
public static final int PERSIST_FLAGS_FROM_CACHE = 1;
/** Bypass the cached data.
*/
public static final int PERSIST_FLAGS_BYPASS_CACHE = 2;
/** Ignore any redirected data (usually adverts).
*/
public static final int PERSIST_FLAGS_IGNORE_REDIRECTED_DATA = 4;
/** Ignore IFRAME content (usually adverts).
*/
public static final int PERSIST_FLAGS_IGNORE_IFRAMES = 8;
/** Do not run the incoming data through a content converter.
* E.g. to decompress it
*/
public static final int PERSIST_FLAGS_NO_CONVERSION = 16;
/** Replace existing files on the disk (use with due diligence!)
*/
public static final int PERSIST_FLAGS_REPLACE_EXISTING_FILES = 32;
/** Don't modify or add base tags.
*/
public static final int PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS = 64;
/** Make changes to original dom rather than cloning nodes
*/
public static final int PERSIST_FLAGS_FIXUP_ORIGINAL_DOM = 128;
/** Fix links relative to destination location (not origin)
*/
public static final int PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION = 256;
/** Don't make any adjustments to links
*/
public static final int PERSIST_FLAGS_DONT_FIXUP_LINKS = 512;
/** Force serialization of output (one file at a time; not concurrent)
*/
public static final int PERSIST_FLAGS_SERIALIZE_OUTPUT = 1024;
/** Don't make any adjustments to filenames
*/
public static final int PERSIST_FLAGS_DONT_CHANGE_FILENAMES = 2048;
/** Fail on broken inline links
*/
public static final int PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS = 4096;
/**
* Persist state flags:
*/
/** Persister is ready to save data */
public static final int PERSIST_STATE_READY = 1;
/** Persister is saving data */
public static final int PERSIST_STATE_SAVING = 2;
/** Persister has finished saving data */
public static final int PERSIST_STATE_FINISHED = 3;
/**
* Persist result values
*/
/** Persist operation was successful or is still ongoing if Persister is saving. */
public static final int PERSIST_SUCCESS = 1;
/** Persist operation was cancled. */
public static final int PERSIST_ABORTED = 2;
/** Persist operation encountered a non-specific failure. */
public static final int PERSIST_FAILURE = 3;
/**
* Persist encoding constants.
*/
/** Persist encoding Flag to Output only the current selection as opposed to the whole document. */
public static final int ENCODE_FLAGS_SELECTION_ONLY = 1;
/**
* Persist encoding Flag for plaintext output. Convert html to plaintext that looks like the html.
* Implies wrap (except inside <pre>), since html wraps.
* HTML output: always do prettyprinting, ignoring existing formatting.
*/
public static final int ENCODE_FLAGS_FORMATTED = 2;
/**
* Persist encoding Flag to Output without formatting or wrapping the content. This flag
* may be used to preserve the original formatting as much as possible.
*/
public static final int ENCODE_FLAGS_RAW = 4;
/** Persist encoding Flag to Output only the body section and no HTML tags.
*/
public static final int ENCODE_FLAGS_BODY_ONLY = 8;
/** Persist encoding Flag to Wrap even if when not doing formatted output. E.g. for text fields.
*/
public static final int ENCODE_FLAGS_PREFORMATTED = 16;
/**Persist encoding Flag to Wrap documents at the specified column.
*/
public static final int ENCODE_FLAGS_WRAP = 32;
/**
* Persist encoding Flag for plaintext output. Output for format flowed (RFC 2646). This is used
* when converting to text for mail sending. This differs just slightly
* but in an important way from normal formatted, and that is that
* lines are space stuffed. This can't (correctly) be done later.
*/
public static final int ENCODE_FLAGS_FORMAT_FLOWED = 64;
/** Persist encoding Flag to Convert links to absolute links where possible.
*/
public static final int ENCODE_FLAGS_ABSOLUTE_LINKS = 128;
/**
* Persist encoding Flag to Attempt to encode entities standardized at W3C (HTML, MathML, etc).
* This is a catch-all flag for documents with mixed contents. Beware of
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
一般在浏览器中查看页面代码 是浏览器直接下载到的页面代码 在未经渲染前 对于JS AJAX输出的内容是无法得到的 这样我们得到的页面内容和直接走socket抓取回来无任何区别 还是无法得到需要的页面内容。 JS函数及页面元素事件的调用 这些很简单都是依靠用户的EVENT去驱动的,而我们通过SOCKET抓取页面对我们只是流而已无法去模拟用户的EVENT 没有这些EVENT 页面上需要EVENT驱动而展现的内容连显示都不可能 更无从抓取了。 JRex为我们解决了这个问题,试验证明JRex 比cobra的lobobrowser好用。
资源推荐
资源详情
资源评论
收起资源包目录
JRex java webbrowser 爬虫ajax网页 源码 (479个子文件)
runLCUnitTests.bat 382B
run.bat 183B
jrex.cls 884B
org_mozilla_jrex_dom_JRexDocumentImpl.cpp 77KB
org_mozilla_jrex_ui_JRexCanvas.cpp 75KB
org_mozilla_jrex_dom_JRexNodeImpl.cpp 69KB
org_mozilla_jrex_dom_ranges_JRexDOMRangeImpl.cpp 65KB
JRexDOMGlobals.cpp 64KB
JRexWindowImpl.cpp 52KB
org_mozilla_jrex_dom_JRexElementImpl.cpp 46KB
JRexLiveConnectSession.cpp 44KB
JRexNavigationWrapper.cpp 34KB
org_mozilla_jrex_dom_html2_JRexHTMLObjectElementImpl.cpp 31KB
org_mozilla_jrex_dom_html2_JRexHTMLInputElementImpl.cpp 31KB
org_mozilla_jrex_dom_traversal_JRexTreeWalkerImpl.cpp 30KB
JRexEditEventWrapper.cpp 29KB
JRexSelectionWrapper.cpp 29KB
org_mozilla_jrex_dom_html2_JRexHTMLTableElementImpl.cpp 29KB
org_mozilla_jrex_navigation_WebNavigationImpl.cpp 27KB
JRexJSObject.cpp 26KB
org_mozilla_jrex_dom_JRexNamedNodeMapImpl.cpp 25KB
org_mozilla_jrex_dom_html2_JRexHTMLTableCellElementImpl.cpp 23KB
org_mozilla_jrex_dom_html2_JRexHTMLSelectElementImpl.cpp 22KB
org_mozilla_jrex_dom_JRexCharacterDataImpl.cpp 22KB
org_mozilla_jrex_event_JRexEventManager.cpp 22KB
org_mozilla_jrex_dom_events_JRexEventImpl.cpp 21KB
org_mozilla_jrex_dom_html2_JRexHTMLAnchorElementImpl.cpp 20KB
org_mozilla_jrex_dom_html2_JRexHTMLTextAreaElementImpl.cpp 20KB
org_mozilla_jrex_pref_JRexPreference.cpp 20KB
org_mozilla_jrex_selection_JRexSelectionImpl.cpp 20KB
org_mozilla_jrex_dom_html2_JRexHTMLIFrameElementImpl.cpp 19KB
org_mozilla_jrex_dom_html2_JRexHTMLImageElementImpl.cpp 19KB
JRexPersistWrapper.cpp 18KB
org_mozilla_jrex_dom_html2_JRexHTMLAppletElementImpl.cpp 18KB
JRexPrintEventWrapper.cpp 17KB
org_mozilla_jrex_dom_html2_JRexHTMLDocumentImpl.cpp 17KB
org_mozilla_jrex_dom_events_JRexMouseEventImpl.cpp 17KB
JRexInputEventWrapper.cpp 17KB
org_mozilla_jrex_dom_html2_JRexHTMLFrameElementImpl.cpp 16KB
org_mozilla_jrex_dom_JRexDocumentTypeImpl.cpp 16KB
org_mozilla_jrex_dom_JRexDOMImplementationImpl.cpp 16KB
org_mozilla_jrex_dom_traversal_JRexNodeIteratorImpl.cpp 16KB
org_mozilla_jrex_liveconnect_JRexLiveConnectSessionImpl.cpp 15KB
org_mozilla_jrex_dom_html2_JRexHTMLTableRowElementImpl.cpp 15KB
org_mozilla_jrex_dom_html2_JRexHTMLLinkElementImpl.cpp 15KB
org_mozilla_jrex_dom_events_JRexEventTargetImpl.cpp 15KB
JRex_JNI_ProgressEvent.cpp 14KB
org_mozilla_jrex_xpcom_JRexXPCOMImpl.cpp 14KB
org_mozilla_jrex_liveconnect_JRexJSObject.cpp 14KB
org_mozilla_jrex_dom_html2_JRexHTMLAreaElementImpl.cpp 14KB
org_mozilla_jrex_dom_html2_JRexHTMLFormElementImpl.cpp 14KB
JRexPreferenceWrapper.cpp 13KB
org_mozilla_jrex_dom_html2_JRexHTMLOptionElementImpl.cpp 13KB
org_mozilla_jrex_dom_html2_JRexHTMLTableSectionElementImpl.cpp 13KB
org_mozilla_jrex_dom_html2_JRexHTMLButtonElementImpl.cpp 13KB
JRex_JNI_Event.cpp 12KB
org_mozilla_jrex_dom_html2_JRexHTMLScriptElementImpl.cpp 12KB
org_mozilla_jrex_io_JRexInputStream.cpp 12KB
org_mozilla_jrex_dom_JRexAttrImpl.cpp 12KB
JRexStreamListener.cpp 12KB
JRex_JNI_URIContentEvent.cpp 12KB
org_mozilla_jrex_dom_events_JRexMutationEventImpl.cpp 12KB
org_mozilla_jrex_dom_traversal_JRexDocumentTraversalImpl.cpp 11KB
org_mozilla_jrex_dom_html2_JRexHTMLTableColElementImpl.cpp 11KB
JRexWebBrowserChromeImpl.cpp 11KB
org_mozilla_jrex_dom_html2_JRexHTMLBodyElementImpl.cpp 11KB
JRex_JNI_WindowEvent.cpp 10KB
JRexFindWrapper.cpp 10KB
org_mozilla_jrex_dom_html2_JRexHTMLOptionsCollectionImpl.cpp 10KB
org_mozilla_jrex_dom_JRexProcessingInstructionImpl.cpp 10KB
org_mozilla_jrex_dom_html2_JRexHTMLElementImpl.cpp 9KB
org_mozilla_jrex_dom_JRexEntityImpl.cpp 9KB
org_mozilla_jrex_dom_html2_JRexHTMLCollectionImpl.cpp 9KB
org_mozilla_jrex_dom_html2_JRexHTMLParamElementImpl.cpp 8KB
org_mozilla_jrex_dom_html2_JRexHTMLMetaElementImpl.cpp 8KB
org_mozilla_jrex_dom_html2_JRexHTMLHRElementImpl.cpp 8KB
org_mozilla_jrex_dom_html2_JRexHTMLLegendElementImpl.cpp 8KB
org_mozilla_jrex_dom_html2_JRexHTMLLabelElementImpl.cpp 8KB
JRexWebProgressListenerImpl.cpp 8KB
org_mozilla_jrex_dom_JRexNodeListImpl.cpp 8KB
JRexURIContentEventListener.cpp 8KB
org_mozilla_jrex_dom_events_JRexUIEventImpl.cpp 7KB
JRexSHistoryListenerImpl.cpp 7KB
JRex_JNI_HistoryEvent.cpp 7KB
org_mozilla_jrex_dom_JRexNotationImpl.cpp 7KB
org_mozilla_jrex_dom_html2_JRexHTMLBaseFontElementImpl.cpp 7KB
org_mozilla_jrex_dom_html2_JRexHTMLStyleElementImpl.cpp 7KB
org_mozilla_jrex_dom_html2_JRexHTMLOListElementImpl.cpp 7KB
org_mozilla_jrex_dom_html2_JRexHTMLFontElementImpl.cpp 7KB
JRexInputEventListener.cpp 7KB
JRexDirectoryServiceProviderImpl.cpp 7KB
org_mozilla_jrex_dom_html2_JRexHTMLIsIndexElementImpl.cpp 6KB
org_mozilla_jrex_dom_events_JRexDocumentEventImpl.cpp 6KB
JRexInputStream.cpp 6KB
org_mozilla_jrex_dom_ranges_JRexDocumentRangeImpl.cpp 6KB
JRexWindowCreatorImpl.cpp 6KB
org_mozilla_jrex_dom_views_JRexDocumentViewImpl.cpp 6KB
org_mozilla_jrex_dom_html2_JRexHTMLOptGroupElementImpl.cpp 6KB
org_mozilla_jrex_dom_views_JRexAbstractViewImpl.cpp 6KB
org_mozilla_jrex_dom_html2_JRexHTMLFrameSetElementImpl.cpp 6KB
共 479 条
- 1
- 2
- 3
- 4
- 5
eagleking012
- 粉丝: 20
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
前往页