home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1998 February
/
VPR9802A.ISO
/
APP_DEMO
/
VC
/
SOURCE.BIN
/
StateCheckBoxBeanInfo.java
< prev
next >
Wrap
Text File
|
1997-10-27
|
8KB
|
234 lines
package symantec.itools.awt;
import java.beans.*;
import symantec.itools.beans.*;
/**
* BeanInfo for StateCheckBox
*
*/
public class StateCheckBoxBeanInfo extends SimpleBeanInfo {
/**
* Constructs a StateCheckBoxBeanInfo object.
*/
public StateCheckBoxBeanInfo() {
}
/**
* Gets a BeanInfo for the superclass of this bean.
* @return BeanInfo[] containing this bean's superclass BeanInfo
*/
public BeanInfo[] getAdditionalBeanInfo() {
try {
BeanInfo[] bi = new BeanInfo[1];
bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
return bi;
}
catch (IntrospectionException e) { throw new Error(e.toString());}
}
/**
* Gets the SymantecBeanDescriptor for this bean.
* @return an object of type SymantecBeanDescriptor
* @see symantec.itools.beans.SymantecBeanDescriptor
*/
public BeanDescriptor getBeanDescriptor() {
SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
bd.setFolder("追加");
bd.setToolbar("追加");
// bd.setFolder("Additional");
// bd.setToolbar("Additional");
bd.setWinHelp("0x123A7");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.TWO_STATE",
"スタイル: 2点切替"));
// "Style: TWO_STATE"));
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.THREE_STATE",
"スタイル: 3点切替"));
// "Style: THREE_STATE"));
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.STATE_UNCHECKED",
"チェック オフ"));
// "STATE_UNCHECKED"));
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.STATE_CHECKED",
"チェック オン"));
// "STATE_CHECKED"));
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.STATE_DEFAULT",
"デフォルト"));
// "STATE_DEFAULT"));
return (BeanDescriptor) bd;
}
/**
* Gets an image that may be used to visually represent this bean
* (in the toolbar, on a form, etc).
* @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
* BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
* @return an image for this bean, always color even if requested monochrome
* @see BeanInfo#ICON_MONO_16x16
* @see BeanInfo#ICON_COLOR_16x16
* @see BeanInfo#ICON_MONO_32x32
* @see BeanInfo#ICON_COLOR_32x32
*/
public java.awt.Image getIcon(int iconKind) {
if (iconKind == BeanInfo.ICON_MONO_16x16 ||
iconKind == BeanInfo.ICON_COLOR_16x16) {
java.awt.Image img = loadImage("StateCheckBoxC16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
java.awt.Image img = loadImage("StateCheckBoxC32.gif");
return img;
}
return null;
}
/**
* Gets an array of descriptions of the methods used for "connections" by
* Visual Caf's Interaction Wizard.
* Included in each method description is a CONNECTIONS ConnectionDescriptor.
* @return method descriptions for this bean
* @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
*/
public MethodDescriptor[] getMethodDescriptors() {
Class[] args;
ConnectionDescriptor connection;
java.util.Vector connections;
java.util.Vector md = new java.util.Vector();
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE ;
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setStyle", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setStyle(%arg%);",
"スタイルを設定する");
// "Set the checkbox style");
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("setStyle:: " + e.toString()); }
try{
args = null;
MethodDescriptor getStyle = new MethodDescriptor(beanClass.getMethod("getStyle", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getStyle()",
"スタイルを取得する");
// "Get the checkbox style");
connections.addElement(connection);
getStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getStyle);
} catch (Exception e) { throw new Error("getStyle:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE ;
MethodDescriptor setState = new MethodDescriptor(beanClass.getMethod("setState", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setState(%arg%);",
"状態を設定する");
// "Set the checkbox state");
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setState(%name%.STATE_UNCHECKED);",
"チェックマークをクリアする");
// "Clear the checkbox");
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setState(%name%.STATE_CHECKED);",
"チェックマークをセットする");
// "Check the checkbox");
connections.addElement(connection);
setState.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setState);
} catch (Exception e) { throw new Error("setState:: " + e.toString()); }
try{
args = null;
MethodDescriptor getState = new MethodDescriptor(beanClass.getMethod("getState", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getState()",
"状態を取得する");
// "Get the checkbox state");
connections.addElement(connection);
connection = new ConnectionDescriptor("output", "boolean", "",
"(%name%.getState() == %name%.STATE_CHECKED)",
"チェックマークがセットされているならば");
// "Is checkbox On?");
connections.addElement(connection);
connection = new ConnectionDescriptor("output", "boolean", "",
"(%name%.getState() == %name%.STATE_UNCHECKED)",
"チェックマークがクリアされているならば");
// "Is checkbox Off?");
connections.addElement(connection);
getState.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getState);
} catch (Exception e) { throw new Error("getState:: " + e.toString()); }
MethodDescriptor[] rv = new MethodDescriptor[md.size()];
md.copyInto(rv);
return rv;
}
/**
* Returns descriptions of this bean's properties.
*/
public PropertyDescriptor[] getPropertyDescriptors() {
try{
PropertyDescriptor style = new PropertyDescriptor("style", beanClass);
style.setBound(true);
style.setConstrained(true);
style.setDisplayName("スタイル");
// style.setDisplayName("Style");
style.setValue("ENUMERATION", "TWO_STATE=0, THREE_STATE=1");
PropertyDescriptor state = new PropertyDescriptor("state", beanClass);
state.setBound(true);
state.setConstrained(true);
state.setDisplayName("状態");
// state.setDisplayName("State");
state.setValue("ENUMERATION", "STATE_UNCHECKED=0, STATE_CHECKED=1, STATE_DEFAULT=2");
PropertyDescriptor[] rv = {
style,
state};
return rv;
} catch (IntrospectionException e) { throw new Error(e.toString()); }
}
private final static Class beanClass = StateCheckBox.class;
} // end of class StateCheckBoxBeanInfo