Moving some Grendel GUI to XUL. Also adding prettier toolbar button images.
|
@ -274,7 +274,7 @@ public class AddressBook extends GeneralFrame {
|
|||
// (Jeff)
|
||||
|
||||
XMLMenuBuilder builder = new XMLMenuBuilder(defaultActions);
|
||||
mMenuBarCtrl = builder.buildFrom("ui/menus.xml", this);
|
||||
mMenuBarCtrl = builder.buildFrom("ui/grendel.xml", this);
|
||||
|
||||
JMenuItem aMenuItem = (JMenuItem)builder.getElementsAndIDs().get("sortAscending");
|
||||
if (aMenuItem != null) {
|
||||
|
|
|
@ -85,15 +85,13 @@ public class Composition extends GeneralFrame {
|
|||
mCompositionPanel.addCompositionPanelListener(new PanelListener());
|
||||
|
||||
//create menubar (top)
|
||||
// fMenu = buildMenu("mainMenubar",
|
||||
// mCompositionPanel.getActions());
|
||||
XMLMenuBuilder builder = new XMLMenuBuilder(mCompositionPanel.getActions());
|
||||
fMenu = builder.buildFrom("ui/menus.xml", (JFrame)this);
|
||||
fMenu = builder.buildFrom("ui/grendel.xml", (JFrame)this);
|
||||
|
||||
getRootPane().setJMenuBar(fMenu);
|
||||
|
||||
fToolBar = mCompositionPanel.getToolBar();
|
||||
fToolBar.add(fToolBar.makeNewSpring());
|
||||
fToolBar.add(new grendel.widgets.Spring());
|
||||
|
||||
mAddressBar = mCompositionPanel.getAddressBar();
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class FolderFrame extends GeneralFrame {
|
|||
// fMenu = buildMenu("folderMain", Util.MergeActions(actions,
|
||||
// fFolderPanel.getActions()));
|
||||
XMLMenuBuilder builder = new XMLMenuBuilder(Util.MergeActions(actions, fFolderPanel.getActions()));
|
||||
fMenu = builder.buildFrom("ui/menus.xml", this);
|
||||
fMenu = builder.buildFrom("ui/grendel.xml", this);
|
||||
getRootPane().setJMenuBar(fMenu);
|
||||
|
||||
fToolBar = fFolderPanel.getToolBar();
|
||||
|
|
|
@ -58,7 +58,7 @@ import javax.swing.JMenu;
|
|||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
//import javax.swing.JToolBar;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
|
@ -438,7 +438,7 @@ public class FolderPanel extends GeneralPanel {
|
|||
* Returns the toolbar associated with this panel.
|
||||
*/
|
||||
|
||||
public GrendelToolBar getToolBar() {
|
||||
public JToolBar getToolBar() {
|
||||
return buildToolBar("folderToolBar", getActions());
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class GeneralFrame extends JFrame
|
|||
protected JMenuBar fMenu;
|
||||
protected CollapsiblePanel fToolBarPanel;
|
||||
protected GridBagConstraints fToolBarPanelConstraints;
|
||||
protected GrendelToolBar fToolBar;
|
||||
protected JToolBar fToolBar;
|
||||
protected Component fStatusBar;
|
||||
protected String fResourceBase = "grendel.ui";
|
||||
protected String fID;
|
||||
|
|
|
@ -46,8 +46,13 @@ import javax.swing.Icon;
|
|||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
import com.trfenv.parsers.Event;
|
||||
import com.trfenv.parsers.xul.XulParser;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class GeneralPanel extends JPanel {
|
||||
private final boolean DEBUG = false;
|
||||
|
@ -57,7 +62,7 @@ public class GeneralPanel extends JPanel {
|
|||
static Clipboard fPrivateClipboard = new Clipboard("Grendel");
|
||||
|
||||
protected String fResourceBase = "grendel.ui";
|
||||
protected GrendelToolBar fToolBar;
|
||||
protected JToolBar fToolBar;
|
||||
|
||||
public GeneralPanel() {
|
||||
setLayout(new BorderLayout());
|
||||
|
@ -68,56 +73,18 @@ public class GeneralPanel extends JPanel {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected GrendelToolBar buildToolBar(String aToolbar, Event[] aActions) {
|
||||
GrendelToolBar res = null;
|
||||
protected JToolBar buildToolBar(String aToolbar, Event[] aActions) {
|
||||
XulParser curParser = new XulParser(aActions, null);
|
||||
Document doc = curParser.makeDocument("ui/grendel.xml");
|
||||
Element toolbar = (Element)doc.getDocumentElement().getElementsByTagName("toolbar").
|
||||
item(0);
|
||||
|
||||
Hashtable commands = new Hashtable();
|
||||
for (int i = 0; i < aActions.length; i++)
|
||||
{
|
||||
Event a = aActions[i];
|
||||
String name = a.getName();
|
||||
commands.put(name, a);
|
||||
}
|
||||
JToolBar newToolbar = (JToolBar)curParser.parseTag(this, toolbar);
|
||||
|
||||
|
||||
try {
|
||||
res = new GrendelToolBar();
|
||||
|
||||
ResourceBundle toolbarresources = ResourceBundle.getBundle(fResourceBase + ".Toolbar");
|
||||
ResourceBundle menuresources = ResourceBundle.getBundle(fResourceBase + ".Menus");
|
||||
String toolbar = menuresources.getString(aToolbar);
|
||||
StringTokenizer tokens = new StringTokenizer(toolbar, " ", false);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String token = tokens.nextToken();
|
||||
if (DEBUG) {
|
||||
System.out.println("Local token = " + 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");
|
||||
|
||||
res.addButton(action, icon, label, tooltip);
|
||||
}
|
||||
} catch (MissingResourceException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Toolbar status:");
|
||||
if (res == null) {
|
||||
System.out.println("\tbuildToolBar failed.");
|
||||
}
|
||||
else {
|
||||
System.out.println("\tbuildToolBar succeeded.");
|
||||
System.out.println("\tGrendelToolBar res contains " + res.getComponentCount() + " components.");
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
return newToolbar;
|
||||
}
|
||||
|
||||
public GrendelToolBar getToolBar() {
|
||||
public JToolBar getToolBar() {
|
||||
return fToolBar;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import javax.swing.Icon;
|
|||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
//import javax.swing.JToolBar;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.ToolTipManager;
|
||||
|
@ -69,9 +69,6 @@ import javax.swing.event.TreeModelEvent;
|
|||
|
||||
import calypso.util.ArrayEnumeration;
|
||||
import calypso.util.Assert;
|
||||
//import netscape.orion.toolbars.NSToolbar;
|
||||
//import netscape.orion.uimanager.AbstractUICmd;
|
||||
//import netscape.orion.uimanager.IUICmd;
|
||||
|
||||
import javax.mail.Folder;
|
||||
import javax.mail.MessagingException;
|
||||
|
@ -106,6 +103,10 @@ import grendel.widgets.TreeTableModelEvent;
|
|||
import grendel.widgets.TreeTableModelListener;
|
||||
|
||||
import com.trfenv.parsers.Event;
|
||||
import com.trfenv.parsers.xul.XulParser;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Panel to display the <em>contents</em> of a folder.
|
||||
|
@ -239,8 +240,15 @@ public class MasterPanel extends GeneralPanel {
|
|||
* Returns the toolbar associated with this panel.
|
||||
*/
|
||||
|
||||
public GrendelToolBar getToolBar() {
|
||||
return buildToolBar("masterToolBar", fActions);
|
||||
public JToolBar getToolBar() {
|
||||
XulParser curParser = new XulParser(fActions, null);
|
||||
Document doc = curParser.makeDocument("ui/grendel.xml");
|
||||
Element toolbar = (Element)doc.getDocumentElement().getElementsByTagName("toolbar").
|
||||
item(0);
|
||||
|
||||
JToolBar newToolbar = (JToolBar)curParser.parseTag(this, toolbar);
|
||||
|
||||
return newToolbar;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MessageFrame extends GeneralFrame {
|
|||
// fMessagePanel.getActions()));
|
||||
XMLMenuBuilder builder = new XMLMenuBuilder(Util.MergeActions(actions,
|
||||
fMessagePanel.getActions()));
|
||||
fMenu = builder.buildFrom("ui/menus.xml", this);
|
||||
fMenu = builder.buildFrom("ui/grendel.xml", this);
|
||||
getRootPane().setJMenuBar(fMenu);
|
||||
|
||||
fToolBar = fMessagePanel.getToolBar();
|
||||
|
|
|
@ -52,7 +52,7 @@ import javax.swing.JTextPane;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
//import javax.swing.JToolBar;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.EventListenerList;
|
||||
|
@ -161,7 +161,7 @@ public class MessagePanel extends GeneralPanel {
|
|||
* Returns the toolbar associated with this panel.
|
||||
*/
|
||||
|
||||
public GrendelToolBar getToolBar() {
|
||||
public JToolBar getToolBar() {
|
||||
return buildToolBar("messageToolBar", fActions);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ import javax.swing.tree.TreePath;
|
|||
|
||||
import com.trfenv.parsers.Event;
|
||||
|
||||
/**
|
||||
*Main Grendel window
|
||||
*/
|
||||
public class MultiMessageDisplayManager extends MessageDisplayManager {
|
||||
MasterFrame fMasterFrame;
|
||||
|
||||
|
@ -138,7 +141,7 @@ class MasterFrame extends GeneralFrame {
|
|||
fPanel.add(fMasterPanel);
|
||||
// fMenu = buildMenu("masterMain", actions);
|
||||
XMLMenuBuilder builder = new XMLMenuBuilder(actions);
|
||||
fMenu = builder.buildFrom("ui/menus.xml", this);
|
||||
fMenu = builder.buildFrom("ui/grendel.xml", this);
|
||||
getRootPane().setJMenuBar(fMenu);
|
||||
|
||||
fToolBar = fMasterPanel.getToolBar();
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<!--
|
||||
#
|
||||
# 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 Edwin Woudt
|
||||
# <edwin@woudt.nl>. Portions created by Edwin Woudt are
|
||||
# Copyright (C) 1999 Edwin Woudt. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
-->
|
||||
|
||||
<!ENTITY toolbar.msgGetNewLabel "Get Mail">
|
||||
<!ENTITY toolbar.msgNewLabel "Write">
|
||||
<!ENTITY toolbar.msgReplyLabel "Reply">
|
||||
<!ENTITY toolbar.msgReplyAllLabel "Reply All">
|
||||
<!ENTITY toolbar.fwdInlineLabel "Forward">
|
||||
<!ENTITY toolbar.markAllReadLabel "Mark Rd">
|
||||
<!ENTITY toolbar.printLabel "Print">
|
||||
<!ENTITY toolbar.msgDeleteLabel "Delete">
|
||||
<!ENTITY toolbar.stopLabel "Stop">
|
||||
|
||||
<!ENTITY msgGetNewTooltip "Get new messages">
|
||||
<!ENTITY msgNewTooltip "Compose a new message">
|
||||
<!ENTITY msgReplyTooltip "Reply">
|
||||
<!ENTITY msgReplyAllTooltip "Reply to all recipients">
|
||||
<!ENTITY fwdQuotedTooltip "Forward">
|
||||
<!ENTITY fwdInlineTooltip "Forward">
|
||||
<!ENTITY fwdQuotedTooltip "Forward">
|
||||
<!ENTITY markAllReadTooltip "Mark all messages read">
|
||||
<!ENTITY printTooltip "Print this message">
|
||||
<!ENTITY msgDeleteTooltip "Delete this message">
|
||||
<!ENTITY stopTooltip "Stop the current action (ESC)">
|
|
@ -1,57 +0,0 @@
|
|||
#
|
||||
# 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 Edwin Woudt
|
||||
# <edwin@woudt.nl>. Portions created by Edwin Woudt are
|
||||
# Copyright (C) 1999 Edwin Woudt. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
msgGetNewLabel=Get Msg
|
||||
msgNewLabel=New Msg
|
||||
msgReplyLabel=Reply
|
||||
msgReplyAllLabel=Reply All
|
||||
fwdQuotedLabel=Fwd Q
|
||||
fwdInlineLabel=Fwd I
|
||||
fwdAttachmentLabel=Fwd A
|
||||
markAllReadLabel=Mark Rd
|
||||
printLabel=Print
|
||||
msgDeleteLabel=Delete
|
||||
stopLabel=Stop
|
||||
|
||||
msgGetNewIcon=getmsg
|
||||
msgNewIcon=newmsg
|
||||
msgReplyIcon=reply
|
||||
msgReplyAllIcon=replyall
|
||||
fwdQuotedIcon=forward
|
||||
fwdInlineIcon=forward
|
||||
fwdAttachmentIcon=forward
|
||||
markAllReadIcon=markallread
|
||||
printIcon=print
|
||||
msgDeleteIcon=delete
|
||||
stopIcon=stop
|
||||
|
||||
msgGetNewTooltip=Get new messages
|
||||
msgNewTooltip=Compose a new message
|
||||
msgReplyTooltip=Reply
|
||||
msgReplyAllTooltip=Reply to all recipients
|
||||
fwdQuotedTooltip=Forward
|
||||
fwdInlineTooltip=Forward
|
||||
fwdQuotedTooltip=Forward
|
||||
markAllReadTooltip=Mark all messages read
|
||||
printTooltip=Print this message
|
||||
msgDeleteTooltip=Delete this message
|
||||
stopTooltip=Stop the current action (ESC)
|
||||
|
|
@ -184,13 +184,13 @@ class UnifiedMessageFrame extends GeneralFrame {
|
|||
layoutPanels(layout);
|
||||
|
||||
XMLMenuBuilder builder = new XMLMenuBuilder(Util.MergeActions(actions, Util.MergeActions(fFolders.getActions(), Util.MergeActions(fThreads.getActions(), fMessage.getActions()))));
|
||||
fMenu = builder.buildFrom("ui/menus.xml", this);
|
||||
fMenu = builder.buildFrom("ui/grendel.xml", this);
|
||||
|
||||
getRootPane().setJMenuBar(fMenu);
|
||||
|
||||
GrendelToolBar masterToolBar = fFolders.getToolBar();
|
||||
GrendelToolBar folderToolBar = fThreads.getToolBar();
|
||||
GrendelToolBar messageToolBar = fMessage.getToolBar();
|
||||
JToolBar masterToolBar = fFolders.getToolBar();
|
||||
JToolBar folderToolBar = fThreads.getToolBar();
|
||||
JToolBar messageToolBar = fMessage.getToolBar();
|
||||
|
||||
|
||||
fToolBar = Util.MergeToolBars(masterToolBar,
|
||||
|
@ -200,7 +200,7 @@ class UnifiedMessageFrame extends GeneralFrame {
|
|||
fToolBarPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
fToolBarPanelConstraints.anchor = GridBagConstraints.WEST;
|
||||
fToolBarPanel.setComponent(fToolBar);
|
||||
fToolBar.add(fToolBar.makeNewSpring());
|
||||
fToolBar.add(new Spring());
|
||||
fToolBarPanelConstraints.weightx = 1.0;
|
||||
fToolBarPanelConstraints.fill = GridBagConstraints.NONE;
|
||||
fToolBarPanelConstraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
|
|
|
@ -46,7 +46,7 @@ import javax.swing.JComponent;
|
|||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JScrollPane;
|
||||
//import javax.swing.JToolBar;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import grendel.widgets.GrendelToolBar;
|
||||
|
@ -138,8 +138,8 @@ public class Util {
|
|||
return res;
|
||||
}
|
||||
|
||||
static public GrendelToolBar MergeToolBars(GrendelToolBar aBar1, GrendelToolBar aBar2) {
|
||||
GrendelToolBar res = new GrendelToolBar();
|
||||
static public JToolBar MergeToolBars(JToolBar aBar1, JToolBar aBar2) {
|
||||
JToolBar res = new JToolBar();
|
||||
|
||||
Component barArray1[] = aBar1.getComponents();
|
||||
Component barArray2[] = aBar2.getComponents();
|
||||
|
@ -151,6 +151,9 @@ public class Util {
|
|||
}
|
||||
|
||||
while (i < count1) {
|
||||
if (!(barArray1[i] instanceof JButton))
|
||||
continue;
|
||||
|
||||
JButton button1 = (JButton) barArray1[i];
|
||||
if (j < count2) {
|
||||
JButton button2 = (JButton) barArray2[j];
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
<!DOCTYPE window [
|
||||
<!ENTITY % menuLabelsDTD SYSTEM "MenuLabels.dtd" >
|
||||
%menuLabelsDTD;
|
||||
<!ENTITY % toolbarDTD SYSTEM "Toolbar.dtd" >
|
||||
%toolbarDTD;
|
||||
]>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
@ -144,4 +146,16 @@
|
|||
|
||||
</menubar>
|
||||
|
||||
<toolbar>
|
||||
<toolbarbutton label="&toolbar.msgGetNewLabel;" onclick="msgGetNew" tooltiptext="&msgGetNewTooltip;" image="widgets/toolbar/mozilla/getmsg.png"/>
|
||||
<toolbarbutton label="&toolbar.msgNewLabel;" onclick="msgNew" tooltiptext="&msgNewTooltip;" image="widgets/toolbar/mozilla/newmsg.png"/>
|
||||
<toolbarbutton label="&toolbar.msgReplyLabel;" onclick="msgReply" tooltiptext="&msgReplyTooltip;" image="widgets/toolbar/mozilla/reply.png"/>
|
||||
<toolbarbutton label="&toolbar.msgReplyAllLabel;" onclick="msgReplyAll" tooltiptext="&msgReplyAllTooltip;" image="widgets/toolbar/mozilla/replyall.png"/>
|
||||
<toolbarbutton label="&toolbar.fwdInlineLabel;" onclick="fwdInline" tooltiptext="&fwdInlineTooltip;" image="widgets/toolbar/mozilla/forward.png"/>
|
||||
<toolbarbutton label="&toolbar.markAllReadLabel;" onclick="markAllRead" tooltiptext="&markAllReadTooltip;" image="widgets/toolbar/mozilla/readall.png"/>
|
||||
<toolbarbutton label="&toolbar.msgDeleteLabel;" tooltiptext="&msgDeleteTooltip;" image="widgets/toolbar/mozilla/delete.png"/>
|
||||
<toolbarbutton label="&toolbar.printLabel;" tooltiptext="&printTooltip;" image="widgets/toolbar/mozilla/print.png"/>
|
||||
<toolbarbutton label="&toolbar.stopLabel;" tooltiptext="&stopTooltip;" image="widgets/toolbar/mozilla/stop.png"/>
|
||||
</toolbar>
|
||||
|
||||
</window>
|
|
@ -26,6 +26,7 @@ import java.awt.Dimension;
|
|||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Component;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
|
@ -44,8 +45,15 @@ public class GrendelToolBar extends JToolBar {
|
|||
public GrendelToolBar() {
|
||||
super();
|
||||
setFloatable(false);
|
||||
}
|
||||
|
||||
// setBackground(new java.awt.Color(238,238,238));
|
||||
public GrendelToolBar(JToolBar aToolbar) {
|
||||
this();
|
||||
|
||||
for (Component i : aToolbar.getComponents()) {
|
||||
if (i instanceof JButton)
|
||||
add(i);
|
||||
}
|
||||
}
|
||||
|
||||
public Spring makeNewSpring() {
|
||||
|
|
После Ширина: | Высота: | Размер: 30 KiB |
После Ширина: | Высота: | Размер: 30 KiB |
После Ширина: | Высота: | Размер: 32 KiB |
После Ширина: | Высота: | Размер: 30 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 30 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 29 KiB |
После Ширина: | Высота: | Размер: 29 KiB |
После Ширина: | Высота: | Размер: 30 KiB |
После Ширина: | Высота: | Размер: 31 KiB |