Added code to throw UnimplementedException whenever a method tht is

not yet implemented is called.

Bug = 40330
a = ashuk
r = edburns

_Ashu
This commit is contained in:
ashuk%eng.sun.com 2000-05-23 21:06:41 +00:00
parent 765bec1b18
commit ca5c9043df
4 changed files with 104 additions and 17 deletions

View File

@ -50,7 +50,7 @@ import org.mozilla.util.Assert;
* This is a test application for using the BrowserControl.
*
* @version $Id: EMWindow.java,v 1.5 2000/04/22 02:00:57 edburns%acm.org Exp $
* @version $Id: EMWindow.java,v 1.6 2000/05/23 21:06:41 ashuk%eng.sun.com Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
@ -98,14 +98,18 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc
Menu fileMenu = new Menu("File");
Menu viewMenu = new Menu("View");
Menu searchMenu = new Menu("Search");
Menu editMenu = new Menu("Edit");
MenuItem newItem = new MenuItem("New Window");
MenuItem closeItem = new MenuItem("Close");
MenuItem findItem = new MenuItem("Find");
MenuItem findNextItem = new MenuItem("Find Next");
MenuItem sourceItem = new MenuItem("View Page Source");
MenuItem pageInfoItem = new MenuItem("View Page Info");
MenuItem selectAllItem = new MenuItem("Select All");
menuBar.add(fileMenu);
menuBar.add(viewMenu);
menuBar.add(searchMenu);
menuBar.add(editMenu);
fileMenu.add(newItem);
newItem.addActionListener(this);
fileMenu.add(closeItem);
@ -116,6 +120,10 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc
findNextItem.addActionListener(this);
viewMenu.add(sourceItem);
sourceItem.addActionListener(this);
viewMenu.add(pageInfoItem);
pageInfoItem.addActionListener(this);
editMenu.add(selectAllItem);
selectAllItem.addActionListener(this);
// Create the URL field
urlField = new TextField("", 30);
@ -318,9 +326,15 @@ public void delete()
currentPage.findNextInPage(false);
}
else if (command.equals("View Page Source")) {
// currentPage.getSourceBytes(viewMode);
currentPage.getSourceBytes(viewMode);
viewMode = !viewMode;
}
else if (command.equals("View Page Info")) {
currentPage.getPageInfo();
}
else if (command.equals("Select All")) {
currentPage.selectAll();
}
}
else if(command.equals("Stop")) {

View File

@ -36,6 +36,8 @@ import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.DefaultTreeModel;
import org.mozilla.webclient.UnimplementedException;
public class BookmarksImpl extends ImplObjectNative implements Bookmarks
{
//
@ -160,7 +162,8 @@ public void removeBookmark(BookmarkEntry bookmark)
{
myFactory.throwExceptionIfNotInitialized();
Assert.assert(-1 != nativeWebShell);
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::getPageInfo has not yet been implemented.\n");
}
public BookmarkEntry newBookmarkEntry(String url)
@ -219,7 +222,7 @@ public static void main(String [] args)
Log.setApplicationName("BookmarksImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: BookmarksImpl.java,v 1.3 2000/03/13 18:42:08 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: BookmarksImpl.java,v 1.4 2000/05/23 21:06:11 ashuk%eng.sun.com Exp $");
try {
org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]);

View File

@ -31,6 +31,12 @@ import org.mozilla.webclient.CurrentPage;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
import java.util.Properties;
import java.io.*;
import java.net.*;
import org.mozilla.webclient.UnimplementedException;
public class CurrentPageImpl extends ImplObjectNative implements CurrentPage
{
//
@ -112,17 +118,33 @@ public String getCurrentURL()
// org.w3c.dom.Document getDOM();
// webclient.PageInfo getPageInfo();
public Properties getPageInfo()
{
Properties result = null;
/* synchronized(myBrowserControl) {
result = nativeGetPageInfo(nativeWebShell);
}
return result;
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::getPageInfo has not yet been implemented.\n");
}
public String getSource()
{
String result = null;
myFactory.throwExceptionIfNotInitialized();
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
result = nativeGetSource();
}
return result;
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::getSource has not yet been implemented.\n");
// return result;
}
public byte [] getSourceBytes(boolean viewMode)
@ -130,10 +152,43 @@ public byte [] getSourceBytes(boolean viewMode)
byte [] result = null;
myFactory.throwExceptionIfNotInitialized();
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
result = nativeGetSourceBytes(nativeWebShell, viewMode);
}
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::getSourceBytes has not yet been implemented.\n Will be available after Webclient M3 Release\n");
// PENDING (Ashu) - This should work - but it does not get anything from URl
// and hangs up from time to time. Have to Debug. In M15, other native solution
// will also be available using DocShell::viewMode
/*
String HTMLContent = null;
String URL = getCurrentURL();
System.out.println("\nThe Current URL is -- " + URL);
try {
Socket s = new Socket("sunweb.central",80);
BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
boolean more = true;
while (more)
{
String line = in.readLine();
if (line == null) more = false;
else
{
HTMLContent = HTMLContent + line;
System.out.println(line);
}
}
}
catch (Throwable e)
{
System.out.println("Error occurred while establishing connection -- \n ERROR - " + e);
}
return result;
*/
}
public void resetFind()
@ -190,7 +245,7 @@ public static void main(String [] args)
Assert.setEnabled(true);
Log.setApplicationName("CurrentPageImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: CurrentPageImpl.java,v 1.4 2000/04/20 02:59:01 ashuk%eng.sun.com Exp $");
Log.setApplicationVersionDate("$Id: CurrentPageImpl.java,v 1.5 2000/05/23 21:06:11 ashuk%eng.sun.com Exp $");
}

View File

@ -32,6 +32,8 @@ import org.mozilla.webclient.HistoryEntry;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
import org.mozilla.webclient.UnimplementedException;
public class HistoryImpl extends ImplObjectNative implements History
{
//
@ -100,10 +102,13 @@ public HistoryEntry [] getBackList()
Assert.assert(-1 != nativeWebShell);
HistoryEntry [] result = null;
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
result = nativeGetBackList(nativeWebShell);
}
return result;
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function History::getBackList has not yet been implemented.\n");
}
public void clearHistory()
@ -111,14 +116,15 @@ public void clearHistory()
myFactory.throwExceptionIfNotInitialized();
Assert.assert(-1 != nativeWebShell);
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
nativeClearHistory(nativeWebShell);
}
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function History::clearHistory has not yet been implemented.\n");
}
// org.w3c.dom.Document getDOM();
// webclient.PageInfo getPageInfo();
public void forward()
{
@ -148,10 +154,13 @@ public HistoryEntry [] getForwardList()
myFactory.throwExceptionIfNotInitialized();
Assert.assert(-1 != nativeWebShell);
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
result = nativeGetForwardList(nativeWebShell);
}
return result;
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function History::getForwardList has not yet been implemented.\n");
}
public HistoryEntry [] getHistory()
@ -160,10 +169,13 @@ public HistoryEntry [] getHistory()
myFactory.throwExceptionIfNotInitialized();
Assert.assert(-1 != nativeWebShell);
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
result = nativeGetHistory(nativeWebShell);
}
return result;
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function History::getHistory has not yet been implemented.\n");
}
public HistoryEntry getHistoryEntry(int historyIndex)
@ -172,10 +184,13 @@ public HistoryEntry getHistoryEntry(int historyIndex)
Assert.assert(-1 != nativeWebShell);
HistoryEntry result = null;
synchronized(myBrowserControl) {
/* synchronized(myBrowserControl) {
result = nativeGetHistoryEntry(nativeWebShell, historyIndex);
}
return result;
*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function History::getHistoryEntry has not yet been implemented.\n");
}
public int getCurrentHistoryIndex()
@ -265,7 +280,7 @@ public static void main(String [] args)
Assert.setEnabled(true);
Log.setApplicationName("HistoryImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: HistoryImpl.java,v 1.2 2000/03/09 23:22:51 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: HistoryImpl.java,v 1.3 2000/05/23 21:06:11 ashuk%eng.sun.com Exp $");
}