Search in sources :

Example 16 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class JingleRoom 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 Volume Control
    try {
        final ControlPanel inputPanel = new ControlPanel(new GridBagLayout());
        Component inputComp = mixer.getPrefferedInputVolume();
        if (inputComp != null) {
            final JLabel inputIcon = new JLabel(JinglePhoneRes.getImageIcon("MICROPHONE_IMAGE"));
            inputPanel.add(inputComp, 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, 50));
        }
    } catch (Exception e) {
        Log.error(e);
    }
    // Add master volume control.
    try {
        final ControlPanel outputPanel = new ControlPanel(new GridBagLayout());
        Component outputControl = mixer.getPrefferedMasterVolume();
        if (outputControl != null) {
            final JLabel outputIcon = new JLabel(JinglePhoneRes.getImageIcon("SPEAKER_IMAGE"));
            outputPanel.add(outputControl, 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, 50));
        }
    } catch (Exception e) {
        Log.error(e);
    }
    // Build ControlPanel List
    muteButton = new CallPanelButton(JinglePhoneRes.getImageIcon("MUTE_IMAGE").getImage(), "Mute");
    muteButton.setToolTipText(JingleResources.getString("label.mute.call"));
    // Add Components to Main Panel
    mainPanel.add(muteButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 1, 2, 1), 0, 0));
    // Add End Call button
    hangUpButton = new RolloverButton("     End Call", JinglePhoneRes.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.SOUTH, 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) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) JLabel(javax.swing.JLabel) Component(java.awt.Component) RolloverButton(org.jivesoftware.spark.component.RolloverButton) SmackException(org.jivesoftware.smack.SmackException) XMPPException(org.jivesoftware.smack.XMPPException) Font(java.awt.Font)

Example 17 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class MissedCalls method getMissedCallPanel.

public JPanel getMissedCallPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.add(new JScrollPane(list), new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    callBackButton = new RolloverButton(PhoneRes.getIString("phone.callback"), PhoneRes.getImageIcon("PHONE_CALL_24x24_IMAGE"));
    deleteButton = new RolloverButton(PhoneRes.getIString("phone.delete"), PhoneRes.getImageIcon("DELETE_24x24_IMAGE"));
    callBackButton.setHorizontalAlignment(JLabel.CENTER);
    deleteButton.setHorizontalAlignment(JLabel.CENTER);
    final Font buttonFont = new Font("Dialog", Font.BOLD, 13);
    callBackButton.setFont(buttonFont);
    deleteButton.setFont(buttonFont);
    // Add Action Listener
    callBackButton.addActionListener(this);
    deleteButton.addActionListener(this);
    // Set as disabled by default, and only have them enabled if their is a valid
    // selection.
    callBackButton.setEnabled(false);
    deleteButton.setEnabled(false);
    final JPanel flowPanel = new JPanel(new FlowLayout());
    flowPanel.setOpaque(false);
    flowPanel.add(callBackButton);
    flowPanel.add(deleteButton);
    panel.setOpaque(false);
    panel.add(flowPanel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) RolloverButton(org.jivesoftware.spark.component.RolloverButton) Font(java.awt.Font)

Example 18 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class RosterMemberPanel method buildTopPanel.

/**
 * Builds the information block.
 *
 * @return the UI representing the Information Block.
 */
private JPanel buildTopPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    // Add phone label
    phoneLabel = new JLabel();
    phoneLabel.setFont(new Font("Arial", Font.BOLD, 13));
    phoneLabel.setForeground(new Color(64, 103, 162));
    panel.add(phoneLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 2, 2, 2), 0, 0));
    // Add Dial Pad
    final RolloverButton dialPadButton = new RolloverButton(PhoneRes.getImageIcon("ICON_NUMBERPAD_IMAGE"));
    panel.add(dialPadButton, new GridBagConstraints(1, 0, 1, 3, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 2, 2, 2), 0, 0));
    final PhonePad pad = new PhonePad();
    dialPadButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            pad.showDialpad(dialPadButton, true);
        }
    });
    // Add Connected Label
    connectedLabel = new JLabel(CONNECTED);
    connectedLabel.setFont(new Font("Arial", Font.BOLD, 13));
    connectedLabel.setHorizontalTextPosition(JLabel.CENTER);
    connectedLabel.setHorizontalAlignment(JLabel.CENTER);
    panel.add(connectedLabel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) Color(java.awt.Color) PhonePad(org.jivesoftware.sparkplugin.ui.PhonePad) JLabel(javax.swing.JLabel) RolloverButton(org.jivesoftware.spark.component.RolloverButton) Font(java.awt.Font)

Example 19 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton 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)

Example 20 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class PhonebookUI method init.

private void init() {
    this.removeAll();
    model = new DefaultTableModel() {

        private static final long serialVersionUID = -1231025049889503785L;

        public boolean isCellEditable(int i, int j) {
            return false;
        }
    };
    sorter = new TableRowSorter<TableModel>(model);
    table = new JTable(model);
    JPanel pbtn = new JPanel();
    JPanel psearch = new JPanel();
    tfsearch = new JTextField();
    JScrollPane scroll = new JScrollPane(table);
    table.setRowSorter(sorter);
    table.getTableHeader().setReorderingAllowed(false);
    btnAdd = new RolloverButton(PhoneRes.getIString("btn.add"));
    btnDel = new RolloverButton(PhoneRes.getIString("btn.del"));
    btnEdit = new RolloverButton(PhoneRes.getIString("btn.edit"));
    btnDial = new RolloverButton(PhoneRes.getIString("btn.dial"));
    // add icons
    btnAdd.setIcon(new ImageIcon(PhoneRes.getImage("ADDICON").getScaledInstance(iconwidth, iconheight, Image.SCALE_SMOOTH)));
    btnDel.setIcon(new ImageIcon(PhoneRes.getImage("DELICON").getScaledInstance(iconwidth, iconheight, Image.SCALE_SMOOTH)));
    btnEdit.setIcon(new ImageIcon(PhoneRes.getImage("EDITICON").getScaledInstance(iconwidth, iconheight, Image.SCALE_SMOOTH)));
    btnDial.setIcon(new ImageIcon(PhoneRes.getImage("DIALICON").getScaledInstance(iconwidth, iconheight, Image.SCALE_SMOOTH)));
    // add actionlisteners
    btnAdd.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            btnAddPerformed();
        }
    });
    btnDel.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            int[] selected = table.getSelectedRows();
            if (selected.length == 0) {
                JOptionPane.showMessageDialog(PhonebookUI.this, PhoneRes.getIString("book.noEntry"), PhoneRes.getIString("book.warning"), JOptionPane.WARNING_MESSAGE);
            }
            for (int select : selected) {
                if (select > -1) {
                    manager.deleteEntry(table.getValueAt(select, 0).toString(), table.getValueAt(select, 1).toString());
                    model.removeRow(sorter.convertRowIndexToModel(select));
                }
            }
            loadEntries();
        }
    });
    btnEdit.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            int selected = table.getSelectedRow();
            if (selected > -1) {
                btnEditPerformed(table.getValueAt(selected, 0).toString(), table.getValueAt(selected, 1).toString());
            } else {
                JOptionPane.showMessageDialog(PhonebookUI.this, PhoneRes.getIString("book.noEntry"), PhoneRes.getIString("book.warning"), JOptionPane.WARNING_MESSAGE);
            }
        }
    });
    btnDial.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            int selected = table.getSelectedRow();
            if (selected > -1) {
                final SoftPhoneManager phoneManager = SoftPhoneManager.getInstance();
                if (phoneManager.getInterlocutors().size() > 0) {
                    phoneManager.getDefaultGuiManager().hangupAll();
                } else {
                    phoneManager.getDefaultGuiManager().dial(table.getValueAt(selected, 1).toString());
                }
            } else {
                JOptionPane.showMessageDialog(PhonebookUI.this, PhoneRes.getIString("book.noEntry"), PhoneRes.getIString("book.warning"), JOptionPane.WARNING_MESSAGE);
            }
        }
    });
    sorter.addRowSorterListener(new RowSorterListener() {

        public void sorterChanged(RowSorterEvent arg0) {
            TableRowSorter<?> rs = (TableRowSorter<?>) arg0.getSource();
            String temp = tfsearch.getText();
            if (model.getRowCount() > 0 && rs.getViewRowCount() < 1) {
                // nur wenn auch was drin steht, erkennen
                if (temp.length() > 0) {
                    tfsearch.setText(temp.substring(0, temp.length() - 1));
                }
                filterTable(tfsearch.getText());
            } else if (table.getRowCount() > 0) {
                table.setRowSelectionInterval(0, 0);
            }
        }
    });
    tfsearch.addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent evt) {
            keyReleasedSuchFeld(evt);
            if (table.getRowCount() > 0) {
                table.setRowSelectionInterval(0, 0);
            }
        }
    });
    loadEntries();
    // add components to layout
    pbtn.setLayout(new BoxLayout(pbtn, BoxLayout.X_AXIS));
    pbtn.setBorder(new EmptyBorder(5, 5, 5, 5));
    pbtn.add(Box.createHorizontalGlue());
    pbtn.add(btnDial);
    pbtn.add(Box.createHorizontalStrut(5));
    pbtn.add(btnAdd);
    pbtn.add(Box.createHorizontalStrut(5));
    pbtn.add(btnEdit);
    pbtn.add(Box.createHorizontalStrut(5));
    pbtn.add(btnDel);
    pbtn.add(Box.createHorizontalGlue());
    psearch.setLayout(new BoxLayout(psearch, BoxLayout.X_AXIS));
    psearch.setBorder(new EmptyBorder(5, 5, 5, 5));
    psearch.add(new JLabel(PhoneRes.getIString("book.search") + ":"));
    psearch.add(tfsearch);
    this.setLayout(new BorderLayout());
    this.add(psearch, BorderLayout.NORTH);
    this.add(pbtn, BorderLayout.SOUTH);
    this.add(scroll, BorderLayout.CENTER);
    tfsearch.requestFocusInWindow();
    frame.setLayout(new BorderLayout());
    frame.add(this, BorderLayout.CENTER);
    frame.setTitle(PhoneRes.getIString("frame.title"));
    frame.setSize(new Dimension(400, 300));
    frame.setIconImage(SparkRes.getImageIcon(SparkRes.ADDRESS_BOOK_16x16).getImage());
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) ActionEvent(java.awt.event.ActionEvent) DefaultTableModel(javax.swing.table.DefaultTableModel) KeyAdapter(java.awt.event.KeyAdapter) BoxLayout(javax.swing.BoxLayout) JTextField(javax.swing.JTextField) RolloverButton(org.jivesoftware.spark.component.RolloverButton) KeyEvent(java.awt.event.KeyEvent) BorderLayout(java.awt.BorderLayout) RowSorterListener(javax.swing.event.RowSorterListener) EmptyBorder(javax.swing.border.EmptyBorder) TableRowSorter(javax.swing.table.TableRowSorter) JScrollPane(javax.swing.JScrollPane) SoftPhoneManager(net.java.sipmack.softphone.SoftPhoneManager) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable) RowSorterEvent(javax.swing.event.RowSorterEvent) TableModel(javax.swing.table.TableModel) DefaultTableModel(javax.swing.table.DefaultTableModel)

Aggregations

RolloverButton (org.jivesoftware.spark.component.RolloverButton)25 JPanel (javax.swing.JPanel)12 GridBagConstraints (java.awt.GridBagConstraints)11 GridBagLayout (java.awt.GridBagLayout)11 Insets (java.awt.Insets)11 Font (java.awt.Font)7 Color (java.awt.Color)6 JLabel (javax.swing.JLabel)6 BorderLayout (java.awt.BorderLayout)4 JScrollPane (javax.swing.JScrollPane)4 SmackException (org.jivesoftware.smack.SmackException)4 XMPPException (org.jivesoftware.smack.XMPPException)4 FlowLayout (java.awt.FlowLayout)3 ActionEvent (java.awt.event.ActionEvent)3 JTextField (javax.swing.JTextField)3 Dimension (java.awt.Dimension)2 ActionListener (java.awt.event.ActionListener)2 KeyEvent (java.awt.event.KeyEvent)2 MouseEvent (java.awt.event.MouseEvent)2 Collection (java.util.Collection)2