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

📄 remindereditpanel.java

📁 发泄网! 发泄网! 发泄网! 发泄网! 发泄网! 发泄网! 发泄网! 发泄网!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	/* 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	*//* * ReminderAddPanel.java * * Created on 31 March 2003, 00:15 */package crms.applet;import javax.swing.*;import javax.swing.border.*;import java.util.*;import java.text.*;import java.awt.*;import crms.util.*;import crms.module.ReminderModule;import crms.module.StaffModule;import crms.vo.*;import crms.ui.*;//import org.w3c.dom.*;import java.awt.event.*;import mseries.Calendar.*;import mseries.ui.*;/** * * @author  dmurphy */public class ReminderEditPanel extends CRMSPanel implements CallbackDestination {	public static final int CLOSE_WINDOW = 0;	public static final int CLOSE_WINDOW_DELETE = 1;	public static final int CB_REFRESH = 2;	CallbackDestination destination = null;		JPanel titlePanel = new JPanel();	JPanel bodyPanel = new JPanel();		JLabel titleLabel = new JLabel();	AutoTextField textFor = new AutoTextField(PanelManager.getInstance().getUIDList(), AutoTextField.DEFAULT_MIN_COMPARE_LENGTH);	private Object priorityStore = null;		DefaultComboBoxModel priorityModel = new DefaultComboBoxModel();	JComboBox comboPriority = new JComboBox(priorityModel);		MDateEntryField dateField = new MDateEntryField();	MDateSpinner timeField = new MDateSpinner();		//JTextField textContact = new JTextField();	JTextArea textNote = new JTextArea();	JTextField textCompany = new JTextField();		JLabel labelCreator = new JLabel();		JButton buttonForSearch = new JButton("Staff Search");	//JButton buttonContactSearch = new JButton("Search");		JCheckBox checkEmail = new JCheckBox("Send Email");	//JTextField textEmail = new JTextField();		JCheckBox checkSMS = new JCheckBox("Send SMS");	//JTextField textSMS = new JTextField();		/*JCheckBox checkApprove = new JCheckBox("Approve");	JLabel labelApprove = new JLabel("Pending Approval");*/		JButton buttonCancel = new JButton();	JButton buttonReset = new JButton();	JButton buttonAdd = new JButton();	JButton buttonDelete = new JButton();	JButton buttonAttachment = new JButton("Attachments");		JScrollPane noteScrollPane = new JScrollPane(textNote);			static SimpleDateFormat df = new SimpleDateFormat("d MMMM, yyyy h:mm a");		int reminderID = -1;	StaffMember reminderFor = null;		//Contact reminderContact = null;		//Permission entityPermission = null;		/** Creates a new instance of ReminderAddPanel */	public ReminderEditPanel() {	}		public ReminderEditPanel(int id) {		this.reminderID = id;	}	public void setDestination(CallbackDestination new_dest) {		destination = new_dest;	}	public void setReminderID(int id) {		reminderID = id;	}		public void init() {		final Object thisobj = this;				setLayout(new BorderLayout());/*			if (reminderID >= 0) {				titleLabel.setText("Edit Reminder");		} else {			titleLabel.setText("Add Reminder");		}		titleLabel.setBackground(Color.WHITE);		titleLabel.setFont(new java.awt.Font("Serif", 1, 18));				titlePanel.setBackground(Color.WHITE);		titlePanel.add(titleLabel);				add(titlePanel, BorderLayout.NORTH);*/				GridBagLayout gbl = new GridBagLayout();		bodyPanel.setLayout(gbl);		bodyPanel.setBackground(Color.WHITE);		bodyPanel.setBorder(new EmptyBorder(0,20,0,20));				MDefaultPullDownConstraints c = new MDefaultPullDownConstraints();		c.firstDay = Calendar.MONDAY;		dateField.setConstraints(c);				MSimpleDateFormat dateFormat = new MSimpleDateFormat("d MMMM, yyyy");		dateField.setDateFormatter(dateFormat);				timeField.setFormatter(new MSimpleDateFormat("h:mm a"));				/*checkApprove.setBackground(Color.WHITE);*/			for (int i=1; i <= 10; i++ ) {			String message = null;			switch(i) {				case 1:					message = "Lowest";					break;				case 10:					message = "Highest";					break;				case 5:					message = "Moderate";					break;				default:					message = null;					break;			}			// Note, we add the space after the number to discern between "1 " and "10 "			String priority = "" + i + " ";			if (message != null) {				priority += "(" + message +")";			}			if (i==5) {				priorityModel.setSelectedItem(priority);			}			priorityModel.addElement(priority);		}		if (priorityStore != null) priorityModel.setSelectedItem(priorityStore);						buttonCancel.setText("Close");		buttonCancel.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				if (destination != null) destination.callback(thisobj, CLOSE_WINDOW, null);				else PanelManager.getInstance().activatePanel(new ReminderViewPanel());			}		});		buttonReset.setText("Reset");		buttonReset.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));				refreshData();				setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));			}		});				buttonDelete.setText("Delete");		buttonDelete.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));				deleteReminder();				setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));			}		});						if (reminderID == -1) {			buttonAdd.setText("Add");			buttonDelete.setVisible(false);		} else {			buttonAdd.setText("Save");		}				buttonAdd.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				if (validateForm()) {					setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));					Reminder reminder = addReminder();					setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));					if (destination != null) destination.callback(thisobj, CLOSE_WINDOW, reminder);				}			}		});		buttonAttachment.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent ev) {				if (reminderID < 0) {					if (!validateForm()) {						return;					}					// setup the reminder and stuff					Reminder reminder = addReminder();					reminderID = reminder.getReminderID();					refreshData();					if (destination != null) destination.callback(thisobj, CB_REFRESH, reminder);					buttonAdd.setText("Save");					buttonDelete.setVisible(true);				}				FileAttachViewWindow window = new FileAttachViewWindow();				window.setReference(EntityType.REMINDER, reminderID, false);				window.display();							}		});					textFor.addFocusListener( new FocusAdapter() {			public void focusLost(FocusEvent ev) {				// check the current entry is an auto completed, get the details and continue				if (textFor.isAutomatic()) {					Server server = ServerFactory.getInstance().getServer();					ServerCommand command = new ServerCommand(StaffModule.STAFF_SEARCH_SUBMIT);					command.setParameter(StaffModule.PARAM_STAFF_UID, textFor.getText());					ServerResponse sr = server.sendCommand(command);					ArrayList staff = (ArrayList) sr.getPart("staff");					if (staff != null && staff.size() == 1) {						setStaffMemberFound((StaffMember)staff.get(0));						return;					}				}			}		});		buttonForSearch.addActionListener(new ActionListener() {						public void actionPerformed(ActionEvent ev) {				activateStaffSearch();			}		});								/*buttonContactSearch.addActionListener(new ActionListener() {			  public void actionPerformed(ActionEvent ev) {			activateContactSearch();				  }		});*/				/*checkEmail.addActionListener(new ActionListener() {			  public void actionPerformed(ActionEvent ev) {				if (checkEmail.isSelected()) {					// set a default address for the email address					if (reminderFor != null && textEmail.getText().length() == 0) {						// TODO: search LDAP and get the mail: attribute!						//textEmail.setText(reminderFor.getUID() + "@syc.net.au");					}					textEmail.setText(reminderFor.getEmail());					textEmail.setEnabled(true);				} else {					textEmail.setEnabled(false);   				}			  }		});		checkSMS.addActionListener(new ActionListener() {			  public void actionPerformed(ActionEvent ev) {				if (checkSMS.isSelected()) {					textSMS.setEnabled(true);					textSMS.setText(reminderFor.getMobile());				} else {					textSMS.setEnabled(false);   				}			  }		});*/				checkEmail.setBackground(Color.WHITE);		checkSMS.setBackground(Color.WHITE);		//if (!checkEmail.isSelected()) textEmail.setEnabled(false);		//if (!checkSMS.isSelected()) textSMS.setEnabled(false);		textNote.setLineWrap(true);				Insets defaultInsets = new Insets(4, 0, 0, 4);				bodyPanel.add(new JLabel("To"),			new GridBagConstraints(0, 0,1,1,0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets,0,0));				bodyPanel.add(textFor,			new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));				bodyPanel.add(buttonForSearch,			new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, defaultInsets, 0, 0));						bodyPanel.add(new JLabel("Priority"),			new GridBagConstraints(0, 1,1,1,0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets,0,0));				bodyPanel.add(comboPriority,			new GridBagConstraints(1, 1, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 116, 0));						bodyPanel.add(new JLabel("Date"),			new GridBagConstraints(0, 2,1,1,0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets,0,0));				bodyPanel.add(dateField,			new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));				bodyPanel.add(new JLabel("Time"),			new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));				bodyPanel.add(timeField,			new GridBagConstraints(1, 3, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));				/*bodyPanel.add(new JLabel("Contact"),			new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));				bodyPanel.add(textContact,			new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));		bodyPanel.add(buttonContactSearch,			new GridBagConstraints(3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, defaultInsets, 0, 0));	*/			JPanel notifyPanel = new JPanel(new GridLayout(1,0));		notifyPanel.setBackground(Color.WHITE);		notifyPanel.add(checkEmail);			notifyPanel.add(checkSMS);					//bodyPanel.add(new JLabel("Email"),			//new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0,GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));		bodyPanel.add(notifyPanel,			new GridBagConstraints(1, 6, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));		/*bodyPanel.add( textEmail,			new GridBagConstraints(2, 6, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));*/						/*bodyPanel.add(new JLabel("SMS"),			new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));		bodyPanel.add(checkSMS,			new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));		bodyPanel.add( textSMS,			new GridBagConstraints(2, 7, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));*/						noteScrollPane.getViewport().add(textNote, null);		bodyPanel.add(new JLabel("Notes"),			new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));				bodyPanel.add(noteScrollPane,			new GridBagConstraints(1, 8, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 80));				/*bodyPanel.add(labelApprove,			new GridBagConstraints(0, 9,1,1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0,0));		bodyPanel.add(checkApprove,			new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, defaultInsets, 0,0));*/				bodyPanel.add(buttonCancel,			new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, defaultInsets, 10, 0));		bodyPanel.add(buttonReset,			new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, defaultInsets, 29, 0));		bodyPanel.add(buttonAdd,			new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, defaultInsets, 0, 0));		bodyPanel.add(buttonDelete,			new GridBagConstraints(3, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, defaultInsets, 0, 0));		//CRMSUtil.insertEmptyRows(3, 4, 11,  bodyPanel);						JPanel wrapper = new JPanel(new BorderLayout());		wrapper.add(bodyPanel, BorderLayout.CENTER);		CRMSButtonBar buttons = new CRMSButtonBar();		buttons.addButton(CRMSButtonBar.LEFT, buttonAttachment);		buttons.addButton(CRMSButtonBar.RIGHT, buttonAdd);		buttons.addButton(CRMSButtonBar.RIGHT, buttonReset);

⌨️ 快捷键说明

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