forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Swing webclient test code and windows makefile mods.
Author=Ann Sunhachawee [email protected] [email protected] Bug=http://bugzilla.mozilla.org/show_bug.cgi?id=16842
- Loading branch information
edburns%acm.org
committed
Oct 20, 1999
1 parent
1178f50
commit e681c41
Showing
21 changed files
with
988 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
java/webclient/classes/org/mozilla/webclient/DocListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.mozilla.webclient; | ||
|
||
public interface DocListener { | ||
|
||
public void handleDocLoaderEvent(); | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
java/webclient/classes/org/mozilla/webclient/DocumentLoadListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.mozilla.webclient; | ||
|
||
public interface DocumentLoadListener { | ||
public void docEventPerformed(String event); | ||
|
||
|
||
} |
8 changes: 8 additions & 0 deletions
8
java/webclient/classes/org/mozilla/webclient/EventRegistration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.mozilla.webclient; | ||
|
||
public interface EventRegistration { | ||
|
||
public boolean addDocumentLoadListener(DocumentLoadListener dll) throws Exception; | ||
|
||
|
||
} |
22 changes: 22 additions & 0 deletions
22
java/webclient/classes/org/mozilla/webclient/test/swing/BackAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
package org.mozilla.webclient.test.swing; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
|
||
import org.mozilla.webclient.*; | ||
|
||
class BackAction extends AbstractAction { | ||
private SwingEmbeddedMozilla em; | ||
|
||
public BackAction(SwingEmbeddedMozilla em) { | ||
super ("Back"); | ||
this.em = em; | ||
} | ||
|
||
public void actionPerformed(ActionEvent evt) { | ||
System.out.println("Back was pressed!!"); | ||
em.back(); | ||
|
||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
java/webclient/classes/org/mozilla/webclient/test/swing/CommandPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package org.mozilla.webclient.test.swing; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
|
||
import org.mozilla.webclient.*; | ||
|
||
public class CommandPanel extends JPanel implements ActionListener { | ||
private JToolBar urltool; | ||
private JToolBar navtool; | ||
private JTextField urlfield; | ||
private JComboBox cb; | ||
private SwingEmbeddedMozilla em; | ||
|
||
public CommandPanel(SwingEmbeddedMozilla em) { | ||
super(); | ||
GridBagLayout gbl = new GridBagLayout(); | ||
GridBagConstraints gbc = new GridBagConstraints(); | ||
setLayout(gbl); | ||
this.em = em; | ||
|
||
navtool = createNavToolBar(); | ||
urltool = createURLToolBar(); | ||
|
||
// Layout of the toolbars. | ||
gbc.anchor = GridBagConstraints.NORTHWEST; | ||
add(navtool, gbc); | ||
|
||
gbc.gridwidth = GridBagConstraints.REMAINDER; | ||
gbc.weightx = 1.0; | ||
add(Box.createHorizontalGlue(), gbc); | ||
|
||
gbc.gridwidth = 1; | ||
add(urltool, gbc); | ||
} | ||
|
||
private JButton makeButton(String arg) { | ||
JButton button = new JButton(arg); | ||
return button; | ||
} | ||
|
||
private JToolBar createURLToolBar() { | ||
JToolBar tb = new JToolBar(); | ||
// Ann - commented out the combobox for demo purposes. 9/20/99 | ||
// String temp[] = {"Fee", "Fi", "Fo", "Fum"}; | ||
//cb = new JComboBox(temp); | ||
//cb.setEditable(true); | ||
//cb.setLightWeightPopupEnabled(false); | ||
urlfield = new JTextField(25); | ||
|
||
tb.add(urlfield); | ||
//tb.add(cb); | ||
//cb.addActionListener(this); | ||
urlfield.addActionListener(this); | ||
return tb; | ||
} | ||
|
||
|
||
|
||
|
||
private JToolBar createNavToolBar() { | ||
JToolBar tb = new JToolBar(); | ||
|
||
tb.add(new BackAction(em)); | ||
tb.add(new ForwardAction(em)); | ||
tb.add(new StopAction(em)); | ||
tb.add(new RefreshAction(em)); | ||
tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE); | ||
return tb; | ||
} | ||
|
||
|
||
public JTextField getURLField() { | ||
return urlfield; | ||
} | ||
|
||
public JToolBar getNavToolBar() { | ||
return navtool; | ||
} | ||
|
||
public void actionPerformed (ActionEvent evt) { | ||
String command = evt.getActionCommand(); | ||
String url = null; | ||
System.out.println( "ActionComand is "+ command); | ||
if ("comboBoxChanged".equals(command)) { | ||
url = (String) cb.getSelectedItem(); | ||
} else { | ||
url = urlfield.getText(); | ||
} | ||
em.loadURL(url); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
java/webclient/classes/org/mozilla/webclient/test/swing/ForwardAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
package org.mozilla.webclient.test.swing; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
|
||
import org.mozilla.webclient.*; | ||
|
||
class ForwardAction extends AbstractAction { | ||
private SwingEmbeddedMozilla em; | ||
|
||
public ForwardAction(SwingEmbeddedMozilla em) { | ||
super ("Forward"); | ||
this.em = em; | ||
} | ||
|
||
public void actionPerformed(ActionEvent evt) { | ||
System.out.println("Forwardwas pressed!!"); | ||
em.forward(); | ||
|
||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
java/webclient/classes/org/mozilla/webclient/test/swing/RefreshAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
package org.mozilla.webclient.test.swing; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
|
||
import org.mozilla.webclient.*; | ||
|
||
class RefreshAction extends AbstractAction { | ||
private SwingEmbeddedMozilla em; | ||
|
||
public RefreshAction(SwingEmbeddedMozilla em) { | ||
super ("Refresh"); | ||
this.em = em; | ||
} | ||
|
||
public void actionPerformed(ActionEvent evt) { | ||
System.out.println("Refresh was pressed!!"); | ||
em.refresh(); | ||
|
||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
java/webclient/classes/org/mozilla/webclient/test/swing/StatusTextField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.mozilla.webclient.test.swing; | ||
/* | ||
* StatusPanel.java | ||
*/ | ||
|
||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
import org.mozilla.webclient.*; | ||
|
||
public class StatusTextField extends JTextField implements DocumentLoadListener { | ||
|
||
public StatusTextField(BrowserControl bc) { | ||
super(); | ||
setEditable(false); | ||
try { | ||
bc.getEventRegistration().addDocumentLoadListener(this); | ||
} catch (Exception ex) { | ||
System.out.println(ex.toString()); | ||
} | ||
|
||
} | ||
public void docEventPerformed(String event) { | ||
if (event.equals("startdocumentload")) { | ||
this.setText("Loading document..."); | ||
} else if (event.equals("enddocumentload")) { | ||
this.setText("Finished loading document."); | ||
} | ||
|
||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
java/webclient/classes/org/mozilla/webclient/test/swing/StopAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
package org.mozilla.webclient.test.swing; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
|
||
import org.mozilla.webclient.*; | ||
|
||
class StopAction extends AbstractAction { | ||
private SwingEmbeddedMozilla em; | ||
|
||
public StopAction(SwingEmbeddedMozilla em) { | ||
super ("Stop"); | ||
this.em = em; | ||
} | ||
|
||
public void actionPerformed(ActionEvent evt) { | ||
System.out.println("Stop was pressed!!"); | ||
em.stop(); | ||
|
||
} | ||
} |
Oops, something went wrong.