/* * [ApplicationMenuItem.java] * * Summary: Generate a menu item, three columns, image/short/long description for an Application. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.8 2009-02-06 include go package in ZIP bundle. * download */ package com.mindprod.htmlmacros.macro; import com.mindprod.fastcat.FastCat; import com.mindprod.htmlmacros.support.BuildImage; import com.mindprod.htmlmacros.support.ImageAlignment; import com.mindprod.htmlmacros.support.Tools; import com.mindprod.prices.AppCat; import java.io.File; import static com.mindprod.htmlmacros.macro.Global.configuration; import static java.lang.System.*; /** * Generate a menu item, three columns, image/short/long description for an Application. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * download * @see com.mindprod.htmlmacros.WebStartMenuItem * @see AmanuensisMenuItem * @since 2009 */ public final class ApplicationMenuItem extends Macro { /** * used to separate a click able link from its neighbours to make it stand out. light vertical bar. * If it won't render, will just give a little extra while space. */ private static final String LINK_SEP = " ❘ "; /** * how to use the macro */ private static final String USAGE = "\nApplicationMenuItem macro needs targetFile page image shortDesc longDesc"; /** * guts to Generate reference to a WebstartMenuItem reference * * @param targetFile name of file to jump to * @param page page number in downloads. * @param image image representing the file. * @param shortDesc short description * @param longDesc long description * * @return expand lines table followed by divider line */ private String expand( String targetFile, String page, String image, String shortDesc, String longDesc ) { // the HTML containing the JNLP link // get base by chopping .html final String base = targetFile.substring( 0, targetFile.length() - ".html".length() ); final String ucBase = base.toUpperCase(); // don't display manual here. final String runHtmlFile = AppCat.APPLICATION.getJarDir() + "/" + targetFile; final String manualLink; final String manualFilename = base + ".manual.html"; if ( new File( ( configuration.getLocalWebrootWithSlashes() + "/" + AppCat.APPLICATION.getJarDir() ).replace( '/', File.separatorChar ), manualFilename ) .exists() ) { manualLink = LINK_SEP + " " + Tools.completeLink( AppCat.APPLICATION.getJarDir() + '/' + manualFilename, "manual", "manual", fileBeingDistributed ); } else { manualLink = ""; } final FastCat sb = new FastCat( 31 ); sb.append( "
" );
sb.append( Tools.completeLink( AppCat.getPrecisDir()
+ "/"
+ base
+ ".txt", "precis", "precis", fileBeingDistributed ) );
sb.append( " " );
sb.append( manualLink );
sb.append( " of current version | \n" );
sb.append( "" );
sb.append( Tools.completeLink( "products"
+ page
+ ".html#"
+ ucBase, "download", "zip", fileBeingDistributed ) );
sb.append( " source and executable | \n" );
sb.append( "