Search in sources :

Example 1 with CallPanelButton

use of org.jivesoftware.sparkplugin.components.CallPanelButton in project Spark by igniterealtime.

the class NonRosterPanel method buildMiddlePanel.

/**
 * Builds the Control Panel.
 *
 * @return the control panel.
 */
private JPanel buildMiddlePanel() {
    // Add Control Panel
    final JPanel mainPanel = new JPanel(new GridBagLayout()) {

        private static final long serialVersionUID = 1571929852761037052L;

        public Dimension getPreferredSize() {
            final Dimension dim = super.getPreferredSize();
            dim.height = 100;
            return dim;
        }
    };
    mainPanel.setOpaque(false);
    // Add Input Volume To Control Panel
    try {
        final ControlPanel inputPanel = new ControlPanel(new GridBagLayout());
        final JLabel inputIcon = new JLabel(PhoneRes.getImageIcon("MICROPHONE_IMAGE"));
        inputPanel.add(mixer.getPrefferedInputVolume(), new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
        inputPanel.add(inputIcon, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
        mainPanel.add(inputPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 1), 0, 0));
    } catch (Exception e) {
        Log.error(e);
    }
    try {
        // Add Output Volume To Control Panel
        final ControlPanel outputPanel = new ControlPanel(new GridBagLayout());
        final JLabel outputIcon = new JLabel(PhoneRes.getImageIcon("SPEAKER_IMAGE"));
        Component component = mixer.getPrefferedMasterVolume();
        if (component != null)
            outputPanel.add(component, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
        outputPanel.add(outputIcon, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
        mainPanel.add(outputPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 5), 0, 0));
    } catch (Exception e) {
        Log.error(e);
    }
    // Build ControlPanel List
    final JPanel controlPanel = new JPanel(new GridBagLayout());
    controlPanel.setOpaque(false);
    muteButton = new CallPanelButton(PhoneRes.getImageIcon("MUTE_IMAGE").getImage(), PhoneRes.getIString("phone.mute"));
    muteButton.setToolTipText(PhoneRes.getIString("phone.tips.mute"));
    controlPanel.add(muteButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    holdButton = new CallPanelButton(PhoneRes.getImageIcon("ON_HOLD_IMAGE").getImage(), PhoneRes.getIString("phone.hold"));
    holdButton.setToolTipText(PhoneRes.getIString("phone.tips.hold"));
    controlPanel.add(holdButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    transferButton = new CallPanelButton(PhoneRes.getImageIcon("TRANSFER_IMAGE").getImage(), PhoneRes.getIString("phone.transfer"));
    transferButton.setToolTipText(PhoneRes.getIString("phone.tips.transfer"));
    controlPanel.add(transferButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    // Add End Call button
    hangUpButton = new EndCallButton();
    redialButton = new RedialButton();
    redialButton.setVisible(false);
    // Add Components to Main Panel
    mainPanel.add(controlPanel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 1, 2, 1), 0, 0));
    mainPanel.add(hangUpButton, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 1, 2, 1), 0, 0));
    mainPanel.add(redialButton, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 1, 2, 1), 0, 0));
    return mainPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) EndCallButton(org.jivesoftware.sparkplugin.components.EndCallButton) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ControlPanel(org.jivesoftware.sparkplugin.ui.components.ControlPanel) CallPanelButton(org.jivesoftware.sparkplugin.components.CallPanelButton) RedialButton(org.jivesoftware.sparkplugin.components.RedialButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Aggregations

Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JComponent (javax.swing.JComponent)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 CallPanelButton (org.jivesoftware.sparkplugin.components.CallPanelButton)1 EndCallButton (org.jivesoftware.sparkplugin.components.EndCallButton)1 RedialButton (org.jivesoftware.sparkplugin.components.RedialButton)1 ControlPanel (org.jivesoftware.sparkplugin.ui.components.ControlPanel)1