Some improvements

This commit is contained in:
7u83 2017-02-13 18:26:32 +01:00
parent 273dac9d26
commit 59ff1f3c0e
18 changed files with 533 additions and 152 deletions

View File

@ -68,11 +68,19 @@ public class Globals {
static final String TRADERPREFS = "Traders";
static final String DEVELSTATUS = "devel_status";
static final String GODMODE = "godmode";
public static final String GODMODE = "godmode";
static public sesim.Exchange se;
static public Preferences prefs;
public static class CfgStrings{
public static final String GODMODE = "godmode";
}
//CfgStrings
static void setLookAndFeel(String selected) {

View File

@ -59,7 +59,7 @@
</Component>
</SubComponents>
</Container>
<Component class="gui.OrderBookNew" name="orderBookNew1">
<Component class="gui.orderbook.OrderBookNew" name="orderBookNew1">
</Component>
</SubComponents>
</Form>
</Form>

View File

@ -85,7 +85,7 @@ public class LoggerDialog extends javax.swing.JDialog {
jScrollPane1 = new javax.swing.JScrollPane();
logArea = new javax.swing.JTextArea();
orderBookNew1 = new gui.OrderBookNew();
orderBookNew1 = new gui.orderbook.OrderBookNew();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -161,6 +161,6 @@ public class LoggerDialog extends javax.swing.JDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea logArea;
private gui.OrderBookNew orderBookNew1;
private gui.orderbook.OrderBookNew orderBookNew1;
// End of variables declaration//GEN-END:variables
}

View File

@ -168,6 +168,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem2ActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="viewClock">
<Properties>
<Property name="text" type="java.lang.String" value="Clock"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="viewClockActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem3">
<Properties>
<Property name="text" type="java.lang.String" value="LogWindow"/>
@ -176,13 +184,11 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem3ActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="viewClock">
<MenuItem class="javax.swing.JCheckBoxMenuItem" name="jCheckBoxMenuItem1">
<Properties>
<Property name="text" type="java.lang.String" value="Clock"/>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="jCheckBoxMenuItem1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="viewClockActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
@ -217,9 +223,6 @@
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[640, 480]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[800, 561]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/>
@ -236,62 +239,17 @@
<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,-2,0,0,3,14"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="oderBookPanelNew1" min="-2" pref="220" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jChartScrollPane" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
</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="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jChartScrollPane" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="oderBookPanelNew1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jChartScrollPane">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="chart.Chart" name="chart">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
@ -302,7 +260,7 @@
<Component id="jButton2" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="stopButton" min="-2" pref="63" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="374" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="clock" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
@ -420,7 +378,77 @@
</Component>
</SubComponents>
</Container>
<Component class="gui.OderBookPanelNew" name="oderBookPanelNew1">
</Component>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="orientation" type="int" value="0"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JSplitPane" name="jSplitPane2">
<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>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jChartScrollPane">
<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>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="chart.Chart" name="chart">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
<Component class="gui.orderbook.OrderBookNew" 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>
<Component class="gui.TraderListPanel" name="traderListPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
</Component>
<Component class="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>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -65,6 +65,8 @@ public class NewMDIApplication extends javax.swing.JFrame {
System.out.printf("!!!! creating new\n");
String base = cfg.getString("base");
AutoTraderInterface ac = Globals.tloader.getStrategyBase(base);
if (ac==null)
return null;
ac.putConfig(cfg);
ac.init(se, id, name, money, shares, cfg);
@ -142,8 +144,6 @@ public class NewMDIApplication extends javax.swing.JFrame {
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jChartScrollPane = new javax.swing.JScrollPane();
chart = new chart.Chart();
jPanel2 = new javax.swing.JPanel();
stopButton = new javax.swing.JButton();
runButton = new javax.swing.JButton();
@ -151,7 +151,13 @@ public class NewMDIApplication extends javax.swing.JFrame {
accelSpinner = new javax.swing.JSpinner();
clock = new gui.Clock();
jComboBox1 = new javax.swing.JComboBox<>();
oderBookPanelNew1 = new gui.OderBookPanelNew();
jSplitPane1 = new javax.swing.JSplitPane();
jSplitPane2 = new javax.swing.JSplitPane();
jChartScrollPane = new javax.swing.JScrollPane();
chart = new chart.Chart();
orderBookNew1 = new gui.orderbook.OrderBookNew();
traderListPanel1 = new gui.TraderListPanel();
orderBooksHorizontal1 = new gui.orderbook.OrderBooksHorizontal();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
@ -172,8 +178,9 @@ public class NewMDIApplication extends javax.swing.JFrame {
simMenuStop = new javax.swing.JMenuItem();
viewMenu = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
viewClock = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem();
helpMenu = new javax.swing.JMenu();
contentMenuItem = new javax.swing.JMenuItem();
aboutMenuItem = new javax.swing.JMenuItem();
@ -185,20 +192,6 @@ public class NewMDIApplication extends javax.swing.JFrame {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(640, 480));
setPreferredSize(new java.awt.Dimension(800, 561));
javax.swing.GroupLayout chartLayout = new javax.swing.GroupLayout(chart);
chart.setLayout(chartLayout);
chartLayout.setHorizontalGroup(
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
chartLayout.setVerticalGroup(
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
jChartScrollPane.setViewportView(chart);
stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Stop24.gif"))); // NOI18N
stopButton.setText("Stop");
@ -254,7 +247,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 374, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(clock, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
@ -282,6 +275,32 @@ public class NewMDIApplication extends javax.swing.JFrame {
.addContainerGap())))
);
getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START);
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
javax.swing.GroupLayout chartLayout = new javax.swing.GroupLayout(chart);
chart.setLayout(chartLayout);
chartLayout.setHorizontalGroup(
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
chartLayout.setVerticalGroup(
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
jChartScrollPane.setViewportView(chart);
jSplitPane2.setBottomComponent(jChartScrollPane);
jSplitPane2.setLeftComponent(orderBookNew1);
jSplitPane1.setTopComponent(jSplitPane2);
jSplitPane1.setRightComponent(traderListPanel1);
jSplitPane1.setBottomComponent(orderBooksHorizontal1);
getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);
fileMenu.setMnemonic('f');
fileMenu.setText("File");
@ -414,6 +433,14 @@ public class NewMDIApplication extends javax.swing.JFrame {
});
viewMenu.add(jMenuItem2);
viewClock.setText("Clock");
viewClock.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewClockActionPerformed(evt);
}
});
viewMenu.add(viewClock);
jMenuItem3.setText("LogWindow");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -422,13 +449,9 @@ public class NewMDIApplication extends javax.swing.JFrame {
});
viewMenu.add(jMenuItem3);
viewClock.setText("Clock");
viewClock.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewClockActionPerformed(evt);
}
});
viewMenu.add(viewClock);
jCheckBoxMenuItem1.setSelected(true);
jCheckBoxMenuItem1.setText("jCheckBoxMenuItem1");
viewMenu.add(jCheckBoxMenuItem1);
menuBar.add(viewMenu);
@ -452,32 +475,6 @@ public class NewMDIApplication extends javax.swing.JFrame {
setJMenuBar(menuBar);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(oderBookPanelNew1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jChartScrollPane)
.addContainerGap())
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jChartScrollPane)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(oderBookPanelNew1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
@ -697,6 +694,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
private javax.swing.JMenu helpMenu;
private javax.swing.JButton jButton2;
private javax.swing.JScrollPane jChartScrollPane;
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
@ -705,10 +703,13 @@ public class NewMDIApplication extends javax.swing.JFrame {
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JPopupMenu.Separator jSeparator2;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JSplitPane jSplitPane2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JMenuBar menuBar;
private gui.OderBookPanelNew oderBookPanelNew1;
private javax.swing.JMenuItem openMenuItem;
private gui.orderbook.OrderBookNew orderBookNew1;
private gui.orderbook.OrderBooksHorizontal orderBooksHorizontal1;
private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JButton runButton;
private javax.swing.JMenuItem saveAsMenuItem;
@ -718,6 +719,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
private javax.swing.JMenuItem simMenuStart;
private javax.swing.JMenuItem simMenuStop;
private javax.swing.JButton stopButton;
private gui.TraderListPanel traderListPanel1;
private javax.swing.JMenuItem viewClock;
private javax.swing.JMenu viewMenu;
// End of variables declaration//GEN-END:variables

View File

@ -56,9 +56,9 @@
<SubComponents>
<Component class="gui.QuotePanel" name="quotePanel1">
</Component>
<Component class="gui.OrderBookNew" name="orderBookNew3">
<Component class="gui.orderbook.OrderBookNew" name="orderBookNew3">
</Component>
<Component class="gui.OrderBookNew" name="orderBookNew4">
<Component class="gui.orderbook.OrderBookNew" name="orderBookNew4">
</Component>
<Component class="javax.swing.Box$Filler" name="filler1">
<Properties>
@ -71,4 +71,4 @@
</AuxValues>
</Component>
</SubComponents>
</Form>
</Form>

View File

@ -48,8 +48,8 @@ public class OderBookPanelNew extends javax.swing.JPanel {
private void initComponents() {
quotePanel1 = new gui.QuotePanel();
orderBookNew3 = new gui.OrderBookNew();
orderBookNew4 = new gui.OrderBookNew();
orderBookNew3 = new gui.orderbook.OrderBookNew();
orderBookNew4 = new gui.orderbook.OrderBookNew();
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);
@ -88,8 +88,8 @@ public class OderBookPanelNew extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.Box.Filler filler1;
private gui.OrderBookNew orderBookNew3;
private gui.OrderBookNew orderBookNew4;
private gui.orderbook.OrderBookNew orderBookNew3;
private gui.orderbook.OrderBookNew orderBookNew4;
private gui.QuotePanel quotePanel1;
// End of variables declaration//GEN-END:variables
}

View File

@ -23,11 +23,11 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="gui.OrderBookNew" name="orderBookNew1">
<Component class="gui.orderbook.OrderBookNew" name="orderBookNew1">
</Component>
<Component class="gui.QuotePanel" name="quotePanel1">
</Component>
<Component class="gui.OrderBookNew" name="orderBookNew2">
<Component class="gui.orderbook.OrderBookNew" name="orderBookNew2">
</Component>
</SubComponents>
</Form>
</Form>

View File

@ -48,9 +48,9 @@ public class OrderBookDialog extends javax.swing.JDialog {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
orderBookNew1 = new gui.OrderBookNew();
orderBookNew1 = new gui.orderbook.OrderBookNew();
quotePanel1 = new gui.QuotePanel();
orderBookNew2 = new gui.OrderBookNew();
orderBookNew2 = new gui.orderbook.OrderBookNew();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new java.awt.FlowLayout());
@ -104,8 +104,8 @@ public class OrderBookDialog extends javax.swing.JDialog {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private gui.OrderBookNew orderBookNew1;
private gui.OrderBookNew orderBookNew2;
private gui.orderbook.OrderBookNew orderBookNew1;
private gui.orderbook.OrderBookNew orderBookNew2;
private gui.QuotePanel quotePanel1;
// End of variables declaration//GEN-END:variables
}

View File

@ -16,12 +16,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="1" pref="400" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="1" pref="389" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="1" pref="300" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="1" pref="284" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View File

@ -23,8 +23,9 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package gui;
package gui.orderbook;
import gui.Globals;
import gui.Globals.CfgListener;
import java.util.ArrayList;
import javax.swing.table.DefaultTableModel;
@ -32,6 +33,7 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import sesim.Exchange;
import sesim.Exchange.Order;
import sesim.Exchange.OrderType;
/**
*
@ -41,6 +43,9 @@ public class OrderBookNew extends javax.swing.JPanel implements Exchange.BookRec
DefaultTableModel model;
TableColumn trader_column = null;
OrderType type = OrderType.BUYLIMIT;
int depth=40;
public void setGodMode(boolean on) {
TableColumnModel tcm = list.getColumnModel();
@ -57,23 +62,25 @@ public class OrderBookNew extends javax.swing.JPanel implements Exchange.BookRec
return;
}
tcm.removeColumn(tcm.getColumn(0));
}
}
/**
* Bla
*/
@Override
public void cfgChanged() {
boolean gm = Globals.prefs.get(Globals.GODMODE, "false").equals("true");
public final void cfgChanged() {
boolean gm = Globals.prefs.get(Globals.CfgStrings.GODMODE, "false").equals("true");
System.out.printf("GM %s\n",gm?"true":"false");
setGodMode(gm);
list.invalidate();
list.repaint();
}
public void setType(OrderType type){
this.type=type;
Globals.se.addBookReceiver(type, this);
}
/**
* Creates new form OrderBookNew
@ -85,13 +92,13 @@ public class OrderBookNew extends javax.swing.JPanel implements Exchange.BookRec
model = (DefaultTableModel) this.list.getModel();
trader_column = list.getColumnModel().getColumn(0);
cfgChanged();
Globals.se.addBookReceiver(Exchange.OrderType.BUYLIMIT, this);
// Globals.se.addBookReceiver(Exchange.OrderType.BUYLIMIT, this);
Globals.addCfgListener(this);
}
@Override
public void UpdateOrderBook() {
ArrayList<Order> ob = Globals.se.getOrderBook(Exchange.OrderType.SELLLIMIT, 40);
ArrayList<Order> ob = Globals.se.getOrderBook(type, depth);
model.setRowCount(ob.size());
int row = 0;
for (Order ob1 : ob) {
@ -147,11 +154,11 @@ public class OrderBookNew extends javax.swing.JPanel implements Exchange.BookRec
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 389, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<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,43"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="gui.orderbook.OrderBookNew" name="askBook">
</Component>
<Container class="gui.orderbook.QutoesHorizontal" name="qutoesHorizontal1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="77" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="296" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="gui.orderbook.OrderBookNew" name="bidBook">
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 2017, tobias
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package gui.orderbook;
import sesim.Exchange;
/**
*
* @author tobias
*/
public class OrderBooksHorizontal extends javax.swing.JPanel {
/**
* Creates new form OrderBooksHorizontal
*/
public OrderBooksHorizontal() {
initComponents();
askBook.setType(Exchange.OrderType.BUYLIMIT);
bidBook.setType(Exchange.OrderType.SELLLIMIT);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
askBook = new gui.orderbook.OrderBookNew();
qutoesHorizontal1 = new gui.orderbook.QutoesHorizontal();
bidBook = new gui.orderbook.OrderBookNew();
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
add(askBook);
javax.swing.GroupLayout qutoesHorizontal1Layout = new javax.swing.GroupLayout(qutoesHorizontal1);
qutoesHorizontal1.setLayout(qutoesHorizontal1Layout);
qutoesHorizontal1Layout.setHorizontalGroup(
qutoesHorizontal1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 77, Short.MAX_VALUE)
);
qutoesHorizontal1Layout.setVerticalGroup(
qutoesHorizontal1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 296, Short.MAX_VALUE)
);
add(qutoesHorizontal1);
add(bidBook);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private gui.orderbook.OrderBookNew askBook;
private gui.orderbook.OrderBookNew bidBook;
private gui.orderbook.QutoesHorizontal qutoesHorizontal1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<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"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" pref="140" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="110" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="175" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Price: 200.123"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,77 @@
/*
* Copyright (c) 2017, tobias
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package gui.orderbook;
/**
*
* @author tobias
*/
public class QutoesHorizontal extends javax.swing.JPanel {
/**
* Creates new form QutoesHorizontal
*/
public QutoesHorizontal() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Price: 200.123");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(110, 110, 110)
.addComponent(jLabel1)
.addContainerGap(175, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}

View File

@ -361,8 +361,13 @@ public class Exchange {
public final String CFG_SHARES_DECIMALS = "shares_decimals";
public void putConfig(JSONObject cfg) {
this.setMoneyDecimals(cfg.getInt(CFG_MONEY_DECIMALS));
this.setSharesDecimals(cfg.getInt(CFG_SHARES_DECIMALS));
try{
this.setMoneyDecimals(cfg.getInt(CFG_MONEY_DECIMALS));
this.setSharesDecimals(cfg.getInt(CFG_SHARES_DECIMALS));
}
catch (Exception e){
}
}
@ -434,8 +439,19 @@ public class Exchange {
}
public void addBookReceiver(OrderType t, BookReceiver br) {
if (br==null){
System.out.printf("Br is null\n");
}
else{
System.out.printf("Br is not Nukk\n");
}
ArrayList<BookReceiver> bookreceivers;
bookreceivers = selectBookReceiver(t);
if (bookreceivers == null){
System.out.printf("null in bookreceivers\n");
}
bookreceivers.add(br);
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<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,-104,0,0,1,67"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="3"/>
</Layout>
</Form>

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2017, tobias
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package sesim;
/**
*
* @author tobias
*/
public class NewJPanel extends javax.swing.JPanel {
/**
* Creates new form NewJPanel
*/
public NewJPanel() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.PAGE_AXIS));
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}