private Component createLibrariesTab ()
{
try
{
// Parsing jar structure
final JarStructure structure = ReflectUtils.getJarStructure ( getClass () );
// Retrieving required files
final JarEntry licensesFolder = structure.getRoot ().getChildByName ( "licenses" );
final JarEntry librariesDataFile = licensesFolder.getChildByName ( "libraries.data" );
// Retrieving additional data for used libraries
final String librariesDataText = FileUtils.readToString ( structure.getEntryInputStream ( librariesDataFile ) );
final Map<String, String> librariesData = parseUrls ( librariesDataText );
// Parsing available libraries info
final WebPanel librariesPanel = new WebPanel ( new VerticalFlowLayout ( 0, 5 ) );
librariesPanel.setMargin ( 5 );
for ( final JarEntry child : licensesFolder.getChilds () )
{
if ( child.getName ().endsWith ( ".txt" ) )
{
final String data = librariesData.get ( child.getName () );
final int i = data.indexOf ( LIBRARY_DATA_SEPARATOR );
final String name = data.substring ( 0, i );
final String url = data.substring ( i + LIBRARY_DATA_SEPARATOR.length () );
final WebLabel nameLabel = new WebLabel ( name );
SwingUtils.setBoldFont ( nameLabel );
// Library license file
final WebLinkLabel fileLink = new WebLinkLabel ( child.getName () );
fileLink.setLink ( new Runnable ()
{
@Override
public void run ()
{
try
{
final String license = FileUtils.readToString ( structure.getEntryInputStream ( child ) );
final WebPopup licensePopup = new WebPopup ();
final WebTextArea textArea = new WebTextArea ( license );
textArea.setEditable ( false );
licensePopup.add ( new WebScrollPane ( textArea, false ) );
licensePopup.showPopupAsModal ( fileLink, true, true );