@Override public void widgetSelected( SelectionEvent e ) { try { final Method parameterlessActionMethod = fireActionOnClass.getMethod( actionName, (Class[]) null ); parameterlessActionMethod.invoke( fireActionOn, (Object[]) null ); } catch ( Exception exception ) { throw WidgetProcessorException.newException( exception ); } } } );
/** * Static constructor. * <p> * Using static constructor methods prevents unnecessarily nesting WidgetProcessorExceptions * within WidgetProcessorExceptions. */ public static WidgetProcessorException newException( Throwable cause ) { if ( cause instanceof WidgetProcessorException ) { return (WidgetProcessorException) cause; } return new WidgetProcessorException( cause ); }
public void buttonClick( ClickEvent event ) { try { Method method = fireActionOnClass.getMethod( actionName, (Class[]) null ); method.invoke( fireActionOn, (Object[]) null ); } catch ( Exception e ) { throw WidgetProcessorException.newException( e ); } } } );
/** * Static constructor. * <p> * For consistency with <code>WidgetProcessorException.newException( Throwable )</code>. */ public static WidgetProcessorException newException( String message ) { return new WidgetProcessorException( message ); }
public void addWidgetProcessor( WidgetProcessor<W, M> widgetProcessor ) { configureOnce(); if ( mWidgetProcessors == null ) { mWidgetProcessors = new ArrayList<WidgetProcessor<W, M>>(); } else if ( mWidgetProcessors.contains( widgetProcessor ) ) { throw WidgetProcessorException.newException( "List of WidgetProcessors already contains " + widgetProcessor.getClass() ); } mWidgetProcessors.add( widgetProcessor ); }
/** * Static constructor. * <p> * For consistency with <code>WidgetProcessorException.newException( Throwable )</code>. */ public static WidgetProcessorException newException( String message, Throwable cause ) { return new WidgetProcessorException( message, cause ); }
public void addWidgetProcessor( WidgetProcessor<W, M> widgetProcessor ) { configureOnce(); if ( mWidgetProcessors == null ) { mWidgetProcessors = new ArrayList<WidgetProcessor<W, M>>(); } else if ( mWidgetProcessors.contains( widgetProcessor ) ) { throw WidgetProcessorException.newException( "List of WidgetProcessors already contains " + widgetProcessor.getClass() ); } mWidgetProcessors.add( widgetProcessor ); }
/** * Static constructor. * <p> * Using static constructor methods prevents unnecessarily nesting WidgetProcessorExceptions * within WidgetProcessorExceptions. */ public static WidgetProcessorException newException( Throwable cause ) { if ( cause instanceof WidgetProcessorException ) { return (WidgetProcessorException) cause; } return new WidgetProcessorException( cause ); }
private CoreWidget getNumberConverter( CoreWidget existingConverter ) { if ( existingConverter != null ) { if ( !( existingConverter instanceof ConvertNumberWidget ) ) { throw WidgetProcessorException.newException( "Unable to set number attributes on a " + existingConverter ); } return existingConverter; } return new ConvertNumberWidget(); }
/** * Static constructor. * <p> * For consistency with <code>WidgetProcessorException.newException( Throwable )</code>. */ public static WidgetProcessorException newException( String message ) { return new WidgetProcessorException( message ); }
private CoreWidget getDateTimeConverter( CoreWidget existingConverter ) { if ( existingConverter != null ) { if ( !( existingConverter instanceof ConvertDateTimeWidget ) ) { throw WidgetProcessorException.newException( "Unable to set date/time attributes on a " + existingConverter ); } return existingConverter; } return new ConvertDateTimeWidget(); }
/** * Static constructor. * <p> * For consistency with <code>WidgetProcessorException.newException( Throwable )</code>. */ public static WidgetProcessorException newException( String message, Throwable cause ) { return new WidgetProcessorException( message, cause ); }
public void onClick( View viewClicked ) { Object traverse = mBindTo; for ( String name : mNames ) { if ( traverse == null ) { return; } traverse = ClassUtils.getProperty( traverse, name ); } try { mAction.invoke( traverse, (Object[]) null ); } catch ( Exception e ) { throw WidgetProcessorException.newException( e ); } } }
public UIComponent processWidget( UIComponent component, String elementName, Map<String, String> attributes, UIMetawidget metawidget ) { Method method; try { method = component.getClass().getMethod( "setLabel", String.class ); } catch ( NoSuchMethodException e ) { // Fail gracefully for JSF 1.1 return component; } try { method.invoke( component, metawidget.getLabelString( attributes ) ); return component; } catch ( Exception e ) { throw WidgetProcessorException.newException( e ); } } }
public UIComponent processWidget( UIComponent component, String elementName, Map<String, String> attributes, UIMetawidget metawidget ) { Method method; try { method = component.getClass().getMethod( "setLabel", String.class ); } catch ( NoSuchMethodException e ) { // Fail gracefully for JSF 1.1 return component; } try { method.invoke( component, metawidget.getLabelString( attributes ) ); return component; } catch ( Exception e ) { throw WidgetProcessorException.newException( e ); } } }
throw WidgetProcessorException.newException( "Unknown type " + mNumberClass );
private DateTimeConverter getDateTimeConverter( Converter existingConverter ) { if ( existingConverter != null ) { if ( !( existingConverter instanceof DateTimeConverter ) ) { throw WidgetProcessorException.newException( "Unable to set date/time attributes on a " + existingConverter.getClass() ); } return (DateTimeConverter) existingConverter; } // In case the application defines its own one FacesContext context = FacesContext.getCurrentInstance(); DateTimeConverter dateTimeConverter = (DateTimeConverter) context.getApplication().createConverter( Date.class ); if ( dateTimeConverter != null ) { return dateTimeConverter; } // The JSF default return new DateTimeConverter(); }
private DateTimeConverter getDateTimeConverter( Converter existingConverter ) { if ( existingConverter != null ) { if ( !( existingConverter instanceof DateTimeConverter ) ) { throw WidgetProcessorException.newException( "Unable to set date/time attributes on a " + existingConverter.getClass() ); } return (DateTimeConverter) existingConverter; } // In case the application defines its own one FacesContext context = FacesContext.getCurrentInstance(); DateTimeConverter dateTimeConverter = (DateTimeConverter) context.getApplication().createConverter( Date.class ); if ( dateTimeConverter != null ) { return dateTimeConverter; } // The JSF default return new DateTimeConverter(); }
public UIComponent processWidget( UIComponent component, String elementName, Map<String, String> attributes, UIMetawidget metawidget ) { String immediateString = attributes.get( FACES_IMMEDIATE ); if ( immediateString == null ) { return component; } boolean immediate = Boolean.parseBoolean( immediateString ); if ( component instanceof ActionSource ) { ( (ActionSource) component ).setImmediate( immediate ); return component; } if ( component instanceof EditableValueHolder ) { ( (EditableValueHolder) component ).setImmediate( immediate ); return component; } throw WidgetProcessorException.newException( "'Immediate' cannot be applied to " + component.getClass() ); } }
private NumberConverter getNumberConverter( Converter existingConverter ) { if ( existingConverter != null ) { if ( !( existingConverter instanceof NumberConverter ) ) { throw WidgetProcessorException.newException( "Unable to set number attributes on a " + existingConverter.getClass() ); } return (NumberConverter) existingConverter; } // In case the application defines its own one FacesContext context = FacesContext.getCurrentInstance(); NumberConverter numberConverter = (NumberConverter) context.getApplication().createConverter( Number.class ); if ( numberConverter != null ) { return numberConverter; } // The JSF default return new NumberConverter(); } }