📄 browserdlg.java
字号:
/////////////////////////////////////////////////////////////////////////////
//
// OPC Trend VJ Client: BrowserDlg.java
// (Source File)
//
/////////////////////////////////////////////////////////////////////////////
//
// Author: Raphael Imhof
// Initial Date: 11/04/98
// $Workfile: BrowserDlg.java $
// $Revision: 1 $
// $Date: 7/27/99 5:09p $
// Target System: Microsoft Windows NT 4.0
// Environment: Visual J++ 6.0 / OPC DataAccess 2.0
// Remarks:
//
/////////////////////////////////////////////////////////////////////////////
//
// Description: implementation of the tag browser class.
//
//
/////////////////////////////////////////////////////////////////////////////
//
// History of Changes (Please remove very old comments and blank lines!)
// $Log: /IDK/OPCServer/clients/VJ++/ISVjTrend/BrowserDlg.java $
//
// 1 7/27/99 5:09p Imhof
//
// 1 7/27/99 4:39p Imhof
//
// 1 7/27/99 4:33p Imhof
//
// 6 1/20/99 3:17p Imhof
// Updated header
//
// 5 1/18/99 5:01p Imhof
//
//
// $Nokeywords:$ (To avoid useless search while checking in.)
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 1999, Siemens Building Technologies, Inc. Landis Division
//
// SIEMENS BUILDING TECHNOLOGIES, INC. IS PROVIDING THE FOLLOWING EXAMPLES
// OF CODE AS SAMPLE ONLY.
// SIEMENS BUILDING TECHNOLOGIES, INC. MAKES NO REPRESENTATIONS OR WARRANTIES
// OF ANY KIND WITH RESPECT TO THE VALIDTY OF THE CODES OR DESIRED RESULTS
// AND DISCLAIMS ALL SUCH REPRESENTATIONS AND WARRANTIES, INCLUDING FOR EXAMPLE,
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// SIEMENS BUILIDNG TECHNOLOGIES, INC. DOES NOT REPRESENT OR WARRANT THAT
// THE FOLLOWING CODE SAMPLES ARE ACCURATE, VALID, COMPLETE OR CURRENT.
//
/////////////////////////////////////////////////////////////////////////////
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;
import opcdaauto.*;
import com.ms.com.Variant;
/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method. The class
* constructor is not invoked unless an object of type 'browser'
* created in the main() method.
*/
public class BrowserDlg extends Form
{
public OPCServer server;
public String sTag;
public BrowserDlg()
{
super();
// Required for Visual J++ Form Designer support
initForm();
// TODO: Add any constructor code after initForm call
}
/**
* browser overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}
private void Find_click(Object source, Event e)
{
tagList.removeAll();
tag.setText("");
OPCBrowser browser = server.CreateBrowser();
String sFilter = new String(filterPrefix.getText() + filterSuffix.getText());
browser.setFilter(sFilter);
//browser.setDataType(0);
browser.setAccessRights(1);
Variant leafs = new Variant(true);
browser.ShowLeafs(leafs);
for(int i =0; i < browser.getCount(); i++)
{
Variant pos = new Variant(i+1);
tagList.addItem(browser.Item(pos));
}
}
private void tag_textChanged(Object source, Event e)
{
}
private void tagList_selectedIndexChanged(Object source, Event e)
{
sTag = (String)tagList.getSelectedItem();
tag.setText(sTag);
}
/**
* 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();
ListBox tagList = new ListBox();
Edit tag = new Edit();
GroupBox groupBox1 = new GroupBox();
Edit filterPrefix = new Edit();
Edit filterSuffix = new Edit();
Button Find = new Button();
Button OK = new Button();
Button Cancel = new Button();
private void initForm()
{
tagList.setLocation(new Point(8, 56));
tagList.setSize(new Point(224, 180));
tagList.setTabIndex(0);
tagList.setText("listBox1");
tagList.setUseTabStops(true);
tagList.addOnSelectedIndexChanged(new EventHandler(this.tagList_selectedIndexChanged));
tag.setLocation(new Point(8, 16));
tag.setSize(new Point(224, 23));
tag.setTabIndex(1);
tag.setText("");
tag.addOnTextChanged(new EventHandler(this.tag_textChanged));
groupBox1.setLocation(new Point(8, 248));
groupBox1.setSize(new Point(328, 64));
groupBox1.setTabIndex(2);
groupBox1.setTabStop(false);
groupBox1.setText("Filter");
filterPrefix.setLocation(new Point(8, 24));
filterPrefix.setSize(new Point(152, 23));
filterPrefix.setTabIndex(0);
filterPrefix.setText("*");
filterSuffix.setLocation(new Point(160, 24));
filterSuffix.setSize(new Point(64, 23));
filterSuffix.setTabIndex(1);
filterSuffix.setText("_TREND");
Find.setLocation(new Point(232, 24));
Find.setSize(new Point(88, 24));
Find.setTabIndex(2);
Find.setText("&Find");
Find.addOnClick(new EventHandler(this.Find_click));
OK.setLocation(new Point(248, 16));
OK.setSize(new Point(80, 24));
OK.setTabIndex(3);
OK.setText("OK");
OK.setDialogResult(DialogResult.OK);
Cancel.setLocation(new Point(248, 48));
Cancel.setSize(new Point(80, 24));
Cancel.setTabIndex(4);
Cancel.setText("Cancel");
Cancel.setDialogResult(DialogResult.CANCEL);
this.setText("Tag Browser");
this.setAcceptButton(OK);
this.setAutoScaleBaseSize(new Point(7, 16));
this.setBorderStyle(FormBorderStyle.FIXED_DIALOG);
this.setCancelButton(Cancel);
this.setClientSize(new Point(346, 327));
this.setControlBox(false);
this.setMaximizeBox(false);
this.setMinimizeBox(false);
this.setShowInTaskbar(false);
this.setNewControls(new Control[] {
Cancel,
OK,
groupBox1,
tag,
tagList});
groupBox1.setNewControls(new Control[] {
filterSuffix,
filterPrefix,
Find});
}
/**
* 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 BrowserDlg());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -