⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contacteditwindow.java

📁 发泄网! 发泄网! 发泄网! 发泄网! 发泄网! 发泄网! 发泄网! 发泄网!
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	/* CRMS, customer relationship management system	Copyright (C) 2003  Service To Youth Council	This program is free software; you can redistribute it and/or modify	it under the terms of the GNU General Public License as published by	the Free Software Foundation; either version 2 of the License, or	(at your option) any later version.	This program is distributed in the hope that it will be useful,	but WITHOUT ANY WARRANTY; without even the implied warranty of	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	GNU General Public License for more details.	You should have received a copy of the GNU General Public License	along with this program; if not, write to the Free Software	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA	For further information contact the SYC ICT department on GPL@syc.net.au	98 Kermode Street	North Adelaide	South Australia	SA 5006 	+61 (0)8 8367 0.05	*//* * CallAddPanel.java * * Created on 27 March 2003, 06:34 */package crms.applet.company;import javax.swing.*;import javax.swing.border.*;import java.awt.*;import org.w3c.dom.*;import crms.util.*;import crms.vo.*;import crms.module.*;import crms.applet.*;import crms.ui.*;import java.awt.event.*;import java.util.*;import mseries.Calendar.*;import mseries.ui.*;/** * * @author  dmurphy */public class ContactEditWindow extends CRMSWindow implements CallbackDestination {	public static final int CB_REFRESH = 0;	public static int PANEL_TYPE_EDIT = 0;	public static int PANEL_TYPE_ADD = 1;		/** Creates a new instance of CallAddPanel */		JPanel main = new JPanel();	JPanel wrapper = null;	JScrollPane scrollPane = null;		JTextField textFirstName = new JTextField();	JTextField textLastName = new JTextField();	JTextField textPosition = new JTextField();	//JTextField textTitle = new JTextField();	JComboBox comboTitle = new JComboBox(ContactType.TITLE_LIST);	JTextField textEmail = new JTextField();	JTextField textWWW = new JTextField();	// The Home fields	JTextField textHomePhone = new JTextField();	JTextField textHomeFax = new JTextField();	JTextField textHomeAddress = new JTextField();	JTextField textHomeSuburb = new JTextField();	JTextField textHomeCountry = new JTextField();	JComboBox comboHomeState = new JComboBox(StateCode.STATE_LIST);	DefaultComboBoxModel contactIdentifierModel = new DefaultComboBoxModel(ContactIdentifiresTypeCode.getTypes(ContactIdentifiresTypeCode.class).toArray());	JComboBox contactIdentifier = new JComboBox(contactIdentifierModel);		JTextField textCompany = new JTextField();	JButton companySearchButton = new JButton("Search");	JButton btnViewCompany = new JButton("View");		JTextField textHomePostcode = new JTextField();		// The Work fields	CompanyLocationComponent locationComponent = new CompanyLocationComponent(true);		JTextField textWorkPhone = new JTextField();	JTextField textWorkOtherPhone = new JTextField();	JTextField textWorkFax = new JTextField();	JTextField textWorkMobile = new JTextField();		JTextField textWorkAddress = new JTextField();	JTextField textWorkSuburb = new JTextField();	JTextField textWorkCountry = new JTextField();	JComboBox comboWorkState = new JComboBox(StateCode.STATE_LIST);		JTextField textWorkPostcode = new JTextField();	DefaultComboBoxModel genderModel = new DefaultComboBoxModel(GenderCode.getTypes(GenderCode.class).toArray());	JComboBox comboGender = new JComboBox(genderModel);		JButton buttonAdd = new JButton();	JButton buttonReset = new JButton("Reset");	JButton buttonCancel = new JButton("Close");	JButton buttonEmail = new JButton("Email");	JButton buttonDelete = new JButton("Delete");		JButton buttonMore = new JButton("More >>");		JButton buttonViewNotes = null;	JButton buttonAttach = null;	JButton buttonAddMeeting = null;	JButton buttonPermissions = null;		UtilityToolbar utilityToolbar = null;//new UtilityToolbar(EntityType.CONTACT, contactID );//	 JButton buttonViewNotes = new JButton("Notes");//	 JButton buttonAttach = new JButton("Files");//	 JButton buttonAddMeeting = new JButton("Meetings");		//	 JTextArea textNote = new JTextArea();//	 JScrollPane noteScrollPane = new JScrollPane(textNote);			//MDateEntryField calendarField = new MDateEntryField();	JTextField textBirthDate = new JTextField();	int panelType = PANEL_TYPE_ADD;	Contact contact = null;	Company company = null;	Location selected_location = null;	Permission entityPermission = null;	boolean showFullDetails = false;	CallbackDestination callback = null;		public ContactEditWindow() {		init();	}	public void display() {		// detect whether we are editing or not		setPanelType(contact == null ? PANEL_TYPE_ADD : PANEL_TYPE_EDIT);		resetFields();		securePanel();		this.setVisible(true);	}	public void setCallback(CallbackDestination new_callback) {		callback = new_callback;	}	public void callback(Object source, int mode, Object data) {		System.out.println("callback recieved: " + source + " mode " + " data " + data);		if (source instanceof CompanySearchWindow) {			setCompany((Company)data);		} else if (source instanceof CompanyLocationComponent) {			selected_location = (Location)data;		}	}	public void setContact(Contact contact) {		panelType = PANEL_TYPE_EDIT;		// Load the company data identified by companyID		ServerCommand command = new ServerCommand(ContactModule.CONTACT_GET);		command.setParameter(ContactModule.PARAM_CONTACT_ID, String.valueOf(contact.getContactID()));						Server server = ServerFactory.getInstance().getServer();		ServerResponse result = server.sendCommand(command);		entityPermission = (Permission) result.getPart("permission");		// update contact to have full details		this.contact = (Contact) result.getPart("contact");		// Only update the company value for this tmp_contact if it hasn't 		// already been set (through the constructor from another form)		//if (company == null && this.contact.getCompanyID() > 0) {		// *** this should ALWAYS be set ***		setCompany((Company) result.getPart("company"));		//}		locationComponent.setSelected(contact.getLocationID());				utilityToolbar = new UtilityToolbar(EntityType.CONTACT, contact.getContactID());		if (contact.getContactID() > -1) {				wrapper.add(utilityToolbar,BorderLayout.NORTH);		}		utilityToolbar.setEntityPermission(entityPermission);		utilityToolbar.setName(contact.getFirstName() + " " + contact.getLastName());		utilityToolbar.setLabel("Primary Staff Contact: " + contact.getOwner());		resetFields();	}	public void setCompany(Company company) {		btnViewCompany.setEnabled(company != null);		if (company == null) {			textCompany.setText("");			return;		}		ServerCommand command = new ServerCommand(CompanyModule.COMPANY_GET);		command.setParameter(CompanyModule.PARAM_COMPANY_ID, String.valueOf(company.getCompanyID()));		Server server = ServerFactory.getInstance().getServer();		ServerResponse result = server.sendCommand(command);		this.company = (Company)result.getPart("company");		textCompany.setText(company.getCompanyName());		locationComponent.setLocations(this.company.getLocations());	}	public void setCompany(String txtCompany) {		textCompany.setText(txtCompany);	}	public void setPanelType(int panelType) {		this.panelType = panelType;		if (panelType == PANEL_TYPE_ADD) {				buttonAdd.setText("Add");				setTitle("Contacts - Add New Contact");		} else {				buttonAdd.setText("Save");				setTitle("Contacts - Edit " + (contact != null ? contact.getFirstName() + " " + contact.getLastName() : "Unknown") );		}	}		public void init() {		final CallbackDestination thisobj = this;		Container pane = this.getContentPane();		pane.setLayout(new BorderLayout());		pane.setBackground(Color.WHITE);		setSize(650,600);		center();						GridBagLayout gbl = new GridBagLayout();		main.setLayout(gbl);		main.setBackground(Color.WHITE);		main.setBorder(new EmptyBorder(0, 20, 0, 20));				buttonAdd.addActionListener( new ActionListener() {				public void actionPerformed(ActionEvent ev) {					if (validateForm()) {						main.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));						if (updateContact()) {							// TODO: go to view screen?							if (callback != null) callback.callback(thisobj, CB_REFRESH, null);							dispose();						}						main.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));					}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -