use of com.moneychanger.ui.model.ContactDetailsTableModel in project otapij by FellowTraveler.
the class AddressBookDialog method populateContactDetails.
private void populateContactDetails(ContactDetails contactDetails, int mode) {
this.contactDetails = contactDetails;
if (contactDetails != null) {
jTextField1.setText(contactDetails.getLabel());
jTextField2.setText(contactDetails.getEmail());
jTextArea1.setText(contactDetails.getPublicKey());
jTextArea2.setText(contactDetails.getMemo());
List list = mode == 1 ? contactDetails.getContactAccts() : contactDetails.getContactNyms();
((ContactDetailsTableModel) jTable6.getModel()).setValue(list);
}
}
use of com.moneychanger.ui.model.ContactDetailsTableModel in project otapij by FellowTraveler.
the class AddressBookDialog method jButton4ActionPerformed.
//GEN-LAST:event_jTable6MouseClicked
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton4ActionPerformed
String value = "account";
boolean status = false;
if (mode == 2) {
value = "nym";
}
if (jTable6.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(null, "Please select contact " + value, "Contact Error", JOptionPane.ERROR_MESSAGE);
return;
}
List list = null;
if (mode == 1) {
status = AddressBookHelper.removeContactAcct(contactID, jTable6.getSelectedRow());
list = AddressBookHelper.getContactDetails(contactID, mode).getContactAccts();
} else if (mode == 2) {
status = AddressBookHelper.removeContactNym(contactID, jTable6.getSelectedRow());
list = AddressBookHelper.getContactDetails(contactID, mode).getContactNyms();
}
if (status) {
JOptionPane.showMessageDialog(null, "Contact " + value + " deleted successfull", "Contact Account", JOptionPane.INFORMATION_MESSAGE);
((ContactDetailsTableModel) jTable6.getModel()).setValue(list);
clearDetails(mode);
} else {
JOptionPane.showMessageDialog(null, "Cannot delete contact " + value, "Contact Error", JOptionPane.ERROR_MESSAGE);
}
}
use of com.moneychanger.ui.model.ContactDetailsTableModel in project otapij by FellowTraveler.
the class AddressBookDialog method initValues.
private void initValues() {
ContactTableModel.removeCols(jTable5);
switch(mode) {
case 1:
{
jRadioButton1.setSelected(true);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Account List" });
System.out.println("In case1");
}
break;
case 2:
{
jRadioButton2.setSelected(true);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Nym List" });
}
break;
case 3:
break;
default:
break;
}
((ContactTableModel) jTable5.getModel()).setValue(AddressBookHelper.getContactList());
jPanel3.setLayout(new CardLayout());
jPanel3.add(new BlankPanel(), "BlankPanel");
jPanel3.add(new ContactNymPanel(), "ContactNymPanel");
jPanel3.add(new ContactAcctPanel(), "ContactAcctPanel");
jTable6.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
if (jTable6.getSelectedRow() >= 0) {
CardLayout cardLayout = (CardLayout) jPanel3.getLayout();
if (mode == 1) {
cardLayout.show(jPanel3, "ContactAcctPanel");
contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
if (contactDetails != null) {
ContactAcctPanel.setValues(jTable6.getSelectedRow(), contactID);
ContactAcctPanel.populateDetails(AddressBookHelper.getContactAccDetails(contactDetails.getContact(), jTable6.getSelectedRow()));
}
// Set details panel here
} else if (mode == 2) {
cardLayout.show(jPanel3, "ContactNymPanel");
contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
if (contactDetails != null) {
ContactNymPanel.setValues(jTable6.getSelectedRow(), contactID);
ContactNymPanel.populateDetails(AddressBookHelper.getContactNymDetails(contactDetails.getContact(), jTable6.getSelectedRow()));
}
} else {
cardLayout.show(jPanel3, "BlankPanel");
}
}
}
});
jTable5.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
if (jTable5.getSelectedRow() >= 0) {
if (!jRadioButton1.isSelected() && !jRadioButton2.isSelected()) {
JOptionPane.showMessageDialog(null, "Please select mode", "Mode Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (jRadioButton2.isSelected()) {
jButton2.setEnabled(false);
jButton3.setEnabled(true);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Nym List" });
mode = 2;
} else if (jRadioButton1.isSelected()) {
jButton2.setEnabled(true);
jButton3.setEnabled(false);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Account List" });
mode = 1;
}
contactID = (String) jTable5.getModel().getValueAt(jTable5.getSelectedRow(), 1);
ContactDetails contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
populateContactDetails(contactDetails, mode);
}
}
});
}
Aggregations