use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.
the class CustomTable method prepareRenderer.
public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
if (c instanceof JComponent) {
JComponent jc = (JComponent) c;
if (getValueAt(rowIndex, vColIndex) instanceof String) {
//Utility.getKeyFromName((String)getValueAt(rowIndex, vColIndex));
String value = (String) getValueAt(rowIndex, vColIndex);
if (this.getModel() instanceof AccountTableModel && vColIndex == 0) {
value = (String) this.getModel().getValueAt(rowIndex, 3);
}
if (this.getModel() instanceof NYMTableModel && vColIndex == 0) {
value = (String) this.getModel().getValueAt(rowIndex, 1);
}
if (this.getModel() instanceof BasketTableModel && vColIndex == 0) {
value = (String) this.getModel().getValueAt(rowIndex, 1);
}
if (this.getModel() instanceof AssetContractTableModel && vColIndex == 0) {
value = (String) this.getModel().getValueAt(rowIndex, 1);
}
if (this.getModel() instanceof ServerContractTableModel && vColIndex == 0) {
value = (String) this.getModel().getValueAt(rowIndex, 1);
}
if (this.getModel() instanceof OTOutboxTableModel) {
if (vColIndex == 4)
value = (String) this.getModel().getValueAt(rowIndex, 8);
if (vColIndex == 5)
value = (String) this.getModel().getValueAt(rowIndex, 9);
}
if (this.getModel() instanceof OTInboxTableModel) {
if (vColIndex == 4)
value = (String) this.getModel().getValueAt(rowIndex, 10);
if (vColIndex == 5)
value = (String) this.getModel().getValueAt(rowIndex, 11);
}
if (this.getModel() instanceof NYMOutboxTableModel) {
if (vColIndex == 1)
value = (String) this.getModel().getValueAt(rowIndex, 4);
if (vColIndex == 2)
value = (String) this.getModel().getValueAt(rowIndex, 5);
}
if (this.getModel() instanceof NYMBoxTableModel) {
if (vColIndex == 1)
value = (String) this.getModel().getValueAt(rowIndex, 4);
if (vColIndex == 2)
value = (String) this.getModel().getValueAt(rowIndex, 5);
}
jc.setToolTipText(value);
}
}
return c;
}
use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.
the class MainPage method jComboBox7ActionPerformed.
//GEN-LAST:event_jTabbedPane_MainPageStateChanged
private void jComboBox7ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jComboBox7ActionPerformed
String currentServerID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
}
System.out.println("Server dropdown currentServerID:" + currentServerID);
List baskets = Basket.getBasketList(currentServerID, null);
System.out.println("baskets:" + baskets);
System.out.println("baskets.size():" + baskets.size());
if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
((BasketTableModel) jTable19.getModel()).setValue(baskets);
} else if (baskets != null && baskets.size() != 0) {
// Show dialog asking for register
new RegisterNymOnServerDialog(this, true, currentServerID).setVisible(true);
if (!Utility.VerifyStringVal(Helpers.getNymID())) {
return;
}
String nymID = Helpers.getNymID();
((BasketTableModel) jTable19.getModel()).setValue(Basket.getBasketList(currentServerID, nymID));
}
jTextField9.setText("");
jTextField11.setText("");
jLabel62.setText("");
}
use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.
the class MainPage method initBasketsTab.
private void initBasketsTab() {
Helpers.populateComboWithoutAll(serverMap, jComboBox7);
BasketTableModel.removeCols(jTable19);
jLabel62.setText("");
String currentServerID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
}
List baskets = Basket.getBasketList(currentServerID, null);
System.out.println("baskets:" + baskets);
System.out.println("baskets.size():" + baskets.size());
if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
((BasketTableModel) jTable19.getModel()).setValue(baskets);
} else if (baskets != null && !baskets.isEmpty()) {
// Show dialog asking for register
new RegisterNymOnServerDialog(this, true, currentServerID).setVisible(true);
if (!Utility.VerifyStringVal(Helpers.getNymID())) {
return;
}
String nymID = Helpers.getNymID();
((BasketTableModel) jTable19.getModel()).setValue(Basket.getBasketList(currentServerID, nymID));
}
jTable19.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("jTable19 valueChanged Basket List Action Listener :" + jTable19.getSelectedRow() + "e:" + e.getSource());
basketClick();
}
});
}
use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.
the class MainPage method jButton32ActionPerformed.
private void jButton32ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton32ActionPerformed
if (jTable19.getSelectedRow() > -1) {
String assetID = (String) jTable19.getModel().getValueAt(jTable19.getSelectedRow(), 1);
new AssetContractEditDialog(this, true, (String) jTable19.getModel().getValueAt(jTable19.getSelectedRow(), 1)).setVisible(true);
refreshAssetContractList();
String currentServerID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
}
System.out.println("currentServerID:" + currentServerID);
List baskets = Basket.getBasketList(currentServerID, null);
if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
((BasketTableModel) jTable19.getModel()).setValue(baskets);
if (Utility.VerifyStringVal(assetID)) {
for (int i = 0; i < jTable19.getRowCount(); i++) {
String id = (String) jTable19.getModel().getValueAt(i, 1);
if (!Utility.VerifyStringVal(id)) {
continue;
}
if (assetID.equals(id)) {
jTable19.setRowSelectionInterval(i, i);
break;
}
}
}
}
} else {
JOptionPane.showMessageDialog(this, "Please select an Asset Contract to edit.", "Asset Contract Edit Error", JOptionPane.ERROR_MESSAGE);
}
}
use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.
the class MainPage method setAssets.
public static void setAssets(String serverID, String assetID) {
List baskets = Basket.getBasketList(serverID, null);
if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
((BasketTableModel) jTable19.getModel()).setValue(baskets);
}
refreshAssetContractList();
if (Utility.VerifyStringVal(assetID)) {
for (int i = 0; i < jTable19.getRowCount(); i++) {
String id = (String) jTable19.getModel().getValueAt(i, 1);
if (!Utility.VerifyStringVal(id)) {
continue;
}
if (assetID.equals(id)) {
jTable19.setRowSelectionInterval(i, i);
break;
}
}
}
}
Aggregations