Search in sources :

Example 1 with RosterMemberCallButton

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

the class RosterMemberPanel method buildControlPanel.

/**
 * Builds the Control Panel.
 *
 * @return the control panel.
 */
private JPanel buildControlPanel() {
    // Add Control Panel
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setOpaque(false);
    // Add Input Volume To Control Panel
    try {
        final ControlPanel inputPanel = new ControlPanel(new GridBagLayout());
        final JLabel inputIcon = new JLabel(PhoneRes.getImageIcon("SPEAKER_IMAGE"));
        inputPanel.add(javaMixer.getPrefferedMasterVolume(), 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, 0.2, GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 1), 0, 0));
    } catch (Exception e) {
        Log.error(e);
    }
    // Add Output Volume To Control Panel
    try {
        final ControlPanel outputPanel = new ControlPanel(new GridBagLayout());
        final JLabel outputIcon = new JLabel(PhoneRes.getImageIcon("MICROPHONE_IMAGE"));
        outputPanel.add(javaMixer.getPrefferedInputVolume(), 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, 0.2, GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 1), 0, 0));
    } catch (Exception e) {
        Log.error(e);
    }
    // Build ControlPanel List
    final ControlPanel controlPanel = new ControlPanel(new GridBagLayout());
    final JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
    sep.setBackground(new Color(219, 228, 238));
    muteButton = new RosterMemberCallButton(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(0, 0, 0, 0), 0, 0));
    controlPanel.add(sep, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    holdButton = new RosterMemberCallButton(PhoneRes.getImageIcon("ON_HOLD_IMAGE").getImage(), PhoneRes.getIString("phone.hold"));
    holdButton.setToolTipText(PhoneRes.getIString("phone.tips.hold"));
    controlPanel.add(holdButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    final JSeparator sep2 = new JSeparator(JSeparator.HORIZONTAL);
    sep2.setBackground(new Color(219, 228, 238));
    controlPanel.add(sep2, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    transferButton = new RosterMemberCallButton(PhoneRes.getImageIcon("TRANSFER_IMAGE").getImage(), PhoneRes.getIString("phone.transfer"));
    transferButton.setToolTipText(PhoneRes.getIString("phone.tips.transfer"));
    controlPanel.add(transferButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    // Add Components to Main Panel
    mainPanel.add(controlPanel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(2, 1, 2, 1), 0, 0));
    // Add End Call button
    hangUpButton = new RolloverButton("     " + PhoneRes.getIString("phone.hangup"), PhoneRes.getImageIcon("HANG_UP_PHONE_77x24_IMAGE"));
    hangUpButton.setHorizontalTextPosition(JLabel.CENTER);
    hangUpButton.setFont(new Font("Dialog", Font.BOLD, 11));
    hangUpButton.setForeground(new Color(153, 32, 10));
    hangUpButton.setMargin(new Insets(0, 0, 0, 0));
    mainPanel.add(hangUpButton, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.8, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    return mainPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) RosterMemberCallButton(org.jivesoftware.sparkplugin.components.RosterMemberCallButton) GridBagLayout(java.awt.GridBagLayout) ControlPanel(org.jivesoftware.sparkplugin.ui.components.ControlPanel) Color(java.awt.Color) JLabel(javax.swing.JLabel) RolloverButton(org.jivesoftware.spark.component.RolloverButton) JSeparator(javax.swing.JSeparator) Font(java.awt.Font)

Aggregations

Color (java.awt.Color)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JSeparator (javax.swing.JSeparator)1 RolloverButton (org.jivesoftware.spark.component.RolloverButton)1 RosterMemberCallButton (org.jivesoftware.sparkplugin.components.RosterMemberCallButton)1 ControlPanel (org.jivesoftware.sparkplugin.ui.components.ControlPanel)1