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

📄 vijxtadialogview.java

📁 Myjxta的源代码 基于JXTA的P2P即时通信系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                        });                        try {                            Thread.sleep(UI_UPDATE_INTERVAL);                        } catch (InterruptedException ix) {                            ix.printStackTrace();                        }                    }                }            });            updateThread.setDaemon(true);            updateThread.setPriority(Thread.MIN_PRIORITY);            if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                LOG.info("before init session");            }            this.getCallControl().initSession();            if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                LOG.info("after init session");            }        }    }    public void protocolStateChanged(int protocolState) {        if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_INVITE_REQUEST_SENT) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_INVITE_REQUEST + " Sent");            showPanel(this.CONFIG_PANEL);            showConfigPanel(this.CONFIG_VIDEO_SOURCE_PANEL);        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_INVITE_REQUEST_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_INVITE_REQUEST + " Received");            String tmpString = this.getCallControl().getRemoteMonitorControl().getOriginator();            final String originator = tmpString == null ? "Unknown Remote" : tmpString;            final String localPeer = this.myJxtaView.getControl().getPeerName();            this.myJxtaView.updatePluginPanel(this, originator);            EventQueue.invokeLater(new Runnable() {                public void run() {                    holdResumeCallButton.setEnabled(false);                    endCallButton.setEnabled(true);                    statsButton.setEnabled(true);                    placeAcceptCallButton.setText(STRINGS.getString("action.vijxta.acceptcall"));                    placeAcceptCallButton.setEnabled(false);                    remoteMonitorPanel.setBorder(new TitledBorder(originator));                    localMonitorPanel.setBorder(new TitledBorder(localPeer));                }            });            showPanel(this.CONFIG_PANEL);            showConfigPanel(this.CONFIG_VIDEO_SOURCE_PANEL);        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_INVITE_ACCEPT_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_INVITE_ACCEPT + " Received");            String tmpString = this.getCallControl().getRemoteMonitorControl().getOriginator();            final String originator = tmpString == null ? "Unknown Remote" : tmpString;            final String localPeer = this.myJxtaView.getControl().getPeerName();            EventQueue.invokeLater(new Runnable() {                public void run() {                    remoteMonitorPanel.setBorder(new TitledBorder(originator));                    localMonitorPanel.setBorder(new TitledBorder(localPeer));                    placeAcceptCallButton.setText(STRINGS.getString("action.vijxta.placecall"));                }            });            showPanel(this.CONFIG_PANEL);            showConfigPanel(this.CONFIG_VIDEO_SOURCE_PANEL);            this.myJxtaView.updatePluginPanel(this, originator);        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_CONFIG_REQUEST_SENT) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_CONFIG_REQUEST + " Sent");        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_CONFIG_ACCEPT_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_CONFIG_ACCEPT + " Received");            if (getCallControl().getLocalMonitorControl() == null) {                EventQueue.invokeLater(new Runnable() {                    public void run() {                        errorMessageLabel.setText("LocalMonitorControl not available, null");                    }                });                showPanel(this.ERROR_PANEL);                if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                    LOG.info("LocalMonitorControl is NULL, Ending Call");                }                getCallControl().viewActionEndCall();            }            boolean transmit = getCallControl().getLocalMonitorControl().isTransmit();            boolean receive = this.getCallControl().getRemoteMonitorControl().isReceive();            Dimension transmitSize = null;            Dimension receiveSize = null;            int padding = 40;            Dimension tmpSize = null;            /** from the config elements aattempt to make all vid panels the same size */            if (transmit) {                tmpSize = this.getCallControl().getLocalMonitorControl().getFormatSize();                transmitSize = new Dimension((int) tmpSize.getWidth() + padding, (int) tmpSize.getHeight() + padding);                if (!receive) {                    receiveSize = new Dimension((int) transmitSize.getWidth() + padding, (int) transmitSize.getHeight() + padding);                }            }            if (receive) {                if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                    LOG.info("RECEIVE");                }                tmpSize = this.getCallControl().getRemoteMonitorControl().getFormatSize();                receiveSize = new Dimension((int) tmpSize.getWidth() + padding, (int) tmpSize.getHeight() + padding);                if (!transmit) {                    transmitSize = new Dimension((int) receiveSize.getWidth() + padding, (int) receiveSize.getHeight() + padding);                }            } else {                if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                    LOG.info("NOT RECEIVE");                }            }            final Dimension tSize = transmitSize;            final Dimension rSize = receiveSize;            if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                LOG.info("transmitPanelSize " + transmitSize);                LOG.info("receivePanelSize " + receiveSize);            }            EventQueue.invokeLater(new Runnable() {                public void run() {                    localMonitorPanel.setPreferredSize(tSize);                    remoteMonitorPanel.setPreferredSize(rSize);                    placeAcceptCallButton.setEnabled(true);                    if (getCallControl().getLocalMonitorControl().getRefreshRateLabelTable() != null) {                        refreshRateSlider.setLabelTable(getCallControl().getLocalMonitorControl().getRefreshRateLabelTable());                    }                }            });        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_CONFIG_REQUEST_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_CONFIG_REQUEST + " Received");        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_CONFIG_ACCEPT_SENT) {            final boolean transmit = getCallControl().getLocalMonitorControl().isTransmit();            final boolean receive = this.getCallControl().getRemoteMonitorControl().isReceive();            Dimension transmitSize = null;            Dimension receiveSize = null;            int padding = 40;            Dimension tmpSize = null;            if (transmit) {                tmpSize = this.getCallControl().getLocalMonitorControl().getFormatSize();                transmitSize = new Dimension((int) tmpSize.getWidth() + padding, (int) tmpSize.getHeight() + padding);                if (!receive) {                    receiveSize = new Dimension((int) transmitSize.getWidth() + padding, (int) transmitSize.getHeight() + padding);                }            }            if (receive) {                tmpSize = this.getCallControl().getRemoteMonitorControl().getFormatSize();                receiveSize = new Dimension((int) tmpSize.getWidth() + padding, (int) tmpSize.getHeight() + padding);                if (!transmit) {                    transmitSize = new Dimension((int) receiveSize.getWidth() + padding, (int) receiveSize.getHeight() + padding);                }            }            final Dimension tSize = transmitSize;            final Dimension rSize = receiveSize;            final boolean isTransmit = transmit;            EventQueue.invokeLater(new Runnable() {                public void run() {                    localMonitorPanel.setPreferredSize(tSize);                    remoteMonitorPanel.setPreferredSize(rSize);                    if (isTransmit) {                        imageQualitySlider.setEnabled(true);                        refreshRateSlider.setEnabled(true);                    }                    if (getCallControl().getLocalMonitorControl().getRefreshRateLabelTable() != null) {                        refreshRateSlider.setLabelTable(getCallControl().getLocalMonitorControl().getRefreshRateLabelTable());                    }                }            });        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_START_REQUEST_SENT) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_START_REQUEST + " Sent");        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_START_REQUEST_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_START_REQUEST + " Received");            if (this.getCallControl().isRemotePeerTransmit()) {                this.getCallControl().getRemoteMonitorControl().obtainHardware();            } else {                // nothing to do... we are transmit only            }            EventQueue.invokeLater(new Runnable() {                public void run() {                    placeAcceptCallButton.setEnabled(true);                }            });        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_START_ACCEPT_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_START_ACCEPT + " Received");            if (this.getCallControl().isRemotePeerTransmit()) {                this.getCallControl().getRemoteMonitorControl().obtainHardware();            } else {                // we are only transmitting            }        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_INCALL) {            updateProtocolStateLabel("IN_CALL");            EventQueue.invokeLater(new Runnable() {                public void run() {                    messageLabel.setText(STRINGS.getString("label.vojxta.connectedto") +                            " " +                            getCallControl().getRemoteMonitorControl().getOriginator());                    placeAcceptCallButton.setEnabled(false);                    holdResumeCallButton.setEnabled(true);                    endCallButton.setEnabled(true);                    if (getCallControl().getLocalVideoSourceType() !=                            ViJxtaCallControl.NO_DEVICE &&                            getCallControl().getLocalMonitorControl().isTransmit()) {                        getCallControl().getLocalMonitorControl().startMonitor();                        getCallControl().getLocalMonitorControl().startMonitorCapture();                        getCallControl().getLocalMonitorControl().startTransmit();                        if (getCallControl().getLocalMonitorControl().getMonitorComponent() ==                                null) {                            EventQueue.invokeLater(new Runnable() {                                public void run() {                                    errorMessageLabel.setText("LocalMonitorControl not available: No Video Device Chosen");                                    showPanel(ERROR_PANEL);                                }                            });                            if (Logging.SHOW_INFO &&                                    LOG.isLoggable(Level.INFO)) {                                LOG.info("LocalMonitorControlComponent is NULL, Ending Call");                            }                            getCallControl().viewActionEndCall();                        } else {                            localMonitorPanel.add(getCallControl().getLocalMonitorControl().getMonitorComponent());                        }                        String refreshRateLabel = getCallControl().getLocalMonitorControl().getRefreshRateUnitLabel();                        refreshRateLabel = refreshRateLabel !=                                null ? "Refresh Rate (" +                                refreshRateLabel +                                ")"                                : "Refresh Rate";                        refreshRateSlider.setBorder(new TitledBorder(refreshRateLabel));                        refreshRateSlider.setEnabled(true);                    }                    if (getCallControl().remotePeerTransmit &&                            getCallControl().getRemoteMonitorControl().isReceive()) {                        getCallControl().getRemoteMonitorControl().startMonitor();                        getCallControl().getRemoteMonitorControl().startReceive();                        if (getCallControl().getRemoteMonitorControl().getMonitorComponent() ==                                null) {                            EventQueue.invokeLater(new Runnable() {                                public void run() {                                    errorMessageLabel.setText("RemoteMonitorControl not available");                                }                            });                            if (Logging.SHOW_INFO &&                                    LOG.isLoggable(Level.INFO)) {                                LOG.info("RemoteMonitorControlComponent is Null, Ending Call");                            }                            // xxx: do we really need to termintate this call just                            // bc we can't get a remote monitor component?                            getCallControl().viewActionEndCall();                        } else {                            remoteMonitorPanel.add(getCallControl().getRemoteMonitorControl().getMonitorComponent());                        }                    }                }            });            updateThread.start();        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_HOLD_REQUEST_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_HOLD_REQUEST + " Received");            EventQueue.invokeLater(new Runnable() {                public void run() {                    holdResumeCallButton.setEnabled(false);                }            });        } else if (protocolState == ViJxtaCallControl.SESSION_VIJXTA_HOLD_ACCEPT_RECEIVED) {            updateProtocolStateLabel(ViJxtaCallControl.COMMAND_VIJXTA_HOLD_ACCEPT + " Received");            EventQueue.invokeLater(new Runnable() {                public void run() {                    holdResumeCallButton.setText(STRINGS.getString("label.vijxta.resumecall"));                    holdResumeCallButton.setEnabled(true);                }            });

⌨️ 快捷键说明

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