📄 isvjtrend.java
字号:
Application.addOnIdle(new EventHandler(this.ISVjTrend_Idle));
server = new Server();
}
/**
* ISVjTrend overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}
private void ISVjTrend_Idle(Object sender, Event e)
{
// Set the statusBarStates
StatusBarPanel sbPanel[] = statusBar.getPanels ();
if ((GetKeyState(VK_CAPITAL) & 1) == 1)
sbPanel[1].setText ("CAP");
else
sbPanel[1].setText ("");
if ((GetKeyState(VK_NUMLOCK) & 1) == 1)
sbPanel[2].setText ("NUM");
else
sbPanel[2].setText ("");
}
private void ISVjTrend_closing(Object source, CancelEvent e)
{
// Check to see if there are changes to save
if(server.IsConnected()) server.Disconnect();
Application.exit();
}
private void menuConnect_click(Object source, Event e)
{
server.Connect();
}
private void menuDisconnect_click(Object source, Event e)
{
if(server.IsConnected())
server.Disconnect();
}
/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
ListView TrendListView = new ListView();
MainMenu mainMenu1 = new MainMenu();
MenuItem fileMenu = new MenuItem();
MenuItem openMenu = new MenuItem();
MenuItem seperator3Menu = new MenuItem();
MenuItem exitMenu = new MenuItem();
MenuItem helpMenu = new MenuItem();
MenuItem aboutMenu = new MenuItem();
StatusBar statusBar = new StatusBar();
StatusBarPanel mainStatusBarPanel = new StatusBarPanel();
StatusBarPanel capStatusBarPanel = new StatusBarPanel();
StatusBarPanel numStatusBarPanel = new StatusBarPanel();
ToolBar toolBar = new ToolBar();
ToolBarButton openToolBarButton = new ToolBarButton();
ToolBarButton sep1ToolBarButton = new ToolBarButton();
ImageList toolBarImageList = new ImageList();
Splitter TrendViewSplitter = new Splitter();
mschrt20.MSChart.MSChart TrendGraphView = new mschrt20.MSChart.MSChart();
ColumnHeader TrendListViewHeaderTime = new ColumnHeader();
ColumnHeader TrendListViewHeaderValue = new ColumnHeader();
ColumnHeader TrendListViewHeaderPriority = new ColumnHeader();
ColumnHeader TrendListViewHeaderAlarm = new ColumnHeader();
ColumnHeader TrendListViewHeaderDataloss = new ColumnHeader();
MenuItem menuConnect = new MenuItem();
MenuItem menuDisconnect = new MenuItem();
MenuItem seperator1Menu = new MenuItem();
ToolBarButton ConnecttoolBarButton = new ToolBarButton();
ToolBarButton DisconnecttoolBarButton = new ToolBarButton();
ToolBarButton sep5ToolBarButton = new ToolBarButton();
private void initForm()
{
// NOTE: This form is storing resource information in an
// external file. Do not modify the string parameter to any
// resources.getObject() function call. For example, do not
// modify "foo1_location" in the following line of code
// even if the name of the Foo object changes:
// foo1.setLocation((Point)resources.getObject("foo1_location"));
IResourceManager resources = new ResourceManager(this, "ISVjTrend");
components.add(openMenu, "openMenu");
openMenu.setShortcut(Shortcut.CTRL_O);
openMenu.setText("&Open...");
openMenu.addOnClick(new EventHandler(this.doOpen));
components.add(seperator3Menu, "seperator3Menu");
seperator3Menu.setText("-");
components.add(exitMenu, "exitMenu");
exitMenu.setText("E&xit");
exitMenu.addOnClick(new EventHandler(this.exitMenu_click));
components.add(aboutMenu, "aboutMenu");
aboutMenu.setText("&About...");
aboutMenu.addOnClick(new EventHandler(this.aboutMenu_click));
components.add(helpMenu, "helpMenu");
helpMenu.setMenuItems(new MenuItem[] {
aboutMenu});
helpMenu.setText("&Help");
components.add(mainStatusBarPanel, "mainStatusBarPanel");
mainStatusBarPanel.setAutoSize(StatusBarPanelAutoSize.SPRING);
mainStatusBarPanel.setBorderStyle(StatusBarPanelBorderStyle.NONE);
mainStatusBarPanel.setWidth(498);
components.add(capStatusBarPanel, "capStatusBarPanel");
capStatusBarPanel.setAlignment(HorizontalAlignment.CENTER);
capStatusBarPanel.setMinWidth(35);
capStatusBarPanel.setWidth(35);
components.add(numStatusBarPanel, "numStatusBarPanel");
numStatusBarPanel.setAlignment(HorizontalAlignment.CENTER);
numStatusBarPanel.setMinWidth(35);
numStatusBarPanel.setWidth(35);
components.add(statusBar, "statusBar");
statusBar.setBackColor(Color.CONTROL);
statusBar.setLocation(new Point(0, 444));
statusBar.setSize(new Point(584, 20));
statusBar.setTabIndex(1);
statusBar.setText("");
statusBar.setShowPanels(true);
statusBar.setPanels(new StatusBarPanel[] {
mainStatusBarPanel,
capStatusBarPanel,
numStatusBarPanel});
components.add(openToolBarButton, "openToolBarButton");
openToolBarButton.setImageIndex(1);
openToolBarButton.setToolTipText("Open");
components.add(sep1ToolBarButton, "sep1ToolBarButton");
sep1ToolBarButton.setStyle(ToolBarButtonStyle.SEPARATOR);
components.add(toolBarImageList, "toolBarImageList");
toolBarImageList.setImageSize(new Point(16, 15));
toolBarImageList.setImageStream((ImageListStreamer)resources.getObject("toolBarImageList_imageStream"));
/* @designTimeOnly toolBarImageList.setLocation(new Point(352, 8)); */
components.add(TrendViewSplitter, "TrendViewSplitter");
TrendViewSplitter.setCursor(Cursor.HSPLIT);
TrendViewSplitter.setDock(ControlDock.TOP);
TrendViewSplitter.setLocation(new Point(0, 153));
TrendViewSplitter.setSize(new Point(584, 1));
TrendViewSplitter.setTabIndex(2);
TrendViewSplitter.setTabStop(false);
components.add(TrendGraphView, "TrendGraphView");
TrendGraphView.setDock(ControlDock.FILL);
TrendGraphView.setLocation(new Point(0, 154));
TrendGraphView.setSize(new Point(584, 290));
TrendGraphView.setTabIndex(5);
TrendGraphView.setOcxState((AxHost.State)resources.getObject("TrendGraphView_ocxState"));
components.add(TrendListViewHeaderTime, "TrendListViewHeaderTime");
TrendListViewHeaderTime.setText("Time");
TrendListViewHeaderTime.setWidth(100);
components.add(TrendListViewHeaderValue, "TrendListViewHeaderValue");
TrendListViewHeaderValue.setText("Value");
TrendListViewHeaderValue.setWidth(100);
components.add(TrendListViewHeaderPriority, "TrendListViewHeaderPriority");
TrendListViewHeaderPriority.setText("Priority");
TrendListViewHeaderPriority.setWidth(100);
components.add(TrendListViewHeaderAlarm, "TrendListViewHeaderAlarm");
TrendListViewHeaderAlarm.setText("Alarm");
TrendListViewHeaderAlarm.setWidth(100);
components.add(TrendListViewHeaderDataloss, "TrendListViewHeaderDataloss");
TrendListViewHeaderDataloss.setText("Dataloss");
TrendListViewHeaderDataloss.setWidth(100);
components.add(TrendListView, "TrendListView");
TrendListView.setDock(ControlDock.TOP);
TrendListView.setLocation(new Point(0, 25));
TrendListView.setSize(new Point(584, 128));
TrendListView.setTabIndex(6);
TrendListView.setText("listView1");
TrendListView.setFullRowSelect(true);
TrendListView.setSorting(SortOrder.DESCENDING);
TrendListView.setView(ViewEnum.REPORT);
TrendListView.setColumns(new ColumnHeader[] {
TrendListViewHeaderTime,
TrendListViewHeaderValue,
TrendListViewHeaderPriority,
TrendListViewHeaderAlarm,
TrendListViewHeaderDataloss});
components.add(menuConnect, "menuConnect");
menuConnect.setText("Connect...");
menuConnect.addOnClick(new EventHandler(this.menuConnect_click));
components.add(menuDisconnect, "menuDisconnect");
menuDisconnect.setText("Disconnect");
menuDisconnect.addOnClick(new EventHandler(this.menuDisconnect_click));
components.add(seperator1Menu, "seperator1Menu");
seperator1Menu.setText("-");
components.add(fileMenu, "fileMenu");
fileMenu.setMenuItems(new MenuItem[] {
menuConnect,
menuDisconnect,
seperator1Menu,
openMenu,
seperator3Menu,
exitMenu});
fileMenu.setText("&Trend");
components.add(mainMenu1, "mainMenu1");
mainMenu1.setMenuItems(new MenuItem[] {
fileMenu,
helpMenu});
/* @designTimeOnly mainMenu1.setLocation(new Point(200, 8)); */
this.setAnchor(ControlAnchor.ALL);
this.setLocation(new Point(298, 88));
this.setText("ISVjTrend");
this.setAutoScaleBaseSize(new Point(7, 16));
this.setClientSize(new Point(584, 464));
this.setIcon((Icon)resources.getObject("this_icon"));
this.setMenu(mainMenu1);
this.addOnClosing(new CancelEventHandler(this.ISVjTrend_closing));
components.add(ConnecttoolBarButton, "ConnecttoolBarButton");
ConnecttoolBarButton.setImageIndex(5);
components.add(DisconnecttoolBarButton, "DisconnecttoolBarButton");
DisconnecttoolBarButton.setImageIndex(6);
components.add(sep5ToolBarButton, "sep5ToolBarButton");
sep5ToolBarButton.setStyle(ToolBarButtonStyle.SEPARATOR);
components.add(toolBar, "toolBar");
toolBar.setSize(new Point(584, 25));
toolBar.setTabIndex(0);
toolBar.setButtons(new ToolBarButton[] {
openToolBarButton,
sep1ToolBarButton,
ConnecttoolBarButton,
DisconnecttoolBarButton,
sep5ToolBarButton});
toolBar.setDropDownArrows(true);
toolBar.setImageList(toolBarImageList);
toolBar.setShowToolTips(true);
toolBar.addOnButtonClick(new ToolBarButtonClickEventHandler(this.toolBar_buttonClick));
this.setNewControls(new Control[] {
TrendGraphView,
TrendListView,
TrendViewSplitter,
toolBar,
statusBar});
TrendGraphView.begin();
}
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new ISVjTrend());
}
public static final int VK_CAPITAL = 0x14;
public static final int VK_NUMLOCK = 0x90;
/**
* @dll.import("USER32",auto)
*/
public static native short GetKeyState(int nVirtKey);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -