📄 page_marketstatus.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: Page_MarketStatus.java
package gnnt.MEBS.HQApplet;
import gnnt.util.service.HQVO.CMDMarketSortVO;
import gnnt.util.service.HQVO.MarketStatusVO;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.PrintStream;
import java.util.Hashtable;
// Referenced classes of package gnnt.MEBS.HQApplet:
// Page_Main, MenuListener, HQApplet, SendThread,
// RHColor, Pos, CodeTable, Common,
// Packet_MarketStatus
public class Page_MarketStatus extends Page_Main
{
byte currentStockType;
int iCount;
int iHighlightRowIndex;
int iHighlightColIndex;
static Pos pos[][];
Font font;
FontMetrics fm;
MenuItem menuQuote;
MenuItem menuMinLine;
MenuItem menuKLine;
static final int RANK_RATE = 0;
static final int RANK_AMOUNTRATE = 5;
static final int RANK_CONSIGNRATE = 6;
static final int RANK_TOTALMONEY = 8;
static String STOCK_RANK_NAME[][];
Packet_MarketStatus packetInfo;
MarketStatusVO statusData[];
void AskForDataOnTimer()
{
CMDMarketSortVO packet = new CMDMarketSortVO();
iCount = getICount();
packet.num = iCount;
m_applet.sendThread.AskForData(packet);
}
public Page_MarketStatus(Rectangle _rc, HQApplet applet, byte currentStockType)
{
super(_rc, applet);
iCount = 7;
iHighlightRowIndex = 0;
iHighlightColIndex = 0;
font = new Font("宋体", 0, 16);
statusData = null;
m_applet.iCurrentPage = 5;
this.currentStockType = currentStockType;
AskForDataOnTimer();
makeMenus();
setMenuEnable(this.currentStockType, false);
STOCK_RANK_NAME = new String[3][3];
STOCK_RANK_NAME[0][0] = m_applet.getShowString("UpRateList");
STOCK_RANK_NAME[1][0] = m_applet.getShowString("DownRateList");
STOCK_RANK_NAME[2][0] = m_applet.getShowString("SwingList");
STOCK_RANK_NAME[0][1] = m_applet.getShowString("5MinUpRateList");
STOCK_RANK_NAME[1][1] = m_applet.getShowString("5MinDownRateList");
STOCK_RANK_NAME[2][1] = m_applet.getShowString("VolRateList");
STOCK_RANK_NAME[0][2] = m_applet.getShowString("ConsignRateDesc");
STOCK_RANK_NAME[1][2] = m_applet.getShowString("ConsignRateAsce");
STOCK_RANK_NAME[2][2] = m_applet.getShowString("MoneyList");
}
void Paint(Graphics g)
{
if(statusData != null)
{
HQApplet _tmp = m_applet;
if(HQApplet.bDebug != 0)
{
System.out.println("this.iCount = " + iCount);
System.out.println("statusData.length / 9 = " + statusData.length / 9);
}
}
initilizer(g);
paintGrid(g);
paintTitle(g);
paintStockData(g);
m_applet.EndPaint();
paintHighlight(iHighlightRowIndex, iHighlightColIndex);
}
void paintGrid(Graphics g)
{
this.fm = g.getFontMetrics(this.font);
Font font = new Font("宋体", 0, 16);
FontMetrics fm = g.getFontMetrics(font);
g.setColor(HQApplet.rhColor.clEqual);
g.drawRect(m_rc.x, m_rc.y, m_rc.width - 1, m_rc.height - 2);
int fontHeight = fm.getHeight() + 2;
g.drawLine(m_rc.x, m_rc.y + fontHeight, m_rc.x + m_rc.width, m_rc.y + fontHeight);
g.drawLine(m_rc.x, m_rc.y + m_rc.height / 3, m_rc.x + m_rc.width, m_rc.y + m_rc.height / 3);
g.drawLine(m_rc.x, m_rc.y + m_rc.height / 3 + fontHeight, m_rc.x + m_rc.width, m_rc.y + m_rc.height / 3 + fontHeight);
g.drawLine(m_rc.x, m_rc.y + (m_rc.height / 3) * 2, m_rc.x + m_rc.width, m_rc.y + (m_rc.height / 3) * 2);
g.drawLine(m_rc.x, m_rc.y + (m_rc.height / 3) * 2 + fontHeight, m_rc.x + m_rc.width, m_rc.y + (m_rc.height / 3) * 2 + fontHeight);
g.drawLine(m_rc.x + m_rc.width / 3, m_rc.y, m_rc.x + m_rc.width / 3, (m_rc.y + m_rc.height) - 2);
g.drawLine(m_rc.x + (m_rc.width / 3) * 2, m_rc.y, m_rc.x + (m_rc.width / 3) * 2, (m_rc.y + m_rc.height) - 2);
}
void paintTitle(Graphics g)
{
int x = m_rc.x;
int y = m_rc.y;
int blockWidth = m_rc.width / 3;
int blockHeight = m_rc.height / 3;
Font font = new Font("宋体", 0, 16);
FontMetrics fm = g.getFontMetrics(font);
g.setFont(font);
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
String str = STOCK_RANK_NAME[i][j];
int strWidth = fm.stringWidth(str);
int hgap = 0;
if(blockWidth > strWidth)
hgap = (blockWidth - strWidth) / 2;
g.setColor(HQApplet.rhColor.clMultiQuote_TitleBack);
g.fillRect(x + 1, y + 1, m_rc.width / 3 - 1, fm.getHeight() + 1);
g.setColor(HQApplet.rhColor.clItem);
g.drawString(str, x + hgap, y + fm.getAscent() + 2);
x += m_rc.width / 3;
}
x = m_rc.x;
y += m_rc.height / 3;
}
}
void paintHighlight(int newRowIndex, int newColIndex)
{
if(newRowIndex >= iCount * 3)
return;
Graphics g = m_applet.getGraphics();
Font font = new Font("宋体", 0, 16);
FontMetrics fm = g.getFontMetrics(font);
if(iCount <= 0)
return;
Pos oldPos = null;
if(iHighlightRowIndex < iCount * 3)
oldPos = pos[iHighlightRowIndex][iHighlightColIndex];
Pos newPos = null;
if(newRowIndex < iCount * 3)
newPos = pos[newRowIndex][newColIndex];
g.setColor(HQApplet.rhColor.clBackGround);
g.setXORMode(HQApplet.rhColor.clHighlight);
if(oldPos != null)
g.fillRect(oldPos.x, oldPos.y, m_rc.width / 3, fm.getHeight());
if(iHighlightRowIndex != newRowIndex || iHighlightColIndex != newColIndex)
{
if(newPos != null)
g.fillRect(newPos.x, newPos.y, m_rc.width / 3, fm.getHeight());
iHighlightRowIndex = newRowIndex;
iHighlightColIndex = newColIndex;
}
g.setPaintMode();
}
boolean KeyPressed(KeyEvent e)
{
if(packetInfo == null || statusData == null)
return false;
int iKeyCode = e.getKeyCode();
switch(iKeyCode)
{
default:
break;
case 38: // '&'
if(iHighlightRowIndex <= 0)
break;
int i;
for(i = 1; iHighlightRowIndex - i >= 0 && getIndexOfStatusDataArray(iHighlightRowIndex - i, iHighlightColIndex) < 0; i++);
paintHighlight(iHighlightRowIndex - i, iHighlightColIndex);
break;
case 40: // '('
if(iHighlightRowIndex >= 3 * iCount - 1)
break;
int i;
for(i = 1; iHighlightRowIndex + i <= 3 * iCount - 1 && getIndexOfStatusDataArray(iHighlightRowIndex + i, iHighlightColIndex) < 0; i++);
paintHighlight(iHighlightRowIndex + i, iHighlightColIndex);
break;
case 37: // '%'
if(iHighlightColIndex > 0)
paintHighlight(iHighlightRowIndex, iHighlightColIndex - 1);
break;
case 39: // '\''
if(iHighlightColIndex < 2)
paintHighlight(iHighlightRowIndex, iHighlightColIndex + 1);
break;
case 10: // '\n'
int index = getIndexOfStatusDataArray(iHighlightRowIndex, iHighlightColIndex);
if(index >= 0)
m_applet.QueryStock(statusData[index].code);
break;
}
return false;
}
void initilizer(Graphics g)
{
FontMetrics fm = g.getFontMetrics(font);
int x = m_rc.x;
int fontHeight = fm.getHeight() + 2;
int y = m_rc.y + fontHeight + 2;
int temp = (m_rc.height / 3 - (fontHeight + 2)) / fontHeight;
if(iCount > temp)
iCount = temp;
if(iCount <= 0)
return;
pos = new Pos[iCount * 3][3];
for(int i = 0; i < iCount * 3; i++)
{
for(int j = 0; j < 3; j++)
{
pos[i][j] = new Pos();
pos[i][j].x = x;
pos[i][j].y = y;
x += m_rc.width / 3;
}
x = m_rc.x;
if(i == iCount - 1)
y = m_rc.y + m_rc.height / 3 + fontHeight + 2;
else
if(i == 2 * iCount - 1)
y = m_rc.y + (m_rc.height / 3) * 2 + fontHeight + 2;
else
y += fontHeight;
}
}
private int getICount()
{
Graphics g = m_applet.getGraphics();
fm = g.getFontMetrics(font);
int fontHeight = fm.getHeight() + 2;
int iCount = (m_rc.height / 3 - (fontHeight + 2)) / fontHeight;
return iCount;
}
void paintStockData(Graphics g)
{
if(packetInfo != null && statusData != null)
{
for(int i = 0; i < iCount * 3; i++)
{
for(int j = 0; j < 3; j++)
{
int index = getIndexOfStatusDataArray(i, j);
if(index >= 0 && index < statusData.length)
{
MarketStatusVO value = statusData[index];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -