Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » is too complicated to be evaluated
is too complicated to be evaluated [message #18368] Wed, 11 February 2004 15:35 Go to next message
Peter Villiger is currently offline Peter VilligerFriend
Messages: 10
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0166_01C3F0BD.0340A800
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0167_01C3F0BD.0340A800"


------=_NextPart_001_0167_01C3F0BD.0340A800
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

We have developed more then 2 thousand panels with VisualAge-VCE. Now we =
are going to use Visual Editor.
=20
Several subclassed Swing-Beans were extended with a String-Property =
(propertyName). This property is only set by constants. To set a =
String-Property with constants, we developed a corresponding =
Property-Editor (PropertryNameEditor).=20

The Source Code Patterns used by VE are well known. In our cases the =
constants can't be evaluated, the constants are defined in a separate =
interface (IDs).

Actually, there is no need to evaluate the constant it could be set =
directly like a quoted String.

Is there any solution for this case?

regards
peter

ps: The distinction between quoted String and a constant is done in =
class org.eclipse.jem.internal.proxy.remote.REMStringBeanTypeProxy =
method #newInstance(String).

------=_NextPart_001_0167_01C3F0BD.0340A800
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff background=3D"">
<DIV><FONT face=3DArial size=3D2>We have developed more then 2 thousand =
panels with=20
VisualAge-VCE. Now we are going to use Visual Editor.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;<BR>Several subclassed =
Swing-Beans were=20
extended with a String-Property (propertyName). This property is only =
set by=20
constants. To set a String-Property with constants, we developed a =
corresponding=20
Property-Editor (PropertryNameEditor). </FONT></DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>The Source Code Patterns used by VE are well known. In our =
cases the=20
constants can't be evaluated, the constants are defined in a separate =
interface=20
(IDs).</DIV>
<DIV><BR>Actually, there is no need to evaluate the constant it could be =
set=20
directly like a quoted String.<BR></DIV>
<DIV>Is there any solution for this case?<BR></DIV>
<DIV>regards<BR>peter<BR></DIV>
<DIV>ps: The distinction between quoted String and a constant is done in =
class=20
org.eclipse.jem.internal.proxy.remote.REMStringBeanTypeProxy method=20
#newInstance(String).<BR></FONT></DIV></BODY></HTML>

------=_NextPart_001_0167_01C3F0BD.0340A800--

------=_NextPart_000_0166_01C3F0BD.0340A800
Content-Type: text/x-java;
name="TextFieldViewBeanInfo.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="TextFieldViewBeanInfo.java"

/*
* Created on 11.02.2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package ch.suva.ve.test;

/**
* @author pev
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class TextFieldViewBeanInfo extends java.beans.SimpleBeanInfo {
/**
* Find the method by comparing (name & parameter size) against the =
methods in the class.
* @return java.lang.reflect.Method
* @param aClass java.lang.Class
* @param methodName java.lang.String
* @param parameterCount int
*/
public static java.lang.reflect.Method findMethod(java.lang.Class =
aClass, java.lang.String methodName, int parameterCount) {
try {
/* Since this method attempts to find a method by getting all methods =
from the class,
this method should only be called if getMethod cannot find the method. =
*/
java.lang.reflect.Method methods[] =3D aClass.getMethods();
for (int index =3D 0; index < methods.length; index++){
java.lang.reflect.Method method =3D methods[index];
if ((method.getParameterTypes().length =3D=3D parameterCount) && =
(method.getName().equals(methodName))) {
return method;
}
}
} catch (java.lang.Throwable exception) {
return null;
}
return null;
}
/**
* Returns the BeanInfo of the superclass of this bean to inherit its =
features.
* @return java.beans.BeanInfo[]
*/
public java.beans.BeanInfo[] getAdditionalBeanInfo() {
java.lang.Class superClass;
java.beans.BeanInfo superBeanInfo =3D null;

try {
superClass =3D getBeanDescriptor().getBeanClass().getSuperclass();
} catch (java.lang.Throwable exception) {
return null;
}

try {
superBeanInfo =3D java.beans.Introspector.getBeanInfo(superClass);
} catch (java.beans.IntrospectionException ie) {}

if (superBeanInfo !=3D null) {
java.beans.BeanInfo[] ret =3D new java.beans.BeanInfo[1];
ret[0] =3D superBeanInfo;
return ret;
}
return null;
}
/**
* Gets the bean class.
* @return java.lang.Class
*/
public static java.lang.Class getBeanClass() {
return TextFieldView.class;
}
/**
* Gets the bean class name.
* @return java.lang.String
*/
public static java.lang.String getBeanClassName() {
return "ch.suva.ve.test.TextFieldView";
}
public java.beans.BeanDescriptor getBeanDescriptor() {
java.beans.BeanDescriptor aDescriptor =3D null;
try {
/* Create and return the TextFieldViewBeanInfo bean descriptor. */
aDescriptor =3D new =
java.beans.BeanDescriptor(ch.suva.ve.test.TextFieldView.clas s);
aDescriptor.setDisplayName("ch.suva.ve.test.TextFieldView");
aDescriptor.setShortDescription("ch.suva.ve.test.TextFieldView ");
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("hidden-state", Boolean.FALSE); */
} catch (Throwable exception) {
};
return aDescriptor;
}
/**
* Return the event set descriptors for this bean.
* @return java.beans.EventSetDescriptor[]
*/
public java.beans.EventSetDescriptor[] getEventSetDescriptors() {
try {
java.beans.EventSetDescriptor aDescriptorList[] =3D {};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}
/**
* Return the method descriptors for this bean.
* @return java.beans.MethodDescriptor[]
*/
public java.beans.MethodDescriptor[] getMethodDescriptors() {
try {
java.beans.MethodDescriptor aDescriptorList[] =3D {
getPropertyNameMethodDescriptor()
,setPropertyName_javalangStringMethodDescriptor()
};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}
/**
* Return the property descriptors for this bean.
* @return java.beans.PropertyDescriptor[]
*/
public java.beans.PropertyDescriptor[] getPropertyDescriptors() {
try {
java.beans.PropertyDescriptor aDescriptorList[] =3D {
propertyNamePropertyDescriptor()
};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}
/**
* Gets the getPropertyName() method descriptor.
* @return java.beans.MethodDescriptor
*/
public java.beans.MethodDescriptor getPropertyNameMethodDescriptor() {
java.beans.MethodDescriptor aDescriptor =3D null;
try {
/* Create and return the getPropertyName() method descriptor. */
java.lang.reflect.Method aMethod =3D null;
try {
/* Attempt to find the method using getMethod with parameter types. =
*/
java.lang.Class aParameterTypes[] =3D {};
aMethod =3D getBeanClass().getMethod("getPropertyName", =
aParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aMethod =3D findMethod(getBeanClass(), "getPropertyName", 0);
};
try {
/* Try creating the method descriptor with parameter descriptors. */
java.beans.ParameterDescriptor aParameterDescriptors[] =3D {};
aDescriptor =3D new java.beans.MethodDescriptor(aMethod, =
aParameterDescriptors);
} catch (Throwable exception) {
/* Try creating the method descriptor without parameter descriptors. =
*/
handleException(exception);
aDescriptor =3D new java.beans.MethodDescriptor(aMethod);
};
/* aDescriptor.setDisplayName("getPropertyName()"); */
/* aDescriptor.setShortDescription("getPropertyName()"); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}
/**
* Called whenever the bean information class throws an exception.
* @param exception java.lang.Throwable
*/
private void handleException(java.lang.Throwable exception) {

/* Uncomment the following lines to print uncaught exceptions to stdout =
*/
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
}
/**
* Gets the propertyName property descriptor.
* @return java.beans.PropertyDescriptor
*/
public java.beans.PropertyDescriptor propertyNamePropertyDescriptor() {
java.beans.PropertyDescriptor aDescriptor =3D null;
try {
try {
/* Using methods via getMethod is the faster way to create the =
propertyName property descriptor. */
java.lang.reflect.Method aGetMethod =3D null;
try {
/* Attempt to find the method using getMethod with parameter types. =
*/
java.lang.Class aGetMethodParameterTypes[] =3D {};
aGetMethod =3D getBeanClass().getMethod("getPropertyName", =
aGetMethodParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aGetMethod =3D findMethod(getBeanClass(), "getPropertyName", 0);
};
java.lang.reflect.Method aSetMethod =3D null;
try {
/* Attempt to find the method using getMethod with parameter types. =
*/
java.lang.Class aSetMethodParameterTypes[] =3D {
java.lang.String.class
};
aSetMethod =3D getBeanClass().getMethod("setPropertyName", =
aSetMethodParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aSetMethod =3D findMethod(getBeanClass(), "setPropertyName", 1);
};
aDescriptor =3D new java.beans.PropertyDescriptor("propertyName"
, aGetMethod, aSetMethod);
} catch (Throwable exception) {
/* Since we failed using methods, try creating a default property =
descriptor. */
handleException(exception);
aDescriptor =3D new java.beans.PropertyDescriptor("propertyName"
, getBeanClass());
};
aDescriptor.setBound(true);
/* aDescriptor.setConstrained(false); */
=
aDescriptor.setPropertyEditorClass(java.lang.Class.forName("ch.suva.ve.te=
st.PropertyNameEditor"));
/* aDescriptor.setDisplayName("propertyName"); */
/* aDescriptor.setShortDescription("propertyName"); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
/* aDescriptor.setValue("ivjDesignTimeProperty", new Boolean(true)); =
*/
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}
/**
* Gets the setPropertyName(java.lang.String) method descriptor.
* @return java.beans.MethodDescriptor
*/
public java.beans.MethodDescriptor =
setPropertyName_javalangStringMethodDescriptor() {
java.beans.MethodDescriptor aDescriptor =3D null;
try {
/* Create and return the setPropertyName(java.lang.String) method =
descriptor. */
java.lang.reflect.Method aMethod =3D null;
try {
/* Attempt to find the method using getMethod with parameter types. =
*/
java.lang.Class aParameterTypes[] =3D {
java.lang.String.class
};
aMethod =3D getBeanClass().getMethod("setPropertyName", =
aParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aMethod =3D findMethod(getBeanClass(), "setPropertyName", 1);
};
try {
/* Try creating the method descriptor with parameter descriptors. */
java.beans.ParameterDescriptor aParameterDescriptor1 =3D new =
java.beans.ParameterDescriptor();
aParameterDescriptor1.setName("arg1");
aParameterDescriptor1.setDisplayName("name");
java.beans.ParameterDescriptor aParameterDescriptors[] =3D {
aParameterDescriptor1
};
aDescriptor =3D new java.beans.MethodDescriptor(aMethod, =
aParameterDescriptors);
} catch (Throwable exception) {
/* Try creating the method descriptor without parameter descriptors. =
*/
handleException(exception);
aDescriptor =3D new java.beans.MethodDescriptor(aMethod);
};
/* aDescriptor.setDisplayName("setPropertyName(java.lang.String) "); */
/* =
aDescriptor.setShortDescription("setPropertyName(java.lang.String) "); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}
}


------=_NextPart_000_0166_01C3F0BD.0340A800
Content-Type: text/x-java;
name="MyPanel.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="MyPanel.java"

/*
* Created on 11.02.2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package ch.suva.ve.test;

import javax.swing.JPanel;

/**
* @author pev
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class MyPanel extends JPanel implements IDs {
=09
protected TextFieldView ivjTextFieldView1 =3D null;

private TextFieldView getTextFieldView1() {
if (ivjTextFieldView1 =3D=3D null) {
try {
ivjTextFieldView1 =3D new TextFieldView();
ivjTextFieldView1.setName("TextFieldView1");
ivjTextFieldView1.setColumns(5);
ivjTextFieldView1.setPropertyName(CONST_2);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjTextFieldView1;
}

private void initialize() {
try {
// user code begin {1}
// user code end
setName("MyPanel");
setSize(572, 348);

java.awt.GridBagConstraints constraintsTextFieldView1 =3D new =
java.awt.GridBagConstraints();
constraintsTextFieldView1.gridx =3D 0;=20
constraintsTextFieldView1.gridy =3D 0;
constraintsTextFieldView1.anchor =3D =
java.awt.GridBagConstraints.WEST;
constraintsTextFieldView1.insets =3D new java.awt.Insets(4, 4, 4, =
4);
add(getTextFieldView1 (),constraintsTextFieldView1);
=09
}=20
catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}

private void handleException(java.lang.Throwable exception) {

/* Uncomment the following lines to print uncaught exceptions to =
stdout */
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
}
=09

}

------=_NextPart_000_0166_01C3F0BD.0340A800
Content-Type: text/x-java;
name="PropertyNameEditor.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="PropertyNameEditor.java"

/*
* Created on 11.02.2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package ch.suva.ve.test;

/**
* @author pev
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class PropertyNameEditor extends java.beans.PropertyEditorSupport =
{
=09
protected PropertyNameEditor() {
super();
}
protected PropertyNameEditor(Object source) {
super(source);
}
/**
* Insert the method's description here.
* Creation date: (17.07.00 17:35:53)
* @return java.lang.String
*/
public String getJavaInitializationString() {

try
{
if(getValue() !=3D null)
{
return (String)getValue();
}
}
catch (Exception e)
{
//e.printStackTrace();
}

//Falls das nicht moeglich ist
try
{
if(getValue() !=3D null)
{
return getValue().toString();
}
}
catch (Exception e)
{
//e.printStackTrace();
}
//Falls das auch nicht moeglich ist
return "";
}
/**
* Sets the property value by parsing a given String. May raise
* java.lang.IllegalArgumentException if either the String is
* badly formatted or if this kind of property can't be expressed
* as text.
*
* @param text The string to be parsed.
*/
public void setAsText(String text) throws =
java.lang.IllegalArgumentException {

if (text !=3D null && text instanceof String)=20
setValue(text);
else
setValue("");
}=09

}

------=_NextPart_000_0166_01C3F0BD.0340A800
Content-Type: text/x-java;
name="TextFieldView.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="TextFieldView.java"

/*
* Created on 11.02.2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package ch.suva.ve.test;

import javax.swing.JTextField;

/**
* @author pev
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class TextFieldView extends JTextField {


protected String propertyName = null;

public void setPropertyName(String name) {
propertyName = name;
}

public String getPropertyName() {
return propertyName;
}

}

------=_NextPart_000_0166_01C3F0BD.0340A800
Content-Type: text/x-java;
name="IDs.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="IDs.java"

/*
* Created on 11.02.2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package ch.suva.ve.test;

/**
* @author pev
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public interface IDs {
public static final String CONST_1 = "const1";
public static final String CONST_2 = "const2";
}

------=_NextPart_000_0166_01C3F0BD.0340A800--
Re: is too complicated to be evaluated [message #18392 is a reply to message #18368] Wed, 11 February 2004 16:08 Go to previous messageGo to next message
Peter Villiger is currently offline Peter VilligerFriend
Messages: 10
Registered: July 2009
Junior Member
attachment:

------------ PanelView -------------
import javax.swing.JPanel;
public class MyPanel extends JPanel implements IDs {

protected TextFieldView ivjTextFieldView1 = null;

private TextFieldView getTextFieldView1() {
if (ivjTextFieldView1 == null) {
try {
ivjTextFieldView1 = new TextFieldView();
ivjTextFieldView1.setName("TextFieldView1");
ivjTextFieldView1.setColumns(5);
ivjTextFieldView1.setPropertyName(CONST_2);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjTextFieldView1;
}

private void initialize() {
try {
// user code begin {1}
// user code end
setName("MyPanel");
setSize(572, 348);
java.awt.GridBagConstraints constraintsTextFieldView1 = new
java.awt.GridBagConstraints();
constraintsTextFieldView1.gridx = 0;
constraintsTextFieldView1.gridy = 0;
constraintsTextFieldView1.anchor = java.awt.GridBagConstraints.WEST;
constraintsTextFieldView1.insets = new java.awt.Insets(4, 4, 4, 4);
add(getTextFieldView1 (),constraintsTextFieldView1);

}
catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}

private void handleException(java.lang.Throwable exception) {
}
}

------------ TextFieldView -------------
import javax.swing.JTextField;
public class TextFieldView extends JTextField {

protected String propertyName = null;

public void setPropertyName(String name) {
propertyName = name;
}

public String getPropertyName() {
return propertyName;
}
}

------------ IDs -------------
public interface IDs {
public static final String CONST_1 = "const1";
public static final String CONST_2 = "const2";
}

------------ PropertyNameEditor -------------
public class PropertyNameEditor extends java.beans.PropertyEditorSupport {

protected PropertyNameEditor() {
super();
}
protected PropertyNameEditor(Object source) {
super(source);
}

public String getJavaInitializationString() {

try {
if(getValue() != null) {
return (String)getValue();
}
}
catch (Exception e) {}

try {
if(getValue() != null) {
return getValue().toString();
}
}
catch (Exception e) {}
return "";
}

public void setAsText(String text) throws
java.lang.IllegalArgumentException {

if (text != null && text instanceof String)
setValue(text);
else
setValue("");
}
}

------------ BeanInfo ----------------
public class TextFieldViewBeanInfo extends java.beans.SimpleBeanInfo {

public static java.lang.reflect.Method findMethod(java.lang.Class aClass,
java.lang.String methodName, int parameterCount) {
try {
java.lang.reflect.Method methods[] = aClass.getMethods();
for (int index = 0; index < methods.length; index++){
java.lang.reflect.Method method = methods[index];
if ((method.getParameterTypes().length == parameterCount) &&
(method.getName().equals(methodName))) {
return method;
}
}
} catch (java.lang.Throwable exception) {
return null;
}
return null;
}

public java.beans.BeanInfo[] getAdditionalBeanInfo() {
java.lang.Class superClass;
java.beans.BeanInfo superBeanInfo = null;

try {
superClass = getBeanDescriptor().getBeanClass().getSuperclass();
} catch (java.lang.Throwable exception) {
return null;
}

try {
superBeanInfo = java.beans.Introspector.getBeanInfo(superClass);
} catch (java.beans.IntrospectionException ie) {}

if (superBeanInfo != null) {
java.beans.BeanInfo[] ret = new java.beans.BeanInfo[1];
ret[0] = superBeanInfo;
return ret;
}
return null;
}

public static java.lang.Class getBeanClass() {
return TextFieldView.class;
}

public static java.lang.String getBeanClassName() {
return "ch.suva.ve.test.TextFieldView";
}
public java.beans.BeanDescriptor getBeanDescriptor() {
java.beans.BeanDescriptor aDescriptor = null;
try {
/* Create and return the TextFieldViewBeanInfo bean descriptor. */
aDescriptor = new
java.beans.BeanDescriptor(ch.suva.ve.test.TextFieldView.clas s);
aDescriptor.setDisplayName("ch.suva.ve.test.TextFieldView");
aDescriptor.setShortDescription("ch.suva.ve.test.TextFieldView ");
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("hidden-state", Boolean.FALSE); */
} catch (Throwable exception) {
};
return aDescriptor;
}

public java.beans.EventSetDescriptor[] getEventSetDescriptors() {
try {
java.beans.EventSetDescriptor aDescriptorList[] = {};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}

public java.beans.MethodDescriptor[] getMethodDescriptors() {
try {
java.beans.MethodDescriptor aDescriptorList[] = {
getPropertyNameMethodDescriptor()
,setPropertyName_javalangStringMethodDescriptor()
};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}

public java.beans.PropertyDescriptor[] getPropertyDescriptors() {
try {
java.beans.PropertyDescriptor aDescriptorList[] = {
propertyNamePropertyDescriptor()
};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}

public java.beans.MethodDescriptor getPropertyNameMethodDescriptor() {
java.beans.MethodDescriptor aDescriptor = null;
try {
/* Create and return the getPropertyName() method descriptor. */
java.lang.reflect.Method aMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aParameterTypes[] = {};
aMethod = getBeanClass().getMethod("getPropertyName", aParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aMethod = findMethod(getBeanClass(), "getPropertyName", 0);
};
try {
/* Try creating the method descriptor with parameter descriptors. */
java.beans.ParameterDescriptor aParameterDescriptors[] = {};
aDescriptor = new java.beans.MethodDescriptor(aMethod,
aParameterDescriptors);
} catch (Throwable exception) {
/* Try creating the method descriptor without parameter descriptors. */
handleException(exception);
aDescriptor = new java.beans.MethodDescriptor(aMethod);
};
/* aDescriptor.setDisplayName("getPropertyName()"); */
/* aDescriptor.setShortDescription("getPropertyName()"); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}

private void handleException(java.lang.Throwable exception) {
}

public java.beans.PropertyDescriptor propertyNamePropertyDescriptor() {
java.beans.PropertyDescriptor aDescriptor = null;
try {
try {
/* Using methods via getMethod is the faster way to create the
propertyName property descriptor. */
java.lang.reflect.Method aGetMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aGetMethodParameterTypes[] = {};
aGetMethod = getBeanClass().getMethod("getPropertyName",
aGetMethodParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aGetMethod = findMethod(getBeanClass(), "getPropertyName", 0);
};
java.lang.reflect.Method aSetMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aSetMethodParameterTypes[] = {
java.lang.String.class
};
aSetMethod = getBeanClass().getMethod("setPropertyName",
aSetMethodParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aSetMethod = findMethod(getBeanClass(), "setPropertyName", 1);
};
aDescriptor = new java.beans.PropertyDescriptor("propertyName"
, aGetMethod, aSetMethod);
} catch (Throwable exception) {
/* Since we failed using methods, try creating a default property
descriptor. */
handleException(exception);
aDescriptor = new java.beans.PropertyDescriptor("propertyName"
, getBeanClass());
};
aDescriptor.setBound(true);
/* aDescriptor.setConstrained(false); */
aDescriptor.setPropertyEditorClass(java.lang.Class.forName("ch.suva.ve.test.PropertyNameEditor "));
/* aDescriptor.setDisplayName("propertyName"); */
/* aDescriptor.setShortDescription("propertyName"); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
/* aDescriptor.setValue("ivjDesignTimeProperty", new Boolean(true)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}

public java.beans.MethodDescriptor
setPropertyName_javalangStringMethodDescriptor() {
java.beans.MethodDescriptor aDescriptor = null;
try {
/* Create and return the setPropertyName(java.lang.String) method
descriptor. */
java.lang.reflect.Method aMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aParameterTypes[] = {
java.lang.String.class
};
aMethod = getBeanClass().getMethod("setPropertyName", aParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aMethod = findMethod(getBeanClass(), "setPropertyName", 1);
};
try {
/* Try creating the method descriptor with parameter descriptors. */
java.beans.ParameterDescriptor aParameterDescriptor1 = new
java.beans.ParameterDescriptor();
aParameterDescriptor1.setName("arg1");
aParameterDescriptor1.setDisplayName("name");
java.beans.ParameterDescriptor aParameterDescriptors[] = {
aParameterDescriptor1
};
aDescriptor = new java.beans.MethodDescriptor(aMethod,
aParameterDescriptors);
} catch (Throwable exception) {
/* Try creating the method descriptor without parameter descriptors. */
handleException(exception);
aDescriptor = new java.beans.MethodDescriptor(aMethod);
};
/* aDescriptor.setDisplayName("setPropertyName(java.lang.String) "); */
/* aDescriptor.setShortDescription("setPropertyName(java.lang.String) ");
*/
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}
}
Re: is too complicated to be evaluated [message #18407 is a reply to message #18368] Wed, 11 February 2004 16:20 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

Just ignore the too complicated msg. It doesn't cause any problems. It
simply doesn't set the text in the image. It doesn't prevent the editor
from being used and changing anything else.

The next release will be able to handle the constant.

--
Thanks, Rich Kulp

Re: is too complicated to be evaluated [message #580744 is a reply to message #18368] Wed, 11 February 2004 16:08 Go to previous message
Peter Villiger is currently offline Peter VilligerFriend
Messages: 10
Registered: July 2009
Junior Member
attachment:

------------ PanelView -------------
import javax.swing.JPanel;
public class MyPanel extends JPanel implements IDs {

protected TextFieldView ivjTextFieldView1 = null;

private TextFieldView getTextFieldView1() {
if (ivjTextFieldView1 == null) {
try {
ivjTextFieldView1 = new TextFieldView();
ivjTextFieldView1.setName("TextFieldView1");
ivjTextFieldView1.setColumns(5);
ivjTextFieldView1.setPropertyName(CONST_2);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjTextFieldView1;
}

private void initialize() {
try {
// user code begin {1}
// user code end
setName("MyPanel");
setSize(572, 348);
java.awt.GridBagConstraints constraintsTextFieldView1 = new
java.awt.GridBagConstraints();
constraintsTextFieldView1.gridx = 0;
constraintsTextFieldView1.gridy = 0;
constraintsTextFieldView1.anchor = java.awt.GridBagConstraints.WEST;
constraintsTextFieldView1.insets = new java.awt.Insets(4, 4, 4, 4);
add(getTextFieldView1 (),constraintsTextFieldView1);

}
catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}

private void handleException(java.lang.Throwable exception) {
}
}

------------ TextFieldView -------------
import javax.swing.JTextField;
public class TextFieldView extends JTextField {

protected String propertyName = null;

public void setPropertyName(String name) {
propertyName = name;
}

public String getPropertyName() {
return propertyName;
}
}

------------ IDs -------------
public interface IDs {
public static final String CONST_1 = "const1";
public static final String CONST_2 = "const2";
}

------------ PropertyNameEditor -------------
public class PropertyNameEditor extends java.beans.PropertyEditorSupport {

protected PropertyNameEditor() {
super();
}
protected PropertyNameEditor(Object source) {
super(source);
}

public String getJavaInitializationString() {

try {
if(getValue() != null) {
return (String)getValue();
}
}
catch (Exception e) {}

try {
if(getValue() != null) {
return getValue().toString();
}
}
catch (Exception e) {}
return "";
}

public void setAsText(String text) throws
java.lang.IllegalArgumentException {

if (text != null && text instanceof String)
setValue(text);
else
setValue("");
}
}

------------ BeanInfo ----------------
public class TextFieldViewBeanInfo extends java.beans.SimpleBeanInfo {

public static java.lang.reflect.Method findMethod(java.lang.Class aClass,
java.lang.String methodName, int parameterCount) {
try {
java.lang.reflect.Method methods[] = aClass.getMethods();
for (int index = 0; index < methods.length; index++){
java.lang.reflect.Method method = methods[index];
if ((method.getParameterTypes().length == parameterCount) &&
(method.getName().equals(methodName))) {
return method;
}
}
} catch (java.lang.Throwable exception) {
return null;
}
return null;
}

public java.beans.BeanInfo[] getAdditionalBeanInfo() {
java.lang.Class superClass;
java.beans.BeanInfo superBeanInfo = null;

try {
superClass = getBeanDescriptor().getBeanClass().getSuperclass();
} catch (java.lang.Throwable exception) {
return null;
}

try {
superBeanInfo = java.beans.Introspector.getBeanInfo(superClass);
} catch (java.beans.IntrospectionException ie) {}

if (superBeanInfo != null) {
java.beans.BeanInfo[] ret = new java.beans.BeanInfo[1];
ret[0] = superBeanInfo;
return ret;
}
return null;
}

public static java.lang.Class getBeanClass() {
return TextFieldView.class;
}

public static java.lang.String getBeanClassName() {
return "ch.suva.ve.test.TextFieldView";
}
public java.beans.BeanDescriptor getBeanDescriptor() {
java.beans.BeanDescriptor aDescriptor = null;
try {
/* Create and return the TextFieldViewBeanInfo bean descriptor. */
aDescriptor = new
java.beans.BeanDescriptor(ch.suva.ve.test.TextFieldView.clas s);
aDescriptor.setDisplayName("ch.suva.ve.test.TextFieldView");
aDescriptor.setShortDescription("ch.suva.ve.test.TextFieldView ");
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("hidden-state", Boolean.FALSE); */
} catch (Throwable exception) {
};
return aDescriptor;
}

public java.beans.EventSetDescriptor[] getEventSetDescriptors() {
try {
java.beans.EventSetDescriptor aDescriptorList[] = {};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}

public java.beans.MethodDescriptor[] getMethodDescriptors() {
try {
java.beans.MethodDescriptor aDescriptorList[] = {
getPropertyNameMethodDescriptor()
,setPropertyName_javalangStringMethodDescriptor()
};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}

public java.beans.PropertyDescriptor[] getPropertyDescriptors() {
try {
java.beans.PropertyDescriptor aDescriptorList[] = {
propertyNamePropertyDescriptor()
};
return aDescriptorList;
} catch (Throwable exception) {
handleException(exception);
};
return null;
}

public java.beans.MethodDescriptor getPropertyNameMethodDescriptor() {
java.beans.MethodDescriptor aDescriptor = null;
try {
/* Create and return the getPropertyName() method descriptor. */
java.lang.reflect.Method aMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aParameterTypes[] = {};
aMethod = getBeanClass().getMethod("getPropertyName", aParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aMethod = findMethod(getBeanClass(), "getPropertyName", 0);
};
try {
/* Try creating the method descriptor with parameter descriptors. */
java.beans.ParameterDescriptor aParameterDescriptors[] = {};
aDescriptor = new java.beans.MethodDescriptor(aMethod,
aParameterDescriptors);
} catch (Throwable exception) {
/* Try creating the method descriptor without parameter descriptors. */
handleException(exception);
aDescriptor = new java.beans.MethodDescriptor(aMethod);
};
/* aDescriptor.setDisplayName("getPropertyName()"); */
/* aDescriptor.setShortDescription("getPropertyName()"); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}

private void handleException(java.lang.Throwable exception) {
}

public java.beans.PropertyDescriptor propertyNamePropertyDescriptor() {
java.beans.PropertyDescriptor aDescriptor = null;
try {
try {
/* Using methods via getMethod is the faster way to create the
propertyName property descriptor. */
java.lang.reflect.Method aGetMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aGetMethodParameterTypes[] = {};
aGetMethod = getBeanClass().getMethod("getPropertyName",
aGetMethodParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aGetMethod = findMethod(getBeanClass(), "getPropertyName", 0);
};
java.lang.reflect.Method aSetMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aSetMethodParameterTypes[] = {
java.lang.String.class
};
aSetMethod = getBeanClass().getMethod("setPropertyName",
aSetMethodParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aSetMethod = findMethod(getBeanClass(), "setPropertyName", 1);
};
aDescriptor = new java.beans.PropertyDescriptor("propertyName"
, aGetMethod, aSetMethod);
} catch (Throwable exception) {
/* Since we failed using methods, try creating a default property
descriptor. */
handleException(exception);
aDescriptor = new java.beans.PropertyDescriptor("propertyName"
, getBeanClass());
};
aDescriptor.setBound(true);
/* aDescriptor.setConstrained(false); */
aDescriptor.setPropertyEditorClass(java.lang.Class.forName("ch.suva.ve.test.PropertyNameEditor "));
/* aDescriptor.setDisplayName("propertyName"); */
/* aDescriptor.setShortDescription("propertyName"); */
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
/* aDescriptor.setValue("ivjDesignTimeProperty", new Boolean(true)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}

public java.beans.MethodDescriptor
setPropertyName_javalangStringMethodDescriptor() {
java.beans.MethodDescriptor aDescriptor = null;
try {
/* Create and return the setPropertyName(java.lang.String) method
descriptor. */
java.lang.reflect.Method aMethod = null;
try {
/* Attempt to find the method using getMethod with parameter types. */
java.lang.Class aParameterTypes[] = {
java.lang.String.class
};
aMethod = getBeanClass().getMethod("setPropertyName", aParameterTypes);
} catch (Throwable exception) {
/* Since getMethod failed, call findMethod. */
handleException(exception);
aMethod = findMethod(getBeanClass(), "setPropertyName", 1);
};
try {
/* Try creating the method descriptor with parameter descriptors. */
java.beans.ParameterDescriptor aParameterDescriptor1 = new
java.beans.ParameterDescriptor();
aParameterDescriptor1.setName("arg1");
aParameterDescriptor1.setDisplayName("name");
java.beans.ParameterDescriptor aParameterDescriptors[] = {
aParameterDescriptor1
};
aDescriptor = new java.beans.MethodDescriptor(aMethod,
aParameterDescriptors);
} catch (Throwable exception) {
/* Try creating the method descriptor without parameter descriptors. */
handleException(exception);
aDescriptor = new java.beans.MethodDescriptor(aMethod);
};
/* aDescriptor.setDisplayName("setPropertyName(java.lang.String) "); */
/* aDescriptor.setShortDescription("setPropertyName(java.lang.String) ");
*/
/* aDescriptor.setExpert(false); */
/* aDescriptor.setHidden(false); */
/* aDescriptor.setValue("preferred", new Boolean(false)); */
} catch (Throwable exception) {
handleException(exception);
};
return aDescriptor;
}
}
Re: is too complicated to be evaluated [message #580767 is a reply to message #18368] Wed, 11 February 2004 16:20 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

Just ignore the too complicated msg. It doesn't cause any problems. It
simply doesn't set the text in the image. It doesn't prevent the editor
from being used and changing anything else.

The next release will be able to handle the constant.

--
Thanks, Rich Kulp

Previous Topic:is too complicated to be evaluated
Next Topic:initialize() vs. initComponents()
Goto Forum:
  


Current Time: Wed Feb 05 17:55:24 GMT 2025

Powered by FUDForum. Page generated in 0.02875 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top