Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » BeanInfoProblem
BeanInfoProblem [message #139871] Wed, 22 August 2007 04:35
Eclipse User
Originally posted by: caye5200.yahoo.com.cn

This is a multi-part message in MIME format.

------=_NextPart_000_01D6_01C7E4B8.DE8BFCA0
Content-Type: text/plain;
format=flowed;
charset="iso-2022-jp";
reply-type=original
Content-Transfer-Encoding: 7bit


------=_NextPart_000_01D6_01C7E4B8.DE8BFCA0
Content-Type: text/x-java;
name="HiDialogBackBeanInfo.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="HiDialogBackBeanInfo.java"

/**
*=20
*/
package jp.co.hitachi.yokohama.dtv.osdui;

import java.beans.PropertyDescriptor;
import java.util.HashMap;

/**
* @author zhangb
*
*/
public class HiDialogBackBeanInfo extends ComponentBeanInfo{
/* (non-Javadoc)
* @see java.beans.SimpleBeanInfo#getPropertyDescriptors()
*/
private static final String =
CLASSNAME=3D"jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack";
private static final String GET=3D"get";
public PropertyDescriptor[] getPropertyDescriptors() {
try {
int num =3D 0 ;
//get the super's propertyDescriptors
PropertyDescriptor[] p_result=3Dsuper.getPropertyDescriptors();
PropertyDescriptor[] result=3Dnew =
PropertyDescriptor[p_result.length+1];
for(int i=3D0;i<p_result.length;i++)
{=09
result[num]=3Dp_result[i]; =20
String propertyname=3Dresult[num].getName();
//get the propety-set map;
HashMap pvmp=3DDTVBeanInfoUtil.getPropertyValueMap(CLASSNAME);
if (pvmp.containsKey(propertyname))
{
if(pvmp.get(propertyname).equals("false"))
result[num].setHidden(true);
if(pvmp.get(propertyname).equals("disable"))=20
result[num]=3D new PropertyDescriptor(propertyname, =
jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.class =
,parseProperty(propertyname),null); =20
}
num++;=20
}
result[num] =3D new PropertyDescriptor("image", =
jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.class);
result[num].setWriteMethod(null);
result[num++].setValue("enumerationValues", new Object[] {
"TYPE_DBBG_TP1", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D BBG_TP1), =
"jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DBBG_TP1 ",
"TYPE_DBBG_TP1_CTP2", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D BBG_TP1_CTP2)=
, " jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DBBG_TP1_ CTP2 ",
"TYPE_DBBG_TP2", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D BBG_TP2), =
"jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DBBG_TP2 ",
"TYPE_DBBG_TP3", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D BBG_TP3), =
"jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DBBG_TP3 ",
"TYPE_DBBG_TP3_2L", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D BBG_TP3_2L), =
" jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DBBG_TP3_ 2L ",
"TYPE_DBBG_TITLE_TP1", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D BBG_TITLE_TP1=
), " jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DBBG_TITL E_TP1 ",
// "TYPE_DEEFAULT", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_D EEFAULT), =
"jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_DEEFAULT ",
// "TYPE_MAX", new =
Integer(jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_M AX), =
"jp.co.hitachi.yokohama.dtv.osdui.HiDialogBack.TYPE_MAX",
=09
});
return result;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private String parseProperty(String Propertyname)
{
String getProperty=3DPropertyname;
char ch=3DCharacter.toUpperCase(getProperty.charAt(0));
StringBuffer sb=3Dnew StringBuffer();
sb.append(GET);
sb.append(String.valueOf(ch));
sb.append(getProperty.substring(1, getProperty.length()));
getProperty=3Dsb.toString();
return getProperty;
}
// public static void main(String args[])
// {
// HiDialogBackBeanInfo aa=3Dnew HiDialogBackBeanInfo();
// PropertyDescriptor[] resutl=3Daa.getPropertyDescriptors();
// for(int i=3D0;i<resutl.length;i++)
// {=09
// =09
// System.out.println(resutl[i].getName());
// }
// }

}

------=_NextPart_000_01D6_01C7E4B8.DE8BFCA0
Content-Type: text/x-java;
name="ComponentBeanInfo.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="ComponentBeanInfo.java"

package jp.co.hitachi.yokohama.dtv.osdui;

import java.awt.Component;
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.EventSetDescriptor;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;

public class ComponentBeanInfo extends java.beans.SimpleBeanInfo{
=09
public BeanInfo[] getAdditionalBeanInfo() {
try {
return new BeanInfo[]{Introspector.getBeanInfo(Component.class)};
} catch (IntrospectionException e) {
return new BeanInfo[0];
}
}
=20
public PropertyDescriptor[] getPropertyDescriptors() {
try {
=09
//PropertyDescriptor[] =
result=3DIntrospector.getBeanInfo(java.awt.Component.class). getPropertyDe=
scriptors();
PropertyDescriptor[] result=3Dnew PropertyDescriptor[12];
int num =3D 0 ; =09
result[num++] =3D new PropertyDescriptor("background", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("bounds", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("componentOrientation", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("enabled", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("font", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("foreground", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("location", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("maximumSize", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("minimumSize", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("name", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("size", =
java.awt.Component.class);
result[num++] =3D new PropertyDescriptor("visible", =
java.awt.Component.class);
return result;
} catch (IntrospectionException e) {
e.printStackTrace();
return null;
}
}
=20
=09
public BeanDescriptor getBeanDescriptor() {
try {
=20
return =
Introspector.getBeanInfo(Component.class).getBeanDescriptor( );
=20
}catch(IntrospectionException e) {
e.printStackTrace();
return null;
}
}
/**
* Deny knowledge of properties. You can override this
* if you wish to provide explicit property info.
*/

/**
* Deny knowledge of a default property. You can override this
* if you wish to define a default property for the bean.
*/
public int getDefaultPropertyIndex() {
try {
=20
return =
Introspector.getBeanInfo(Component.class).getDefaultProperty Index();
=20
}catch(IntrospectionException e) {
e.printStackTrace();
return -1;
}
}

/**
* Deny knowledge of event sets. You can override this
* if you wish to provide explicit event set info.
*/
public EventSetDescriptor[] getEventSetDescriptors() {
try {
=20
return =
Introspector.getBeanInfo(Component.class).getEventSetDescrip tors();
=20
}catch(IntrospectionException e) {
e.printStackTrace();
return null;
}
}

/**
* Deny knowledge of a default event. You can override this
* if you wish to define a default event for the bean.
*/
public int getDefaultEventIndex() {
try {
=20
return =
Introspector.getBeanInfo(Component.class).getDefaultEventInd ex();
=20
}catch(IntrospectionException e) {
e.printStackTrace();
return -1;
}
}

/**
* Deny knowledge of methods. You can override this
* if you wish to provide explicit method info.
*/
public MethodDescriptor[] getMethodDescriptors() {
try {
=20
return =
Introspector.getBeanInfo(Component.class).getMethodDescripto rs();
=20
}catch(IntrospectionException e) {
e.printStackTrace();
return null;
}
}
}

------=_NextPart_000_01D6_01C7E4B8.DE8BFCA0--
Previous Topic:BeanInfoProblem
Next Topic:BeanInfoProblem
Goto Forum:
  


Current Time: Thu Oct 02 12:37:22 GMT 2014

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

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