propsheet.java
来自「一个简单的visio程序。」· Java 代码 · 共 1,220 行 · 第 1/3 页
JAVA
1,220 行
for (int cn = 0; cn< wrapper.getFrame().clist.size(); cn++)
{
ctrl = (webide.Controlslist)(wrapper.getFrame().clist.elementAt(cn));
String ctrlname = ctrl.className.substring(ctrl.className.indexOf(".")+1);
if (ctrlname.equalsIgnoreCase("data"))
{
Object indobj = ctrl.prop.get("index");
if (indobj != null && ((Short)indobj).shortValue() != -1)
{
vds.addElement(ctrl.prop.get("name") + "(" + ctrl.prop.get("index") + ")");
}
else
{
vds.addElement(ctrl.prop.get("name") );
}
}
else if (ctrlname.equalsIgnoreCase("hsrdc"))
{
Object indobj = ctrl.prop.get("index");
if (indobj != null && ((Short)indobj).shortValue() != -1)
{
vds.addElement(ctrl.prop.get("name") + "(" + ctrl.prop.get("index") + ")");
}
else
{
vds.addElement(ctrl.prop.get("name") );
}
}
}
}
int size = vds.size();
if (size>0)
{
str = new String[size+1];
vds.copyInto(str);
str[size] = "";
if (view instanceof PropChoice)
{
PropChoice selector = (PropChoice)view;
String ss = null, ds = null;
ds = editor.getAsText();
for (ii = 0; ii < str.length; ii++)
{
if (ds != null && ds.equalsIgnoreCase(str[ii]))
{
ss = str[ii];
break;
}
}
selector.removeAll();
for (ii = 0; ii < str.length; ii++)
selector.addItem(str[ii]);
if (selector.getItemCount() > 0)
{
if(ss != null)
selector.select(ss);
else
selector.select(0);
}
}
break;
}
else str = null;
}
else if (name.equalsIgnoreCase("datafield"))
{
Object dt = ctrl.prop.get("datasource");
String dts = "";
webide.Controlslist tmpctrl = null;
if (dt != null)
{
dts = ctrl.prop.get("datasource").toString();
if (wrapper.getFrame().clist !=null)
{
for (int cn = 0; cn< wrapper.getFrame().clist.size(); cn++)
{
ctrl = (webide.Controlslist)(wrapper.getFrame().clist.elementAt(cn));
if((webide.Wrapper)ctrl.wrap != wrapper)
{
String ctrlname = ctrl.className.substring(ctrl.className.indexOf(".")+1);
if (ctrlname.equalsIgnoreCase("data")||ctrlname.equalsIgnoreCase("hsrdc")) //-HGJ- (from ||)
{
Object indobj = ctrl.prop.get("index");
if (indobj != null && ((Short)indobj).shortValue() != -1)
{
if (dts.equalsIgnoreCase(ctrl.prop.get("name") + "(" + ctrl.prop.get("index") + ")"))
{
tmpctrl = ctrl;
ctrlname1 = ctrlname;
break;
}
}
else
{
if (dts.equalsIgnoreCase(ctrl.prop.get("name").toString()))
{
tmpctrl = ctrl;
ctrlname1 = ctrlname;
break;
}
}
}
}
}
}
if (ctrlname1 != null && ctrlname1.equalsIgnoreCase("data") && tmpctrl != null)
{
Object record = tmpctrl.prop.get("recordsource");
String rs = "";
if (record != null)
rs = record.toString();
Object cc = tmpctrl.prop.get("connect");
String c = "";
if (cc != null)
c = cc.toString();
if(!rs.equals("") && !c.equals(""))
{
HPCore.BNCTRL.IDEDATA data = (HPCore.BNCTRL.IDEDATA)tmpctrl.wrap.getBean();
str = data.getFieldName(rs,c);
}
else
{
String msg = "You must fill the RecordSource of the data control." ;
MsgBox.MessageBox(new Frame(),"Instant Basic", msg, MsgBox.OK, 1);
str = null;
}
}
else if (ctrlname1 != null && ctrlname1.equalsIgnoreCase("hsrdc") && tmpctrl != null)
{
Object record = tmpctrl.prop.get("recordsource");
String rs = "";
if (record != null)
rs = record.toString();
Object cc = tmpctrl.prop.get("connect");
String c = "";
if (cc != null && !(cc.toString().trim()).equals(""))
c = cc.toString();
else if (cc == null || c.equals(""))
{
StringBuffer connect_bak = new StringBuffer("DSN=");
String tmp = "";
Object dsn = tmpctrl.prop.get("datasourcename");
if (dsn != null)
{
tmp = dsn.toString();
connect_bak.append(tmp + ";");
if (!tmp.equals(""))
{
dsn = tmpctrl.prop.get("username");
tmp = "";
if (dsn != null)
{
tmp = dsn.toString();
if (!tmp.equals(""))
connect_bak.append("UID="+ tmp + ";");
else
connect_bak.append("UID=SYSADM;");
}
else
connect_bak.append("UID=SYSADM;");
dsn = tmpctrl.prop.get("password");
tmp = "";
if (dsn != null)
{
tmp = dsn.toString();
if (!tmp.equals(""))
connect_bak.append("PWD="+ tmp + ";");
else
connect_bak.append("PWD=;");
}
else
connect_bak.append("PWD=;");
c = connect_bak.toString();
}
}
}
if(!rs.equals("") && !c.equals(""))
{
HPCore.BNCTRL.IDEDATA data = (HPCore.BNCTRL.IDEDATA)tmpctrl.wrap.getBean();
str = data.getFieldName(rs,c);
}
else
{
String msg = "You must fill the SQL of the remote data control." ;
MsgBox.MessageBox(new Frame(),"Instant Basic", msg, MsgBox.OK, 1);
str = null;
}
}
else
str = null;
}
else str = null;
}
else if (name.equalsIgnoreCase("listfield") || name.equalsIgnoreCase("boundcolumn"))
{
java.util.Enumeration eee = ctrl.prop.keys();
Object dt = null;
String dts = "";
while(eee != null && eee.hasMoreElements())
{
Object pName = eee.nextElement();
if (((String)pName).equalsIgnoreCase("bindings"))
{
dt = ctrl.prop.get("bindings");
if (dt != null)
dts = dt.toString();
break;
}
else if(((String)pName).equalsIgnoreCase("rowsource"))
{
dt = ctrl.prop.get("rowsource");
if (dt != null)
dts = dt.toString();
break;
}
}
webide.Controlslist tmpctrl = null;
if (dt != null && wrapper.getFrame().clist !=null)
{
for (int cn = 0; cn< wrapper.getFrame().clist.size(); cn++)
{
ctrl = (webide.Controlslist)(wrapper.getFrame().clist.elementAt(cn));
if((webide.Wrapper)ctrl.wrap != wrapper)
{
String ctrlname = ctrl.className.substring(ctrl.className.indexOf(".")+1);
if (ctrlname.equalsIgnoreCase("data")||ctrlname.equalsIgnoreCase("hsrdc")) //-HGJ- (from ||))
{
Object indobj = ctrl.prop.get("index");
if (indobj != null && ((Short)indobj).shortValue() != -1)
{
if (dts.equalsIgnoreCase(ctrl.prop.get("name") + "(" + ctrl.prop.get("index") + ")"))
{
tmpctrl = ctrl;
ctrlname1 = ctrlname;
break;
}
}
else
{
if (dts.equalsIgnoreCase(ctrl.prop.get("name").toString()))
{
tmpctrl = ctrl;
ctrlname1 = ctrlname;
break;
}
}
}
}
}
if (ctrlname1 != null && ctrlname1.equalsIgnoreCase("data") && tmpctrl != null)
{
Object record = tmpctrl.prop.get("recordsource");
String rs = "";
if (record != null)
rs = record.toString();
Object cc = tmpctrl.prop.get("connect");
String c = "";
if (cc != null)
c = cc.toString();
if(!rs.equals("") && !c.equals(""))
{
HPCore.BNCTRL.IDEDATA data = (HPCore.BNCTRL.IDEDATA)tmpctrl.wrap.getBean();
str = data.getFieldName(rs,c);
}else
{
String msg = "You must fill the RecordSource of the data control." ;
MsgBox.MessageBox(new Frame(),"visio", msg, MsgBox.OK, 1);
str = null;
}
}
else if (ctrlname1 != null && ctrlname1.equalsIgnoreCase("hsrdc") && tmpctrl != null)
{
Object record = tmpctrl.prop.get("sql");
String rs = "";
if (record != null)
rs = record.toString();
Object cc = tmpctrl.prop.get("connect");
String c = "";
if (cc != null)
c = cc.toString();
else if (cc ==null || c.equals(""))
{
StringBuffer connect_bak = new StringBuffer("DSN=");
String tmp = "";
Object dsn = tmpctrl.prop.get("datasourcename");
if (dsn != null)
{
tmp = dsn.toString();
connect_bak.append(tmp + ";");
if (!tmp.equals(""))
{
dsn = tmpctrl.prop.get("username");
tmp = "";
if (dsn != null)
{
tmp = dsn.toString();
if (!tmp.equals(""))
connect_bak.append("UID="+ tmp + ";");
else
connect_bak.append("UID=SYSADM;");
}
else
connect_bak.append("UID=SYSADM;");
dsn = tmpctrl.prop.get("password");
tmp = "";
if (dsn != null)
{
tmp = dsn.toString();
if (!tmp.equals(""))
connect_bak.append("PWD="+ tmp + ";");
else
connect_bak.append("PWD=;");
}
else
connect_bak.append("PWD=;");
c = connect_bak.toString();
}
}
}
if(!rs.equals("") && !c.equals(""))
{
HPCore.BNCTRL.IDEDATA data = (HPCore.BNCTRL.IDEDATA)tmpctrl.wrap.getBean();
str = data.getFieldName(rs,c);
}
else
{
String msg = "You must fill the SQL of the remote data control." ;
MsgBox.MessageBox(new Frame(),"visio", msg, MsgBox.OK, 1);
str = null;
}
}
else
str = null;
}
else str = null;
}
if (str == null)
{
if (view instanceof PropChoice)
{
PropChoice selector = (PropChoice)view;
if (selector.getItemCount() > 0)
{
selector.removeAll();
if (editor.getAsText() != null && !editor.getAsText().equals(""))
{
selector.addItem(editor.getAsText());
selector.addItem("");
}
else
selector.addItem("");
}
}
}
else
{
if (view instanceof PropChoice)
{
PropChoice selector = (PropChoice)view;
String df = editor.getAsText();
int ind = -1;
for (ii = 0; ii < str.length; ii++)
{
if (df != null && df.equals(str[ii]))
ind = ii;
}
if (selector.getItemCount() == str.length)
{
for (ii = 0; ii < str.length; ii++)
{
if (!str[ii].equals(selector.getItem(ii)))
{
ind = -1;
break;
}
}
}
if (ind == -1 || selector.getItemCount() <= 1 || selector.getItemCount() != str.length)
{
selector.removeAll();
if (ind == -1) ind = 0;
for (ii = 0; ii < str.length; ii++)
selector.addItem(str[ii]);
}
if( selector.getItemCount() > 0)
{
selector.select(ind);
}
}
}
break;
}
}
} // end of refreshPropValue.
/* ------------------------------------------------------------------------------------- */
/* ---------------------------------------- Event -------------------------------------- */
public void itemStateChanged(ItemEvent event)
{
String Selection = PChoice.getSelectedItem();
webide.Wrapper wrap = (webide.Wrapper)(ItemWrapper.get(Selection));
console.setCurrentFocus(wrap);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?