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

📄 companywindow.java

📁 CRMS客户关系管理系统(JAVA版),这是一个客户关系管理系统。
💻 JAVA
字号:
	/* 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 0755	*//* * CRMSApplet.java * * Created on 27 March 2003, 05:25 */package crms.applet.company;import javax.swing.*;import java.applet.*;import java.awt.*;import java.awt.event.*;import java.util.*;import java.net.*;import crms.util.*;import crms.applet.*;import crms.ui.*;import crms.vo.*;import crms.applet.company.*;import crms.module.CompanyModuleWrapper;import crms.module.StaffModule;/** Company window master * * @author  tnichols */public class CompanyWindow extends UniqueWindow implements CallbackDestination {		JPanel bodyPanel = new JPanel();	CompanyDetailsComponent details = null;	CompanyLocationComponent location = null;	Company company = null;	StaffMember user = null;	JButton delButton = new JButton("Delete");	public String getUniqueID(Object data) {		String id = getClass().getName() + ":";		if (data instanceof Company) {			Company c = (Company)data;			id += "Company:" + c.getCompanyID();		}		return id;	}	public void setData(Object data) {		setCompany((Company)data);	}	public void createWindow(String title) {		final CallbackDestination thisobj = this;		// set window options		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);		if (title == null) {			setTitle("Companies");		} else {			setTitle("Companies - " + title);		}		setBackground(Color.WHITE);		// configure window contents		Container pane = getContentPane();			pane.setLayout(new BorderLayout());		pane.setBackground(Color.WHITE);		// create details panel		details = new CompanyDetailsComponent(company);			details.init();		details.setVisible(true);		// create my buttons -- main control bar		CRMSButtonBar control = new CRMSButtonBar();		JButton closeButton = new JButton("Close");		closeButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				dispose();			}		} );		// add buttons to bar		control.addButton(CRMSButtonBar.RIGHT, closeButton);		// create buttons -- company control bar		CRMSButtonBar buttons = new CRMSButtonBar();		buttons.setBackground(new Color(0xA7, 0xFF, 0xC3));		delButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				int result = JOptionPane.showConfirmDialog((Component)thisobj, "Are you sure you wish to delete this company?", "Company Window", JOptionPane.YES_NO_OPTION);				if (result == JOptionPane.YES_OPTION ) {					if (CompanyModuleWrapper.deleteCompany(company.getCompanyID())) {						dispose();					}				}			}		} );		JButton editButton = new JButton("Edit Details");		editButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				//CompanyEditWindow window = new CompanyEditWindow(CompanyEditWindow.PANEL_TYPE_EDIT, company);				CompanyEditWindow window = (CompanyEditWindow)UniqueWindowFactory.getInstance().getUniqueWindow(new CompanyEditWindow(), company);				window.setCallback(thisobj);				window.display();			}		} );		JButton contactsButton = new JButton("Contacts");		contactsButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				ContactSearchWindow window = new ContactSearchWindow();				window.setCompany(company);				window.searchContacts();				window.display();			}		} );		JButton staffButton = new JButton("Staff");		staffButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				StaffListWindow window = new StaffListWindow();				Server server = ServerFactory.getInstance().getServer();				ServerCommand command = new ServerCommand(StaffModule.STAFF_LIST_COMPANY);				command.setParameter(StaffModule.PARAM_STAFF_COMPANY, new Integer(company.getCompanyID()));				ServerResponse sr = server.sendCommand(command);				window.setStaff((java.util.List)sr.getPart("staff"));				window.display();			}		} );		//JButton callsButton = new JButton("Messages");		JButton notesButton = new JButton("Notes");		notesButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				NotesViewWindow window = new NotesViewWindow();				window.setNotes(EntityType.COMPANY, company.getCompanyID(), false);				window.display();			}		} );		JButton meetingsButton = new JButton("Meetings");		meetingsButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				MeetingViewWindow window = new MeetingViewWindow();				window.setReference(ContactType.ORGANISATION, company.getCompanyID(), false);				window.display();			}		} );		JButton attachButton = new JButton("Attachments");		attachButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				FileAttachViewWindow window = new FileAttachViewWindow();				window.setReference(EntityType.COMPANY, company.getCompanyID(), false);				window.display();			}		} );		// add buttons to bar		//buttons.addButton(CRMSButtonBar.LEFT, callsButton);		buttons.addButton(CRMSButtonBar.LEFT, attachButton);		buttons.addButton(CRMSButtonBar.LEFT, meetingsButton);		buttons.addButton(CRMSButtonBar.LEFT, notesButton);		buttons.addButton(CRMSButtonBar.LEFT, contactsButton);		buttons.addButton(CRMSButtonBar.LEFT, staffButton);		buttons.addButton(CRMSButtonBar.RIGHT, delButton);		buttons.addButton(CRMSButtonBar.RIGHT, editButton);		// create panel for the non-resizing items in a "flow"		JPanel top = new JPanel();		top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS));		top.add(details);		top.add(buttons);		// create the main panel		location = new CompanyLocationComponent(true);		location.init();		location.setLocations(company.getLocations());		pane.add(top, BorderLayout.NORTH);		pane.add(location, BorderLayout.CENTER);		pane.add(control, BorderLayout.SOUTH);		// handle size / location		setSize(780,500);		center();	}	public void setUser(StaffMember new_user) {		user = new_user;		if (user.getPower() < 3) {			delButton.setVisible(false);		}	}	public void setCompany(Company company) {		String title = null;		if (company != null) {			title = company.getCompanyName();		} else {			title = "Untitled Company";		}		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));		if (company != null) {			this.company = CompanyModuleWrapper.retrieveCompany(company.getCompanyID());		}		setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));		createWindow(title);	}	// interface functions	public void display() {		this.setVisible(true);	}	public void callback(Object source, int mode, Object data) {		if (source instanceof CompanyEditWindow) {			if (mode == CompanyEditWindow.COMPANY_SAVED) {				System.out.println("callback raised, setting data"+ data);				this.company = (Company)data;				details.setCompany(this.company);				location.setLocations(company.getLocations());			}		}	}	//Main method	public static void main(String[] args) {				CompanyWindow window = new CompanyWindow();		window.display();			}	}

⌨️ 快捷键说明

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