use of net.java.sipmack.softphone.SoftPhoneManager 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);
}
});
}
use of net.java.sipmack.softphone.SoftPhoneManager 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);
}
});
}
use of net.java.sipmack.softphone.SoftPhoneManager in project Spark by igniterealtime.
the class ContactDialControl method placeCall.
private void placeCall() {
if (incomingCall) {
SoftPhoneManager.getInstance().getDefaultGuiManager().answer();
enableIt(false);
} else {
final SoftPhoneManager phoneManager = SoftPhoneManager.getInstance();
if (phoneManager.getInterlocutors().size() > 0) {
phoneManager.getDefaultGuiManager().hangupAll();
} else {
phoneManager.getDefaultGuiManager().dial(callField.getText());
}
}
}
use of net.java.sipmack.softphone.SoftPhoneManager 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());
}
Aggregations