OpenSeSim/src/gui/orderbook/OrderBooksHorizontal.java

142 lines
6.3 KiB
Java

/*
* 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 gui.Globals;
import sesim.Exchange;
/**
*
* @author tobias
*/
public class OrderBooksHorizontal extends javax.swing.JPanel {
/**
* Creates new form OrderBooksHorizontal
*/
public OrderBooksHorizontal() {
initComponents();
if (Globals.se==null)
return;
bidBook.setType(Exchange.OrderType.BUYLIMIT);
askBook.setType(Exchange.OrderType.SELLLIMIT);
}
public void setDepth(int depth){
bidBook.depth=depth;
askBook.depth=depth;
}
/**
* 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() {
bidBookPanel = new javax.swing.JPanel();
bidBook = new gui.orderbook.OrderBook();
jLabel2 = new javax.swing.JLabel();
quoteVertical2 = new gui.orderbook.QuoteVertical();
askBookPanel = new javax.swing.JPanel();
askBook = new gui.orderbook.OrderBook();
jLabel1 = new javax.swing.JLabel();
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
bidBookPanel.setPreferredSize(new java.awt.Dimension(320, 296));
jLabel2.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Bid");
javax.swing.GroupLayout bidBookPanelLayout = new javax.swing.GroupLayout(bidBookPanel);
bidBookPanel.setLayout(bidBookPanelLayout);
bidBookPanelLayout.setHorizontalGroup(
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))
.addContainerGap())
);
bidBookPanelLayout.setVerticalGroup(
bidBookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.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))
);
add(bidBookPanel);
add(quoteVertical2);
askBookPanel.setPreferredSize(new java.awt.Dimension(320, 296));
jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Ask");
javax.swing.GroupLayout askBookPanelLayout = new javax.swing.GroupLayout(askBookPanel);
askBookPanel.setLayout(askBookPanelLayout);
askBookPanelLayout.setHorizontalGroup(
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))
.addContainerGap())
);
askBookPanelLayout.setVerticalGroup(
askBookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.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))
);
add(askBookPanel);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private gui.orderbook.OrderBook askBook;
private javax.swing.JPanel askBookPanel;
private gui.orderbook.OrderBook bidBook;
private javax.swing.JPanel bidBookPanel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private gui.orderbook.QuoteVertical quoteVertical2;
// End of variables declaration//GEN-END:variables
}