home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 15.3 KB | 411 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 07/17/97 LAB Changed constrained property of gapColor to true. Changed constrained property
- // of enforceMinDim to true. Changed constrained property of propResize to true.
- // Added use3DBorder property. Added allowDynamicMoving property. Updated boolean
- // get<PropertyName> to is<PropertyName> for enforceMinDim and propResize. Added
- // toggle connections for enforceMinDim and propResize. Added toggle, set, is and
- // is not connections for use3DBorder and allowDynamicMoving properties.
- // 09/07/97 LAB Fixed misspelling of descriptions.
- // 09/11/97 LAB Hid layout property (Addresses Mac Bug #7610).
-
- /**
- * BeanInfo for SplitterPanel.
- *
- */
- public class SplitterPanelBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a SplitterPanelBeanInfo object.
- */
- public SplitterPanelBeanInfo() {
- }
-
- /**
- * 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() {
- ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
- String s=group.getString("GroupPanel");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder(s);
- bd.setToolbar(s);
- bd.setWinHelp("0x123BA");
-
- 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("SplitterPanelC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("SplitterPanelC32.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();
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
-
- try{
- args = null;
- MethodDescriptor isEnforceMinDim = new MethodDescriptor(beanClass.getMethod("isEnforceMinDim", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isEnforceMinDim()",
- conn.getString("isEnforceMinDim"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isEnforceMinDim()",
- conn.getString("isNotEnforceMinDim"));
- connections.addElement(connection);
-
- isEnforceMinDim.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isEnforceMinDim);
- } catch (Exception e) { throw new Error("isEnforceMinDim:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setGapSizes = new MethodDescriptor(beanClass.getMethod("setGapSizes", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setGapSizes(%arg%);",
- conn.getString("setGapSizes"));
- connections.addElement(connection);
-
- setGapSizes.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setGapSizes);
- } catch (Exception e) { throw new Error("setGapSizes:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor iBdrSize = new MethodDescriptor(beanClass.getMethod("iBdrSize", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.iBdrSize()",
- conn.getString("iBdrSize"));
- connections.addElement(connection);
-
- iBdrSize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(iBdrSize);
- } catch (Exception e) { throw new Error("iBdrSize:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isPropResize = new MethodDescriptor(beanClass.getMethod("isPropResize", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isPropResize()",
- conn.getString("isPropResize"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.getPropResize()",
- conn.getString("getPropResize"));
- connections.addElement(connection);
-
- isPropResize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isPropResize);
- } catch (Exception e) { throw new Error("isPropResize:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor oBdrSize = new MethodDescriptor(beanClass.getMethod("oBdrSize", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.oBdrSize()",
- conn.getString("oBdrSize"));
- connections.addElement(connection);
-
- oBdrSize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(oBdrSize);
- } catch (Exception e) { throw new Error("oBdrSize:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setEnforceMinDim = new MethodDescriptor(beanClass.getMethod("setEnforceMinDim", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setEnforceMinDim(%arg%);",
- conn.getString("setEnforceMinDimValue"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setEnforceMinDim(!%name%.isEnforceMinDim());",
- conn.getString("setEnforceMinDimToggle"));
- connections.addElement(connection);
-
- setEnforceMinDim.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setEnforceMinDim);
- } catch (Exception e) { throw new Error("setEnforceMinDim:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getGapColor = new MethodDescriptor(beanClass.getMethod("getGapColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getGapColor()",
- conn.getString("getGapColor"));
- connections.addElement(connection);
-
- getGapColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getGapColor);
- } catch (Exception e) { throw new Error("getGapColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setGapColor = new MethodDescriptor(beanClass.getMethod("setGapColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setGapColor(%arg%);",
- conn.getString("setGapColor"));
- connections.addElement(connection);
-
- setGapColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setGapColor);
- } catch (Exception e) { throw new Error("setGapColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setBdrSizes = new MethodDescriptor(beanClass.getMethod("setBdrSizes", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setBdrSizes(%arg%);",
- conn.getString("setBdrSizes"));
- connections.addElement(connection);
-
- setBdrSizes.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBdrSizes);
- } catch (Exception e) { throw new Error("setBdrSizes:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setPropResize = new MethodDescriptor(beanClass.getMethod("setPropResize", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setPropResize(%arg%);",
- conn.getString("setPropResizeValue"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setPropResize(!%name%.isPropResize());",
- conn.getString("setPropResizeToggle"));
- connections.addElement(connection);
-
- setPropResize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setPropResize);
- } catch (Exception e) { throw new Error("setPropResize:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor removeAll = new MethodDescriptor(beanClass.getMethod("removeAll", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.removeAll();",
- conn.getString("removeAll"));
- connections.addElement(connection);
-
- removeAll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(removeAll);
- } catch (Exception e) { throw new Error("removeAll:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setUse3DBorder = new MethodDescriptor(beanClass.getMethod("setUse3DBorder", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setUse3DBorder(!%name%.isUse3DBorder());",
- conn.getString("setUse3DBorderToggle"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setUse3DBorder(%arg%);",
- conn.getString("setUse3DBorderValue"));
- connections.addElement(connection);
-
- setUse3DBorder.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setUse3DBorder);
- } catch (Exception e) { throw new Error("setUse3DBorder:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isUse3DBorder = new MethodDescriptor(beanClass.getMethod("isUse3DBorder", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isUse3DBorder()",
- conn.getString("isUse3DBorder"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isUse3DBorder()",
- conn.getString("isNotUse3DBorder"));
- connections.addElement(connection);
-
- isUse3DBorder.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isUse3DBorder);
- } catch (Exception e) { throw new Error("isUse3DBorder:: " + e.toString()); }
-
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setAllowDynamicMoving = new MethodDescriptor(beanClass.getMethod("setAllowDynamicMoving", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setAllowDynamicMoving(!%name%.isAllowDynamicMoving());",
- conn.getString("setAllowDynamicMovingToggle"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setAllowDynamicMoving(%arg%);",
- conn.getString("setAllowDynamicMovingValue"));
- connections.addElement(connection);
-
- setAllowDynamicMoving.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setAllowDynamicMoving);
- } catch (Exception e) { throw new Error("setAllowDynamicMoving:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isAllowDynamicMoving = new MethodDescriptor(beanClass.getMethod("isAllowDynamicMoving", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isAllowDynamicMoving()",
- conn.getString("isAllowDynamicMoving"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isAllowDynamicMoving()",
- conn.getString("isNotAllowDynamicMoving"));
- connections.addElement(connection);
-
- isAllowDynamicMoving.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isAllowDynamicMoving);
- } catch (Exception e) { throw new Error("isAllowDynamicMoving:: " + 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 gapColor = new PropertyDescriptor("gapColor", beanClass);
- gapColor.setBound(true);
- gapColor.setConstrained(true);
- gapColor.setDisplayName(prop.getString("gapColor"));
-
- PropertyDescriptor enforceMinDim = new PropertyDescriptor("enforceMinDim", beanClass);
- enforceMinDim.setBound(true);
- enforceMinDim.setConstrained(true);
- enforceMinDim.setDisplayName(prop.getString("enforceMinDim"));
-
- PropertyDescriptor propResize = new PropertyDescriptor("propResize", beanClass);
- propResize.setBound(true);
- propResize.setConstrained(true);
- propResize.setDisplayName(prop.getString("propResize"));
-
- PropertyDescriptor use3DBorder = new PropertyDescriptor("use3DBorder", beanClass);
- use3DBorder.setBound(true);
- use3DBorder.setConstrained(true);
- use3DBorder.setDisplayName(prop.getString("use3DBorder"));
-
- PropertyDescriptor allowDynamicMoving = new PropertyDescriptor("allowDynamicMoving", beanClass);
- allowDynamicMoving.setBound(true);
- allowDynamicMoving.setConstrained(true);
- allowDynamicMoving.setDisplayName(prop.getString("allowDynamicMoving"));
-
- PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
- layout.setHidden(true);
-
- PropertyDescriptor[] rv = {
- gapColor,
- enforceMinDim,
- propResize,
- use3DBorder,
- allowDynamicMoving,
- layout};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = SplitterPanel.class;
-
- } // end of class SplitterPanelBeanInfo