Building the new OrderBookPanel
This commit is contained in:
parent
e2c15eff1c
commit
0397dc44a9
@ -18,48 +18,22 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="quotePanel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="orderBookNew3" alignment="1" pref="585" max="32767" attributes="0"/>
|
||||
<Component id="orderBookNew4" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="597" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="orderBookNew3" min="-2" pref="156" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="70" max="-2" attributes="0"/>
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
|
||||
<Component id="quotePanel1" min="-2" pref="91" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="orderBookNew4" min="-2" pref="176" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="238" max="-2" attributes="0"/>
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="245" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="gui.QuotePanel" name="quotePanel1">
|
||||
</Component>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew3">
|
||||
</Component>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew4">
|
||||
</Component>
|
||||
<Component class="javax.swing.Box$Filler" name="filler1">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
@ -71,4 +45,4 @@
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
@ -47,9 +47,6 @@ public class OderBookPanelNew extends javax.swing.JPanel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
quotePanel1 = new opensesim.gui.QuotePanel();
|
||||
orderBookNew3 = new opensesim.gui.orderbook.OrderBook();
|
||||
orderBookNew4 = new opensesim.gui.orderbook.OrderBook();
|
||||
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
@ -58,38 +55,20 @@ public class OderBookPanelNew extends javax.swing.JPanel {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(quotePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(orderBookNew3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE)
|
||||
.addComponent(orderBookNew4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(597, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(orderBookNew3, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(70, 70, 70)
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(30, 30, 30)
|
||||
.addComponent(quotePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(orderBookNew4, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGap(238, 238, 238)
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(245, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.Box.Filler filler1;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew3;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew4;
|
||||
private opensesim.gui.QuotePanel quotePanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -22,12 +22,4 @@
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew1">
|
||||
</Component>
|
||||
<Component class="gui.QuotePanel" name="quotePanel1">
|
||||
</Component>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew2">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
@ -48,15 +48,8 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
orderBookNew1 = new opensesim.gui.orderbook.OrderBook();
|
||||
quotePanel1 = new opensesim.gui.QuotePanel();
|
||||
orderBookNew2 = new opensesim.gui.orderbook.OrderBook();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
getContentPane().setLayout(new java.awt.FlowLayout());
|
||||
getContentPane().add(orderBookNew1);
|
||||
getContentPane().add(quotePanel1);
|
||||
getContentPane().add(orderBookNew2);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
@ -104,8 +97,5 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew1;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew2;
|
||||
private opensesim.gui.QuotePanel quotePanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -33,15 +33,6 @@
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="opensesim.gui.orderbook.OrderBook" name="orderBookNew1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
@ -464,13 +455,6 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="opensesim.gui.orderbook.OrderBooksHorizontal" name="orderBooksHorizontal1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="bottom"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="opensesim.chart.MasterChart" name="chart">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
@ -480,13 +464,6 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="opensesim.gui.orderbook.QuoteVertical" name="quoteVertical1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane5">
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
@ -498,15 +475,6 @@
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="opensesim.gui.Statistics" name="statistics1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="top"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
@ -200,7 +200,6 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
jTextArea1 = new javax.swing.JTextArea();
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
jSplitPane2 = new javax.swing.JSplitPane();
|
||||
orderBookNew1 = new opensesim.gui.orderbook.OrderBook();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
stopButton = new javax.swing.JButton();
|
||||
runButton = new javax.swing.JButton();
|
||||
@ -210,11 +209,8 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jSplitPane3 = new javax.swing.JSplitPane();
|
||||
jSplitPane4 = new javax.swing.JSplitPane();
|
||||
orderBooksHorizontal1 = new opensesim.gui.orderbook.OrderBooksHorizontal();
|
||||
chart = new opensesim.chart.MasterChart();
|
||||
quoteVertical1 = new opensesim.gui.orderbook.QuoteVertical();
|
||||
jSplitPane5 = new javax.swing.JSplitPane();
|
||||
statistics1 = new opensesim.gui.Statistics();
|
||||
menuBar = new javax.swing.JMenuBar();
|
||||
fileMenu = new javax.swing.JMenu();
|
||||
openMenuItem = new javax.swing.JMenuItem();
|
||||
@ -253,9 +249,6 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
jScrollPane2.setViewportView(jTextArea1);
|
||||
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
|
||||
jSplitPane2.setLeftComponent(orderBookNew1);
|
||||
|
||||
jSplitPane1.setTopComponent(jSplitPane2);
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
@ -353,15 +346,11 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
jSplitPane4.setDividerLocation(300);
|
||||
jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane4.setBottomComponent(orderBooksHorizontal1);
|
||||
jSplitPane4.setLeftComponent(chart);
|
||||
|
||||
jSplitPane3.setRightComponent(jSplitPane4);
|
||||
jSplitPane3.setLeftComponent(quoteVertical1);
|
||||
|
||||
jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane5.setTopComponent(statistics1);
|
||||
|
||||
jSplitPane3.setLeftComponent(jSplitPane5);
|
||||
|
||||
getContentPane().add(jSplitPane3, java.awt.BorderLayout.CENTER);
|
||||
@ -919,8 +908,10 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}//GEN-LAST:event_stopButtonActionPerformed
|
||||
|
||||
private void jCheckBoxMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuItem1ActionPerformed
|
||||
JDialog jd = new opensesim.gui.orderbook.OrderBookDialog(this, false);
|
||||
jd.setVisible(rootPaneCheckingEnabled);
|
||||
// JDialog jd = new opensesim.gui.orderbook.OrderBookDialog(this, false);
|
||||
// jd.setVisible(rootPaneCheckingEnabled);
|
||||
opensesim.gui.orderbook.OrderBookDialog.runDialog(this, godworld);
|
||||
|
||||
}//GEN-LAST:event_jCheckBoxMenuItem1ActionPerformed
|
||||
|
||||
TraderListDialog tld = null;
|
||||
@ -1106,10 +1097,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private javax.swing.JTextArea jTextArea1;
|
||||
private javax.swing.JMenuBar menuBar;
|
||||
private javax.swing.JMenuItem openMenuItem;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew1;
|
||||
private opensesim.gui.orderbook.OrderBooksHorizontal orderBooksHorizontal1;
|
||||
private javax.swing.JMenuItem pasteMenuItem;
|
||||
private opensesim.gui.orderbook.QuoteVertical quoteVertical1;
|
||||
private javax.swing.JMenuItem resetToDefaultsMenuItem;
|
||||
private javax.swing.JButton runButton;
|
||||
private javax.swing.JMenuItem saveAsMenuItem;
|
||||
@ -1118,7 +1106,6 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private javax.swing.JMenuItem simMenuPause;
|
||||
private javax.swing.JMenuItem simMenuStart;
|
||||
private javax.swing.JMenuItem simMenuStop;
|
||||
private opensesim.gui.Statistics statistics1;
|
||||
private javax.swing.JButton stopButton;
|
||||
private javax.swing.JMenu viewMenu;
|
||||
private javax.swing.JCheckBoxMenuItem viewTraderListCheckBox;
|
||||
|
@ -25,8 +25,8 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="books" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="orderBookPanel1" pref="418" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -34,14 +34,17 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="books" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="orderBookPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="gui.orderbook.OrderBooksHorizontal" name="books">
|
||||
<Component class="opensesim.gui.orderbook.OrderBookPanel" name="orderBookPanel1">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new opensesim.gui.orderbook.OrderBookPanel(godworld)"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -25,6 +25,10 @@
|
||||
*/
|
||||
package opensesim.gui.orderbook;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import opensesim.world.GodWorld;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
@ -37,7 +41,19 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
public OrderBookDialog(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
books.setDepth(1000000);
|
||||
// books.setDepth(1000000);
|
||||
}
|
||||
|
||||
GodWorld godworld;
|
||||
|
||||
|
||||
static public void runDialog(Frame parent, GodWorld godworld){
|
||||
OrderBookDialog d = new OrderBookDialog(parent,false);
|
||||
d.godworld=godworld;
|
||||
d.setVisible(true);
|
||||
// d.dispose();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,7 +65,7 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
books = new opensesim.gui.orderbook.OrderBooksHorizontal();
|
||||
orderBookPanel1 = new opensesim.gui.orderbook.OrderBookPanel(godworld);
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
@ -59,14 +75,14 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(books, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(orderBookPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(books, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(orderBookPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
@ -116,6 +132,6 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.orderbook.OrderBooksHorizontal books;
|
||||
private opensesim.gui.orderbook.OrderBookPanel orderBookPanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -26,32 +26,53 @@
|
||||
package opensesim.gui.orderbook;
|
||||
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.gui.Globals.CfgListener;
|
||||
import opensesim.gui.util.NummericCellRenderer;
|
||||
import java.awt.Component;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import opensesim.old_sesim.Exchange;
|
||||
import opensesim.old_sesim.Order;
|
||||
import opensesim.old_sesim.Order.OrderType;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.Order;
|
||||
|
||||
|
||||
import opensesim.world.TradingAPI;
|
||||
import opensesim.world.scheduler.Event;
|
||||
import opensesim.world.scheduler.EventListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class OrderBook extends javax.swing.JPanel implements Exchange.BookReceiver, CfgListener {
|
||||
public class OrderBookPanel extends javax.swing.JPanel implements EventListener {
|
||||
|
||||
DefaultTableModel model;
|
||||
TableColumn trader_column = null;
|
||||
|
||||
TradingAPI api=null;
|
||||
|
||||
@Override
|
||||
public long receive(Event task) {
|
||||
synchronized (this) {
|
||||
if (oupdate) {
|
||||
new_oupdate = true;
|
||||
return 0;
|
||||
}
|
||||
oupdate = true;
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
oupdater();
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
class Renderer extends DefaultTableCellRenderer {
|
||||
|
||||
@ -76,7 +97,7 @@ public class OrderBook extends javax.swing.JPanel implements Exchange.BookReceiv
|
||||
}
|
||||
}
|
||||
|
||||
OrderType type = OrderType.BUYLIMIT;
|
||||
// OrderType type = OrderType.BUYLIMIT;
|
||||
int depth = 40;
|
||||
|
||||
public void setGodMode(boolean on) {
|
||||
@ -99,35 +120,42 @@ public class OrderBook extends javax.swing.JPanel implements Exchange.BookReceiv
|
||||
/**
|
||||
* Bla
|
||||
*/
|
||||
@Override
|
||||
/* @Override
|
||||
public final void cfgChanged() {
|
||||
boolean gm = Globals.prefs.get(Globals.CfgStrings.GODMODE, "false").equals("true");
|
||||
setGodMode(gm);
|
||||
list.invalidate();
|
||||
list.repaint();
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public void setType(OrderType type) {
|
||||
this.type = type;
|
||||
Globals.se.addBookReceiver(type, this);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
GodWorld godworld;
|
||||
/**
|
||||
* Creates new form OrderBookNew
|
||||
*/
|
||||
public OrderBook() {
|
||||
public OrderBookPanel(GodWorld godworld) {
|
||||
initComponents();
|
||||
|
||||
if (Globals.se == null) {
|
||||
if (Globals.world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.godworld = godworld;
|
||||
|
||||
model = (DefaultTableModel) this.list.getModel();
|
||||
trader_column = list.getColumnModel().getColumn(0);
|
||||
list.getColumnModel().getColumn(1).setCellRenderer(new NummericCellRenderer(3));
|
||||
list.getColumnModel().getColumn(2).setCellRenderer(new NummericCellRenderer(0));
|
||||
cfgChanged();
|
||||
// cfgChanged();
|
||||
// Globals.se.addBookReceiver(Exchange.OrderType.BUYLIMIT, this);
|
||||
Globals.addCfgListener(this);
|
||||
// Globals.addCfgListener(this);
|
||||
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
@ -145,7 +173,10 @@ public class OrderBook extends javax.swing.JPanel implements Exchange.BookReceiv
|
||||
long ouctr = 0;
|
||||
|
||||
void oupdater() {
|
||||
ArrayList<Order> ob = Globals.se.getOrderBook(type, depth);
|
||||
// ArrayList<Order> ob = Globals.se.getOrderBook(type, depth);
|
||||
|
||||
Collection <Order> ob = api.getOrderBook(Order.Type.BUY);
|
||||
|
||||
model.setRowCount(ob.size());
|
||||
int row = 0;
|
||||
for (Order ob1 : ob) {
|
||||
@ -168,7 +199,7 @@ public class OrderBook extends javax.swing.JPanel implements Exchange.BookReceiv
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Override
|
||||
public void UpdateOrderBook() {
|
||||
|
||||
synchronized (this) {
|
@ -11,7 +11,7 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,40,0,0,3,-60"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,116,0,0,3,-60"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
@ -28,10 +28,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="bidBook" pref="244" max="32767" attributes="0"/>
|
||||
<Component id="jLabel2" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jLabel2" pref="458" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -41,15 +38,12 @@
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="bidBook" pref="269" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="345" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="opensesim.gui.orderbook.OrderBook" name="bidBook">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
@ -61,8 +55,6 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="opensesim.gui.orderbook.QuoteVertical" name="quoteVertical2">
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="askBookPanel">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
@ -75,10 +67,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="askBook" pref="244" max="32767" attributes="0"/>
|
||||
<Component id="jLabel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jLabel1" pref="458" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -88,15 +77,12 @@
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="askBook" pref="269" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="345" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="opensesim.gui.orderbook.OrderBook" name="askBook">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
|
@ -43,13 +43,13 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
if (Globals.se==null)
|
||||
return;
|
||||
|
||||
bidBook.setType(OrderType.BUYLIMIT);
|
||||
askBook.setType(OrderType.SELLLIMIT);
|
||||
// bidBook.setType(OrderType.BUYLIMIT);
|
||||
// askBook.setType(OrderType.SELLLIMIT);
|
||||
}
|
||||
|
||||
public void setDepth(int depth){
|
||||
bidBook.depth=depth;
|
||||
askBook.depth=depth;
|
||||
// bidBook.depth=depth;
|
||||
// askBook.depth=depth;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,11 +62,8 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
private void initComponents() {
|
||||
|
||||
bidBookPanel = new javax.swing.JPanel();
|
||||
bidBook = new opensesim.gui.orderbook.OrderBook();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
quoteVertical2 = new opensesim.gui.orderbook.QuoteVertical();
|
||||
askBookPanel = new javax.swing.JPanel();
|
||||
askBook = new opensesim.gui.orderbook.OrderBook();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
|
||||
@ -83,9 +80,7 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
bidBookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(bidBookPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(bidBookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(bidBook, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
bidBookPanelLayout.setVerticalGroup(
|
||||
@ -93,12 +88,10 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, bidBookPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(bidBook, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE))
|
||||
.addContainerGap(345, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
add(bidBookPanel);
|
||||
add(quoteVertical2);
|
||||
|
||||
askBookPanel.setPreferredSize(new java.awt.Dimension(320, 296));
|
||||
|
||||
@ -112,9 +105,7 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
askBookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(askBookPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(askBookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(askBook, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
askBookPanelLayout.setVerticalGroup(
|
||||
@ -122,8 +113,7 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, askBookPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(askBook, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE))
|
||||
.addContainerGap(345, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
add(askBookPanel);
|
||||
@ -131,12 +121,9 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.orderbook.OrderBook askBook;
|
||||
private javax.swing.JPanel askBookPanel;
|
||||
private opensesim.gui.orderbook.OrderBook bidBook;
|
||||
private javax.swing.JPanel bidBookPanel;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private opensesim.gui.orderbook.QuoteVertical quoteVertical2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user