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

📄 vojxtadialogpanel.java

📁 jxta官方例程
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     *  UI action denoting the user adjusted the quality slider     */    private void localActionQualityChanged (int quality) {                getCallControl ().setLocalVoiceQuality (quality);            }        /**     *  UI action denoting user has chosen to persist this audio session. User     *  Chooses a directoy to save the session into. This is just a skeleton.     *  None of the save session logic has been implemented.     */    private void localActionPersistSession (boolean save) {                if(save == true) {                        JFileChooser chooser = new JFileChooser ();                        chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);                        chooser.setDialogTitle ("Choose Audio Logging Directory");                        int returnVal = chooser.showOpenDialog (this.getParent ());                        if(returnVal == JFileChooser.APPROVE_OPTION) {                                if(chooser.getSelectedFile () != null) {                    if(chooser.getSelectedFile ().isDirectory ()) {                                                if (LOG.isEnabledFor (Level.INFO)) {                                                        sessionLogFileNameLabel.setText (                                    chooser.getSelectedFile ().getAbsolutePath ()+                                    File.separator+DEFAULT_SESSION_FILE_NAME);                        }                                                getCallControl ().setPersistSession (true,                                chooser.getSelectedFile ().getAbsolutePath ()+                                File.pathSeparator+DEFAULT_SESSION_FILE_NAME);                    }                }            }                    }else{                        getCallControl ().setPersistSession (false, null);        }    }            /**     *  UI action denoting the user wants to start the call. This action is for     *  two actions.  Place call for the user who initiated the session and     *  Accept call for the user on the other end. CallControl then performs the     *  protocol semantics to make the call active.     */    private void localActionStartCall () {                EventQueue.invokeLater (new Runnable () {                        public void run () {                                startCallButton.setEnabled (false);            }        });                if(isInitiatedLocally () ) {                        getCallControl ().viewActionPlaceCall ();                    }else{                        getCallControl ().viewActionAcceptCall ();                    }    }        /**     *  UI action. User wishes to place the call on hold. The same button is     *  used for Hold and Resume depending on the call state     *     */    private void localActionHoldCall () {                EventQueue.invokeLater (new Runnable () {                        public void run () {                                holdCallButton.setEnabled (false);            }        });                        if(holdCallButton.getText ().equals ("Resume Call")) {                                    getCallControl ().viewActionResumeCall ();                    }else if(holdCallButton.getText ().equals ("Hold Call")) {                        getCallControl ().viewActionHoldCall ();        }                            }        /**     *  UI action. user wishes to end call.     */    private void localActionEndCall () {                EventQueue.invokeLater (new Runnable () {                        public void run () {                                endCallButton.setEnabled (false);                                holdCallButton.setEnabled (false);            }        });                getCallControl ().viewActionHangupCall ();    }        /**     *  Signals the app view we are done with this dialogpanel and to remove. If     *  Dismiss is invoked prior to end call attempt to go down as graceful as      *  possible alerting the remote peer(s).     */    private void localActionDismiss () {                if(this.getCallControl ().getProtocolState () !=                 VoJxtaCallControl.SESSION_VOJXTA_DISCONNECTED) {                        getCallControl().destroy ();        }                this.view.removeDialog (this.vojxtaDialog);    }        /**     *  Returns the call COntrol object     */    private VoJxtaCallControl getCallControl () {                return this.callControl;    }            /**     *  Setts the call control object     */    private void setCallControl (VoJxtaCallControl callControl) {                this.callControl = callControl;    }                        /**     *  updates the UI status label. usually due to protocol changes     *     */    private void updateStatusView (final String status) {        if (LOG.isEnabledFor (Level.INFO)) {            //LOG.info ("status = "+status);        }        EventQueue.invokeLater (new Runnable () {            public void run () {                statusLabel.setText (status);            }        });            }        /**     *  This method is the event signaling mechanism from call control. Events     *  received by the remote peer and our own call control are registerd here.     *  UI updates and button states can be changed based on protocol state.     */    public void protocolStateChanged (int protocolState) {                if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_INVITE_REQUEST_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    startCallButton.setEnabled (true);                }            });                    }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_START_REQUEST_SENT) {                                            }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_INCALL) {                        updateThread.start ();                        EventQueue.invokeLater (new Runnable () {                public void run () {                    if(getCallControl ().isSpeakerGainSupported ()) {                        speakerVolumeSlider.setEnabled (true);                        speakerVolumeSlider.setMinimum ((int)getCallControl ().getSpeakerMinGain ());                        speakerVolumeSlider.setMaximum ((int)getCallControl ().getSpeakerMaxGain ());                        speakerVolumeSlider.setValue ((int)getCallControl ().getSpeakerGainValue ());                        speakerLabel.setText ("SPKR ("+getCallControl ().getSpeakerGainUnits ()+")");                    }                    if(getCallControl ().isMicGainSupported ()) {                        micVolumeSlider.setEnabled (true);                        micVolumeSlider.setMinimum ((int)getCallControl ().getMicMinGain ());                        micVolumeSlider.setMaximum ((int)getCallControl ().getMicMaxGain ());                        micVolumeSlider.setValue ((int)getCallControl ().getMicGainValue ());                        micLabel.setText ("MIC ("+getCallControl ().getMicGainUnits ()+")");                    }                                                            messageLabel.setText(                                   //STRINGS.getString ("label.vojxta.connectedto" + " " +                            "Connected to " +                            getCallControl().getOriginator ());                    holdCallButton.setEnabled (true);                    endCallButton.setEnabled (true);                }            });        }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_HOLD_REQUEST_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    holdCallButton.setEnabled (false);                }            });        }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_HOLD_ACCEPT_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    holdCallButton.setText ("Resume Call");                    holdCallButton.setEnabled (true);                }            });                                            }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_RESUME_REQUEST_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    holdCallButton.setEnabled (true);                }            });        }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_RESUME_ACCEPT_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    holdCallButton.setText ("Hold Call");                    holdCallButton.setEnabled (true);                }            });                    }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_HANGUP_REQUEST_SENT) {                        if(updateThread != null && updateThread.isRunning()) {                updateThread.stopThread();            }                    }        else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_HANGUP_REQUEST_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    holdCallButton.setEnabled (false);                    endCallButton.setEnabled (false);                }            });                        if(updateThread != null && updateThread.isRunning()) {                updateThread.stopThread();            }                    }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_DISCONNECT_REQUEST_RECEIVED) {                        EventQueue.invokeLater (new Runnable () {                public void run () {                    holdCallButton.setEnabled (false);                    endCallButton.setEnabled (false);                }            });                        if(updateThread != null && updateThread.isRunning()) {                updateThread.stopThread();            }                    }else if(protocolState == VoJxtaCallControl.SESSION_VOJXTA_DISCONNECTED) {                        if(updateThread != null && updateThread.isRunning()) {                updateThread.stopThread();            }                        setInSession(false);                        setInitiatedLocally(false);                        EventQueue.invokeLater (new Runnable () {                public void run () {                    messageLabel.setText(STRINGS.getString ("label.vojxta.sessionended"));                    holdCallButton.setEnabled (false);                    endCallButton.setEnabled (false);                    dismissButton.setEnabled(true);                }            });             this.getCallControl ().destroy ();           }    }            /**     * left over for chaging the status message on the panel... will be removed     */    public void sessionStateChanged (int sessionState) {                if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_DISCONNECTED) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_DISCONNECTED);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_DISCONNECTING) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_DISCONNECTING);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_ENDED) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_ENDED);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_ENDING) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_ENDING);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_INCALL) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_INCALL);                                }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_HOLDING) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_HOLDING);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_STARTED) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_STARTED);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_STARTING) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_STARTING);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_CONNECTED) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_CONNECTED);                    }else if(sessionState == VoJxtaCallControl.SESSION_VOJXTA_CONNECTING) {                        updateStatusView (this.DISPLAY_SESSION_VOJXTA_CONNECTING);                    }                            }        /**     *  Creates the call control panel and sets up the cardlayout.     */    private void UI () {                cardLayout = new CardLayout ();                deckPanel = new JPanel (cardLayout);                this.add (deckPanel);                JPanel callPanel = new JPanel ();                deckPanel.add (callPanel, this.CALL_PANEL);                GridBagLayout gbl = new GridBagLayout ();        GridBagConstraints gbc = new GridBagConstraints ();                                callPanel.setLayout (gbl);                // add panels to this container                JPanel messagePanel = new JPanel ();        gbc.fill = gbc.NONE;        gbc.anchor = gbc.CENTER;        gbc.gridx = 0;        gbc.gridy = 0;        gbc.insets = panelInsets;        gbc.weightx = 1;

⌨️ 快捷键说明

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