public void updateSizeForStateAndInfo ( ) { // Find all state and info glyphs for ( Glyph glyph : this . glyph . getGlyph ( ) ) { if ( glyph . getClazz ( ) == STATE_VARIABLE ) { stateGlyphs . add ( glyph ) ; } else if ( glyph . getClazz ( ) == UNIT_OF_INFORMATION ) { infoGlyphs . add ( glyph ) ; } } //Calculate "state of information" glyphs' sizes int wholeWidthOfStates = calcReqWidthByStateAndInfos ( stateGlyphs ) ; int wholeWidthOfInfos = calcReqWidthByStateAndInfos ( infoGlyphs ) ; // Calculate positions int numOfStates = stateGlyphs . size ( ) ; int numOfInfos = infoGlyphs . size ( ) ; //set a maximum width to glyph according to state and info boxes int totNumStateInfo = numOfInfos + numOfStates ; int multiplier = totNumStateInfo <= 2 ? 2 : 3 ; float requiredWidth = multiplier * OFFSET_BTW_INFO_GLYPHS + ( multiplier - 1 ) * MAX_STATE_AND_INFO_WIDTH ; //Adjust heights so that info box offsets are taken into account in layout. if ( totNumStateInfo > 0 ) this . glyph . getBbox ( ) . setH ( this . glyph . getBbox ( ) . getH ( ) + MAX_STATE_AND_INFO_HEIGHT / 2 ) ; if ( this . glyph . getBbox ( ) . getW ( ) < requiredWidth ) { this . glyph . getBbox ( ) . setW ( requiredWidth ) ; } }
If glyph attribute of this VNode object includes any state of information or unit of information glyphs this method updates the size of VNode accordingly .