idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
3,600
public static StyleSheetItem create ( final StyleSheetParams styleSheetParams ) { return StyleSheetItemImpl . create ( ) . uid ( styleSheetIdGenerator . incrementAndGet ( ) ) . set ( styleSheetParams ) ; }
Build a style sheet item .
3,601
public static FXMLItem create ( final FXMLParams fxmlParams ) { return FXMLItemImpl . create ( true ) . uid ( fxmlIdGenerator . incrementAndGet ( ) ) . set ( fxmlParams ) ; }
Build a Singleton FXML item .
3,602
public static MessageItem create ( final Message messageParams ) { return MessageItemImpl . create ( ) . uid ( messageIdGenerator . incrementAndGet ( ) ) . set ( messageParams ) ; }
Build a Message item .
3,603
void initTabEventHandler ( final ToggleButton tabButton ) { try { tabButton . setOnDragDetected ( getHandler ( MouseEvent . DRAG_DETECTED ) ) ; tabButton . setOnAction ( getHandler ( ActionEvent . ACTION ) ) ; } catch ( final CoreException ce ) { LOGGER . error ( "Error while attaching event handler" , ce ) ; } }
Inits the tab event handler .
3,604
public static < D extends Object > Object buildCustomizableClass ( final ParameterItem < Class < ? > > parameter , final Class < D > defaultObject , final Class < ? > interfaceClass ) { Object object = null ; try { object = parameter . get ( ) . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { LOGGER . error ( CUSTOM_CLASS_LOADING_ERROR , e , interfaceClass . getSimpleName ( ) ) ; try { object = defaultObject . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e2 ) { throw new CoreRuntimeException ( "Impossible to build Default " + interfaceClass . getSimpleName ( ) , e2 ) ; } } return object ; }
Build a customizable class .
3,605
private static String getThreadName ( final Type threadType ) { String threadName ; switch ( threadType ) { case NOT_RUN_INTO_JAT : threadName = "JavaFX Application Thread" ; break ; case NOT_RUN_INTO_JIT : threadName = "JRebirth Internal Thread" ; break ; case NOT_RUN_INTO_JTP : threadName = "JRebirth Thread Pool" ; break ; default : threadName = "" ; } return threadName ; }
Return the concerned thread name .
3,606
public Object parseObject ( final ParameterEntry parameterEntry ) { Object res = null ; res = parseObjectString ( this . object . getClass ( ) , parameterEntry . getSerializedString ( ) ) ; parameterEntry . setObject ( res ) ; return res ; }
Parse the serialized object .
3,607
private Object parseObjectString ( Class < ? > objectType , final String objectString ) { Object res ; if ( ResourceParams . class . isAssignableFrom ( objectType ) ) { if ( this . object instanceof List < ? > ) { ResourceParams rp = ( ResourceParams ) ( ( List < ? > ) this . object ) . get ( 0 ) ; try { rp = ( ResourceParams ) rp . clone ( ) ; rp . parse ( objectString . split ( PARAMETER_SEPARATOR_REGEX ) ) ; rp . getKey ( ) ; } catch ( final CloneNotSupportedException e ) { } res = rp ; } else { ( ( ResourceParams ) this . object ) . parse ( objectString . split ( PARAMETER_SEPARATOR_REGEX ) ) ; res = this . object ; } } else if ( Class . class . isAssignableFrom ( objectType ) ) { res = parseClassParameter ( objectString ) ; } else if ( Enum . class . isAssignableFrom ( objectType ) ) { res = parseEnumParameter ( ( Enum < ? > ) this . object , objectString ) ; } else if ( File . class . isAssignableFrom ( objectType ) ) { res = parseFileParameter ( objectString ) ; } else if ( List . class . isAssignableFrom ( objectType ) ) { res = parseListParameter ( objectString ) ; } else { res = parsePrimitive ( objectType , objectString ) ; } return res ; }
Parse a string representation of an object .
3,608
private Object parseClassParameter ( final String serializedObject ) { Object res = null ; try { res = Class . forName ( serializedObject ) ; } catch ( final ClassNotFoundException e ) { throw new CoreRuntimeException ( "Impossible to load class " + serializedObject , e ) ; } return res ; }
Parse a class definition by calling Class . forName .
3,609
@ SuppressWarnings ( "unchecked" ) private Object parseEnumParameter ( final Enum < ? > e , final String serializedObject ) { final Object res = Enum . valueOf ( e . getClass ( ) , serializedObject ) ; return res ; }
Parse an Enum definition by calling Enum . valueOf .
3,610
private Object parseFileParameter ( final String serializedObject ) { final File res = new File ( serializedObject ) ; if ( ! res . exists ( ) ) { throw new CoreRuntimeException ( "Impossible to load file " + serializedObject ) ; } return res ; }
Parse a file definition by using canonical path .
3,611
private Object parseListParameter ( final String serializedObject ) { final List < Object > res = new ArrayList < > ( ) ; final Class < ? > objectType = ( ( List < ? > ) this . object ) . get ( 0 ) . getClass ( ) ; for ( final String item : serializedObject . split ( ";" ) ) { res . add ( parseObjectString ( objectType , item ) ) ; } return res ; }
Parse a generic list .
3,612
private Object parsePrimitive ( Class < ? > objectType , final String serializedObject ) { Object res = null ; if ( Boolean . class . isAssignableFrom ( objectType ) ) { res = Boolean . valueOf ( serializedObject ) ; } else if ( String . class . isAssignableFrom ( objectType ) ) { res = serializedObject ; } else if ( Character . class . isAssignableFrom ( objectType ) ) { res = Character . valueOf ( serializedObject . charAt ( 0 ) ) ; } else if ( Byte . class . isAssignableFrom ( objectType ) ) { res = Byte . parseByte ( serializedObject ) ; } else if ( Short . class . isAssignableFrom ( objectType ) ) { res = Short . parseShort ( serializedObject ) ; } else if ( Integer . class . isAssignableFrom ( objectType ) ) { res = Integer . parseInt ( serializedObject ) ; } else if ( Long . class . isAssignableFrom ( objectType ) ) { res = Long . parseLong ( serializedObject ) ; } else if ( Float . class . isAssignableFrom ( objectType ) ) { res = Float . parseFloat ( serializedObject ) ; } else if ( Double . class . isAssignableFrom ( objectType ) ) { res = Double . parseDouble ( serializedObject ) ; } return res ; }
Parse primitive serialized object .
3,613
public void searchConfigurationFiles ( final String wildcard , final String extension ) { this . configurationFileWildcard = wildcard ; this . configurationFileExtension = extension ; readPropertiesFiles ( ) ; }
Search configuration files according to the parameters provided .
3,614
private void readPropertiesFile ( final String custConfFileName ) { final Properties p = new Properties ( ) ; LOGGER . log ( READ_CONF_FILE , custConfFileName ) ; try ( InputStream is = ClasspathUtility . loadInputStream ( custConfFileName ) ) { p . load ( is ) ; for ( final Map . Entry < Object , Object > entry : p . entrySet ( ) ) { if ( this . propertiesParametersMap . containsKey ( entry . getKey ( ) ) ) { LOGGER . log ( UPDATE_PARAMETER , entry . getKey ( ) , entry . getValue ( ) ) ; } else { LOGGER . log ( STORE_PARAMETER , entry . getKey ( ) , entry . getValue ( ) ) ; } storePropertiesParameter ( entry ) ; } } catch ( final IOException e ) { LOGGER . error ( CONF_READING_ERROR , custConfFileName ) ; } }
Read a customized configuration file to load parameters values .
3,615
private String resolveVarEnv ( final String entryValue ) { String value = entryValue ; if ( value != null ) { value = checkPattern ( value , ENV_VAR_PATTERN1 , true ) ; value = checkPattern ( value , ENV_VAR_PATTERN2 , false ) ; } return value ; }
Resolve any environment variable found into the string .
3,616
private String checkPattern ( final String value , final Pattern pattern , final boolean withBrace ) { String res = value ; final Matcher matcher = pattern . matcher ( value ) ; while ( matcher . find ( ) ) { final String envName = matcher . group ( 2 ) ; if ( ! this . varenvMap . containsKey ( envName ) ) { final String envValue = System . getenv ( envName ) ; this . varenvMap . put ( envName , envValue ) ; } if ( this . varenvMap . get ( envName ) != null ) { if ( withBrace ) { res = res . replace ( "${" + envName + "}" , this . varenvMap . get ( envName ) ) ; } else { res = res . replace ( "$" + envName , this . varenvMap . get ( envName ) ) ; } } else { LOGGER . log ( UNDEFINED_ENV_VAR , envName ) ; } } return res ; }
Check if the given string contains an environment variable .
3,617
public static Cipher getCipher ( final Key key , int mode ) { try { Cipher cipher = Cipher . getInstance ( key . getAlgorithm ( ) ) ; cipher . init ( mode , key ) ; return cipher ; } catch ( NoSuchAlgorithmException | InvalidKeyException | NoSuchPaddingException e ) { throw new RuntimeException ( e ) ; } }
Creates a new Cipher
3,618
public void setNodes ( final List < ? extends Node > nodesToAdd ) { for ( final Node n : nodesToAdd ) { this . nodes . add ( n ) ; } }
Set the nodes .
3,619
void onButtonFired ( final ActionEvent event ) { final Optional < Button > b = getTarget ( event , Button . class ) ; final Optional < UniqueKey < ? extends Model > > data = getUserData ( b , StackWaves . PAGE_MODEL_KEY ) ; if ( data . isPresent ( ) ) { model ( ) . sendWave ( StackWaves . SHOW_PAGE_MODEL , WBuilder . waveData ( StackWaves . PAGE_MODEL_KEY , data . get ( ) ) , WBuilder . waveData ( StackWaves . STACK_NAME , "DemoStack" ) ) ; } }
When a button is fired display the related ModuleModel .
3,620
private Font buildRealFont ( final RealFont rFont ) { checkFontStatus ( rFont ) ; return Font . font ( transformFontName ( rFont . name ( ) . name ( ) ) , rFont . size ( ) ) ; }
Build a real font with name and size .
3,621
private Font buildFamilyFont ( final FamilyFont familyFont ) { Font font = null ; if ( familyFont . posture ( ) == null && familyFont . weight ( ) == null ) { font = Font . font ( transformFontName ( familyFont . family ( ) ) , familyFont . size ( ) ) ; } else if ( familyFont . posture ( ) == null ) { font = Font . font ( transformFontName ( familyFont . family ( ) ) , familyFont . weight ( ) , familyFont . size ( ) ) ; } else if ( familyFont . weight ( ) == null ) { font = Font . font ( transformFontName ( familyFont . family ( ) ) , familyFont . posture ( ) , familyFont . size ( ) ) ; } else { font = Font . font ( transformFontName ( familyFont . family ( ) ) , familyFont . weight ( ) , familyFont . posture ( ) , familyFont . size ( ) ) ; } return font ; }
Build a Family Font with name and size .
3,622
private void checkFontStatus ( final FontParams fontParams ) { final List < String > fonts = Font . getFontNames ( transformFontName ( fontParams . name ( ) . name ( ) ) ) ; Font font = null ; String fontName = null ; if ( fonts . isEmpty ( ) ) { final List < String > fontPaths = fontParams instanceof RealFont && ( ( RealFont ) fontParams ) . skipFontsFolder ( ) ? Collections . singletonList ( "" ) : ResourceParameters . FONT_FOLDER . get ( ) ; for ( int i = 0 ; i < fontPaths . size ( ) && font == null ; i ++ ) { String fontPath = fontPaths . get ( i ) ; if ( ! fontPath . isEmpty ( ) ) { fontPath += Resources . PATH_SEP ; } fontName = fontPath + transformFontName ( fontParams . name ( ) . name ( ) ) + "." + fontParams . extension ( ) ; LOGGER . trace ( "Try to load Transformed Font {}" , fontName ) ; font = Font . loadFont ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( fontName ) , fontParams . size ( ) ) ; if ( font == null ) { fontName = fontPath + fontParams . name ( ) . name ( ) + "." + fontParams . extension ( ) ; LOGGER . trace ( "Try to load Raw Font {}" , fontName ) ; font = Font . loadFont ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( fontName ) , fontParams . size ( ) ) ; if ( font != null ) { LOGGER . info ( "{} Raw Font loaded" , fontName ) ; } } else { LOGGER . info ( "{} Transformed Font loaded" , fontName ) ; } } if ( font == null ) { LOGGER . error ( "Font : {} not found into base folder: {}" , fontParams . name ( ) . name ( ) + "." + fontParams . extension ( ) , ResourceParameters . FONT_FOLDER . get ( ) ) ; } } }
Load the font file .
3,623
public static Swagger from ( final Swagger router , final Object ... objs ) { for ( Object o : objs ) { Processor . process ( router , o ) ; } return router ; }
Builds a Swagger from an annotated Java Object
3,624
private void checkCallbackMethods ( ) throws CoreException { for ( final EnumEventType eet : getAnnotationValue ( ) ) { final String methodName = buildHandlingMethodName ( eet ) ; final Class < ? > eventClass = getAnnotationApiEventClass ( ) ; try { this . callbackObject . getClass ( ) . getDeclaredMethod ( methodName , eventClass ) ; } catch ( NoSuchMethodException | SecurityException e ) { throw new CoreException ( NO_EVENT_CALLBACK . getText ( this . callbackObject . getClass ( ) . getName ( ) , methodName , eventClass . getName ( ) ) , e ) ; } } }
For each annotation event type check if the callback method exists .
3,625
private String buildHandlingMethodName ( final EnumEventType annotationType ) { final StringBuilder methodName = new StringBuilder ( ) ; if ( Arrays . asList ( getAnnotationValue ( ) ) . contains ( annotationType ) ) { methodName . append ( this . annotation . annotationType ( ) . getSimpleName ( ) . substring ( 0 , 1 ) . toLowerCase ( ) ) ; methodName . append ( this . annotation . annotationType ( ) . getSimpleName ( ) . substring ( 1 ) ) ; methodName . append ( Key . Any . name ( ) . equals ( annotationType . toString ( ) ) || Action . Action . name ( ) . equals ( annotationType . toString ( ) ) ? "" : annotationType . name ( ) ) ; final String uniqueName = getAnnotationName ( ) ; if ( uniqueName . length ( ) > 0 ) { methodName . append ( uniqueName ) ; } } return methodName . toString ( ) ; }
Build the handling method name used to manage this event .
3,626
private EnumEventType convertEventToEnum ( final EventType < ? extends Event > eventType ) { EnumEventType convertedType = null ; if ( getAnnotationValue ( ) != null && getAnnotationValue ( ) . length > 0 ) { final EnumEventType [ ] aTypes = getAnnotationValue ( ) [ 0 ] . getClass ( ) . getEnumConstants ( ) ; for ( int i = 0 ; i < aTypes . length && convertedType == null ; i ++ ) { if ( aTypes [ i ] . eventType ( ) == eventType ) { convertedType = aTypes [ i ] ; } } } return convertedType ; }
Convert a JavaFX event type into an annotation event type .
3,627
private void callMethod ( final String methodName , final Event event ) { final Class < ? > ctrlClass = this . callbackObject . getClass ( ) ; try { final Method method = ctrlClass . getDeclaredMethod ( methodName , event . getClass ( ) ) ; ClassUtility . callMethod ( method , this . callbackObject , event ) ; } catch ( NoSuchMethodException | SecurityException | IllegalArgumentException | CoreException e ) { LOGGER . log ( EVENT_HANDLING_IMPOSSIBLE , e ) ; } }
Call the method into the callback object .
3,628
private < T > ServiceTask < T > runTask ( final Wave sourceWave , final Method method , final Object [ ] parameterValues ) { sourceWave . addWaveListener ( new ServiceTaskWaveListener ( ) ) ; final ServiceTaskBase < T > task = new ServiceTaskBase < > ( this , method , parameterValues , sourceWave ) ; this . pendingTasks . put ( sourceWave . wUID ( ) , task ) ; sourceWave . addDatas ( WBuilder . waveData ( JRebirthWaves . SERVICE_TASK , task ) ) ; if ( sourceWave . containsNotNull ( JRebirthWaves . PROGRESS_PROPERTY ) ) { bindProgressProperty ( task , sourceWave . getData ( JRebirthWaves . PROGRESS_PROPERTY ) . value ( ) ) ; } if ( sourceWave . containsNotNull ( JRebirthWaves . PROGRESS_BAR ) ) { bindProgressBar ( task , sourceWave . getData ( JRebirthWaves . PROGRESS_BAR ) . value ( ) ) ; } if ( sourceWave . containsNotNull ( JRebirthWaves . TASK_TITLE ) ) { bindTitle ( task , sourceWave . getData ( JRebirthWaves . TASK_TITLE ) . value ( ) ) ; } if ( sourceWave . containsNotNull ( JRebirthWaves . TASK_MESSAGE ) ) { bindMessage ( task , sourceWave . getData ( JRebirthWaves . TASK_MESSAGE ) . value ( ) ) ; } JRebirth . runIntoJTP ( task ) ; return task ; }
Run the wave type method .
3,629
private void bindProgressProperty ( final ServiceTaskBase < ? > task , final DoubleProperty progressProperty ) { JRebirth . runIntoJAT ( "Bind Progress Property to " + task . getServiceHandlerName ( ) , ( ) -> { task . updateProgress ( 0 , 0 ) ; progressProperty . bind ( task . workDoneProperty ( ) . divide ( task . totalWorkProperty ( ) ) ) ; } ) ; }
Bind a task to a progress property to follow its progression .
3,630
private void bindProgressBar ( final ServiceTaskBase < ? > task , final ProgressBar progressBar ) { JRebirth . runIntoJAT ( "Bind ProgressBar to " + task . getServiceHandlerName ( ) , ( ) -> { task . updateProgress ( 0 , 0 ) ; progressBar . progressProperty ( ) . bind ( task . workDoneProperty ( ) . divide ( task . totalWorkProperty ( ) ) ) ; } ) ; }
Bind a task to a progress bar widget to follow its progression .
3,631
private void bindTitle ( final ServiceTask < ? > task , final StringProperty titleProperty ) { JRebirth . runIntoJAT ( "Bind Title for " + task . getServiceHandlerName ( ) , ( ) -> titleProperty . bind ( task . titleProperty ( ) ) ) ; }
Bind a task to a string property that will display the task title .
3,632
private void bindMessage ( final ServiceTask < ? > task , final StringProperty messageProperty ) { JRebirth . runIntoJAT ( "Bind Message for " + task . getServiceHandlerName ( ) , ( ) -> messageProperty . bind ( task . messageProperty ( ) ) ) ; }
Bind a task to a string property that will display the task message .
3,633
public void updateProgress ( final Wave wave , final double workDone , final double totalWork , final double progressIncrement ) { if ( wave . get ( JRebirthWaves . SERVICE_TASK ) . checkProgressRatio ( workDone , totalWork , progressIncrement ) ) { JRebirth . runIntoJAT ( "ServiceTask Workdone (dbl) " + workDone + RATIO_SEPARATOR + totalWork , ( ) -> wave . get ( JRebirthWaves . SERVICE_TASK ) . updateProgress ( workDone , totalWork ) ) ; } }
Update the progress of the service task related to the given wave .
3,634
protected < T > Optional < T > getSource ( Event event , Class < T > type ) { return getValue ( event , event :: getSource , type ) ; }
Gets the source .
3,635
protected < T > Optional < T > getTarget ( Event event , Class < T > type ) { return getValue ( event , event :: getTarget , type ) ; }
Gets the target .
3,636
public void render ( final String file , final Map < String , Object > context , final Handler < AsyncResult < Buffer > > handler ) { read ( prefix + file , new AsyncResultHandler < String > ( ) { public void handle ( AsyncResult < String > asyncResult ) { if ( asyncResult . failed ( ) ) { handler . handle ( new YokeAsyncResult < Buffer > ( asyncResult . cause ( ) ) ) ; } else { try { handler . handle ( new YokeAsyncResult < > ( parseStringValue ( asyncResult . result ( ) , context , new HashSet < String > ( ) ) ) ) ; } catch ( IllegalArgumentException iae ) { handler . handle ( new YokeAsyncResult < Buffer > ( iae ) ) ; } } } } ) ; }
An interpreter for strings with named placeholders .
3,637
private void buildErrorNode ( final CoreException ce ) { final TextArea ta = TextAreaBuilder . create ( ) . text ( ce . getMessage ( ) ) . build ( ) ; this . errorNode = PaneBuilder . create ( ) . children ( ta ) . build ( ) ; }
Build the errorNode to display the error taht occured .
3,638
private void processViewAnnotation ( ) { final AutoHandler ah = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , AutoHandler . class ) ; if ( ah != null && ah . value ( ) == CallbackObject . View || controller ( ) == null ) { this . callbackObject = this ; } else { this . callbackObject = this . controller ( ) ; } final RootNodeId rni = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , RootNodeId . class ) ; if ( rni != null ) { node ( ) . setId ( rni . value ( ) . isEmpty ( ) ? this . getClass ( ) . getSimpleName ( ) : rni . value ( ) ) ; } final RootNodeClass rnc = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , RootNodeClass . class ) ; if ( rnc != null && rnc . value ( ) . length > 0 ) { for ( final String styleClass : rnc . value ( ) ) { if ( styleClass != null && ! styleClass . isEmpty ( ) ) { node ( ) . getStyleClass ( ) . add ( styleClass ) ; } } } for ( final Annotation a : this . getClass ( ) . getAnnotations ( ) ) { if ( a . annotationType ( ) . getName ( ) . startsWith ( BASE_ANNOTATION_NAME ) ) { try { if ( node ( ) != null && controller ( ) instanceof AbstractController ) { addHandler ( node ( ) , a ) ; } } catch ( IllegalArgumentException | CoreException e ) { LOGGER . log ( UIMessages . VIEW_ANNO_PROCESSING_FAILURE , e , this . getClass ( ) . getName ( ) ) ; } } } }
Process view annotation .
3,639
private void processFields ( ) throws CoreException { final Class < ? > currentClass = this . getClass ( ) ; for ( final Field f : currentClass . getDeclaredFields ( ) ) { if ( Node . class . isAssignableFrom ( f . getType ( ) ) || Animation . class . isAssignableFrom ( f . getType ( ) ) ) { boolean needToHide = false ; if ( ! f . isAccessible ( ) ) { f . setAccessible ( true ) ; needToHide = true ; } processAnnotations ( f ) ; if ( needToHide && f . isAccessible ( ) ) { f . setAccessible ( false ) ; } } } }
Process all fields annotations to auto - link them with event handler .
3,640
private void processAnnotations ( final Field property ) throws CoreException { for ( final Annotation a : property . getAnnotations ( ) ) { if ( EventTarget . class . isAssignableFrom ( property . getType ( ) ) ) { if ( a . annotationType ( ) . getName ( ) . startsWith ( BASE_ANNOTATION_NAME ) ) { try { final EventTarget target = ( EventTarget ) property . get ( this ) ; if ( target != null && controller ( ) instanceof AbstractController ) { addHandler ( target , a ) ; } } catch ( IllegalArgumentException | IllegalAccessException e ) { LOGGER . log ( UIMessages . NODE_ANNO_PROCESSING_FAILURE , e , this . getClass ( ) . getName ( ) , property . getName ( ) ) ; } } } else if ( Animation . class . isAssignableFrom ( property . getType ( ) ) && OnFinished . class . getName ( ) . equals ( a . annotationType ( ) . getName ( ) ) ) { try { final Animation animation = ( Animation ) property . get ( this ) ; if ( animation != null && controller ( ) instanceof AbstractController ) { addHandler ( animation , a ) ; } } catch ( IllegalArgumentException | IllegalAccessException e ) { LOGGER . log ( UIMessages . ANIM_ANNO_PROCESSING_FAILURE , e , this . getClass ( ) . getName ( ) , property . getName ( ) ) ; } } } }
Process all OnXxxx Annotation to attach event handler on this field .
3,641
private void addHandler ( final EventTarget target , final Annotation annotation ) throws CoreException { final AnnotationEventHandler < Event > aeh = new AnnotationEventHandler < > ( this . callbackObject , annotation ) ; for ( final EnumEventType eet : ( EnumEventType [ ] ) ClassUtility . getAnnotationAttribute ( annotation , "value" ) ) { if ( target instanceof Node ) { ( ( Node ) target ) . addEventHandler ( eet . eventType ( ) , aeh ) ; } else if ( target instanceof MenuItem ) { if ( eet . eventType ( ) == ActionEvent . ACTION ) { ( ( MenuItem ) target ) . addEventHandler ( ActionEvent . ACTION , new AnnotationEventHandler < > ( this . callbackObject , annotation ) ) ; } else { ( ( MenuItem ) target ) . setOnMenuValidation ( aeh ) ; } } else if ( target instanceof Window ) { ( ( Window ) target ) . addEventHandler ( eet . eventType ( ) , aeh ) ; } } }
Add an event handler on the given node according to annotation OnXxxxx .
3,642
private void addHandler ( final Animation animation , final Annotation annotation ) throws CoreException { final AnnotationEventHandler < ActionEvent > aeh = new AnnotationEventHandler < > ( this . callbackObject , annotation ) ; animation . setOnFinished ( aeh ) ; }
Add an event handler on the given animation according to annotation OnFinished .
3,643
@ SuppressWarnings ( "unchecked" ) protected C buildController ( ) throws CoreException { return ( C ) ClassUtility . findAndBuildGenericType ( this . getClass ( ) , Controller . class , NullController . class , this ) ; }
Build the view controller .
3,644
public boolean add ( final K key , final V value ) { if ( ! this . map . containsKey ( key ) ) { this . map . put ( key , new ArrayList < V > ( ) ) ; } return this . map . get ( key ) . add ( value ) ; }
Add a new entry .
3,645
public Yoke listen ( final HttpServer server ) { server . requestHandler ( new Handler < HttpServerRequest > ( ) { public void handle ( HttpServerRequest req ) { final YokeRequest request = requestWrapper . wrap ( req , new Context ( defaultContext ) , engineMap , store ) ; Boolean poweredBy = request . get ( "x-powered-by" ) ; if ( poweredBy != null && poweredBy ) { request . response ( ) . putHeader ( "x-powered-by" , "yoke" ) ; } new Handler < Object > ( ) { int currentMiddleware = - 1 ; public void handle ( Object error ) { if ( error == null ) { currentMiddleware ++ ; if ( currentMiddleware < middlewareList . size ( ) ) { final MountedMiddleware mountedMiddleware = middlewareList . get ( currentMiddleware ) ; if ( ! mountedMiddleware . enabled ) { handle ( null ) ; } else { if ( request . path ( ) . startsWith ( mountedMiddleware . mount ) ) { mountedMiddleware . middleware . handle ( request , this ) ; } else { handle ( null ) ; } } } else { HttpServerResponse response = request . response ( ) ; response . setStatusCode ( 404 ) ; response . setStatusMessage ( HttpResponseStatus . valueOf ( 404 ) . reasonPhrase ( ) ) ; if ( errorHandler != null ) { errorHandler . handle ( request , null ) ; } else { response . end ( HttpResponseStatus . valueOf ( 404 ) . reasonPhrase ( ) ) ; } } } else { request . put ( "error" , error ) ; if ( errorHandler != null ) { errorHandler . handle ( request , null ) ; } else { HttpServerResponse response = request . response ( ) ; int errorCode ; if ( response . getStatusCode ( ) >= 400 ) { errorCode = response . getStatusCode ( ) ; } else { if ( error instanceof Number ) { errorCode = ( ( Number ) error ) . intValue ( ) ; } else if ( error instanceof YokeException ) { errorCode = ( ( YokeException ) error ) . getErrorCode ( ) . intValue ( ) ; } else if ( error instanceof JsonObject ) { errorCode = ( ( JsonObject ) error ) . getInteger ( "errorCode" , 500 ) ; } else if ( error instanceof Map ) { Integer tmp = ( Integer ) ( ( Map ) error ) . get ( "errorCode" ) ; errorCode = tmp != null ? tmp : 500 ; } else { errorCode = 500 ; } } response . setStatusCode ( errorCode ) ; response . setStatusMessage ( HttpResponseStatus . valueOf ( errorCode ) . reasonPhrase ( ) ) ; response . end ( HttpResponseStatus . valueOf ( errorCode ) . reasonPhrase ( ) ) ; } } } } . handle ( null ) ; } } ) ; return this ; }
Starts listening at a already created server .
3,646
public Yoke deploy ( final JsonArray config , final Handler < Object > handler ) { if ( config . size ( ) == 0 ) { if ( handler == null ) { return this ; } else { handler . handle ( null ) ; return this ; } } Handler < AsyncResult < String > > waitFor = new Handler < AsyncResult < String > > ( ) { private int latch = config . size ( ) ; private boolean handled = false ; public void handle ( AsyncResult < String > event ) { latch -- ; if ( handler != null ) { if ( ! handled && ( event . failed ( ) || latch == 0 ) ) { handled = true ; handler . handle ( event . failed ( ) ? event . cause ( ) : null ) ; } } } } ; for ( Object o : config ) { JsonObject json = ( JsonObject ) o ; vertx . deployVerticle ( json . getString ( "verticle" ) , new DeploymentOptions ( json ) , waitFor ) ; } return this ; }
Deploys required middleware from a config json element . The handler is only called once all middleware is deployed or in error . The order of deployment is not guaranteed since all deploy functions are called concurrently and do not wait for the previous result before deploying the next item .
3,647
@ SuppressWarnings ( "unchecked" ) public < KP extends Object > KP getKeyPart ( final Class < KP > keyPartClass ) { return ( KP ) getListKeyPart ( ) . stream ( ) . filter ( kp -> kp != null && keyPartClass . isAssignableFrom ( kp . getClass ( ) ) ) . findFirst ( ) . get ( ) ; }
Return the first object assignable from te given class .
3,648
protected double readDouble ( final String doubleString , final double min , final double max ) { return Math . max ( Math . min ( Double . parseDouble ( doubleString ) , max ) , min ) ; }
Read a double string value .
3,649
protected int readInteger ( final String intString , final int min , final int max ) { return Math . max ( Math . min ( Integer . parseInt ( intString ) , max ) , min ) ; }
Read ab integer string value .
3,650
public void trackTask ( final ServiceTaskBase < ? > task ) { LOGGER . trace ( "track a Task" ) ; this . serviceTasks . add ( task ) ; task . setOnCancelled ( this . workerHandler ) ; task . setOnSucceeded ( this . workerHandler ) ; task . setOnFailed ( this . workerHandler ) ; }
Track a task progression .
3,651
private void addSubSlide ( final Node defaultSubSlide ) { this . subSlides . add ( model ( ) . getStepPosition ( ) , defaultSubSlide ) ; this . slideContent . getChildren ( ) . add ( defaultSubSlide ) ; StackPane . setAlignment ( defaultSubSlide , Pos . CENTER ) ; }
Add a subslide node .
3,652
protected Node getHeaderPanel ( ) { final Pane headerPane = PaneBuilder . create ( ) . styleClass ( "header" ) . layoutX ( 0.0 ) . layoutY ( 0.0 ) . minWidth ( 1024 ) . prefWidth ( 1024 ) . build ( ) ; final Label primaryTitle = LabelBuilder . create ( ) . font ( PrezFonts . SLIDE_TITLE . get ( ) ) . textFill ( PrezColors . SLIDE_TITLE . get ( ) ) . text ( model ( ) . getSlide ( ) . getTitle ( ) . replaceAll ( "\\\\n" , "\n" ) . replaceAll ( "\\\\t" , "\t" ) ) . layoutX ( 40 ) . layoutY ( 45 ) . build ( ) ; this . secondaryTitle = LabelBuilder . create ( ) . font ( PrezFonts . SLIDE_SUB_TITLE . get ( ) ) . textFill ( PrezColors . SLIDE_TITLE . get ( ) ) . layoutX ( 450 ) . layoutY ( 14 ) . minWidth ( 450 ) . alignment ( Pos . CENTER_RIGHT ) . textAlignment ( TextAlignment . RIGHT ) . build ( ) ; final ImageView breizhcamp = ImageViewBuilder . create ( ) . layoutX ( 680.0 ) . layoutY ( - 14.0 ) . scaleX ( 0.6 ) . scaleY ( 0.6 ) . image ( PrezImages . HEADER_LOGO . get ( ) ) . build ( ) ; final Polyline pl = PolylineBuilder . create ( ) . strokeWidth ( 3 ) . stroke ( Color . BLACK ) . points ( 684.0 , 12.0 , 946.0 , 12.0 , 946.0 , 107.0 ) . build ( ) ; this . rectangle = RectangleBuilder . create ( ) . layoutX ( 108.0 ) . layoutY ( 95.0 ) . width ( 0.0 ) . height ( 14.0 ) . fill ( Color . web ( "1C9A9A" ) ) . build ( ) ; this . circle = CircleBuilder . create ( ) . scaleX ( 0 ) . scaleY ( 0 ) . layoutX ( 18 + 54 ) . layoutY ( 18 + 54 ) . radius ( 54 ) . fill ( Color . web ( "444442" ) ) . build ( ) ; this . pageLabel = LabelBuilder . create ( ) . layoutX ( 970 ) . layoutY ( 18.0 ) . text ( String . valueOf ( model ( ) . getSlide ( ) . getPage ( ) ) ) . font ( PrezFonts . PAGE . get ( ) ) . rotate ( 90.0 ) . build ( ) ; headerPane . getChildren ( ) . addAll ( this . circle , primaryTitle , breizhcamp , this . secondaryTitle , pl , this . rectangle , this . pageLabel ) ; return headerPane ; }
Build and return the header panel .
3,653
protected void bindNode ( final Node node ) { node . scaleXProperty ( ) . bind ( bindWidth ( ) ) ; node . scaleYProperty ( ) . bind ( bindHeight ( ) ) ; }
Bind node s scale properties to stage size .
3,654
protected NumberBinding bindHeight ( ) { return Bindings . divide ( model ( ) . localFacade ( ) . globalFacade ( ) . application ( ) . stage ( ) . heightProperty ( ) , 768 ) ; }
Returns the height ratio .
3,655
protected NumberBinding bindWidth ( ) { return Bindings . divide ( model ( ) . localFacade ( ) . globalFacade ( ) . application ( ) . stage ( ) . widthProperty ( ) , 1024 ) ; }
Returns the width ratio .
3,656
protected Node getFooterPanel ( ) { this . pageLabel = LabelBuilder . create ( ) . text ( String . valueOf ( model ( ) . getSlide ( ) . getPage ( ) ) ) . font ( PrezFonts . PAGE . get ( ) ) . build ( ) ; final AnchorPane ap = AnchorPaneBuilder . create ( ) . children ( this . pageLabel ) . build ( ) ; AnchorPane . setRightAnchor ( this . pageLabel , 20.0 ) ; final StackPane sp = StackPaneBuilder . create ( ) . styleClass ( "footer" ) . prefHeight ( 35.0 ) . minHeight ( Region . USE_PREF_SIZE ) . maxHeight ( Region . USE_PREF_SIZE ) . children ( ap ) . build ( ) ; StackPane . setAlignment ( ap , Pos . CENTER_RIGHT ) ; return sp ; }
Build and return the footer panel .
3,657
protected VBox buildDefaultContent ( final SlideContent slideContent ) { final VBox vbox = new VBox ( ) ; if ( model ( ) . getSlide ( ) . getStyle ( ) != null ) { vbox . getStyleClass ( ) . add ( model ( ) . getSlide ( ) . getStyle ( ) ) ; } if ( slideContent != null ) { for ( final SlideItem item : slideContent . getItem ( ) ) { addSlideItem ( vbox , item ) ; } if ( slideContent . getTitle ( ) != null ) { this . secondaryTitle . setText ( slideContent . getTitle ( ) ) ; } } return vbox ; }
Build the default content slide .
3,658
protected void addSlideItem ( final VBox vbox , final SlideItem item ) { Node node = null ; if ( item . isLink ( ) ) { final Hyperlink link = HyperlinkBuilder . create ( ) . opacity ( 1.0 ) . text ( item . getValue ( ) ) . build ( ) ; link . getStyleClass ( ) . add ( "link" + item . getLevel ( ) ) ; link . setOnAction ( new EventHandler < ActionEvent > ( ) { public void handle ( final ActionEvent e ) { final ClipboardContent content = new ClipboardContent ( ) ; content . putString ( "http://" + ( ( Hyperlink ) e . getSource ( ) ) . getText ( ) ) ; Clipboard . getSystemClipboard ( ) . setContent ( content ) ; } } ) ; node = link ; } else if ( item . isHtml ( ) ) { final WebView web = WebViewBuilder . create ( ) . fontScale ( 1.4 ) . build ( ) ; web . getEngine ( ) . loadContent ( item . getValue ( ) ) ; VBox . setVgrow ( web , Priority . NEVER ) ; node = web ; } else if ( item . getImage ( ) != null ) { final Image image = Resources . create ( new RelImage ( item . getImage ( ) ) ) . get ( ) ; final ImageView imageViewer = ImageViewBuilder . create ( ) . styleClass ( ITEM_CLASS_PREFIX + item . getLevel ( ) ) . image ( image ) . build ( ) ; node = imageViewer ; } else { final Text text = TextBuilder . create ( ) . styleClass ( ITEM_CLASS_PREFIX + item . getLevel ( ) ) . text ( item . getValue ( ) == null ? "" : item . getValue ( ) ) . build ( ) ; node = text ; } if ( item . getStyle ( ) != null ) { node . getStyleClass ( ) . add ( item . getStyle ( ) ) ; } if ( item . getScale ( ) != 1.0 ) { node . setScaleX ( item . getScale ( ) ) ; node . setScaleY ( item . getScale ( ) ) ; } vbox . getChildren ( ) . add ( node ) ; }
Add a slide item by managing level .
3,659
public void showSlideStep ( final SlideStep slideStep ) { if ( this . subSlides . size ( ) >= model ( ) . getStepPosition ( ) || this . subSlides . get ( model ( ) . getStepPosition ( ) ) == null ) { addSubSlide ( buildDefaultContent ( model ( ) . getContent ( slideStep ) ) ) ; } final Node nextSlide = this . subSlides . get ( model ( ) . getStepPosition ( ) ) ; if ( this . currentSubSlide == null || nextSlide == null ) { this . currentSubSlide = nextSlide ; } else { performStepAnimation ( nextSlide ) ; } }
Show the slide step store which match with XML file .
3,660
protected void showCustomSlideStep ( final Node node ) { addSubSlide ( node ) ; final Node nextSlide = this . subSlides . get ( model ( ) . getStepPosition ( ) ) ; if ( this . currentSubSlide == null || nextSlide == null ) { this . currentSubSlide = nextSlide ; } else { performStepAnimation ( nextSlide ) ; } }
Show a programmatic built node as a sub slide .
3,661
private void performStepAnimation ( final Node nextSlide ) { this . slideStepAnimation = ParallelTransitionBuilder . create ( ) . onFinished ( new EventHandler < ActionEvent > ( ) { public void handle ( final ActionEvent event ) { AbstractTemplateView . this . currentSubSlide = nextSlide ; } } ) . children ( SequentialTransitionBuilder . create ( ) . node ( this . currentSubSlide ) . children ( TranslateTransitionBuilder . create ( ) . duration ( Duration . millis ( 400 ) ) . fromY ( 0 ) . toY ( - 700 ) . build ( ) , TimelineBuilder . create ( ) . keyFrames ( new KeyFrame ( Duration . millis ( 0 ) , new KeyValue ( this . currentSubSlide . visibleProperty ( ) , true ) ) , new KeyFrame ( Duration . millis ( 1 ) , new KeyValue ( this . currentSubSlide . visibleProperty ( ) , false ) ) ) . build ( ) ) . build ( ) , SequentialTransitionBuilder . create ( ) . node ( nextSlide ) . children ( TimelineBuilder . create ( ) . keyFrames ( new KeyFrame ( Duration . millis ( 0 ) , new KeyValue ( nextSlide . visibleProperty ( ) , false ) ) , new KeyFrame ( Duration . millis ( 1 ) , new KeyValue ( nextSlide . visibleProperty ( ) , true ) ) ) . build ( ) , TranslateTransitionBuilder . create ( ) . duration ( Duration . millis ( 400 ) ) . fromY ( 700 ) . toY ( 0 ) . build ( ) ) . build ( ) ) . build ( ) ; this . slideStepAnimation . play ( ) ; }
Create an Launch the animation between two sub slides .
3,662
private void parseString ( final String eventSerialized ) { final StringTokenizer st = new StringTokenizer ( eventSerialized , ClassUtility . SEPARATOR ) ; if ( st . countTokens ( ) >= 5 ) { sequence ( Integer . parseInt ( st . nextToken ( ) ) ) . eventType ( JRebirthEventType . valueOf ( st . nextToken ( ) ) ) . source ( st . nextToken ( ) ) . target ( st . nextToken ( ) ) . eventData ( st . nextToken ( ) ) ; } }
Parse the serialized string .
3,663
private Color buildHSBColor ( final HSBColor hsbColor ) { Color color = null ; if ( hsbColor . opacity ( ) >= 1.0 ) { color = Color . hsb ( hsbColor . hue ( ) , hsbColor . saturation ( ) , hsbColor . brightness ( ) ) ; } else { color = Color . hsb ( hsbColor . hue ( ) , hsbColor . saturation ( ) , hsbColor . brightness ( ) , hsbColor . opacity ( ) ) ; } return color ; }
Build an HSB color .
3,664
private Color buildGrayColor ( final GrayColor gColor ) { Color color = null ; if ( gColor . opacity ( ) >= 1.0 ) { color = Color . gray ( gColor . gray ( ) ) ; } else { color = Color . gray ( gColor . gray ( ) , gColor . opacity ( ) ) ; } return color ; }
Build a Gray color .
3,665
private Pane buildButtonBar ( final boolean isHorizontal ) { if ( isHorizontal ) { this . box = new HBox ( ) ; this . box . setMaxWidth ( Region . USE_COMPUTED_SIZE ) ; this . box . getStyleClass ( ) . add ( "HorizontalTabbedPane" ) ; } else { this . box = new VBox ( ) ; this . box . setMaxHeight ( Region . USE_COMPUTED_SIZE ) ; this . box . getStyleClass ( ) . add ( "VerticalTabbedPane" ) ; } switch ( model ( ) . object ( ) . orientation ( ) ) { case top : this . box . getStyleClass ( ) . add ( "Top" ) ; ( ( HBox ) this . box ) . setAlignment ( Pos . BOTTOM_LEFT ) ; break ; case bottom : this . box . getStyleClass ( ) . add ( "Bottom" ) ; ( ( HBox ) this . box ) . setAlignment ( Pos . TOP_RIGHT ) ; break ; case left : this . box . getStyleClass ( ) . add ( "Left" ) ; ( ( VBox ) this . box ) . setAlignment ( Pos . TOP_RIGHT ) ; break ; case right : this . box . getStyleClass ( ) . add ( "Right" ) ; ( ( VBox ) this . box ) . setAlignment ( Pos . TOP_LEFT ) ; break ; } return this . box ; }
Builds the button bar .
3,666
public SequentialTransition addTab ( int idx , final Dockable tab ) { final SequentialTransition seq = new SequentialTransition ( ) ; final ToggleButton b = new ToggleButton ( tab . name ( ) ) ; b . setToggleGroup ( this . group ) ; b . setUserData ( tab ) ; final ToggleButton oldButton = this . buttonByTab . put ( tab . name ( ) , b ) ; final int previousIndex = this . box . getChildren ( ) . indexOf ( oldButton ) ; if ( previousIndex >= 0 && previousIndex < idx ) { idx ++ ; } selectTab ( tab ) ; controller ( ) . initTabEventHandler ( b ) ; if ( idx < 0 || idx > this . box . getChildren ( ) . size ( ) ) { idx = this . box . getChildren ( ) . size ( ) ; } b . setScaleX ( 0.0 ) ; this . box . getChildren ( ) . add ( idx , b ) ; if ( this . box instanceof HBox ) { HBox . setMargin ( b , new Insets ( 0 , 1 , 0 , 0 ) ) ; } else if ( this . box instanceof VBox ) { VBox . setMargin ( b , new Insets ( 1 , 0 , 0 , 0 ) ) ; } final ScaleTransition st = new ScaleTransition ( Duration . millis ( 600 ) ) ; st . setNode ( b ) ; st . setFromX ( 0.0 ) ; st . setToX ( 1.0 ) ; seq . getChildren ( ) . add ( st ) ; return seq ; }
Adds the tab .
3,667
void selectTab ( final Dockable t ) { this . stackPane . getChildren ( ) . clear ( ) ; this . stackPane . getChildren ( ) . add ( model ( ) . getModel ( t . modelKey ( ) ) . node ( ) ) ; }
Select tab .
3,668
public int removeMarker ( ) { System . out . println ( "Remove Marker" ) ; final int idx = getBox ( ) . getChildren ( ) . indexOf ( this . marker ) ; getBox ( ) . getChildren ( ) . remove ( this . marker ) ; return idx ; }
Removes the marker .
3,669
private void createBallModel ( final JRebirthEvent event ) { switch ( event . eventType ( ) ) { case CREATE_APPLICATION : case CREATE_NOTIFIER : case CREATE_GLOBAL_FACADE : case CREATE_COMMAND_FACADE : case CREATE_SERVICE_FACADE : case CREATE_UI_FACADE : case CREATE_COMMAND : case CREATE_SERVICE : case CREATE_MODEL : case CREATE_VIEW : case CREATE_CONTROLLER : callCommand ( CreateBallCommand . class , WBuilder . waveData ( EditorWaves . EVENT , event ) ) ; break ; case CREATE_WAVE : default : } }
Create a ballModel instance .
3,670
private void accessBallModel ( final JRebirthEvent event ) { switch ( event . eventType ( ) ) { case ACCESS_COMMAND : case ACCESS_CONTROLLER : case ACCESS_MODEL : case ACCESS_SERVICE : case ACCESS_VIEW : callCommand ( AccessBallCommand . class , WBuilder . waveData ( EditorWaves . EVENT , event ) ) ; break ; default : } }
Access to a ballModel instance .
3,671
private void destroyBallModel ( final JRebirthEvent event ) { switch ( event . eventType ( ) ) { case DESTROY_COMMAND : case DESTROY_SERVICE : case DESTROY_MODEL : case DESTROY_VIEW : case DESTROY_CONTROLLER : callCommand ( DestroyBallCommand . class , WBuilder . waveData ( EditorWaves . EVENT , event ) ) ; break ; case DESTROY_WAVE : default : } }
Destroy a ball model .
3,672
private String buildObjectKey ( final Object object ) { String objectKey = null ; final Class < ? > objectClass = object . getClass ( ) ; final KeyGenerator typeGenerator = objectClass . getAnnotation ( KeyGenerator . class ) ; if ( typeGenerator == null ) { objectKey = generateAggregatedKey ( object ) ; } else { objectKey = generateTypeKey ( object , typeGenerator ) ; } if ( objectKey == null ) { objectKey = object . toString ( ) ; } return objectKey ; }
Generate the string key for an object .
3,673
private String generateTypeKey ( final Object object , final KeyGenerator typeGenerator ) { String objectKey = null ; Method method = null ; try { method = object . getClass ( ) . getMethod ( typeGenerator . value ( ) ) ; objectKey = ( String ) method . invoke ( object ) ; } catch ( final NoSuchMethodException e ) { LOGGER . log ( METHOD_NOT_FOUND , typeGenerator . value ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } catch ( final SecurityException e ) { LOGGER . log ( NO_KEY_GENERATOR_METHOD , typeGenerator . value ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { LOGGER . log ( KEY_GENERATOR_FAILURE , typeGenerator . value ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } return objectKey ; }
Generate Type key by using the class - level annotation .
3,674
private String generateAggregatedKey ( final Object object ) { final StringBuilder sb = new StringBuilder ( ) ; KeyGenerator methodGenerator ; for ( final Method m : object . getClass ( ) . getMethods ( ) ) { methodGenerator = m . getAnnotation ( KeyGenerator . class ) ; if ( methodGenerator != null ) { Object returnedValue = null ; try { returnedValue = m . invoke ( object ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { LOGGER . log ( METHOD_KEY_GENERATOR_FAILURE , m . getName ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } if ( returnedValue == null ) { LOGGER . log ( NULL_METHOD_KEY , m . getName ( ) , object . getClass ( ) . getSimpleName ( ) ) ; } else { sb . append ( convertMethodKeyObject ( methodGenerator , returnedValue ) ) ; } } } return sb . toString ( ) . isEmpty ( ) ? null : sb . toString ( ) ; }
Generate unique key by using the method - level annotations .
3,675
public String getTitle ( ) { return getSlide ( ) . getContent ( ) == null || getSlide ( ) . getContent ( ) . isEmpty ( ) || getSlide ( ) . getContent ( ) . get ( 0 ) . getTitle ( ) == null ? null : getSlide ( ) . getContent ( ) . get ( 0 ) . getTitle ( ) . replaceAll ( "\\\\n" , "\n" ) ; }
Return the splash title .
3,676
public String getExplanation ( ) { final StringBuilder sb = new StringBuilder ( ) ; if ( getMessage ( ) != null ) { sb . append ( getMessage ( ) ) ; } if ( getCause ( ) != null ) { sb . append ( getCause ( ) . getClass ( ) . getSimpleName ( ) ) ; } return sb . toString ( ) ; }
Return the explanation of the exception .
3,677
protected void fxmlPreInitialize ( ) { if ( ! getListKeyPart ( ) . isEmpty ( ) && getListKeyPart ( ) . get ( 0 ) instanceof FXMLItem ) { this . fxmlItem = ( FXMLItem ) getListKeyPart ( ) . get ( 0 ) ; } else if ( ! getListKeyPart ( ) . isEmpty ( ) && getListKeyPart ( ) . get ( 0 ) . toString ( ) . startsWith ( KEYPART_FXML_PREFIX ) ) { final String baseName = getListKeyPart ( ) . get ( 0 ) . toString ( ) . substring ( KEYPART_FXML_PREFIX . length ( ) ) ; this . fxmlPath = baseName . replaceAll ( FXML . DOT_SEPARATOR , FXML . PATH_SEPARATOR ) + FXML . FXML_EXT ; if ( getListKeyPart ( ) . size ( ) > 1 && getListKeyPart ( ) . get ( 1 ) . toString ( ) . startsWith ( KEYPART_RB_PREFIX ) ) { this . resourcePath = getListKeyPart ( ) . get ( 1 ) . toString ( ) . substring ( KEYPART_RB_PREFIX . length ( ) ) . replaceAll ( FXML . DOT_SEPARATOR , FXML . PATH_SEPARATOR ) ; } else { this . resourcePath = baseName ; } } else { String baseName = this . getClass ( ) . getCanonicalName ( ) ; baseName = baseName . substring ( 0 , baseName . lastIndexOf ( Model . class . getSimpleName ( ) ) ) ; baseName = baseName . replaceAll ( FXML . DOT_SEPARATOR , FXML . PATH_SEPARATOR ) ; this . fxmlPath = baseName + FXML . FXML_EXT ; this . resourcePath = baseName ; } }
Pre init .
3,678
protected void attachParentListener ( ) { final AutoRelease ar = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , AutoRelease . class ) ; if ( ar != null && ar . value ( ) && node ( ) != null ) { node ( ) . parentProperty ( ) . addListener ( new ChangeListener < Node > ( ) { public void changed ( final ObservableValue < ? extends Node > observable , final Node oldValue , final Node newValue ) { if ( newValue != null ) { AbstractBaseModel . this . hasBeenAttached = true ; } if ( newValue == null && AbstractBaseModel . this . hasBeenAttached ) { AbstractBaseModel . this . hasBeenAttached = false ; release ( ) ; node ( ) . parentProperty ( ) . removeListener ( this ) ; } } } ) ; } }
Attach a custom listener that will release the mode when the rootNode is removed from its parent .
3,679
public void onTokenRefresh ( ) { EasyGcm . Logger . d ( "Received token refresh broadcast" ) ; EasyGcm . removeRegistrationId ( getApplicationContext ( ) ) ; if ( GcmUtils . checkCanAndShouldRegister ( getApplicationContext ( ) ) ) { startService ( GcmRegistrationService . createGcmRegistrationIntent ( this ) ) ; } }
Called if InstanceID token is updated . This may occur if the security of the previous token had been compromised . This call is initiated by the InstanceID provider .
3,680
public BaseField < T > addBaseField ( int viewResId ) { BaseField < T > field = new BaseField < T > ( viewResId ) ; mBaseFields . add ( field ) ; return field ; }
Base field methods
3,681
public CheckableField < T > addCheckableField ( int viewResId , BooleanExtractor < T > isCheckedExtractor ) { CheckableField < T > field = new CheckableField < T > ( viewResId , isCheckedExtractor ) ; mCheckableFields . add ( field ) ; return field ; }
Checkable field methods
3,682
public StaticImageField < T > addStaticImageField ( int viewResId , StaticImageLoader < T > staticImageLoader ) { StaticImageField < T > field = new StaticImageField < T > ( viewResId , staticImageLoader ) ; mStaticImageFields . add ( field ) ; return field ; }
static image field methods
3,683
private void readPropertiesFile ( final String rbFilename ) { final File rbFile = new File ( rbFilename ) ; final String rbName = rbFile . getName ( ) . substring ( 0 , rbFile . getName ( ) . lastIndexOf ( ".properties" ) ) ; if ( rbName == null || rbName . isEmpty ( ) ) { LOGGER . error ( JRebirthMarkers . MESSAGE , "Resource Bundle must be not null and not empty" ) ; } else { LOGGER . info ( JRebirthMarkers . MESSAGE , "Store ResourceBundle : {} " , rbName ) ; try { this . resourceBundles . add ( ResourceBundle . getBundle ( rbName ) ) ; } catch ( final MissingResourceException e ) { LOGGER . error ( JRebirthMarkers . MESSAGE , "{} Resource Bundle not found" , rbName ) ; } } }
Read a customized Message file to load all translated messages .
3,684
private String findMessage ( final String messageKey ) { String message = null ; try { if ( ! this . resourceBundles . isEmpty ( ) ) { for ( int i = this . resourceBundles . size ( ) - 1 ; i >= 0 && message == null ; i -- ) { if ( this . resourceBundles . get ( i ) . containsKey ( messageKey ) ) { message = this . resourceBundles . get ( i ) . getString ( messageKey ) ; } } } } catch ( final MissingResourceException e ) { LOGGER . error ( "Message key not found into resource bundle" , e ) ; } return message ; }
Retrieved the message mapped with the given key .
3,685
public static boolean equalsOrBothNull ( final Object object1 , final Object object2 ) { return object1 == null && object2 == null || object1 != null && object1 . equals ( object2 ) ; }
Return true if the object are equals or both null .
3,686
public static String lowerFirstChar ( final String upperCasedString ) { return upperCasedString . substring ( 0 , 1 ) . toLowerCase ( Locale . getDefault ( ) ) + upperCasedString . substring ( 1 ) ; }
Lower case te first char of a string .
3,687
public static boolean checkAllMethodReturnTrue ( final Object instance , final List < Method > methods ) { boolean res = true ; if ( ! methods . isEmpty ( ) ) { for ( final Method method : methods ) { Object returnValue ; try { returnValue = method . invoke ( instance ) ; res &= returnValue instanceof Boolean && ( ( Boolean ) returnValue ) . booleanValue ( ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { res = false ; } } } return res ; }
Check if all given methods return true or if the list is empty .
3,688
private ParallelTransition buildSlideTransition ( final boolean isReverse , final SlideModel < SlideStep > previousSlideModel , final SlideModel < SlideStep > selectedSlideModel ) { final ParallelTransition slideAnimation = ParallelTransitionBuilder . create ( ) . build ( ) ; if ( previousSlideModel != null ) { final Animation a = isReverse ? previousSlideModel . getShowAnimation ( ) : previousSlideModel . getHideAnimation ( ) ; if ( a != null ) { slideAnimation . getChildren ( ) . add ( a ) ; } } if ( this . selectedSlideModel != null ) { final Animation a = isReverse ? this . selectedSlideModel . getHideAnimation ( ) : this . selectedSlideModel . getShowAnimation ( ) ; if ( a != null ) { slideAnimation . getChildren ( ) . add ( a ) ; } } final SlideModel < SlideStep > csm = selectedSlideModel ; slideAnimation . setOnFinished ( new javafx . event . EventHandler < ActionEvent > ( ) { public void handle ( final ActionEvent arg0 ) { if ( previousSlideModel instanceof AbstractBaseModel ) { ( ( AbstractBaseModel < ? > ) previousSlideModel ) . doHideView ( null ) ; } if ( selectedSlideModel instanceof AbstractBaseModel ) { ( ( AbstractBaseModel < ? > ) selectedSlideModel ) . doShowView ( null ) ; } if ( csm != null ) { Node node ; for ( int i = view ( ) . node ( ) . getChildren ( ) . size ( ) - 1 ; i >= 0 ; i -- ) { node = view ( ) . node ( ) . getChildren ( ) . get ( i ) ; if ( csm . node ( ) != node ) { view ( ) . node ( ) . getChildren ( ) . remove ( node ) ; } } } } } ) ; return slideAnimation ; }
Get the animation to use between slides .
3,689
public void next ( final boolean skipSlideStep ) { synchronized ( this ) { if ( skipSlideStep || this . selectedSlideModel . nextStep ( ) && this . slidePosition < getPresentationService ( ) . getPresentation ( ) . getSlides ( ) . getSlide ( ) . size ( ) - 1 ) { this . slidePosition = Math . min ( this . slidePosition + 1 , getPresentationService ( ) . getPresentation ( ) . getSlides ( ) . getSlide ( ) . size ( ) - 1 ) ; displaySlide ( getPresentationService ( ) . getPresentation ( ) . getSlides ( ) . getSlide ( ) . get ( this . slidePosition ) , false ) ; } } }
Got to next slide .
3,690
public void previous ( final boolean skipSlideStep ) { synchronized ( this ) { if ( skipSlideStep || this . selectedSlideModel . previousStep ( ) && this . slidePosition > 0 ) { this . slidePosition = Math . max ( this . slidePosition - 1 , 0 ) ; displaySlide ( getPresentationService ( ) . getPresentation ( ) . getSlides ( ) . getSlide ( ) . get ( this . slidePosition ) , ! skipSlideStep ) ; } } }
Go to previous slide .
3,691
public void showSlideMenu ( ) { synchronized ( this ) { if ( ! this . menuShown . getAndSet ( true ) ) { final SlideMenuModel smm = getModel ( Key . create ( SlideMenuModel . class , this . selectedSlide ) ) ; StackPane . setAlignment ( smm . node ( ) , Pos . CENTER ) ; view ( ) . node ( ) . getChildren ( ) . add ( smm . node ( ) ) ; smm . node ( ) . parentProperty ( ) . addListener ( ( observable , oldValue , newValue ) -> { if ( newValue == null ) { this . menuShown . set ( false ) ; } } ) ; } } }
Display the slide menu to navigate .
3,692
public YokeRequest wrap ( HttpServerRequest request , Context context , Map < String , Engine > engines , SessionStore store ) { return new YokeRequest ( request , new YokeResponse ( request . response ( ) , context , engines ) , context , store ) ; }
Default implementation of the request wrapper
3,693
private void addEvent ( final List < JRebirthEvent > eventList , final String strLine ) { eventList . add ( new JRebirthEventBase ( strLine ) ) ; }
Add an event to the event list .
3,694
private void initSequential ( final Boolean sequential ) { final Sequential seq = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , Sequential . class ) ; setSequential ( seq == null ? sequential == null ? DEFAULT_SEQUENTIAL_VALUE : sequential : seq . value ( ) ) ; }
Define the sequential value .
3,695
protected UniqueKey < ? extends Command > getCommandKey ( final Class < ? extends Command > commandClass , final Object ... keyPart ) { return Key . create ( commandClass , keyPart ) ; }
Return the command key .
3,696
@ SuppressWarnings ( "unchecked" ) protected void buildObject ( ) { final Class < ? > objectType = ClassUtility . findGenericClass ( this . getClass ( ) , OBJECT_EXCLUDED_CLASSES ) ; if ( objectType != null ) { Object keyPart = null ; boolean found = false ; for ( int i = 0 ; ! found && i < getListKeyPart ( ) . size ( ) ; i ++ ) { keyPart = getListKeyPart ( ) . get ( i ) ; if ( objectType . isAssignableFrom ( keyPart . getClass ( ) ) ) { this . object = ( O ) keyPart ; found = true ; } } if ( this . object == null ) { try { this . object = ( O ) ClassUtility . buildGenericType ( this . getClass ( ) , OBJECT_EXCLUDED_CLASSES ) ; } catch ( final CoreException ce ) { LOGGER . log ( UIMessages . CREATION_FAILURE , ce , this . getClass ( ) . getName ( ) ) ; throw new CoreRuntimeException ( ce ) ; } } } }
Create the default bindable object .
3,697
public void doUnload ( final Wave wave ) { this . eventList = new ArrayList < > ( ) ; final Collection < BallModel > list = new ArrayList < > ( this . ballMap . values ( ) ) ; for ( final BallModel ballModel : list ) { unregisterBall ( ballModel ) ; } }
Unload the event list .
3,698
public void doPlay ( final Wave wave ) { if ( ! this . playing ) { this . playing = true ; this . timeFrame = 0 ; } if ( this . timeFrame < this . eventList . size ( ) - 1 ) { showNext ( this . eventList . get ( this . timeFrame ) ) ; } else { this . playing = false ; } }
Call when event play button is pressed .
3,699
public void doNext ( final Wave wave ) { if ( this . eventList != null && this . timeFrame + 1 < this . eventList . size ( ) ) { showNext ( this . eventList . get ( this . timeFrame + 1 ) ) ; } }
Call when event next button is pressed .