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

📄 panelmanager.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    *//* * PanelManager.java * * Created on 7 April 2003, 03:01 */package crms.applet;import javax.swing.*;import java.awt.*;import java.applet.*;import java.net.*;import java.util.*;import crms.util.*;import crms.module.StaffModule;/** Top level panel management class that controls the application state and swapping display panels. * * @author  dmurphy, tnichols */public class PanelManager {        private static PanelManager _instance = null;        private JPanel parent = null;        private CRMSPanel currentPanel = null;    private CRMSPanel previousPanel = null;        private AppletContext appletContext = null;    private URL codeBase = null;    private String userName = null;    private String userKey = null;	private String compose_url = null;	// cache values	ArrayList cache_uidlist = null;        /** Creates a new instance of PanelManager */    private PanelManager() {    }            public void setAuthenticatedUser(String username, String key) {        this.userName = username;        this.userKey = key;    }        public static PanelManager getInstance() {        if (_instance == null) {            _instance = new PanelManager();        }        return _instance;    }        public void setParentPanel(JPanel parentPanel) {        parent = parentPanel;        parent.setBackground(Color.WHITE);                parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));        if (currentPanel != null) {            previousPanel = currentPanel;            parent.remove(currentPanel);        }    }        public JPanel getParentPanel() {        return parent;    }        public void activatePanel(CRMSPanel panel) {                if (userName == null && userKey == null) {            // User hasn't been authenticated - show error pane.               throw new RuntimeException("User hasn't been authenticated!");        }        System.out.println( "Activating panel: " + panel.getClass());                parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));        if (currentPanel != null) {            previousPanel = currentPanel;            parent.remove(currentPanel);        }        parent.add(panel);        currentPanel = panel;        panel.setVisible(true);        panel.init();        panel.revalidate();		parent.repaint(0, 0, 0, parent.getWidth(), parent.getHeight());        parent.setCursor(Cursor.getDefaultCursor());    }    public void setAppletContext(AppletContext context) {        this.appletContext = context;    }        public AppletContext getAppletContext() {        return appletContext;    }        public void setCodeBase(URL codeBase) {        this.codeBase = codeBase;    }        public URL getCodeBase() {        return codeBase;    }        public String getAuthenticatedUser() {        return userName;    }	/** Enable webmail composer functionality by passing in the URL to the compose page.	 * @param new_url The base compose URL	 */	public void setComposeURL(String new_url) {		compose_url = new_url;	}	/** Determine whether to show email UI elements.	 * @return Whether or not the composer function is enabled.	 */	public boolean isComposerEnabled() {		return compose_url != null;	}	/** Bring up a squirrelmail compose window.  The function opens a new window based on the 	 * plugin applet URL. If running in standalone mode or no compose_url is set, this 	 * functionality is disabled.	 *	 * @param email The email address to compose to	 */	public void showComposeWindow(String email) {		// require an email address		if (compose_url == null || compose_url == null) return;		try {			AppletContext ac = getInstance().getAppletContext();			if (ac == null) return;			ac.showDocument(new URL(compose_url + "?send_to=" + email), "_blank");		} catch (Exception ex) {			ex.printStackTrace();		}	}	/** Prepare the cache of data that is used during the life of the applet.  Calling this function will initialise	 * or update the cache of values used for things like auto-complete and so forth. */	public void initCache() {		Server server = ServerFactory.getInstance().getServer();		ServerCommand command = new ServerCommand(StaffModule.STAFF_AUTO_LIST);		// get the AUTO_LIST		ServerResponse sr = server.sendCommand(command);		cache_uidlist = (ArrayList)sr.getPart("uids");	}	/** Get the UID List (LDAP UID's). Do not modify this!	 *	 * @return ArrayList of strings storing the uid attributes only for all staff members.	 */	public ArrayList getUIDList() {		return cache_uidlist;	}        }

⌨️ 快捷键说明

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