帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
1.1 KiB

package com.fr.design.gui.core;
import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
public class CustomWidgetOption extends WidgetOption {
private static final long serialVersionUID = -8144214820100962842L;
private String optionName;
private Icon optionIcon;
private Class<? extends Widget> widgetClass;
public CustomWidgetOption(String optionName, Icon optionIcon, Class<? extends Widget> widgetClass) {
this.optionName = optionName;
this.optionIcon = optionIcon;
this.widgetClass = widgetClass;
}
@Override
public Widget createWidget() {
Class<? extends Widget> cls = widgetClass();
try {
Widget ins = cls.newInstance();
return ins ;
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
@Override
public String optionName() {
return this.optionName;
}
@Override
public Icon optionIcon() {
return this.optionIcon;
}
@Override
public Class<? extends Widget> widgetClass() {
return this.widgetClass;
}
}