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

📄 lastcontactviewpanel.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 java.text.*;import java.beans.*;import java.io.*;import java.text.*;/** * * @author  dmurphy */public class LastContactViewPanel extends CRMSPanel {        JPanel titlePanel = new JPanel();    CRMSPanel bodyPanel = CRMSPanel.getEmptyPanel();//    NotesTableModel tableModel = new NotesTableModel();//    JTable viewNotesTable = new JTable(tableModel);    JEditorPane meetingPane = new JEditorPane();    JScrollPane scrollPane = new JScrollPane(meetingPane);        JLabel headingLabel = new JLabel();        public static SimpleDateFormat df = new SimpleDateFormat("EEEE, d MMMM, yyyy");    public static SimpleDateFormat tf = new SimpleDateFormat("h:mm a");    JButton buttonAdd = new JButton("Add Meeting");    JButton buttonClose = new JButton("Close");        JPanel buttonPanel = new JPanel();    ContactType contactType = null;    int contactID = -1;   	boolean readonly = false; 	CallbackDestination destination = null;    //Permission entityPermission = null;    /** Creates a new instance of LastContactViewPanel */    public LastContactViewPanel() {	}    public LastContactViewPanel(ContactType type, int contactID, Permission entityPermission) {        this.contactType = type;        this.contactID = contactID;        this.entityPermission = entityPermission;    }	public void setReference(ContactType type, int contactID) {        this.contactType = type;        this.contactID = contactID;		refreshData();	}			public void setReadonly(boolean new_readonly) {		readonly = new_readonly;		if (readonly == true) {            buttonAdd.setVisible(false);		}	}	public void setDestination(CallbackDestination callback) {		destination = 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(contactType.getName() + " Meetings");                titlePanel.add(headingLabel);                titlePanel.setBackground(Color.WHITE);        add(titlePanel, BorderLayout.NORTH);                buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));        buttonPanel.setBackground(Color.WHITE);        buttonPanel.add(buttonAdd);        buttonPanel.add(buttonClose);                buttonAdd.addActionListener( new ActionListener() {           public void actionPerformed(ActionEvent ev) {               //PanelManager.getInstance().activatePanel(new LastContactAddPanel(contactType, contactID, entityPermission));				MeetingAddWindow window = new MeetingAddWindow();				window.setReference(contactType, contactID);				window.setDestination(destination);				window.display();           }        });                buttonClose.addActionListener( new ActionListener() {                       public void actionPerformed(ActionEvent ev) {				if (destination != null) destination.callback(thisobj, CRMSComponent.CB_CLOSE_WINDOW, null);           }                    });                scrollPane.getViewport().setBackground(Color.WHITE);                bodyPanel.setLayout(new BorderLayout());        bodyPanel.setBackground(Color.WHITE);        bodyPanel.setBorder(new EmptyBorder(0,20,0,20));        bodyPanel.add(scrollPane, BorderLayout.CENTER);                add(bodyPanel, BorderLayout.CENTER);        add(buttonPanel, BorderLayout.SOUTH);                setCurrentPanel(bodyPanel);    }        public void refreshData() {        meetingPane.setText("");        meetingPane.setContentType("text/html");        meetingPane.setEditable(false);                Server server = ServerFactory.getInstance().getServer();                ServerCommand command = new ServerCommand(LastContactModule.COMMAND_SHOW_MEETINGS);                command.setParameter(LastContactModule.PARAM_CONTACT_TYPE, contactType.getCode());        command.setParameter(LastContactModule.PARAM_CONTACT_ID, String.valueOf(contactID));                ServerResponse sr = server.sendCommand(command);        if (sr == null) {            System.out.println("ServerResponse is null!");        }        ArrayList meetings = (ArrayList) sr.getPart("meetings");        if ( meetings == null || meetings.size() == 0) {            meetingPane.setText("<i>No meeting details have been entered...</i>");            return;        }        StringBuffer buf = new StringBuffer();        for (int i=0; i < meetings.size(); i++) {            LastContact lc = (LastContact) meetings.get(i);			command = new ServerCommand(StaffModule.STAFF_SEARCH_SUBMIT);			command.setParameter(StaffModule.PARAM_STAFF_UID, lc.getOwner());			sr = server.sendCommand(command);			ArrayList staff = (ArrayList) sr.getPart("staff");			StaffMember user = null, found = null;			if (staff.size() >= 1) {				for (int j = 0; j < staff.size(); j++) {					user = (StaffMember)staff.get(j);					if (user.getUID().compareTo(lc.getOwner()) == 0) found = user;				}			}            buf.append( "<p><b>");            if (found != null) {                buf.append( found.getFirstName());                buf.append( " " );                buf.append( found.getLastName());            } else {				buf.append( lc.getOwner() );            }            buf.append( " had meeting at <i>");            buf.append( df.format(lc.getLastContactDate()) );            buf.append( " " );            buf.append(tf.format(lc.getLastContactDate()) );            //buf.append( " by " + note.getUser());            buf.append( "</i>");			if (lc.getLevel() >= 1) {				buf.append(" (private)");			}			buf.append("</b><br>");            buf.append( lc.getDetails());            buf.append( "</p>");        }        meetingPane.setText(buf.toString());    }    }

⌨️ 快捷键说明

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