?? spypanel.java
字號(hào):
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package server.ftp.gui;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import server.ftp.ConnectionService;
import server.ftp.FtpConfig;
import server.ftp.SpyConnectionInterface;
/**
* This panel is used to monitor user activity.
*
* @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
*/
public
class SpyPanel extends JPanel implements SpyConnectionInterface {
private JTextArea mLogTxt = null;
private FtpConfig mConfig = null;
private String mstSessionId = null;
/**
* Instantiate this dialog box
*/
public SpyPanel(FtpConfig config, String sessId) {
mConfig = config;
mstSessionId = sessId;
initComponents();
}
/**
* Initialize the UI components
*/
private void initComponents() {
setLayout(new BorderLayout());
mLogTxt = new JTextArea();
mLogTxt.setEditable(false);
JScrollPane txtPane = new JScrollPane(mLogTxt,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
add(txtPane, BorderLayout.CENTER);
ConnectionService conService = mConfig.getConnectionService();
if (conService != null) {
conService.setSpyObject(mstSessionId, this);
}
}
/**
* Get connection session id.
*/
public String getSessionId() {
return mstSessionId;
}
/**
* Write server response.
*/
public void response(String msg) {
mLogTxt.append(msg);
}
/**
* Write user request.
*/
public void request(String msg) {
mLogTxt.append(msg);
}
/**
* Clear log messages
*/
public void clearLog() {
mLogTxt.setText("");
}
/**
* Close pane
*/
public void closePane() {
ConnectionService conService = mConfig.getConnectionService();
if (conService != null) {
conService.setSpyObject(mstSessionId, null);
}
mLogTxt.setText("");
}
/**
* Disconnect user
*/
public void disconnect() {
ConnectionService conService = mConfig.getConnectionService();
if (conService != null) {
conService.setSpyObject(mstSessionId, null);
conService.closeConnection(mstSessionId);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -