📄 vijxtadialogpanel.java
字号:
/* * Copyright (c) [2005] [Jeffrey Moore] * * Redistributions in source code form must reproduce the above copyright and * this condition. * * The contents of this file are subject to the Sun Project JXTA License * Version 1.1 (the "License"); you may not use this file except in compliance * with the License. A copy of the License is available at * http://www.jxta.org/jxta_license.html. * *//* * ViJxtaDialogPanel.java * * Created on April 11, 2005, 9:26 AM */package net.jxta.myjxta.plugins.vijxta;import info.clearthought.layout.TableLayout;import java.awt.CardLayout;import java.awt.Color;import java.awt.Component;import java.awt.Dimension;import java.awt.EventQueue;import java.awt.Font;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.net.MalformedURLException;import java.net.URL;import java.util.Collections;import java.util.Hashtable;import java.util.Iterator;import java.util.ResourceBundle;import javax.swing.ButtonGroup;import javax.swing.DefaultListModel;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JLabel;import javax.swing.JList;import javax.swing.JPanel;import javax.swing.JRadioButton;import javax.swing.JSeparator;import javax.swing.JSlider;import javax.swing.JTextField;import javax.swing.JPasswordField;import javax.swing.SwingConstants;import javax.swing.border.TitledBorder;import javax.swing.event.ChangeEvent;import javax.swing.event.ChangeListener;import net.jxta.myjxta.View;import net.jxta.myjxta.dialog.Dialog;import net.jxta.myjxta.plugin.PluginPanel;import net.jxta.myjxta.ui.MyJXTAView;import net.jxta.myjxta.util.Resources;import net.jxta.myjxta.util.exec.ExecFactory;import org.apache.log4j.Level;import org.apache.log4j.Logger;/** * * @author Jeff Moore */public class ViJxtaDialogPanel extends JPanel implements PluginPanel { static final Logger LOG = Logger.getLogger(ViJxtaDialogPanel.class); private static final ResourceBundle STRINGS = Resources.getStrings(); //hACK! public static final String CONFIG_VIDEO_SOURCE_PANEL = "configVideoSource"; public static final String CONFIG_LOCAL_DEVICES_PANEL = "configLocalDevices"; public static final String CONFIG_NETWORKED_DEVICES_PANEL = "configNetworkedDevices"; public static final String INITIATED_LOCALLY = "ViJxtaDialogInitiatedLocally"; private static final String CONFIG_FORMATS_PANEL = "configFormats"; private static final String CONFIG_TEST_PANEL = "configTest"; private static final String CONFIG_PANEL = "configPanel"; private static final String NO_RESPONSE_PANEL = "noResponsePanel"; private static final String CONFIG_LOCAL_OPTIONS_PANEL = "configLocalOptionsPanel"; private static final String CALL_CONTROL_PANEL = "callControlPanel"; private static final String STATS_PANEL = "statsPanel"; private static final String ERROR_PANEL = "errorPanel"; private static final String IDLE_PANEL = "idlePanel"; private static final String URL_JMF_DOWNLOAD = "http://java.sun.com/products/java-media/jmf/2.1.1/download.html"; private static final String JMF_ERROR_MESSAGE = "<html><font color=blue><u>Download Java Media Framework</u></font></html>"; /** sleep time for the UI update thread*/ private static final int UI_UPDATE_INTERVAL = 1000; /** sleep time while waiting for dialog pipe to connect */ private static final int CONNECT_SLEEP_TIME = 200; private JButton startCallButton = null; private JButton endCallButton = null; private JSlider imageQualitySlider = null; private JLabel messageLabel = null; private JLabel incomingBufferSizeLabel = null; private JLabel outgoingBufferSizeLabel = null; private JLabel sessionLogFileNameLabel = null; private JLabel incomingImageCompressionLabel = null; private JLabel outgoingImageCompressionLabel = null; private JLabel productLabel = null; private JCheckBox speakerMuteCheckBox = null; private JCheckBox saveConvoCheckBox = null; private JLabel bytesReceivedLabel = null; private JLabel messagesReceivedLabel = null; private JLabel roundTripTimeLabel = null; private JLabel bytesSentLabel = null; JCheckBox transmitCheckBox = null; JCheckBox receiveCheckBox = null; private JLabel messagesSentLabel = null; private CardLayout cardLayout = null; private JPanel deckPanel = null; private CardLayout configCardLayout = null; private JPanel configDeckPanel = null; private JLabel speakerLabel = null; private JButton statsButton = null; private JLabel jmfErrorLabel = null; private JLabel encodedBufferSizeLabel = null; private JLabel errorMessageLabel = null; private JLabel encodedBlockSizeLabel = null; private JLabel callElapsedTimeLabel = null; private JLabel callStartTimeLabel = null; private JLabel callEndTimeLabel = null; private JLabel outgoingMessagesPerSecondLabel = null; private JLabel incomingMessagesPerSecondLabel = null; private JLabel outgoingBytesPerSecondLabel = null; private JLabel incomingBytesPerSecondLabel = null; private JLabel compressionRatioLabel = null; private JLabel qualityLabel = null; private JLabel averageDecodeTimeLabel = null; private JLabel averageEncodeTimeLabel = null; private JLabel decodeTimeLabel = null; private JLabel encodeTimeLabel = null; private JLabel protocolStateLabel = null; private JLabel refreshRateLabel = null; private JLabel encodedMessageSizeLabel = null; private JList captureDevicesList = null; private JList formatsList = null; private JPanel monitorTestPanel = null; private static boolean inSession = false; Insets panelInsets =null; private ViJxtaDialog viJxtaDialog = null; Insets subComponentInsets = null; private static boolean initiatedLocally = false; private View myJxtaView = null; private ViJxtaCallControl viJxtaCallControl = null; private Thread updateThread = null; private boolean updateThreadRun = true; long previousOutgoingMessagesValue = 0; long previousIncomingMessagesValue = 0; long previousOutgoingBytesValue = 0; long previousIncomingBytesValue = 0; private boolean noLocalCaptureDevicesFound = false; private Hashtable imageQualityLabelTable = null; private Component monitorTestComponent = null; private Component localMonitorComponent = null; private Component remoteMonitorComponent = null; private JPanel localMonitorPanel = null; private JPanel remoteMonitorPanel = null; private JButton placeAcceptCallButton = null; private JPanel messagePanel = null; private JButton holdResumeCallButton = null; private JSlider refreshRateSlider = null; private boolean isJMFPresent = false; private boolean localDevice = false; private boolean networkedDevice = false; private boolean noDevice = false; private JTextField networkedSourceURLTextField = null; private JTextField authenticationUserNameTextField = null; private JPasswordField authenticationPasswordTextField = null; private JCheckBox authenticationCheckBox = null; /** Creates a new instance of ViJxtaDialogPanel */ public ViJxtaDialogPanel(View p_view, Dialog dialog) { super(); LOG.setLevel(Level.INFO); imageQualityLabelTable = new Hashtable() ; imageQualityLabelTable.put(new Integer(0), new JLabel("0%")); imageQualityLabelTable.put(new Integer(20), new JLabel("20%")); imageQualityLabelTable.put(new Integer(40), new JLabel("40%")); imageQualityLabelTable.put(new Integer(60), new JLabel("60%")); imageQualityLabelTable.put(new Integer(80), new JLabel("80%")); imageQualityLabelTable.put(new Integer(100), new JLabel("100%")); this.myJxtaView = p_view; this.viJxtaDialog = (ViJxtaDialog) dialog; if(!this.viJxtaDialog.isConnected()) { if (LOG.isEnabledFor(Level.INFO)) { LOG.info("Constructor : ViJxtaDialog not connected"); } dismiss(); }else{ UI(); /** test for jmf.jar. if jmf is not present then move to errorpane and ditch plugin * protocol will never be sent. */ //tests for jmf.jar try { this.isJMFPresent = LocalDeviceMonitorControl.isJMFPresent(); }catch(Exception x ) { x.printStackTrace(); isJMFPresent = false; }catch(Error e) { e.printStackTrace(); isJMFPresent = false; } this.viJxtaCallControl = new ViJxtaCallControl(this, this.myJxtaView, viJxtaDialog, initiatedLocally); if (LOG.isEnabledFor(Level.INFO)) { LOG.info("viJxtaCall Control is "+this.viJxtaCallControl);; } if (LOG.isEnabledFor(Level.INFO)) { LOG.info("viJxtaCall Control is "+this.getCallControl());; } /** UI update thread for stats, call times etc*/ updateThread = new Thread(new Runnable() { public void run() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -