/* * [HomeHead.java] * * Summary: Produce the header for the Home page. * * Copyright: (c) 2004-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. */ package com.mindprod.htmlmacros.macro; import com.mindprod.common18.ST; import com.mindprod.fastcat.FastCat; import com.mindprod.htmlmacros.support.BuildImage; import com.mindprod.htmlmacros.support.GoogleAdSense; import com.mindprod.htmlmacros.support.ImageAlignment; import com.mindprod.htmlmacros.support.Indexing; import com.mindprod.htmlmacros.support.Tools; import static java.lang.System.*; /** * Produce the header for the Home page. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2004 */ public final class HomeHead extends Head { /** * how to use the macro */ private static final String USAGE = "\nHomeHead macro needs title description keywords icon16 ref image"; /** * buid code to display and link to the Bgloss master index and Java glossary * * @return genernated html code */ private String buildExtraNavigation() { final FastCat sb = new FastCat( 4 ); final String jglossImageRef = BuildImage.buildImgTag( "navigate/jgloss.png", "go to the Java Glossary", ImageAlignment.middle, "plain", fileBeingDistributed ); sb.append( Tools.completeLink( "jgloss/jgloss.html", jglossImageRef, "plain", fileBeingDistributed ) ); sb.append( '\n' ); final String bglossImageRef = BuildImage.buildImgTag( "navigate/bgloss.png", "go to the Computer Buyers’ Glossary Home", ImageAlignment.middle, "plain", fileBeingDistributed ); sb.append( Tools.completeLink( "bgloss/bgloss.html", bglossImageRef, "plain", fileBeingDistributed ) ); sb.append( '\n' ); return sb.toString(); } /** * Generate the header for a Home page. * * @param parms parameters from macro command line. parms[0] = title description of fragment. parms[1] * = description parms[2] = keywords parms[3] = icon16 png icon for title bar, usually * icon16/xxx.png parms[4] = image for essay parms[5] = optional menu, * LOCAL_WEBROOT_WITH_BACKSLASHES relative * @param quiet true if want output suppressed. * @param verbose @return expanded macro HTML */ public String expandMacro( String[] parms, final boolean quiet, final boolean verbose ) { if ( !quiet ) { out.print( "H" ); } if ( parms.length != 6 ) { throw new IllegalArgumentException( USAGE ); } final String title = parms[ 0 ]; final String description = parms[ 1 ]; final String keywords = parms[ 2 ]; final String icon16 = parms[ 3 ]; // might be an image or html to emmed ad link to an image String topLeftOfPageRef = parms[ 4 ]; if ( ST.isEmpty( topLeftOfPageRef ) ) { topLeftOfPageRef = null; } String topLeftOfPageImage = parms[ 5 ]; if ( !ST.isEmpty( topLeftOfPageImage ) ) { topLeftOfPageImage = "home/" + topLeftOfPageImage; } final String extraNavigation = buildExtraNavigation(); return generalHead( title, null, // shorttitle description, title, // hereBreadcrumbTitle "titlehome", // titleStile keywords, icon16, topLeftOfPageRef, /* url of image provider */ topLeftOfPageImage, /* daily image */ null, extraNavigation, null, null, null, null, null, null, null, null, Indexing.NONE, GoogleAdSense.MEDIUM_RECTANGLE, null, null ); } }