Let's get grendel runnin' :D. This checkin might be a bit rough so expect a couple of build bustages.

bug 86953 - Grendel uses old jaxp
bug 272345 - Grendel doesn't compile on Java 1.4
bug 292916 - Move Grendel to use Ant instead of Makefiles for compilation (partial fix)
partial fix for bug 293079 - Move grendel to use XUL
This commit is contained in:
rj.keller%beonex.com 2005-05-06 19:02:09 +00:00
parent 5db2c09a41
commit 3cd6e9d811
55 changed files with 1013 additions and 1017 deletions

126
grendel/build.xml Normal file
View File

@ -0,0 +1,126 @@
<?xml version="1.0"?>
<!-- ***** 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.
-
- The Original Code is Grendel mail/news client.
-
- The Initial Developer of the Original Code is
- R.J. Keller.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- 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 MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. 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 MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<project name="Grendel" default="build" basedir=".">
<target name="build" description="Compiles Grendel.">
<mkdir dir="dist"/>
<unzip dest="dist" overwrite="false">
<fileset dir="extlibs">
<include name="**/*.jar"/>
</fileset>
</unzip>
<copy todir="dist">
<fileset dir="sources/grendel">
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.dtd"/>
</fileset>
</copy>
<copy todir="dist">
<fileset dir="sources">
<include name="**/*.properties"/>
</fileset>
</copy>
<javac srcdir="." destdir="dist"
optimize="false"
debug="true"
includes="**/*.java"/>
</target>
<target name="unzipResources">
<copy todir="dist/resources">
<fileset dir="sources/grendel">
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.dtd"/>
</fileset>
</copy>
<copy todir="dist">
<fileset dir="sources">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<target name="makeJar" description="Pumps all the libs into one big JAR for distribution. Grendel must be built before running this.">
<jar destfile="grendel.jar">
<fileset dir="dist">
<include name="**/*.*"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="grendel.Main"/>
</manifest>
</jar>
<zip destfile="dist/grendel.zip">
<fileset dir="dist">
<include name="images/*.gif"/>
<include name="xml/*.xml"/>
<include name="dtd/*.dtd"/>
<include name="templates/*.tmpl"/>
<include name="images/*.jpg"/>
</fileset>
<fileset dir=".">
<include name="*.jar"/>
</fileset>
</zip>
</target>
<target name="run" description="Runs Grendel after compiling.">
<java classname="grendel.Main" classpath="dist"/>
</target>
<target name="clean" description="Cleans up generated class files.">
<delete dir="dist"/>
<delete file="grendel.jar"/>
<delete dir="javadoc"/>
</target>
<target name="javadoc" description="Generate JavaDoc API information">
<mkdir dir="javadoc"/>
<javadoc destdir="javadoc">
<fileset dir="." includes="**/*.java"/>
</javadoc>
</target>
</project>

View File

@ -32,7 +32,7 @@ import java.lang.String;
* ByteToCharConverterEnumeration return a Enumeration of String which
* represent ByteToCharConverter available in the classpath
* @author ftang
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see
*
*/
@ -41,7 +41,7 @@ public class ByteToCharConverterEnumeration extends PrefetchEnumeration {
/*
*
* @author ftang
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see
*
*/
@ -52,7 +52,7 @@ public class ByteToCharConverterEnumeration extends PrefetchEnumeration {
/*
*
* @author ftang
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see
*
*/
@ -69,7 +69,7 @@ public class ByteToCharConverterEnumeration extends PrefetchEnumeration {
/*
*
* @author ftang
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see
*
*/

View File

@ -951,8 +951,8 @@ public class NNTPStore extends Store implements StatusSource {
*/
public Folder[] listSubscribed() throws MessagingException {
Vector groups = new Vector();
for (Enumeration enum = newsgroups.elements(); enum.hasMoreElements(); ) {
Newsgroup group = (Newsgroup)enum.nextElement();
for (Enumeration enumer = newsgroups.elements(); enumer.hasMoreElements(); ) {
Newsgroup group = (Newsgroup)enumer.nextElement();
if (group.subscribed)
groups.addElement(group);
}

View File

@ -26,11 +26,13 @@
package grendel.addressbook;
import grendel.addressbook.addresscard.*;
import grendel.ui.UIAction;
import grendel.ui.GeneralFrame;
import grendel.widgets.*;
import grendel.ui.XMLMenuBuilder;
import calypso.util.*;
import com.trfenv.parsers.Event;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
@ -43,8 +45,6 @@ import javax.swing.table.*;
import javax.swing.event.TableModelEvent;
import javax.swing.border.EmptyBorder;
import netscape.ldap.*;
/**
*
* @author Lester Schueler
@ -54,7 +54,7 @@ public class AddressBook extends GeneralFrame {
private Hashtable mMenuItems;
// private ACS_Personal myLocalAddressBook;
private MenuBarCtrl mMenuBarCtrl;
private JMenuBar mMenuBarCtrl;
private GrendelToolBar mTtoolbar;
// private Component mStatusbar;
private JTable mTable;
@ -70,7 +70,7 @@ public class AddressBook extends GeneralFrame {
public static void main(String[] args) {
AddressBook AddressBookFrame = new AddressBook();
AddressBookFrame.addWindowListener(new AppCloser());
AddressBookFrame.show();
AddressBookFrame.setVisible(true);
}
protected static final class AppCloser extends WindowAdapter {
@ -270,14 +270,15 @@ public class AddressBook extends GeneralFrame {
// FIXME - need to build the menu bar
// (Jeff)
mMenuBarCtrl = buildMenu("menus.xml",defaultActions);
XMLMenuBuilder builder = new XMLMenuBuilder(defaultActions);
mMenuBarCtrl = builder.buildFrom("ui/menus.xml", this);
JMenuItem aMenuItem = mMenuBarCtrl.getCtrlByName("sortAscending");
JMenuItem aMenuItem = (JMenuItem)builder.getElementsAndIDs().get("sortAscending");
if (aMenuItem != null) {
aMenuItem.setSelected(true);
}
aMenuItem = mMenuBarCtrl.getCtrlByName("byName");
aMenuItem = (JMenuItem)builder.getElementsAndIDs().get("byName");
if (aMenuItem != null) {
aMenuItem.setSelected(true);
}
@ -398,7 +399,7 @@ public class AddressBook extends GeneralFrame {
public static final String myAddressBookCardTag ="myAddressBookCard";
// --- action implementations -----------------------------------
private UIAction[] defaultActions = {
private Event[] defaultActions = {
//"File" actions
new NewCard(),
// new NewList(),
@ -442,9 +443,9 @@ public class AddressBook extends GeneralFrame {
//-----------------------
/**
*/
class NewCard extends UIAction {
class NewCard extends Event {
NewCard() {
super(newCardTag);
super(newCardTag, null);
this.setEnabled(true);
}
@ -452,14 +453,14 @@ public class AddressBook extends GeneralFrame {
NewCardDialog aDialog = new NewCardDialog(getParentFrame());
//display the new card dialog
aDialog.show ();
aDialog.setVisible(true);
aDialog.dispose();
}
}
class SearchDirectory extends UIAction {
class SearchDirectory extends Event {
SearchDirectory() {
super(searchDirectoryTag);
super(searchDirectoryTag, null);
this.setEnabled(true);
}
@ -467,13 +468,13 @@ public class AddressBook extends GeneralFrame {
SearchDirectoryDialog aDialog = new SearchDirectoryDialog(getParentFrame());
//display the new card dialog
aDialog.show ();
aDialog.setVisible(true);
aDialog.dispose();
}
}
class SaveAs extends UIAction {
class SaveAs extends Event {
SaveAs() {
super(saveAsTag);
this.setEnabled(true);
@ -482,12 +483,12 @@ public class AddressBook extends GeneralFrame {
NewCardDialog aDialog = new NewCardDialog(getParentFrame());
//display the new card dialog
aDialog.show ();
aDialog.setVisible(true);
aDialog.dispose();
}
}
class CloseWindow extends UIAction {
class CloseWindow extends Event {
CloseWindow() {
super(closeWindowTag);
this.setEnabled(true);
@ -506,7 +507,7 @@ public class AddressBook extends GeneralFrame {
//-----------------------
//"Edit" actions
//-----------------------
class Undo extends UIAction {
class Undo extends Event {
Undo() {
super(undoTag);
this.setEnabled(true);
@ -517,7 +518,7 @@ public class AddressBook extends GeneralFrame {
//-----------------------
//"View" actions
//-----------------------
class HideMessageToolbar extends UIAction {
class HideMessageToolbar extends Event {
HideMessageToolbar() {
super(hideMessageToolbarTag);
this.setEnabled(true);
@ -528,7 +529,7 @@ public class AddressBook extends GeneralFrame {
//-----------------------
//-----------------------
class Search extends UIAction {
class Search extends Event {
Search() {
super(newListTag);
this.setEnabled(true);
@ -560,7 +561,7 @@ public class AddressBook extends GeneralFrame {
//----------------
// Sort Ascending
//----------------
class SortAscending extends UIAction {
class SortAscending extends Event {
SortAscending() {
super(sortAscendingTag);
this.setEnabled(true);
@ -584,7 +585,7 @@ public class AddressBook extends GeneralFrame {
//----------------
// Sort Descending
//----------------
class SortDescending extends UIAction {
class SortDescending extends Event {
SortDescending() {
super(sortDescendingTag);
this.setEnabled(true);
@ -608,7 +609,7 @@ public class AddressBook extends GeneralFrame {
//----------------------------------
// Base class for sorting the names
//----------------------------------
class ResultSorter extends UIAction {
class ResultSorter extends Event {
String myLocalColumnName;
ResultSorter(String Tag){
super(Tag);
@ -713,7 +714,7 @@ public class AddressBook extends GeneralFrame {
* @see createToolbar
*/
public void addToolbarButton(GrendelToolBar aToolBar,
UIAction aActionListener,
Event aActionListener,
String aImageName, String aToolTip) {
JButton b = new JButton();

View File

@ -77,7 +77,7 @@ public class ACS_Personal implements ICardSource, IQuerySet {
try {
//write the new value out to the DB.
fDB.assert ("Control", "NextCardID", nextCardStrID);
fDB.addassert ("Control", "NextCardID", nextCardStrID);
} catch (IOException ioe) {
}
@ -151,13 +151,13 @@ public class ACS_Personal implements ICardSource, IQuerySet {
AddressCardAttributeSet attrSet =
(AddressCardAttributeSet)aCard.getAttributeSet();
for (Enumeration enum = attrSet.elements (); enum.hasMoreElements(); ) {
for (Enumeration enumer = attrSet.elements (); enumer.hasMoreElements(); ) {
//get the next attribute
AddressCardAttribute attr = (AddressCardAttribute) enum.nextElement ();
AddressCardAttribute attr = (AddressCardAttribute) enumer.nextElement ();
//write the attribute to the DB
try {
fDB.assert (thisCardID, attr.getName(), attr.getValue());
fDB.addassert (thisCardID, attr.getName(), attr.getValue());
} catch (IOException ioe) {}
}
}
@ -165,8 +165,8 @@ public class ACS_Personal implements ICardSource, IQuerySet {
/** Add a set of cards to this addressbook.
*/
public void add (AddressCardSet aCardSet, boolean OverWrite) {
for (Enumeration enum = aCardSet.getCardEnumeration (); enum.hasMoreElements() ;) {
AddressCard card = (AddressCard) enum.nextElement();
for (Enumeration enumer = aCardSet.getCardEnumeration (); enumer.hasMoreElements() ;) {
AddressCard card = (AddressCard) enumer.nextElement();
add (card, OverWrite);
}
}
@ -196,8 +196,8 @@ public class ACS_Personal implements ICardSource, IQuerySet {
if (null != ACA) {
try { //the RDFish DB returns an enumeration of a matching card ID's
for (Enumeration enum = fDB.findAll(ACA.getName(), ACA.getValue (), false); enum.hasMoreElements() ;) {
retIDSet.addElement (enum.nextElement());
for (Enumeration enumer = fDB.findAll(ACA.getName(), ACA.getValue (), false); enumer.hasMoreElements() ;) {
retIDSet.addElement (enumer.nextElement());
}
} catch (IOException exc) {
exc.printStackTrace();

View File

@ -59,8 +59,8 @@ public class AddressCardSet implements ICardSet {
}
public void sort(String[] anAttributeArray) {
Enumeration enum = getEnumeration();
while (enum.hasMoreElements()) {
Enumeration enumer = getEnumeration();
while (enumer.hasMoreElements()) {
}
}

View File

@ -133,10 +133,10 @@ public class LDAP_Server implements ICardSource, IQueryString {
LDAPAttributeSet LDAP_attrSet = new LDAPAttributeSet(); //To LDAP
//enumerate thru each attribute and translate from CA attributes into LDAP attributes.
for (Enumeration enum = AC_attrSet.getEnumeration(); enum.hasMoreElements() ;) {
for (Enumeration enumer = AC_attrSet.getEnumeration(); enumer.hasMoreElements() ;) {
//Get the old
IAttribute AC_attr = (IAttribute) enum.nextElement();
IAttribute AC_attr = (IAttribute) enumer.nextElement();
//Create the new
LDAPAttribute LDAP_attr = new LDAPAttribute(AC_attr.getName(), AC_attr.getValue());
@ -221,8 +221,8 @@ public class LDAP_Server implements ICardSource, IQueryString {
LDAPModificationSet LDAP_modSet = new LDAPModificationSet();
//enumerate thru each attribute
for (Enumeration enum = AC_attrSet.getEnumeration() ; enum.hasMoreElements() ;) {
IAttribute AC_attr = (IAttribute) enum.nextElement();
for (Enumeration enumer = AC_attrSet.getEnumeration() ; enumer.hasMoreElements() ;) {
IAttribute AC_attr = (IAttribute) enumer.nextElement();
int LDAP_mod = 0;
boolean attributeModified = false;

View File

@ -78,10 +78,10 @@ class AddressDialog extends Dialog implements ActionListener {
frame.setBackground(Color.lightGray);
AddressDialog aDialog = new AddressDialog(frame);
aDialog.show ();
aDialog.setVisible(true);
aDialog.dispose();
frame.show();
frame.setVisible(true);
}
/**

View File

@ -534,7 +534,7 @@ public class AddressList extends JScrollPane implements Serializable {
//create image icon for drag and drop.
mIcon = new ImageIcon(getClass().getResource("images/card.gif"));
mIcon = new ImageIcon("composition/images/card.gif");
}
public void paint (Graphics g) {

View File

@ -74,7 +74,7 @@ public class AttachmentsListBeanInfo extends SimpleBeanInfo {
//showDialog requests that the AddressList display its file dialog.
//public void showDialog () {
mthd = beanClass.getMethod ("showDialog", null);
mthd = beanClass.getMethod("showDialog");
MethodDescriptor showDialogDesc = new MethodDescriptor (mthd);
showDialogDesc.setShortDescription ("Displays the file dialog");
@ -91,7 +91,7 @@ public class AttachmentsListBeanInfo extends SimpleBeanInfo {
//Delets all attachments from the list.
//public void removeAllAttachments () {
mthd = beanClass.getMethod ("removeAllAttachments", null);
mthd = beanClass.getMethod ("removeAllAttachments");
MethodDescriptor removeAllAttachmentsDesc = new MethodDescriptor (mthd);
removeAllAttachmentsDesc.setShortDescription ("Delets all attachments from the list");

View File

@ -42,6 +42,7 @@ import grendel.widgets.GrendelToolBar;
import grendel.ui.FolderPanel;
import grendel.ui.GeneralFrame;
import grendel.ui.StoreFactory;
import grendel.ui.XMLMenuBuilder;
import javax.mail.Address;
import javax.mail.Message;
@ -87,8 +88,8 @@ public class Composition extends GeneralFrame {
//create menubar (top)
// fMenu = buildMenu("mainMenubar",
// mCompositionPanel.getActions());
fMenu = buildMenu("menus.xml",
mCompositionPanel.getActions());
XMLMenuBuilder builder = new XMLMenuBuilder(mCompositionPanel.getActions());
fMenu = builder.buildFrom("ui/menus.xml", (JFrame)this);
getRootPane().setJMenuBar(fMenu);
@ -128,6 +129,8 @@ public class Composition extends GeneralFrame {
restoreBounds();
mCompositionPanel.AddSignature();
setSize(670, 490);
}
public void dispose() {

View File

@ -89,10 +89,11 @@ import grendel.storage.MessageExtra;
import grendel.storage.MessageExtraFactory;
import grendel.ui.ActionFactory;
import grendel.ui.GeneralPanel;
import grendel.ui.UIAction;
import grendel.widgets.CollapsiblePanel;
import grendel.widgets.GrendelToolBar;
import com.trfenv.parsers.Event;
public class CompositionPanel extends GeneralPanel {
private Hashtable mCommands;
private Hashtable mMenuItems;
@ -150,7 +151,7 @@ public class CompositionPanel extends GeneralPanel {
* of actions supported by the embedded JTextComponent
* augmented with the actions defined locally.
*/
public UIAction[] getActions() {
public Event[] getActions() {
return defaultActions;
// XXX WHS need to translate Actions to UICmds
// return TextAction.augmentList(mEditor.getActions(), defaultActions);
@ -320,7 +321,7 @@ public class CompositionPanel extends GeneralPanel {
// --- action implementations -----------------------------------
private UIAction[] defaultActions = {
private Event[] defaultActions = {
//"File" actions
// new SaveDraft(),
new SaveAs(),
@ -370,7 +371,7 @@ public class CompositionPanel extends GeneralPanel {
* Try to save the message to the "draft" mailbox.
* @see SaveAs
*/
class SaveDraft extends UIAction {
class SaveDraft extends Event {
SaveDraft() {
super(saveDraftTag);
this.setEnabled(true);
@ -382,7 +383,7 @@ public class CompositionPanel extends GeneralPanel {
* Try to save the message to a text file.
* @see SaveDraft
*/
class SaveAs extends UIAction {
class SaveAs extends Event {
SaveAs() {
super(saveAsTag);
this.setEnabled(true);
@ -391,7 +392,7 @@ public class CompositionPanel extends GeneralPanel {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog (getParentFrame(), "Save As", FileDialog.SAVE);
fileDialog.setFile("untitled.txt");
fileDialog.show(); //blocks
fileDialog.setVisible(true); //blocks
String fileName = fileDialog.getFile();
//check for canel
@ -420,7 +421,7 @@ public class CompositionPanel extends GeneralPanel {
/**
* Send the mail message now.
*/
class SendNow extends UIAction {
class SendNow extends Event {
SendNow() {
super(sendNowTag);
this.setEnabled(true);
@ -584,7 +585,7 @@ public class CompositionPanel extends GeneralPanel {
* Quote the original text message into the editor.
* @see PasteAsQuotation
*/
class QuoteOriginalText extends UIAction {
class QuoteOriginalText extends Event {
QuoteOriginalText() {
super(quoteOriginalTextTag);
this.setEnabled(true);
@ -669,7 +670,7 @@ public class CompositionPanel extends GeneralPanel {
* Inline the original text message into the editor.
* @see QuoteOriginalText
*/
class InlineOriginalText extends UIAction {
class InlineOriginalText extends Event {
InlineOriginalText() {
super(inlineOriginalTextTag);
this.setEnabled(true);
@ -762,7 +763,7 @@ public class CompositionPanel extends GeneralPanel {
/**
* Add a signature
*/
class AddSignatureAction extends UIAction {
class AddSignatureAction extends Event {
AddSignatureAction() {
super(addSignatureTag);
this.setEnabled(true);
@ -807,7 +808,7 @@ public class CompositionPanel extends GeneralPanel {
}
}
class SelectAddresses extends UIAction {
class SelectAddresses extends Event {
SelectAddresses() {
super(selectAddressesTag);
this.setEnabled(true);
@ -822,7 +823,7 @@ public class CompositionPanel extends GeneralPanel {
//display the addressee dialog
aDialog.setAddresses (mAddresses); //initialize the dialog
aDialog.show (); //blocks
aDialog.setVisible (true); //blocks
if (false == aDialog.getCanceled()) {
//get the addresses from dialog
@ -843,7 +844,7 @@ public class CompositionPanel extends GeneralPanel {
//-----------------------
// "file->attach" actions
//-----------------------
class AttachFile extends UIAction {
class AttachFile extends Event {
AttachFile() {
super(fileTag);
this.setEnabled(true);
@ -864,7 +865,7 @@ public class CompositionPanel extends GeneralPanel {
* Quote and paste whatever string that's on the clipboard into the editor.
* @see QuoteOriginalText
*/
class PasteAsQuotation extends UIAction {
class PasteAsQuotation extends Event {
PasteAsQuotation() {
super(pasteAsQuotationTag);
this.setEnabled(true);

View File

@ -50,7 +50,7 @@ class CompositionTest extends JPanel implements ActionListener {
frame.add (new CompositionTest(), BorderLayout.CENTER);
//frame.setSize(450, 200);
frame.pack();
frame.show();
frame.setVisible(true);
}
/**
@ -101,7 +101,7 @@ class CompositionTest extends JPanel implements ActionListener {
//This is where the compsiton editor is started.
Composition CompFrame = new Composition();
CompFrame.pack();
CompFrame.show();
CompFrame.setVisible(true);
}
}
}

View File

@ -193,7 +193,9 @@ public class FilterMaster extends Object {
public Folder getFolder(String name) {
Session session = StoreFactory.Instance().getSession();
// ### Definitely wrong:
Store store = BerkeleyStore.GetDefaultStore(session);
//XXXrlk: WARNING, DANGEROUS, BAD, GUARANTEED CRASH HERE
// temporary change to make Grendel compile
Store store = null;
Folder folder;
try {

View File

@ -180,7 +180,9 @@ public class MailServerPrefsEditor implements PropertyEditor
fHostListModel = new HostListModel();
URL url = getClass().getResource("PrefDialogs.xml");
fPanel = new PageUI(url, "id", "serverPrefs", fModel, getClass());
//XXXrlk: why does this constructor have parameters?
// fPanel = new PageUI(url, "id", "serverPrefs", fModel, getClass());
fPanel = new PageUI();
JComponent c;
ChangeAction ca = new ChangeAction();

View File

@ -85,7 +85,9 @@ public class UIPrefsEditor extends JPanel
// XMLNode root = null;
URL url = getClass().getResource("PrefDialogs.xml");
fPanel = new PageUI(url, "id", "UIPrefs", fModel, getClass());
//XXXrlk: why does this constructor have parameters?
// fPanel = new PageUI(url, "id", "UIPrefs", fModel, getClass());
fPanel = new PageUI();
JComponent c;
ChangeAction ca = new ChangeAction();

View File

@ -114,7 +114,9 @@ public class UserPrefsEditor
public UserPrefsEditor() {
fModel = new UserPrefsModel();
URL url = getClass().getResource("PrefDialogs.xml");
fPanel = new PageUI(url, "id", "userPrefs", fModel, getClass());
//XXXrlk: why does this constructor have parameters?
// fPanel = new PageUI(url, "id", "userPrefs", fModel, getClass());
fPanel = new PageUI();
ChangeAction ca = new ChangeAction();
JComponent c;

View File

@ -55,7 +55,7 @@ public class General extends JFrame {
public static void main(String argv[]) {
General ui = new General();
ui.show();
ui.setVisible(true);
}
@ -103,7 +103,7 @@ public class General extends JFrame {
setData();
prefs.writePrefs();
hide();
setVisible(false);
dispose();
}
@ -114,7 +114,7 @@ public class General extends JFrame {
public void actionPerformed(ActionEvent e) {
hide();
setVisible(false);
dispose();
}

View File

@ -67,7 +67,7 @@ public class Identities extends JFrame {
public static void main(String argv[]) {
Identities ident = new Identities();
ident.show();
ident.setVisible(true);
}
@ -229,7 +229,7 @@ public class Identities extends JFrame {
update();
ida.writePrefs();
hide();
setVisible(false);
dispose();
}

View File

@ -92,7 +92,7 @@ public final class BGDB extends BaseDB implements Runnable {
thread.start();
}
public synchronized void assert(String name, String slot, String value)
public synchronized void addassert(String name, String slot, String value)
throws IOException
{
logfid.seek(logfid.length());
@ -177,7 +177,8 @@ public final class BGDB extends BaseDB implements Runnable {
c);
}
if (c.command.equals("assert")) {
base.assert(c.name, c.slot, c.value);
//XXXrlk: doing asserts later.
// base.assert(c.name, c.slot, c.value);
} else if (c.command.equals("unassert")) {
base.unassert(c.name, c.slot, c.value);
} else {

View File

@ -30,7 +30,7 @@ import java.util.Enumeration;
/** An interface to a RDF-ish database. */
public interface DB {
public void assert(String name, String slot, String value)
public void addassert(String name, String slot, String value)
throws IOException;
public void unassert(String name, String slot, String value)
throws IOException;

View File

@ -124,8 +124,7 @@ final class HackDB extends BaseDB {
}
public synchronized void assert(String name, String slot, String value)
public synchronized void addassert(String name, String slot, String value)
throws IOException
{
File s = findSlotFile(slot, false);
@ -135,7 +134,6 @@ final class HackDB extends BaseDB {
}
public synchronized void unassert(String name, String slot, String value)
throws IOException
{

View File

@ -82,7 +82,8 @@ public class PhoneTest {
// value + "'");
System.out.print(".");
count++;
db.assert(name, slot, value);
//XXXrlk: doing asserts later.
// db.assert(name, slot, value);
} else {
name = str;
}
@ -135,7 +136,8 @@ public class PhoneTest {
db.unassert(name.substring(1), slot, value);
System.out.println("Unasserted.");
} else {
db.assert(name, slot, value);
//XXXrlk: doing asserts later.
// db.assert(name, slot, value);
System.out.println("Asserted.");
}
}

View File

@ -40,12 +40,12 @@ public class SelfTest {
// DB db = new HackDB(top);
DB db = new SimpleDB(top);
db = new BGDB(db, new File(home, "__hackdb__queue"));
db.assert("terry", "fullname", "Terry Weissman");
db.assert("jwz", "fullname", "Jamie Zawinski");
db.assert("terry", "phone", "650-937-2756");
db.assert("terry", "phone", "408-338-8227");
db.assert("jwz", "phone", "650-937-2620");
db.assert("jwz", "phone", "415-ACRIDHE");
db.addassert("terry", "fullname", "Terry Weissman");
db.addassert("jwz", "fullname", "Jamie Zawinski");
db.addassert("terry", "phone", "650-937-2756");
db.addassert("terry", "phone", "408-338-8227");
db.addassert("jwz", "phone", "650-937-2620");
db.addassert("jwz", "phone", "415-ACRIDHE");
for (int j=0 ; j<2 ; j++) {

View File

@ -236,7 +236,7 @@ public final class SimpleDB extends BaseDB {
public synchronized void assert(String name, String slot, String value)
public synchronized void addassert(String name, String slot, String value)
throws IOException
{
int n = LookupString(name, true);

View File

@ -81,13 +81,13 @@ public class Twingle implements Runnable {
thread.start();
}
void assert(String name, String slot, String value) {
void addassert(String name, String slot, String value) {
if (name != null && value != null) {
try {
db.assert(name, slot, value);
db.addassert(name, slot, value);
} catch (IOException e) {
// ### What to do...
System.out.println("db.assert() failed in Twingle.assert: " + e);
System.out.println("db.addassert() failed in Twingle.assert: " + e);
}
}
}
@ -142,9 +142,9 @@ public class Twingle implements Runnable {
addr = str.trim();
}
if (name != null) {
assert(addr, "fullname", name);
addassert(addr, "fullname", name);
}
assert(id, slot, addr);
addassert(id, slot, addr);
}
}
@ -181,11 +181,11 @@ public class Twingle implements Runnable {
if (id.charAt(0) == '<' && id.endsWith(">")) {
id = id.substring(1, id.length() - 1);
}
assert(id, "parent", folder.getName());
addassert(id, "parent", folder.getName());
String subj[] = headers.getHeader("Subject");
if (subj != null && subj.length != 0)
assert(id, "subject", subj[0]);
addassert(id, "subject", subj[0]);
hackAddressList(id, headers, "from");
hackAddressList(id, headers, "to");

View File

@ -55,7 +55,7 @@ import grendel.filters.FilterMaster;
*/
import grendel.composition.Composition;
import grendel.ui.UIAction;
import com.trfenv.parsers.Event;
public class ActionFactory {
static ExitAction fExitAction = new ExitAction();
@ -133,7 +133,7 @@ public class ActionFactory {
}
}
class ExitAction extends UIAction {
class ExitAction extends Event {
public ExitAction() {
super("appExit");
@ -151,7 +151,7 @@ class ExitAction extends UIAction {
}
}
class NewMailAction extends UIAction {
class NewMailAction extends Event {
public NewMailAction() {
super("msgGetNew");
@ -165,7 +165,7 @@ class NewMailAction extends UIAction {
}
}
class ComposeMessageAction extends UIAction {
class ComposeMessageAction extends Event {
public ComposeMessageAction() {
super("msgNew");
@ -185,55 +185,20 @@ class DummyComposeMessageThread implements Runnable {
}
}
class PreferencesAction extends UIAction {
PreferencesAction fThis;
public PreferencesAction() {
super("appPrefs");
fThis = this;
setEnabled(true);
}
public void actionPerformed(ActionEvent aEvent) {
Object source = aEvent.getSource();
if (source instanceof Component) {
Frame frame = Util.GetParentFrame((Component) source);
if (frame instanceof JFrame) {
new Thread(new PrefThread((JFrame) frame), "Prefs").start();
}
}
}
class PrefThread implements Runnable {
JFrame fFrame;
PrefThread(JFrame aFrame) {
fFrame = aFrame;
}
public void run() {
synchronized(fThis) {
setEnabled(false);
new PrefsDialog(fFrame);
setEnabled(true);
}
}
}
}
class SearchAction extends UIAction {
class SearchAction extends Event {
SearchAction() {
super("appSearch");
}
public void actionPerformed(ActionEvent aEvent) {
Frame frame = new SearchFrame();
frame.show();
frame.setVisible(true);
frame.toFront();
frame.requestFocus();
}
}
class RunFiltersAction extends UIAction {
class RunFiltersAction extends Event {
RunFiltersAction() {
super("appRunFilters");
@ -247,7 +212,7 @@ class RunFiltersAction extends UIAction {
}
}
class ShowTooltipsAction extends UIAction {
class ShowTooltipsAction extends Event {
ShowTooltipsAction() {
super("appShowTooltips");
@ -266,7 +231,7 @@ class ShowTooltipsAction extends UIAction {
}
}
class RunIdentityPrefsAction extends UIAction {
class RunIdentityPrefsAction extends Event {
RunIdentityPrefsAction() {
super("prefIds");
@ -274,11 +239,11 @@ class RunIdentityPrefsAction extends UIAction {
public void actionPerformed(ActionEvent aEvent) {
JFrame prefs = new Identities();
prefs.show();
prefs.setVisible(true);
}
}
class RunServerPrefsAction extends UIAction {
class RunServerPrefsAction extends Event {
RunServerPrefsAction() {
super("prefSrvs");
@ -286,11 +251,11 @@ class RunServerPrefsAction extends UIAction {
public void actionPerformed(ActionEvent aEvent) {
JFrame prefs = new Servers();
prefs.show();
prefs.setVisible(true);
}
}
class RunGeneralPrefsAction extends UIAction {
class RunGeneralPrefsAction extends Event {
RunGeneralPrefsAction() {
super("prefGeneral");
@ -298,11 +263,11 @@ class RunGeneralPrefsAction extends UIAction {
public void actionPerformed(ActionEvent aEvent) {
JFrame prefs = new General();
prefs.show();
prefs.setVisible(true);
}
}
class RunUIPrefsAction extends UIAction {
class RunUIPrefsAction extends Event {
RunUIPrefsAction() {
super("prefUI");
@ -310,6 +275,6 @@ class RunUIPrefsAction extends UIAction {
public void actionPerformed(ActionEvent aEvent) {
JFrame prefs = new UI();
prefs.show();
prefs.setVisible(true);
}
}

View File

@ -49,11 +49,11 @@ class BiffIcon extends JLabel implements ChangeListener {
public BiffIcon() {
if (fIconUnknown == null) {
fIconUnknown =
new ImageIcon(getClass().getResource("images/biffUnknown.gif"));
new ImageIcon("ui/images/biffUnknown.gif");
fIconNew =
new ImageIcon(getClass().getResource("images/biffNew.gif"));
new ImageIcon("ui/images/biffNew.gif");
fIconNone =
new ImageIcon(getClass().getResource("images/biffNone.gif"));
new ImageIcon("ui/images/biffNone.gif");
}
setText(null); // Necessary for icon size to be used for preferred size
setBiffState(MailDrop.UNKNOWN);

View File

@ -118,7 +118,7 @@ public class FolderCombo extends JComboBox {
class FolderRenderer extends JLabel implements ListCellRenderer {
public FolderRenderer() {
setIcon(new ImageIcon(getClass().getResource("/grendel/ui/images/folder-small.gif")));
setIcon(new ImageIcon("ui/images/folder-small.gif"));
setOpaque(true);
}

View File

@ -40,10 +40,11 @@ import grendel.view.ViewedMessage;
import javax.swing.event.ChangeEvent;
import grendel.ui.UIAction;
import grendel.widgets.StatusEvent;
import grendel.widgets.TreePath;
import com.trfenv.parsers.Event;
public class FolderFrame extends GeneralFrame {
static Vector fFolderFrames = new Vector();
FolderPanel fFolderPanel;
@ -56,8 +57,8 @@ public class FolderFrame extends GeneralFrame {
fPanel.add(fFolderPanel);
// fMenu = buildMenu("folderMain", Util.MergeActions(actions,
// fFolderPanel.getActions()));
fMenu = buildMenu("menus.xml",
Util.MergeActions(actions, fFolderPanel.getActions()));
XMLMenuBuilder builder = new XMLMenuBuilder(Util.MergeActions(actions, fFolderPanel.getActions()));
fMenu = builder.buildFrom("ui/menus.xml", this);
getRootPane().setJMenuBar(fMenu);
fToolBar = fFolderPanel.getToolBar();
@ -142,7 +143,7 @@ public class FolderFrame extends GeneralFrame {
}
}
}
UIAction actions[] = { ActionFactory.GetExitAction(),
Event actions[] = { ActionFactory.GetExitAction(),
ActionFactory.GetNewMailAction(),
ActionFactory.GetComposeMessageAction()};
}

View File

@ -72,7 +72,6 @@ import grendel.composition.Composition;
import grendel.prefs.base.InvisiblePrefs;
import grendel.storage.MessageExtra;
import grendel.storage.MessageExtraFactory;
import grendel.ui.UIAction;
import grendel.view.FolderView;
import grendel.view.FolderViewFactory;
import grendel.view.MessageSetView;
@ -100,6 +99,8 @@ import grendel.widgets.TreeTableDataModel;
import calypso.util.Assert;
import com.trfenv.parsers.Event;
/**
* Panel to display the <em>contents</em> of a folder.
*/
@ -214,7 +215,7 @@ public class FolderPanel extends GeneralPanel {
ThreadAction fThreadAction = new ThreadAction();
// The big action list
UIAction fActions[] = {ActionFactory.GetNewMailAction(),
Event fActions[] = {ActionFactory.GetNewMailAction(),
ActionFactory.GetComposeMessageAction(),
fDeleteMessageAction,
fOpenMessageAction,
@ -273,8 +274,8 @@ public class FolderPanel extends GeneralPanel {
ToggleCellRenderer renderer;
ToggleCellEditor editor;
Icon unreadIcon = new ImageIcon(getClass().getResource("images/unread.gif"));
Icon readIcon = new ImageIcon(getClass().getResource("images/read.gif"));
Icon unreadIcon = new ImageIcon("ui/images/unread.gif");
Icon readIcon = new ImageIcon("ui/images/read.gif");
renderer = new ToggleCellRenderer();
renderer.getCheckBox().setIcon(unreadIcon);
@ -292,8 +293,8 @@ public class FolderPanel extends GeneralPanel {
column.setCellEditor(editor);
fMessageTree.addColumn(column);
Icon unflaggedIcon = new ImageIcon(getClass().getResource("images/unflagged.gif"));
Icon flaggedIcon = new ImageIcon(getClass().getResource("images/flagged.gif"));
Icon unflaggedIcon = new ImageIcon("ui/images/unflagged.gif");
Icon flaggedIcon = new ImageIcon("ui/images/flagged.gif");
renderer = new ToggleCellRenderer();
renderer.getCheckBox().setIcon(unflaggedIcon);
@ -311,8 +312,8 @@ public class FolderPanel extends GeneralPanel {
column.setCellEditor(editor);
fMessageTree.addColumn(column);
Icon deletedIcon = new ImageIcon(getClass().getResource("images/deleted.gif"));
Icon undeletedIcon = new ImageIcon(getClass().getResource("images/unflagged.gif"));
Icon deletedIcon = new ImageIcon("ui/images/deleted.gif");
Icon undeletedIcon = new ImageIcon("ui/images/unflagged.gif");
renderer = new ToggleCellRenderer();
renderer.getCheckBox().setIcon(undeletedIcon);
@ -429,7 +430,7 @@ public class FolderPanel extends GeneralPanel {
* Returns the actions available for this panel
*/
public UIAction[] getActions() {
public Event[] getActions() {
return Util.MergeActions(fActions, fSortActions);
}
@ -751,7 +752,7 @@ public class FolderPanel extends GeneralPanel {
}
}
class OpenMessageAction extends UIAction implements Runnable {
class OpenMessageAction extends Event implements Runnable {
OpenMessageAction() {
super("msgOpen");
@ -785,7 +786,7 @@ public class FolderPanel extends GeneralPanel {
// DeleteMessageAction class
//
class DeleteMessageAction extends UIAction {
class DeleteMessageAction extends Event {
DeleteMessageAction() {
super("msgDelete");
@ -801,7 +802,7 @@ public class FolderPanel extends GeneralPanel {
// CopyMessageAction class
//
class CopyMessageAction extends UIAction {
class CopyMessageAction extends Event {
Folder fDest;
@ -820,7 +821,7 @@ public class FolderPanel extends GeneralPanel {
// MoveMessageAction class
//
class MoveMessageAction extends UIAction {
class MoveMessageAction extends Event {
Folder fDest;
@ -839,7 +840,7 @@ public class FolderPanel extends GeneralPanel {
// ThreadAction class
//
class ThreadAction extends UIAction {
class ThreadAction extends Event {
boolean selected;
@ -865,7 +866,7 @@ public class FolderPanel extends GeneralPanel {
// SortAction class
//
class SortAction extends UIAction {
class SortAction extends Event {
int fType;
boolean selected;
@ -896,7 +897,7 @@ public class FolderPanel extends GeneralPanel {
// ReplyAction class
//
class ReplyAction extends UIAction {
class ReplyAction extends Event {
boolean replyall;
public ReplyAction(String aAction, boolean r) {
super(aAction);
@ -913,7 +914,7 @@ public class FolderPanel extends GeneralPanel {
}
Composition frame = new Composition();
frame.initializeAsReply((Message) (selection.elementAt(0)), replyall);
frame.show();
frame.setVisible(true);
frame.requestFocus();
}
}
@ -922,7 +923,7 @@ public class FolderPanel extends GeneralPanel {
// ForwardAction class
//
class ForwardAction extends UIAction {
class ForwardAction extends Event {
int fScope;
ForwardAction(String aName, int aScope) {
@ -940,7 +941,7 @@ public class FolderPanel extends GeneralPanel {
}
Composition frame = new Composition();
frame.initializeAsForward((Message) (selection.elementAt(0)), fScope);
frame.show();
frame.setVisible(true);
frame.requestFocus();
}
}
@ -949,7 +950,7 @@ public class FolderPanel extends GeneralPanel {
// MarkAction class
//
class MarkAction extends UIAction {
class MarkAction extends Event {
int fScope;
MarkAction(String aName, int aScope) {
@ -1033,7 +1034,7 @@ public class FolderPanel extends GeneralPanel {
}
}
class CopyToClipboardAction extends UIAction {
class CopyToClipboardAction extends Event {
CopyToClipboardAction() {
super("copy-to-clipboard");
@ -1051,7 +1052,7 @@ public class FolderPanel extends GeneralPanel {
}
}
class PasteFromClipboardAction extends UIAction {
class PasteFromClipboardAction extends Event {
PasteFromClipboardAction() {
super("paste-from-clipboard");

View File

@ -158,12 +158,8 @@ public class GeneralFrame extends JFrame
// We need to use Class.forName because getClass() might return a child
// class in another package.
try {
URL url = Class.forName("grendel.ui.GeneralFrame").getResource("images/GrendelIcon32.gif");
setIconImage(getToolkit().getImage(url));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ImageIcon curImage = new ImageIcon("ui/images/GrendelIcon32.gif");
setIconImage(curImage.getImage());
fFrameList.addElement(this);
}
@ -266,30 +262,6 @@ public class GeneralFrame extends JFrame
}
}
/**
* Creates the MenuBar by reading from an XML file
*
* @param file the XML file to build the menu from
* @return a menubar built from the file
*/
protected MenuBarCtrl buildMenu(String file, UIAction[] actions) {
MenuBarCtrl menubar = null;
URL url;
XMLMenuBuilder builder =
new XMLMenuBuilder(this, actions);
try {
url = getClass().getResource(file);
builder.buildFrom(url.openStream());
menubar = builder.getComponent();
} catch (Throwable t) {
t.printStackTrace();
}
menubar.setFont(new Font("Helvetica", Font.PLAIN, 12));
return menubar;
}
protected Component buildStatusBar() {
JPanel res = new JPanel();
res.setLayout(new BoxLayout(res, BoxLayout.X_AXIS));

View File

@ -27,7 +27,6 @@
package grendel.ui;
import grendel.ui.UIAction;
import grendel.ui.ToolBarLayout;
import grendel.widgets.GrendelToolBar;
@ -50,6 +49,8 @@ import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JButton;
import com.trfenv.parsers.Event;
public class GeneralPanel extends JPanel {
private final boolean DEBUG = false;
static ResourceBundle fLabels = ResourceBundle.getBundle("grendel.ui.Labels",
@ -65,17 +66,17 @@ public class GeneralPanel extends JPanel {
setFont(new Font("Helvetica", Font.PLAIN, 12));
}
public UIAction[] getActions() {
public Event[] getActions() {
return null;
}
protected GrendelToolBar buildToolBar(String aToolbar, UIAction[] aActions) {
protected GrendelToolBar buildToolBar(String aToolbar, Event[] aActions) {
GrendelToolBar res = null;
Hashtable commands = new Hashtable();
for (int i = 0; i < aActions.length; i++)
{
UIAction a = aActions[i];
Event a = aActions[i];
String name = a.getName();
commands.put(name, a);
}
@ -94,7 +95,7 @@ public class GeneralPanel extends JPanel {
if (DEBUG) {
System.out.println("Local token = " + token);
}
UIAction action = (UIAction)commands.get(token);
Event action = (Event)commands.get(token);
String icon = toolbarresources.getString(token + "Icon");
String label = toolbarresources.getString(token + "Label");
String tooltip = toolbarresources.getString(token + "Tooltip");

View File

@ -70,5 +70,6 @@ include ../../../rules.mk
resources::
cp *.xml $(DISTDIR)/grendel/ui
cp *.properties $(DISTDIR)/grendel/ui
cp *.dtd $(DISTDIR)/grendel/ui
cp -r images $(DISTDIR)/grendel/ui

View File

@ -80,7 +80,6 @@ import grendel.prefs.base.InvisiblePrefs;
import grendel.prefs.base.ServerArray;
import grendel.storage.FolderExtraFactory;
import grendel.storage.SearchResultsFolderFactory;
import grendel.ui.UIAction;
import grendel.view.ViewedFolder;
import grendel.view.ViewedStore;
import grendel.view.ViewedStoreEvent;
@ -104,6 +103,8 @@ import grendel.widgets.TreeTableModelBroadcaster;
import grendel.widgets.TreeTableModelEvent;
import grendel.widgets.TreeTableModelListener;
import com.trfenv.parsers.Event;
/**
* Panel to display the <em>contents</em> of a folder.
*/
@ -117,7 +118,7 @@ public class MasterPanel extends GeneralPanel {
StoreChangeListener fStoreChangeListener = null;
ViewedStore fStores[];
UIAction fActions[] = {ActionFactory.GetNewMailAction(),
Event fActions[] = {ActionFactory.GetNewMailAction(),
ActionFactory.GetComposeMessageAction(),
new CopyToClipboardAction(),
new PasteFromClipboardAction(),
@ -228,7 +229,7 @@ public class MasterPanel extends GeneralPanel {
* Returns the actions associated with this panel.
*/
public UIAction[] getActions() {
public Event[] getActions() {
return fActions;
}
@ -341,7 +342,7 @@ public class MasterPanel extends GeneralPanel {
}
}
class NewFolderAction extends UIAction {
class NewFolderAction extends Event {
NewFolderAction() {
super("folderNew");
@ -360,7 +361,7 @@ public class MasterPanel extends GeneralPanel {
}
}
class DeleteFolderAction extends UIAction {
class DeleteFolderAction extends Event {
DeleteFolderAction() {
super("folderDelete");
}
@ -395,7 +396,7 @@ public class MasterPanel extends GeneralPanel {
Composition frame = new Composition();
frame.show();
frame.setVisible(true);
frame.requestFocus();
}
}
@ -406,7 +407,7 @@ public class MasterPanel extends GeneralPanel {
}
}
class CopyToClipboardAction extends UIAction {
class CopyToClipboardAction extends Event {
CopyToClipboardAction() {
super("copy-to-clipboard");
@ -424,7 +425,7 @@ public class MasterPanel extends GeneralPanel {
}
}
class PasteFromClipboardAction extends UIAction {
class PasteFromClipboardAction extends Event {
PasteFromClipboardAction() {
super("paste-from-clipboard");

View File

@ -0,0 +1,190 @@
<!--
#
# 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.
#
# The Original Code is the Grendel mail/news client.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1997 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Will Scullin <scullin@meer.net>
# Edwin Woudt <edwin@woudt.nl>
# R.J. Keller <rj.keller@beonex.com
# -->
<!-- multipane menu labels -->
<!ENTITY multiFileLabel "File" >
<!ENTITY multiFileAccel "F" >
<!ENTITY multiEditLabel "Edit" >
<!ENTITY multiEditAccel "E" >
<!ENTITY multiViewLabel "View" >
<!ENTITY multiViewAccel "V" >
<!ENTITY multiMessageLabel "Message" >
<!ENTITY multiMessageAccel "M" >
<!-- Master menu labels -->
<!ENTITY masterFileLabel "File" >
<!ENTITY masterFileAccel "F" >
<!ENTITY masterEditLabel "Edit" >
<!ENTITY masterEditAccel "E" >
<!-- Folder menu labels -->
<!ENTITY folderFileLabel "File" >
<!ENTITY folderFileAccel "F" >
<!ENTITY folderEditLabel "Edit" >
<!ENTITY folderEditAccel "E" >
<!ENTITY folderMessageLabel "Message" >
<!ENTITY folderMessageAccel "M" >
<!-- Message menu labels -->
<!ENTITY messageFileLabel "File" >
<!ENTITY messageFileAccel "F" >
<!ENTITY messageEditLabel "Edit" >
<!ENTITY messageEditAccel "E" >
<!ENTITY messageMessageLabel "Message" >
<!ENTITY messageMessageAccel "M" >
<!-- View menu labels -->
<!ENTITY viewLayoutLabel "Layout" >
<!ENTITY viewLayoutAccel "L" >
<!ENTITY splitLeftLabel "Split Left" >
<!ENTITY splitLeftAccel "L" >
<!ENTITY splitRightLabel "Split Right" >
<!ENTITY splitRightAccel "R" >
<!ENTITY splitTopLabel "Split Top" >
<!ENTITY splitTopAccel "T" >
<!ENTITY stackedLabel "Stacked" >
<!ENTITY stackedAccel "S" >
<!ENTITY appShowTooltipsLabel "Show Tooltips" >
<!ENTITY appShowTooltipsAccel "T" >
<!-- Common menu labels -->
<!ENTITY windowLabel "Window" >
<!ENTITY windowAccel "W" >
<!-- Application menu item labels -->
<!ENTITY appExitLabel "Exit" >
<!ENTITY appExitAccel "x" >
<!ENTITY appPrefsLabel "Preferences..." >
<!ENTITY appPrefsAccel "r" >
<!ENTITY appSearchLabel "Search" >
<!ENTITY appSearchAccel "S" >
<!ENTITY appRunFiltersLabel "Run Filters on TestInbox" >
<!ENTITY appRunFiltersAccel "F" >
<!-- Edit menu item labels -->
<!ENTITY editUndoLabel "Undo" >
<!ENTITY editUndoAccel "U" >
<!ENTITY editCutLabel "Cut" >
<!ENTITY editCutAccel "t" >
<!ENTITY editCopyLabel "Copy" >
<!ENTITY editCopyAccel "C" >
<!ENTITY editPasteLabel "Paste" >
<!ENTITY editPasteAccel "P" >
<!ENTITY editClearLabel "Delete" >
<!ENTITY editClearAccel "D" >
<!-- Folder menu item labels -->
<!ENTITY folderOpenLabel "Open Folder" >
<!ENTITY folderOpenAccel "O" >
<!-- Message menu item labels -->
<!ENTITY folderNewLabel "New Folder..." >
<!ENTITY folderNewAccel "F" >
<!ENTITY folderDeleteLabel "Delete Folder" >
<!ENTITY folderDeleteAccel "D" >
<!ENTITY msgGetNewLabel "Get New Messages" >
<!ENTITY msgGetNewAccel "G" >
<!ENTITY msgOpenLabel "Open Message" >
<!ENTITY msgOpenAccel "M" >
<!ENTITY msgSaveAsLabel "Save As..." >
<!ENTITY msgSaveAsAccel "A" >
<!ENTITY msgNewLabel "New Message" >
<!ENTITY msgNewAccel "N" >
<!ENTITY msgReplyLabel "Reply" >
<!ENTITY msgReplyAccel "R" >
<!ENTITY msgReplyAllLabel "Reply All" >
<!ENTITY msgReplyAllAccel "A" >
<!ENTITY fwdQuotedLabel "Forward Quoted" >
<!ENTITY fwdQuotedAccel "Q" >
<!ENTITY fwdInlineLabel "Forward Inline" >
<!ENTITY fwdInlineAccel "I" >
<!ENTITY fwdAttachmentLabel "Forward Attachment" >
<!ENTITY fwdAttachmentAccel "A" >
<!ENTITY msgMoveLabel "File to" >
<!ENTITY msgMoveAccel "F" >
<!ENTITY msgMovePopupLabel "File to" >
<!ENTITY msgCopyLabel "Copy to" >
<!ENTITY msgCopyAccel "C" >
<!ENTITY msgCopyPopupLabel "Copy to" >
<!ENTITY msgDeleteLabel "Delete Message" >
<!ENTITY msgDeleteAccel "D" >
<!ENTITY msgDeletePopupLabel "Delete Message" >
<!ENTITY msgMarkLabel "Mark" >
<!ENTITY msgMarkAccel "M" >
<!-- Mark menu labels -->
<!ENTITY markMsgReadLabel "As Read" >
<!ENTITY markMsgReadAccel "R" >
<!ENTITY markThreadReadLabel "Thread Read" >
<!ENTITY markThreadReadAccel "T" >
<!ENTITY markAllReadLabel "All Read" >
<!ENTITY markAllReadAccel "A" >
<!-- Sort menu labels -->
<!ENTITY viewSortLabel "Sort" >
<!ENTITY viewSortAccel "S" >
<!ENTITY toggleThreadingLabel "Toggle Threading" >
<!ENTITY toggleThreadingAccel "T" >
<!ENTITY sortDateLabel "by Date" >
<!ENTITY sortDateAccel "D" >
<!ENTITY sortSubjectLabel "by Subject" >
<!ENTITY sortSubjectAccel "S" >
<!ENTITY sortAuthorLabel "by Author" >
<!ENTITY sortAuthorAccel "A" >
<!ENTITY sortNumberLabel "by Number" >
<!ENTITY sortNumberAccel "N" >
<!-- Window menu item labels -->
<!ENTITY windowListLabel "Window List..." >
<!ENTITY windowListAccel "W" >
<!-- Preferences menu labels -->
<!ENTITY multiPrefsLabel "Preferences" >
<!ENTITY multiPrefsAccel "P" >
<!ENTITY prefIdsLabel "Identities" >
<!ENTITY prefIdsAccel "I" >
<!ENTITY prefSrvsLabel "Servers" >
<!ENTITY prefSrvsAccel "S" >
<!ENTITY prefGeneralLabel "General" >
<!ENTITY prefGeneralAccel "G" >
<!ENTITY prefUILabel "User interface" >
<!ENTITY prefUIAccel "U" >

View File

@ -35,10 +35,9 @@ import java.util.Vector;
import javax.mail.Message;
import javax.mail.MessagingException;
//import netscape.orion.toolbars.ToolbarFactory;
//import netscape.orion.toolbars.ToolBarLayout;
//import netscape.orion.uimanager.AbstractUICmd;
//import netscape.orion.uimanager.IUICmd;
import grendel.ui.XMLMenuBuilder;
import com.trfenv.parsers.Event;
public class MessageFrame extends GeneralFrame {
static Vector fMessageFrames = new Vector();
@ -56,9 +55,9 @@ public class MessageFrame extends GeneralFrame {
fPanel.add(fMessagePanel);
// fMenu = buildMenu("messageMain", Util.MergeActions(actions,
// fMessagePanel.getActions()));
fMenu = buildMenu("menus.xml",
Util.MergeActions(actions,
XMLMenuBuilder builder = new XMLMenuBuilder(Util.MergeActions(actions,
fMessagePanel.getActions()));
fMenu = builder.buildFrom("ui/menus.xml", this);
getRootPane().setJMenuBar(fMenu);
fToolBar = fMessagePanel.getToolBar();
@ -128,6 +127,6 @@ public class MessageFrame extends GeneralFrame {
return null;
}
UIAction actions[] = { ActionFactory.GetExitAction(),
Event actions[] = { ActionFactory.GetExitAction(),
ActionFactory.GetComposeMessageAction() };
}

View File

@ -64,8 +64,8 @@ class MessageModel implements TreeTableDataModel {
Icon fMessageReadIcon;
public MessageModel() {
fMessageIcon = new ImageIcon(getClass().getResource("images/msg-small.gif"));
fMessageReadIcon = new ImageIcon(getClass().getResource("images/msgRead-small.gif"));
fMessageIcon = new ImageIcon("ui/images/msg-small.gif");
fMessageReadIcon = new ImageIcon("ui/images/msgRead-small.gif");
}
public void setFolderView(FolderView aView) {

View File

@ -71,11 +71,12 @@ import grendel.mime.parser.MimeParserFactory;
import grendel.mime.html.MimeHTMLOperatorFactory;
import grendel.storage.MessageExtra;
import grendel.storage.MessageExtraFactory;
import grendel.ui.UIAction;
import grendel.widgets.GrendelToolBar;
import grendel.widgets.StatusEvent;
import com.trfenv.parsers.Event;
/* ####
import calypso.net.URLSource;
*/
@ -102,7 +103,7 @@ public class MessagePanel extends GeneralPanel {
EventListenerList fListeners = new EventListenerList();
UIAction fActions[] = {ActionFactory.GetNewMailAction(),
Event fActions[] = {ActionFactory.GetNewMailAction(),
ActionFactory.GetComposeMessageAction()};
/**
* Constructs a new message panel.

View File

@ -39,11 +39,12 @@ import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Store;
import grendel.ui.UIAction;
import grendel.view.ViewedFolder;
import grendel.view.ViewedMessage;
import grendel.widgets.TreePath;
import com.trfenv.parsers.Event;
public class MultiMessageDisplayManager extends MessageDisplayManager {
MasterFrame fMasterFrame;
@ -136,7 +137,8 @@ class MasterFrame extends GeneralFrame {
fMasterPanel.addMasterPanelListener(new FolderSelectionListener());
fPanel.add(fMasterPanel);
// fMenu = buildMenu("masterMain", actions);
fMenu = buildMenu("menus.xml", actions);
XMLMenuBuilder builder = new XMLMenuBuilder(actions);
fMenu = builder.buildFrom("ui/menus.xml", this);
getRootPane().setJMenuBar(fMenu);
fToolBar = fMasterPanel.getToolBar();
@ -200,7 +202,7 @@ class MasterFrame extends GeneralFrame {
// Action array
UIAction actions[] = { ActionFactory.GetExitAction(),
Event actions[] = { ActionFactory.GetExitAction(),
ActionFactory.GetNewMailAction(),
ActionFactory.GetComposeMessageAction()};
}

View File

@ -59,11 +59,8 @@ import javax.swing.text.JTextComponent;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import com.sun.xml.parser.Resolver;
import com.sun.xml.parser.Parser;
import com.sun.xml.tree.XmlDocument;
import com.sun.xml.tree.XmlDocumentBuilder;
import com.sun.xml.tree.TreeWalker;
import javax.xml.parsers.DocumentBuilderFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

View File

@ -53,10 +53,10 @@ import grendel.filters.FilterMaster;
*/
import grendel.composition.Composition;
import grendel.ui.UIAction;
import com.trfenv.parsers.Event;
class PreferencesAction extends UIAction {
class PreferencesAction extends Event {
PreferencesAction fThis;
public PreferencesAction() {

View File

@ -172,7 +172,7 @@ public abstract class ProgressFrame extends GeneralFrame implements Runnable {
fThread = null;
// Is this right? (edwin)
// this.dispose();
this.hide();
setVisible(false);
}
public abstract void progressLoop();

View File

@ -34,7 +34,7 @@ public class Splash extends JWindow {
public Splash() {
super();
ImageIcon image = new ImageIcon(getClass().getResource("images/GrendelSplash.jpg"));
ImageIcon image = new ImageIcon("ui/images/GrendelSplash.jpg");
JLabel splashLabel = new JLabel(image);
getContentPane().add(splashLabel);

View File

@ -46,17 +46,17 @@ public class UIFactory {
private UIFactory() {
fFolderIcon =
new ImageIcon(getClass().getResource("images/folder-small.gif"));
new ImageIcon("ui/images/folder-small.gif");
fNewsgroupIcon =
new ImageIcon(getClass().getResource("images/newsgroup-small.gif"));
new ImageIcon("ui/images/newsgroup-small.gif");
fLocalStoreIcon =
new ImageIcon(getClass().getResource("images/storeLocal-small.gif"));
new ImageIcon("ui/images/storeLocal-small.gif");
fRemoteStoreIcon =
new ImageIcon(getClass().getResource("images/storeRemote-small.gif"));
new ImageIcon("ui/images/storeRemote-small.gif");
fInboxIcon =
new ImageIcon(getClass().getResource("images/inbox-small.gif"));
new ImageIcon("ui/images/inbox-small.gif");
fConnectedIcon =
new ImageIcon(getClass().getResource("images/connected-small.gif"));
new ImageIcon("ui/images/connected-small.gif");
}
public static UIFactory Instance() {

View File

@ -52,7 +52,6 @@ import javax.mail.MessagingException;
import grendel.prefs.base.InvisiblePrefs;
import grendel.prefs.base.UIPrefs;
import grendel.ui.UIAction;
import grendel.view.ViewedMessage;
import grendel.widgets.CollapsiblePanel;
import grendel.widgets.GrendelToolBar;
@ -60,6 +59,8 @@ import grendel.widgets.Spring;
import grendel.widgets.StatusEvent;
import grendel.widgets.TreePath;
import com.trfenv.parsers.Event;
/**
* The legendary three pane UI.
*/
@ -183,8 +184,8 @@ class UnifiedMessageFrame extends GeneralFrame {
layoutPanels(layout);
fMenu = buildMenu("menus.xml",
Util.MergeActions(actions, Util.MergeActions(fFolders.getActions(), Util.MergeActions(fThreads.getActions(), fMessage.getActions()))));
XMLMenuBuilder builder = new XMLMenuBuilder(Util.MergeActions(actions, Util.MergeActions(fFolders.getActions(), Util.MergeActions(fThreads.getActions(), fMessage.getActions()))));
fMenu = builder.buildFrom("ui/menus.xml", this);
getRootPane().setJMenuBar(fMenu);
@ -345,7 +346,7 @@ class UnifiedMessageFrame extends GeneralFrame {
LayoutAction fStackedLayoutAction =
new LayoutAction(UnifiedMessageDisplayManager.STACKED);
UIAction[] actions = { ActionFactory.GetExitAction(),
Event[] actions = { ActionFactory.GetExitAction(),
ActionFactory.GetNewMailAction(),
ActionFactory.GetComposeMessageAction(),
ActionFactory.GetPreferencesAction(),
@ -473,15 +474,14 @@ class UnifiedMessageFrame extends GeneralFrame {
// LayoutAction class
//
class LayoutAction extends UIAction {
class LayoutAction extends Event {
ImageIcon fIcon;
String action;
public LayoutAction(String aAction) {
super(aAction);
this.setEnabled(true);
action = aAction;
fIcon = new ImageIcon(getClass().getResource("images/" +
aAction + ".gif"));
fIcon = new ImageIcon("ui/images/" + aAction + ".gif");
}
public void actionPerformed(ActionEvent aEvent) {

View File

@ -50,9 +50,10 @@ import javax.swing.JScrollPane;
import javax.swing.KeyStroke;
import grendel.ui.ToolBarLayout;
import grendel.ui.UIAction;
import grendel.widgets.GrendelToolBar;
import com.trfenv.parsers.Event;
public class Util {
static final boolean DEBUG = false;
public static final int LEFT = 0;
@ -108,9 +109,9 @@ public class Util {
g.drawChars(fChars, first, length, x, y);
}
static UIAction FindAction(Vector aVector, String aAction) {
static Event FindAction(Vector aVector, String aAction) {
for (int i = 0; i < aVector.size(); i++) {
UIAction action = (UIAction)aVector.elementAt(i);
Event action = (Event)aVector.elementAt(i);
if (action.equals(aAction)) {
return action;
}
@ -118,7 +119,7 @@ public class Util {
return null;
}
static public UIAction[] MergeActions(UIAction aActions1[], UIAction aActions2[]) {
static public Event[] MergeActions(Event aActions1[], Event aActions2[]) {
Vector resVector = new Vector();
int i;
if (aActions1 != null) {
@ -133,7 +134,7 @@ public class Util {
}
}
}
UIAction res[] = new UIAction[resVector.size()];
Event res[] = new Event[resVector.size()];
resVector.copyInto(res);
return res;
}
@ -277,7 +278,7 @@ public class Util {
}
}
class ScrollAction extends UIAction {
class ScrollAction extends Event {
JScrollPane fScrollPane;
int fAction;

View File

@ -17,303 +17,83 @@
* Copyright (C) 1999 Giao Nguyen. All
* Rights Reserved.
*
* Contributor(s): Morgan Schweers <morgan@vixen.com>
* Contributor(s):
* Morgan Schweers <morgan@vixen.com>
* R.J. Keller <rj.keller@beonex.com>
*/
package grendel.ui;
import java.io.InputStream;
import java.io.IOException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Hashtable;
import java.util.Properties;
import java.awt.Container;
import java.awt.Font;
import java.util.Map;
import java.util.HashMap;
import javax.swing.JMenuBar;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ButtonGroup;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Document;
import com.sun.xml.parser.Resolver;
import com.sun.xml.parser.Parser;
import com.sun.xml.tree.XmlDocument;
import com.sun.xml.tree.TreeWalker;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import grendel.widgets.MenuCtrl;
import grendel.widgets.MenuBarCtrl;
import grendel.widgets.Control;
import com.trfenv.parsers.xul.XulParser;
import com.trfenv.parsers.Event;
/**
* Build a menu bar from an XML data source. This builder supports:
* <UL>
* <LI>Text label cross referencing to a properties file.
* <LI>Text label cross referencing to a DTD file.
* <LI>Action lookups.
* </UL>
*/
public class XMLMenuBuilder extends XMLWidgetBuilder {
static final String id_attr = "id";
static final String menu_tag = "menu";
static final String label_attr = "label";
static final String separator_attr = "separator";
static final String menuitem_tag = "menuitem";
static final String checkbox_attr = "checkbox";
static final String radio_attr = "radio";
static final String group_attr = "group";
static final String accel_attr = "accel";
static final String type_attr = "type";
public class XMLMenuBuilder {
private Event[] mListener;
private Element root;
private JMenuBar mMenuBar;
/**
* The button group indexed by its name.
*/
protected Hashtable button_group;
Hashtable actions;
MenuBarCtrl component;
private Map<String, JComponent> mIDs;
/**
* Build a menu builder which operates on XML formatted data
*
* @param ref the reference point for properties location
* @param actionList array of UIAction objects to map to
* @param aListener The action listener that contains the events
* for all the tags that will be parsed.
*/
public XMLMenuBuilder(Class ref, UIAction[] actionList) {
button_group = new Hashtable();
actions = new Hashtable();
this.ref = ref;
if (actionList != null) {
for (int i = 0; i < actionList.length; i++) {
actions.put(actionList[i].getName(), actionList[i]);
public XMLMenuBuilder(Event[] aListener) {
mListener = aListener;
mIDs = new HashMap<String, JComponent>();
}
}
}
/**
* Build a menu builder which operates on XML formatted data
*Builds a JMenuBar based on the input stream data.
*
* @param frame reference point for properties location
* @param actionList array of UIAction objects to map to
* @param stream The input stream to read the XML data from.
* @param aWindow The parent window of this menubar.
*/
public XMLMenuBuilder(JFrame frame, UIAction[] actionList) {
this(frame.getClass(), actionList);
public JMenuBar buildFrom(String file, JFrame aWindow) {
XulParser parser = new XulParser(mListener, aWindow);
Document doc = XulParser.makeDocument(file);
root = doc.getDocumentElement();
//no, we don't support multiple menu bars. If there are multiple menubars, just take
//the first one.
Element menubarTag = (Element)root.getElementsByTagName("menubar").item(0);
mMenuBar = (JMenuBar)parser.parseTag(null, menubarTag);
mIDs = parser.getIDs();
return mMenuBar;
}
/**
* Read the input stream and build a menubar from it
*
* @param stream the stream containing the XML data
*Returns a map containing the element ID as a string and the JComponent being
*the component that the ID connects to.
*/
public JComponent buildFrom(InputStream stream) {
XmlDocument doc;
TreeWalker tree;
Node node;
URL linkURL;
Element current;
try {
doc = XmlDocument.createXmlDocument(stream, false);
current = doc.getDocumentElement();
tree = new TreeWalker(current);
// get the link tag for this file
node = tree.getNextElement("head").getFirstChild().getNextSibling();
// set the configuration contained in this node
setConfiguration((Element)node);
// skip to the body
buildFrom(tree.getNextElement("body"));
} catch (Throwable t) {
t.printStackTrace();
} finally {
return component;
}
}
public JMenu buildMenu(Element element) {
Node node;
MenuCtrl menu = new MenuCtrl();
String my_id = element.getAttribute(id_attr);
menu.setText(getReferencedLabel(element, label_attr).trim());
menu.setActionCommand(element.getAttribute(id_attr));
node = element.getFirstChild().getNextSibling();
while (node != null) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element current = (Element)node;
String tag = current.getTagName();
JComponent comp = buildComponent((Element)node);
menu.add(comp);
}
node = node.getNextSibling();
}
return menu;
}
public JComponent buildFrom(Element element) {
Node node =
element.getFirstChild().getNextSibling().getFirstChild().getNextSibling();
component = new MenuBarCtrl();
while (node != null) {
// if it's an element, we process.
// otherwise, it's probably a closing tag
if (node.getNodeType() == Node.ELEMENT_NODE) {
JMenu menu = buildMenu((Element)node);
component.addItemByName(menu.getActionCommand(), menu);
}
node = node.getNextSibling();
}
return component;
}
/**
* @return the menubar built by this builder
*/
public MenuBarCtrl getComponent() {
return component;
}
public void configureForOwner(JComponent component) {
}
/**
* Build the component at the current XML element and add to the parent
* @param current the current element
*/
protected JComponent buildComponent(Element current) {
String tag = current.getTagName();
JComponent comp = null;
// menu tag
if (tag.equals(menu_tag)) {
comp = buildMenu(current);
} else if (tag.equals(menuitem_tag)) { // menuitem tag
String type = current.getAttribute(type_attr);
// which type of menuitem?
if (type.equals("")) {
// no type ? it's a regular menuitem
comp = buildMenuItem(current);
} else if (type.equals(separator_attr)) { // separator
comp = buildSeparator(current);
} else if (type.equals(checkbox_attr)) { // checkboxes
comp = buildCheckBoxMenuItem(current);
} else if (type.equals(radio_attr)) { // radio
comp = buildRadioMenuItem(current);
}
}
comp.setFont(new Font("Helvetica", Font.PLAIN, 12));
return comp;
}
/**
* Build a JRadioMenuItem
* @param current the element that describes the JRadioMenuItem
* @return the built component
*/
protected JRadioButtonMenuItem buildRadioMenuItem(Element current) {
String group = current.getAttribute(group_attr);
ButtonGroup bg;
JRadioButtonMenuItem comp = new JRadioButtonMenuItem();
finishComponent(comp, current);
// do we add to a button group?
if (button_group.containsKey(group)) {
bg = (ButtonGroup)button_group.get(group);
} else {
bg = new ButtonGroup();
button_group.put(group, bg);
}
bg.add((JRadioButtonMenuItem)comp);
comp.setFont(new Font("Helvetica", Font.PLAIN, 12));
return comp;
}
/**
* Build a JCheckBoxMenuItem.
* @param current the element that describes the JCheckBoxMenuItem
* @return the built component
*/
protected JCheckBoxMenuItem buildCheckBoxMenuItem(Element current) {
JCheckBoxMenuItem item = new JCheckBoxMenuItem();
finishComponent(item, current);
item.setFont(new Font("Helvetica", Font.PLAIN, 12));
return item;
}
/**
* Build a JSeparator.
* @param current the element that describes the JSeparator
* @return the built component
*/
protected JSeparator buildSeparator(Element current) {
return new JSeparator();
}
/**
* Build a JMenuItem.
* @param current the element that describes the JMenuItem
* @return the built component
*/
protected JMenuItem buildMenuItem(Element current) {
JMenuItem item = new JMenuItem();
finishComponent(item, current);
item.setFont(new Font("Helvetica", Font.PLAIN, 12));
return item;
}
private void finishComponent(JMenuItem item, Element current) {
String label = getReferencedLabel(current, label_attr);
UIAction action = null;
if (label.length() > 0) {
item.setText(label);
}
label = current.getAttribute("action");
if ((action = (UIAction)actions.get(label)) != null) {
item.addActionListener(action);
}
label = getReferencedLabel(current, accel_attr);
if (label.length() > 0) {
item.setMnemonic(label.charAt(0));
}
}
public static void main(String[] args) throws Exception {
javax.swing.JFrame frame = new javax.swing.JFrame("Foo bar");
XMLMenuBuilder builder = new XMLMenuBuilder(frame, new UIAction[0]);
URL url = builder.getClass().getResource("menus.xml");
builder.buildFrom(url.openStream());
frame.setJMenuBar((JMenuBar)builder.getComponent());
frame.pack();
frame.setVisible(true);
public Map<String, JComponent> getElementsAndIDs()
{
return mIDs;
}
}

View File

@ -56,16 +56,9 @@ import javax.swing.JComboBox;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Document;
import com.sun.xml.parser.Resolver;
import com.sun.xml.parser.Parser;
import com.sun.xml.tree.XmlDocument;
import com.sun.xml.tree.TreeWalker;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* Build a panel from an XML data source.
@ -111,27 +104,24 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
* @param stream the stream containing the XML data
*/
public JComponent buildFrom(InputStream stream) {
XmlDocument doc;
TreeWalker tree;
Document doc;
Node node;
URL linkURL;
Element current;
try {
doc = XmlDocument.createXmlDocument(stream, false);
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(stream);
current = doc.getDocumentElement();
tree = new TreeWalker(current);
// get the link tag for this file
// get into head and get the first element
node =
tree.getNextElement("head").getFirstChild().getNextSibling();
node = current.getElementsByTagName("head").item(0).getFirstChild().getNextSibling();
// set the configuration contained in this node
setConfiguration((Element)node);
// skip to the body and find the element
current = findTargetElement(tree.getNextElement("body"));
current = findTargetElement((Element)current.getElementsByTagName("body").item(0));
if (current != null) {
component = (PageUI)buildFrom(current);

View File

@ -1,136 +1,89 @@
<?xml version="1.0"?>
<xml>
<head>
<link role="stringprops" href="MenuLabels.properties"/>
</head>
<body>
<!DOCTYPE window [
<!ENTITY % menuLabelsDTD SYSTEM "MenuLabels.dtd" >
%menuLabelsDTD;
]>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset><!--
<key modifiers="accel" key="&folderNewAccel;" oncommand="msgNew"/>
--></keyset>
<menubar id="mail.multi_pane">
<menu id="FileMenu" category="file"
label="$multiFileLabel" accel="F">
<menuitem id="msgNew" category="file" action="msgNew"
label="$msgNewLabel" accel="$msgNewAccel"
description=""/>
<menuitem id="folderNew" category="file" action="folderNew"
label="$folderNewLabel" accel="$folderNewAccel"
description=""/>
<menuitem id="msgOpen" category="file" action="msgOpen"
label="$msgOpenLabel" accel="$msgOpenAccel"
description=""/>
<menuitem id="msgSaveAs" category="file" action="msgSaveAs"
label="$msgSaveAsLabel" accel="$msgSaveAsAccel"
description=""/>
<menuitem type="separator"/>
<menuitem id="msgGetNew" category="file" action="msgGetNew"
label="$msgGetNewLabel" accel="$msgGetNewAccel"
description=""/>
<menuitem type="separator"/>
<menuitem id="appExit" category="quit" action="appExit"
label="$appExitLabel" accel="$appExitAccel"
description=""/>
<menu id="FileMenu" label="&multiFileLabel;" accesskey="&multiFileAccel;">
<menupopup>
<menuitem id="msgNew" onclick="msgNew" label="&msgNewLabel;" accesskey="&msgNewAccel;"/>
<menuitem id="folderNew" onclick="folderNew" label="&folderNewLabel;" accesskey="&folderNewAccel;"/>
<menuitem id="msgOpen" onclick="msgOpen" label="&msgOpenLabel;" accesskey="&msgOpenAccel;"/>
<menuitem id="msgSaveAs" onclick="msgSaveAs" label="&msgSaveAsLabel;" accesskey="&msgSaveAsAccel;"/>
<menuseparator/>
<menuitem id="msgGetNew" onclick="msgGetNew" label="&msgGetNewLabel;" accesskey="&msgGetNewAccel;"/>
<menuseparator/>
<menuitem id="appExit" onclick="appExit" label="&appExitLabel;" accesskey="&appExitAccel;"/>
</menupopup>
</menu>
<menu id="EditMenu" category="edit"
label="$multiEditLabel" accel="$multiEditAccel">
<menuitem id="editUndo" category="edit" action="editUndo"
label="$editUndoLabel" accel="$editUndoAccel"
description=""/>
<menuitem id="editCut" category="edit" action="editCut"
label="$editCutLabel" accel="$editCutAccel"
description=""/>
<menuitem id="editCopy" category="edit" action="editCopy"
label="$editCopyLabel" accel="$editCopyAccel"
description=""/>
<menuitem id="editPaste" category="edit" action="editPaste"
label="$editPasteLabel" accel="$editPasteAccel"
description=""/>
<menuitem type="separator"/>
<menuitem id="folderDelete" category="edit" action="folderDelete"
label="$folderDeleteLabel" accel="$folderDeleteAccel"
description=""/>
<menuitem type="separator"/>
<menuitem id="appSearch" category="edit" action="appSearch"
label="$appSearchLabel" accel="$appSearchAccel"
description=""/>
<menuitem id="appRunFilters" category="edit" action="appRunFilters"
label="$appRunFiltersLabel" accel="$appRunFiltersAccel"
description=""/>
<menu id="EditMenu" label="&multiEditLabel;" accesskey="&multiEditAccel;">
<menupopup>
<menuitem id="editUndo" onclick="editUndo" label="&editUndoLabel;" accesskey="&editUndoAccel;"/>
<menuitem id="editCut" onclick="editCut" label="&editCutLabel;" accesskey="&editCutAccel;"/>
<menuitem id="editCopy" onclick="editCopy" label="&editCopyLabel;" accesskey="&editCopyAccel;"/>
<menuitem id="editPaste" onclick="editPaste" label="&editPasteLabel;" accesskey="&editPasteAccel;"/>
<menuseparator/>
<menuitem id="folderDelete" onclick="folderDelete" label="&folderDeleteLabel;" accesskey="&folderDeleteAccel;"/>
<menuseparator/>
<menuitem id="appSearch" onclick="appSearch" label="&appSearchLabel;" accesskey="&appSearchAccel;"/>
<menuitem id="appRunFilters" onclick="appRunFilters" label="&appRunFiltersLabel;" accesskey="&appRunFiltersAccel;"/>
</menupopup>
</menu>
<menu id="ViewMenu" category="view"
label="$multiViewLabel" accel="$multiViewAccel">
<menu id="SortMenu" category="view"
label="$viewSortLabel" accel="$viewSortAccel">
<menuitem id="toggleThreading" category="view" action="toggleThreading"
type="checkbox"
label="$toggleThreadingLabel" accel="$toggleThreadingAccel"
description=""/>
<menuitem type="separator"/>
<menuitem id="sortAuthor" category="view" action="sortAuthor"
type="radio" group="sort"
label="$sortAuthorLabel" accel="$sortAuthorAccel"
description=""/>
<menuitem id="sortDate" category="view" action="sortDate"
type="radio" group="sort"
label="$sortDateLabel" accel="$sortDateAccel"
description=""/>
<menuitem id="sortNumber" category="view" action="sortNumber"
type="radio" group="sort"
label="$sortNumberLabel" accel="$sortNumberAccel"
description=""/>
<menuitem id="sortSubject" category="view" action="sortSubject"
type="radio" group="sort"
label="$sortSubjectLabel" accel="$sortSubjectAccel"
description=""/>
<menu id="ViewMenu" label="&multiViewLabel;" accesskey="&multiViewAccel;">
<menupopup>
<menu id="SortMenu" label="&viewSortLabel;" accesskey="&viewSortAccel;">
<menupopup>
<menuitem id="toggleThreading" onclick="toggleThreading" label="&toggleThreadingLabel;" accesskey="&toggleThreadingAccel;"/>
<menuseparator/>
<menuitem id="sortAuthor" onclick="sortAuthor" label="&sortAuthorLabel;" accesskey="&sortAuthorAccel;"/>
<menuitem id="sortDate" onclick="sortDate" label="&sortDateLabel;" accesskey="&sortDateAccel;"/>
<menuitem id="sortNumber" onclick="sortNumber" label="&sortNumberLabel;" accesskey="&sortNumberAccel;"/>
<menuitem id="sortSubject" onclick="sortSubject" label="&sortSubjectLabel;" accesskey="&sortSubjectAccel;"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="MessageMenu" category="message"
label="$multiMessageLabel" accel="$multiMessageAccel">
<menuitem id="msgNew" category="message" action="msgNew"
label="$msgNewLabel" accel="$msgNewAccel"
description=""/>
<menuitem type="separator"/>
<menuitem id="msgReply" category="message" action="msgReply"
label="$msgReplyLabel" accel="$msgReplyAccel"
description=""/>
<menuitem id="msgReplyAll" category="message" action="msgReplyAll"
label="$msgReplyAllLabel" accel="$msgReplyAllAccel"
description=""/>
<menuitem id="fwdQuoted" category="message" action="fwdQuoted"
label="$fwdQuotedLabel" accel="$fwdQuotedAccel"
description=""/>
<menuitem id="fwdInline" category="message" action="fwdInline"
label="$fwdInlineLabel" accel="$fwdInlineAccel"
description=""/>
<menuitem id="fwdAttachment" category="message" action="fwdAttachment"
label="$fwdAttachmentLabel" accel="$fwdAttachmentAccel"
description=""/>
<menuitem type="separator"/>
<menu id="msgMark" category="message"
label="$msgMarkLabel" accel="$msgMarkAccel">
<menuitem id="markMsgRead" category="message" action="markMsgRead"
label="$markMsgReadLabel" accel="$markMsgReadAccel"
description=""/>
<menuitem id="markThreadRead" category="message" action="markThreadRead"
label="$markThreadReadLabel" accel="$markThreadReadAccel"
description=""/>
<menuitem id="markAllRead" category="message" action="markAllRead"
label="$markAllReadLabel" accel="$markAllReadAccel"
description=""/>
<menu id="MessageMenu" label="&multiMessageLabel;" accesskey="&multiMessageAccel;">
<menupopup>
<menuitem id="msgNew" onclick="msgNew" label="&msgNewLabel;" accesskey="&msgNewAccel;"/>
<menuseparator/>
<menuitem id="msgReply" onclick="msgReply" label="&msgReplyLabel;" accesskey="&msgReplyAccel;"/>
<menuitem id="msgReplyAll" onclick="msgReplyAll" label="&msgReplyAllLabel;" accesskey="&msgReplyAllAccel;"/>
<menuitem id="fwdQuoted" onclick="fwdQuoted" label="&fwdQuotedLabel;" accesskey="&fwdQuotedAccel;"/>
<menuitem id="fwdInline" onclick="fwdInline" label="&fwdInlineLabel;" accesskey="&fwdInlineAccel;"/>
<menuitem id="fwdAttachment" onclick="fwdAttachment" label="&fwdAttachmentLabel;" accesskey="&fwdAttachmentAccel;"/>
<menuseparator/>
<menu id="msgMark" label="&msgMarkLabel;" accesskey="&msgMarkAccel;">
<menupopup>
<menuitem id="markMsgRead" onclick="markMsgRead" label="&markMsgReadLabel;" accesskey="&markMsgReadAccel;"/>
<menuitem id="markThreadRead" onclick="markThreadRead" label="&markThreadReadLabel;" accesskey="&markThreadReadAccel;"/>
<menuitem id="markAllRead" onclick="markAllRead" label="&markAllReadLabel;" accesskey="&markAllReadAccel;"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="PrefsMenu" category="prefs"
label="$multiPrefsLabel" accel="$multiPrefsAccel">
<menuitem id="prefGeneral" category="prefs" action="prefGeneral"
label="$prefGeneralLabel" accel="$prefGeneralAccel"
description=""/>
<menuitem id="prefIds" category="prefs" action="prefIds"
label="$prefIdsLabel" accel="$prefIdsAccel"
description=""/>
<menuitem id="prefSrvs" category="prefs" action="prefSrvs"
label="$prefSrvsLabel" accel="$prefSrvsAccel"
description=""/>
<menuitem id="prefUI" category="prefs" action="prefUI"
label="$prefUILabel" accel="$prefUIAccel"
description=""/>
<menu id="PrefsMenu" label="&multiPrefsLabel;" accesskey="&multiPrefsAccel;">
<menupopup>
<menuitem id="prefGeneral" onclick="prefGeneral" label="&prefGeneralLabel;" accesskey="&prefGeneralAccel;"/>
<menuitem id="prefIds" onclick="prefIds" label="&prefIdsLabel;" accesskey="&prefIdsAccel;"/>
<menuitem id="prefSrvs" onclick="prefSrvs" label="&prefSrvsLabel;" accesskey="&prefSrvsAccel;"/>
<menuitem id="prefUI" onclick="prefUI" label="&prefUILabel;" accesskey="&prefUIAccel;"/>
</menupopup>
</menu>
</menubar>
</body>
</xml>
</window>

View File

@ -1 +1 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * 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. * * The Original Code is the Grendel mail/news client. * * The Initial Developer of the Original Code is Netscape Communications * Corporation. Portions created by Netscape are * Copyright (C) 1997 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): Brandon Wiley * * Created: Brandon Wiley */ package grendel.view; import java.util.*; public class EnumerationIterator implements Iterator { Enumeration enum; public EnumerationIterator(Enumeration e) {enum=e;} public boolean hasNext() {return enum.hasMoreElements();} public Object next() {return enum.nextElement();} public void remove() {} }
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * 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. * * The Original Code is the Grendel mail/news client. * * The Initial Developer of the Original Code is Netscape Communications * Corporation. Portions created by Netscape are * Copyright (C) 1997 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): Brandon Wiley * * Created: Brandon Wiley */ package grendel.view; import java.util.*; public class EnumerationIterator implements Iterator { Enumeration enumer; public EnumerationIterator(Enumeration e) {enumer=e;} public boolean hasNext() {return enumer.hasMoreElements();} public Object next() {return enumer.nextElement();} public void remove() {} }

View File

@ -94,7 +94,7 @@ class TestMessageThread implements IThreadable, ISortable {
if (start < (L-2) &&
(subject.charAt(start) == 'r' || subject.charAt(start) == 'R') &&
(subject.charAt(start+1) == 'e' || subject.charAt(start+1) == 'e')) {
(subject.charAt(start+1) == 'e' || subject.charAt(start+1) == 'E')) {
if (subject.charAt(start+2) == ':') {
start += 3; // Skip over "Re:"
has_re = true; // yes, we found it.

View File

@ -105,8 +105,8 @@ public class Animation extends Component implements Runnable
for (int i = 0; i < iFrames; i++)
{
Integer arg[] = { new Integer(i) };
String name = MessageFormat.format(template, arg);
fGlyphs[i] = new ImageIcon(getClass().getResource(name));
String name = MessageFormat.format(template, arg, null);
fGlyphs[i] = new ImageIcon(name);
}
}

View File

@ -35,11 +35,11 @@ import javax.swing.JToolBar;
import javax.swing.JButton;
import grendel.ui.ToolBarLayout;
import grendel.ui.UIAction;
import grendel.widgets.Animation;
import grendel.widgets.Spring;
import grendel.widgets.ToolBarButton;
import com.trfenv.parsers.Event;
public class GrendelToolBar extends JToolBar {
@ -50,17 +50,19 @@ public class GrendelToolBar extends JToolBar {
layout = new ToolBarLayout();
setLayout(layout);
setFloatable(false);
setBackground(new java.awt.Color(238,238,238));
}
public Spring makeNewSpring() {
return layout.createSpring();
}
public void addButton(UIAction aActionListener,
public void addButton(Event aActionListener,
String aImageName,
String aText,
String aToolTip) {
ToolBarButton b = new ToolBarButton();
JButton b = new JButton();
b.setHorizontalTextPosition(JButton.CENTER);
b.setVerticalTextPosition(JButton.BOTTOM);
@ -73,8 +75,7 @@ public class GrendelToolBar extends JToolBar {
b.setBorder(BorderFactory.createEmptyBorder());
b.setToolTipText(aToolTip);
URL iconUrl = getClass().getResource("toolbar/mozilla/" + aImageName + ".gif");
b.setIcon(new ImageIcon(iconUrl));
b.setIcon(new ImageIcon("widgets/toolbar/mozilla/" + aImageName + ".gif"));
Dimension d=b.getPreferredSize();
double w=d.getWidth();

View File

@ -1170,8 +1170,8 @@ public class TreeTable extends JComponent implements Scrollable,
public void updateUI() {
super.updateUI();
fPlusIcon = new ImageIcon(getClass().getResource("images/plus.gif"));
fMinusIcon = new ImageIcon(getClass().getResource("images/minus.gif"));
fPlusIcon = new ImageIcon("widgets/images/plus.gif");
fMinusIcon = new ImageIcon("widgets/images/minus.gif");
fWindowColor = UIManager.getColor("window");
fHighlightColor = UIManager.getColor("textHighlight");