Removed dead code
This commit is contained in:
parent
53f839a41b
commit
9b33636b91
28
src/chart/ChartPanel.form
Normal file
28
src/chart/ChartPanel.form
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?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">
|
||||||
|
<EmptySpace min="0" pref="498" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="341" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
</Form>
|
126
src/chart/ChartPanel.java
Normal file
126
src/chart/ChartPanel.java
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package chart;
|
||||||
|
|
||||||
|
import gui.Globals;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.AdjustmentEvent;
|
||||||
|
import java.awt.event.AdjustmentListener;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import javax.swing.JScrollBar;
|
||||||
|
import javax.swing.JViewport;
|
||||||
|
import javax.swing.Scrollable;
|
||||||
|
import sesim.Exchange.QuoteReceiver;
|
||||||
|
import sesim.OHLCData;
|
||||||
|
import sesim.OHLCDataItem;
|
||||||
|
import sesim.Quote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class ChartPanel extends javax.swing.JPanel implements QuoteReceiver, AdjustmentListener {
|
||||||
|
|
||||||
|
public JScrollBar xbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form Chart1
|
||||||
|
*/
|
||||||
|
public ChartPanel() {
|
||||||
|
initComponents();
|
||||||
|
System.out.printf("Now cursor\n");
|
||||||
|
|
||||||
|
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
||||||
|
|
||||||
|
if (Globals.se == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSize(new Dimension(9000, 500));
|
||||||
|
Globals.se.addQuoteReceiver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ArrayList <ChartPainter> chartPainters = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param p
|
||||||
|
*/
|
||||||
|
public void addChartPainter(ChartPainter p){
|
||||||
|
chartPainters.add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OHLCData data;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintComponent(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
|
||||||
|
if (Globals.se==null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
//this.xbar.setMaximum(994000);
|
||||||
|
|
||||||
|
XLegendChartPainter p = new XLegendChartPainter();
|
||||||
|
data = Globals.se.getOHLCdata(60000*60);
|
||||||
|
|
||||||
|
ChartDef def = new ChartDef();
|
||||||
|
def.x_unit_width = 1.0;
|
||||||
|
def.x_scrollbar=xbar;
|
||||||
|
|
||||||
|
|
||||||
|
for (ChartPainter painter: chartPainters){
|
||||||
|
painter.drawChart((Graphics2D)g, xbar, data, this, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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() {
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 498, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 341, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void UpdateQuote(Quote q) {
|
||||||
|
|
||||||
|
int s = data.size();
|
||||||
|
System.out.printf("Data size %d",s);
|
||||||
|
// xbar.setMaximum(data.size());
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void adjustmentValueChanged(AdjustmentEvent e) {
|
||||||
|
System.out.printf("Adjustemntlistener called %d\n", xbar.getValue());
|
||||||
|
|
||||||
|
this.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user