proppanel.java
来自「一个简单的visio程序。」· Java 代码 · 共 1,380 行 · 第 1/3 页
JAVA
1,380 行
{
if(value instanceof Object[])
{
int pagescount = ((String[])value).length;
int pacount = 0;
for(int j = 0; j < pagescount; j++)
{
if(((String[])value)[j] != null)
{
pacount++;
}
}
if(pacount == 0)
{
label = "(None)";
}
else if(pacount == 1)
{
label = "("+Integer.toString(pacount)+" page"+")";
}
else
{
label = "("+Integer.toString(pacount)+" pages"+")";
}
}
else
{
label = "(None)";
}
return label;
}
else if (value instanceof Font)
{
label = ((Font)value).getName().trim();
return label;
}
else if(editor instanceof Editor.ColorEditor)
{
Color color = Util.updateColor(((Integer)value).intValue());
if(Util.updateColor(color) != null)
{
label = Util.updateColor(color);
return label;
}
else
{
label = Util.getVbcolor(color);
return label;
}
}
else if(name.equalsIgnoreCase("custom"))
{
label = "";
}
else if (value instanceof Object[])
{
label = "(list)";
return label;
}
else if (value instanceof int[])
{
label = "(list)";
return label;
}
else if (value instanceof font)
{
label = ((font)value)._getName().trim();
return label;
}
else if (name.equalsIgnoreCase("icon") || name.equalsIgnoreCase("mouseicon"))
{
if(value == null || value.toString().equals(""))
{
label = "(None)";
}
else
{
label = "(Icon)";
}
return label;
}
else if(editor instanceof Editor.PictureEditor)
{
if(value == null || value.toString().equals(""))
{
label = "(None)";
}
else
{
label = "(Bitmap)";
}
return label;
}
else if(contrlname.equalsIgnoreCase("VB.TextBox") && name.equalsIgnoreCase("text") && ((Boolean)wrapper.getPropValue("multiline")).booleanValue())
{
label = "(Text)";
return label;
}
else if(name.equalsIgnoreCase("itemdata") || name.equalsIgnoreCase("list"))
{
label = "(list)";
return label;
}
else
{
if (name.equalsIgnoreCase("width")
|| name.equalsIgnoreCase("height")
|| name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("top"))
{
short smode = 1;
float Ivalue = 0;
try
{
Ivalue = Util.getFloatValue(value);
}
catch(Exception e)
{
System.out.println("Warning1: " + e);
}
Ivalue = propsheet.JAVAtoVB(Ivalue,name);
if((1-(Ivalue - (int)Ivalue))<0.001 && smode == 1)
{
Ivalue = (int)Ivalue + 1;
}
else if((Ivalue - (int)Ivalue)<0.01 && smode == 1)
{
Ivalue = (int)Ivalue;
}
if((Ivalue - (int)Ivalue) == 0)
{
label = Integer.toString((int)(Ivalue));
}
else
{
label = Float.toString((float)(Ivalue));
}
PropTextbox st = (PropTextbox)view;
st.setText(label);
return label;
}
else if(name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
short smode = 1;
float Ivalue = 0;
Ivalue = Util.getFloatValue(value);
Ivalue = propsheet.JAVAtoVB(Ivalue,name);
if((1-(Ivalue - (int)Ivalue))<0.001 && smode == 1)
{
Ivalue = (int)Ivalue + 1;
}
else if((Ivalue - (int)Ivalue)<0.01 && smode == 1)
{
Ivalue = (int)Ivalue;
}
if((Ivalue - (int)Ivalue) == 0)
{
label = Integer.toString((int)(Ivalue));
}
else
{
label = Float.toString((float)(Ivalue));
}
PropTextbox st = (PropTextbox)view;
st.setText(String.valueOf((int)Ivalue));
return label;
}
else if(name.equalsIgnoreCase("rowheight") || name.equalsIgnoreCase("defcolwidth"))
{
short smode = 1;
float Ivalue = 0;
Ivalue = Util.getFloatValue(value);
Ivalue = propsheet.JAVAtoVB(Ivalue,name);
if((1-(Ivalue - (int)Ivalue)) < 0.001 && smode == 1)
{
Ivalue = (int)Ivalue + 1;
}
else if((Ivalue - (int)Ivalue) < 0.01 && smode == 1)
{
Ivalue = (int)Ivalue;
}
if((Ivalue - (int)Ivalue) == 0)
{
label = Integer.toString((int)(Ivalue));
}
else
{
label = Float.toString((float)(Ivalue));
}
PropTextbox st = (PropTextbox)view;
st.setText(String.valueOf((int)Ivalue));
return label;
}
else if(name.equalsIgnoreCase("index"))
{
if(((Short)value).shortValue() == -1 || value == null)
{
label = "";
}
else
{
label = value.toString();
}
PropTextbox st = (PropTextbox)view;
st.setText(label);
return label;
}
else if(name.equalsIgnoreCase("databasename"))
{
label = value.toString();
PropTextbox st = (PropTextbox)view;
st.setText(label);
return label;
}
else
{
if(value instanceof java.awt.Insets)
{
label = value.toString().substring(value.toString().indexOf("["));
}
else
{
label = value.toString();
if(view instanceof PropTextbox)
{
PropTextbox st = (PropTextbox)view;
st.setText(label);
}
}
return label;
}
}
}
catch(Exception e)
{
;//empty
}
return label;
}
public void setProperty(String name, Object value)
{
if(pTab == null || views == null) return;
int size = pTab.size();
short smode = 1;
float Invalue = 0;
float Ivalue = 0;
for (int i = 0; i < size; i++)
{
Object[] Prop = (Object[])pTab.get(""+i);
PropertyEditor editor = (PropertyEditor)Prop[3];
String wname = (String)Prop[0];
if (name.equalsIgnoreCase(wname))
{
if(name.equalsIgnoreCase("height")
|| name.equalsIgnoreCase("width")
|| name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("top"))
{
Invalue = ((Number)value).floatValue();
Ivalue = this.propsheet.JAVAtoVB(Invalue,name);
}
else if(name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
Ivalue = LineBounds(((Number)value).intValue(),name);
}
else if (name.equalsIgnoreCase("scalemode"))
{
PropChoice yt = (PropChoice)views[i];
if (yt == null) return;
editor.setValue(new Short((short)0));
yt.select(0);
}
if ((!name.equalsIgnoreCase("scalemode"))&&(!name.equalsIgnoreCase("beanbounds")))
{
if(name.equalsIgnoreCase("height")
|| name.equalsIgnoreCase("width")
|| name.equalsIgnoreCase("left")
|| name.equalsIgnoreCase("top"))
{
if(!(views[i] instanceof PropTextbox)) return;
PropTextbox st = (PropTextbox)views[i];
if (st == null) return;
if ((Ivalue - (short)Ivalue) == 0)
{
st.setText(String.valueOf((short)Ivalue));
editor.setValue(new Short((short)Ivalue));
}
else
{
st.setText(String.valueOf(Ivalue));
editor.setValue(new Float(Ivalue));
}
}
else if(name.equalsIgnoreCase("x1")
|| name.equalsIgnoreCase("x2")
|| name.equalsIgnoreCase("y1")
|| name.equalsIgnoreCase("y2"))
{
if(!(views[i] instanceof PropTextbox)) return;
PropTextbox st = (PropTextbox)views[i];
if (st == null) return;
if ((Ivalue - (int)Ivalue) == 0)
{
st.setText(String.valueOf((short)Ivalue));
editor.setValue(new Short((short)Ivalue));
}
else
{
st.setText(String.valueOf(Ivalue));
editor.setValue(new Float(Ivalue));
}
}
else
{
PropTextbox st = (PropTextbox)views[i];
if (st == null) return;
short Value = ((Number)value).shortValue();
st.setText(String.valueOf(Value));
editor.setValue(new Short(Value));
}
}
if (views[i] != null && views[i].isVisible()) {
views[i].setVisible(false);
}
try
{
wrapper.wasModified(editor);
}
catch(Exception ex) {}
break;
}
}
repaint();
}
public void setWrapper(webide.Wrapper wrap)
{
this.wrapper = wrap;
}
public void Dispose()
{
for(int i = 0; i < views.length; i++)
{
if(views[i] instanceof DropButton)
{
if(((DropButton)views[i]).getWinVisible())
{
((DropButton)views[i]).Dispose();
}
}
}
}
private void maxLengthString(String name)
{
if(name.length() > maxLength)
{
maxLength = name.length();
}
}
private int getAddLength()
{
if(maxLength > 12)
{
return (maxLength - 12)*7;
}
else
{
return 0;
}
}
public int getEditWidth()
{
Dimension dim = getSize();
Insets pins = getInsets();
int width = dim.width - pins.left - pins.right;
int insets = 0;
if(scrollbar.isVisible())
{
insets = wodd+1+scrollwidth;
}
else
{
insets = wodd+1;
}
return width - 101 - getAddLength()-insets+scrollwidth+6;
}
private float LineBounds(int value,String name)
{
float Ivalue = 0;
float Invalue = 0;
Invalue = (float)(value);
Ivalue = this.propsheet.JAVAtoVB(Invalue,name);
return Ivalue;
}
private int getStart()
{
return start;
}
private int getL()
{
return pointcount;
}
public int getRow(int pos)
{
for(int i = 0; i < pTab.size(); i++)
{
Object s[] = (Object[])pTab.get(""+i);
int j = ((Integer)s[1]).intValue();
if(j == pos)
{
return i;
}
}
return 0;
}
public int getCurrentRow()
{
return currentRow;
}
public void Repaint()
{
java.awt.Graphics g = getGraphics();
if(g != null)
update(g);
g.dispose();
}
private int getCurrentView(MouseEvent e)
{
int mouseclickpoint = e.getY() - hodd;
if((int)(mouseclickpoint/16) + getStart() <= properlength-1)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?