Margin display
This commit is contained in:
parent
3a01f672eb
commit
f7c2b6266e
@ -36,9 +36,10 @@
|
|||||||
<Component class="javax.swing.JTable" name="assetTable">
|
<Component class="javax.swing.JTable" name="assetTable">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||||
<Table columnCount="2" rowCount="2">
|
<Table columnCount="3" rowCount="2">
|
||||||
<Column editable="false" title="Asset" type="java.lang.String"/>
|
<Column editable="false" title="Asset" type="java.lang.String"/>
|
||||||
<Column editable="false" title="Ammount" type="java.lang.String"/>
|
<Column editable="false" title="Ammount" type="java.lang.String"/>
|
||||||
|
<Column editable="false" title="Margin" type="java.lang.String"/>
|
||||||
</Table>
|
</Table>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
||||||
|
@ -36,14 +36,14 @@ import opensesim.world.Account;
|
|||||||
*
|
*
|
||||||
* @author tube
|
* @author tube
|
||||||
*/
|
*/
|
||||||
public class AccountPanel extends javax.swing.JPanel implements EventListener{
|
public class AccountPanel extends javax.swing.JPanel implements EventListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form AccountPanel
|
* Creates new form AccountPanel
|
||||||
*/
|
*/
|
||||||
public AccountPanel() {
|
public AccountPanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
assetTable.setAutoCreateRowSorter(true);
|
assetTable.setAutoCreateRowSorter(true);
|
||||||
assetTable.getTableHeader().setReorderingAllowed(false);
|
assetTable.getTableHeader().setReorderingAllowed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,17 +54,22 @@ public class AccountPanel extends javax.swing.JPanel implements EventListener{
|
|||||||
model = (DefaultTableModel) this.assetTable.getModel();
|
model = (DefaultTableModel) this.assetTable.getModel();
|
||||||
|
|
||||||
Map<AbstractAsset, Double> am = account.getAssets();
|
Map<AbstractAsset, Double> am = account.getAssets();
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
model.setRowCount(am.size());
|
model.setRowCount(am.size());
|
||||||
for (AbstractAsset a : am.keySet()) {
|
for (AbstractAsset a : am.keySet()) {
|
||||||
Double val = account.get(a);
|
Double val = account.get(a);
|
||||||
Double avail = account.getAvail(a);
|
Double avail = account.getAvail(a);
|
||||||
String astr = val.toString()+"/"+avail.toString();
|
String astr = val.toString() + "/" + avail.toString();
|
||||||
|
|
||||||
|
Double mval = account.getMargin(a);
|
||||||
|
Double mavail = account.getAvail(a);
|
||||||
|
String mastr = mval.toString(); // + "/" + mavail.toString();
|
||||||
|
|
||||||
// model.setValueAt(ob1.getAccount().getOwner().getName(), row, 0);
|
// model.setValueAt(ob1.getAccount().getOwner().getName(), row, 0);
|
||||||
model.setValueAt(a.getSymbol(), row, 0);
|
model.setValueAt(a.getSymbol(), row, 0);
|
||||||
model.setValueAt(astr, row, 1);
|
model.setValueAt(astr, row, 1);
|
||||||
|
model.setValueAt(mastr, row, 2);
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,18 +89,18 @@ public class AccountPanel extends javax.swing.JPanel implements EventListener{
|
|||||||
|
|
||||||
assetTable.setModel(new javax.swing.table.DefaultTableModel(
|
assetTable.setModel(new javax.swing.table.DefaultTableModel(
|
||||||
new Object [][] {
|
new Object [][] {
|
||||||
{null, null},
|
{null, null, null},
|
||||||
{null, null}
|
{null, null, null}
|
||||||
},
|
},
|
||||||
new String [] {
|
new String [] {
|
||||||
"Asset", "Ammount"
|
"Asset", "Ammount", "Margin"
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class[] types = new Class [] {
|
Class[] types = new Class [] {
|
||||||
java.lang.String.class, java.lang.String.class
|
java.lang.String.class, java.lang.String.class, java.lang.String.class
|
||||||
};
|
};
|
||||||
boolean[] canEdit = new boolean [] {
|
boolean[] canEdit = new boolean [] {
|
||||||
false, false
|
false, false, false
|
||||||
};
|
};
|
||||||
|
|
||||||
public Class getColumnClass(int columnIndex) {
|
public Class getColumnClass(int columnIndex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user