public static Button getButton ( final String id , final String buttonName , final String buttonDesc , final String style , final boolean setStyle , final Resource icon , final Class < ? extends SPUIButtonDecorator > buttonDecoratorclassName ) { Button button = null ; SPUIButtonDecorator buttonDecorator = null ; try { // Create instance buttonDecorator = buttonDecoratorclassName . newInstance ( ) ; // Decorate button button = buttonDecorator . decorate ( new SPUIButton ( id , buttonName , buttonDesc ) , style , setStyle , icon ) ; } catch ( final InstantiationException exception ) { LOG . error ( "Error occured while creating Button decorator-" + buttonName , exception ) ; } catch ( final IllegalAccessException exception ) { LOG . error ( "Error occured while acessing Button decorator-" + buttonName , exception ) ; } return button ; }
Get Button - Factory Approach for decoration .