/** * Adds a new conditional font to this title, the conditional font will * be applied to {@link #setFont(Font)} when its <code>condition</code> * is met. If there is more than one font whose condition is met, then the * first one that was registered is used. * @param id the id of the font which is to be used * @param kind what kind of title this is * @param condition the condition to met * @param backup to be used when there is not font set in the {@link FontManager} */ protected void addConditionalFont( String id, Path kind, Condition condition, FontModifier backup ){ ConditionalFont font = new ConditionalFont( id, kind, condition, backup ); addFont( font ); if( conditionalFonts == null ) conditionalFonts = new ArrayList<ConditionalFont>(); conditionalFonts.add( font ); updateFonts(); }
/** * Adds a new conditional font to this title, the conditional font will * be applied to {@link #setFont(Font)} when its <code>condition</code> * is met. If there is more than one font whose condition is met, then the * first one that was registered is used. * @param id the id of the font which is to be used * @param kind what kind of title this is * @param condition the condition to met * @param backup to be used when there is not font set in the {@link FontManager} */ protected void addConditionalFont( String id, Path kind, Condition condition, FontModifier backup ){ ConditionalFont font = new ConditionalFont( id, kind, condition, backup ); addFont( font ); if( conditionalFonts == null ) conditionalFonts = new ArrayList<ConditionalFont>(); conditionalFonts.add( font ); updateFonts(); }
/** * Checks the state of this title and may replace the font of the title. */ protected void updateFonts(){ if( conditionalFonts != null ){ FontModifier modifier = null; for( ConditionalFont font : conditionalFonts ){ if( font.getState() ){ modifier = font.value(); break; } } setFontModifier( modifier ); } }
/** * Checks the state of this title and may replace the font of the title. */ protected void updateFonts(){ if( conditionalFonts != null ){ FontModifier modifier = null; for( ConditionalFont font : conditionalFonts ){ if( font.getState() ){ modifier = font.value(); break; } } setFontModifier( modifier ); } }