Summary
dishevelled.org identify provides lightweight components for identifiable beans, those marked as having a name and an icon bundle. The identify project has a dependency on the dishevelled.org iconbundle library and requires java version 1.6 or later.
A bean becomes identifiable by implementing the Identifiable interface:
class MyBean implements Identifiable { /** Icon bundle. */ private static final IconBundle BNDL = new PNGIconBundle("mybean.png"); @Override public String getName() { return "MyBean"; } @Override public IconBundle getIconBundle() { return BNDL; } }
by having the BeanDescriptor in its BeanInfo class extend IdentifiableBeanDescriptor:
final class MyBeanInfo extends SimpleBeanInfo { /** Icon bundle. */ private static final IconBundle BNDL = new PNGIconBundle("mybean.png"); /** Bean descriptor. */ private final beanDescriptor = new IdentifiableBeanDescriptor(MyBean.class) { @Override public int getNamePropertyIndex() { // return the index of a property descriptor to use as the "name" property return 1; } @Override public IconBundle getIconBundle() { return BNDL; } }; @Override public BeanDescriptor getBeanDescriptor() { return beanDescriptor; } }
or by doing nothing and accepting the defaults as implemented in IdentifyUtils.
Acknowledgements
- Powered by Apache Maven.
- Project hosting by SourceForge.net.