Search in sources :

Example 1 with TransferManager

use of org.jivesoftware.sparkplugin.ui.transfer.TransferManager in project Spark by igniterealtime.

the class NonRosterPanel method setupDefaults.

public void setupDefaults() {
    holdButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent mouseEvent) {
            toggleHold();
        }
    });
    muteButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent mouseEvent) {
            toggleMute();
        }
    });
    transferButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent mouseEvent) {
            TransferManager ui = new TransferManager();
            final String number = ui.getNumber(SparkManager.getChatManager().getChatContainer().getChatFrame());
            if (ModelUtil.hasLength(number)) {
                setStatus(PhoneRes.getIString("phone.transferring") + "...", blueColor);
                historyPanel.transferring();
                SwingWorker transferringThread = new SwingWorker() {

                    public Object construct() {
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        return true;
                    }

                    public void finished() {
                        setStatus(PhoneRes.getIString("phone.transfered"), blueColor);
                        historyPanel.transfer(number);
                        callWasTransferred = true;
                        softPhone.handleTransfer(getActiveCall().getID(), number);
                        callEnded();
                    }
                };
                transferringThread.start();
            }
        }
    });
    final SoftPhoneManager manager = SoftPhoneManager.getInstance();
    hangUpButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            manager.getDefaultGuiManager().hangup(activeCall);
            hangUpButton.setEnabled(false);
            muteButton.setButtonSelected(false);
            holdButton.setButtonSelected(false);
        }
    });
    redialButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            manager.getDefaultGuiManager().dial(activeCall.getCall().getNumber());
            redialButton.setVisible(false);
            hangUpButton.setVisible(true);
        }
    });
}
Also used : TransferManager(org.jivesoftware.sparkplugin.ui.transfer.TransferManager) MouseEvent(java.awt.event.MouseEvent) ActionListener(java.awt.event.ActionListener) SoftPhoneManager(net.java.sipmack.softphone.SoftPhoneManager) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) SwingWorker(org.jivesoftware.spark.util.SwingWorker)

Example 2 with TransferManager

use of org.jivesoftware.sparkplugin.ui.transfer.TransferManager in project Spark by igniterealtime.

the class RosterMemberPanel method setupDefaults.

public void setupDefaults() {
    holdButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent mouseEvent) {
            toggleHold();
        }
    });
    muteButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent mouseEvent) {
            toggleMute();
        }
    });
    transferButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent mouseEvent) {
            TransferManager ui = new TransferManager();
            final String number = ui.getNumber(SparkManager.getChatManager().getChatContainer().getChatFrame());
            if (ModelUtil.hasLength(number)) {
                setStatus("Transferring...", blueColor);
                historyPanel.transferring();
                SwingWorker transferringThread = new SwingWorker() {

                    public Object construct() {
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        return true;
                    }

                    public void finished() {
                        setStatus("Transferred", blueColor);
                        historyPanel.transfer(number);
                        callWasTransferred = true;
                        softPhone.handleTransfer(getActiveCall().getID(), number);
                        callEnded();
                    }
                };
                transferringThread.start();
            }
        }
    });
    final SoftPhoneManager manager = SoftPhoneManager.getInstance();
    hangUpButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            manager.getDefaultGuiManager().hangup(activeCall);
            hangUpButton.setEnabled(false);
        }
    });
}
Also used : TransferManager(org.jivesoftware.sparkplugin.ui.transfer.TransferManager) MouseEvent(java.awt.event.MouseEvent) ActionListener(java.awt.event.ActionListener) SoftPhoneManager(net.java.sipmack.softphone.SoftPhoneManager) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) SwingWorker(org.jivesoftware.spark.util.SwingWorker)

Aggregations

ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 MouseAdapter (java.awt.event.MouseAdapter)2 MouseEvent (java.awt.event.MouseEvent)2 SoftPhoneManager (net.java.sipmack.softphone.SoftPhoneManager)2 SwingWorker (org.jivesoftware.spark.util.SwingWorker)2 TransferManager (org.jivesoftware.sparkplugin.ui.transfer.TransferManager)2