home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
Source.bin
/
WizardBeanInfo.java
< prev
next >
Wrap
Text File
|
1998-03-18
|
20KB
|
559 lines
/*
* WizardBeanInfo.java
*/
package symantec.itools.awt;
import java.beans.*;
import symantec.itools.beans.*;
import java.util.ResourceBundle;
/**
* BeanInfo for Wizard.
*/
public class WizardBeanInfo extends SimpleBeanInfo {
/**
* Constructs a WizardBeanInfo object.
*/
public WizardBeanInfo()
{
}
/**
* 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("GroupUtility");
SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
bd.setFolder(s);
bd.setToolbar(s);
//bd.setWinHelp("0x123B2");// TO CHANGE
bd.addAdditionalConnections(getAdditionalBeanInfo());
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("WizardC16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
java.awt.Image img = loadImage("WizardC32.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");
// setSelectedIndex
/*
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE;
MethodDescriptor setSelectedIndex = new MethodDescriptor(beanClass.getMethod("setSelectedIndex", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setSelectedIndex(%arg%);",
conn.getString("SetSelectedIndex"));
connections.addElement(connection);
setSelectedIndex.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setSelectedIndex);
} catch (Exception e) { throw new Error("setSelectedIndex:: " + e.toString()); }
*/
// getSelectedIndex
try{
args = null;
MethodDescriptor getSelectedIndex = new MethodDescriptor(beanClass.getMethod("getSelectedIndex", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getSelectedIndex()",
conn.getString("SetSelectedIndex"));
connections.addElement(connection);
getSelectedIndex.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getSelectedIndex);
} catch (Exception e) { throw new Error("getSelectedIndex:: " + e.toString()); }
// setButtonsAlignment
/*
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE ;
MethodDescriptor setButtonsAlignment = new MethodDescriptor(beanClass.getMethod("setButtonsAlignment", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setButtonsAlignment(%arg%);",
conn.getString("SetButtonsAlignment"));
connections.addElement(connection);
setButtonsAlignment.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setButtonsAlignment);
} catch (Exception e) { throw new Error("setButtonsAlignment:: " + e.toString()); }
*/
// getButtonsAlignment
/*
try{
args = null;
MethodDescriptor getButtonsAlignment = new MethodDescriptor(beanClass.getMethod("getButtonsAlignment", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getButtonsAlignment()",
conn.getString("GetButtonsAlignment"));
connections.addElement(connection);
getButtonsAlignment.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getButtonsAlignment);
} catch (Exception e) { throw new Error("getButtonsAlignment:: " + e.toString()); }
*/
// getPageCount
try{
args = null;
MethodDescriptor getPageCount = new MethodDescriptor(beanClass.getMethod("getPageCount", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getPageCount()",
conn.getString("GetPageCount"));
connections.addElement(connection);
getPageCount.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getPageCount);
} catch (Exception e) { throw new Error("getPageCount:: " + e.toString()); }
// goPrevious
try{
args = null;
MethodDescriptor goPrevious = new MethodDescriptor(beanClass.getMethod("goPrevious", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.goPrevious();",
conn.getString("GoPrevious"));
connections.addElement(connection);
goPrevious.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(goPrevious);
} catch (Exception e) { throw new Error("goPrevious:: " + e.toString()); }
// goNext
try{
args = null;
MethodDescriptor goNext = new MethodDescriptor(beanClass.getMethod("goNext", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.goNext();",
conn.getString("GoNext"));
connections.addElement(connection);
goNext.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(goNext);
} catch (Exception e) { throw new Error("goNext:: " + e.toString()); }
// doFinish
try{
args = null;
MethodDescriptor doFinish = new MethodDescriptor(beanClass.getMethod("doFinish", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.doFinish();",
conn.getString("DoFinish"));
connections.addElement(connection);
doFinish.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(doFinish);
} catch (Exception e) { throw new Error("doFinish:: " + e.toString()); }
// doCancel
try{
args = null;
MethodDescriptor doCancel = new MethodDescriptor(beanClass.getMethod("doCancel", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.doCancel();",
conn.getString("DoCancel"));
connections.addElement(connection);
doCancel.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(doCancel);
} catch (Exception e) { throw new Error("doCancel:: " + e.toString()); }
// doHelp
try{
args = null;
MethodDescriptor doHelp = new MethodDescriptor(beanClass.getMethod("doHelp", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.doHelp();",
conn.getString("DoHelp"));
connections.addElement(connection);
doHelp.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(doHelp);
} catch (Exception e) { throw new Error("doHelp:: " + e.toString()); }
// updateButtonsState
try{
args = null;
MethodDescriptor updateButtonsState = new MethodDescriptor(beanClass.getMethod("updateButtonsState", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.updateButtonsState();",
conn.getString("SetButtonsState"));
connections.addElement(connection);
updateButtonsState.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(updateButtonsState);
} catch (Exception e) { throw new Error("updateButtonsState:: " + e.toString()); }
// setPreviousEnabled
try{
args = new Class[1];
args[0] = java.lang.Boolean.TYPE;
MethodDescriptor setPreviousEnabled = new MethodDescriptor(beanClass.getMethod("setPreviousEnabled", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setPreviousEnabled(true);",
conn.getString("SetPreviousEnabledTrue"));
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setPreviousEnabled(false);",
conn.getString("SetPreviousEnabledFalse"));
connections.addElement(connection);
setPreviousEnabled.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setPreviousEnabled);
} catch (Exception e) { throw new Error("setPreviousEnabled:: " + e.toString()); }
// setNextEnabled
try{
args = new Class[1];
args[0] = java.lang.Boolean.TYPE;
MethodDescriptor setNextEnabled = new MethodDescriptor(beanClass.getMethod("setNextEnabled", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setNextEnabled(true);",
conn.getString("SetNextEnabledTrue"));
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setNextEnabled(false);",
conn.getString("SetNextEnabledFalse"));
connections.addElement(connection);
setNextEnabled.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setNextEnabled);
} catch (Exception e) { throw new Error("setNextEnabled:: " + e.toString()); }
// setFinishEnabled
try{
args = new Class[1];
args[0] = java.lang.Boolean.TYPE;
MethodDescriptor setFinishEnabled = new MethodDescriptor(beanClass.getMethod("setFinishEnabled", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setFinishEnabled(true);",
conn.getString("SetFinishEnabledTrue"));
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setFinishEnabled(false);",
conn.getString("SetFinishEnabledFalse"));
connections.addElement(connection);
setFinishEnabled.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setFinishEnabled);
} catch (Exception e) { throw new Error("setFinishEnabled:: " + e.toString()); }
// setCancelEnabled
try{
args = new Class[1];
args[0] = java.lang.Boolean.TYPE;
MethodDescriptor setCancelEnabled = new MethodDescriptor(beanClass.getMethod("setCancelEnabled", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setCancelEnabled(true);",
conn.getString("SetCancelEnabledTrue"));
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setCancelEnabled(false);",
conn.getString("SetCancelEnabledFalse"));
connections.addElement(connection);
setCancelEnabled.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setCancelEnabled);
} catch (Exception e) { throw new Error("setCancelEnabled:: " + e.toString()); }
// setHelpEnabled
try{
args = new Class[1];
args[0] = java.lang.Boolean.TYPE;
MethodDescriptor setHelpEnabled = new MethodDescriptor(beanClass.getMethod("setHelpEnabled", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setHelpEnabled(true);",
conn.getString("SetHelpEnabledTrue"));
connections.addElement(connection);
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setHelpEnabled(false);",
conn.getString("SetHelpEnabledFalse"));
connections.addElement(connection);
setHelpEnabled.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setHelpEnabled);
} catch (Exception e) { throw new Error("setHelpEnabled:: " + e.toString()); }
// setNextPageIndex
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE;
MethodDescriptor setNextPageIndex = new MethodDescriptor(beanClass.getMethod("setNextPageIndex", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setNextPageIndex(%arg%);",
conn.getString("SetNextPageIndex"));
connections.addElement(connection);
setNextPageIndex.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setNextPageIndex);
} catch (Exception e) { throw new Error("setNextPageName:: " + e.toString()); }
// setPreviousPageIndex
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE;
MethodDescriptor setPreviousPageIndex = new MethodDescriptor(beanClass.getMethod("setPreviousPageIndex", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setPreviousPageIndex(%arg%);",
conn.getString("SetPreviousPageIndex"));
connections.addElement(connection);
setPreviousPageIndex.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setPreviousPageIndex);
} catch (Exception e) { throw new Error("setPreviousPageName:: " + e.toString()); }
// setNextPage
try{
args = new Class[1];
args[0] = java.awt.Component.class;
MethodDescriptor setNextPage = new MethodDescriptor(beanClass.getMethod("setNextPage", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "java.awt.Component", "",
"%name%.setNextPage(%arg%);",
conn.getString("SetNextPage"));
connections.addElement(connection);
setNextPage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setNextPage);
} catch (Exception e) { throw new Error("setNextPage:: " + e.toString()); }
// setPreviousPage
try{
args = new Class[1];
args[0] = java.awt.Component.class;
MethodDescriptor setPreviousPage = new MethodDescriptor(beanClass.getMethod("setPreviousPage", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "java.awt.Component", "",
"%name%.setPreviousPage(%arg%);",
conn.getString("SetPreviousPage"));
connections.addElement(connection);
setPreviousPage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setPreviousPage);
} catch (Exception e) { throw new Error("setPreviousPage:: " + 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{
// SelectedIndex
PropertyDescriptor selectedIndex = new PropertyDescriptor("selectedIndex", beanClass,
"getSelectedIndex", null);
selectedIndex.setBound(true);
//selectedIndex.setConstrained(true);
selectedIndex.setDisplayName(prop.getString("SelectedIndex"));
selectedIndex.setHidden(true);
// ComponentAt
/*
PropertyDescriptor componentAt = new PropertyDescriptor("componentAt", beanClass);
componentAt.setBound(true);
componentAt.setConstrained(true);
componentAt.setDisplayName("Component at index");
componentAt.setHidden(true);
*/
// HelpButtonVisible
PropertyDescriptor helpButtonVisible = new PropertyDescriptor("helpButtonVisible", beanClass);
helpButtonVisible.setBound(true);
helpButtonVisible.setConstrained(true);
helpButtonVisible.setDisplayName(prop.getString("HelpButtonVisible"));
// Combined button
PropertyDescriptor combinedButton = new PropertyDescriptor("combinedButton", beanClass);
combinedButton.setBound(true);
combinedButton.setConstrained(true);
combinedButton.setDisplayName(prop.getString("CombinedButton"));
// Buttons alignment
PropertyDescriptor buttonsAlignment = new PropertyDescriptor("buttonsAlignment", beanClass);
buttonsAlignment.setBound(true);
buttonsAlignment.setConstrained(true);
buttonsAlignment.setDisplayName(prop.getString("ButtonsAlignment"));
buttonsAlignment.setValue("ENUMERATION", "LEFT=0, CENTER=1, RIGHT=2");
// PageCount
PropertyDescriptor pageCount = new PropertyDescriptor("pageCount", beanClass,
"getPageCount", null);
pageCount.setBound(true);
pageCount.setDisplayName(prop.getString("PageCount"));
pageCount.setHidden(true);
// Layout
PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
layout.setHidden(true);
PropertyDescriptor[] rv = {
selectedIndex,
//componentAt,
helpButtonVisible,
combinedButton,
buttonsAlignment,
pageCount,
layout};
return rv;
} catch (IntrospectionException e) { throw new Error(e.toString()); }
}
/*
public EventSetDescriptor[] getEventSetDescriptors() {
try {
EventSetDescriptor action = new EventSetDescriptor();
} catch() {}
public EventSetDescriptor(Class sourceClass,
String eventSetName,
Class listenerType,
String listenerMethodName) throws IntrospectionException
}
*/
/**
* Returns the index of the property expected to be changed most often by the designer.
*/
public int getDefaultPropertyIndex() {
return 0; // the index for our default property is always 0
}
private final static Class beanClass = symantec.itools.awt.Wizard.class;
}