зеркало из https://github.com/mozilla/pjs.git
*** empty log message ***
This commit is contained in:
Родитель
a49fd4408a
Коммит
9cf43463af
|
@ -20,6 +20,7 @@
|
|||
package grendel.addressbook;
|
||||
|
||||
import grendel.addressbook.addresscard.*;
|
||||
import grendel.ui.UIAction;
|
||||
import grendel.widgets.CollapsiblePanel;
|
||||
import grendel.widgets.GrendelToolBar;
|
||||
|
||||
|
@ -31,7 +32,6 @@ import java.util.Vector;
|
|||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.table.*;
|
||||
|
@ -122,13 +122,17 @@ public class AddressBook extends JFrame {
|
|||
|
||||
setBackground(Color.lightGray);
|
||||
//setBorderStyle(JPanel.ETCHED);
|
||||
setLayout(new BorderLayout());
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
|
||||
// addWindowListener(new FrameHider());
|
||||
|
||||
//create menubar (top)
|
||||
//merge both the editors commands with this applications commands.
|
||||
// mMenubar = NsMenuManager.createMenuBar("grendel.addressbook.Menus", "grendel.addressbook.MenuLabels", "mainMenubar", defaultActions);
|
||||
// FIXME - need to build the menu bar
|
||||
// (Jeff)
|
||||
|
||||
mMenubar = new JMenuBar();
|
||||
|
||||
//collapsble panels holds toolbar.
|
||||
CollapsiblePanel collapsePanel = new CollapsiblePanel(true);
|
||||
|
@ -147,7 +151,7 @@ public class AddressBook extends JFrame {
|
|||
panel1.setLayout(new BorderLayout());
|
||||
panel1.add(collapsePanel, BorderLayout.NORTH);
|
||||
|
||||
//hack togetther the data sources.
|
||||
//hack together the data sources.
|
||||
mDataSourceList = new DataSourceList ();
|
||||
mDataSourceList.addEntry (new DataSource ("Four11 Directory", "ldap.four11.com"));
|
||||
mDataSourceList.addEntry (new DataSource ("InfoSpace Directory", "ldap.infospace.com"));
|
||||
|
@ -157,8 +161,8 @@ public class AddressBook extends JFrame {
|
|||
AddressPanel addressPanel = new AddressPanel (mDataSourceList);
|
||||
panel1.add(addressPanel, BorderLayout.CENTER);
|
||||
|
||||
add(mMenubar, BorderLayout.NORTH);
|
||||
add(panel1, BorderLayout.CENTER);
|
||||
getContentPane().add(mMenubar, BorderLayout.NORTH);
|
||||
getContentPane().add(panel1, BorderLayout.CENTER);
|
||||
|
||||
setSize (600, 400);
|
||||
}
|
||||
|
@ -233,7 +237,7 @@ public class AddressBook extends JFrame {
|
|||
public static final String myAddressBookCardTag ="myAddressBookCard";
|
||||
|
||||
// --- action implementations -----------------------------------
|
||||
private Action[] defaultActions = {
|
||||
private UIAction[] defaultActions = {
|
||||
//"File" actions
|
||||
new NewCard(),
|
||||
// new NewList(),
|
||||
|
@ -277,7 +281,7 @@ public class AddressBook extends JFrame {
|
|||
//-----------------------
|
||||
/**
|
||||
*/
|
||||
class NewCard extends AbstractAction {
|
||||
class NewCard extends UIAction {
|
||||
NewCard() {
|
||||
super(newCardTag);
|
||||
setEnabled(true);
|
||||
|
@ -292,7 +296,7 @@ public class AddressBook extends JFrame {
|
|||
}
|
||||
}
|
||||
|
||||
class SaveAs extends AbstractAction {
|
||||
class SaveAs extends UIAction {
|
||||
SaveAs() {
|
||||
super(saveAsTag);
|
||||
setEnabled(true);
|
||||
|
@ -306,7 +310,7 @@ public class AddressBook extends JFrame {
|
|||
}
|
||||
}
|
||||
|
||||
class CloseWindow extends AbstractAction {
|
||||
class CloseWindow extends UIAction {
|
||||
CloseWindow() {
|
||||
super(closeWindowTag);
|
||||
setEnabled(true);
|
||||
|
@ -325,7 +329,7 @@ public class AddressBook extends JFrame {
|
|||
//-----------------------
|
||||
//"Edit" actions
|
||||
//-----------------------
|
||||
class Undo extends AbstractAction {
|
||||
class Undo extends UIAction {
|
||||
Undo() {
|
||||
super(undoTag);
|
||||
setEnabled(true);
|
||||
|
@ -336,7 +340,7 @@ public class AddressBook extends JFrame {
|
|||
//-----------------------
|
||||
//"View" actions
|
||||
//-----------------------
|
||||
class HideMessageToolbar extends AbstractAction {
|
||||
class HideMessageToolbar extends UIAction {
|
||||
HideMessageToolbar() {
|
||||
super(hideMessageToolbarTag);
|
||||
setEnabled(true);
|
||||
|
@ -347,7 +351,7 @@ public class AddressBook extends JFrame {
|
|||
|
||||
//-----------------------
|
||||
//-----------------------
|
||||
class Search extends AbstractAction {
|
||||
class Search extends UIAction {
|
||||
Search() {
|
||||
super(newListTag);
|
||||
setEnabled(true);
|
||||
|
@ -400,7 +404,7 @@ public class AddressBook extends JFrame {
|
|||
* @param aToolTip The buttons tool tip. like "Save the current file".
|
||||
* @see createToolbar
|
||||
*/
|
||||
public void addToolbarButton(GrendelToolBar aToolBar, AbstractAction aActionListener, String aImageName, String aToolTip) {
|
||||
public void addToolbarButton(GrendelToolBar aToolBar, UIAction aActionListener, String aImageName, String aToolTip) {
|
||||
JButton b = new JButton();
|
||||
|
||||
b.setHorizontalTextPosition(JButton.CENTER);
|
||||
|
@ -408,8 +412,12 @@ public class AddressBook extends JFrame {
|
|||
b.setToolTipText(aToolTip);
|
||||
|
||||
// URL iconUrl = getClass().getResource("images/" + gifName + ".gif");
|
||||
b.setIcon(new ImageIcon(getClass().getResource(aImageName)));
|
||||
// b.setIcon(new ImageIcon(getClass().getResource(aImageName)));
|
||||
|
||||
// FIXME - need the toolbar graphics for this sub-app
|
||||
// (Jeff)
|
||||
|
||||
b.setIcon(new ImageIcon(getClass().getResource("markAllRead.gif")));
|
||||
// iconUrl = getClass().getResource("images/" + gifName + "-disabled.gif");
|
||||
// button.setDisabledIcon(ImageIcon.createImageIcon(iconUrl));
|
||||
|
||||
|
@ -670,7 +678,7 @@ System.out.println ("Done.");
|
|||
mTable.setShowGrid(false);
|
||||
|
||||
// Put the table and header into a scrollPane
|
||||
JScrollPane scrollpane = JTable.createScrollPaneForTable(mTable);
|
||||
JScrollPane scrollpane = new JScrollPane(mTable);
|
||||
// JTableHeader tableHeader = mTable.getTableHeader();
|
||||
|
||||
// create and add the column heading to the scrollpane's
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
This is Grendel -- a Java mail/news client.
|
||||
|
||||
The grendel.addressbook package talks to LDAP, and provides a nice API
|
||||
to all things dealing with addressbook.
|
||||
|
||||
See http://www.mozilla.org/projects/grendel/ for more info.
|
||||
#
|
||||
# The contents of this directory are subject to the Mozilla Public
|
||||
# License Version 1.0 (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.
|
||||
|
|
|
@ -88,12 +88,21 @@ public class ACS_Personal implements ICardSource, IQuerySet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* No-op implementations for now (just to get this building properly)
|
||||
* (Jeff)
|
||||
*/
|
||||
|
||||
public AC_IDSet opEqual(IAttribute anAttribute) { return null; }
|
||||
|
||||
public AC_IDSet opNotEqual(IAttribute anAttribute) { return null; }
|
||||
|
||||
/**
|
||||
* retrieveing address cards
|
||||
* retrieving address cards
|
||||
*/
|
||||
public ICardSet getCardSet (ITerm aQueryTerm, String[] anAttributesArray) {
|
||||
//get the card ID's that satidsfy the query.
|
||||
ACIDSet CardIDSet = aQueryTerm.evaluate_ACSP (this);
|
||||
//get the card ID's that satisfy the query.
|
||||
AC_IDSet CardIDSet = aQueryTerm.evaluate_ACSP (this);
|
||||
|
||||
//create the address card set that'll be returned.
|
||||
AddressCardSet retCardSet = new AddressCardSet ();
|
||||
|
@ -133,11 +142,12 @@ public class ACS_Personal implements ICardSource, IQuerySet {
|
|||
aCard.setID (thisCardID);
|
||||
|
||||
//get the set of attributes and enumerate thruough them.
|
||||
AddressCardAttributeSet attrSet = aCard.getAttributeSet();
|
||||
AddressCardAttributeSet attrSet =
|
||||
(AddressCardAttributeSet)aCard.getAttributeSet();
|
||||
|
||||
for (Enumeration enum = attrSet.elements (); enum.hasMoreElements(); ) {
|
||||
//get the next attribute
|
||||
AddressCardAttribute attr = (AddressCardAttribute) enum.netxElement ();
|
||||
AddressCardAttribute attr = (AddressCardAttribute) enum.nextElement ();
|
||||
|
||||
//write the attribute to the DB
|
||||
try {
|
||||
|
@ -151,10 +161,23 @@ public class ACS_Personal implements ICardSource, IQuerySet {
|
|||
public void add (AddressCardSet aCardSet, boolean OverWrite) {
|
||||
for (Enumeration enum = aCardSet.getCardEnumeration (); enum.hasMoreElements() ;) {
|
||||
AddressCard card = (AddressCard) enum.nextElement();
|
||||
addCard (card, OverWrite);
|
||||
add (card, OverWrite);
|
||||
}
|
||||
}
|
||||
|
||||
/** No-op implementation of the add(ICard) method from ICardSource
|
||||
*/
|
||||
public void add (ICard card) { }
|
||||
|
||||
/** No-op implementation of update(ICard) from ICardSource
|
||||
*/
|
||||
public void update(ICard card) { }
|
||||
|
||||
/** No-op implementation of delete(ICard) from ICardSource
|
||||
*/
|
||||
public void delete(ICard card) { }
|
||||
|
||||
|
||||
//*******************************
|
||||
//**** Operational functions ****
|
||||
//*******************************
|
||||
|
@ -162,14 +185,17 @@ public class ACS_Personal implements ICardSource, IQuerySet {
|
|||
/** Search the database for all cards that match this value
|
||||
* and return a set Adddress Card ID's (ACID's).
|
||||
*/
|
||||
public ACIDSet opEqual (AddressCardAttribute ACA) {
|
||||
ACIDSet retIDSet = new ACIDSet();
|
||||
public AC_IDSet opEqual (AC_Attribute ACA) {
|
||||
AC_IDSet retIDSet = new AC_IDSet();
|
||||
|
||||
if (null != ACA) {
|
||||
//the RDFish DB returns an enumeration of a matching card ID's
|
||||
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());
|
||||
}
|
||||
} catch (IOException exc) {
|
||||
exc.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return retIDSet;
|
||||
|
@ -178,8 +204,8 @@ public class ACS_Personal implements ICardSource, IQuerySet {
|
|||
/** Search the database for all cards that DO NOT match this value
|
||||
* and return a set Adddress Card ID's (ACID's).
|
||||
*/
|
||||
public ACIDSet opNotEqual (AddressCardAttribute ACA) {
|
||||
ACIDSet retIDSet = new ACIDSet();
|
||||
public AC_IDSet opNotEqual (AC_Attribute ACA) {
|
||||
AC_IDSet retIDSet = new AC_IDSet();
|
||||
|
||||
return retIDSet;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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.
|
||||
*
|
||||
* Created: Jeff Galyan <talisman@anamorphic.com>, 16 Jan 1999
|
||||
*/
|
||||
|
||||
package grendel.addressbook.addresscard;
|
||||
|
||||
/** Defines an addresscard for the addressbook.
|
||||
*/
|
||||
|
||||
public class AddressCard implements ICard {
|
||||
|
||||
private String ID;
|
||||
private ICardSource mySource;
|
||||
private AddressCardAttributeSet myAttrSet;
|
||||
|
||||
public AddressCard(ICardSource source, IAttributeSet attrSet) {
|
||||
mySource = source;
|
||||
myAttrSet = (AddressCardAttributeSet)attrSet;
|
||||
}
|
||||
|
||||
public void setID(String thisCardID) {
|
||||
ID = thisCardID;
|
||||
}
|
||||
|
||||
//******************************
|
||||
// Methods defined for ICard
|
||||
//******************************
|
||||
public ICardSource getParent() {
|
||||
return mySource;
|
||||
}
|
||||
|
||||
public void addAttribute(IAttribute anAttribute) {
|
||||
myAttrSet.add(anAttribute);
|
||||
}
|
||||
|
||||
public IAttribute getAttribute(String anAttributeName) {
|
||||
return myAttrSet.getAttribute(anAttributeName);
|
||||
}
|
||||
|
||||
public IAttributeSet getAttributeSet() {
|
||||
return myAttrSet;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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.
|
||||
*
|
||||
* Created: Jeff Galyan <talisman@anamorphic.com>, 16 Jan 1999
|
||||
*/
|
||||
|
||||
package grendel.addressbook.addresscard;
|
||||
|
||||
/** Defines an attribute for an addresscard.
|
||||
*/
|
||||
|
||||
public class AddressCardAttribute implements IAttribute {
|
||||
|
||||
private String name, value;
|
||||
private boolean newness = true;
|
||||
private boolean deleted = false;
|
||||
private boolean modified = false;
|
||||
|
||||
public AddressCardAttribute(String attrName, String attrValue) {
|
||||
name = attrName;
|
||||
value = attrValue;
|
||||
}
|
||||
|
||||
|
||||
//**********************
|
||||
// Methods defined for
|
||||
// IAttribute
|
||||
//**********************
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean isNew() {
|
||||
return newness;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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.
|
||||
*
|
||||
* Created: Jeff Galyan <talisman@anamorphic.com>, 16 Jan 1999
|
||||
*/
|
||||
|
||||
package grendel.addressbook.addresscard;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
/** Defines an attribute set.
|
||||
*/
|
||||
|
||||
public class AddressCardAttributeSet implements IAttributeSet {
|
||||
|
||||
private Vector attrVec;
|
||||
|
||||
public AddressCardAttributeSet() {
|
||||
attrVec = new Vector();
|
||||
}
|
||||
|
||||
public void add(IAttribute anAttribute) {
|
||||
attrVec.addElement(anAttribute);
|
||||
}
|
||||
|
||||
public Enumeration elements() {
|
||||
return getEnumeration();
|
||||
}
|
||||
|
||||
//***********************************
|
||||
// Methods defined for IAttributeSet
|
||||
//***********************************
|
||||
public Enumeration getEnumeration() {
|
||||
return attrVec.elements();
|
||||
}
|
||||
|
||||
public IAttribute getAttribute(String anAttributeName) {
|
||||
IAttribute anAttribute = null;
|
||||
for (int i = 0; i < attrVec.size(); i++) {
|
||||
if (((AddressCardAttribute)attrVec.elementAt(i)).getName() == anAttributeName) {
|
||||
anAttribute = (IAttribute)attrVec.elementAt(i);
|
||||
}
|
||||
}
|
||||
return anAttribute;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return attrVec.size();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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.
|
||||
*
|
||||
* Created: Jeff Galyan <talisman@anamorphic.com>, 16 Jan 1999
|
||||
*/
|
||||
|
||||
package grendel.addressbook.addresscard;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
/** Defines an addresscard set.
|
||||
*/
|
||||
|
||||
public class AddressCardSet implements ICardSet {
|
||||
|
||||
private Vector cards;
|
||||
|
||||
public AddressCardSet() {
|
||||
cards = new Vector();
|
||||
}
|
||||
|
||||
public Enumeration getCardEnumeration() {
|
||||
return getEnumeration();
|
||||
}
|
||||
|
||||
//*********************************
|
||||
// Methods defined for ICardSet
|
||||
//*********************************
|
||||
public void add(ICard aCard) {
|
||||
cards.addElement(aCard);
|
||||
}
|
||||
|
||||
public void remove(ICard aCard) {
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (cards.elementAt(i).equals(aCard)) {
|
||||
cards.removeElementAt(i);
|
||||
}
|
||||
}
|
||||
cards.trimToSize();
|
||||
}
|
||||
|
||||
public void sort(String[] anAttributeArray) {
|
||||
Enumeration enum = getEnumeration();
|
||||
while (enum.hasMoreElements()) {
|
||||
}
|
||||
}
|
||||
|
||||
public Enumeration getEnumeration() {
|
||||
return cards.elements();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -28,4 +28,5 @@ import grendel.storage.intertwingle.*;
|
|||
public interface ITerm {
|
||||
public String getExpression(IQueryString iqs);
|
||||
public AC_IDSet getSet (IQuerySet iqs);
|
||||
public AC_IDSet evaluate_ACSP (IQuerySet iqs);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче