📄 page_bill.jad
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 2007-6-14 15:25:34
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: Page_Bill.java
package gnnt.MEBS.HQApplet;
import gnnt.MEBS.hq.BillDataVO;
import gnnt.MEBS.hq.ProductDataVO;
import gnnt.util.service.HQVO.CMDBillVO;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Hashtable;
import java.util.Vector;
// Referenced classes of package gnnt.MEBS.HQApplet:
// Page_Main, MenuListener, HQApplet, ProductData,
// SendThread, BillFieldInfo, CodeTable, RHColor,
// Common
public class Page_Bill extends Page_Main
{
void AskForDataOnTimer()
{
ProductData stock = super.m_applet.GetProductData(super.m_applet.strCurrentCode);
CMDBillVO packet = new CMDBillVO();
packet.code = super.m_applet.strCurrentCode;
packet.type = 0;
if(stock != null && stock.vBill != null && stock.vBill.size() > 0)
packet.time = ((BillDataVO)stock.vBill.lastElement()).time;
super.m_applet.sendThread.AskForData(packet);
}
void AskForDataOnce()
{
CMDBillVO packet = new CMDBillVO();
packet.code = super.m_applet.strCurrentCode;
packet.type = 0;
packet.time = 0;
super.m_applet.sendThread.AskForData(packet);
}
public Page_Bill(Rectangle _rc, HQApplet applet)
{
super(_rc, applet);
zoomRate = 1.0F;
curPageNo = 0;
iRows = 0;
super.m_applet.iCurrentPage = 4;
AskForDataOnce();
makeMenus();
iProductType = super.m_applet.getProductType(super.m_applet.strCurrentCode);
fieldInfo = (new BillFieldInfo[] {
new BillFieldInfo(super.m_applet.getShowString("Time"), true, 64), new BillFieldInfo(super.m_applet.getShowString("Price"), true, 70), new BillFieldInfo(super.m_applet.getShowString("CurVol"), true, 60), new BillFieldInfo(super.m_applet.getShowString("Dingli"), true, 50), new BillFieldInfo(super.m_applet.getShowString("ZhuanRang"), true, 50)
});
}
void Paint(Graphics g)
{
initVisibleField();
initPageInfo(g);
paintTitle(g);
paintBillData(g);
}
void paintTitle(Graphics g)
{
FontMetrics fm = null;
String sCode = "";
if(stock != null)
sCode = stock.sCode;
CodeTable stockTable = (CodeTable)super.m_applet.m_htProduct.get(sCode);
String title = "";
String sName = "";
if(stockTable != null)
sName = stockTable.sName;
if(sName.equals(sCode))
sName = "";
title = title + sName + " " + sCode + " " + super.m_applet.getShowString("TradeList");
int x = super.m_rc.x;
int y = super.m_rc.y;
g.setFont(fntTitle);
fm = g.getFontMetrics();
g.setColor(HQApplet.rhColor.clProductName);
x += (super.m_rc.width - fm.stringWidth(title)) / 2;
if(x < 0)
x = 0;
g.drawString(title, x, y + fm.getAscent());
x = super.m_rc.x;
y = super.m_rc.y + fm.getHeight();
g.setColor(HQApplet.rhColor.clGrid);
g.drawRect(x, y, (x + super.m_rc.width) - 1, super.m_rc.height - fm.getHeight());
for(int i = 1; i < 3; i++)
g.drawLine(x + (super.m_rc.width / 3) * i, y, x + (super.m_rc.width / 3) * i, (y + super.m_rc.height) - fm.getHeight());
g.setFont(fntText);
fm = g.getFontMetrics();
g.drawLine(x, y + fm.getHeight() + 2, (x + super.m_rc.width) - 1, y + fm.getHeight() + 2);
startY = y + fm.getHeight() + 4 + fm.getAscent();
g.setColor(HQApplet.rhColor.clItem);
int fieldNum = fieldInfo.length;
y += fm.getAscent() + 1;
for(int i = 0; i < 3; i++)
{
x = super.m_rc.x + (super.m_rc.width / 3) * i;
for(int j = 0; j < fieldNum; j++)
{
if(!fieldInfo[j].visible)
break;
x = (int)((float)x + (float)fieldInfo[j].width * zoomRate);
String str = fieldInfo[j].name;
int strWidth = fm.stringWidth(str);
g.drawString(str, x - strWidth, y);
}
}
String strText = super.m_applet.getShowString("PagePrefix") + (totalPages - curPageNo) + super.m_applet.getShowString("PageSuffix") + " " + super.m_applet.getShowString("TotalPagePrefix") + totalPages + super.m_applet.getShowString("TotalPageSuffix");
g.setColor(HQApplet.rhColor.clGrid);
g.drawString(strText, (super.m_rc.x + super.m_rc.width) - fm.stringWidth(strText), (super.m_rc.y + y) - fm.getHeight() - fm.getDescent());
}
void paintBillData(Graphics g)
{
if(stock == null || stock.realData == null || stock.vBill == null)
return;
int iPrecision = super.m_applet.GetPrecision(stock.sCode);
g.setFont(fntText);
FontMetrics fm = g.getFontMetrics();
int iShow = iRows * 3;
int iSize = stock.vBill.size();
if(iSize <= 0)
return;
if(iSize < iShow)
iShow = iSize;
int x = super.m_rc.x;
int y = startY;
int iStart = iSize - iShow * (curPageNo + 1);
if(iStart < 0)
iStart = 0;
int iEnd = iStart + iShow;
if(iEnd > iSize)
{
iEnd = iSize;
iStart = iEnd - iShow;
if(iStart <= 0)
iStart = 1;
}
for(int i = iStart; i < iEnd; i++)
{
x = super.m_rc.x;
x += (super.m_rc.width / 3) * ((i - iStart) / iRows);
if((i - iStart) % iRows == 0)
y = startY;
BillDataVO billPre = null;
if(i > 0)
billPre = (BillDataVO)stock.vBill.elementAt(i - 1);
BillDataVO bill = (BillDataVO)stock.vBill.elementAt(i);
if(fieldInfo[0].visible)
{
DecimalFormat df = new DecimalFormat("#,#0");
String str = df.format(bill.time);
if(str.length() != 8)
str = "0" + str;
str = str.replace(',', ':');
g.setColor(HQApplet.rhColor.clNumber);
x = (int)((float)x + (float)fieldInfo[0].width * zoomRate);
g.drawString(str, x - fm.stringWidth(str), y);
}
if(fieldInfo[1].visible)
{
String str = Common.FloatToString(bill.curPrice, iPrecision);
if(bill.curPrice > stock.realData.yesterBalancePrice)
g.setColor(HQApplet.rhColor.clIncrease);
else
if(bill.curPrice < stock.realData.yesterBalancePrice)
g.setColor(HQApplet.rhColor.clDecrease);
else
g.setColor(HQApplet.rhColor.clEqual);
x = (int)((float)x + (float)fieldInfo[1].width * zoomRate);
g.drawString(str, x - fm.stringWidth(str), y);
}
if(fieldInfo[2].visible)
{
String str;
if(billPre == null)
str = String.valueOf(bill.totalAmount);
else
str = String.valueOf((int)(bill.totalAmount - billPre.totalAmount));
g.setColor(HQApplet.rhColor.clVolume);
x = (int)((float)x + ((float)fieldInfo[2].width * zoomRate - 16F));
g.drawString(str, x - fm.stringWidth(str), y);
if(iProductType != 2 && iProductType != 3)
{
byte ask;
if(billPre == null)
ask = 2;
else
if(billPre.buyPrice <= 0.001F)
ask = 1;
else
if(bill.curPrice >= billPre.sellPrice)
ask = 0;
else
if(bill.curPrice <= billPre.buyPrice)
{
ask = 1;
} else
{
int sell = (int)((billPre.sellPrice - bill.curPrice) * 1000F);
float buy = (int)((bill.curPrice - billPre.buyPrice) * 1000F);
if((float)sell < buy)
ask = 0;
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -