private CharSequence getImage ( final UIMenuItem _menuItem , final String _node ) { final String label = _menuItem . getLabel ( ) ; String content = "" ; if ( StringUtils . isNotEmpty ( label ) ) { content = StringUtils . left ( label , 1 ) . toUpperCase ( ) ; } final StringBuilder js = new StringBuilder ( ) ; if ( StringUtils . isNotEmpty ( _menuItem . getImage ( ) ) && _menuItem . getImage ( ) . endsWith ( ".svg" ) ) { try { final QueryBuilder querBldr = new QueryBuilder ( CIAdminUserInterface . Image ) ; querBldr . addWhereAttrEqValue ( CIAdminUserInterface . Image . Name , _menuItem . getImage ( ) ) ; final InstanceQuery query = querBldr . getQuery ( ) ; query . execute ( ) ; if ( query . next ( ) ) { final Checkout checkout = new Checkout ( query . getCurrentValue ( ) ) ; final ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; checkout . execute ( os ) ; final String svg = new String ( os . toByteArray ( ) , StandardCharsets . UTF_8 ) ; js . append ( "domConstruct.create(\"span\", {\n" ) . append ( "innerHTML: \"" ) . append ( StringEscapeUtils . escapeEcmaScript ( svg ) ) . append ( "\"\n" ) . append ( "}, " ) . append ( _node ) . append ( ");\n" ) ; } } catch ( final EFapsException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } } else { js . append ( "domConstruct.create(\"span\", {\n" ) . append ( "class: \"circle " ) . append ( content ) . append ( " \"\n," ) . append ( "innerHTML: \"" ) . append ( content ) . append ( "\"\n" ) . append ( "}, " ) . append ( _node ) . append ( ");\n" ) ; } return js ; }
Gets the image .