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

📄 lastcontactaddpanel.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    *//* * CallViewPanel.java * * Created on 27 March 2003, 00:11 */package crms.applet;import javax.swing.*;import java.awt.*;import java.awt.event.*;import javax.swing.border.*;import javax.swing.event.*;import java.util.*;import crms.vo.*;import crms.ui.*;import crms.module.*;import crms.util.*;import crms.dao.*;import java.text.*;import java.beans.*;import java.io.*;import java.text.*;import mseries.Calendar.*;import mseries.ui.*;import org.apache.log4j.Logger;/** * * @author  dmurphy */public class LastContactAddPanel extends CRMSPanel {        static Logger logger = Logger.getLogger(LastContactAddPanel.class);        JPanel titlePanel = new JPanel();    CRMSPanel bodyPanel = CRMSPanel.getEmptyPanel();    JLabel headingLabel = new JLabel();        public static SimpleDateFormat df = new SimpleDateFormat("EEEE, d MMMM, yyyy");    public static SimpleDateFormat tf = new SimpleDateFormat("h:mm a");    JButton buttonSave = new JButton("Save Meeting");    JButton buttonReset = new JButton("Clear");    JButton buttonCancel = new JButton("Close");	JCheckBox chkLevel = new JCheckBox("Private");        JTextArea detailsText = new JTextArea();    JScrollPane detailsScrollPane = new JScrollPane(detailsText);        MDateEntryField dateField = new MDateEntryField();    MDateSpinner timeField = new MDateSpinner();        ContactType contactType = null;    int contactID = -1;       	CallbackDestination callback = null;	     /** Creates a new instance of LastContactViewPanel */    public LastContactAddPanel() {	}    public void setReference(ContactType type, int contactID) {        this.contactType = type;        this.contactID = contactID;		refreshData();    }	public void setCallback(CallbackDestination callback) {		this.callback = callback;	}        public void init() {		final Object thisobj = this;        setLayout(new BorderLayout());        setBackground(Color.WHITE);/*        headingLabel.setFont(new java.awt.Font("Serif", 1, 14));        headingLabel.setBackground(Color.WHITE);        headingLabel.setText("Add " + contactType.getName() + " Meeting");        titlePanel.add(headingLabel);        titlePanel.setBackground(Color.WHITE);        add(titlePanel, BorderLayout.NORTH);*/              detailsText.setWrapStyleWord(true);        detailsText.setLineWrap(true);                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"));                buttonSave.addActionListener( new ActionListener() {           public void actionPerformed(ActionEvent ev) {               saveNote();               if (callback != null) callback.callback(thisobj, CRMSComponent.CB_CLOSE_WINDOW,			new Object());				//PanelManager.getInstance().activatePanel(new LastContactViewPanel(contactType, contactID, entityPermission));           }        });                buttonReset.addActionListener( new ActionListener() {           public void actionPerformed(ActionEvent ev) {               refreshData();           }        });                buttonCancel.addActionListener( new ActionListener() {           public void actionPerformed(ActionEvent ev) {               if (callback != null) callback.callback(thisobj, CRMSComponent.CB_CLOSE_WINDOW, null);               //PanelManager.getInstance().activatePanel(new LastContactViewPanel(contactType, contactID, entityPermission));           }        });                GridBagLayout gbl = new GridBagLayout();        bodyPanel.setLayout(gbl);        bodyPanel.setBackground(Color.WHITE);        bodyPanel.setBorder(new EmptyBorder(0, 20, 0, 20));                detailsText.setRows(10);        detailsText.setLineWrap(true);                Insets defaultInsets = new Insets(4,0,0,4);                bodyPanel.add(new JLabel("Date"),			new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));        bodyPanel.add(dateField,			new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));                bodyPanel.add(new JLabel("Time"),			new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));        bodyPanel.add(timeField,			new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));        bodyPanel.add(new JLabel("Details"),			new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));        bodyPanel.add(detailsScrollPane,			new GridBagConstraints(1, 2, 3, 10, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));                bodyPanel.add(new JLabel("Private"),			new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, defaultInsets, 0, 0));        bodyPanel.add(chkLevel,			new GridBagConstraints(1, 13, 3, 10, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, defaultInsets, 0, 0));		chkLevel.setBackground(Color.WHITE);        		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));		buttonPanel.setBackground(Color.WHITE);		buttonPanel.add(buttonSave);		buttonPanel.add(buttonReset);		buttonPanel.add(buttonCancel);                add(bodyPanel, BorderLayout.CENTER);		add(buttonPanel, BorderLayout.SOUTH);                CRMSUtil.fixGridBagLayout(gbl, bodyPanel);    }        public void refreshData() {        detailsText.setText("");		chkLevel.setSelected(false);    }        public void saveNote() {                Server server = ServerFactory.getInstance().getServer();                ServerCommand command = new ServerCommand(LastContactModule.COMMAND_SAVE_MEETING);        command.setParameter(LastContactModule.PARAM_CONTACT_ID, String.valueOf(contactID));        command.setParameter(LastContactModule.PARAM_CONTACT_TYPE, contactType.getCode());                        Calendar timeCal = Calendar.getInstance();        Calendar cal = Calendar.getInstance();        try {            timeCal.setTime(timeField.getValue());            cal.setTime(dateField.getValue());        }        catch (ParseException ex) {            logger.error(ex);        }        cal.set(Calendar.HOUR, timeCal.get(Calendar.HOUR));        cal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));        cal.set(Calendar.SECOND, 0);        cal.set(Calendar.MILLISECOND, 0);                String theDate = LastContactDAO.df.format(cal.getTime());                command.setParameter(LastContactModule.PARAM_DATE, theDate);        command.setParameter(LastContactModule.PARAM_DETAILS, detailsText.getText());        if (chkLevel.isSelected()) {			command.setParameter(LastContactModule.PARAM_LEVEL, new Integer(1));		}                ServerResponse sr = server.sendCommand(command);    }}

⌨️ 快捷键说明

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