diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
index b83f0e6..06265af 100644
--- a/nbproject/private/private.xml
+++ b/nbproject/private/private.xml
@@ -23,22 +23,14 @@
file:/home/tube/NetBeansProjects/SeSim/src/gui/MainChart.java
file:/home/tube/NetBeansProjects/SeSim/src/chart/Chart.java
file:/home/tube/NetBeansProjects/SeSim/src/sesim/OHLCData.java
- file:/home/tube/NetBeansProjects/SeSim/src/resources/files/defaultcfg.json
- file:/home/tube/NetBeansProjects/SeSim/src/sesim/MinMax.java
- file:/home/tube/NetBeansProjects/SeSim/build.xml
- file:/home/tube/NetBeansProjects/SeSim/src/sesim/Exchange.java
file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderGui.java
+ file:/home/tube/NetBeansProjects/SeSim/src/gui/jp99.java
file:/home/tube/NetBeansProjects/SeSim/src/gui/orderbook/OrderBook.java
- file:/home/tube/NetBeansProjects/SeSim/src/gui/TraderListDialog.java
+ file:/home/tube/NetBeansProjects/SeSim/src/sesim/OHLCDataItem.java
file:/home/tube/NetBeansProjects/SeSim/src/gui/AboutDialog.java
- file:/home/tube/NetBeansProjects/SeSim/src/gui/OpenOrdersList.java
- file:/home/tube/NetBeansProjects/SeSim/src/gui/BidBook.java
- file:/home/tube/NetBeansProjects/SeSim/src/gui/EditAutoTraderList.java
- file:/home/tube/NetBeansProjects/SeSim/src/sesim/Scheduler.java
- file:/home/tube/NetBeansProjects/SeSim/src/gui/AskBook.java
- file:/home/tube/NetBeansProjects/SeSim/src/gui/TraderListPanel.java
- file:/home/tube/NetBeansProjects/SeSim/nbproject/jnlp-impl.xml
+ file:/home/tube/NetBeansProjects/SeSim/src/chart/Chart1.java
file:/home/tube/NetBeansProjects/SeSim/README.md
+ file:/home/tube/NetBeansProjects/SeSim/src/gui/TestChartdialog.java
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 8967fbc..968e4bd 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -1,4 +1,4 @@
-#Sun, 06 Aug 2017 13:02:54 +0200
+#Sun, 10 Sep 2017 00:32:21 +0200
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
@@ -84,6 +84,7 @@ manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
+project.license=bsd
run.classpath=${javac.classpath}\:${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
diff --git a/src/chart/Chart.java b/src/chart/Chart.java
index 8ad5915..8325453 100644
--- a/src/chart/Chart.java
+++ b/src/chart/Chart.java
@@ -42,7 +42,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
private int first_bar, last_bar;
-
/**
* Creates new form Chart
*/
@@ -60,8 +59,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
}
-
-
@Override
public Dimension getPreferredScrollableViewportSize() {
return this.getPreferredSize();
@@ -151,8 +148,8 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
if (xl_color != null) {
g.setColor(xl_color);
}
-
- g.drawLine(clip_bounds.x, y,clip_bounds.width,y);
+
+ g.drawLine(clip_bounds.x, y, clip_bounds.width, y);
Dimension dim = getSize();
@@ -213,7 +210,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
double getValAtY(float y) {
float val = 0;
-
if (c_mm.isLog()) {
float ys = rect.height / c_mm.getDiff();
@@ -223,25 +219,23 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
return (-(y - rect.y - rect.height)) / c_yscaling + c_mm.getMin();
-
}
}
-
- private void drawLineItem(RenderCtx ctx, int prevx, int x, OHLCDataItem prev, OHLCDataItem i){
- Graphics2D g = ctx.g;
- if (prev==null)
- prev=i;
- int y1 = (int)ctx.getY(prev.close);
- int y2 = (int)ctx.getY(i.close);
- Color cur = g.getColor();
- g.setColor(Color.RED);
- g.drawLine(prevx,y1,x,y2);
- g.setColor(cur);
- }
-
-
+ private void drawLineItem(RenderCtx ctx, int prevx, int x, OHLCDataItem prev, OHLCDataItem i) {
+ Graphics2D g = ctx.g;
+ if (prev == null) {
+ prev = i;
+ }
+ int y1 = (int) ctx.getY(prev.close);
+ int y2 = (int) ctx.getY(i.close);
+ Color cur = g.getColor();
+ g.setColor(Color.RED);
+ g.drawLine(prevx, y1, x, y2);
+ g.setColor(cur);
+ }
+
private void drawCandleItem(RenderCtx ctx, int prevx, int x, OHLCDataItem prev, OHLCDataItem i) {
Graphics2D g = ctx.g;
@@ -403,16 +397,16 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
public OHLCData data;
public Color bgcolor = null;
-
+
/**
* logarithmic scaling
*/
- public boolean log=false;
+ public boolean log = false;
}
protected OHLCData data;
-
+
ArrayList charts = new ArrayList<>();
protected void addChart(SubChartDef d) {
@@ -421,21 +415,18 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
}
-
void drawAll(Graphics2D g) {
int pwidth = (int) (em_width * x_unit_width * (num_bars + 1)) + clip_bounds.width;
this.setPreferredSize(new Dimension(pwidth, gdim.height));
this.revalidate();
int h1 = 0;
-
-
for (SubChartDef d : charts) {
-
- if (d.data==null){
+
+ if (d.data == null) {
System.out.printf("Data is null\n");
- System.exit(0);
+ System.exit(0);
}
// calclulate the min/max values
@@ -486,9 +477,9 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
}
}
-
- protected void setupSubCharts(){
-
+
+ protected void setupSubCharts() {
+
}
private void draw(Graphics2D g) {
@@ -499,10 +490,9 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
if (data.size() == 0) {
return;
}
-
+
// Point m = MouseInfo.getPointerInfo().getLocation() ;
// g.drawLine(0, m.y, 1000, m.y);
-
int pwidth = (int) (em_width * x_unit_width * (num_bars + 1)) + clip_bounds.width;
this.setPreferredSize(new Dimension(pwidth, gdim.height));
@@ -530,10 +520,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
lastvpos = p0;
}
-
-
-
-
this.charts = new ArrayList<>();
setupSubCharts();
@@ -554,7 +540,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
Rectangle c_rect0;
- private void draw2(Graphics2D g) {
+ /*private void draw2(Graphics2D g) {
if (data == null) {
return;
@@ -653,7 +639,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
drawChart(ctx);
}
-
+*/
private float c_font_height;
@Override
@@ -661,8 +647,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
if (Globals.se == null) {
return;
}
-
-
super.paintComponent(g);
@@ -721,7 +705,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
}// //GEN-END:initComponents
private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
-
+
}//GEN-LAST:event_formMouseMoved
@Override
diff --git a/src/chart/Chart1.java b/src/chart/Chart1.java
index f5da290..5e0fcf4 100644
--- a/src/chart/Chart1.java
+++ b/src/chart/Chart1.java
@@ -1,14 +1,17 @@
package chart;
+import gui.Globals;
import java.awt.Cursor;
import java.awt.Graphics;
+import sesim.Exchange.QuoteReceiver;
+import sesim.Quote;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
-public class Chart1 extends javax.swing.JPanel {
+public class Chart1 extends javax.swing.JPanel implements QuoteReceiver{
/**
* Creates new form Chart1
@@ -17,14 +20,26 @@ public class Chart1 extends javax.swing.JPanel {
initComponents();
System.out.printf("Now cursor\n");
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
-
+
+ if (Globals.se == null)
+ return;
+
+ Globals.se.addQuoteReceiver(this);
}
-
+
+ private int em_width;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
+
+
+ // Calculate the number of pixels for 1 em
+ em_width = g.getFontMetrics().stringWidth("M");
+
+
+
g.drawLine(0, 0, 10, 10);
}
@@ -50,6 +65,11 @@ public class Chart1 extends javax.swing.JPanel {
);
}// //GEN-END:initComponents
+ @Override
+ public void UpdateQuote(Quote q) {
+ System.out.printf("%s\n",q.price);
+ }
+
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
diff --git a/src/gui/ChartPanel.form b/src/gui/ChartPanel.form
deleted file mode 100644
index c638b68..0000000
--- a/src/gui/ChartPanel.form
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
diff --git a/src/gui/ChartPanel.java b/src/gui/ChartPanel.java
deleted file mode 100644
index a533576..0000000
--- a/src/gui/ChartPanel.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package gui;
-
-/**
- *
- * @author 7u83 <7u83@mail.ru>
- */
-public class ChartPanel extends javax.swing.JPanel {
-
- /**
- * Creates new form ChartPanel
- */
- public ChartPanel() {
- 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")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 400, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 300, Short.MAX_VALUE)
- );
- }// //GEN-END:initComponents
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- // End of variables declaration//GEN-END:variables
-}
diff --git a/src/gui/SeSimApplication.form b/src/gui/SeSimApplication.form
index 9e9fd6b..ce65759 100644
--- a/src/gui/SeSimApplication.form
+++ b/src/gui/SeSimApplication.form
@@ -481,6 +481,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/gui/SeSimApplication.java b/src/gui/SeSimApplication.java
index d1b3a06..b6a2f91 100644
--- a/src/gui/SeSimApplication.java
+++ b/src/gui/SeSimApplication.java
@@ -90,6 +90,7 @@ public class SeSimApplication extends javax.swing.JFrame {
Globals.prefs.putBoolean("initilized", true);
}
this.chartSrollPane.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_NEVER);
+
//this.setLocationRelativeTo(null);
}
@@ -191,6 +192,7 @@ public class SeSimApplication extends javax.swing.JFrame {
quoteVertical1 = new gui.orderbook.QuoteVertical();
jSplitPane5 = new javax.swing.JSplitPane();
statistics1 = new gui.Statistics();
+ chart11 = new chart.Chart1();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
openMenuItem = new javax.swing.JMenuItem();
@@ -344,6 +346,19 @@ public class SeSimApplication extends javax.swing.JFrame {
jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane5.setTopComponent(statistics1);
+ javax.swing.GroupLayout chart11Layout = new javax.swing.GroupLayout(chart11);
+ chart11.setLayout(chart11Layout);
+ chart11Layout.setHorizontalGroup(
+ chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 104, Short.MAX_VALUE)
+ );
+ chart11Layout.setVerticalGroup(
+ chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 235, Short.MAX_VALUE)
+ );
+
+ jSplitPane5.setRightComponent(chart11);
+
jSplitPane3.setLeftComponent(jSplitPane5);
getContentPane().add(jSplitPane3, java.awt.BorderLayout.CENTER);
@@ -913,6 +928,7 @@ public class SeSimApplication extends javax.swing.JFrame {
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JSpinner accelSpinner;
private gui.MainChart chart;
+ private chart.Chart1 chart11;
private javax.swing.JScrollPane chartSrollPane;
private javax.swing.JMenuItem clearMenuItem;
private gui.Clock clock;
diff --git a/src/gui/TestChartdialog.form b/src/gui/TestChartdialog.form
new file mode 100644
index 0000000..109aa6b
--- /dev/null
+++ b/src/gui/TestChartdialog.form
@@ -0,0 +1,73 @@
+
+
+
diff --git a/src/gui/TestChartdialog.java b/src/gui/TestChartdialog.java
new file mode 100644
index 0000000..ecad82e
--- /dev/null
+++ b/src/gui/TestChartdialog.java
@@ -0,0 +1,124 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package gui;
+
+import java.awt.Cursor;
+
+/**
+ *
+ * @author 7u83 <7u83@mail.ru>
+ */
+public class TestChartdialog extends javax.swing.JDialog {
+
+ /**
+ * Creates new form TestChartdialog
+ */
+ public TestChartdialog(java.awt.Frame parent, boolean modal) {
+ super(parent, modal);
+ 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jButton1 = new javax.swing.JButton();
+ chart1 = new chart.Chart();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ jButton1.setText("jButton1");
+
+ javax.swing.GroupLayout chart1Layout = new javax.swing.GroupLayout(chart1);
+ chart1.setLayout(chart1Layout);
+ chart1Layout.setHorizontalGroup(
+ chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 0, Short.MAX_VALUE)
+ );
+ chart1Layout.setVerticalGroup(
+ chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 386, Short.MAX_VALUE)
+ );
+
+ 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()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGap(0, 548, Short.MAX_VALUE)
+ .addComponent(jButton1))
+ .addComponent(chart1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(chart1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton1)
+ .addGap(27, 27, 27))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
+ * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
+ */
+ try {
+ for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ javax.swing.UIManager.setLookAndFeel(info.getClassName());
+ break;
+ }
+ }
+ } catch (ClassNotFoundException ex) {
+ java.util.logging.Logger.getLogger(TestChartdialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(TestChartdialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(TestChartdialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(TestChartdialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the dialog */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ TestChartdialog dialog = new TestChartdialog(new javax.swing.JFrame(), true);
+ dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+ @Override
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ dialog.setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private chart.Chart chart1;
+ private javax.swing.JButton jButton1;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/src/gui/jp99.form b/src/gui/jp99.form
new file mode 100644
index 0000000..2e8cc49
--- /dev/null
+++ b/src/gui/jp99.form
@@ -0,0 +1,59 @@
+
+
+
diff --git a/src/gui/jp99.java b/src/gui/jp99.java
new file mode 100644
index 0000000..606f805
--- /dev/null
+++ b/src/gui/jp99.java
@@ -0,0 +1,69 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package gui;
+
+/**
+ *
+ * @author 7u83 <7u83@mail.ru>
+ */
+public class jp99 extends javax.swing.JPanel {
+
+ /**
+ * Creates new form jp99
+ */
+ public jp99() {
+ 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ chart11 = new chart.Chart1();
+
+ javax.swing.GroupLayout chart11Layout = new javax.swing.GroupLayout(chart11);
+ chart11.setLayout(chart11Layout);
+ chart11Layout.setHorizontalGroup(
+ chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 382, Short.MAX_VALUE)
+ );
+ chart11Layout.setVerticalGroup(
+ chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 282, Short.MAX_VALUE)
+ );
+
+ jScrollPane1.setViewportView(chart11);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private chart.Chart1 chart11;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/src/sesim/Clock.java b/src/sesim/Clock.java
index 0db7039..5122321 100644
--- a/src/sesim/Clock.java
+++ b/src/sesim/Clock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, tobias
+ * Copyright (c) 2017, 7u83
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without