⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xrenderer.java

📁 XBrowser是一个完全免费并且开源的Web浏览器
💻 JAVA
字号:
/****************************************************************
*              XBrowser  -  eXtended web Browser                *
*                                                               *
*           Copyright (c) 2000-2001  Armond Avanes              *
*     Refer to ReadMe & License files for more information      *
*                                                               *
*                                                               *
*                      By: Armond Avanes                        *
*       Armond555@yahoo.com     &    Armond333@yahoo.com        *
*                http://xbrowser.sourceforge.net/               *
*****************************************************************/
package xbrowser.renderer;

import java.io.*;
import java.awt.*;
import java.util.*;

import xbrowser.renderer.event.*;
import xbrowser.widgets.*;

/** Abstraction of page rendering window.
 *  Provides support for various aspects:
 *  <OL>
 *      <LI> <A HREF="#Classic"> Features every browser must support </A> </LI>
 *      <LI> <A HREF="#Async"> Asyncronous displaying </A> </LI>
 *      <LI> <A HREF="#History"> Work with page history </A> </LI>
 *      <LI> <A HREF="#Source"> Work with HTML code </A> </LI>
 *      <LI> <A HREF="#Print"> Printer outout capabilities </A> </LI>
 *  </OL>
 *  Implementation for this interface could be of different nature, not only
 *  Sun's <code>JEditorPane</code>. <BR>
 *  We will try to add others (NetClueSoft, ICE, HTMLWindow, maybe own 8-) )
 */
public interface XRenderer
{
	/** Sets the context of this renderer. */
	public void setContext(XRendererContext context);

	/** Returns Component that can be used to incorporate HTML window in
	 *  XBrowser application UI <code>Frame</code> */
	public Component getComponent();
	/** Enables event hook. */
	public void addRendererListener(XRendererListener renderer_listener);
	/** Disables event hook. */
	public void removeRendererListener(XRendererListener renderer_listener);

	/** <A NAME="Classic">
	 *  Go to <code>url</code> specified. */
	public void showURL(String url);
	/** Returns title of current page. */
	public String getPageTitle();

	/** Repeat request to Web-server for current page. */
	public void reload();
	/** Repeat drawing of page. */
	public void refresh();
	/** Returns page properties. */
	public XPageProperties getPageProperties();

	/** <A NAME="Async">
	 *  Cancel loading, layout and displaying for page. */
	public void stopRendering();
	/**  Free resources, stop applets and JS on page. */
	public void destroying();

	/** <A NAME="History">
	 *  Indicates that history has items to go forward. */
	public boolean hasForwardHistory();
	/** Go to next page in history. */
	public void showNextPage();
	/*  Indicates that history has items to return to. */
	public boolean hasBackwardHistory();
	/**  Go to previous page. */
	public void showPreviousPage();
	/** Returns URL for next item's in history. */
	public String getNextPagePath();
	/** Returns URL for previous item's in history. */
	public String getPreviousPagePath();

	/** Allows to fetch history to go forward. */
	public Iterator getForwardHistory();
	/** Allows to fetch history to return. */
	public Iterator getBackwardHistory();

	/** Go to history item specified by <code>index</code>.
	 *  <code> history_type</code> could be either
	 *  {@link xbrowser.renderer.XRenderer#BACKWARD_HISTORY} or
	 *  {@link xbrowser.renderer.XRenderer#FORWARD_HISTORY}. */
	public void showPageFromHistory(int index, int history_type);

	/** Returns URL of current page. Returns <code>null</code> if none. */
	public String getCurrentURL();
	/** Returns URL of current page. Returns empty string if none. */
	public String getPageCompletePath();
	/** Returns URL of hyperlink that is selected now. */
	public String getCurrentFocusedLink();
	/** Returns URLs from history. */
	public Iterator getURLList();

	/** <A NAME="Source">
	 *  Indicates that page HTML source was fully loaded.   */
	public boolean hasSource();
	/**  Returns page HTML source code <em>(could be normalized!)</em>. */
	public String getSource();
	/**  Save source code to file specified.
	 *   Linked elements may or may not be saved too. */
	public void saveContent(File dest_file, int saving_mode);
	/** Perform search specified.
	 *  Throws an exception if end of document reached. */
	public void findNext(String find_phrase, boolean case_sensitive, boolean whole_word, boolean search_up)	throws Exception;
	/** Highlight text on current page. */
	public void selectAll();
	/** Copies to clipboard text presentation of current page. */
	public void copy();

	/** <A NAME="Print">
	 *  Creates printing job for current loaded page.   */
	public void startPrinting(boolean print_immediately);
	/** If printing job was created for current page, it gets cancelled. */
	public void stopPrinting();

	/**  Set scale for page print preview to <code>new_scale</code>. */
	public void changePreviewScale(XPreviewContainer preview, int new_scale);
	/**  Fetch from printers all available page sizes to let user choose
	  *  paper settings in dialogs. */
	public void loadPreviews(final XPreviewContainer preview, int scale) throws Exception;

// Attributes:
	public final static int BACKWARD_HISTORY = 30;
	public final static int FORWARD_HISTORY = 31;

    public final static int SAVING_WEB_PAGE_HTML_ONLY = 20;
    public final static int SAVING_WEB_PAGE_COMPLETELY = 21;
    public final static int SAVING_WEB_PAGE_SINGLE_ARCHIVE = 22;

    public final static String UNTITLED_DOCUMENT = "untitled.html";
    public final static String EMPTY_DOCUMENT = "< ... >";
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -