propsheet.java
来自「一个简单的visio程序。」· Java 代码 · 共 1,220 行 · 第 1/3 页
JAVA
1,220 行
if (pec != null)
{
try
{
editor = (PropertyEditor)pec.newInstance();
}
catch (Exception ex) { }
}
if (editor == null)
{
if(type.toString().equalsIgnoreCase("class java.awt.Color")
|| name.equalsIgnoreCase("backcolor") || name.equalsIgnoreCase("background")
|| name.equalsIgnoreCase("forecolor") || name.equalsIgnoreCase("foreground")
|| name.equalsIgnoreCase("fillcolor") || name.equalsIgnoreCase("bordercolor"))
{
editor = (ColorEditor)(new ColorEditor());
}
else
{
editor = PropertyEditorManager.findEditor(type);
}
}
if (editor == null && value instanceof Object[])
{
editor = (PropertyEditor)(new LStringEditor(((String[])value)));
}
if (editor == null
&& (name.equalsIgnoreCase("Picture")
|| name.equalsIgnoreCase("icon")
|| name.equalsIgnoreCase("mouseicon")
|| name.equalsIgnoreCase("dragicon")
|| name.equalsIgnoreCase("palette")
|| name.equalsIgnoreCase("toolboxbitmap")
|| name.equalsIgnoreCase("maskpicture")
|| name.equalsIgnoreCase("PictureUp")
|| name.equalsIgnoreCase("PictureDisabled")
|| name.equalsIgnoreCase("PictureDn")
|| name.equalsIgnoreCase("Pictureclosed")
|| name.equalsIgnoreCase("PictureLeaf")
|| name.equalsIgnoreCase("PictureOpen")
|| name.equalsIgnoreCase("PicturePlus")
|| name.equalsIgnoreCase("PictureMinus") ) )
{
editor = (PictureEditor)(new PictureEditor());
}
if (type.toString().equalsIgnoreCase("class HAB.object.font"))
{
editor = (FontEditor)(new FontEditor());
}
if (editor == null)
{
System.out.println("Editor is null " +name + " --->Type : " + type);
return null;
}
if (value == null)
{
if ( type.toString().equalsIgnoreCase("class java.lang.String"))
{
value = "";
editor.setValue(value);
}
}
else
{
if (name.equalsIgnoreCase("width")
|| name.equalsIgnoreCase("height")
|| name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("top"))
{
Ivalue = Util.getFloatValue(value);
Component child = this.wrapper.getChild();
Component Parent = child.getParent();
if(Parent != null && Parent.getClass().getName().equalsIgnoreCase("VB.PictureBox"))
{
if(name.equalsIgnoreCase("top"))
{
Ivalue = ((Panel)Parent).getInsets().top;
}
if(name.equalsIgnoreCase("left"))
{
Ivalue = ((Panel)Parent).getInsets().left;
}
short smode = ((Number)this.wrapper.getControl().parentCtrl.wrap.getPropValue("scalemode")).shortValue();
if (smode == 0)
{
Ivalue = conScale(name,Ivalue,1);
}
else
{
Ivalue = Util.convertJavaScale((int)smode,Ivalue);
}
if((Ivalue - (int)Ivalue) == 0)
{
editor.setValue(new Short((short)Ivalue));
}
else
{
editor.setValue(new Float(Ivalue));
}
}
else
{
}
webide.form.PainterForm pf = this.wrapper.getFrame();
if (!(child instanceof webide.form.PainterForm))
{
if (name.equalsIgnoreCase("left") && Util.parentIsFrame(this.wrapper))
{
Ivalue = Ivalue - pf.getInsets().left;
}
if (name.equalsIgnoreCase("top") && Util.parentIsFrame(this.wrapper))
{
Ivalue = Ivalue - pf.getInsets().top;
}
short smode = pf.getScaleMode();
if (smode == 0)
{
Ivalue = conScale(name,Ivalue,0);
}
else
{
Ivalue = Util.convertJavaScale(smode,Ivalue);
}
if((Ivalue - (short)Ivalue) == 0)
{
editor.setValue(new Short((short)Ivalue));
}
else
{
editor.setValue(new Float(Ivalue));
}
}
else
{
Ivalue = (float)(Ivalue*15);
if((Ivalue - (int)Ivalue) == 0)
{
editor.setValue(new Short((short)Ivalue));
}
else
{
editor.setValue(new Float(Ivalue));
}
}
}
else
{
try {
editor.setValue(value);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
catch (Exception ex)
{
System.err.println("Skipping property " + name + " : " + ex);
ex.printStackTrace();
return null;
}
return editor;
}
public float JAVAtoVB(float Ivalue,String name)
{
webide.Wrapper cF = this.wrapper;
short smode = 1;
Component child = cF.getChild();
Component Parent = child.getParent();
if(Parent != null && Parent.getClass().getName().equalsIgnoreCase("VB.PictureBox"))
{
if(name.equalsIgnoreCase("left")||name.equalsIgnoreCase("x1")
||name.equalsIgnoreCase("x2"))
{
Ivalue = Ivalue - ((Panel)Parent).getInsets().left;
}
if(name.equalsIgnoreCase("top")||name.equalsIgnoreCase("y1")
||name.equalsIgnoreCase("y2"))
{
Ivalue = Ivalue - ((Panel)Parent).getInsets().top;
}
Object scaleobj = cF.getControl().parentCtrl.wrap.getPropValue("scalemode");
if (scaleobj != null)
{
smode = ((Short)scaleobj).shortValue();
}
if (smode == 0)
{
Ivalue = conScale(name,Ivalue,1);
}
else
{
Ivalue = Util.convertJavaScale((int)smode,Ivalue);
}
}
else
{
if (!(cF.getChild() instanceof webide.form.PainterForm))
{
if ((name.equalsIgnoreCase("left")||name.equalsIgnoreCase("x1")||name.equalsIgnoreCase("x2")) && Util.parentIsFrame(cF))
{
Ivalue = Ivalue - cF.getFrame().getInsets().left;
}
if ((name.equalsIgnoreCase("top")||name.equalsIgnoreCase("y1")||name.equalsIgnoreCase("y2")) && Util.parentIsFrame(cF))
{
Ivalue = Ivalue - cF.getFrame().getInsets().top;
}
Object scaleobj = cF.getFrame().prop.get("scalemode");
if (scaleobj != null)
{
smode = ((Short)scaleobj).shortValue();
}
if (smode == 0)
{
Ivalue = conScale(name,Ivalue,0);
}
else
{
Ivalue = Util.convertJavaScale((int)smode,Ivalue);
}
}
else
{
Ivalue = (float)(Ivalue*15);
}
}
return Ivalue;
}
public float conScale(String name,float value,int tag)
{
return conScale(this.wrapper,name,value,tag);
}
public float conScale(webide.Wrapper cF, String name,float value,int tag)
{
if(tag == 0)
{
if(cF != null)
{
Object scaleht = cF.getFrame().prop.get("height");
float fscaleht = Util.getFloatValue(scaleht);
fscaleht = (fscaleht/15) - 27;
Object scalewh = cF.getFrame().prop.get("width");
float fscalewh = Util.getFloatValue(scalewh);
fscalewh = (fscalewh/15) - 8;
if (name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2"))
{
float sbwidth = cF.getFrame().getScaleWidth();
Object sleft = new Float(cF.getFrame().getScaleLeft());
if (sleft != null)
{
float saleft = ((Float)sleft).floatValue();
value = value*(sbwidth/fscalewh) + saleft;
}
}
else if(name.equalsIgnoreCase("top")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
float sbheight = cF.getFrame().getScaleHeight();
Object stop = new Float(cF.getFrame().getScaleTop());
if (stop != null)
{
float satop = ((Float)stop).floatValue();
value = value*(sbheight/fscaleht) + satop;
}
}
else if(name.equalsIgnoreCase("height")||name.equalsIgnoreCase("rowheight"))
{
Object sheight = new Float(cF.getFrame().getScaleHeight());
if (sheight != null)
{
float saheight=((Float)sheight).floatValue();
value = value*(saheight/fscaleht);
}
}
else if(name.equalsIgnoreCase("width")||name.equalsIgnoreCase("defcolwidth"))
{
Object swidth = new Float(cF.getFrame().getScaleWidth());
if (swidth != null)
{
float sawidth=((Float)swidth).floatValue();
value = value*(sawidth/fscalewh);
}
}
}
}
else if(tag == 1)
{
Component child = cF.getChild();
Component Parent = child.getParent();
Object scaleht = cF.getControl().parentCtrl.wrap.getPropValue("height");
float fscaleht = Util.getFloatValue(scaleht);
fscaleht = fscaleht - 4;
Object scalewh = cF.getControl().parentCtrl.wrap.getPropValue("width");
float fscalewh = Util.getFloatValue(scalewh);
fscalewh = fscalewh - 4;
if (name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2"))
{
float sbwidth = Util.getFloatValue(cF.getControl().parentCtrl.wrap.getPropValue("scalewidth"));
Object sleft = cF.getControl().parentCtrl.wrap.getPropValue("scaleleft");
if (sleft != null)
{
float saleft = ((Float)sleft).floatValue();
value = value*(sbwidth/fscalewh) + saleft;
}
}
else if(name.equalsIgnoreCase("top")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
float sbheight = Util.getFloatValue(cF.getControl().parentCtrl.wrap.getPropValue("scaleheight"));
Object stop = cF.getControl().parentCtrl.wrap.getPropValue("scaletop");
if (stop != null)
{
float satop = ((Float)stop).floatValue();
value = value*(sbheight/fscaleht) + satop;
}
}
else if(name.equalsIgnoreCase("height")||name.equalsIgnoreCase("rowheight"))
{
Object sheight = cF.getControl().parentCtrl.wrap.getPropValue("scaleheight");
if (sheight != null)
{
float saheight=Util.getFloatValue(sheight);
value = value*(saheight/fscaleht);
}
}
else if(name.equalsIgnoreCase("width")||name.equalsIgnoreCase("defcolwidth"))
{
Object swidth = cF.getControl().parentCtrl.wrap.getPropValue("scalewidth");
if (swidth != null)
{
float sawidth=Util.getFloatValue(swidth);
value = value*(sawidth/fscalewh);
}
}
}
return value;
}
public webide.views.prop.PropPanel getPropPanel()
{
return proppanel;
}
public void Dispose()
{
this.proppanel.Dispose();
}
public void refreshPropValue(String name)
{
for (int i = 0; i < properties.length; i++)
{
String propName = properties[i].getDisplayName().toLowerCase();
Class type = properties[i].getPropertyType();
if (name.equalsIgnoreCase(propName) && type.toString().equalsIgnoreCase("class java.lang.String"))
{
Component view = views[i];
PropertyEditor editor = editors[i];
webide.Controlslist ctrl=wrapper.getControl();
String[] str=null;
int ii=0;
String Cname = ctrl.className.substring(ctrl.className.indexOf(".")+1);
if (name.equalsIgnoreCase("recordsource") && Cname.equalsIgnoreCase("data"))
{
Object connect = ctrl.prop.get("connect");
String con="";
if (connect != null)
con = connect.toString();
if (!con.equals(""))
{
HPCore.BNCTRL.IDEDATA data = (HPCore.BNCTRL.IDEDATA)ctrl.wrap.getBean();
str = data.getTableName(con);
}
else
{
String msg = "You need to fill in the Connect properties of the Data Control to complete this operation" ;
MsgBox.MessageBox(new Frame(),"Instant Basic", msg, MsgBox.OK, 1);
str = null;
}
}
else if (name.equalsIgnoreCase("datasource") || name.equalsIgnoreCase("rowsource"))
{
java.util.Vector vds = new java.util.Vector();
if (wrapper.getFrame().clist !=null)
{
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?