home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 11.3 KB | 318 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 07/17/97 LAB Moved connection for setTickStyle property back into base class, since that's
- // where it is now. Changed the TickFreq property's constrained flag to true.
- // Added connections for TickFreq property. Added a decrement current value connection.
- // Added toggle, set, is, and is not connections for the ShowBorder property.
- // 09/07/97 LAB Fixed misspelling of descriptions.
-
- /**
- * BeanInfo for Slider.
- *
- */
- public class SliderBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a SliderBeanInfo object.
- */
- public SliderBeanInfo() {
- }
-
- /**
- * 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);
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.TICK_BOTH",
- conn.getString("TICK_BOTH")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.TICK_NONE",
- conn.getString("TICK_NONE")));
-
-
- return (BeanDescriptor) bd;
- }
-
- /**
- * 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();
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- String s;
-
- try{
- args = null;
- MethodDescriptor getMaxValue = new MethodDescriptor(beanClass.getMethod("getMaxValue", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getMaxValue");
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getMaxValue()",s);
- connections.addElement(connection);
-
- getMaxValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getMaxValue);
- } catch (Exception e) { throw new Error("getMaxValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setMaxValue = new MethodDescriptor(beanClass.getMethod("setMaxValue", args));
-
- connections = new java.util.Vector();
- s=conn.getString("setMaxValue");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setMaxValue(%arg%);",s);
- connections.addElement(connection);
-
- setMaxValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setMaxValue);
- } catch (Exception e) { throw new Error("setMaxValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setTickStyle = new MethodDescriptor(beanClass.getMethod("setTickStyle", args));
-
- connections = new java.util.Vector();
- s=conn.getString("setTickStyle");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setTickStyle(%arg%);",s);
- connections.addElement(connection);
-
- setTickStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTickStyle);
- } catch (Exception e) { throw new Error("setTickStyle:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTickStyle = new MethodDescriptor(beanClass.getMethod("getTickStyle", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getTickStyle");
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getTickStyle()",s);
- connections.addElement(connection);
-
- getTickStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTickStyle);
- } catch (Exception e) { throw new Error("getTickStyle:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getMinValue = new MethodDescriptor(beanClass.getMethod("getMinValue", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getMinValue");
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getMinValue()",s);
- connections.addElement(connection);
-
- getMinValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getMinValue);
- } catch (Exception e) { throw new Error("getMinValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setMinValue = new MethodDescriptor(beanClass.getMethod("setMinValue", args));
-
- connections = new java.util.Vector();
- s=conn.getString("setMinValue");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setMinValue(%arg%);",s);
- connections.addElement(connection);
-
- setMinValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setMinValue);
- } catch (Exception e) { throw new Error("setMinValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setValue = new MethodDescriptor(beanClass.getMethod("setValue", args));
-
- connections = new java.util.Vector();
- s=conn.getString("setValueCurr");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setValue(%arg%);",s);
- connections.addElement(connection);
-
- s=conn.getString("setValueInc");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setValue(%name%.getValue()+%arg%);",s);
- connections.addElement(connection);
-
- s=conn.getString("setValueDec");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setValue(%name%.getValue()-%arg%);",s);
- connections.addElement(connection);
-
- setValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setValue);
- } catch (Exception e) { throw new Error("setValue:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getValue = new MethodDescriptor(beanClass.getMethod("getValue", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getValue");
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getValue()",s);
- connections.addElement(connection);
-
- getValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getValue);
- } catch (Exception e) { throw new Error("getValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setTickFreq = new MethodDescriptor(beanClass.getMethod("setTickFreq", args));
-
- connections = new java.util.Vector();
- s=conn.getString("setTickFreq");
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setTickFreq(%arg%);",s);
- connections.addElement(connection);
-
- setTickFreq.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTickFreq);
- } catch (Exception e) { throw new Error("setTickFreq:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTickFreq = new MethodDescriptor(beanClass.getMethod("getTickFreq", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getTickFreq");
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getTickFreq()",s);
- connections.addElement(connection);
-
- getTickFreq.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTickFreq);
- } catch (Exception e) { throw new Error("getTickFreq:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setShowBorder = new MethodDescriptor(beanClass.getMethod("setShowBorder", args));
-
- connections = new java.util.Vector();
- s=conn.getString("setShowBorderToggle");
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setShowBorder(!%name%.isShowBorder());",s);
- connections.addElement(connection);
-
- s=conn.getString("setShowBorderValue");
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setShowBorder(%arg%);",s);
- connections.addElement(connection);
-
- setShowBorder.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setShowBorder);
- } catch (Exception e) { throw new Error("setShowBorder:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isShowBorder = new MethodDescriptor(beanClass.getMethod("isShowBorder", args));
-
- connections = new java.util.Vector();
- s=conn.getString("isShowBorder");
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isShowBorder()",s);
- connections.addElement(connection);
-
- s=conn.getString("isNotShowBorder");
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isShowBorder()",s);
- connections.addElement(connection);
-
- isShowBorder.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isShowBorder);
- } catch (Exception e) { throw new Error("isShowBorder:: " + e.toString()); }
-
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- md.copyInto(rv);
-
- return rv;
- }
-
- /**
- * Returns descriptions of this bean's properties.
- */
- public PropertyDescriptor[] getPropertyDescriptors() {
- ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
-
- try{
- PropertyDescriptor minValue = new PropertyDescriptor("minValue", beanClass);
- minValue.setBound(true);
- minValue.setConstrained(true);
- minValue.setDisplayName(prop.getString("minValue"));
-
- PropertyDescriptor maxValue = new PropertyDescriptor("maxValue", beanClass);
- maxValue.setBound(true);
- maxValue.setConstrained(true);
- maxValue.setDisplayName(prop.getString("maxValue"));
-
- PropertyDescriptor tickFreq = new PropertyDescriptor("tickFreq", beanClass);
- tickFreq.setBound(true);
- tickFreq.setConstrained(true);
- tickFreq.setDisplayName(prop.getString("tickFreq"));
-
- PropertyDescriptor value = new PropertyDescriptor("value", beanClass);
- value.setBound(true);
- value.setConstrained(true);
- value.setDisplayName(prop.getString("value"));
-
- PropertyDescriptor showBorder = new PropertyDescriptor("showBorder", beanClass);
- showBorder.setBound(true);
- showBorder.setConstrained(true);
- showBorder.setDisplayName(prop.getString("showBorder"));
-
- PropertyDescriptor[] rv = {
- minValue,
- maxValue,
- tickFreq,
- value,
- showBorder};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = Slider.class;
-
- } // end of class SliderBeanInfo