Search in sources :

Example 1 with ControlPanel

use of org.jivesoftware.sparkplugin.ui.components.ControlPanel 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)

Example 2 with ControlPanel

use of org.jivesoftware.sparkplugin.ui.components.ControlPanel 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

GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Insets (java.awt.Insets)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 ControlPanel (org.jivesoftware.sparkplugin.ui.components.ControlPanel)2 Color (java.awt.Color)1 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 Font (java.awt.Font)1 JComponent (javax.swing.JComponent)1 JSeparator (javax.swing.JSeparator)1 RolloverButton (org.jivesoftware.spark.component.RolloverButton)1 CallPanelButton (org.jivesoftware.sparkplugin.components.CallPanelButton)1 EndCallButton (org.jivesoftware.sparkplugin.components.EndCallButton)1 RedialButton (org.jivesoftware.sparkplugin.components.RedialButton)1 RosterMemberCallButton (org.jivesoftware.sparkplugin.components.RosterMemberCallButton)1