methodofwasmodify.java
来自「一个简单的visio程序。」· Java 代码 · 共 1,557 行 · 第 1/4 页
JAVA
1,557 行
}
else if (((String)Invalue).equalsIgnoreCase(ctrlname)
&&(!(ctr.equalsIgnoreCase(control.className))))
{
String nam = (String)Invalue;
String msg = "'" + nam +"'" + " is a control name";
MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.OK, 1);
Invalue = control.prop.get("name");
PropTextbox st = (PropTextbox)proppanel.views[i];
ChangeText(st,Invalue,i,propsheet);
}
/*
else if(wrap.getFrame().mlist != null)
{
int mlistLength = wrap.getFrame().mlist.length;
for(int j = 0;j < mlistLength;j++)
{
if(wrap.getFrame().mlist[j].getName().equalsIgnoreCase((String)Invalue))
{
String nam = (String)Invalue;
String msg = "'" + nam +"'" + " is a control name";
MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.OK, 1);
Invalue = control.prop.get("name");
PropTextbox st = (PropTextbox)proppanel.views[i];
ChangeText(st,Invalue,i,propsheet);
}
}
}
*/
}
return Invalue;
}
private static Object IndexName2(String name,Object Invalue,int i,Wrapper wrapp, PropSheet propsheet)
{
short id;
String ctm = null;
PropPanel proppanel = propsheet.getPropPanel();
MainConsole mM = MainConsole.getMainConsole();
Controlslist control = wrapp.getControl();
ctm = (String)(control.prop.get("name"));
for (int cu = 0; cu < wrapp.getFrame().clist.size(); cu++)
{
Controlslist ctrl = (Controlslist)(wrapp.getFrame().clist.elementAt(cu));
if((Wrapper)ctrl.wrap != wrapp)
{
if (((String)(ctrl.prop.get("name"))).equalsIgnoreCase(ctm))
{
if( ( Invalue.equals(ctrl.prop.get("index")) && ((Number)Invalue).shortValue() > -1 )
|| ((Number)Invalue).shortValue() == -1 )
{
short nam = ((Number)Invalue).shortValue();
String msg = "";
if(((Number)Invalue).shortValue() == -1)
msg = "Can't clear Index property without changing Name";
else
msg = "Array already has control index " + "'" + nam +"'";
MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.OK, 1);
Invalue = control.prop.get("index");
PropTextbox st = (PropTextbox)proppanel.views[i];
ChangeText(st,Invalue,i,propsheet);
break;
}
}
}
}
if(((Number)Invalue).shortValue() < -1)
{
String msg = "Invalid property value";
MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.OK, 1);
Invalue = control.prop.get("index");
PropTextbox st = (PropTextbox)proppanel.views[i];
if(Invalue != null)
{
ChangeText(st,Invalue,i,propsheet);
}
else
{
st.setText("");
Object[] Prop = (Object[])proppanel.pTab.get(""+i);
PropertyEditor editor = (PropertyEditor)Prop[3];
//st.setValue("");
//wrapp.adaptor.b = false;
editor.setValue(new Short((short)-1));
//wrapp.adaptor.b = true;
proppanel.views[i] = st;
}
}
return Invalue;
}
private static Object changTabindex(Object Invalue,int i,Wrapper wrapp, PropSheet propsheet)
{
Controlslist control = wrapp.getControl();
short TIvalue = ((Number)Invalue).shortValue();
if(TIvalue >= wrapp.getFrame().clist.size())
{
Invalue = control.prop.get("tabindex");
PropTextbox st = (PropTextbox)propsheet.getPropPanel().views[i];
ChangeText(st,Invalue,i,propsheet);
}
else
{
Object value = control.prop.get("tabindex");
for (int cu = 0; cu < wrapp.getFrame().clist.size(); cu++)
{
Controlslist ctrl = (Controlslist)(wrapp.getFrame().clist.elementAt(cu));
Object Ivalue = ctrl.prop.get("tabindex");
if (Ivalue != null)
{
if (((Number)Invalue).shortValue() == ((Number)Ivalue).shortValue())
{
Wrapper wrap = (Wrapper)ctrl.wrap;
try
{
wrap.setPropValue("tabindex",value);
}
catch(Exception e)
{
}
ctrl.prop.put("tabindex",value);
}
}
}
}
return Invalue;
}
private static float convtScale(String name,float value,int tag,Wrapper wrapp)
{
if(tag == 0)
{
Object scaleht = wrapp.getFrame().prop.get("height");
float fscaleht = Util.getFloatValue(scaleht);
fscaleht = (fscaleht/15) - 27;
/*
if(wrapp.getFrame().mlist != null && wrapp.getFrame().mlist.length>0)
{
fscaleht = fscaleht - (wrapp.getFrame().getInsets().top - wrapp.getFrame().TOP);
}
*/
Object scalewh = wrapp.getFrame().prop.get("width");
float fscalewh = Util.getFloatValue(scalewh);
fscalewh = (fscalewh/15) - 8;
if (name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2"))
{
float sawidth = wrapp.getFrame().getScaleWidth();
Object sleft = new Float(wrapp.getFrame().getScaleLeft());
if (sleft != null)
{
float saleft=Util.getFloatValue(sleft);
value = (value - saleft)/(sawidth/fscalewh);
}
}
else if(name.equalsIgnoreCase("top")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
float saheight = wrapp.getFrame().getScaleHeight();
Object stop = new Float(wrapp.getFrame().getScaleTop());
if (stop != null)
{
float satop=Util.getFloatValue(stop);
value = (value - satop)/(saheight/fscaleht);
}
}
else if(name.equalsIgnoreCase("height") || name.equalsIgnoreCase("rowheight"))
{
Object sheight = new Float(wrapp.getFrame().getScaleHeight());
if (sheight != null)
{
float saheight=Util.getFloatValue(sheight);
value = value/(saheight/fscaleht);
}
}
else if(name.equalsIgnoreCase("width")|| name.equalsIgnoreCase("defcolwidth"))
{
Object swidth = new Float(wrapp.getFrame().getScaleWidth());
if (swidth != null)
{
float sawidth = Util.getFloatValue(swidth);
value = value/(sawidth/fscalewh);
}
}
}
else if(tag == 1)
{
Component child = wrapp.getChild();
Component Parent = child.getParent();
Object scaleht = wrapp.getControl().parentCtrl.wrap.getPropValue("height");
float fscaleht = Util.getFloatValue(scaleht);
fscaleht = fscaleht - 4;
Object scalewh = wrapp.getControl().parentCtrl.wrap.getPropValue("width");
float fscalewh = Util.getFloatValue(scalewh);
fscalewh = fscalewh - 4;
if (name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2"))
{
float sawidth = Util.getFloatValue(wrapp.getControl().parentCtrl.wrap.getPropValue("scalewidth"));
Object sleft = wrapp.getControl().parentCtrl.wrap.getPropValue("scaleleft");
if (sleft != null)
{
float saleft=Util.getFloatValue(sleft);
value = (value - saleft)/(sawidth/fscalewh);
}
}
else if(name.equalsIgnoreCase("top")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
float saheight = Util.getFloatValue(wrapp.getControl().parentCtrl.wrap.getPropValue("scaleheight"));
Object stop = wrapp.getControl().parentCtrl.wrap.getPropValue("scaletop");
if (stop != null)
{
float satop=Util.getFloatValue(stop);
value = (value - satop)/(saheight/fscaleht);
}
}
else if(name.equalsIgnoreCase("height")||name.equalsIgnoreCase("rowheight"))
{
Object sheight = wrapp.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 = wrapp.getControl().parentCtrl.wrap.getPropValue("scalewidth");
if (swidth != null)
{
float sawidth=Util.getFloatValue(swidth);
value = value/(sawidth/fscalewh);
}
}
}
return value;
}
public static void ItemDataSetValue(Object value,Wrapper wrapp, PropSheet propsheet)
{
PropPanel proppanel = propsheet.getPropPanel();
int lent1 = 0;
int lent2 = 0;
Object val = null;
if(value instanceof String[])
{
lent1 = ((String[])value).length;
}
val = wrapp.getPropValue("itemdata");
for (int j = 0; j < wrapp.prop.length; j++)
{
Object[] Prop = (Object[])proppanel.pTab.get(""+j);
String wname = (String)Prop[0];
PropertyEditor editor = (PropertyEditor)Prop[3];
if (wname.equalsIgnoreCase("itemdata"))
{
if(val != null)
lent2 = ((int[])val).length;
else
lent2 = 0;
if(lent1>lent2)
{
int[] intvalu = new int[lent1];
for(int i = 0; i < lent2; i++)
{
intvalu[i] = ((int[])val)[i];
}
for(int i = lent2; i < lent1; i++)
intvalu[i] = 0;
editor.setValue(intvalu);
try
{
wrapp.setPropValue("itemdata",intvalu);
}
catch(Exception e)
{
// System.out.println("Exception e:::"+e);
}
Controlslist control = wrapp.getControl();
control.prop.put("itemdata",intvalu);
}
else if(lent1 < lent2)
{
int[] intvalu = new int[lent1];
for(int i = 0; i < lent1; i++)
{
intvalu[i] = ((int[])val)[i];
}
editor.setValue(intvalu);
try
{
wrapp.setPropValue("itemdata",intvalu);
}catch(Exception e)
{
// System.out.println("Exception e:::"+e);
}
Controlslist control = wrapp.getControl();
control.prop.put("itemdata",intvalu);
}
return;
}
}
}
private static void setPictureButton(String name,int i,Object value,PropSheet propsheet)
{
if(name.equalsIgnoreCase("picture"))
{
if(value == null || value.toString().equals(""))
{
((SubButton)propsheet.getPropPanel().views[i]).setText("(None)");
}
else
{
((SubButton)propsheet.getPropPanel().views[i]).setText("(Bitmap)");
}
}
else if(name.equalsIgnoreCase("icon"))
{
//if(value != null)
if(value == null || value.toString().equals(""))
{
((SubButton)propsheet.getPropPanel().views[i]).setText("(None)");
}
else
{
((SubButton)propsheet.getPropPanel().views[i]).setText("(Icon)");
}
}
}
private static Object LimitedSize(int i ,String name,Object value,Wrapper wrapp)
{
Dimension minSize = wrapp.getChild().getMinimumSize();
Dimension maxSize = wrapp.getChild().getMaximumSize();
int Invalue = ((Float)value).intValue();
if(name.equalsIgnoreCase("height"))
{
if(Invalue < minSize.height)
{
value = new Float((float)minSize.height);
}
else if(Invalue > maxSize.height)
{
value = new Float((float)maxSize.height);
}
}
else if(name.equalsIgnoreCase("width"))
{
if(Invalue < minSize.width)
{
value = new Float((float)minSize.width);
}
else if(Invalue > maxSize.width)
{
value = new Float((float)maxSize.width);
}
}
return value;
}
public static void ChangeText(PropTextbox pt, Object value, int i,PropSheet propsheet)
{
if(value == null)
{
value = "";
}
pt.setText(value.toString());
PropPanel proppanel = propsheet.getPropPanel();
Object[] Prop = (Object[])proppanel.pTab.get(""+i);
((PropertyEditor)Prop[3]).setValue(value);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?