0001: //** Copyright Statement ***************************************************
0002: //The Salmon Open Framework for Internet Applications (SOFIA)
0003: // Copyright (C) 1999 - 2002, Salmon LLC
0004: //
0005: // This program is free software; you can redistribute it and/or
0006: // modify it under the terms of the GNU General Public License version 2
0007: // as published by the Free Software Foundation;
0008: //
0009: // This program is distributed in the hope that it will be useful,
0010: // but WITHOUT ANY WARRANTY; without even the implied warranty of
0011: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012: // GNU General Public License for more details.
0013: //
0014: // You should have received a copy of the GNU General Public License
0015: // along with this program; if not, write to the Free Software
0016: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0017: //
0018: // For more information please visit http://www.salmonllc.com
0019: //** End Copyright Statement ***************************************************
0020: package com.salmonllc.jsp;
0021:
0022: import com.salmonllc.html.*;
0023:
0024: import com.salmonllc.properties.*;
0025:
0026: import com.salmonllc.util.*;
0027:
0028: /////////////////////////
0029: //$Archive: /SOFIA/SourceCode/com/salmonllc/jsp/JspNavBar.java $
0030: //$Author: Srufle $
0031: //$Revision: 130 $
0032: //$Modtime: 8/05/04 5:22p $
0033: /////////////////////////
0034: import java.util.*;
0035:
0036: /**
0037: * This object is used to render a Navigation Menu in a JSP Page
0038: */
0039: public class JspNavBar extends JspContainer implements Constants,
0040: java.io.Serializable {
0041: private static final String CUSTOMGROUPHREFSTYLE = "CUSTOMGROUPHREFSTYLE";
0042: private static final String CUSTOMGROUPHOVERSTYLE = "CUSTOMGROUPHOVERSTYLE";
0043: Hashtable _nav;
0044: HtmlScript _imagesScript;
0045: HtmlTable _table;
0046: String _groupname;
0047: String _navWidthPercent = null;
0048:
0049: // String _selectedItemMarkerImg,_selectedItemMarkerMouseOverImg,_itemMarkerImg,_itemTitleMarkerImg,_itemMarkerMouserOverImg;
0050: Vector _groups;
0051: Vector _subItems;
0052: Vector _vPopups;
0053: boolean _autoSelectNav = true;
0054: boolean _bHorizontalMode = false;
0055:
0056: // If a new mode is added be sure to define it sequentially.
0057: boolean _dreamMode = false;
0058: boolean _showSubMenuMarker = true;
0059: int _navWidth;
0060: int _selectedGroupIndex = -1;
0061: int _selectedItemIndex = -1;
0062: int _sizeOption = 0;
0063:
0064: //
0065: private String _align = null;
0066: private String _anchorPrefixCss = "A.";
0067:
0068: //////////////
0069: //
0070: private String _bgColor = "";
0071: private String _cellBgColor;
0072: private String _groupCellBgColor;
0073: private String _groupHoverBgColor;
0074: private String _groupHoverStyle;
0075: private String _groupHrefStyle;
0076: private String _groupSpacerImage;
0077: private String _hSpaceImage;
0078: private String _height;
0079: private String _hoverBgColor;
0080: private String _hoverStyle;
0081: private String _hrefStyle;
0082: private String _lastSubMenuAdded;
0083: private String _markerImage;
0084: private String _markerOverImage;
0085: private String _sPctSign = "%";
0086: private String _selectedBgColor;
0087: private String _selectedHoverBgColor;
0088: private String _selectedHoverStyle;
0089: private String _selectedMarkerImage;
0090: private String _selectedStyle;
0091: private String _showPopupBgColor;
0092: private String _showPopupHoverStyle;
0093: private String _showPopupImage;
0094: private String _showPopupSelectedHoverStyle;
0095: private String _showPopupSelectedStyle;
0096: private String _showPopupStyle;
0097: private String _subHoverBgColor;
0098: private String _subHoverStyle;
0099: private String _subHrefStyle;
0100: private String _subMenuBgColor;
0101: private String _textImage;
0102: private String _textStyle;
0103: private String _theme;
0104: private String _vSpaceImage;
0105: private String _width;
0106: private boolean _bGenerateScripts = true;
0107: private boolean _oneSelected = false;
0108: private int _border = -1;
0109: private int _cellPadding = -1;
0110: private int _cellSpacing = -1;
0111: private int _cols = -1;
0112: private int _hSpace = -1;
0113: private int _lastGroupAdded;
0114: private int _vSpace = -1;
0115:
0116: /**
0117: * This constructor creates a NavigationMenu using properties from a group with a groupname of default.
0118: *
0119: * @param name java.lang.String
0120: * @param p com.salmonllc.html.HtmlPage
0121: */
0122: public JspNavBar(String name, HtmlPage p) {
0123: this (name, null, p);
0124: }
0125:
0126: /**
0127: * This constructor creates a NavigationMenu using properties from a group with a groupname of default.
0128: *
0129: * @param name java.lang.String
0130: * @param theme DOCUMENT ME!
0131: * @param p com.salmonllc.html.HtmlPage
0132: */
0133: public JspNavBar(String name, String theme, HtmlPage p) {
0134: super (name, p);
0135: _groups = new Vector();
0136: _subItems = new Vector();
0137: p
0138: .setDocumentType("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">");
0139:
0140: p.addNavBar(this );
0141: setTheme(theme);
0142: }
0143:
0144: /**
0145: * Sets the alignment property for the table.
0146: *
0147: * @param align Valid values are ALIGN_LEFT,ALIGN_CENTER,ALIGN_RIGHT and ALIGN_NONE.
0148: */
0149: public void setAlign(String align) {
0150: _align = align;
0151: }
0152:
0153: public void setAnchorPrefixCss(String anchorPrefixCss) {
0154: _anchorPrefixCss = anchorPrefixCss;
0155: }
0156:
0157: public String getAnchorPrefixCss() {
0158: return _anchorPrefixCss;
0159: }
0160:
0161: /**
0162: * Sets whether or not the navbar will generate extra url parameters that automatically select another nav item if the user clicks on it
0163: *
0164: * @param autoSelect DOCUMENT ME!
0165: */
0166: public void setAutoSelectNavbar(boolean autoSelect) {
0167: _autoSelectNav = autoSelect;
0168: }
0169:
0170: /**
0171: * Sets the background color for the table.
0172: *
0173: * @param value DOCUMENT ME!
0174: */
0175: public void setBgcolor(String value) {
0176: _bgColor = value;
0177: }
0178:
0179: /**
0180: * Sets the border width for the table.
0181: *
0182: * @param border DOCUMENT ME!
0183: */
0184: public void setBorder(int border) {
0185: _border = border;
0186: }
0187:
0188: /**
0189: * This method sets the NavBar Item Cell BG Color.
0190: *
0191: * @param val DOCUMENT ME!
0192: */
0193: public void setCellBgColor(String val) {
0194: _cellBgColor = val;
0195: }
0196:
0197: /**
0198: * Sets the cell padding for the table.
0199: *
0200: * @param value DOCUMENT ME!
0201: */
0202: public void setCellPadding(int value) {
0203: _cellPadding = value;
0204: }
0205:
0206: /**
0207: * Sets the cell spacing for the table.
0208: *
0209: * @param value DOCUMENT ME!
0210: */
0211: public void setCellSpacing(int value) {
0212: _cellSpacing = value;
0213: }
0214:
0215: /**
0216: * Sets the cell padding for the table.
0217: *
0218: * @param value DOCUMENT ME!
0219: */
0220: public void setCols(int value) {
0221: _cols = value;
0222: }
0223:
0224: /*
0225: * In the horizonal nav bar display the first level nav bars under the groups. others will expand to the right.
0226: */
0227: public boolean isFirstLevelSubMenu(String subMenu) {
0228: for (int i = 1; i <= _groups.size(); i++) {
0229: if (((Group) _groups.elementAt(i - 1))._visible == false) {
0230: continue;
0231: }
0232:
0233: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
0234: .size(); j++) {
0235: if (((Item) ((Group) _groups.elementAt(i - 1))._items
0236: .elementAt(j - 1))._visible == false) {
0237: continue;
0238: }
0239:
0240: String sItemName = ((Item) ((Group) _groups
0241: .elementAt(i - 1))._items.elementAt(j - 1))._submenu;
0242:
0243: if ((sItemName != null) && sItemName.equals(subMenu)) {
0244: return true;
0245: }
0246: }
0247: }
0248:
0249: return false;
0250: }
0251:
0252: /**
0253: * DOCUMENT ME!
0254: *
0255: * @param bGenScript DOCUMENT ME!
0256: */
0257: public void setGenerateScripts(boolean bGenScript) {
0258: _bGenerateScripts = bGenScript;
0259: }
0260:
0261: /**
0262: * DOCUMENT ME!
0263: *
0264: * @return DOCUMENT ME!
0265: */
0266: public boolean isGenerateScripts() {
0267: return _bGenerateScripts;
0268: }
0269:
0270: /**
0271: * This method sets the Group Cell BG Color.
0272: *
0273: * @param val DOCUMENT ME!
0274: */
0275: public void setGroupCellBgColor(String val) {
0276: _groupCellBgColor = val;
0277: }
0278:
0279: /**
0280: * This method sets the Group Cell BG Color.
0281: *
0282: * @param groupIdx DOCUMENT ME!
0283: * @param bgColor DOCUMENT ME!
0284: */
0285: public void setGroupCellBgColor(int groupIdx, String bgColor) {
0286: try {
0287: Group group = (Group) _groups.elementAt(groupIdx);
0288: group._bgColor = bgColor;
0289: } catch (Exception e) {
0290: e.printStackTrace();
0291: }
0292: }
0293:
0294: /**
0295: * Get Is Group Expanded
0296: *
0297: * @param groupName DOCUMENT ME!
0298: *
0299: * @return DOCUMENT ME!
0300: */
0301: public boolean isGroupExpanded(String groupName) {
0302: boolean isExpanded = false;
0303:
0304: try {
0305: for (int i = 0; i < _groups.size(); i++) {
0306: Group group = (Group) _groups.elementAt(i);
0307:
0308: if (group._name.equals(groupName)) {
0309: isExpanded = group._expanded;
0310:
0311: break;
0312: }
0313: }
0314: } catch (Exception e) {
0315: e.printStackTrace();
0316: }
0317:
0318: return isExpanded;
0319: }
0320:
0321: /**
0322: * Set Group Expansion by groupName
0323: *
0324: * @param groupName DOCUMENT ME!
0325: */
0326: public void setGroupExpansion(String groupName) {
0327: try {
0328: for (int i = 0; i < _groups.size(); i++) {
0329: Group group = (Group) _groups.elementAt(i);
0330: boolean expanded = group._expanded;
0331:
0332: if (group._name.equals(groupName)) {
0333: if (expanded) {
0334: contractGroup(groupName);
0335: } else {
0336: expandGroup(groupName);
0337: }
0338: }
0339: }
0340: } catch (Exception e) {
0341: e.printStackTrace();
0342: }
0343: }
0344:
0345: /**
0346: * This method sets the Group Cell Hover BG Color.
0347: *
0348: * @param val DOCUMENT ME!
0349: */
0350: public void setGroupHoverBgColor(String val) {
0351: _groupHoverBgColor = val;
0352: }
0353:
0354: /**
0355: * This method sets the Group Hover Style.
0356: *
0357: * @param groupIdx int index of the group
0358: * @param groupHoverStyle String group Hover Style.
0359: */
0360: public void setGroupHoverStyle(int groupIdx, String groupHoverStyle) {
0361: try {
0362: Group group = (Group) _groups.elementAt(groupIdx);
0363: group._groupHoverStyle = groupHoverStyle;
0364: } catch (Exception e) {
0365: e.printStackTrace();
0366: }
0367: }
0368:
0369: /**
0370: * This method sets the Group Cell Hover Style.
0371: *
0372: * @param val DOCUMENT ME!
0373: */
0374: public void setGroupHoverStyle(String val) {
0375: _groupHoverStyle = val;
0376: }
0377:
0378: /**
0379: * This method sets the Group Href Style.
0380: *
0381: * @param groupIdx int index of the group
0382: * @param groupHrefStyle String group Href Style.
0383: */
0384: public void setGroupHrefStyle(int groupIdx, String groupHrefStyle) {
0385: try {
0386: Group group = (Group) _groups.elementAt(groupIdx);
0387: group._groupHrefStyle = groupHrefStyle;
0388: } catch (Exception e) {
0389: e.printStackTrace();
0390: }
0391: }
0392:
0393: /**
0394: * This method sets the Group Cell Href Style.
0395: *
0396: * @param val DOCUMENT ME!
0397: */
0398: public void setGroupHrefStyle(String val) {
0399: _groupHrefStyle = val;
0400: }
0401:
0402: /**
0403: * Get Group Index by groupName
0404: *
0405: * @param groupName is the group name
0406: *
0407: * @return DOCUMENT ME!
0408: */
0409: public int getGroupIndex(String groupName) {
0410: int groupIdx = -1;
0411:
0412: try {
0413: for (int i = 0; i < _groups.size(); i++) {
0414: Group group = (Group) _groups.elementAt(i);
0415:
0416: if (group._name.equals(groupName)) {
0417: groupIdx = i;
0418:
0419: break;
0420: }
0421: }
0422:
0423: return groupIdx;
0424: } catch (Exception e) {
0425: e.printStackTrace();
0426:
0427: return groupIdx;
0428: }
0429: }
0430:
0431: /**
0432: * This method sets the Group to a state of selected. This is used to give the group the same style as when it is rolled over.
0433: *
0434: * @param groupIdx - index of the group to set selected
0435: * @param selected - status true or false
0436: */
0437: public void setGroupSelected(int groupIdx, boolean selected) {
0438: try {
0439: Group group = (Group) _groups.elementAt(groupIdx);
0440: group._selected = selected;
0441: } catch (Exception e) {
0442: e.printStackTrace();
0443: }
0444: }
0445:
0446: /**
0447: * This method gets the minimum height of the table in pixels.
0448: *
0449: * @param val DOCUMENT ME!
0450: */
0451: public void setGroupSpacerImage(String val) {
0452: _groupSpacerImage = translateSiteMapURL(val);
0453: }
0454:
0455: /**
0456: * Set Group Title to be displayed by groupName
0457: *
0458: * @param groupName
0459: * @param titleText is the Text the Group should display.
0460: */
0461: public void setGroupTitle(String groupName, String titleText) {
0462: try {
0463: for (int i = 0; i < _groups.size(); i++) {
0464: Group group = (Group) _groups.elementAt(i);
0465:
0466: if (group._name.equals(groupName)) {
0467: group._groupTitle = titleText;
0468: }
0469: }
0470: } catch (Exception e) {
0471: e.printStackTrace();
0472: }
0473: }
0474:
0475: /**
0476: * Get Group Title Text by group Index
0477: *
0478: * @param groupIdx is the group index
0479: *
0480: * @return DOCUMENT ME!
0481: */
0482: public String getGroupTitle(int groupIdx) {
0483: String groupTitle = null;
0484:
0485: try {
0486: Group group = (Group) _groups.elementAt(groupIdx);
0487: groupTitle = group._groupTitle;
0488:
0489: return groupTitle;
0490: } catch (Exception e) {
0491: e.printStackTrace();
0492:
0493: return groupTitle;
0494: }
0495: }
0496:
0497: /**
0498: * Sets the horizontal margin for the table.
0499: *
0500: * @param val DOCUMENT ME!
0501: */
0502: public void setHSpace(int val) {
0503: _hSpace = val;
0504: }
0505:
0506: /**
0507: * This method gets the minimum height of the table in pixels.
0508: *
0509: * @param val DOCUMENT ME!
0510: */
0511: public void setHSpaceImage(String val) {
0512: _hSpaceImage = translateSiteMapURL(val);
0513: }
0514:
0515: /**
0516: * This method gets the minimum height of the table in pixels.
0517: *
0518: * @param val DOCUMENT ME!
0519: */
0520: public void setHeight(String val) {
0521: _height = val;
0522: }
0523:
0524: /**
0525: * DOCUMENT ME!
0526: *
0527: * @param bHorizontalMode DOCUMENT ME!
0528: */
0529: public void setHorizontalMode(boolean bHorizontalMode) {
0530: this ._bHorizontalMode = bHorizontalMode;
0531: }
0532:
0533: /**
0534: * DOCUMENT ME!
0535: *
0536: * @return DOCUMENT ME!
0537: */
0538: public boolean getHorizontalMode() {
0539: return _bHorizontalMode;
0540: }
0541:
0542: /**
0543: * DOCUMENT ME!
0544: *
0545: * @return DOCUMENT ME!
0546: */
0547: public boolean isHorizontalMode() {
0548: return _bHorizontalMode;
0549: }
0550:
0551: /**
0552: * This method sets the NavBar Item MouseOver Cell BG Color.
0553: *
0554: * @param val DOCUMENT ME!
0555: */
0556: public void setHoverBgColor(String val) {
0557: _hoverBgColor = val;
0558: }
0559:
0560: /**
0561: * This method sets the NavBar Item MouseOver Style.
0562: *
0563: * @param val DOCUMENT ME!
0564: */
0565: public void setHoverStyle(String val) {
0566: _hoverStyle = val;
0567: }
0568:
0569: /**
0570: * Set Href for a Group Item
0571: *
0572: * @param groupIndex is the group index of the entry to change the HRef of.
0573: * @param itemIndex is the item index of the entry to change the HRef of.
0574: * @param href is the new URL for the HREF of the link.
0575: */
0576: public void setHref(int groupIndex, int itemIndex, String href) {
0577: try {
0578: Group group = (Group) _groups.elementAt(groupIndex - 1);
0579: Item item = (Item) group._items.elementAt(itemIndex - 1);
0580: item._href = href;
0581:
0582: // createTable();
0583: } catch (Exception e) {
0584: e.printStackTrace();
0585: }
0586: }
0587:
0588: /**
0589: * Set Href for a Group
0590: *
0591: * @param groupName is the group name of the entry to change the HRef of.
0592: * @param href is the new URL for the HREF of the link.
0593: */
0594: public void setHref(String groupName, String href) {
0595: try {
0596: for (int i = 0; i < _groups.size(); i++) {
0597: Group group = (Group) _groups.elementAt(i);
0598:
0599: if (group._name.equals(groupName)) {
0600: group._href = href;
0601: }
0602: }
0603: } catch (Exception e) {
0604: e.printStackTrace();
0605: }
0606: }
0607:
0608: /**
0609: * Set Href for a Group
0610: *
0611: * @param groupIndex is the group index of the entry to change the HRef of.
0612: * @param href is the new URL for the HREF of the link.
0613: */
0614: public void setHref(int groupIndex, String href) {
0615: try {
0616: Group group = (Group) _groups.elementAt(groupIndex - 1);
0617: group._href = href;
0618: } catch (Exception e) {
0619: e.printStackTrace();
0620: }
0621: }
0622:
0623: /**
0624: * This method sets the NavBar Item Href Style.
0625: *
0626: * @param val DOCUMENT ME!
0627: */
0628: public void setHrefStyle(String val) {
0629: _hrefStyle = val;
0630: }
0631:
0632: /**
0633: * DOCUMENT ME!
0634: *
0635: * @return DOCUMENT ME!
0636: */
0637: public boolean isIE5() {
0638: return ((getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT) && (getPage()
0639: .getBrowserVersion() < 5));
0640: }
0641:
0642: /**
0643: * DOCUMENT ME!
0644: *
0645: * @return DOCUMENT ME!
0646: */
0647: public boolean isIE6() {
0648: return ((getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT)
0649: && (getPage().getBrowserVersion() > 5) && (getPage()
0650: .getBrowserVersion() < 7));
0651: }
0652:
0653: /**
0654: * Set the Background color of a Group Item
0655: *
0656: * @param groupIndex is the group index of the entry .
0657: * @param itemIndex is the item index of the entry .
0658: * @param color is to indicate what Background color the item should show.
0659: */
0660: public void setItemBgColor(int groupIndex, int itemIndex,
0661: String color) {
0662: try {
0663: Group group = (Group) _groups.elementAt(groupIndex - 1);
0664: Item item = (Item) group._items.elementAt(itemIndex - 1);
0665: item._itemBgcolor = color;
0666: } catch (Exception e) {
0667: e.printStackTrace();
0668: }
0669: }
0670:
0671: /**
0672: * This method sets the Last Group added.
0673: *
0674: * @param val DOCUMENT ME!
0675: */
0676: public void setLastGroupAdded(int val) {
0677: _lastGroupAdded = val;
0678: }
0679:
0680: /**
0681: * This method sets the Last Group added.
0682: *
0683: * @return DOCUMENT ME!
0684: */
0685: public int getLastGroupAdded() {
0686: return _lastGroupAdded;
0687: }
0688:
0689: /**
0690: * This method sets the Last Group added.
0691: *
0692: * @param val DOCUMENT ME!
0693: */
0694: public void setLastSubMenuAdded(String val) {
0695: _lastSubMenuAdded = val;
0696: }
0697:
0698: /**
0699: * This method sets the Last Group added.
0700: *
0701: * @return DOCUMENT ME!
0702: */
0703: public String getLastSubMenuAdded() {
0704: return _lastSubMenuAdded;
0705: }
0706:
0707: /**
0708: * This method gets the minimum height of the table in pixels.
0709: *
0710: * @param val DOCUMENT ME!
0711: */
0712: public void setMarkerImage(String val) {
0713: _markerImage = translateSiteMapURL(val);
0714: }
0715:
0716: /**
0717: * This method gets the minimum height of the table in pixels.
0718: *
0719: * @param val DOCUMENT ME!
0720: */
0721: public void setMarkerOverImage(String val) {
0722: _markerOverImage = translateSiteMapURL(val);
0723: }
0724:
0725: /**
0726: * DOCUMENT ME!
0727: *
0728: * @return DOCUMENT ME!
0729: */
0730: public boolean isNetscape4() {
0731: return ((getPage().getBrowserType() == HtmlPageBase.BROWSER_NETSCAPE) && (getPage()
0732: .getBrowserVersion() < 4));
0733: }
0734:
0735: /**
0736: * DOCUMENT ME!
0737: *
0738: * @return DOCUMENT ME!
0739: */
0740: public boolean isNetscape6() {
0741: return ((getPage().getBrowserType() == HtmlPageBase.BROWSER_NETSCAPE) && (getPage()
0742: .getBrowserVersion() == 6));
0743: }
0744:
0745: /**
0746: * DOCUMENT ME!
0747: *
0748: * @return DOCUMENT ME!
0749: */
0750: public boolean isNetscape7() {
0751: return ((getPage().getBrowserType() == HtmlPageBase.BROWSER_NETSCAPE) && (getPage()
0752: .getBrowserVersion() == 7));
0753: }
0754:
0755: /**
0756: * DOCUMENT ME!
0757: *
0758: * @return DOCUMENT ME!
0759: */
0760: public boolean isNetscapeBelowV6() {
0761: return ((getPage().getBrowserType() == HtmlPageBase.BROWSER_NETSCAPE) && (getPage()
0762: .getBrowserVersion() < 6));
0763: }
0764:
0765: /**
0766: * DOCUMENT ME!
0767: *
0768: * @return DOCUMENT ME!
0769: */
0770: public Vector getPopupsVector() {
0771: _vPopups = new Vector();
0772:
0773: Vector vHidePopups = new Vector();
0774:
0775: for (int i = 1; i <= _groups.size(); i++) {
0776: if (((Group) _groups.elementAt(i - 1))._visible == false) {
0777: continue;
0778: }
0779:
0780: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
0781: .size(); j++) {
0782: if (((Item) ((Group) _groups.elementAt(i - 1))._items
0783: .elementAt(j - 1))._visible == false) {
0784: continue;
0785: }
0786:
0787: //String sItemName=((Item)((Group)_groups.elementAt(i-1))._items.elementAt(j-1))._name;
0788: String sItemMenu = ((Item) ((Group) _groups
0789: .elementAt(i - 1))._items.elementAt(j - 1))._submenu;
0790: boolean sItemShowPopup = ((Item) ((Group) _groups
0791: .elementAt(i - 1))._items.elementAt(j - 1))._showPopup;
0792:
0793: if ((sItemMenu != null)
0794: && (_vPopups.indexOf(sItemMenu) < 0)) {
0795: if (sItemShowPopup) {
0796: _vPopups.addElement(sItemMenu);
0797: } else {
0798: vHidePopups.addElement(sItemMenu);
0799: }
0800: }
0801: }
0802: }
0803:
0804: for (int k = 1; k <= _subItems.size(); k++) {
0805: boolean _sVisible = ((SubItem) _subItems.elementAt(k - 1))._visible;
0806: String subSubName = ((SubItem) _subItems.elementAt(k - 1))._subMenu;
0807:
0808: //String subGroupName = ((SubItem) _subItems.elementAt(k-1))._subMenuGroup;
0809: if ((subSubName != null)
0810: && (_vPopups.indexOf(subSubName) < 0) && _sVisible
0811: && (vHidePopups.indexOf(subSubName) == -1)) {
0812: _vPopups.addElement(subSubName);
0813: }
0814: }
0815:
0816: return _vPopups;
0817: }
0818:
0819: /**
0820: * This method gets the minimum height of the table in pixels.
0821: *
0822: * @param val DOCUMENT ME!
0823: */
0824: public void setSelectedBgColor(String val) {
0825: _selectedBgColor = val;
0826: }
0827:
0828: /**
0829: * This method gets the minimum height of the table in pixels.
0830: *
0831: * @param val DOCUMENT ME!
0832: */
0833: public void setSelectedHoverBgColor(String val) {
0834: _selectedHoverBgColor = val;
0835: }
0836:
0837: /**
0838: * This method gets the minimum height of the table in pixels.
0839: *
0840: * @param val DOCUMENT ME!
0841: */
0842: public void setSelectedHoverStyle(String val) {
0843: _selectedHoverStyle = val;
0844: }
0845:
0846: /**
0847: * This selects the current page shown if it has a reference in the menu.
0848: */
0849: public void setSelectedItem() {
0850: clearSelectedItem();
0851:
0852: boolean outer_loop = false;
0853:
0854: for (int i = 0; i < _groups.size(); i++) {
0855: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
0856: .size(); j++) {
0857: String sHref = ((Item) ((Group) _groups.elementAt(i))._items
0858: .elementAt(j))._href;
0859:
0860: if (isPage(sHref)) {
0861: setSelectedItem((i + 1), (j + 1), true);
0862: outer_loop = true;
0863:
0864: break;
0865: }
0866: }
0867:
0868: if (outer_loop) {
0869: break;
0870: }
0871: }
0872: }
0873:
0874: /**
0875: * Set a Group Item to selected
0876: *
0877: * @param groupIndex int group index of item to select in menu.
0878: * @param itemIndex int item index of item to select in menu.
0879: * @param selected DOCUMENT ME!
0880: */
0881: public void setSelectedItem(int groupIndex, int itemIndex,
0882: boolean selected) {
0883: clearSelectedItem();
0884:
0885: Group group = (Group) _groups.elementAt(groupIndex - 1);
0886: Item item = (Item) group._items.elementAt(itemIndex - 1);
0887: item._selected = selected;
0888: }
0889:
0890: /**
0891: * This selects the current page shown if it has a reference in the menu.
0892: *
0893: * @param itemName DOCUMENT ME!
0894: */
0895: public void setSelectedItem(String itemName) {
0896: clearSelectedItem();
0897:
0898: if (!Util.isFilled(itemName)) {
0899: return;
0900: }
0901:
0902: boolean outer_loop = false;
0903:
0904: for (int i = 0; i < _groups.size(); i++) {
0905: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
0906: .size(); j++) {
0907: String sName = ((Item) ((Group) _groups.elementAt(i))._items
0908: .elementAt(j))._name;
0909:
0910: if (sName.toUpperCase().equals(itemName.toUpperCase())) {
0911: setSelectedItem((i + 1), (j + 1), true);
0912: outer_loop = true;
0913:
0914: break;
0915: }
0916: }
0917:
0918: if (outer_loop) {
0919: break;
0920: }
0921: }
0922: }
0923:
0924: /**
0925: * This method gets the minimum height of the table in pixels.
0926: *
0927: * @param val DOCUMENT ME!
0928: */
0929: public void setSelectedMarkerImage(String val) {
0930: _selectedMarkerImage = translateSiteMapURL(val);
0931: }
0932:
0933: /**
0934: * This method gets the minimum height of the table in pixels.
0935: *
0936: * @param val DOCUMENT ME!
0937: */
0938: public void setSelectedStyle(String val) {
0939: _selectedStyle = val;
0940: }
0941:
0942: /**
0943: * This sets the subItem to Selected.
0944: *
0945: * @param subItemName DOCUMENT ME!
0946: */
0947: public void setSelectedSubItem(String subItemName) {
0948: for (int i = 0; i < _subItems.size(); i++) {
0949: SubItem subItem = (SubItem) _subItems.elementAt(i);
0950:
0951: if (subItem._name.equals(subItemName)) {
0952: clearSelectedSubItem();
0953: subItem._selected = true;
0954:
0955: return;
0956: }
0957: }
0958:
0959: return;
0960: }
0961:
0962: /**
0963: * Set whether the submenu of a Group item should have its submenu shown on the navbar or while hovering over the item.
0964: *
0965: * @param groupIndex is the group index of the entry to hide/show.
0966: * @param itemIndex is the item index of the entry to hide/show.
0967: * @param show is to indicate whether the item should show popup in navbar or on mouseover. True = On MouseOver False= In Navbar
0968: */
0969: public void setShowPopup(int groupIndex, int itemIndex, boolean show) {
0970: try {
0971: Group group = (Group) _groups.elementAt(groupIndex - 1);
0972: Item item = (Item) group._items.elementAt(itemIndex - 1);
0973: item._showPopup = show;
0974: } catch (Exception e) {
0975: e.printStackTrace();
0976: }
0977: }
0978:
0979: /**
0980: * Set whether the submenu of a Group item should have its submenu shown on the navbar or while hovering over the item.
0981: *
0982: * @param groupName is the group of the entry to hide/show.
0983: * @param itemName is the item of the entry to hide/show.
0984: * @param show is to indicate whether the submenu should be shown in navbar or On Mouseover. True = On MouseOver False= In Navbar
0985: */
0986: public void setShowPopup(String groupName, String itemName,
0987: boolean show) {
0988: try {
0989: for (int i = 0; i < _groups.size(); i++) {
0990: Group group = (Group) _groups.elementAt(i);
0991:
0992: if (group._name.equals(groupName)) {
0993: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
0994: .size(); j++) {
0995: Item item = ((Item) ((Group) _groups
0996: .elementAt(i))._items.elementAt(j));
0997:
0998: if (item._name.equals(itemName)) {
0999: item._showPopup = show;
1000: }
1001: }
1002: }
1003: }
1004: } catch (Exception e) {
1005: e.printStackTrace();
1006: }
1007: }
1008:
1009: /**
1010: * This method sets the Show Popup In Navbar Background Color. If the background color is set A table will be inserted around the Popup items with this background color
1011: *
1012: * @param val DOCUMENT ME!
1013: */
1014: public void setShowPopupBgColor(String val) {
1015: _showPopupBgColor = val;
1016: }
1017:
1018: /**
1019: * This method sets the Show Popup Hover Style.
1020: *
1021: * @param val DOCUMENT ME!
1022: */
1023: public void setShowPopupHoverStyle(String val) {
1024: _showPopupHoverStyle = val;
1025: }
1026:
1027: /**
1028: * This method sets the Show Popup Image
1029: *
1030: * @param val DOCUMENT ME!
1031: */
1032: public void setShowPopupImage(String val) {
1033: _showPopupImage = val;
1034: }
1035:
1036: /**
1037: * This method sets the Show Popup Selected Hover Style.
1038: *
1039: * @param val DOCUMENT ME!
1040: */
1041: public void setShowPopupSelectedHoverStyle(String val) {
1042: _showPopupSelectedHoverStyle = val;
1043: }
1044:
1045: /**
1046: * This method sets the Show Popup Selected Style.
1047: *
1048: * @param val DOCUMENT ME!
1049: */
1050: public void setShowPopupSelectedStyle(String val) {
1051: _showPopupSelectedStyle = val;
1052: }
1053:
1054: /**
1055: * This method sets the Show Popup Style.
1056: *
1057: * @param val DOCUMENT ME!
1058: */
1059: public void setShowPopupStyle(String val) {
1060: _showPopupStyle = val;
1061: }
1062:
1063: /**
1064: * Show the item marker in the sub menus. In the horizontal mode you may not want to show the marker in the sub menus. Default is true.
1065: *
1066: * @param showSubMenuMarker boolean .
1067: */
1068: public void setShowSubMenuMarker(boolean showSubMenuMarker) {
1069: this ._showSubMenuMarker = showSubMenuMarker;
1070: }
1071:
1072: /**
1073: * DOCUMENT ME!
1074: *
1075: * @return DOCUMENT ME!
1076: */
1077: public boolean getShowSubMenuMarker() {
1078: return _showSubMenuMarker;
1079: }
1080:
1081: /**
1082: * Set Size Option
1083: *
1084: * @param sizeoption int
1085: */
1086: public void setSizeOption(int sizeoption) {
1087: _sizeOption = sizeoption;
1088: _table.setSizeOption(sizeoption);
1089: }
1090:
1091: /**
1092: * This method sets the NavBar SubItem MouseOver Cell BG Color.
1093: *
1094: * @param val DOCUMENT ME!
1095: */
1096: public void setSubHoverBgColor(String val) {
1097: _subHoverBgColor = val;
1098: }
1099:
1100: /**
1101: * This method sets the NavBar SubItem MouseOver Style.
1102: *
1103: * @param val DOCUMENT ME!
1104: */
1105: public void setSubHoverStyle(String val) {
1106: _subHoverStyle = val;
1107: }
1108:
1109: /**
1110: * This method sets the NavBar SubItem Href Style.
1111: *
1112: * @param val DOCUMENT ME!
1113: */
1114: public void setSubHrefStyle(String val) {
1115: _subHrefStyle = val;
1116: }
1117:
1118: /**
1119: * This method sets the Sub Menu Default Background Color.
1120: *
1121: * @param val DOCUMENT ME!
1122: */
1123: public void setSubMenuBgColor(String val) {
1124: _subMenuBgColor = val;
1125: }
1126:
1127: /**
1128: * Set Background color of an item on the Submenu
1129: *
1130: * @param subItemName is the sub Item Name .
1131: * @param bgColor is the color to set the Background Color of the Item.
1132: */
1133: public void setSubMenuItemBgColor(String subItemName, String bgColor) {
1134: try {
1135: for (int i = 0; i < _subItems.size(); i++) {
1136: SubItem subItem = (SubItem) _subItems.elementAt(i);
1137:
1138: if (subItem._name.equals(subItemName)) {
1139: subItem._subItemBgColor = bgColor;
1140: }
1141: }
1142: } catch (Exception e) {
1143: e.printStackTrace();
1144: }
1145: }
1146:
1147: /**
1148: * Set SubMenu visibility
1149: *
1150: * @param itemName is the item name of the entry to hide/show.
1151: * @param visible is to indicate whether the item should be shown or not.
1152: */
1153: public void setSubMenuItemVisible(String itemName, boolean visible) {
1154: try {
1155: for (int i = 0; i < _subItems.size(); i++) {
1156: SubItem subItem = (SubItem) _subItems.elementAt(i);
1157:
1158: if (subItem._name.equals(itemName)) {
1159: subItem._visible = visible;
1160: }
1161: }
1162: } catch (Exception e) {
1163: e.printStackTrace();
1164: }
1165: }
1166:
1167: /**
1168: * Set Submenu visibility
1169: *
1170: * @param subMenuName is the subMenu to hide/show.
1171: * @param visible is to indicate whether the item should be shown or not.
1172: */
1173: public void setSubMenuVisible(String subMenuName, boolean visible) {
1174: try {
1175: for (int i = 0; i < _subItems.size(); i++) {
1176: SubItem subItem = (SubItem) _subItems.elementAt(i);
1177:
1178: if (subItem._subMenuGroup.equals(subMenuName)) {
1179: subItem._visible = visible;
1180:
1181: String subMenu = subItem._subMenu;
1182: String subGroup = subItem._subMenuGroup;
1183:
1184: if (!subGroup.equals(subMenu)) {
1185: setSubMenuVisible(subMenu, visible);
1186: }
1187: }
1188: }
1189: } catch (Exception e) {
1190: e.printStackTrace();
1191: }
1192: }
1193:
1194: /**
1195: * Set Target of a Group Item
1196: *
1197: * @param groupIndex is the group index of the entry to change the target of.
1198: * @param itemIndex is the item index of the entry to change the target of.
1199: * @param target is the new target associated with the link.
1200: */
1201: public void setTarget(int groupIndex, int itemIndex, String target) {
1202: try {
1203: Group group = (Group) _groups.elementAt(groupIndex - 1);
1204: Item item = (Item) group._items.elementAt(itemIndex - 1);
1205: item._target = target;
1206:
1207: // createTable();
1208: } catch (Exception e) {
1209: e.printStackTrace();
1210: }
1211:
1212: /* String sItemKey=_groupname+".Group"+groupIndex+".Item"+itemIndex;
1213: HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
1214: Enumeration enum=hc.getComponents();
1215: while(enum.hasMoreElements()) {
1216: HtmlComponent hcp=(HtmlComponent)enum.nextElement();
1217: if (hcp instanceof HtmlLink) {
1218: HtmlLink hl=(HtmlLink)hcp;
1219: hl.setTarget(target);
1220: }
1221: }*/
1222: }
1223:
1224: /**
1225: * This method gets the minimum height of the table in pixels.
1226: *
1227: * @param val DOCUMENT ME!
1228: */
1229: public void setTextImage(String val) {
1230: _textImage = translateSiteMapURL(val);
1231: }
1232:
1233: /**
1234: * This method gets the minimum height of the table in pixels.
1235: *
1236: * @param val DOCUMENT ME!
1237: */
1238: public void setTextStyle(String val) {
1239: _textStyle = val;
1240: }
1241:
1242: /**
1243: * This method sets the property theme for the component.
1244: *
1245: * @param theme The theme to use.
1246: */
1247: public void setTheme(String theme) {
1248: Props prop = getPage().getPageProperties();
1249:
1250: int iBorder = prop.getThemeIntProperty(theme,
1251: Props.NAVBAR_BORDER);
1252:
1253: if (iBorder >= 0) {
1254: _border = iBorder;
1255: }
1256:
1257: String bgColor = prop.getThemeProperty(theme,
1258: Props.NAVBAR_BG_COLOR);
1259:
1260: if ((bgColor != null) && (bgColor.length() > 0)) {
1261: _bgColor = bgColor;
1262: }
1263:
1264: _cellPadding = prop.getThemeIntProperty(theme,
1265: Props.NAVBAR_CELLPADDING);
1266: _cellSpacing = prop.getThemeIntProperty(theme,
1267: Props.NAVBAR_CELLSPACING);
1268: _align = prop.getThemeProperty(theme, Props.NAVBAR_ALIGN);
1269: _hSpace = prop.getThemeIntProperty(theme, Props.NAVBAR_H_SPACE);
1270: _vSpace = prop.getThemeIntProperty(theme, Props.NAVBAR_V_SPACE);
1271: _height = prop.getThemeProperty(theme, Props.NAVBAR_HEIGHT);
1272: _width = prop.getThemeProperty(theme, Props.NAVBAR_WIDTH);
1273: _hrefStyle = prop.getThemeProperty(theme,
1274: Props.NAVBAR_HREF_STYLE);
1275: _hoverStyle = prop.getThemeProperty(theme,
1276: Props.NAVBAR_HOVER_STYLE);
1277: _textStyle = prop.getThemeProperty(theme,
1278: Props.NAVBAR_TEXT_STYLE);
1279: _selectedStyle = prop.getThemeProperty(theme,
1280: Props.NAVBAR_SELECTED_STYLE);
1281: _selectedHoverStyle = prop.getThemeProperty(theme,
1282: Props.NAVBAR_SELECTED_HOVER_STYLE);
1283: _showPopupStyle = prop.getThemeProperty(theme,
1284: Props.NAVBAR_SHOW_POPUP_STYLE);
1285: _showPopupHoverStyle = prop.getThemeProperty(theme,
1286: Props.NAVBAR_SHOW_POPUP_HOVER_STYLE);
1287: _showPopupSelectedStyle = prop.getThemeProperty(theme,
1288: Props.NAVBAR_SHOW_POPUP_SELECTED_STYLE);
1289: _showPopupSelectedHoverStyle = prop.getThemeProperty(theme,
1290: Props.NAVBAR_SHOW_POPUP_SELECTED_HOVER_STYLE);
1291: _cellBgColor = prop.getThemeProperty(theme,
1292: Props.NAVBAR_CELL_BG_COLOR);
1293: _groupCellBgColor = prop.getThemeProperty(theme,
1294: Props.NAVBAR_GROUP_CELL_BG_COLOR);
1295: _groupHrefStyle = prop.getThemeProperty(theme,
1296: Props.NAVBAR_GROUP_HREF_STYLE);
1297: _groupHoverStyle = prop.getThemeProperty(theme,
1298: Props.NAVBAR_GROUP_HOVER_STYLE);
1299: _groupHoverBgColor = prop.getThemeProperty(theme,
1300: Props.NAVBAR_GROUP_HOVER_BG_COLOR);
1301: _hoverBgColor = prop.getThemeProperty(theme,
1302: Props.NAVBAR_HOVER_BG_COLOR);
1303: _selectedBgColor = prop.getThemeProperty(theme,
1304: Props.NAVBAR_SELECTED_BG_COLOR);
1305: _selectedHoverBgColor = prop.getThemeProperty(theme,
1306: Props.NAVBAR_SELECTED_HOVER_BG_COLOR);
1307: _showPopupBgColor = prop.getThemeProperty(theme,
1308: Props.NAVBAR_SHOW_POPUP_BG_COLOR);
1309: _subMenuBgColor = prop.getThemeProperty(theme,
1310: Props.NAVBAR_SUBMENU_BG_COLOR);
1311: _markerImage = prop.getThemeProperty(theme,
1312: Props.NAVBAR_MARKER_IMAGE);
1313: _markerOverImage = prop.getThemeProperty(theme,
1314: Props.NAVBAR_MARKER_OVER_IMAGE);
1315: _selectedMarkerImage = prop.getThemeProperty(theme,
1316: Props.NAVBAR_SELECTED_MARKER_IMAGE);
1317: _textImage = prop.getThemeProperty(theme,
1318: Props.NAVBAR_TEXT_IMAGE);
1319: _vSpaceImage = prop.getThemeProperty(theme,
1320: Props.NAVBAR_V_SPACE_IMAGE);
1321: _hSpaceImage = prop.getThemeProperty(theme,
1322: Props.NAVBAR_H_SPACE_IMAGE);
1323: _groupSpacerImage = prop.getThemeProperty(theme,
1324: Props.NAVBAR_GROUP_SPACER_IMAGE);
1325: _showPopupImage = prop.getThemeProperty(theme,
1326: Props.NAVBAR_SHOW_POPUP_IMAGE);
1327:
1328: // _subCellBgColor = prop.getThemeProperty(theme, Props.NAVBAR_SUB_CELL_BG_COLOR);
1329: _subHoverBgColor = prop.getThemeProperty(theme,
1330: Props.NAVBAR_SUB_HOVER_BG_COLOR);
1331: _subHoverStyle = prop.getThemeProperty(theme,
1332: Props.NAVBAR_SUB_HOVER_STYLE);
1333: _subHrefStyle = prop.getThemeProperty(theme,
1334: Props.NAVBAR_SUB_HREF_STYLE);
1335:
1336: _theme = theme;
1337: }
1338:
1339: /**
1340: * Set Title of a Group Item
1341: *
1342: * @param groupIndex is the group index of the entry to change the caption of.
1343: * @param itemIndex is the item index of the entry to change the caption of.
1344: * @param title is the new caption for the item.
1345: */
1346: public void setTitle(int groupIndex, int itemIndex, String title) {
1347: try {
1348: Group group = (Group) _groups.elementAt(groupIndex - 1);
1349: Item item = (Item) group._items.elementAt(itemIndex - 1);
1350: item._title = title;
1351:
1352: // createTable();
1353: } catch (Exception e) {
1354: e.printStackTrace();
1355: }
1356:
1357: /* String sItemKey=_groupname+".Group"+groupIndex+".Item"+itemIndex;
1358: HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
1359: Enumeration enum=hc.getComponents();
1360: while(enum.hasMoreElements()) {
1361: HtmlComponent hcp=(HtmlComponent)enum.nextElement();
1362: if (hcp instanceof HtmlText) {
1363: HtmlText ht=(HtmlText)hcp;
1364: ht.setText(title);
1365: }
1366: if (hcp instanceof HtmlRaw) {
1367: HtmlRaw hr=(HtmlRaw)hcp;
1368: hr.setHtml(title);
1369: }
1370: if (hcp instanceof HtmlLink) {
1371: Enumeration linkEnum=((HtmlLink)hcp).getComponents();
1372: while(linkEnum.hasMoreElements()) {
1373: HtmlComponent hcpLink=(HtmlComponent)enum.nextElement();
1374: if (hcpLink instanceof HtmlText) {
1375: HtmlText ht=(HtmlText)hcp;
1376: ht.setText(title);
1377: }
1378: if (hcpLink instanceof HtmlRaw) {
1379: HtmlRaw hr=(HtmlRaw)hcp;
1380: hr.setHtml(title);
1381: }
1382: }
1383: }
1384: }*/
1385: }
1386:
1387: /**
1388: * Sets the vertical margin for the table.
1389: *
1390: * @param val DOCUMENT ME!
1391: */
1392: public void setVSpace(int val) {
1393: _vSpace = val;
1394: }
1395:
1396: /**
1397: * This method gets the minimum height of the table in pixels.
1398: *
1399: * @param val DOCUMENT ME!
1400: */
1401: public void setVSpaceImage(String val) {
1402: _vSpaceImage = translateSiteMapURL(val);
1403: }
1404:
1405: /**
1406: * Set Group Item Visibility
1407: *
1408: * @param groupIndex is the group index of the entry to hide/show.
1409: * @param itemIndex is the item index of the entry to hide/show.
1410: * @param visible is to indicate whether the item should be shown or not.
1411: */
1412: public void setVisible(int groupIndex, int itemIndex,
1413: boolean visible) {
1414: try {
1415: Group group = (Group) _groups.elementAt(groupIndex - 1);
1416: Item item = (Item) group._items.elementAt(itemIndex - 1);
1417: item._visible = visible;
1418:
1419: // createTable();
1420: } catch (Exception e) {
1421: e.printStackTrace();
1422: }
1423: }
1424:
1425: /**
1426: * Set Group visibilty
1427: *
1428: * @param groupIndex is the group index of the entry to hide/show.
1429: * @param visible is to indicate whether the item should be shown or not.
1430: */
1431: public void setVisible(int groupIndex, boolean visible) {
1432: try {
1433: Group group = (Group) _groups.elementAt(groupIndex - 1);
1434: group._visible = visible;
1435: } catch (Exception e) {
1436: e.printStackTrace();
1437: }
1438: }
1439:
1440: /**
1441: * Set Group Item visibility
1442: *
1443: * @param groupName is the group name of the entry to hide/show.
1444: * @param itemName is the item name of the entry to hide/show.
1445: * @param visible is to indicate whether the item should be shown or not.
1446: */
1447: public void setVisible(String groupName, String itemName,
1448: boolean visible) {
1449: try {
1450: for (int i = 0; i < _groups.size(); i++) {
1451: Group group = (Group) _groups.elementAt(i);
1452:
1453: if (group._name.equals(groupName)) {
1454: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
1455: .size(); j++) {
1456: Item item = ((Item) ((Group) _groups
1457: .elementAt(i))._items.elementAt(j));
1458:
1459: if (item._name.equals(itemName)) {
1460: item._visible = visible;
1461: }
1462: }
1463: }
1464: }
1465: } catch (Exception e) {
1466: e.printStackTrace();
1467: }
1468: }
1469:
1470: /**
1471: * Set Group visibility
1472: *
1473: * @param groupName is the group name of the entry to hide/show.
1474: * @param visible is to indicate whether the item should be shown or not.
1475: */
1476: public void setVisible(String groupName, boolean visible) {
1477: try {
1478: for (int i = 0; i < _groups.size(); i++) {
1479: Group group = (Group) _groups.elementAt(i);
1480:
1481: if (group._name.equals(groupName)) {
1482: group._visible = visible;
1483: }
1484: }
1485: } catch (Exception e) {
1486: e.printStackTrace();
1487: }
1488: }
1489:
1490: /**
1491: * Set Width
1492: *
1493: * @param val String
1494: */
1495: public void setWidth(String val) {
1496: _width = val;
1497:
1498: // _table.setWidth(width);
1499: }
1500:
1501: /**
1502: * Get Width
1503: *
1504: * @return width String
1505: */
1506: public String getWidth() {
1507: return _width;
1508: }
1509:
1510: /**
1511: * Add a NavBar Item to the specified group
1512: *
1513: * @param name java.lang.String - Internal Name of Item
1514: * @param group int - Index of Group to add Item
1515: * @param title java.lang.String - Text To be Displayed
1516: * @param href java.lang.String - Href
1517: * @param target java.lang.String - Target
1518: * @param horizPadding int - Horizontal Padding to Be added In front of Displayed Text
1519: * @param subMenu java.lang.String - Name of Submenu for the Item
1520: */
1521: public void addGroupItem(String name, int group, String title,
1522: String href, String target, int horizPadding, String subMenu) {
1523: this .addGroupItem(name, group, title, href, target,
1524: horizPadding, null, subMenu, true);
1525:
1526: return;
1527: }
1528:
1529: /**
1530: * Add a NavBar Item to the specified group
1531: *
1532: * @param name java.lang.String - Internal Name of Item
1533: * @param group int - Index of Group to add Item
1534: * @param title java.lang.String - Text To be Displayed
1535: * @param href java.lang.String - Href
1536: * @param target java.lang.String - Target
1537: * @param horizPadding int - Horizontal Padding to Be added In front of Displayed Text
1538: * @param bgColor java.lang.String - Background Color of Item . Will override default
1539: * @param subMenu java.lang.String - Name of Submenu for the Item
1540: * @param showPopup boolean - Should Popup SubMenu Be shown inside the Navbar or Popup when Mouse Over
1541: */
1542: public void addGroupItem(String name, int group, String title,
1543: String href, String target, int horizPadding,
1544: String bgColor, String subMenu, boolean showPopup) {
1545: try {
1546: Item item = new Item();
1547: item._name = name;
1548: item._title = title;
1549: item._horizPadding = horizPadding;
1550: item._href = href;
1551: item._target = target;
1552: item._itemBgcolor = bgColor;
1553: item._submenu = subMenu;
1554: item._showPopup = showPopup;
1555: setLastSubMenuAdded(subMenu);
1556:
1557: ((Group) _groups.elementAt(group - 1))._items
1558: .addElement(item);
1559: } catch (Exception e) {
1560: }
1561:
1562: return;
1563: }
1564:
1565: /**
1566: * Add a NavBar Item to the last group Added
1567: *
1568: * @param name java.lang.String - Internal Name of Item
1569: * @param title java.lang.String - Text To be Displayed
1570: * @param href java.lang.String - Href
1571: */
1572: public void addGroupItem(String name, String title, String href) {
1573: this .addGroupItem(name, title, href, null, 0);
1574: }
1575:
1576: /**
1577: * Add a NavBar Item to the last group Added
1578: *
1579: * @param name java.lang.String - Internal Name of Item
1580: * @param title java.lang.String - Text To be Displayed
1581: * @param href DOCUMENT ME!
1582: * @param horizPadding int - Horizontal Padding to Be added In front of Displayed Text
1583: */
1584: public void addGroupItem(String name, String title, String href,
1585: int horizPadding) {
1586: this .addGroupItem(name, title, href, null, horizPadding);
1587: }
1588:
1589: /**
1590: * Add a NavBar Item to the last group Added
1591: *
1592: * @param name java.lang.String - Internal Name of Item
1593: * @param title java.lang.String - Text To be Displayed
1594: * @param href java.lang.String - Href
1595: * @param target java.lang.String - Target
1596: * @param horizPadding int - Horizontal Padding to Be added In front of Displayed Text
1597: */
1598: public void addGroupItem(String name, String title, String href,
1599: String target, int horizPadding) {
1600: this .addGroupItem(name, getLastGroupAdded(), title, href,
1601: target, horizPadding, null, null, true);
1602:
1603: return;
1604: }
1605:
1606: /**
1607: * Add Sub Item to a navBar Item
1608: *
1609: * @param name DOCUMENT ME!
1610: * @param title DOCUMENT ME!
1611: * @param href DOCUMENT ME!
1612: * @param target DOCUMENT ME!
1613: * @param horizPadding DOCUMENT ME!
1614: * @param subMenu DOCUMENT ME!
1615: * @param subMenuGroup DOCUMENT ME!
1616: */
1617: public void addSubItem(String name, String title, String href,
1618: String target, int horizPadding, String subMenu,
1619: String subMenuGroup) {
1620: this .addSubItem(name, title, href, target, horizPadding,
1621: subMenu, subMenuGroup, null);
1622:
1623: return;
1624: }
1625:
1626: /**
1627: * Add subItem to a navbar item
1628: *
1629: * @param name DOCUMENT ME!
1630: * @param title DOCUMENT ME!
1631: * @param href DOCUMENT ME!
1632: * @param target DOCUMENT ME!
1633: * @param horizPadding DOCUMENT ME!
1634: * @param subMenu DOCUMENT ME!
1635: * @param subMenuGroup DOCUMENT ME!
1636: * @param bgColor DOCUMENT ME!
1637: */
1638: public void addSubItem(String name, String title, String href,
1639: String target, int horizPadding, String subMenu,
1640: String subMenuGroup, String bgColor) {
1641: try {
1642: //Check what was passed. If null make the correct adjustments to the Sub Menu and Sub Menu Group
1643: String _Menu = "";
1644: String _MenuGroup = "";
1645:
1646: if (subMenu != null) {
1647: if (subMenuGroup != null) {
1648: _Menu = subMenu;
1649: _MenuGroup = subMenuGroup;
1650: } else {
1651: _Menu = subMenu;
1652: _MenuGroup = getLastSubMenuAdded();
1653: }
1654: } else if (subMenuGroup != null) {
1655: _Menu = subMenuGroup;
1656: _MenuGroup = subMenuGroup;
1657: } else {
1658: _Menu = getLastSubMenuAdded();
1659: _MenuGroup = getLastSubMenuAdded();
1660: }
1661:
1662: //Add SubItem
1663: SubItem subItem = new SubItem();
1664: subItem._name = name;
1665: subItem._title = title;
1666: subItem._horizPadding = horizPadding;
1667: subItem._href = href;
1668: subItem._target = target;
1669: subItem._subItemBgColor = bgColor;
1670: subItem._subMenu = _Menu;
1671: subItem._subMenuGroup = _MenuGroup;
1672: _subItems.addElement(subItem);
1673: } catch (Exception e) {
1674: }
1675:
1676: return;
1677: }
1678:
1679: /**
1680: * This method clears all the selected groups.
1681: */
1682: public void clearSelectedGroups() {
1683: for (int i = 0; i < _groups.size(); i++) {
1684: ((Group) _groups.elementAt(i))._selected = false;
1685: }
1686: }
1687:
1688: /**
1689: * This method clears the selected menu item.
1690: */
1691: public void clearSelectedItem() {
1692: for (int i = 0; i < _groups.size(); i++) {
1693: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
1694: .size(); j++) {
1695: ((Item) ((Group) _groups.elementAt(i))._items
1696: .elementAt(j))._selected = false;
1697: }
1698: }
1699: }
1700:
1701: /**
1702: * This method clears the selected menu item.
1703: */
1704: public void clearSelectedSubItem() {
1705: for (int i = 0; i < _subItems.size(); i++) {
1706: SubItem subItem = (SubItem) _subItems.elementAt(i);
1707: subItem._selected = false;
1708: }
1709: }
1710:
1711: /**
1712: * Collapse all group items in the Navbar
1713: */
1714: public void contractAllGroups() {
1715: try {
1716: for (int i = 0; i < _groups.size(); i++) {
1717: Group group = (Group) _groups.elementAt(i);
1718:
1719: for (int j = 0; j < group._items.size(); j++) {
1720: Item item = ((Item) group._items.elementAt(j));
1721: item._visible = false;
1722:
1723: String subMenu = item._submenu;
1724:
1725: if (subMenu != null) {
1726: setSubMenuVisible(subMenu, false);
1727: }
1728: }
1729:
1730: group._expanded = false;
1731: }
1732: } catch (Exception e) {
1733: com.salmonllc.util.MessageLog.writeErrorMessage(
1734: "ERROR:Contract All Groups", e, this );
1735: e.printStackTrace();
1736: }
1737: }
1738:
1739: /**
1740: * Collapse Group specified
1741: *
1742: * @param groupIdx is the group index of the entry to hide/show.
1743: */
1744: public void contractGroup(int groupIdx) {
1745: try {
1746: Group group = (Group) _groups.elementAt(groupIdx);
1747:
1748: for (int j = 0; j < group._items.size(); j++) {
1749: Item item = ((Item) group._items.elementAt(j));
1750: item._visible = false;
1751:
1752: String subMenu = item._submenu;
1753:
1754: if (subMenu != null) {
1755: setSubMenuVisible(subMenu, false);
1756: }
1757: }
1758:
1759: group._expanded = false;
1760: } catch (Exception e) {
1761: e.printStackTrace();
1762: }
1763: }
1764:
1765: /**
1766: * Collapse Group specified by groupName
1767: *
1768: * @param groupName is the group name of the entry to hide/show.
1769: */
1770: public void contractGroup(String groupName) {
1771: try {
1772: for (int i = 0; i < _groups.size(); i++) {
1773: Group group = (Group) _groups.elementAt(i);
1774:
1775: if (group._name.equals(groupName)) {
1776: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
1777: .size(); j++) {
1778: Item item = ((Item) ((Group) _groups
1779: .elementAt(i))._items.elementAt(j));
1780: item._visible = false;
1781:
1782: String subMenu = item._submenu;
1783:
1784: if (subMenu != null) {
1785: setSubMenuVisible(subMenu, false);
1786: }
1787: }
1788:
1789: group._expanded = false;
1790: }
1791: }
1792: } catch (Exception e) {
1793: e.printStackTrace();
1794: }
1795: }
1796:
1797: /**
1798: * Create a Group Item
1799: *
1800: * @param name java.lang.String
1801: * @param image DOCUMENT ME!
1802: * @param href DOCUMENT ME!
1803: * @param groupTitle DOCUMENT ME!
1804: * @param vertPadding DOCUMENT ME!
1805: */
1806: public void createGroup(String name, String image, String href,
1807: String groupTitle, int vertPadding) {
1808: this .createGroup(name, image, href, groupTitle, vertPadding,
1809: null, null, null);
1810:
1811: return;
1812: }
1813:
1814: /**
1815: * DOCUMENT ME!
1816: *
1817: * @param name DOCUMENT ME!
1818: * @param image DOCUMENT ME!
1819: * @param href DOCUMENT ME!
1820: * @param groupTitle DOCUMENT ME!
1821: * @param vertPadding DOCUMENT ME!
1822: * @param bgColor DOCUMENT ME!
1823: */
1824: public void createGroup(String name, String image, String href,
1825: String groupTitle, int vertPadding, String bgColor) {
1826: this .createGroup(name, image, href, groupTitle, vertPadding,
1827: bgColor, null, null);
1828:
1829: return;
1830: }
1831:
1832: /**
1833: * Create a Group Item
1834: *
1835: * @param name java.lang.String
1836: * @param image DOCUMENT ME!
1837: * @param href DOCUMENT ME!
1838: * @param groupTitle DOCUMENT ME!
1839: * @param vertPadding DOCUMENT ME!
1840: * @param bgColor DOCUMENT ME!
1841: * @param groupHrefStyle The overriding Group Href Style
1842: * @param groupHoverStyle The overriding Group Hover Style
1843: */
1844: public void createGroup(String name, String image, String href,
1845: String groupTitle, int vertPadding, String bgColor,
1846: String groupHrefStyle, String groupHoverStyle) {
1847: try {
1848: Group group = new Group();
1849: group._name = name;
1850: group._image = image;
1851: group._groupTitle = groupTitle;
1852: group._vertPadding = vertPadding;
1853: group._href = href;
1854: group._bgColor = bgColor;
1855: group._groupHrefStyle = groupHrefStyle;
1856: group._groupHoverStyle = groupHoverStyle;
1857: _groups.addElement(group);
1858: group._items = new Vector();
1859: setLastGroupAdded(_groups.indexOf(group) + 1);
1860: } catch (Exception e) {
1861: }
1862:
1863: return;
1864: }
1865:
1866: /**
1867: * Expand all Group Items
1868: */
1869: public void expandAllGroups() {
1870: try {
1871: for (int i = 0; i < _groups.size(); i++) {
1872: Group group = (Group) _groups.elementAt(i);
1873:
1874: for (int j = 0; j < group._items.size(); j++) {
1875: Item item = ((Item) group._items.elementAt(j));
1876: item._visible = true;
1877:
1878: String subMenu = item._submenu;
1879:
1880: if (subMenu != null) {
1881: setSubMenuVisible(subMenu, true);
1882: }
1883: }
1884:
1885: group._expanded = true;
1886: }
1887: } catch (Exception e) {
1888: com.salmonllc.util.MessageLog.writeErrorMessage(
1889: "ERROR:Expand All Groups", e, this );
1890: e.printStackTrace();
1891: }
1892: }
1893:
1894: /**
1895: * Expand Group item by group Index
1896: *
1897: * @param groupIdx is the group index of the entry to hide/show.
1898: */
1899: public void expandGroup(int groupIdx) {
1900: try {
1901: Group group = (Group) _groups.elementAt(groupIdx);
1902:
1903: for (int j = 0; j < group._items.size(); j++) {
1904: Item item = ((Item) group._items.elementAt(j));
1905: item._visible = true;
1906:
1907: String subMenu = item._submenu;
1908:
1909: if (subMenu != null) {
1910: setSubMenuVisible(subMenu, true);
1911: }
1912: }
1913:
1914: group._expanded = true;
1915: } catch (Exception e) {
1916: e.printStackTrace();
1917: }
1918: }
1919:
1920: /**
1921: * Expand Group item by name
1922: *
1923: * @param groupName is the group name of the entry to hide/show.
1924: */
1925: public void expandGroup(String groupName) {
1926: try {
1927: for (int i = 0; i < _groups.size(); i++) {
1928: Group group = (Group) _groups.elementAt(i);
1929:
1930: if (group._name.equals(groupName)) {
1931: for (int j = 0; j < ((Group) _groups.elementAt(i))._items
1932: .size(); j++) {
1933: Item item = ((Item) ((Group) _groups
1934: .elementAt(i))._items.elementAt(j));
1935: item._visible = true;
1936:
1937: String subMenu = item._submenu;
1938:
1939: if (subMenu != null) {
1940: setSubMenuVisible(subMenu, true);
1941: }
1942: }
1943:
1944: group._expanded = true;
1945: }
1946: }
1947: } catch (Exception e) {
1948: e.printStackTrace();
1949: }
1950: }
1951:
1952: /**
1953: * Generates the Html for the component. This method is called by the framework and should not be called directly
1954: *
1955: * @param p DOCUMENT ME!
1956: *
1957: * @throws java.io.IOException DOCUMENT ME!
1958: */
1959: public void generateHTML(TagWriter p) throws java.io.IOException {
1960: synchronized (this ) {
1961: _dreamMode = p.getDreamWeaverConv();
1962: _vPopups = null;
1963:
1964: //Generate Styles used in the navbar
1965: // hrefStyle "Style of the Href Text when not Hovering"
1966: // hoverStyle "Style of the Hover Text while Hovering"
1967: // groupHrefStyle "Style of the Group Href Text when not Hovering"
1968: // groupHoverStyle "Style of the Group Hover Text while Hovering"
1969: // textStyle "Style of text if not an href"
1970: // selectedStyle "Style of href when selected"
1971: // selectedHoverStyle "Style of selected href while hovering"
1972: // groupCellBgColor "BackGround Color of Group Cell when not Hovering"
1973: // grouphoverBgColor "BackGround color of Group cell while hovering"
1974: // cellBgColor "BackGround Color of Cell when not Hovering"
1975: // hoverBgColor "BackGround color of cell while hovering"
1976: // selectedBgColor "bg color of selected href"
1977: // selectedHoverBgColor "bg color of selected href while hovering"
1978: if (isNetscape4()) {
1979: _sPctSign = "pct";
1980: }
1981:
1982: p.println("<STYLE>");
1983:
1984: String anchorPrefix = getAnchorPrefixCss();
1985:
1986: if (!isNullOrEmty(_hrefStyle)) {
1987: p.println(anchorPrefix + getName() + HREFSTYLE + "{"
1988: + _hrefStyle + "}");
1989: p.println(anchorPrefix + getName() + HREFSTYLE
1990: + ":hover" + "{" + _hrefStyle + "}");
1991: p.println(anchorPrefix + getName() + HREFSTYLE
1992: + ":visited" + "{" + _hrefStyle + "}");
1993: p.println(anchorPrefix + getName() + HREFSTYLE
1994: + ":active" + "{" + _hrefStyle + "}");
1995: } else {
1996: p.println(anchorPrefix + getName() + HREFSTYLE + "{ }");
1997: }
1998:
1999: if (!isNullOrEmty(_hoverStyle)) {
2000: p.println(anchorPrefix + getName() + HOVERSTYLE + "{"
2001: + _hoverStyle + "}");
2002: p.println(anchorPrefix + getName() + HOVERSTYLE
2003: + ":hover" + "{" + _hoverStyle + "}");
2004: p.println(anchorPrefix + getName() + HOVERSTYLE
2005: + ":visited" + "{" + _hoverStyle + "}");
2006: p.println(anchorPrefix + getName() + HOVERSTYLE
2007: + ":active" + "{" + _hoverStyle + "}");
2008: } else {
2009: p
2010: .println(anchorPrefix + getName() + HOVERSTYLE
2011: + "{ }");
2012: }
2013:
2014: if (!isNullOrEmty(_textStyle)) {
2015: p.println("." + getName() + TEXTSTYLE + "{"
2016: + _textStyle + "}");
2017: } else {
2018: p.println("." + getName() + TEXTSTYLE + "{ }");
2019: }
2020:
2021: if (!isNullOrEmty(_selectedStyle)) {
2022: p.println(anchorPrefix + getName() + SELECTEDSTYLE
2023: + "{" + _selectedStyle + "}");
2024: p.println(anchorPrefix + getName() + SELECTEDSTYLE
2025: + ":hover" + "{" + _selectedStyle + "}");
2026: p.println(anchorPrefix + getName() + SELECTEDSTYLE
2027: + ":visited" + "{" + _selectedStyle + "}");
2028: p.println(anchorPrefix + getName() + SELECTEDSTYLE
2029: + ":active" + "{" + _selectedStyle + "}");
2030: } else {
2031: p.println(anchorPrefix + getName() + SELECTEDSTYLE
2032: + "{ }");
2033: }
2034:
2035: if (!isNullOrEmty(_selectedHoverStyle)) {
2036: p.println(anchorPrefix + getName() + SELECTEDHOVERSTYLE
2037: + "{" + _selectedHoverStyle + "}");
2038: p.println(anchorPrefix + getName() + SELECTEDHOVERSTYLE
2039: + ":hover" + "{" + _selectedHoverStyle + "}");
2040: p.println(anchorPrefix + getName() + SELECTEDHOVERSTYLE
2041: + ":visited" + "{" + _selectedHoverStyle + "}");
2042: p.println(anchorPrefix + getName() + SELECTEDHOVERSTYLE
2043: + ":active" + "{" + _selectedHoverStyle + "}");
2044: } else {
2045: p.println(anchorPrefix + getName() + SELECTEDHOVERSTYLE
2046: + "{ }");
2047: }
2048:
2049: if (!isNullOrEmty(_showPopupStyle)) {
2050: p.println(anchorPrefix + getName() + SHOWPOPUPSTYLE
2051: + "{" + _showPopupStyle + "}");
2052: p.println(anchorPrefix + getName() + SHOWPOPUPSTYLE
2053: + ":hover" + "{" + _showPopupStyle + "}");
2054: p.println(anchorPrefix + getName() + SHOWPOPUPSTYLE
2055: + ":visited" + "{" + _showPopupStyle + "}");
2056: p.println(anchorPrefix + getName() + SHOWPOPUPSTYLE
2057: + ":active" + "{" + _showPopupStyle + "}");
2058: } else {
2059: p.println(anchorPrefix + getName() + SHOWPOPUPSTYLE
2060: + "{ }");
2061: }
2062:
2063: if (!isNullOrEmty(_showPopupHoverStyle)) {
2064: p.println(anchorPrefix + getName()
2065: + SHOWPOPUPHOVERSTYLE + "{"
2066: + _showPopupHoverStyle + "}");
2067: p.println(anchorPrefix + getName()
2068: + SHOWPOPUPHOVERSTYLE + ":hover" + "{"
2069: + _showPopupHoverStyle + "}");
2070: p.println(anchorPrefix + getName()
2071: + SHOWPOPUPHOVERSTYLE + ":visited" + "{"
2072: + _showPopupHoverStyle + "}");
2073: p.println(anchorPrefix + getName()
2074: + SHOWPOPUPHOVERSTYLE + ":active" + "{"
2075: + _showPopupHoverStyle + "}");
2076: } else {
2077: p.println(anchorPrefix + getName()
2078: + SHOWPOPUPHOVERSTYLE + "{ }");
2079: }
2080:
2081: if (!isNullOrEmty(_showPopupSelectedStyle)) {
2082: p.println(anchorPrefix + getName()
2083: + SHOWPOPUPSELECTEDSTYLE + "{"
2084: + _showPopupSelectedStyle + "}");
2085: p.println(anchorPrefix + getName()
2086: + SHOWPOPUPSELECTEDSTYLE + ":hover" + "{"
2087: + _showPopupSelectedStyle + "}");
2088: p.println(anchorPrefix + getName()
2089: + SHOWPOPUPSELECTEDSTYLE + ":visited" + "{"
2090: + _showPopupSelectedStyle + "}");
2091: p.println(anchorPrefix + getName()
2092: + SHOWPOPUPSELECTEDSTYLE + ":active" + "{"
2093: + _showPopupSelectedStyle + "}");
2094: } else {
2095: p.println(anchorPrefix + getName()
2096: + SHOWPOPUPSELECTEDSTYLE + "{ }");
2097: }
2098:
2099: if (!isNullOrEmty(_showPopupSelectedHoverStyle)) {
2100: p.println(anchorPrefix + getName()
2101: + SHOWPOPUPSELECTEDHOVERSTYLE + "{"
2102: + _showPopupSelectedStyle + "}");
2103: p.println(anchorPrefix + getName()
2104: + SHOWPOPUPSELECTEDHOVERSTYLE + ":hover" + "{"
2105: + _showPopupSelectedStyle + "}");
2106: p.println(anchorPrefix + getName()
2107: + SHOWPOPUPSELECTEDHOVERSTYLE + ":visited"
2108: + "{" + _showPopupSelectedStyle + "}");
2109: p.println(anchorPrefix + getName()
2110: + SHOWPOPUPSELECTEDHOVERSTYLE + ":active" + "{"
2111: + _showPopupSelectedStyle + "}");
2112: } else {
2113: p.println(anchorPrefix + getName()
2114: + SHOWPOPUPSELECTEDHOVERSTYLE + "{ }");
2115: }
2116:
2117: if (!isNullOrEmty(_cellBgColor)) {
2118: p.println("TD." + getName() + CELLBGSTYLE
2119: + "{BACKGROUND:" + _cellBgColor + "}");
2120: } else {
2121: p.println("TD." + getName() + CELLBGSTYLE + "{ }");
2122: }
2123:
2124: if (!isNullOrEmty(_hoverBgColor)) {
2125: p.println("TD." + getName() + CELLHOVERBGSTYLE
2126: + "{BACKGROUND:" + _hoverBgColor + "}");
2127: } else {
2128: p.println("TD." + getName() + CELLHOVERBGSTYLE + "{ }");
2129: }
2130:
2131: if (!isNullOrEmty(_selectedBgColor)) {
2132: p.println("TD." + getName() + SELECTEDBGSTYLE
2133: + "{BACKGROUND:" + _selectedBgColor + "}");
2134: } else {
2135: p.println("TD." + getName() + SELECTEDBGSTYLE + "{ }");
2136: }
2137:
2138: if (!isNullOrEmty(_selectedHoverBgColor)) {
2139: p.println("TD." + getName() + SELECTEDHOVERBGSTYLE
2140: + "{BACKGROUND:" + _selectedHoverBgColor + "}");
2141: } else {
2142: p.println("TD." + getName() + SELECTEDHOVERBGSTYLE
2143: + "{ }");
2144: }
2145:
2146: if (!isNullOrEmty(_showPopupBgColor)) {
2147: p.println("TD." + getName() + SHOWPOPUPBGSTYLE
2148: + "{BACKGROUND:" + _showPopupBgColor + "}");
2149: } else {
2150: p.println("TD." + getName() + SHOWPOPUPBGSTYLE + "{}");
2151: }
2152:
2153: if (!isNullOrEmty(_groupHrefStyle)) {
2154: p.println(anchorPrefix + getName() + GROUPHREFSTYLE
2155: + "{" + _groupHrefStyle + "}");
2156: p.println(anchorPrefix + getName() + GROUPHREFSTYLE
2157: + ":hover" + "{" + _groupHrefStyle + "}");
2158: p.println(anchorPrefix + getName() + GROUPHREFSTYLE
2159: + ":visited" + "{" + _groupHrefStyle + "}");
2160: p.println(anchorPrefix + getName() + GROUPHREFSTYLE
2161: + ":active" + "{" + _groupHrefStyle + "}");
2162: } else {
2163: p.println(anchorPrefix + getName() + GROUPHREFSTYLE
2164: + "{}");
2165: }
2166:
2167: if (!isNullOrEmty(_groupHoverStyle)) {
2168: p.println(anchorPrefix + getName() + GROUPHOVERSTYLE
2169: + "{" + _groupHoverStyle + "}");
2170: p.println(anchorPrefix + getName() + GROUPHOVERSTYLE
2171: + ":hover" + "{" + _groupHoverStyle + "}");
2172: p.println(anchorPrefix + getName() + GROUPHOVERSTYLE
2173: + ":visited" + "{" + _groupHoverStyle + "}");
2174: p.println(anchorPrefix + getName() + GROUPHOVERSTYLE
2175: + ":active" + "{" + _groupHoverStyle + "}");
2176: } else {
2177: p.println(anchorPrefix + getName() + GROUPHOVERSTYLE
2178: + "{}");
2179: }
2180:
2181: if (!isNullOrEmty(_groupCellBgColor)) {
2182: p.println("TD." + getName() + GROUPCELLBGSTYLE
2183: + "{BACKGROUND:" + _groupCellBgColor + "}");
2184: } else {
2185: p.println("TD." + getName() + GROUPCELLBGSTYLE + "{}");
2186: }
2187:
2188: if (!isNullOrEmty(_groupHoverBgColor)) {
2189: p.println("TD." + getName() + GROUPHOVERBGSTYLE
2190: + "{BACKGROUND:" + _groupHoverBgColor + "}");
2191: } else {
2192: p.println("TD." + getName() + GROUPHOVERBGSTYLE + "{}");
2193: }
2194:
2195: if (!isNullOrEmty(_subHrefStyle)) {
2196: p.println(anchorPrefix + getName() + SUBHREFSTYLE + "{"
2197: + _subHrefStyle + "}");
2198: p.println(anchorPrefix + getName() + SUBHREFSTYLE
2199: + ":hover" + "{" + _subHrefStyle + "}");
2200: p.println(anchorPrefix + getName() + SUBHREFSTYLE
2201: + ":visited" + "{" + _subHrefStyle + "}");
2202: p.println(anchorPrefix + getName() + SUBHREFSTYLE
2203: + ":active" + "{" + _subHrefStyle + "}");
2204: } else {
2205: p.println(anchorPrefix + getName() + SUBHREFSTYLE
2206: + "{ }");
2207: }
2208:
2209: if (!isNullOrEmty(_subHoverStyle)) {
2210: p.println(anchorPrefix + getName() + SUBHOVERSTYLE
2211: + "{" + _subHoverStyle + "}");
2212: p.println(anchorPrefix + getName() + SUBHOVERSTYLE
2213: + ":hover" + "{" + _subHoverStyle + "}");
2214: p.println(anchorPrefix + getName() + SUBHOVERSTYLE
2215: + ":visited" + "{" + _subHoverStyle + "}");
2216: p.println(anchorPrefix + getName() + SUBHOVERSTYLE
2217: + ":active" + "{" + _subHoverStyle + "}");
2218: } else {
2219: p.println(anchorPrefix + getName() + SUBHOVERSTYLE
2220: + "{ }");
2221: }
2222:
2223: if (!isNullOrEmty(_subMenuBgColor)) {
2224: p.println("TD." + getName() + SUBCELLBGSTYLE
2225: + "{BACKGROUND:" + _subMenuBgColor + "}");
2226: } else {
2227: p.println("TD." + getName() + SUBCELLBGSTYLE + "{ }");
2228: }
2229:
2230: /*
2231: if(!isNullOrEmty(_subHoverBgColor))
2232: p.println("<STYLE>TD." + getName() + SUBCELLHOVERBGSTYLE + "{BACKGROUND:" + _subHoverBgColor + "}</STYLE>");
2233: else
2234: p.println("<STYLE>TD." + getName() + SUBCELLHOVERBGSTYLE + "{ }</STYLE>");
2235: */
2236: if (!isNullOrEmty(_subHoverBgColor)) {
2237: p.println("TD." + getName() + SUBCELLHOVERBGSTYLE
2238: + "{BACKGROUND:" + _subHoverBgColor + "}");
2239: } else {
2240: p.println("TD." + getName() + SUBCELLHOVERBGSTYLE
2241: + "{ }");
2242: }
2243:
2244: p.println("</STYLE>");
2245:
2246: //
2247: //Generate function scripts for loading images
2248: p.println("<SCRIPT LANGUAGE=JavaScript1.2>");
2249: p.println(getLoadFunctionScript());
2250: p.println(getImagesScript());
2251: p.println("</SCRIPT>");
2252: p.println();
2253:
2254: p.println("<!-- //Generate Table to be displayed -->");
2255: p.print("<TABLE");
2256:
2257: if (_border != -1) {
2258: p.print(" BORDER=\"" + _border + "\"");
2259: }
2260:
2261: if (_cellPadding != -1) {
2262: p.print(" CELLPADDING=\"" + _cellPadding + "\"");
2263: }
2264:
2265: if (_cellSpacing != -1) {
2266: p.print(" CELLSPACING=\"" + _cellSpacing + "\"");
2267: }
2268:
2269: if (_bgColor != null) {
2270: p.print(" BGCOLOR=\"" + _bgColor + "\"");
2271: }
2272:
2273: if (_height != null) {
2274: p.print(" HEIGHT=\"" + _height + "\"");
2275: }
2276:
2277: if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) {
2278: if (_width != null) {
2279: int tempWidth = 0;
2280:
2281: try {
2282: tempWidth = Integer.parseInt(_width);
2283: } catch (Exception e) {
2284: _navWidthPercent = _width;
2285: }
2286:
2287: _navWidth = tempWidth + _cellPadding;
2288:
2289: if (_navWidthPercent != null) {
2290: p.print(" WIDTH=\"" + _navWidthPercent + "\"");
2291: } else {
2292: p.print(" WIDTH=\"" + _navWidth + "\"");
2293: }
2294: }
2295: } else if (_width != null) {
2296: p.print(" WIDTH=\"" + _width + "\"");
2297: }
2298:
2299: if (_align != null) {
2300: p.print(" ALIGN=\"" + _align + "\"");
2301: }
2302:
2303: if (_cols != -1) {
2304: p.print(" COLS=\"" + _cols + "\"");
2305: }
2306:
2307: if (_hSpace != -1) {
2308: p.print(" HSPACE=\"" + _hSpace + "\"");
2309: }
2310:
2311: if (_vSpace != -1) {
2312: p.print(" VSPACE=\"" + _vSpace + "\"");
2313: }
2314:
2315: p.print(">");
2316:
2317: //p.println();
2318: String sGroupDividerStart = "<TR>";
2319: String sGroupDividerEnd = "</TR>";
2320:
2321: if (isHorizontalMode()) {
2322: sGroupDividerStart = "";
2323: sGroupDividerEnd = "";
2324: p.print("<TR>");
2325: p.println();
2326: }
2327:
2328: //Generate tr and td lines for all navbar groups and the related items
2329: //check to see if there is a forced setSelected
2330: _oneSelected = oneSelected();
2331:
2332: for (int i = 1; i <= _groups.size(); i++) {
2333: if (((Group) _groups.elementAt(i - 1))._visible == false) {
2334: continue;
2335: }
2336:
2337: //Load Vertical Space Image
2338: if ((_vSpaceImage != null)
2339: && (!_vSpaceImage.equals(""))) {
2340: p.print(sGroupDividerStart);
2341: p.println();
2342: p.print("<TD><IMG SRC =\"" + _vSpaceImage + "\"");
2343: p.print(" BORDER=0");
2344: p
2345: .print(" VSPACE="
2346: + ((Group) _groups.elementAt(i - 1))._vertPadding);
2347: p.print("></TD>");
2348: p.println();
2349: p.print(sGroupDividerEnd);
2350: }
2351:
2352: //Group header image
2353: String sGroupName = ((Group) _groups.elementAt(i - 1))._name;
2354: String sGroupHref = ((Group) _groups.elementAt(i - 1))._href;
2355: String sGroupImage = ((Group) _groups.elementAt(i - 1))._image;
2356: String sGroupTitle = ((Group) _groups.elementAt(i - 1))._groupTitle;
2357: String sGroupBgColor = ((Group) _groups
2358: .elementAt(i - 1))._bgColor;
2359: int sGroupVpadding = ((Group) _groups.elementAt(i - 1))._vertPadding;
2360: boolean bGroupSelected = ((Group) _groups
2361: .elementAt(i - 1))._selected;
2362:
2363: /** Saqib Chowdhry Jul 30, 2003 (12:09:54 PM) */
2364: String sGroupHrefStyle = ((Group) _groups
2365: .elementAt(i - 1))._groupHrefStyle;
2366: String sGroupHoverStyle = ((Group) _groups
2367: .elementAt(i - 1))._groupHoverStyle;
2368:
2369: if ((Util.isFilled(sGroupHrefStyle) || (Util
2370: .isFilled(sGroupHoverStyle)))) {
2371: p.println("<STYLE>");
2372: }
2373:
2374: if (Util.isFilled(sGroupHrefStyle)) {
2375: p.println(anchorPrefix + getName()
2376: + CUSTOMGROUPHREFSTYLE + i + "{"
2377: + sGroupHrefStyle + "}");
2378: p.println(anchorPrefix + getName()
2379: + CUSTOMGROUPHREFSTYLE + i + ":hover" + "{"
2380: + sGroupHrefStyle + "}");
2381: p.println(anchorPrefix + getName()
2382: + CUSTOMGROUPHREFSTYLE + i + ":visited"
2383: + "{" + sGroupHrefStyle + "}");
2384: p.println(anchorPrefix + getName()
2385: + CUSTOMGROUPHREFSTYLE + i + ":active"
2386: + "{" + sGroupHrefStyle + "}");
2387: }
2388:
2389: if (Util.isFilled(sGroupHoverStyle)) {
2390: p.println(anchorPrefix + getName()
2391: + CUSTOMGROUPHOVERSTYLE + i + "{"
2392: + sGroupHoverStyle + "}");
2393: p.println(anchorPrefix + getName()
2394: + CUSTOMGROUPHOVERSTYLE + i + ":hover"
2395: + "{" + sGroupHoverStyle + "}");
2396: p.println(anchorPrefix + getName()
2397: + CUSTOMGROUPHOVERSTYLE + i + ":visited"
2398: + "{" + sGroupHoverStyle + "}");
2399: p.println(anchorPrefix + getName()
2400: + CUSTOMGROUPHOVERSTYLE + i + ":active"
2401: + "{" + sGroupHoverStyle + "}");
2402: }
2403:
2404: if ((Util.isFilled(sGroupHrefStyle) || (Util
2405: .isFilled(sGroupHoverStyle)))) {
2406: p.println("</STYLE>");
2407: }
2408:
2409: if (sGroupHref != null) {
2410: p.println();
2411: p.print(sGroupDividerStart);
2412: p.println();
2413:
2414: if ((sGroupTitle != null)
2415: && !sGroupTitle.equals("")) {
2416: // SC (10/10/02 3:23:51 PM)
2417: if (!sGroupHref.toUpperCase().startsWith(
2418: "JAVASCRIPT:")) {
2419: p.print("<TD ONCLICK=\"document.location='"
2420: + encodeURL(sGroupHref) + "';\"");
2421: } else {
2422: p.print("<TD ONCLICK=\"" + sGroupHref
2423: + "\"");
2424: }
2425:
2426: //If Browser Type is NETSCAPE OR MAC DO NOT CODE MOUSEOVER OR MOUSEOUT
2427: if (!((isNetscapeBelowV6()) || (getPage()
2428: .getBrowserOS() == HtmlPage.BROWSER_OS_MAC))) {
2429: //ONMOUSEOVER
2430: p.print(" ONMOUSEOVER=\"");
2431:
2432: if ((_groupHoverBgColor != null)
2433: && (!_groupHoverBgColor.equals(""))) {
2434: p.print("this.className='" + getName()
2435: + GROUPHOVERBGSTYLE + "';");
2436: } else if ((_hoverBgColor != null)
2437: && (!_hoverBgColor.equals(""))) {
2438: p.print("this.className='" + getName()
2439: + CELLHOVERBGSTYLE + "';");
2440: }
2441:
2442: /**
2443: * Saqib Chowdhry Jul 30, 2003 (12:09:54 PM)
2444: */
2445: if (Util.isFilled(sGroupHoverStyle)) {
2446: p.print("document.getElementById('"
2447: + sGroupName + getName() + "')"
2448: + ".className='" + getName()
2449: + CUSTOMGROUPHOVERSTYLE + i
2450: + "';");
2451: } else if ((_groupHoverStyle != null)
2452: && (!_groupHoverStyle.equals(""))) {
2453: p.print("document.getElementById('"
2454: + sGroupName + getName() + "')"
2455: + ".className='" + getName()
2456: + GROUPHOVERSTYLE + "';");
2457: } else {
2458: p.print("document.getElementById('"
2459: + sGroupName + getName() + "')"
2460: + ".className='" + getName()
2461: + HOVERSTYLE + "';");
2462: }
2463:
2464: p.print("\"");
2465:
2466: //ONMOUSEOUT
2467: p.print(" ONMOUSEOUT=\"");
2468:
2469: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
2470: if ((sGroupBgColor != null)
2471: && (!sGroupBgColor.equals(""))) {
2472: p
2473: .print("this.className='TD.{BACKGROUND:"
2474: + sGroupBgColor
2475: + ";}"
2476: + "';");
2477: } else if ((_groupHoverBgColor != null)
2478: && (!_groupHoverBgColor.equals(""))) {
2479: p.print("this.className='" + getName()
2480: + GROUPCELLBGSTYLE + "';");
2481: } else if ((_hoverBgColor != null)
2482: && (!_hoverBgColor.equals(""))) {
2483: p.print("this.className='" + getName()
2484: + CELLBGSTYLE + "';");
2485: }
2486:
2487: /**
2488: * Saqib Chowdhry Jul 30, 2003 (12:09:54 PM)
2489: */
2490: if (Util.isFilled(sGroupHoverStyle)) {
2491: if (bGroupSelected) {
2492: p.print("document.getElementById('"
2493: + sGroupName + getName()
2494: + "')" + ".className='"
2495: + getName()
2496: + CUSTOMGROUPHOVERSTYLE + i
2497: + "';");
2498: } else {
2499: p.print("document.getElementById('"
2500: + sGroupName + getName()
2501: + "').className='"
2502: + getName()
2503: + CUSTOMGROUPHREFSTYLE + i
2504: + "';");
2505: }
2506: } else if ((_groupHoverStyle != null)
2507: && (!_groupHoverStyle.equals(""))) {
2508: if (bGroupSelected) {
2509: p.print("document.getElementById('"
2510: + sGroupName + getName()
2511: + "')" + ".className='"
2512: + getName()
2513: + GROUPHOVERSTYLE + "';");
2514: } else {
2515: p.print("document.getElementById('"
2516: + sGroupName + getName()
2517: + "').className='"
2518: + getName()
2519: + GROUPHREFSTYLE + "';");
2520: }
2521: } else {
2522: p.print("document.getElementById('"
2523: + sGroupName + getName()
2524: + "').className='" + getName()
2525: + HREFSTYLE + "';");
2526: }
2527:
2528: p.print("\"");
2529: }
2530:
2531: //CLASS
2532: //IF A BG COLOR IS PASSED OVERIDE THE GROUP CELL BG COLOR
2533: if ((sGroupBgColor != null)
2534: && (!sGroupBgColor.equals(""))) {
2535: p.print(" BGCOLOR=\"" + sGroupBgColor
2536: + "\" NOWRAP");
2537: } else if ((_groupCellBgColor != null)
2538: && (!_groupCellBgColor.equals(""))) {
2539: p.print(" CLASS=\"" + getName()
2540: + GROUPCELLBGSTYLE + "\" NOWRAP");
2541: } else {
2542: p.print(" CLASS=\"" + getName()
2543: + CELLBGSTYLE + "\" NOWRAP");
2544: }
2545:
2546: p.print(">");
2547:
2548: //HREF
2549: p.print("<A NAME=\"" + sGroupName + getName()
2550: + "\" ID=\"" + sGroupName + getName()
2551: + "\" HREF=\"" + encodeURL(sGroupHref)
2552: + "\"");
2553:
2554: if (!((isNetscapeBelowV6()))) {
2555: p.print(" ONCLICK=\"return false;\"");
2556: }
2557:
2558: /**
2559: * Saqib Chowdhry Jul 30, 2003 (12:09:54 PM)
2560: */
2561: if (Util.isFilled(sGroupHoverStyle)) {
2562: if (bGroupSelected) {
2563: if (Util.isFilled(sGroupHoverStyle)) {
2564: p.print(" CLASS=\"" + getName()
2565: + CUSTOMGROUPHOVERSTYLE + i
2566: + "\"");
2567: }
2568: } else {
2569: if (Util.isFilled(sGroupHrefStyle)) {
2570: p.print(" CLASS=\"" + getName()
2571: + CUSTOMGROUPHREFSTYLE + i
2572: + "\"");
2573: }
2574: }
2575: } else if ((_groupHrefStyle != null)
2576: && (!_groupHrefStyle.equals(""))) {
2577: if (bGroupSelected) {
2578: p.print(" CLASS=\"" + getName()
2579: + GROUPHOVERSTYLE + "\"");
2580: } else {
2581: p.print(" CLASS=\"" + getName()
2582: + GROUPHREFSTYLE + "\"");
2583: }
2584: } else {
2585: p.print(" CLASS=\"" + getName() + HREFSTYLE
2586: + "\"");
2587: }
2588:
2589: p.print(">");
2590:
2591: // p.print("<font class=\""+getName() + GROUPHREFSTYLE+"\">");
2592: p.print(sGroupTitle);
2593:
2594: // p.print( "</font>");
2595: } else {
2596: p.print("<TD");
2597:
2598: if ((sGroupBgColor != null)
2599: && (!sGroupBgColor.equals(""))) {
2600: p.print(" BGCOLOR=\"" + sGroupBgColor
2601: + "\" NOWRAP");
2602: } else if ((_groupCellBgColor != null)
2603: && (!_groupCellBgColor.equals(""))) {
2604: p.print(" CLASS=\"" + getName()
2605: + GROUPCELLBGSTYLE + "\" NOWRAP");
2606: } else {
2607: p.print(" CLASS=\"" + getName()
2608: + CELLBGSTYLE + "\" NOWRAP");
2609: }
2610:
2611: p.print("><A NAME=\"" + sGroupName + getName()
2612: + "\" ID=\"" + sGroupName + getName()
2613: + "\" HREF=\"" + encodeURL(sGroupHref)
2614: + "\"");
2615: p.print(">");
2616: p.print("<IMG SRC =\"" + sGroupImage + "\"");
2617: p.print(" BORDER=0");
2618: p.print(" VSPACE=" + sGroupVpadding + ">");
2619: }
2620:
2621: p.print("</A></TD>");
2622: p.println();
2623: p.print(sGroupDividerEnd);
2624: } else {
2625: if ((sGroupTitle != null)
2626: && !sGroupTitle.equals("")) {
2627: p.print(sGroupDividerStart);
2628: p.print("<TD");
2629:
2630: //If Browser Type is NETSCAPE OR MAC DO NOT CODE MOUSEOVER OR MOUSEOUT
2631: if (!((isNetscapeBelowV6()) || (getPage()
2632: .getBrowserOS() == HtmlPage.BROWSER_OS_MAC))) {
2633: //ONMOUSEOVER
2634: p.print(" ONMOUSEOVER=\"");
2635:
2636: if ((_groupHoverBgColor != null)
2637: && (!_groupHoverBgColor.equals(""))) {
2638: p.print("this.className='" + getName()
2639: + GROUPHOVERBGSTYLE + "';");
2640: } else if ((_hoverBgColor != null)
2641: && (!_hoverBgColor.equals(""))) {
2642: p.print("this.className='" + getName()
2643: + CELLHOVERBGSTYLE + "';");
2644: }
2645:
2646: p.print("\"");
2647:
2648: //ONMOUSEOUT
2649: p.print(" ONMOUSEOUT=\"");
2650:
2651: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
2652: if ((sGroupBgColor != null)
2653: && (!sGroupBgColor.equals(""))) {
2654: p
2655: .print("this.className='TD.{BACKGROUND:"
2656: + sGroupBgColor
2657: + ";}"
2658: + "';");
2659: } else if ((_groupHoverBgColor != null)
2660: && (!_groupHoverBgColor.equals(""))) {
2661: p.print("this.className='" + getName()
2662: + GROUPCELLBGSTYLE + "';");
2663: } else if ((_hoverBgColor != null)
2664: && (!_hoverBgColor.equals(""))) {
2665: p.print("this.className='" + getName()
2666: + CELLBGSTYLE + "';");
2667: }
2668:
2669: p.print("\"");
2670: }
2671:
2672: //CLASS
2673: //IF A BG COLOR IS PASSED OVERIDE THE GROUP CELL BG COLOR
2674: if ((sGroupBgColor != null)
2675: && (!sGroupBgColor.equals(""))) {
2676: p.print(" BGCOLOR=\"" + sGroupBgColor
2677: + "\" NOWRAP");
2678: } else if ((_groupCellBgColor != null)
2679: && (!_groupCellBgColor.equals(""))) {
2680: p.print(" CLASS=\"" + getName()
2681: + GROUPCELLBGSTYLE + "\" NOWRAP");
2682: } else {
2683: p.print(" CLASS=\"" + getName()
2684: + CELLBGSTYLE + "\" NOWRAP");
2685: }
2686:
2687: p.print(">");
2688: p.print("<SPAN CLASS=\"" + getName()
2689: + TEXTSTYLE + "\"");
2690: p.print(">");
2691: p.print(sGroupTitle);
2692: p.print("</SPAN>");
2693: p.print("</TD>");
2694: p.print(sGroupDividerEnd);
2695: } else if (sGroupImage != null) {
2696: p.print(sGroupDividerStart);
2697: p.print("<TD");
2698:
2699: if ((sGroupBgColor != null)
2700: && (!sGroupBgColor.equals(""))) {
2701: p.print(" BGCOLOR=\"" + sGroupBgColor
2702: + "\" NOWRAP");
2703: } else if ((_groupCellBgColor != null)
2704: && (!_groupCellBgColor.equals(""))) {
2705: p.print(" CLASS=\"" + getName()
2706: + GROUPCELLBGSTYLE + "\" NOWRAP");
2707: } else {
2708: p.print(" CLASS=\"" + getName()
2709: + CELLBGSTYLE + "\" NOWRAP");
2710: }
2711:
2712: p.print("><IMG SRC =\"" + sGroupImage + "\"");
2713: p.print(" BORDER=0");
2714: p.print(" VSPACE=" + sGroupVpadding + ">");
2715: p.print("</TD>");
2716: p.print(sGroupDividerEnd);
2717: }
2718: }
2719:
2720: //In the horizontal mode, we will show the all navbaritems. It is best to have ONLY ONE GROUP.
2721: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
2722: .size(); j++) {
2723: if ((((Item) ((Group) _groups.elementAt(i - 1))._items
2724: .elementAt(j - 1))._visible == false)
2725: && !isHorizontalMode()) {
2726: continue;
2727: }
2728:
2729: p.println();
2730:
2731: String sName = ((Item) ((Group) _groups
2732: .elementAt(i - 1))._items.elementAt(j - 1))._name;
2733: String sTitle = ((Item) ((Group) _groups
2734: .elementAt(i - 1))._items.elementAt(j - 1))._title;
2735: String sHref = ((Item) ((Group) _groups
2736: .elementAt(i - 1))._items.elementAt(j - 1))._href;
2737: String sTarget = ((Item) ((Group) _groups
2738: .elementAt(i - 1))._items.elementAt(j - 1))._target;
2739: String sBgColor = ((Item) ((Group) _groups
2740: .elementAt(i - 1))._items.elementAt(j - 1))._itemBgcolor;
2741: int sHSpace = ((Item) ((Group) _groups
2742: .elementAt(i - 1))._items.elementAt(j - 1))._horizPadding;
2743: boolean sShowPopup = ((Item) ((Group) _groups
2744: .elementAt(i - 1))._items.elementAt(j - 1))._showPopup;
2745: boolean sSelected = ((Item) ((Group) _groups
2746: .elementAt(i - 1))._items.elementAt(j - 1))._selected;
2747: String sSubMenu = ((Item) ((Group) _groups
2748: .elementAt(i - 1))._items.elementAt(j - 1))._submenu;
2749:
2750: if (!sShowPopup && getSubMenuVisibility(sSubMenu)) {
2751: //p.println("<!--generateTDPopupInNavBarLines STARTING-->");
2752: generateTDPopupInNavBarLines(sName, sHref,
2753: sTitle, sTarget, sHSpace, sSubMenu,
2754: sBgColor, p);
2755:
2756: continue;
2757: } else {
2758: p.print(sGroupDividerStart);
2759: }
2760:
2761: if ((sSubMenu != null)
2762: && getSubMenuVisibility(sSubMenu)
2763: && (!(isNetscapeBelowV6()))) {
2764: //p.println("<!--generateTDSubMenuLine STARTING -->");
2765: p.println(generateTDSubMenuLine(sName, sHref,
2766: sTitle, sTarget, sHSpace, sSubMenu,
2767: sSubMenu, sBgColor, false, sSelected));
2768: } else {
2769: if (sSelected) {
2770: p.println(generateTDSelectedLine(sName,
2771: sHref, sTitle, sTarget, sHSpace,
2772: sBgColor, false));
2773: } else if (isPage(sName) && !_oneSelected) {
2774: p.println(generateTDSelectedLine(sName,
2775: sHref, sTitle, sTarget, sHSpace,
2776: sBgColor, false));
2777: } else {
2778: if (!Util.isNull(sHref)
2779: && !Util.isEmpty(sHref)) {
2780: p.println(generateTDLine(sName, sHref,
2781: sTitle, sTarget, sHSpace,
2782: sBgColor, false));
2783: } else {
2784: p.println(generateTDTextLine(sName,
2785: sTitle, sHSpace));
2786: }
2787: }
2788: }
2789:
2790: p.println();
2791: p.print(sGroupDividerEnd);
2792: }
2793:
2794: //Spacer Image after each group
2795: if ((_groupSpacerImage != null)
2796: && !_groupSpacerImage.equals("")) {
2797: p.println();
2798: p.println(sGroupDividerStart);
2799: p.println();
2800: p.print("<TD><IMG SRC =\"" + _groupSpacerImage
2801: + "\"");
2802: p.print(" BORDER=0");
2803: p
2804: .print(" VSPACE="
2805: + ((Group) _groups.elementAt(i - 1))._vertPadding);
2806: p.print("></TD>");
2807: p.println();
2808: p.print(sGroupDividerEnd);
2809: }
2810: }
2811:
2812: if (isHorizontalMode()) {
2813: p.print("</TR>");
2814: p.println();
2815:
2816: if ((_groups != null) && !_groups.isEmpty()) {
2817: expandAllGroups();
2818: }
2819: }
2820:
2821: p.println("</TABLE>");
2822:
2823: if ((isNetscapeBelowV6())
2824: || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC)) {
2825: return;
2826: } else {
2827: createSubMenuScript(p);
2828: }
2829: }
2830: }
2831:
2832: /**
2833: * Remove all items from the specified Group index
2834: *
2835: * @param groupIdx is the group index of which items will be removed . return true/false if removal was successful.
2836: *
2837: * @return DOCUMENT ME!
2838: */
2839: public boolean removeAllGroupItems(int groupIdx) {
2840: boolean itemsCleared = false;
2841:
2842: try {
2843: Group group = (Group) _groups.elementAt(groupIdx);
2844:
2845: int itemCount = group._items.size();
2846: int subItemCount = 0;
2847: Item testItem = null;
2848: String itemSubMenuVal = null;
2849:
2850: SubItem testSubItem = null;
2851: String subMenuGroupVal = null;
2852:
2853: for (int i = itemCount - 1; i >= 0; i--) {
2854: testItem = (Item) (group._items.elementAt(i));
2855: itemSubMenuVal = testItem._submenu;
2856:
2857: if (!Util.isFilled(itemSubMenuVal)) {
2858: group._items.remove(i);
2859:
2860: // MessageLog.writeDebugMessage("Removed Item:" + testItem._name, null);
2861: continue;
2862: }
2863:
2864: subItemCount = _subItems.size();
2865:
2866: for (int j = subItemCount - 1; j >= 0; j--) {
2867: testSubItem = (SubItem) _subItems.elementAt(j);
2868:
2869: subMenuGroupVal = testSubItem._subMenuGroup;
2870:
2871: if (itemSubMenuVal
2872: .equalsIgnoreCase(subMenuGroupVal)) {
2873: if (removeSubItems(subMenuGroupVal)) {
2874: break;
2875: }
2876: }
2877: }
2878:
2879: group._items.remove(i);
2880:
2881: // MessageLog.writeDebugMessage("Removed Item After:" + testItem._name, null);
2882: }
2883:
2884: group._items.clear();
2885: itemsCleared = true;
2886:
2887: return itemsCleared;
2888: } catch (Exception e) {
2889: e.printStackTrace();
2890:
2891: return itemsCleared;
2892: }
2893: }
2894:
2895: /**
2896: * Remove all items from the specified Group name
2897: *
2898: * @param groupName is the group name to remove items from.
2899: *
2900: * @return DOCUMENT ME!
2901: */
2902: public boolean removeAllGroupItems(String groupName) {
2903: return removeAllGroupItems(getGroupIndex(groupName));
2904: }
2905:
2906: /**
2907: * Remove all Groups and their associated Items from the Navbar return true/false if removal was successful.
2908: *
2909: * @return DOCUMENT ME!
2910: */
2911: public boolean removeAllGroups() {
2912: boolean groupsCleared = false;
2913:
2914: try {
2915: _groups.clear();
2916: _subItems.clear();
2917:
2918: return groupsCleared;
2919: } catch (Exception e) {
2920: e.printStackTrace();
2921:
2922: return groupsCleared;
2923: }
2924: }
2925:
2926: /**
2927: * DOCUMENT ME!
2928: *
2929: * @param subMenuName DOCUMENT ME!
2930: *
2931: * @return DOCUMENT ME!
2932: */
2933: public boolean removeSubItems(String subMenuName) {
2934: boolean itemsCleared = false;
2935:
2936: // MessageLog.writeDebugMessage("--->", null);
2937: try {
2938: int subItemCount = _subItems.size();
2939:
2940: SubItem testSubItem = null;
2941: String subItemSubMenuVal = null;
2942: String subMenuGroupVal = null;
2943:
2944: for (int j = subItemCount - 1; j >= 0; j--) {
2945: testSubItem = (SubItem) _subItems.elementAt(j);
2946:
2947: subItemSubMenuVal = testSubItem._subMenu;
2948: subMenuGroupVal = testSubItem._subMenuGroup;
2949:
2950: // MessageLog.writeDebugMessage(subMenuName + "subMenuName --- subMenuGroupVal :" + subMenuGroupVal, null);
2951: if (subMenuName.equalsIgnoreCase(subMenuGroupVal)) {
2952: if (subMenuName.equalsIgnoreCase(subItemSubMenuVal)) {
2953: _subItems.remove(j);
2954:
2955: // MessageLog.writeDebugMessage("Removed SubItem :" + testSubItem._name, null);
2956: } else {
2957: removeSubItems(subItemSubMenuVal);
2958: _subItems.remove(j);
2959: }
2960: }
2961: }
2962:
2963: itemsCleared = true;
2964:
2965: // MessageLog.writeDebugMessage("<---", null);
2966: return itemsCleared;
2967: } catch (Exception e) {
2968: e.printStackTrace();
2969:
2970: return itemsCleared;
2971: }
2972: }
2973:
2974: /**
2975: * DOCUMENT ME!
2976: *
2977: * @param pixels DOCUMENT ME!
2978: *
2979: * @return DOCUMENT ME!
2980: */
2981: protected HtmlImage newHorizonalSpacer(int pixels) {
2982: HtmlPage page = getPage();
2983: Props pr = page.getPageProperties();
2984: String sVertSpacerImage = pr.getProperty(_groupname
2985: + ".Group.HorizSpacerImage");
2986: HtmlImage img = new HtmlImage(sVertSpacerImage, page);
2987: img.setHorizontalSpace(pixels);
2988:
2989: return img;
2990: }
2991:
2992: /**
2993: * DOCUMENT ME!
2994: *
2995: * @param pixels int
2996: *
2997: * @return com.salmonllc.html.HtmlImage
2998: */
2999: protected HtmlImage newVerticalSpacer(int pixels) {
3000: HtmlPage page = getPage();
3001: Props pr = page.getPageProperties();
3002: String sVertSpacerImage = pr.getProperty(_groupname
3003: + ".Group.VertSpacerImage");
3004: HtmlImage img = new HtmlImage(sVertSpacerImage, page);
3005: img.setVerticalSpace(pixels);
3006:
3007: return img;
3008: }
3009:
3010: /**
3011: * DOCUMENT ME!
3012: *
3013: * @param tdLine DOCUMENT ME!
3014: * @param showPopup DOCUMENT ME!
3015: * @param bSelected DOCUMENT ME!
3016: * @param sName DOCUMENT ME!
3017: * @param sBgColor DOCUMENT ME!
3018: * @param subMenuName DOCUMENT ME!
3019: *
3020: * @return DOCUMENT ME!
3021: */
3022: private String getFlyoutSubmenuMouseEvents(String tdLine,
3023: boolean showPopup, boolean bSelected, String sName,
3024: String sBgColor, String subMenuName) {
3025: //ONMOUSEOVER
3026: tdLine += "\n ONMOUSEOVER=\"";
3027:
3028: //Hover BG Color
3029: //Check if line being generated is inside a ShowPopup menu
3030: //If so DO NOT USE HOVER BG COLORS
3031: if (!showPopup) {
3032: if ((_subHoverBgColor != null)
3033: && (!_subHoverBgColor.equals("")) && !bSelected) {
3034: tdLine += ("this.className='" + getName()
3035: + SUBCELLHOVERBGSTYLE + "';");
3036: } else if ((_hoverBgColor != null)
3037: && (!_hoverBgColor.equals("")) && !bSelected) {
3038: tdLine += ("this.className='" + getName()
3039: + CELLHOVERBGSTYLE + "';");
3040: } else if ((_hoverBgColor != null)
3041: && (!_hoverBgColor.equals("")) && bSelected) {
3042: tdLine += ("this.className='" + getName()
3043: + SELECTEDHOVERBGSTYLE + "';");
3044: }
3045:
3046: // }else{
3047: // tdLine += ("this.className='" + getName() + SHOWPOPUPBGSTYLE + "';");
3048: }
3049:
3050: if (isIE6()) {
3051: if (subMenuName != null) {
3052: tdLine += ("popup" + subMenuName + getName() + "ShowPopup();");
3053: }
3054:
3055: if ((_markerOverImage != null)
3056: && !_markerOverImage.trim().equals("")
3057: && _showSubMenuMarker) {
3058: tdLine += ("fnc" + getName()
3059: + "_MarkerOverImage(document.Marker" + sName
3060: + getName() + ");");
3061: }
3062: }
3063:
3064: tdLine += "event.cancelBubble=true;";
3065:
3066: //Hover Style
3067: //Check if line being generated is inside a ShowPopup menu
3068: //If so use showpopup styles
3069: if (showPopup
3070: && ((_showPopupHoverStyle != null) && (!_showPopupHoverStyle
3071: .equals("")))) {
3072: if (!bSelected) {
3073: tdLine += ("document.getElementById('" + sName
3074: + getName() + "').className='" + getName()
3075: + SHOWPOPUPHOVERSTYLE + "';\"");
3076: } else {
3077: tdLine += ("document.getElementById('" + sName
3078: + getName() + "').className='" + getName()
3079: + SHOWPOPUPSELECTEDHOVERSTYLE + "';\"");
3080: }
3081: } else if (!bSelected) {
3082: if ((_subHoverStyle != null)
3083: && (!_subHoverStyle.equals(""))) {
3084: tdLine += ("document.getElementById('" + sName
3085: + getName() + "').className='" + getName()
3086: + SUBHOVERSTYLE + "';\"");
3087: } else {
3088: tdLine += ("document.getElementById('" + sName
3089: + getName() + "').className='" + getName()
3090: + HOVERSTYLE + "';\"");
3091: }
3092: } else {
3093: tdLine += ("document.getElementById('" + sName + getName()
3094: + "').className='" + getName() + SELECTEDHOVERSTYLE + "';\"");
3095: }
3096:
3097: //ONMOUSEOUT
3098: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
3099: tdLine += " ONMOUSEOUT=\"";
3100:
3101: if ((sBgColor != null) && (!sBgColor.equals(""))) {
3102: tdLine += ("this.className='TD.{BACKGROUND:" + sBgColor
3103: + ";}" + "';");
3104: } else
3105: //Cell BG color
3106: {
3107: if (!bSelected) {
3108: if (showPopup
3109: && ((_showPopupBgColor != null) && (!_showPopupBgColor
3110: .equals("")))) {
3111: tdLine += ("this.className='" + getName()
3112: + SHOWPOPUPBGSTYLE + "';");
3113: } else {
3114: if ((_subMenuBgColor != null)
3115: && (!_subMenuBgColor.equals(""))) {
3116: tdLine += ("this.className='" + getName()
3117: + SUBCELLBGSTYLE + "';");
3118: } else {
3119: tdLine += ("this.className='" + getName()
3120: + CELLBGSTYLE + "';");
3121: }
3122: }
3123:
3124: // } else {
3125: // if (showPopup && ((_showPopupBgColor != null) && (!_showPopupBgColor.equals(""))))
3126: // {
3127: // tdLine += ("this.className='" + getName() + SHOWPOPUPBGSTYLE + "';");
3128: // }
3129: // else
3130: // {
3131: // tdLine += ("this.className='" + getName() + SELECTEDBGSTYLE + "';");
3132: // }
3133: }
3134: }
3135:
3136: tdLine += "event.cancelBubble=true;";
3137:
3138: //Cell Style
3139: if (showPopup
3140: && ((_showPopupStyle != null) && (!_showPopupStyle
3141: .equals("")))) {
3142: if (!bSelected) {
3143: tdLine += ("document.getElementById('" + sName
3144: + getName() + "').className='" + getName()
3145: + SHOWPOPUPSTYLE + "';\"");
3146: } else {
3147: tdLine += ("document.getElementById('" + sName
3148: + getName() + "').className='" + getName()
3149: + SHOWPOPUPSELECTEDSTYLE + "';\"");
3150: }
3151: } else {
3152: if (!bSelected) {
3153: if ((_subHrefStyle != null)
3154: && (!_subHrefStyle.equals(""))) {
3155: tdLine += ("document.getElementById('" + sName
3156: + getName() + "').className='" + getName()
3157: + SUBHREFSTYLE + "';\"");
3158: } else {
3159: tdLine += ("document.getElementById('" + sName
3160: + getName() + "').className='" + getName()
3161: + HREFSTYLE + "';\"");
3162: }
3163: } else {
3164: tdLine += ("document.getElementById('" + sName
3165: + getName() + "').className='" + getName()
3166: + SELECTEDSTYLE + "';\"");
3167: }
3168: }
3169:
3170: return tdLine;
3171: }
3172:
3173: /**
3174: * DOCUMENT ME!
3175: *
3176: * @param sScript DOCUMENT ME!
3177: * @param subMenu DOCUMENT ME!
3178: * @param subChildren DOCUMENT ME!
3179: * @param sAnchorName DOCUMENT ME!
3180: *
3181: * @return DOCUMENT ME!
3182: */
3183: private StringBuffer getIE6NS7PopupFunc(StringBuffer sScript,
3184: String subMenu, Vector subChildren, String sAnchorName) {
3185: sScript.append("\nfunction popup" + subMenu + getName()
3186: + "Popup() ");
3187: sScript.append("\n{");
3188: sScript.append("\nif ( document.getElementById(\"popup"
3189: + subMenu + getName()
3190: + "\").style.visibility=='hidden') ");
3191: sScript.append("\n{");
3192:
3193: //Following is changed to allocate the horizonal nav bar TT
3194: if (isHorizontalMode()) {
3195: sScript.append("\ndocument.getElementById(\"popup"
3196: + subMenu + getName() + "\").style.top=popup"
3197: + subMenu + getName()
3198: + "getPixelTop( document.getElementById(\""
3199: + sAnchorName + getName() + "\").offsetParent);");
3200: sScript.append("\ndocument.getElementById(\"popup"
3201: + subMenu + getName() + "\").style.left=popup"
3202: + subMenu + getName()
3203: + "getPixelLeft(document.getElementById(\""
3204: + sAnchorName + getName() + "\").offsetParent)-"
3205: + _cellPadding + ";"); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +");");
3206: } else {
3207: sScript.append("\ndocument.getElementById(\"popup"
3208: + subMenu + getName() + "\").style.top=popup"
3209: + subMenu + getName()
3210: + "getPixelTop( document.getElementById(\""
3211: + sAnchorName + getName() + "\").offsetParent);");
3212: sScript.append("\ndocument.getElementById(\"popup"
3213: + subMenu + getName() + "\").style.left=popup"
3214: + subMenu + getName()
3215: + "getPixelLeft(document.getElementById(\""
3216: + sAnchorName + getName()
3217: + "\").offsetParent)+(document.getElementById(\""
3218: + sAnchorName + getName()
3219: + "\").parentNode.offsetWidth-" + _cellPadding
3220: + ");");
3221:
3222: //sScript.append("\ndocument.getElementById(\"popup"+ subMenu + "\").style.left=popup" + subMenu + getName() + "getPixelLeft(document.getElementById(\"" + sAnchorName + "\").offsetParent)-" + _cellPadding + ";"); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +");");
3223: }
3224:
3225: sScript.append("\n}");
3226: sScript.append("\nif (document.getElementById(\"popup"
3227: + subMenu + getName()
3228: + "\").style.visibility=='visible') ");
3229: sScript.append("\n{");
3230:
3231: //
3232: if (isHorizontalMode()) {
3233: //if(isFirstLevelSubMenu(subMenu)) {
3234: sScript.append("\n if ( ");
3235: sScript.append("\n (");
3236: sScript.append("\n !(");
3237: sScript.append("\n (");
3238: sScript
3239: .append("\n "
3240: + getName()
3241: + "getMouseX()+document.body.scrollLeft > document.getElementById(\"popup"
3242: + subMenu + getName() + "\").offsetLeft &&"); // + popupsubMenu1.offsetLeft &&
3243: sScript
3244: .append("\n "
3245: + getName()
3246: + "getMouseX()+document.body.scrollLeft <(document.getElementById(\"popup"
3247: + subMenu + getName() + "\").offsetLeft+"
3248: + _cellPadding
3249: + ")+ (document.getElementById(\"popup"
3250: + subMenu + getName() + "\").offsetWidth+"
3251: + _cellPadding + ")");
3252: sScript.append("\n ) &&");
3253: sScript.append("\n (");
3254: sScript
3255: .append("\n "
3256: + getName()
3257: + "getMouseY()+document.body.scrollTop > document.getElementById(\"popup"
3258: + subMenu + getName() + "\").offsetTop - "
3259: + _cellPadding + " &&");
3260: sScript
3261: .append("\n "
3262: + getName()
3263: + "getMouseY()+document.body.scrollTop < document.getElementById(\"popup"
3264: + subMenu
3265: + getName()
3266: + "\").offsetTop + document.getElementById(\"popup"
3267: + subMenu + getName() + "\").offsetHeight"); // + document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight +" + 2* _cellPadding);
3268: sScript.append("\n )");
3269: sScript.append("\n )");
3270: sScript.append("\n )");
3271: sScript.append("\n &&");
3272: sScript.append("\n (");
3273: sScript.append("\n !(");
3274: sScript.append("\n (");
3275: sScript.append("\n " + getName()
3276: + "getMouseX()+document.body.scrollLeft > popup"
3277: + subMenu + getName()
3278: + "getPixelLeft(document.getElementById(\""
3279: + sAnchorName + getName() + "\").offsetParent) &&");
3280: sScript.append("\n " + getName()
3281: + "getMouseX()+document.body.scrollLeft <( popup"
3282: + subMenu + getName()
3283: + "getPixelLeft(document.getElementById(\""
3284: + sAnchorName + getName() + "\").offsetParent)+"
3285: + _cellPadding + ")+(document.getElementById(\""
3286: + sAnchorName + getName()
3287: + "\").parentNode.offsetWidth+" + _cellPadding
3288: + ")");
3289: sScript.append("\n ) &&");
3290: sScript.append("\n (");
3291: sScript.append("\n " + getName()
3292: + "getMouseY()+document.body.scrollTop > (popup"
3293: + subMenu + getName()
3294: + "getPixelTop(document.getElementById(\""
3295: + sAnchorName + getName() + "\").offsetParent) -"
3296: + (2 * _cellPadding) + ") && ");
3297: sScript.append("\n " + getName()
3298: + "getMouseY()+document.body.scrollTop < popup"
3299: + subMenu + getName()
3300: + "getPixelTop(document.getElementById(\""
3301: + sAnchorName + getName() + "\").offsetParent)+"
3302: + getName()
3303: + "getMaxHeight(document.getElementById(\""
3304: + sAnchorName + getName()
3305: + "\").parentNode.offsetHeight) +" + _cellPadding);
3306: sScript.append("\n )");
3307: sScript.append("\n )");
3308: sScript.append("\n )");
3309: sScript.append("\n )");
3310: sScript.append("\n{");
3311:
3312: /*sScript.append("\nif ((" + getName() + "getMouseX()+document.body.scrollLeft<popup" + subMenu + getName() + ".offsetLeft-" + sAnchorName + ".offsetWidth || " + getName() + "getMouseX()+document.body.scrollLeft>");
3313: sScript.append("\n(popup" + subMenu + getName() + ".offsetLeft+" + _cellPadding +")+(popup" + subMenu + getName() + ".offsetWidth+" + _cellPadding +")+(" + sAnchorName + ".offsetWidth+" + _cellPadding +")) || (getMouseY()+document.body.scrollTop<");
3314: sScript.append("\npopup" + subMenu + getName() + ".offsetTop-" + sAnchorName + ".offsetHeight || getMouseY()+document.body.scrollTop>");
3315: sScript.append("\npopup" + subMenu + getName() + ".offsetTop+popup" + subMenu + getName() + ".offsetHeight+" + sAnchorName + ".offsetHeight)) ");
3316: sScript.append("\n{"); */
3317: /*}else{
3318: sScript.append("\nif ((" + getName() + "getMouseX()+document.body.scrollLeft<popup" + subMenu + getName() + ".offsetLeft || " + getName() + "getMouseX()+document.body.scrollLeft>");
3319: sScript.append("\n(popup" + subMenu + getName() + ".offsetLeft+" + _cellPadding +")+(popup" + subMenu + getName() + ".offsetWidth+" + _cellPadding +")) || (getMouseY()+document.body.scrollTop<");
3320: sScript.append("\npopup" + subMenu + getName() + ".offsetTop-getMaxHeight(" + sAnchorName + ".offsetHeight) || getMouseY()+document.body.scrollTop>");
3321: sScript.append("\npopup" + subMenu + getName() + ".offsetTop+popup" + subMenu + getName() + ".offsetHeight+" + sAnchorName + ".offsetHeight)) ");
3322: sScript.append("\n{");
3323: }*/
3324: } else {
3325: /*sScript.append("\nif ((" + getName() + "getMouseX()+document.body.scrollLeft<document.getElementById(\"popup"+ subMenu + "\").offsetLeft-document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth || " + getName() + "getMouseX()+document.body.scrollLeft>");
3326: sScript.append("\n(document.getElementById(\"popup"+ subMenu + "\").offsetLeft+" + _cellPadding +")+(document.getElementById(\"popup"+ subMenu + "\").offsetWidth+" + _cellPadding +")+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +")) || (getMouseY()+document.body.scrollTop<");
3327: sScript.append("\ndocument.getElementById(\"popup"+ subMenu + "\").offsetTop-document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight || getMouseY()+document.body.scrollTop>");
3328: sScript.append("\ndocument.getElementById(\"popup"+ subMenu + "\").offsetTop+document.getElementById(\"popup"+ subMenu + "\").offsetHeight+document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight)) ");
3329: sScript.append("\n{");*/
3330: sScript
3331: .append("\nif (("
3332: + getName()
3333: + "getMouseX()+document.body.scrollLeft<document.getElementById(\"popup"
3334: + subMenu
3335: + getName()
3336: + "\").offsetLeft-document.getElementById(\""
3337: + sAnchorName + getName()
3338: + "\").parentNode.offsetWidth || "
3339: + getName()
3340: + "getMouseX()+document.body.scrollLeft>");
3341: sScript.append("\n(document.getElementById(\"popup"
3342: + subMenu + getName() + "\").offsetLeft+"
3343: + _cellPadding
3344: + ")+(document.getElementById(\"popup" + subMenu
3345: + getName() + "\").offsetWidth+" + _cellPadding
3346: + ")) "); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +")) ");
3347: sScript.append("|| (" + getName()
3348: + "getMouseY()+document.body.scrollTop<");
3349: sScript.append("\ndocument.getElementById(\"popup"
3350: + subMenu + getName() + "\").offsetTop || "); //-document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight || ");
3351: sScript.append("" + getName()
3352: + "getMouseY()+document.body.scrollTop>");
3353: sScript.append("\ndocument.getElementById(\"popup"
3354: + subMenu + getName()
3355: + "\").offsetTop+document.getElementById(\"popup"
3356: + subMenu + getName() + "\").offsetHeight )) "); //+document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight)) ");
3357: sScript.append("\n{");
3358: }
3359:
3360: if (subChildren.size() > 0) {
3361: sScript.append("\nif (");
3362:
3363: for (int i = 0; i < subChildren.size(); i++) {
3364: if (i > 0) {
3365: sScript.append("&& ");
3366: }
3367:
3368: sScript.append("\ndocument.getElementById(\"popup"
3369: + (String) subChildren.elementAt(i) + getName()
3370: + "\").style.visibility=='hidden' ");
3371: }
3372:
3373: sScript.append(")");
3374: sScript.append("\n{");
3375: sScript.append("\ndocument.getElementById(\"popup"
3376: + subMenu + getName()
3377: + "\").style.visibility='hidden';");
3378:
3379: for (int i = 0; i < subChildren.size(); i++) {
3380: String subChildName = (String) subChildren.elementAt(i);
3381: sScript.append("\ndocument.getElementById(\"popup"
3382: + subChildName + getName()
3383: + "\").style.visibility='hidden';");
3384: }
3385:
3386: sScript.append("\n}");
3387: } else {
3388: sScript.append("\ndocument.getElementById(\"popup"
3389: + subMenu + getName()
3390: + "\").style.visibility='hidden';");
3391: }
3392:
3393: sScript.append("\n}");
3394:
3395: //
3396: if (isHorizontalMode()) {
3397: sScript
3398: .append("\nif ("
3399: + getName()
3400: + "getMouseX()+document.body.scrollLeft<(document.getElementById(\"popup"
3401: + subMenu + getName() + "\").offsetLeft+"
3402: + _cellPadding + ") && (" + getName()
3403: + "getMouseY()+document.body.scrollTop<");
3404: sScript.append("\npopup" + subMenu + getName()
3405: + "getPixelTop(document.getElementById(\""
3406: + sAnchorName + getName() + "\").offsetParent) || "
3407: + getName()
3408: + "getMouseY()+document.body.scrollTop>");
3409: sScript.append("\npopup" + subMenu + getName()
3410: + "getPixelTop(document.getElementById(\""
3411: + sAnchorName + getName()
3412: + "\").offsetParent)+document.getElementById(\""
3413: + sAnchorName + getName()
3414: + "\").parentNode.offsetHeight +"
3415: + (2 * _cellPadding) + ")) ");
3416: sScript.append("\n{");
3417: } else {
3418: if (isNetscape7() || isNetscape6()) {
3419: sScript
3420: .append("\nif ("
3421: + getName()
3422: + "getMouseX()+document.body.scrollLeft<(document.getElementById(\"popup"
3423: + subMenu
3424: + getName()
3425: + "\").offsetLeft) && ("
3426: + getName()
3427: + "getMouseY()+document.body.scrollTop<");
3428: } else {
3429: sScript
3430: .append("\nif ("
3431: + getName()
3432: + "getMouseX()+document.body.scrollLeft<(document.getElementById(\"popup"
3433: + subMenu
3434: + getName()
3435: + "\").offsetLeft+"
3436: + _cellPadding
3437: + ") && ("
3438: + getName()
3439: + "getMouseY()+document.body.scrollTop<");
3440: }
3441:
3442: sScript.append("\npopup" + subMenu + getName()
3443: + "getPixelTop(document.getElementById(\""
3444: + sAnchorName + getName() + "\").offsetParent) || "
3445: + getName()
3446: + "getMouseY()+document.body.scrollTop>");
3447: sScript.append("\npopup" + subMenu + getName()
3448: + "getPixelTop(document.getElementById(\""
3449: + sAnchorName + getName()
3450: + "\").offsetParent)+document.getElementById(\""
3451: + sAnchorName + getName()
3452: + "\").parentNode.offsetHeight )) "); //+"+(2*_cellPadding)+")) ");
3453: sScript.append("\n{");
3454: }
3455:
3456: if (subChildren.size() > 0) {
3457: sScript.append("\nif (");
3458:
3459: for (int i = 0; i < subChildren.size(); i++) {
3460: if (i > 0) {
3461: sScript.append("&& ");
3462: }
3463:
3464: sScript.append("\ndocument.getElementById(\"popup"
3465: + (String) subChildren.elementAt(i) + getName()
3466: + "\").style.visibility=='hidden' ");
3467: }
3468:
3469: sScript.append(")");
3470: sScript.append("\n{");
3471: sScript.append("\ndocument.getElementById(\"popup"
3472: + subMenu + getName()
3473: + "\").style.visibility='hidden';");
3474:
3475: for (int i = 0; i < subChildren.size(); i++) {
3476: String subChildName = (String) subChildren.elementAt(i);
3477: sScript.append("\ndocument.getElementById(\"popup"
3478: + subChildName + getName()
3479: + "\").style.visibility='hidden';");
3480: }
3481:
3482: sScript.append("\n}");
3483: } else {
3484: sScript.append("\ndocument.getElementById(\"popup"
3485: + subMenu + getName()
3486: + "\").style.visibility='hidden';");
3487: }
3488:
3489: return sScript;
3490: }
3491:
3492: /**
3493: * DOCUMENT ME!
3494: *
3495: * @param sScript DOCUMENT ME!
3496: * @param subMenu DOCUMENT ME!
3497: * @param sAnchorName DOCUMENT ME!
3498: * @param subGroupName DOCUMENT ME!
3499: *
3500: * @return DOCUMENT ME!
3501: */
3502: private StringBuffer getIE6NS7ShowPopupFunc(StringBuffer sScript,
3503: String subMenu, String sAnchorName, String subGroupName) {
3504: sScript.append("\nfunction popup" + subMenu + getName()
3505: + "ShowPopup() {");
3506:
3507: //Following has cahnged to allocate the horizonal nav bar TT
3508: if (isHorizontalMode() && isFirstLevelSubMenu(subMenu)) {
3509: sScript.append("\ndocument.getElementById(\"popup"
3510: + subMenu + getName() + "\").style.top=popup"
3511: + subMenu + getName()
3512: + "getPixelTop(document.getElementById(\""
3513: + sAnchorName + getName() + "\").offsetParent)+( "
3514: + getName()
3515: + "getMaxHeight(document.getElementById(\""
3516: + sAnchorName + getName()
3517: + "\").parentNode.offsetHeight" + ") );"); //+ " + (2 * _cellPadding) + ");");//" + sAnchorName + ".offsetHeight+" + (2 * _cellPadding) + ");");
3518: sScript.append("\ndocument.getElementById(\"popup"
3519: + subMenu + getName() + "\").style.left=popup"
3520: + subMenu + getName()
3521: + "getPixelLeft(document.getElementById(\""
3522: + sAnchorName + getName() + "\").offsetParent)-("
3523: + _cellPadding + ");");
3524: } else {
3525: sScript.append("var varObjWidth = popup" + subMenu
3526: + getName()
3527: + "getPixelLeft(document.getElementById(\""
3528: + sAnchorName + getName()
3529: + "\").offsetParent)+(document.getElementById(\""
3530: + sAnchorName + getName()
3531: + "\").parentNode.offsetWidth-" + _cellPadding
3532: + ");");
3533: sScript
3534: .append("if( varObjWidth < document.body.clientWidth){");
3535: sScript.append("\ndocument.getElementById(\"popup"
3536: + subMenu + getName() + "\").style.top=popup"
3537: + subMenu + getName()
3538: + "getPixelTop(document.getElementById(\""
3539: + sAnchorName + getName() + "\").offsetParent) ;");
3540: sScript.append("\ndocument.getElementById(\"popup"
3541: + subMenu + getName() + "\").style.left=popup"
3542: + subMenu + getName()
3543: + "getPixelLeft(document.getElementById(\""
3544: + sAnchorName + getName()
3545: + "\").offsetParent)+(document.getElementById(\""
3546: + sAnchorName + getName()
3547: + "\").parentNode.offsetWidth-" + _cellPadding
3548: + ");");
3549: sScript.append("}else{"); // Move the new cel to the left 5 pixel down to make sure that the menu will be in the window
3550: sScript.append("\ndocument.getElementById(\"popup"
3551: + subMenu + getName() + "\").style.top=popup"
3552: + subMenu + getName()
3553: + "getPixelTop(document.getElementById(\""
3554: + sAnchorName + getName()
3555: + "\").offsetParent) + 5;");
3556: sScript.append("\ndocument.getElementById(\"popup"
3557: + subMenu + getName() + "\").style.left=popup"
3558: + subMenu + getName()
3559: + "getPixelLeft(document.getElementById(\""
3560: + sAnchorName + getName()
3561: + "\").offsetParent)-(document.getElementById(\""
3562: + sAnchorName + getName()
3563: + "\").parentNode.offsetWidth-" + _cellPadding
3564: + ");");
3565: sScript.append("}");
3566: }
3567:
3568: sScript.append("\ndocument.getElementById(\"popup" + subMenu
3569: + getName() + "\").style.visibility='visible';");
3570:
3571: Vector checkHide = new Vector();
3572:
3573: for (int k = 1; k <= _subItems.size(); k++) {
3574: String sSubGroupName = ((SubItem) _subItems
3575: .elementAt(k - 1))._subMenuGroup;
3576: String sSubMenu = ((SubItem) _subItems.elementAt(k - 1))._subMenu;
3577:
3578: if ((!sSubMenu.equals(subMenu))
3579: && (sSubGroupName.equals(subGroupName))
3580: && (!sSubMenu.equals(sSubGroupName))
3581: && (checkHide.indexOf(sSubMenu) < 0)) {
3582: sScript.append("\ndocument.getElementById(\"popup"
3583: + sSubMenu + getName()
3584: + "\").style.visibility='hidden';");
3585: checkHide.addElement(sSubMenu);
3586: }
3587: }
3588:
3589: return sScript;
3590: }
3591:
3592: /**
3593: *
3594: */
3595: private String getIETDFlyoutLine(String tdLine, boolean showPopup,
3596: String sName, String sBgColor) {
3597: //ONMOUSEOVER
3598: tdLine += " ONMOUSEOVER=\"";
3599:
3600: //Check if line being generated is inside a ShowPopup menu
3601: //If so DO NOT USE HOVER BG COLORS
3602: if (!showPopup) {
3603: if ((_subHoverBgColor != null)
3604: && (!_subHoverBgColor.equals(""))) {
3605: tdLine += ("this.className='" + getName()
3606: + SUBCELLHOVERBGSTYLE + "';");
3607: } else if ((_hoverBgColor != null)
3608: && (!_hoverBgColor.equals(""))) {
3609: tdLine += ("this.className='" + getName()
3610: + CELLHOVERBGSTYLE + "';");
3611: }
3612: }
3613:
3614: tdLine += "event.cancelBubble=true;";
3615:
3616: //Check if line being generated is inside a ShowPopup menu
3617: //If so use showpopup styles
3618: if (showPopup
3619: && ((_showPopupHoverStyle != null) && (!_showPopupHoverStyle
3620: .equals("")))) {
3621: tdLine += ("document.getElementById('" + sName + getName()
3622: + "').className='" + getName()
3623: + SHOWPOPUPHOVERSTYLE + "';");
3624: } else {
3625: if ((_subHoverStyle != null)
3626: && (!_subHoverStyle.equals(""))) {
3627: tdLine += ("document.getElementById('" + sName
3628: + getName() + "').className='" + getName()
3629: + SUBHOVERSTYLE + "';");
3630: } else {
3631: tdLine += ("document.getElementById('" + sName
3632: + getName() + "').className='" + getName()
3633: + HOVERSTYLE + "';");
3634: }
3635: }
3636:
3637: //
3638: //In the NS^ move the follwoing function call to anchor which is inside the current TD.
3639: if ((_markerOverImage != null)
3640: && !_markerOverImage.trim().equals("")
3641: && !isNetscape6()) {
3642: tdLine += ("fnc" + getName()
3643: + "_MarkerOverImage(document.Marker" + sName
3644: + getName() + ");\"");
3645: } else {
3646: tdLine += "\"";
3647: }
3648:
3649: //ONMOUSEOUT
3650: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
3651: tdLine += " ONMOUSEOUT=\"";
3652:
3653: if ((sBgColor != null) && (!sBgColor.equals(""))) {
3654: tdLine += ("this.className='TD.{BACKGROUND:" + sBgColor
3655: + ";}" + "';");
3656: } else {
3657: if (showPopup
3658: && ((_showPopupBgColor != null) && (!_showPopupBgColor
3659: .equals("")))) {
3660: tdLine += ("this.className='" + getName()
3661: + SHOWPOPUPBGSTYLE + "';");
3662: } else {
3663: if ((_subMenuBgColor != null)
3664: && (!_subMenuBgColor.equals(""))) {
3665: tdLine += ("this.className='" + getName()
3666: + SUBCELLBGSTYLE + "';");
3667: } else {
3668: tdLine += ("this.className='" + getName()
3669: + CELLBGSTYLE + "';");
3670: }
3671: }
3672: }
3673:
3674: tdLine += "event.cancelBubble=true;";
3675:
3676: //STYLE
3677: if (showPopup
3678: && ((_showPopupStyle != null) && (!_showPopupStyle
3679: .equals("")))) {
3680: tdLine += ("document.getElementById('" + sName + getName()
3681: + "').className='" + getName() + SHOWPOPUPSTYLE + "';");
3682: } else {
3683: if ((_subHrefStyle != null) && (!_subHrefStyle.equals(""))) {
3684: tdLine += ("document.getElementById('" + sName
3685: + getName() + "').className='" + getName()
3686: + SUBHREFSTYLE + "';");
3687: } else {
3688: tdLine += ("document.getElementById('" + sName
3689: + getName() + "').className='" + getName()
3690: + HREFSTYLE + "';");
3691: }
3692: }
3693:
3694: //
3695: if ((_markerOverImage != null)
3696: && !_markerOverImage.trim().equals("")) {
3697: tdLine += ("fnc" + getName()
3698: + "_MarkerImage(document.Marker" + sName
3699: + getName() + ");\"");
3700: } else {
3701: tdLine += "\"";
3702: }
3703:
3704: return tdLine;
3705: }
3706:
3707: /**
3708: * DOCUMENT ME!
3709: *
3710: * @param tdLine DOCUMENT ME!
3711: * @param showPopup DOCUMENT ME!
3712: * @param sName DOCUMENT ME!
3713: * @param sBgColor DOCUMENT ME!
3714: *
3715: * @return DOCUMENT ME!
3716: */
3717: private String getIETDLine(String tdLine, boolean showPopup,
3718: String sName, String sBgColor) {
3719: //ONMOUSEOVER
3720: tdLine += " ONMOUSEOVER=\"";
3721:
3722: //Check if line being generated is inside a ShowPopup menu
3723: //If so DO NOT USE HOVER BG COLORS
3724: if (!showPopup) {
3725: if ((_hoverBgColor != null) && (!_hoverBgColor.equals(""))) {
3726: tdLine += ("this.className='" + getName()
3727: + CELLHOVERBGSTYLE + "';");
3728: }
3729: }
3730:
3731: tdLine += "event.cancelBubble=true;";
3732:
3733: //Check if line being generated is inside a ShowPopup menu
3734: //If so use showpopup styles
3735: if (showPopup
3736: && ((_showPopupHoverStyle != null) && (!_showPopupHoverStyle
3737: .equals("")))) {
3738: tdLine += ("document.getElementById('" + sName + getName()
3739: + "').className='" + getName()
3740: + SHOWPOPUPHOVERSTYLE + "';");
3741: } else {
3742: tdLine += ("document.getElementById('" + sName + getName()
3743: + "').className='" + getName() + HOVERSTYLE + "';");
3744: }
3745:
3746: //
3747: //In the NS^ move the follwoing function call to anchor which is inside the current TD.
3748: if ((_markerOverImage != null)
3749: && !_markerOverImage.trim().equals("")
3750: && !isNetscape6()) {
3751: tdLine += ("fnc" + getName()
3752: + "_MarkerOverImage(document.Marker" + sName
3753: + getName() + ");\"");
3754: } else {
3755: tdLine += "\"";
3756: }
3757:
3758: //ONMOUSEOUT
3759: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
3760: tdLine += " ONMOUSEOUT=\"";
3761:
3762: if ((sBgColor != null) && (!sBgColor.equals(""))) {
3763: tdLine += ("this.className='TD.{BACKGROUND:" + sBgColor
3764: + ";}" + "';");
3765: } else {
3766: if (showPopup
3767: && ((_showPopupBgColor != null) && (!_showPopupBgColor
3768: .equals("")))) {
3769: tdLine += ("this.className='" + getName()
3770: + SHOWPOPUPBGSTYLE + "';");
3771: } else {
3772: tdLine += ("this.className='" + getName() + CELLBGSTYLE + "';");
3773: }
3774: }
3775:
3776: tdLine += "event.cancelBubble=true;";
3777:
3778: //STYLE
3779: if (showPopup
3780: && ((_showPopupStyle != null) && (!_showPopupStyle
3781: .equals("")))) {
3782: tdLine += ("document.getElementById('" + sName + getName()
3783: + "').className='" + getName() + SHOWPOPUPSTYLE + "';");
3784: } else {
3785: tdLine += ("document.getElementById('" + sName + getName()
3786: + "').className='" + getName() + HREFSTYLE + "';");
3787: }
3788:
3789: //
3790: if ((_markerOverImage != null)
3791: && !_markerOverImage.trim().equals("")) {
3792: tdLine += ("fnc" + getName()
3793: + "_MarkerImage(document.Marker" + sName
3794: + getName() + ");\"");
3795: } else {
3796: tdLine += "\"";
3797: }
3798:
3799: return tdLine;
3800: }
3801:
3802: /**
3803: * Generates The proper Java Scripts for all the images in the NavBar Table with the appropriate attributes
3804: *
3805: * @return DOCUMENT ME!
3806: */
3807: private String getImagesScript() {
3808: StringBuffer sScript = new StringBuffer();
3809: sScript.append("var highlight;\n");
3810: sScript.append("var highlightSelected;\n");
3811:
3812: sScript.append("function " + getName()
3813: + "hideImages(selectedItem){\n");
3814:
3815: if (isNetscape7() || isNetscape6()) {
3816: sScript.append("if(selectedItem && highlightSelected){ \n");
3817: sScript.append("fnc" + getName()
3818: + "_SelectedMarkerImage(highlightSelected);\n");
3819: sScript.append("highlight = \"undefined\";\n");
3820: sScript.append("}else if(highlight){ \n");
3821: sScript.append("fnc" + getName()
3822: + "_MarkerImage(highlight);\n");
3823: sScript.append("} \n");
3824: } else {
3825: sScript
3826: .append("if(selectedItem!=null && highlightSelected!=null){ \n");
3827: sScript.append("fnc" + getName()
3828: + "_SelectedMarkerImage(highlightSelected);\n");
3829: sScript.append("highlight = null;\n");
3830: sScript.append("}else if(highlight!=null){ \n");
3831: sScript.append("fnc" + getName()
3832: + "_MarkerImage(highlight);\n");
3833: sScript.append("} \n");
3834: sScript.append(" \n");
3835: }
3836:
3837: // sScript.append("fnc"+getName()+"_MarkerImage(highlight);\n");
3838: // sScript.append("}\n");
3839: sScript.append("}\n");
3840:
3841: if ((_markerImage != null) && !_markerImage.equals("")) {
3842: sScript.append("\nvar " + getName()
3843: + "_MarkerImage=new Image();\n");
3844: sScript.append(getName() + "_MarkerImage.onload=this."
3845: + getName() + "_imageLoaded;\n");
3846: sScript.append(getName() + "_MarkerImage.onerror=this."
3847: + getName() + "_imageLoaded;\n");
3848: sScript.append(getName() + "_MarkerImage.onabort=this."
3849: + getName() + "_imageLoaded;\n");
3850: sScript.append(getName() + "_MarkerImage.src=\""
3851: + _markerImage + "\";\n");
3852:
3853: sScript.append("function fnc" + getName()
3854: + "_MarkerImage(source) {\n");
3855:
3856: //sScript.append("if("+getName()+"_loading) {\n");
3857: //sScript.append("setTimeout('fnc"+getName()+"_MarkerImage(document.'+source.name+');',10);\n");
3858: // sScript.append("return;\n");
3859: //sScript.append("}\n");
3860: if (isNetscape7() || isNetscape6()) {
3861: sScript.append("if (!source) \n");
3862: } else {
3863: sScript.append("if (source==null) \n");
3864: }
3865:
3866: sScript.append("return;\n");
3867: sScript.append(getName() + "_loading=true;\n");
3868: sScript.append("source.src=" + getName()
3869: + "_MarkerImage.src;\n");
3870: sScript.append("};\n\n");
3871: }
3872:
3873: if ((_markerOverImage != null) && !_markerOverImage.equals("")) {
3874: sScript.append("\nvar " + getName()
3875: + "_MarkerOverImage=new Image();\n");
3876: sScript.append(getName() + "_MarkerOverImage.onload=this."
3877: + getName() + "_imageLoaded;\n");
3878: sScript.append(getName() + "_MarkerOverImage.onerror=this."
3879: + getName() + "_imageLoaded;\n");
3880: sScript.append(getName() + "_MarkerOverImage.onabort=this."
3881: + getName() + "_imageLoaded;\n");
3882: sScript.append(getName() + "_MarkerOverImage.src=\""
3883: + _markerOverImage + "\";\n");
3884:
3885: sScript.append("function fnc" + getName()
3886: + "_MarkerOverImage(source, selectedItem) {\n");
3887:
3888: //sScript.append("if("+getName()+"_loading) {\n");
3889: //sScript.append("setTimeout('fnc"+getName()+"_MarkerOverImage(document.'+source.name+');',10);\n");
3890: // sScript.append("return;\n");
3891: //sScript.append("}\n");
3892: if (isNetscape7() || isNetscape6()) {
3893: sScript.append("if (!source) \n");
3894: } else {
3895: sScript.append("if (source==null) \n");
3896: }
3897:
3898: sScript.append("return;\n");
3899:
3900: if (isNetscape7() || isNetscape6()) {
3901: sScript.append(" if(selectedItem)\n");
3902: } else {
3903: sScript.append(" if(selectedItem!=null)\n");
3904: }
3905:
3906: sScript.append("highlightSelected=source;\n");
3907: sScript.append("else\n");
3908: sScript.append("highlight=source; \n");
3909:
3910: sScript.append(getName() + "hideImages(selectedItem);\n");
3911: sScript.append(getName() + "_loading=true;\n");
3912: sScript.append("source.src=" + getName()
3913: + "_MarkerOverImage.src;\n");
3914:
3915: sScript.append("};\n\n");
3916: }
3917:
3918: if ((_textImage != null) && !_textImage.equals("")) {
3919: sScript.append("\nvar " + getName()
3920: + "_TextImage=new Image();\n");
3921: sScript.append(getName() + "_TextImage.onload=this."
3922: + getName() + "_imageLoaded;\n");
3923: sScript.append(getName() + "_TextImage.onerror=this."
3924: + getName() + "_imageLoaded;\n");
3925: sScript.append(getName() + "_TextImage.onabort=this."
3926: + getName() + "_imageLoaded;\n");
3927: sScript.append(getName() + "_TextImage.src=\"" + _textImage
3928: + "\";\n");
3929: sScript.append("function fnc" + getName()
3930: + "_TextImage(source) {\n");
3931: sScript.append("if(" + getName() + "_loading) {\n");
3932: sScript.append("setTimeout('fnc" + getName()
3933: + "_TextImage(document.'+source.name+');',10);\n");
3934: sScript.append("return;\n");
3935: sScript.append("}\n");
3936:
3937: if (isNetscape7() || isNetscape6()) {
3938: sScript.append("if (!source) \n");
3939: } else {
3940: sScript.append("if (source==null) \n");
3941: }
3942:
3943: sScript.append("return;\n");
3944: sScript.append(getName() + "_loading=true;\n");
3945: sScript.append("source.src=" + getName()
3946: + "_TextImage.src;\n");
3947: sScript.append("};\n\n");
3948: }
3949:
3950: if ((_selectedMarkerImage != null)
3951: && !_selectedMarkerImage.equals("")) {
3952: sScript.append("\nvar " + getName()
3953: + "_SelectedMarkerImage=new Image();\n");
3954: sScript.append(getName()
3955: + "_SelectedMarkerImage.onload=this." + getName()
3956: + "_imageLoaded;\n");
3957: sScript.append(getName()
3958: + "_SelectedMarkerImage.onerror=this." + getName()
3959: + "_imageLoaded;\n");
3960: sScript.append(getName()
3961: + "_SelectedMarkerImage.onabort=this." + getName()
3962: + "_imageLoaded;\n");
3963: sScript.append(getName() + "_SelectedMarkerImage.src=\""
3964: + _selectedMarkerImage + "\";\n");
3965: sScript.append("function fnc" + getName()
3966: + "_SelectedMarkerImage(source) {\n");
3967: sScript.append("if(" + getName() + "_loading) {\n");
3968: sScript
3969: .append("setTimeout('fnc"
3970: + getName()
3971: + "_SelectedMarkerImage(document.'+source.name+');',10);\n");
3972: sScript.append("return;\n");
3973: sScript.append("}\n");
3974:
3975: if (isNetscape7() || isNetscape6()) {
3976: sScript.append("if (!source) \n");
3977: } else {
3978: sScript.append("if (source==null) \n");
3979: }
3980:
3981: sScript.append("return;\n");
3982: sScript.append(getName() + "_loading=true;\n");
3983: sScript.append("source.src=" + getName()
3984: + "_SelectedMarkerImage.src;\n");
3985: sScript.append("};\n\n");
3986: }
3987:
3988: if ((_showPopupImage != null) && !_showPopupImage.equals("")) {
3989: sScript.append("\nvar " + getName()
3990: + "_ShowPopupImage=new Image();\n");
3991: sScript.append(getName() + "_ShowPopupImage.onload=this."
3992: + getName() + "_imageLoaded;\n");
3993: sScript.append(getName() + "_ShowPopupImage.onerror=this."
3994: + getName() + "_imageLoaded;\n");
3995: sScript.append(getName() + "_ShowPopupImage.onabort=this."
3996: + getName() + "_imageLoaded;\n");
3997: sScript.append(getName() + "_ShowPopupImage.src=\""
3998: + _showPopupImage + "\";\n");
3999: sScript.append("function fnc" + getName()
4000: + "_ShowPopupImage(source) {\n");
4001: sScript.append("if(" + getName() + "_loading) {\n");
4002: sScript
4003: .append("setTimeout('fnc"
4004: + getName()
4005: + "_ShowPopupImage(document.'+source.name+');',10);\n");
4006: sScript.append("return;\n");
4007: sScript.append("}\n");
4008:
4009: if (isNetscape7() || isNetscape6()) {
4010: sScript.append("if (!source) \n");
4011: } else {
4012: sScript.append("if (source==null) \n");
4013: }
4014:
4015: sScript.append("return;\n");
4016: sScript.append(getName() + "_loading=true;\n");
4017: sScript.append("source.src=" + getName()
4018: + "_ShowPopupImage.src;\n");
4019: sScript.append("};\n\n");
4020: }
4021:
4022: return sScript.toString();
4023: }
4024:
4025: /**
4026: * Get Load Function
4027: *
4028: * @return String
4029: */
4030: private String getLoadFunctionScript() {
4031: StringBuffer sScript = new StringBuffer();
4032: sScript.append("var " + getName() + "_loading=false;");
4033: sScript.append("function " + getName() + "_imageLoaded(e) {");
4034: sScript.append(getName() + "_loading=false;");
4035: sScript.append("}");
4036:
4037: return sScript.toString();
4038: }
4039:
4040: /**
4041: *
4042: */
4043: private void getNS45TDFlyoutLine(StringBuffer sbNS6TDLine,
4044: boolean showPopup, String sName, String sBgColor) {
4045: //ONMOUSEOVER
4046: sbNS6TDLine.append(" generateTDLine ONMOUSEOVER=\"");
4047:
4048: //Check if line being generated is inside a ShowPopup menu
4049: //If so DO NOT USE HOVER BG COLORS
4050: if (!showPopup) {
4051: if ((_subHoverBgColor != null)
4052: && (!_subHoverBgColor.equals(""))) {
4053: sbNS6TDLine.append("this.className='" + getName()
4054: + SUBCELLHOVERBGSTYLE + "';");
4055: } else if ((_hoverBgColor != null)
4056: && (!_hoverBgColor.equals(""))) {
4057: sbNS6TDLine.append("this.className='" + getName()
4058: + CELLHOVERBGSTYLE + "';");
4059: }
4060: }
4061:
4062: //Check if line being generated is inside a ShowPopup menu
4063: //If so use showpopup styles
4064: if (showPopup
4065: && ((_showPopupHoverStyle != null) && (!_showPopupHoverStyle
4066: .equals("")))) {
4067: sbNS6TDLine.append("document.getElementById('" + sName
4068: + getName() + "').className='" + getName()
4069: + SHOWPOPUPHOVERSTYLE + "';");
4070: } else {
4071: if ((_subHoverStyle != null)
4072: && (!_subHoverStyle.equals(""))) {
4073: sbNS6TDLine.append("document.getElementById('" + sName
4074: + getName() + "').className='" + getName()
4075: + SUBHOVERSTYLE + "';");
4076: } else {
4077: sbNS6TDLine.append("document.getElementById('" + sName
4078: + getName() + "').className='" + getName()
4079: + HOVERSTYLE + "';");
4080: }
4081: }
4082:
4083: //
4084: //In the NS^ move the follwoing function call to anchor which is inside the current TD.
4085: if ((_markerOverImage != null)
4086: && !_markerOverImage.trim().equals("")
4087: && !isNetscape6()) {
4088: sbNS6TDLine.append("fnc" + getName()
4089: + "_MarkerOverImage(document.Marker" + sName
4090: + getName() + ");\"");
4091: } else {
4092: sbNS6TDLine.append("\"");
4093: }
4094:
4095: //ONMOUSEOUT
4096: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
4097: sbNS6TDLine.append(" ONMOUSEOUT=\"");
4098:
4099: if ((sBgColor != null) && (!sBgColor.equals(""))) {
4100: sbNS6TDLine.append("this.className='TD.{BACKGROUND:"
4101: + sBgColor + ";}" + "';");
4102: } else {
4103: if (showPopup
4104: && ((_showPopupBgColor != null) && (!_showPopupBgColor
4105: .equals("")))) {
4106: sbNS6TDLine.append("this.className='" + getName()
4107: + SHOWPOPUPBGSTYLE + "';");
4108: } else {
4109: if ((_subHrefStyle != null)
4110: && (!_subHrefStyle.equals(""))) {
4111: sbNS6TDLine.append("this.className='" + getName()
4112: + SUBCELLBGSTYLE + "';");
4113: } else {
4114: sbNS6TDLine.append("this.className='" + getName()
4115: + CELLBGSTYLE + "';");
4116: }
4117: }
4118: }
4119:
4120: //STYLE
4121: if (showPopup
4122: && ((_showPopupStyle != null) && (!_showPopupStyle
4123: .equals("")))) {
4124: sbNS6TDLine.append("document.getElementById('" + sName
4125: + getName() + "').className='" + getName()
4126: + SHOWPOPUPSTYLE + "';");
4127: } else {
4128: if ((_subHrefStyle != null) && (!_subHrefStyle.equals(""))) {
4129: sbNS6TDLine.append("document.getElementById('" + sName
4130: + getName() + "').className='" + getName()
4131: + SUBHREFSTYLE + "';");
4132: } else {
4133: sbNS6TDLine.append("document.getElementById('" + sName
4134: + getName() + "').className='" + getName()
4135: + HREFSTYLE + "';");
4136: }
4137: }
4138:
4139: //
4140: if ((_markerOverImage != null)
4141: && !_markerOverImage.trim().equals("")) {
4142: sbNS6TDLine.append("fnc" + getName()
4143: + "_MarkerImage(document.Marker" + sName
4144: + getName() + ");\"");
4145: } else {
4146: sbNS6TDLine.append("\"");
4147: }
4148: }
4149:
4150: /**
4151: * DOCUMENT ME!
4152: *
4153: * @param sbNS6TDLine DOCUMENT ME!
4154: * @param showPopup DOCUMENT ME!
4155: * @param sName DOCUMENT ME!
4156: * @param sBgColor DOCUMENT ME!
4157: */
4158: private void getNS45TDLine(StringBuffer sbNS6TDLine,
4159: boolean showPopup, String sName, String sBgColor) {
4160: //ONMOUSEOVER
4161: sbNS6TDLine.append(" generateTDLine ONMOUSEOVER=\"");
4162:
4163: //Check if line being generated is inside a ShowPopup menu
4164: //If so DO NOT USE HOVER BG COLORS
4165: if (!showPopup) {
4166: if ((_hoverBgColor != null) && (!_hoverBgColor.equals(""))) {
4167: sbNS6TDLine.append("this.className='" + getName()
4168: + CELLHOVERBGSTYLE + "';");
4169: }
4170: }
4171:
4172: //Check if line being generated is inside a ShowPopup menu
4173: //If so use showpopup styles
4174: if (showPopup
4175: && ((_showPopupHoverStyle != null) && (!_showPopupHoverStyle
4176: .equals("")))) {
4177: sbNS6TDLine.append("document.getElementById('" + sName
4178: + getName() + "').className='" + getName()
4179: + SHOWPOPUPHOVERSTYLE + "';");
4180: } else {
4181: sbNS6TDLine.append("document.getElementById('" + sName
4182: + getName() + "').className='" + getName()
4183: + HOVERSTYLE + "';");
4184: }
4185:
4186: //
4187: //In the NS^ move the follwoing function call to anchor which is inside the current TD.
4188: if ((_markerOverImage != null)
4189: && !_markerOverImage.trim().equals("")
4190: && !isNetscape6()) {
4191: sbNS6TDLine.append("fnc" + getName()
4192: + "_MarkerOverImage(document.Marker" + sName
4193: + getName() + ");\"");
4194: } else {
4195: sbNS6TDLine.append("\"");
4196: }
4197:
4198: //ONMOUSEOUT
4199: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
4200: sbNS6TDLine.append(" ONMOUSEOUT=\"");
4201:
4202: if ((sBgColor != null) && (!sBgColor.equals(""))) {
4203: sbNS6TDLine.append("this.className='TD.{BACKGROUND:"
4204: + sBgColor + ";}" + "';");
4205: } else {
4206: if (showPopup
4207: && ((_showPopupBgColor != null) && (!_showPopupBgColor
4208: .equals("")))) {
4209: sbNS6TDLine.append("this.className='" + getName()
4210: + SHOWPOPUPBGSTYLE + "';");
4211: } else {
4212: sbNS6TDLine.append("this.className='" + getName()
4213: + CELLBGSTYLE + "';");
4214: }
4215: }
4216:
4217: //STYLE
4218: if (showPopup
4219: && ((_showPopupStyle != null) && (!_showPopupStyle
4220: .equals("")))) {
4221: sbNS6TDLine.append("document.getElementById('" + sName
4222: + getName() + "').className='" + getName()
4223: + SHOWPOPUPSTYLE + "';");
4224: } else {
4225: sbNS6TDLine.append("document.getElementById('" + sName
4226: + getName() + "').className='" + getName()
4227: + HREFSTYLE + "';");
4228: }
4229:
4230: //
4231: if ((_markerOverImage != null)
4232: && !_markerOverImage.trim().equals("")) {
4233: sbNS6TDLine.append("fnc" + getName()
4234: + "_MarkerImage(document.Marker" + sName
4235: + getName() + ");\"");
4236: } else {
4237: sbNS6TDLine.append("\"");
4238: }
4239: }
4240:
4241: /**
4242: * DOCUMENT ME!
4243: *
4244: * @param sScript DOCUMENT ME!
4245: * @param subMenu DOCUMENT ME!
4246: * @param subChildren DOCUMENT ME!
4247: * @param sAnchorName DOCUMENT ME!
4248: *
4249: * @return DOCUMENT ME!
4250: */
4251: private StringBuffer getNS6PopupFunc(StringBuffer sScript,
4252: String subMenu, Vector subChildren, String sAnchorName) {
4253: sScript.append("\nfunction popup" + subMenu + getName()
4254: + "Popup() ");
4255: sScript.append("\n{");
4256: sScript.append("\nif ( document.getElementById(\"popup"
4257: + subMenu + getName()
4258: + "\").style.visibility=='hidden') ");
4259: sScript.append("\n{");
4260:
4261: //Following is changed to allocate the horizonal nav bar TT
4262: if (isHorizontalMode()) {
4263: sScript.append("\ndocument.getElementById(\"popup"
4264: + subMenu + getName() + "\").style.top=popup"
4265: + subMenu + getName()
4266: + "getPixelTop( document.getElementById(\""
4267: + sAnchorName + getName() + "\").parentNode)+( "
4268: + getName()
4269: + "getMaxHeight(document.getElementById(\""
4270: + sAnchorName + getName()
4271: + "\").parentNode.offsetHeight) );");
4272: sScript.append("\ndocument.getElementById(\"popup"
4273: + subMenu + getName() + "\").style.left=popup"
4274: + subMenu + getName()
4275: + "getPixelLeft(document.getElementById(\""
4276: + sAnchorName + getName() + "\"))-"
4277: + (2 * _cellPadding) + ";"); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +");");
4278: } else {
4279: sScript.append("\ndocument.getElementById(\"popup"
4280: + subMenu + getName() + "\").style.top=popup"
4281: + subMenu + getName()
4282: + "getPixelTop( document.getElementById(\""
4283: + sAnchorName + getName() + "\"));");
4284: sScript.append("\ndocument.getElementById(\"popup"
4285: + subMenu + getName() + "\").style.left=popup"
4286: + subMenu + getName()
4287: + "getPixelLeft(document.getElementById(\""
4288: + sAnchorName + getName()
4289: + "\"))+(document.getElementById(\"" + sAnchorName
4290: + getName() + "\").parentNode.offsetWidth-"
4291: + _cellPadding + ");");
4292:
4293: //sScript.append("\ndocument.getElementById(\"popup"+ subMenu + "\").style.left=popup" + subMenu + getName() + "getPixelLeft(document.getElementById(\"" + sAnchorName + "\").offsetParent)-" + _cellPadding + ";"); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +");");
4294: }
4295:
4296: sScript.append("\n}");
4297: sScript.append("\nif (document.getElementById(\"popup"
4298: + subMenu + getName()
4299: + "\").style.visibility=='visible') ");
4300: sScript.append("\n{");
4301:
4302: //
4303: if (isHorizontalMode()) {
4304: sScript.append("\n if ( ");
4305: sScript.append("\n (");
4306: sScript.append("\n !(");
4307: sScript.append("\n (");
4308: sScript
4309: .append("\n "
4310: + getName()
4311: + "getMouseX()+window.pageXOffset > document.getElementById(\"popup"
4312: + subMenu + getName() + "\").offsetLeft &&"); // + popupsubMenu1.offsetLeft &&
4313: sScript
4314: .append("\n "
4315: + getName()
4316: + "getMouseX()+window.pageXOffset <(document.getElementById(\"popup"
4317: + subMenu + getName() + "\").offsetLeft+"
4318: + _cellPadding
4319: + ")+ (document.getElementById(\"popup"
4320: + subMenu + getName() + "\").offsetWidth+"
4321: + _cellPadding + ")");
4322: sScript.append("\n ) &&");
4323: sScript.append("\n (");
4324: sScript
4325: .append("\n "
4326: + getName()
4327: + "getMouseY()+window.pageYOffset > document.getElementById(\"popup"
4328: + subMenu + getName() + "\").offsetTop - "
4329: + _cellPadding + " &&");
4330: sScript
4331: .append("\n "
4332: + getName()
4333: + "getMouseY()+window.pageYOffset < document.getElementById(\"popup"
4334: + subMenu
4335: + getName()
4336: + "\").offsetTop + document.getElementById(\"popup"
4337: + subMenu + getName() + "\").offsetHeight"); // + document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight +" + 2* _cellPadding);
4338: sScript.append("\n )");
4339: sScript.append("\n )");
4340: sScript.append("\n )");
4341: sScript.append("\n &&");
4342: sScript.append("\n (");
4343: sScript.append("\n !(");
4344: sScript.append("\n (");
4345: sScript.append("\n " + getName()
4346: + "getMouseX()+window.pageXOffset > popup"
4347: + subMenu + getName()
4348: + "getPixelLeft(document.getElementById(\""
4349: + sAnchorName + getName() + "\")) &&");
4350: sScript.append("\n " + getName()
4351: + "getMouseX()+window.pageXOffset <( popup"
4352: + subMenu + getName()
4353: + "getPixelLeft(document.getElementById(\""
4354: + sAnchorName + getName() + "\"))+" + _cellPadding
4355: + ")+(document.getElementById(\"" + sAnchorName
4356: + getName() + "\").parentNode.offsetWidth+"
4357: + _cellPadding + ")");
4358: sScript.append("\n ) &&");
4359: sScript.append("\n (");
4360: sScript.append("\n " + getName()
4361: + "getMouseY()+window.pageYOffset > (popup"
4362: + subMenu + getName()
4363: + "getPixelTop(document.getElementById(\""
4364: + sAnchorName + getName() + "\")) -"
4365: + (2 * _cellPadding) + ") && ");
4366: sScript.append("\n " + getName()
4367: + "getMouseY()+window.pageYOffset < popup"
4368: + subMenu + getName()
4369: + "getPixelTop(document.getElementById(\""
4370: + sAnchorName + getName() + "\"))+" + getName()
4371: + "getMaxHeight(document.getElementById(\""
4372: + sAnchorName + getName()
4373: + "\").parentNode.offsetHeight) +" + _cellPadding);
4374: sScript.append("\n )");
4375: sScript.append("\n )");
4376: sScript.append("\n )");
4377: sScript.append("\n )");
4378: sScript.append("\n{");
4379: } else {
4380: sScript
4381: .append("\nif (("
4382: + getName()
4383: + "getMouseX()+window.pageXOffset<document.getElementById(\"popup"
4384: + subMenu
4385: + getName()
4386: + "\").offsetLeft-document.getElementById(\""
4387: + sAnchorName + getName()
4388: + "\").parentNode.offsetWidth || "
4389: + getName()
4390: + "getMouseX()+window.pageXOffset>");
4391: sScript.append("\n(document.getElementById(\"popup"
4392: + subMenu + getName() + "\").offsetLeft+"
4393: + _cellPadding
4394: + ")+(document.getElementById(\"popup" + subMenu
4395: + getName() + "\").offsetWidth+" + _cellPadding
4396: + ")) "); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +")) ");
4397: sScript.append("|| (" + getName()
4398: + "getMouseY()+window.pageYOffset<");
4399: sScript.append("\ndocument.getElementById(\"popup"
4400: + subMenu + getName() + "\").offsetTop || "); //-document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight || ");
4401: sScript.append("" + getName()
4402: + "getMouseY()+window.pageYOffset>");
4403: sScript.append("\ndocument.getElementById(\"popup"
4404: + subMenu + getName()
4405: + "\").offsetTop+document.getElementById(\"popup"
4406: + subMenu + getName() + "\").offsetHeight )) "); //+document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight)) ");
4407: sScript.append("\n{");
4408: }
4409:
4410: if (subChildren.size() > 0) {
4411: sScript.append("\nif (");
4412:
4413: for (int i = 0; i < subChildren.size(); i++) {
4414: if (i > 0) {
4415: sScript.append("&& ");
4416: }
4417:
4418: sScript.append("\ndocument.getElementById(\"popup"
4419: + (String) subChildren.elementAt(i) + getName()
4420: + "\").style.visibility=='hidden' ");
4421: }
4422:
4423: sScript.append(")");
4424: sScript.append("\n{");
4425: sScript.append("\ndocument.getElementById(\"popup"
4426: + subMenu + getName()
4427: + "\").style.visibility='hidden';");
4428:
4429: for (int i = 0; i < subChildren.size(); i++) {
4430: String subChildName = (String) subChildren.elementAt(i);
4431: sScript.append("\ndocument.getElementById(\"popup"
4432: + subChildName + getName()
4433: + "\").style.visibility='hidden';");
4434: }
4435:
4436: sScript.append("\n}");
4437: } else {
4438: sScript.append("\ndocument.getElementById(\"popup"
4439: + subMenu + getName()
4440: + "\").style.visibility='hidden';");
4441: }
4442:
4443: sScript.append("\n}");
4444:
4445: //
4446: if (isHorizontalMode()) {
4447: sScript
4448: .append("\nif ("
4449: + getName()
4450: + "getMouseX()+window.pageXOffset<(document.getElementById(\"popup"
4451: + subMenu + getName() + "\").offsetLeft+"
4452: + _cellPadding + ") && (" + getName()
4453: + "getMouseY()+window.pageYOffset<");
4454: sScript.append("\npopup" + subMenu + getName()
4455: + "getPixelTop(document.getElementById(\""
4456: + sAnchorName + getName() + "\")) || " + getName()
4457: + "getMouseY()+window.pageYOffset>");
4458: sScript.append("\npopup" + subMenu + getName()
4459: + "getPixelTop(document.getElementById(\""
4460: + sAnchorName + getName()
4461: + "\"))+document.getElementById(\"" + sAnchorName
4462: + getName() + "\").parentNode.offsetHeight +"
4463: + (2 * _cellPadding) + ")) ");
4464: sScript.append("\n{");
4465: } else {
4466: sScript
4467: .append("\nif ("
4468: + getName()
4469: + "getMouseX()+window.pageXOffset<(document.getElementById(\"popup"
4470: + subMenu + getName() + "\").offsetLeft+"
4471: + _cellPadding + ") && (" + getName()
4472: + "getMouseY()+window.pageYOffset<");
4473: sScript.append("\npopup" + subMenu + getName()
4474: + "getPixelTop(document.getElementById(\""
4475: + sAnchorName + getName() + "\")) || " + getName()
4476: + "getMouseY()+window.pageYOffset>");
4477: sScript.append("\npopup" + subMenu + getName()
4478: + "getPixelTop(document.getElementById(\""
4479: + sAnchorName + getName()
4480: + "\"))+document.getElementById(\"" + sAnchorName
4481: + getName() + "\").parentNode.offsetHeight )) "); //+"+(2*_cellPadding)+")) ");
4482: sScript.append("\n{");
4483: }
4484:
4485: if (subChildren.size() > 0) {
4486: sScript.append("\nif (");
4487:
4488: for (int i = 0; i < subChildren.size(); i++) {
4489: if (i > 0) {
4490: sScript.append("&& ");
4491: }
4492:
4493: sScript.append("\ndocument.getElementById(\"popup"
4494: + (String) subChildren.elementAt(i) + getName()
4495: + "\").style.visibility=='hidden' ");
4496: }
4497:
4498: sScript.append(")");
4499: sScript.append("\n{");
4500: sScript.append("\ndocument.getElementById(\"popup"
4501: + subMenu + getName()
4502: + "\").style.visibility='hidden';");
4503:
4504: for (int i = 0; i < subChildren.size(); i++) {
4505: String subChildName = (String) subChildren.elementAt(i);
4506: sScript.append("\ndocument.getElementById(\"popup"
4507: + subChildName + getName()
4508: + "\").style.visibility='hidden';");
4509: }
4510:
4511: sScript.append("\n}");
4512: } else {
4513: sScript.append("\ndocument.getElementById(\"popup"
4514: + subMenu + getName()
4515: + "\").style.visibility='hidden';");
4516: }
4517:
4518: return sScript;
4519: }
4520:
4521: /**
4522: * DOCUMENT ME!
4523: *
4524: * @param sScript DOCUMENT ME!
4525: * @param subMenu DOCUMENT ME!
4526: * @param sAnchorName DOCUMENT ME!
4527: * @param subGroupName DOCUMENT ME!
4528: *
4529: * @return DOCUMENT ME!
4530: */
4531: private StringBuffer getNS6ShowPopupFunc(StringBuffer sScript,
4532: String subMenu, String sAnchorName, String subGroupName) {
4533: sScript.append("\nfunction popup" + subMenu + getName()
4534: + "ShowPopup() {");
4535:
4536: //Following has cahnged to allocate the horizonal nav bar TT
4537: if (isHorizontalMode() && isFirstLevelSubMenu(subMenu)) {
4538: /*sScript.append("\ndocument.getElementById(\"popup"+ subMenu + "\").style.top=popup" + subMenu + getName() + "getPixelTop(document.getElementById(\"" + sAnchorName + "\"))+( getMaxHeight(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight) );");//+ " + (2 * _cellPadding) + ");");//" + sAnchorName + ".offsetHeight+" + (2 * _cellPadding) + ");"); /// .parentNode)+( getMaxHeight(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetHeight" + ") );");//+ " + (2 * _cellPadding) + ");");//" + sAnchorName + ".offsetHeight+" + (2 * _cellPadding) + ");");
4539: sScript.append("\ndocument.getElementById(\"popup"+ subMenu + "\").style.left=popup" + subMenu + getName() + "getPixelLeft(document.getElementById(\"" + sAnchorName + "\"))-(" + _cellPadding * 2 + ");");
4540: */
4541: sScript.append("\ndocument.getElementById(\"popup"
4542: + subMenu + getName() + "\").style.top=popup"
4543: + subMenu + getName()
4544: + "getPixelTop( document.getElementById(\""
4545: + sAnchorName + getName() + "\").parentNode)+( "
4546: + getName()
4547: + "getMaxHeight(document.getElementById(\""
4548: + sAnchorName + getName()
4549: + "\").parentNode.offsetHeight) );");
4550: sScript.append("\ndocument.getElementById(\"popup"
4551: + subMenu + getName() + "\").style.left=popup"
4552: + subMenu + getName()
4553: + "getPixelLeft(document.getElementById(\""
4554: + sAnchorName + getName() + "\"))-"
4555: + (2 * _cellPadding) + ";"); //+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth+" + _cellPadding +");");
4556: } else {
4557: sScript.append("var varObjWidth = popup" + subMenu
4558: + getName()
4559: + "getPixelLeft(document.getElementById(\""
4560: + sAnchorName + getName()
4561: + "\"))+(document.getElementById(\"" + sAnchorName
4562: + getName() + "\").parentNode.offsetWidth-"
4563: + _cellPadding + ");"); //.offsetParent)+(document.getElementById(\"" + sAnchorName + "\").parentNode.offsetWidth-" + _cellPadding + ");");
4564: sScript.append("if( varObjWidth < window.innerWidth){");
4565: sScript.append("\ndocument.getElementById(\"popup"
4566: + subMenu + getName() + "\").style.top=popup"
4567: + subMenu + getName()
4568: + "getPixelTop(document.getElementById(\""
4569: + sAnchorName + getName() + "\")) ;");
4570: sScript.append("\ndocument.getElementById(\"popup"
4571: + subMenu + getName() + "\").style.left=popup"
4572: + subMenu + getName()
4573: + "getPixelLeft(document.getElementById(\""
4574: + sAnchorName + getName()
4575: + "\"))+(document.getElementById(\"" + sAnchorName
4576: + getName() + "\").parentNode.offsetWidth-"
4577: + _cellPadding + ");");
4578: sScript.append("}else{"); // Move the new cel to the left 5 pixel down to make sure that the menu will be in the window
4579: sScript.append("\ndocument.getElementById(\"popup"
4580: + subMenu + getName() + "\").style.top=popup"
4581: + subMenu + getName()
4582: + "getPixelTop(document.getElementById(\""
4583: + sAnchorName + getName() + "\")) + 5;");
4584: sScript.append("\ndocument.getElementById(\"popup"
4585: + subMenu + getName() + "\").style.left=popup"
4586: + subMenu + getName()
4587: + "getPixelLeft(document.getElementById(\""
4588: + sAnchorName + getName()
4589: + "\"))-(document.getElementById(\"" + sAnchorName
4590: + getName() + "\").parentNode.offsetWidth-"
4591: + _cellPadding + ");");
4592: sScript.append("}");
4593: }
4594:
4595: sScript.append("\ndocument.getElementById(\"popup" + subMenu
4596: + getName() + "\").style.visibility='visible';");
4597:
4598: Vector checkHide = new Vector();
4599:
4600: for (int k = 1; k <= _subItems.size(); k++) {
4601: String sSubGroupName = ((SubItem) _subItems
4602: .elementAt(k - 1))._subMenuGroup;
4603: String sSubMenu = ((SubItem) _subItems.elementAt(k - 1))._subMenu;
4604:
4605: if ((!sSubMenu.equals(subMenu))
4606: && (sSubGroupName.equals(subGroupName))
4607: && (!sSubMenu.equals(sSubGroupName))
4608: && (checkHide.indexOf(sSubMenu) < 0)) {
4609: sScript.append("\ndocument.getElementById(\"popup"
4610: + sSubMenu + getName()
4611: + "\").style.visibility='hidden';");
4612: checkHide.addElement(sSubMenu);
4613: }
4614: }
4615:
4616: return sScript;
4617: }
4618:
4619: /**
4620: * Get If Item Is on the Navbar as a item
4621: *
4622: * @param itemName DOCUMENT ME!
4623: *
4624: * @return boolean
4625: */
4626: private boolean isNavBarItem(String itemName) {
4627: boolean isItem = false;
4628:
4629: try {
4630: outerloop: for (int i = 1; i <= _groups.size(); i++) {
4631: if (((Group) _groups.elementAt(i - 1))._visible == false) {
4632: continue;
4633: }
4634:
4635: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
4636: .size(); j++) {
4637: if (((Item) ((Group) _groups.elementAt(i - 1))._items
4638: .elementAt(j - 1))._visible == false) {
4639: continue;
4640: }
4641:
4642: String sName = ((Item) ((Group) _groups
4643: .elementAt(i - 1))._items.elementAt(j - 1))._name;
4644: boolean sShowPopup = ((Item) ((Group) _groups
4645: .elementAt(i - 1))._items.elementAt(j - 1))._showPopup;
4646: String sSubMenu = ((Item) ((Group) _groups
4647: .elementAt(i - 1))._items.elementAt(j - 1))._submenu;
4648:
4649: if (itemName.equals(sName)) {
4650: isItem = true;
4651:
4652: break outerloop;
4653: } else {
4654: if (!sShowPopup
4655: && getSubMenuVisibility(sSubMenu)) {
4656: for (int k = 1; k <= _subItems.size(); k++) {
4657: boolean _sVisible = ((SubItem) _subItems
4658: .elementAt(k - 1))._visible;
4659: String subGroupName = ((SubItem) _subItems
4660: .elementAt(k - 1))._subMenuGroup;
4661: String subItemName = ((SubItem) _subItems
4662: .elementAt(k - 1))._name;
4663:
4664: if (subGroupName.equals(sSubMenu)
4665: && _sVisible) {
4666: if (itemName.equals(subItemName)) {
4667: isItem = true;
4668:
4669: break outerloop;
4670: }
4671: }
4672: }
4673: }
4674: }
4675: }
4676: }
4677: } catch (Exception e) {
4678: e.printStackTrace();
4679: }
4680:
4681: return isItem;
4682: }
4683:
4684: /**
4685: * DOCUMENT ME!
4686: *
4687: * @param sVal DOCUMENT ME!
4688: *
4689: * @return DOCUMENT ME!
4690: */
4691: private boolean isNullOrEmty(String sVal) {
4692: if ((sVal == null) || sVal.equalsIgnoreCase("null")
4693: || (sVal.length() < 1)) {
4694: return true;
4695: }
4696:
4697: return false;
4698: }
4699:
4700: /**
4701: * Check to if the current page is equal to the page requested
4702: *
4703: * @param sName java.lang.String
4704: *
4705: * @return boolean
4706: */
4707: private boolean isPage(String sName) {
4708: if (sName == null) {
4709: return false;
4710: }
4711:
4712: String NavBarIdName = "";
4713:
4714: if (getPage().getParameter(NAVBARID) != null) {
4715: NavBarIdName = getPage().getParameter(NAVBARID);
4716: }
4717:
4718: if (sName.equals(NavBarIdName)) {
4719: return true;
4720: }
4721:
4722: return false;
4723:
4724: /* if (sHref==null)
4725: return false;
4726: String pageName=getPage().getPageName();
4727: int qindex=sHref.indexOf('?');
4728: if (qindex>-1)
4729: sHref=sHref.substring(0,qindex);
4730: if (sHref.endsWith(pageName))
4731: return true;
4732: return false;
4733: */
4734: }
4735:
4736: /**
4737: * Get Popup Item
4738: *
4739: * @param subMenuGroup DOCUMENT ME!
4740: *
4741: * @return String
4742: */
4743: private String getPopupItem(String subMenuGroup) {
4744: String sReturn = null;
4745: outerloop: for (int i = 1; i <= _groups.size(); i++) {
4746: if (((Group) _groups.elementAt(i - 1))._visible == false) {
4747: continue;
4748: }
4749:
4750: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
4751: .size(); j++) {
4752: if (((Item) ((Group) _groups.elementAt(i - 1))._items
4753: .elementAt(j - 1))._visible == false) {
4754: continue;
4755: }
4756:
4757: String sName = ((Item) ((Group) _groups
4758: .elementAt(i - 1))._items.elementAt(j - 1))._name;
4759: String sSubMenu = ((Item) ((Group) _groups
4760: .elementAt(i - 1))._items.elementAt(j - 1))._submenu;
4761:
4762: if ((sSubMenu != null) && sSubMenu.equals(subMenuGroup)) {
4763: sReturn = sName;
4764:
4765: break outerloop;
4766: }
4767: }
4768: }
4769:
4770: if (sReturn == null) {
4771: for (int k = 1; k <= _subItems.size(); k++) {
4772: boolean _bVisible = ((SubItem) _subItems
4773: .elementAt(k - 1))._visible;
4774:
4775: if (!_bVisible) {
4776: continue;
4777: }
4778:
4779: String sName = ((SubItem) _subItems.elementAt(k - 1))._name;
4780: String subSubName = ((SubItem) _subItems
4781: .elementAt(k - 1))._subMenu;
4782:
4783: if ((subSubName != null)
4784: && subSubName.equals(subMenuGroup)) {
4785: sReturn = sName;
4786:
4787: break;
4788: }
4789: }
4790: }
4791:
4792: return sReturn;
4793: }
4794:
4795: /**
4796: * Get Sub Menu Mouse Script
4797: *
4798: * @param subMenu DOCUMENT ME!
4799: *
4800: * @return String
4801: */
4802: private String getSubMenuMouseScript(Vector subMenu) {
4803: if (!isGenerateScripts()) // In that case scripts will be generated by the associated nav bar
4804: {
4805: return "";
4806: }
4807:
4808: Vector vNavBars = getPage().getNavBarsVector();
4809: StringBuffer sbGetMouseScripts = new StringBuffer(); //If there is more than one nav bar in a page generate the mouse event trackers
4810: StringBuffer sScript = new StringBuffer();
4811: StringBuffer sShowScript = new StringBuffer();
4812: StringBuffer sbScriptNS = new StringBuffer();
4813: StringBuffer sbVars = new StringBuffer();
4814:
4815: if ((vNavBars != null) && (vNavBars.size() > 0)) {
4816: Enumeration enumNavbars = vNavBars.elements();
4817:
4818: while (enumNavbars.hasMoreElements()) {
4819: JspNavBar nb = (JspNavBar) enumNavbars.nextElement();
4820:
4821: if ((nb == null) || !nb.getVisible()) {
4822: continue;
4823: }
4824:
4825: String sName = nb.getName();
4826:
4827: if ((sName == null) || sName.equals(getName())) {
4828: continue;
4829: }
4830:
4831: sbVars.append("\nvar " + sName + "mouseX=0;");
4832: sbVars.append("\nvar " + sName + "mouseY=0;");
4833: sbScriptNS.append("\n" + sName
4834: + "mouseX = e.pageX || e.clientX;");
4835: sbScriptNS.append("\n" + sName
4836: + "mouseY = e.pageY || e.clientY;");
4837: sbGetMouseScripts.append("\nfunction " + sName
4838: + "getMouseX() {");
4839: sbGetMouseScripts.append("\nreturn " + sName
4840: + "mouseX;");
4841: sbGetMouseScripts.append("\n}");
4842: sbGetMouseScripts.append("\nfunction " + sName
4843: + "getMouseY() {");
4844: sbGetMouseScripts.append("\nreturn " + sName
4845: + "mouseY;");
4846: sbGetMouseScripts.append("\n}");
4847:
4848: Vector vSubMenu = nb.getPopupsVector();
4849:
4850: for (int i = 0; i < vSubMenu.size(); i++) {
4851: sbScriptNS.append("\npopup"
4852: + (String) vSubMenu.elementAt(i) + sName
4853: + "Popup();");
4854: sShowScript.append("\npopup"
4855: + (String) vSubMenu.elementAt(i) + sName
4856: + "ShowPopup();");
4857: sShowScript.append("\npopup"
4858: + (String) vSubMenu.elementAt(i) + sName
4859: + "Popup();");
4860: }
4861:
4862: nb.setGenerateScripts(false); //Do not generate ths scripts in more than onece in the page
4863: }
4864: }
4865:
4866: sScript.append("\n<SCRIPT LANGUAGE='JavaScript1.2'>");
4867: sScript.append("\nvar " + getName() + "mouseX=0;");
4868: sScript.append("\nvar " + getName() + "mouseY=0;");
4869:
4870: if ((sbVars != null) && (sbVars.length() > 0)) {
4871: sScript.append(sbVars.toString());
4872: }
4873:
4874: sScript.append("\nfunction " + getName() + "mouseTracker(e) {");
4875: sScript.append("\ne = e || window.Event || window.event;");
4876: sScript.append("\n" + getName()
4877: + "mouseX = e.pageX || e.clientX;");
4878: sScript.append("\n" + getName()
4879: + "mouseY = e.pageY || e.clientY;");
4880:
4881: if ((sbScriptNS != null) && (sbScriptNS.length() > 0)) {
4882: sScript.append(sbScriptNS.toString());
4883: }
4884:
4885: for (int i = 0; i < subMenu.size(); i++) {
4886: sScript.append("\npopup" + (String) subMenu.elementAt(i)
4887: + getName() + "Popup();");
4888: sShowScript.append("\npopup"
4889: + (String) subMenu.elementAt(i) + getName()
4890: + "ShowPopup();");
4891: sShowScript.append("\npopup"
4892: + (String) subMenu.elementAt(i) + getName()
4893: + "Popup();");
4894: }
4895:
4896: sScript.append("\n}");
4897: sScript.append("\nfunction set" + getName()
4898: + "MouseTracker() {");
4899: sScript.append("\nif (document.captureEvents)");
4900: sScript
4901: .append("\ndocument.captureEvents(window.Event.MOUSEMOVE|window.Event.MOUSEUP);");
4902: sScript.append("\ndocument.onmousemove = this." + getName()
4903: + "mouseTracker;");
4904: sScript.append("\n}");
4905: sScript.append("\nfunction " + getName() + "getMouseX() {");
4906: sScript.append("\nreturn " + getName() + "mouseX;");
4907: sScript.append("\n}");
4908: sScript.append("\nfunction " + getName() + "getMouseY() {");
4909: sScript.append("\nreturn " + getName() + "mouseY;");
4910: sScript.append("\n}");
4911:
4912: if ((sbGetMouseScripts != null)
4913: && (sbGetMouseScripts.length() > 0)) {
4914: sScript.append(sbGetMouseScripts.toString());
4915: }
4916:
4917: sScript.append("\nset" + getName() + "MouseTracker();");
4918:
4919: sScript.append("\n</SCRIPT>");
4920:
4921: //In order to avoid the flash effect in the first hit of the page initilize the components in onLoad()
4922: if (isNetscape6() || isNetscape7()) {
4923: //getPage().setOnLoad(sShowScript.toString());
4924: getPage().writeScript(sShowScript.toString());
4925: }
4926:
4927: setGenerateScripts(true);
4928:
4929: return sScript.toString();
4930: }
4931:
4932: /**
4933: * Get Sub Menu Popup Script
4934: *
4935: * @param subMenu DOCUMENT ME!
4936: * @param sName DOCUMENT ME!
4937: * @param subGroupName DOCUMENT ME!
4938: * @param subChildren DOCUMENT ME!
4939: *
4940: * @return String
4941: */
4942: private String getSubMenuPopupScript(String subMenu, String sName,
4943: String subGroupName, Vector subChildren) {
4944: String sAnchorName = subGroupName + sName;
4945: StringBuffer sScript = new StringBuffer();
4946: sScript.append("\n<SCRIPT LANGUAGE=\"JavaScript1.2\">");
4947:
4948: if (isNetscape6()) {
4949: writeNS6getPixelTopFunc(sScript, subMenu);
4950: writeNS6getPixelLeftFunc(sScript, subMenu);
4951: } else {
4952: sScript.append("\nfunction popup" + subMenu + getName()
4953: + "getPixelTop(htmlElement)");
4954: sScript.append("\n{");
4955: sScript.append("\nif (htmlElement.offsetParent==null)");
4956: sScript.append("\nreturn htmlElement.offsetTop-"
4957: + _cellSpacing + ";");
4958: sScript.append("\nreturn htmlElement.offsetTop+popup"
4959: + subMenu + getName()
4960: + "getPixelTop(htmlElement.offsetParent)");
4961: sScript.append("\n}");
4962:
4963: //
4964: sScript.append("\nfunction popup" + subMenu + getName()
4965: + "getPixelLeft(htmlElement)");
4966: sScript.append("\n{");
4967: sScript.append("\nif (htmlElement.offsetParent==null)");
4968: sScript.append("\nreturn htmlElement.offsetLeft+"
4969: + _cellPadding + ";");
4970: sScript.append("\nreturn htmlElement.offsetLeft+popup"
4971: + subMenu + getName()
4972: + "getPixelLeft(htmlElement.offsetParent)");
4973: sScript.append("\n}");
4974: }
4975:
4976: if (isNetscape7()
4977: || (getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT)) {
4978: getIE6NS7PopupFunc(sScript, subMenu, subChildren,
4979: sAnchorName);
4980: sScript.append("\n}");
4981: sScript.append("\n}");
4982: sScript.append("\n}");
4983: getIE6NS7ShowPopupFunc(sScript, subMenu, sAnchorName,
4984: subGroupName);
4985: } else if (isNetscape6()) {
4986: getNS6PopupFunc(sScript, subMenu, subChildren, sAnchorName);
4987: sScript.append("\n}");
4988: sScript.append("\n}");
4989: sScript.append("\n}");
4990: getNS6ShowPopupFunc(sScript, subMenu, sAnchorName,
4991: subGroupName);
4992: }
4993:
4994: sScript.append("\n}");
4995: sScript.append("\n</SCRIPT>");
4996:
4997: return sScript.toString();
4998: }
4999:
5000: /*public boolean isSecondLevelSubMenu(String subMenu){
5001: for (int i=1;i<=_groups.size();i++) {
5002: if (((Group)_groups.elementAt(i-1))._visible==false)
5003: continue;
5004: for (int j=1;j<=((Group)_groups.elementAt(i-1))._items.size();j++) {
5005: Item itm = ((Item)((Group)_groups.elementAt(i-1))._items.elementAt(j-1));
5006: if (itm._visible==false)
5007: continue;
5008: String sItemName=itm._submenu;
5009: for(int k=0 ; k < _subItems.size() ; k++){
5010: ((Item)((Group)_groups.elementAt(i-1))._items.elementAt(j-1));
5011: }
5012: if(sItemName!= null && sItemName.equals(subMenu))
5013: return true;
5014: }
5015: }
5016: return false;
5017: }*/
5018:
5019: /**
5020: * Get Submenu Visibility
5021: *
5022: * @param subMenuName DOCUMENT ME!
5023: *
5024: * @return DOCUMENT ME!
5025: */
5026: private boolean getSubMenuVisibility(String subMenuName) {
5027: Vector subMenu = new Vector();
5028: boolean visibility = false;
5029:
5030: try {
5031: for (int i = 0; i < _subItems.size(); i++) {
5032: SubItem subItem = (SubItem) _subItems.elementAt(i);
5033:
5034: if (subItem._subMenu.equals(subMenuName)) {
5035: subMenu.addElement(subItem);
5036: }
5037: }
5038:
5039: if (subMenu.size() == 0) {
5040: return true;
5041: }
5042:
5043: for (int i = 0; i < subMenu.size(); i++) {
5044: SubItem subItem = (SubItem) subMenu.elementAt(i);
5045:
5046: if (!subItem._visible) {
5047: continue;
5048: }
5049:
5050: visibility = true;
5051:
5052: break;
5053: }
5054: } catch (Exception e) {
5055: e.printStackTrace();
5056: }
5057:
5058: return visibility;
5059: }
5060:
5061: /**
5062: * DOCUMENT ME!
5063: *
5064: * @param tdLine DOCUMENT ME!
5065: * @param showPopup DOCUMENT ME!
5066: * @param bSelected DOCUMENT ME!
5067: * @param sName DOCUMENT ME!
5068: * @param sBgColor DOCUMENT ME!
5069: * @param subMenuName DOCUMENT ME!
5070: *
5071: * @return DOCUMENT ME!
5072: */
5073: private String getSubmenuMouseEvents(String tdLine,
5074: boolean showPopup, boolean bSelected, String sName,
5075: String sBgColor, String subMenuName) {
5076: //ONMOUSEOVER
5077: tdLine += "\n ONMOUSEOVER=\"";
5078:
5079: //Hover BG Color
5080: //Check if line being generated is inside a ShowPopup menu
5081: //If so DO NOT USE HOVER BG COLORS
5082: if (!showPopup) {
5083: if ((_hoverBgColor != null) && (!_hoverBgColor.equals(""))
5084: && !bSelected) {
5085: tdLine += ("this.className='" + getName()
5086: + CELLHOVERBGSTYLE + "';");
5087: } else if ((_hoverBgColor != null)
5088: && (!_hoverBgColor.equals("")) && bSelected) {
5089: tdLine += ("this.className='" + getName()
5090: + SELECTEDHOVERBGSTYLE + "';");
5091: }
5092:
5093: // }else{
5094: // tdLine += ("this.className='" + getName() + SHOWPOPUPBGSTYLE + "';");
5095: }
5096:
5097: if (isIE6()) {
5098: if (subMenuName != null) {
5099: tdLine += ("popup" + subMenuName + getName() + "ShowPopup();");
5100: }
5101:
5102: if ((_markerOverImage != null)
5103: && !_markerOverImage.trim().equals("")
5104: && _showSubMenuMarker) {
5105: tdLine += ("fnc" + getName()
5106: + "_MarkerOverImage(document.Marker" + sName
5107: + getName() + ");");
5108: }
5109: }
5110:
5111: tdLine += "event.cancelBubble=true;";
5112:
5113: //Hover Style
5114: //Check if line being generated is inside a ShowPopup menu
5115: //If so use showpopup styles
5116: if (showPopup
5117: && ((_showPopupHoverStyle != null) && (!_showPopupHoverStyle
5118: .equals("")))) {
5119: if (!bSelected) {
5120: tdLine += ("document.getElementById('" + sName
5121: + getName() + "').className='" + getName()
5122: + SHOWPOPUPHOVERSTYLE + "';\"");
5123: } else {
5124: tdLine += ("document.getElementById('" + sName
5125: + getName() + "').className='" + getName()
5126: + SHOWPOPUPSELECTEDHOVERSTYLE + "';\"");
5127: }
5128: } else if (!bSelected) {
5129: tdLine += ("document.getElementById('" + sName + getName()
5130: + "').className='" + getName() + HOVERSTYLE + "';\"");
5131: } else {
5132: tdLine += ("document.getElementById('" + sName + getName()
5133: + "').className='" + getName() + SELECTEDHOVERSTYLE + "';\"");
5134: }
5135:
5136: //ONMOUSEOUT
5137: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
5138: tdLine += " ONMOUSEOUT=\"";
5139:
5140: if ((sBgColor != null) && (!sBgColor.equals(""))) {
5141: tdLine += ("this.className='TD.{BACKGROUND:" + sBgColor
5142: + ";}" + "';");
5143: } else
5144: //Cell BG color
5145: {
5146: if (!bSelected) {
5147: if (showPopup
5148: && ((_showPopupBgColor != null) && (!_showPopupBgColor
5149: .equals("")))) {
5150: tdLine += ("this.className='" + getName()
5151: + SHOWPOPUPBGSTYLE + "';");
5152: } else {
5153: tdLine += ("this.className='" + getName()
5154: + CELLBGSTYLE + "';");
5155: }
5156:
5157: // } else {
5158: // if (showPopup && ((_showPopupBgColor != null) && (!_showPopupBgColor.equals(""))))
5159: // {
5160: // tdLine += ("this.className='" + getName() + SHOWPOPUPBGSTYLE + "';");
5161: // }
5162: // else
5163: // {
5164: // tdLine += ("this.className='" + getName() + SELECTEDBGSTYLE + "';");
5165: // }
5166: }
5167: }
5168:
5169: tdLine += "event.cancelBubble=true;";
5170:
5171: //Cell Style
5172: if (showPopup
5173: && ((_showPopupStyle != null) && (!_showPopupStyle
5174: .equals("")))) {
5175: if (!bSelected) {
5176: tdLine += ("document.getElementById('" + sName
5177: + getName() + "').className='" + getName()
5178: + SHOWPOPUPSTYLE + "';\"");
5179: } else {
5180: tdLine += ("document.getElementById('" + sName
5181: + getName() + "').className='" + getName()
5182: + SHOWPOPUPSELECTEDSTYLE + "';\"");
5183: }
5184: } else {
5185: if (!bSelected) {
5186: tdLine += ("document.getElementById('" + sName
5187: + getName() + "').className='" + getName()
5188: + HREFSTYLE + "';\"");
5189: } else {
5190: tdLine += ("document.getElementById('" + sName
5191: + getName() + "').className='" + getName()
5192: + SELECTEDSTYLE + "';\"");
5193: }
5194: }
5195:
5196: return tdLine;
5197: }
5198:
5199: /**
5200: * DOCUMENT ME!
5201: *
5202: * @param sHref DOCUMENT ME!
5203: * @param sName DOCUMENT ME!
5204: *
5205: * @return DOCUMENT ME!
5206: */
5207: private String computeHref(String sHref, String sName) {
5208: if (sHref == null) {
5209: return sHref;
5210: }
5211:
5212: sHref = encodeURL(sHref);
5213:
5214: // FC (05/06/03 11:32 AM)
5215: if (sHref.toUpperCase().startsWith("JAVASCRIPT:")) {
5216: return sHref;
5217: }
5218:
5219: if (!_autoSelectNav) {
5220: return sHref;
5221: }
5222:
5223: int qindex = sHref.indexOf('#');
5224: String zoom = "";
5225:
5226: if (qindex > -1) {
5227: zoom = sHref.substring(qindex);
5228: sHref = sHref.substring(0, qindex);
5229: }
5230:
5231: qindex = sHref.indexOf('?');
5232:
5233: if (qindex > -1) {
5234: sHref += ("&" + NAVBARID + "=" + sName + zoom);
5235: } else {
5236: // SC (10/10/02 3:01:04 PM)
5237: sHref += ("?" + NAVBARID + "=" + sName + zoom);
5238: }
5239:
5240: return sHref;
5241: }
5242:
5243: /**
5244: * Create the Div section for the submenu that will be popped up when hovering over an item
5245: *
5246: * @param sSubMenu DOCUMENT ME!
5247: * @param sItemName DOCUMENT ME!
5248: * @param sSubGroupName DOCUMENT ME!
5249: *
5250: * @return DOCUMENT ME!
5251: */
5252: private String createPopupDiv(String sSubMenu, String sItemName,
5253: String sSubGroupName) {
5254: Vector subChildren = new Vector();
5255: StringBuffer sScript = new StringBuffer();
5256:
5257: //Separate style tag did not work in the pages where more than 1 navbar is used. Therefore moved the stype inside the div tag. 10/7/02
5258: /*sScript.append("\n<STYLE type=\"text/css\">#popup" + sSubMenu + getName());
5259: sScript.append("\n{position:absolute;top:0px;left:0px;width:150px;visibility:hidden;z-index:0;}");
5260: sScript.append("\n</STYLE>");*/
5261: sScript.append("\n<DIV id=\"popup" + sSubMenu + getName()
5262: + "\"");
5263: sScript
5264: .append(" style='position:absolute;top:0px;left:0px;width:150px;visibility:hidden;z-index:0;' >");
5265: sScript.append("\n<TABLE WIDTH=\"100" + _sPctSign
5266: + "\" BORDER=\"0\" BGCOLOR=\"" + _bgColor
5267: + "\" CELLPADDING=\"" + _cellPadding
5268: + "\" CELLSPACING=\"" + _cellSpacing + "\">");
5269:
5270: for (int k = 1; k <= _subItems.size(); k++) {
5271: boolean _sVisible = ((SubItem) _subItems.elementAt(k - 1))._visible;
5272: String subGroupName = ((SubItem) _subItems.elementAt(k - 1))._subMenuGroup;
5273:
5274: if (subGroupName.equals(sSubMenu) && _sVisible) {
5275: String sName = ((SubItem) _subItems.elementAt(k - 1))._name;
5276: String sTitle = ((SubItem) _subItems.elementAt(k - 1))._title;
5277: String sHref = ((SubItem) _subItems.elementAt(k - 1))._href;
5278: String sTarget = ((SubItem) _subItems.elementAt(k - 1))._target;
5279: String sBgColor = ((SubItem) _subItems.elementAt(k - 1))._subItemBgColor;
5280: int sHspace = ((SubItem) _subItems.elementAt(k - 1))._horizPadding;
5281: String subSubName = ((SubItem) _subItems
5282: .elementAt(k - 1))._subMenu;
5283: sScript.append("\n<TR>");
5284:
5285: if ((subSubName != null)
5286: && (!subSubName.equals(sSubMenu)) && _sVisible) {
5287: if ((sBgColor == null) && (_subMenuBgColor != null)) {
5288: sBgColor = _subMenuBgColor;
5289: }
5290:
5291: //sScript.append(generateTDSubMenuLine(sName, sHref, sTitle, sTarget, sHspace, subSubName, subGroupName, sBgColor, true, false));
5292: sScript.append(generateTDFlyoutSubMenuLine(sName,
5293: sHref, sTitle, sTarget, sHspace,
5294: subSubName, subGroupName, sBgColor, false,
5295: false));
5296: subChildren.addElement(subSubName);
5297: } else {
5298: if ((sBgColor == null) && (_subMenuBgColor != null)) {
5299: sBgColor = _subMenuBgColor;
5300: }
5301:
5302: //sScript.append(generateTDLine(sName, sHref, sTitle, sTarget, sHspace, sBgColor, true));
5303: sScript.append(generateTDFlyoutLine(sName, sHref,
5304: sTitle, sTarget, sHspace, sBgColor, false));
5305: }
5306:
5307: sScript.append("\n</TR>");
5308: }
5309: }
5310:
5311: sScript.append("</TABLE></DIV>");
5312: sScript.append(getSubMenuPopupScript(sSubMenu, sItemName,
5313: sSubGroupName, subChildren));
5314:
5315: return sScript.toString();
5316: }
5317:
5318: /**
5319: * Create Scriot for all submenus
5320: *
5321: * @param p DOCUMENT ME!
5322: */
5323: private void createSubMenuScript(TagWriter p) {
5324: StringBuffer sScript = new StringBuffer();
5325: _vPopups = new Vector();
5326:
5327: Vector vHidePopups = new Vector();
5328:
5329: //
5330: StringBuffer sbFirstLevelMenusAnchors = new StringBuffer();
5331:
5332: for (int i = 1; i <= _groups.size(); i++) {
5333: if (((Group) _groups.elementAt(i - 1))._visible == false) {
5334: continue;
5335: }
5336:
5337: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
5338: .size(); j++) {
5339: if (((Item) ((Group) _groups.elementAt(i - 1))._items
5340: .elementAt(j - 1))._visible == false) {
5341: continue;
5342: }
5343:
5344: String sItemName = ((Item) ((Group) _groups
5345: .elementAt(i - 1))._items.elementAt(j - 1))._name;
5346: String sItemMenu = ((Item) ((Group) _groups
5347: .elementAt(i - 1))._items.elementAt(j - 1))._submenu;
5348: boolean sItemShowPopup = ((Item) ((Group) _groups
5349: .elementAt(i - 1))._items.elementAt(j - 1))._showPopup;
5350:
5351: if ((sItemMenu != null)
5352: && (_vPopups.indexOf(sItemMenu) < 0)) {
5353: if (sItemShowPopup) {
5354: if (isNavBarItem(sItemName)) {
5355: sbFirstLevelMenusAnchors
5356: .append("document.getElementById(\"");
5357: sbFirstLevelMenusAnchors.append(sItemMenu);
5358: sbFirstLevelMenusAnchors.append(sItemName
5359: + getName());
5360: sbFirstLevelMenusAnchors.append("\")");
5361: sbFirstLevelMenusAnchors.append(" ,");
5362: }
5363:
5364: sScript.append(createPopupDiv(sItemMenu,
5365: getPopupItem(sItemMenu), sItemMenu));
5366: _vPopups.addElement(sItemMenu);
5367: } else {
5368: vHidePopups.addElement(sItemMenu);
5369: }
5370: } else {
5371: if (isNavBarItem(sItemName)) {
5372: sbFirstLevelMenusAnchors
5373: .append("document.getElementById(\"");
5374: sbFirstLevelMenusAnchors.append(sItemName
5375: + getName());
5376: sbFirstLevelMenusAnchors.append("\")");
5377: sbFirstLevelMenusAnchors.append(" ,");
5378: }
5379: }
5380: }
5381: }
5382:
5383: for (int k = 1; k <= _subItems.size(); k++) {
5384: boolean _sVisible = ((SubItem) _subItems.elementAt(k - 1))._visible;
5385: String subSubName = ((SubItem) _subItems.elementAt(k - 1))._subMenu;
5386: String subGroupName = ((SubItem) _subItems.elementAt(k - 1))._subMenuGroup;
5387:
5388: if ((subSubName != null)
5389: && (_vPopups.indexOf(subSubName) < 0) && _sVisible
5390: && (vHidePopups.indexOf(subSubName) == -1)) {
5391: sScript.append(createPopupDiv(subSubName,
5392: getPopupItem(subSubName), subGroupName));
5393: _vPopups.addElement(subSubName);
5394: }
5395: }
5396:
5397: sScript.append("\n<SCRIPT language=JavaScript1.2> ");
5398: sScript.append("\n");
5399: sScript.append("\n function " + getName()
5400: + "getMaxHeight(subRet){");
5401: sScript.append("\n var aryMaxH = [");
5402:
5403: if (sbFirstLevelMenusAnchors.length() > 0) {
5404: sScript.append(sbFirstLevelMenusAnchors.substring(0,
5405: sbFirstLevelMenusAnchors.length() - 2));
5406: }
5407:
5408: sScript.append("\n];");
5409:
5410: sScript.append("\nvar arlen = aryMaxH.length; ");
5411: sScript.append("\nvar retVal = 0; ");
5412: sScript.append("\nfor (i=0;i<arlen;i++){ ");
5413: sScript.append(" var obj = aryMaxH[i]; ");
5414: sScript.append(" var tempH = 0; ");
5415: sScript.append(" if(obj==null || obj=='undefined') ");
5416: sScript.append(" continue; ");
5417: sScript.append(" else ");
5418: sScript.append(" tempH = obj.offsetHeight; ");
5419: sScript.append(" if(retVal < tempH) ");
5420: sScript.append(" retVal = tempH; ");
5421: sScript.append("\n} ");
5422: sScript.append("\nif(retVal<subRet) ");
5423: sScript.append("\n return subRet;");
5424: sScript.append("\nelse");
5425: sScript.append("\n return retVal; ");
5426: sScript.append("\n}");
5427: sScript.append("\n</SCRIPT>");
5428:
5429: try {
5430: p.println(sScript.toString());
5431: p.println(getSubMenuMouseScript(_vPopups));
5432: } catch (Exception e) {
5433: }
5434:
5435: return;
5436: }
5437:
5438: /**
5439: *
5440: */
5441: private String generateTDFlyoutLine(String sName, String sHref,
5442: String sTitle, String sTarget, int sHpad, String sBgColor,
5443: boolean showPopup) {
5444: String tdLine = "";
5445:
5446: //onmouseover and onmouse out with document.getElementByID... does not work on NS6. THerefore move it to the next anchor.
5447: StringBuffer sbNS6TDLine = new StringBuffer();
5448:
5449: //HREF GIVE EACH NAVBARITEM A UNIQUE NAME AND SAVE IT IN THE NAVBARID PARAMETER
5450: sHref = computeHref(sHref, sName);
5451:
5452: //
5453: //SET THE MOUSEOVER,MOUSEOUT AND CLASS FOR THE TD
5454: if ((sTarget != null) && (sTarget.length() > 0)) {
5455: tdLine = "<TD ONCLICK=\"window.open('" + sHref + "');\"";
5456: }
5457:
5458: // SC (10/10/02 3:12:57 PM)
5459: else if (sHref.toUpperCase().startsWith("JAVASCRIPT:")) {
5460: tdLine = "<TD ONCLICK=\"" + sHref + "\"";
5461: } else {
5462: tdLine = "<TD 922 ONCLICK=\"document.location='" + sHref
5463: + "';\"";
5464: }
5465:
5466: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
5467: if (!((getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) || (getPage()
5468: .getBrowserOS() == HtmlPage.BROWSER_OS_MAC))
5469: && !isIE6()) {
5470: tdLine = getIETDFlyoutLine(tdLine, showPopup, sName,
5471: sBgColor);
5472: } else if (!isNetscapeBelowV6()) {
5473: getNS45TDFlyoutLine(sbNS6TDLine, showPopup, sName, sBgColor);
5474: }
5475:
5476: //CLASS
5477: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
5478: if ((sBgColor != null) && (!sBgColor.equals(""))) {
5479: tdLine += (" BGCOLOR=\"" + sBgColor + "\" NOWRAP>");
5480: } else {
5481: if (showPopup
5482: && ((_showPopupBgColor != null) && (!_showPopupBgColor
5483: .equals("")))) {
5484: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPBGSTYLE + "\" NOWRAP>");
5485: } else {
5486: if ((_subMenuBgColor != null)
5487: && (!_subMenuBgColor.equals(""))) {
5488: tdLine += (" CLASS=\"" + getName() + SUBCELLBGSTYLE + "\" NOWRAP>");
5489: } else {
5490: tdLine += (" CLASS=\"" + getName() + CELLBGSTYLE + "\" NOWRAP>");
5491: }
5492: }
5493: }
5494:
5495: //ANCHOR
5496: if (!_dreamMode) {
5497: //HREF CLASS
5498: //LS 03/30/04
5499: //Do Not encode URL again as this was done previously by the computeHref Method
5500: // tdLine += ("\n<A HREF=\"" + encodeURL(sHref) + "\"");
5501: tdLine += ("\n<A HREF=\"" + sHref + "\"");
5502: tdLine += " ONCLICK=\"return false;\"";
5503:
5504: if (isNetscape6()) {
5505: tdLine += sbNS6TDLine.toString();
5506: }
5507:
5508: if ((_subHrefStyle != null) && (!_subHrefStyle.equals(""))) {
5509: tdLine += (" CLASS=\"" + getName() + SUBHREFSTYLE + "\">");
5510: } else {
5511: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
5512: }
5513: }
5514:
5515: //
5516: if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) {
5517: if (_navWidthPercent == null) {
5518: int navTableWidth = (_navWidth - _hSpace)
5519: - _cellPadding;
5520:
5521: if (navTableWidth <= 0) {
5522: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
5523: } else {
5524: tdLine += ("\n<TABLE WIDTH=\"" + navTableWidth + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
5525: }
5526: } else {
5527: tdLine += ("\n<TABLE WIDTH=\"" + _navWidthPercent + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
5528: }
5529: } else {
5530: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
5531: }
5532:
5533: tdLine += "\n<TR><TD";
5534: tdLine += (" WIDTH =\"5" + _sPctSign + "\">");
5535:
5536: //
5537: //IMAGE SOURCE MARKER IMAGE
5538: tdLine += ("<IMG SRC=\"" + _markerImage + "\"");
5539:
5540: if (isIE6()) {
5541: tdLine = getIETDFlyoutLine(tdLine, showPopup, sName,
5542: sBgColor);
5543: }
5544:
5545: tdLine += (" NAME=\"Marker" + sName + getName()
5546: + "\" ONLOAD=\"" + getName()
5547: + "_imageLoaded();\" BORDER=\"0\"" + " HSPACE=\"0\">");
5548:
5549: //IMAGE SOURCE NULL IMAGE BETWEEN MARKER IMAGE AND TITLE
5550: tdLine += ("<IMG SRC=\"" + _hSpaceImage + "\"");
5551: tdLine += " BORDER=\"0\"";
5552:
5553: //If a submenu(showPopup) is being inserted into the NavBar add spacing of 3 for indentation
5554: if (showPopup) {
5555: sHpad += 3;
5556: }
5557:
5558: tdLine += (" HSPACE=\"" + (sHpad + 3) + "\">");
5559:
5560: //
5561: tdLine += "\n</TD>";
5562:
5563: //
5564: //If the td line being generated is not on the navbar menu inforce no word wrap
5565: if (isNavBarItem(sName)) // && !isHorizontalMode())
5566: {
5567: tdLine += "\n<TD ";
5568: } else {
5569: tdLine += "\n<TD NOWRAP";
5570: }
5571:
5572: //
5573: tdLine += (" WIDTH =\"95" + _sPctSign + "\">");
5574:
5575: tdLine += ("<A NAME=\"" + sName + getName() + "\"");
5576:
5577: //LS 03/30/04
5578: //Do Not encode URL again as this was done previously by the computeHref Method
5579: // tdLine += (" HREF=\"" + encodeURL(sHref) + "\"");
5580: tdLine += (" HREF=\"" + sHref + "\"");
5581:
5582: if (!((isNetscapeBelowV6()))) {
5583: tdLine += " ONCLICK=\"return false;\"";
5584: }
5585:
5586: if (sTarget != null) {
5587: tdLine += (" TARGET=\"" + sTarget + "\"");
5588: }
5589:
5590: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
5591: if (!((isNetscapeBelowV6()) || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC))) {
5592: if (isIE6()) {
5593: tdLine = getIETDFlyoutLine(tdLine, showPopup, sName,
5594: sBgColor);
5595: } else {
5596: //HREF ONMOUSEOVER
5597: if ((_markerOverImage != null)
5598: && !_markerOverImage.trim().equals("")) {
5599: tdLine += (" ONMOUSEOVER=\"fnc" + getName()
5600: + "_MarkerOverImage(document.Marker"
5601: + sName + getName() + ");\" ");
5602: }
5603:
5604: //HREF ONMOUSEOUT
5605: if ((_markerOverImage != null)
5606: && !_markerOverImage.trim().equals("")) {
5607: tdLine += (" ONMOUSEOUT=\"fnc" + getName()
5608: + "_MarkerImage(document.Marker" + sName
5609: + getName() + ");\" ");
5610: }
5611: }
5612: }
5613:
5614: //HREF CLASS
5615: //If showPopup and a different style was given for the submenu in Navbar
5616: if (showPopup
5617: && ((_showPopupStyle != null) && (!_showPopupStyle
5618: .equals("")))) {
5619: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPSTYLE + "\">");
5620: } else {
5621: if ((_subHrefStyle != null) && (!_subHrefStyle.equals(""))) {
5622: tdLine += (" CLASS=\"" + getName() + SUBHREFSTYLE + "\">");
5623: } else {
5624: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
5625: }
5626: }
5627:
5628: //HREF TITLE
5629: tdLine += (sTitle + "</A>");
5630:
5631: //
5632: tdLine += "</TD>";
5633: tdLine += "</TR>";
5634: tdLine += "</TABLE>";
5635:
5636: if (!_dreamMode) {
5637: tdLine += "</A>";
5638: }
5639:
5640: tdLine += "</TD>";
5641:
5642: return tdLine;
5643: }
5644:
5645: /**
5646: *
5647: */
5648: private String generateTDFlyoutSubMenuLine(String sName,
5649: String sHref, String sTitle, String sTarget, int sHpad,
5650: String subMenuName, String sGroupName, String sBgColor,
5651: boolean showPopup, boolean bSelected) {
5652: String tdLine = "";
5653: String sAnchorName = sGroupName + sName;
5654:
5655: try {
5656: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
5657: sHref = computeHref(sHref, sName);
5658:
5659: if ((sTarget != null) && (sTarget.length() > 0)) {
5660: tdLine = "<TD ONCLICK=\"window.open('" + sHref
5661: + "');\"";
5662: }
5663:
5664: // SC (10/10/02 3:12:57 PM)
5665: else if (sHref.toUpperCase().startsWith("JAVASCRIPT:")) {
5666: tdLine = "<TD ONCLICK=\"" + sHref + "\"";
5667: } else {
5668: //LS 03/30/04
5669: //Do Not encode URL again as this was done previously by the computeHref Method
5670: // tdLine = "\n<TD 1409 ONCLICK=\"document.location='" + encodeURL(sHref) + "';\"";
5671: tdLine = "\n<TD 1409 ONCLICK=\"document.location='"
5672: + sHref + "';\"";
5673: }
5674: } else {
5675: tdLine = "\n<TD ONCLICK=\"return false;\"";
5676: }
5677:
5678: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
5679: if (!((isNetscapeBelowV6()) || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC))
5680: && !isIE6()) {
5681: tdLine = getFlyoutSubmenuMouseEvents(tdLine, showPopup,
5682: bSelected, sName, sBgColor, subMenuName);
5683: }
5684:
5685: //CLASS
5686: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
5687: if ((sBgColor != null) && (!sBgColor.equals(""))) {
5688: tdLine += (" BGCOLOR=\"" + sBgColor + "\" NOWRAP>");
5689: } else {
5690: if (showPopup
5691: && ((_showPopupBgColor != null) && (!_showPopupBgColor
5692: .equals("")))) {
5693: if (!bSelected) {
5694: tdLine += (" CLASS=\"" + getName()
5695: + SHOWPOPUPBGSTYLE + "\" NOWRAP>");
5696: } else {
5697: tdLine += (" CLASS=\"" + getName()
5698: + SHOWPOPUPSELECTEDSTYLE + "\" NOWRAP>");
5699: }
5700: } else if (!bSelected) {
5701: if ((_subMenuBgColor != null)
5702: && (!_subMenuBgColor.equals(""))) {
5703: tdLine += (" CLASS=\"" + getName()
5704: + SUBCELLBGSTYLE + "\" NOWRAP>");
5705: } else {
5706: tdLine += (" CLASS=\"" + getName()
5707: + CELLBGSTYLE + "\" NOWRAP>");
5708: }
5709: } else {
5710: tdLine += (" CLASS=\"" + getName()
5711: + SELECTEDBGSTYLE + "\" NOWRAP>");
5712: }
5713: }
5714:
5715: if (!_dreamMode) {
5716: tdLine += ("\n<A NAME=\"" + sAnchorName + getName()
5717: + "\" ID=\"" + sAnchorName + getName() + "\"");
5718: tdLine += " ONCLICK=\"return false;\"";
5719:
5720: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
5721: //LS 03/30/04
5722: //Do Not encode URL again as this was done previously by the computeHref Method
5723: // tdLine += (" HREF=\"" + encodeURL(sHref) + "\" ");
5724: tdLine += (" HREF=\"" + sHref + "\" ");
5725: }
5726:
5727: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
5728: if (!((isNetscapeBelowV6()) || (getPage()
5729: .getBrowserOS() == HtmlPage.BROWSER_OS_MAC))
5730: && !isIE6()) {
5731: //HREF ONMOUSEOVER
5732: String tdMOverLine = "";
5733:
5734: if (!isNetscape6()) {
5735: tdMOverLine += ("\"popup" + subMenuName
5736: + getName() + "ShowPopup();");
5737: } else {
5738: tdLine += "\"";
5739: }
5740:
5741: if ((_markerOverImage != null)
5742: && !_markerOverImage.trim().equals("")
5743: && _showSubMenuMarker) {
5744: tdMOverLine += ("fnc" + getName()
5745: + "_MarkerOverImage(document.Marker"
5746: + sName + getName() + ");");
5747: }
5748:
5749: if (!tdMOverLine.equals("")) {
5750: tdLine += ("ONMOUSEOVER=" + tdMOverLine);
5751: tdLine += "\"";
5752: }
5753:
5754: //HREF ONMOUSEOUT
5755: tdLine += "\nONMOUSEOUT=";
5756: tdLine += ("\"fnc" + getName()
5757: + "_MarkerImage(document.Marker" + sName
5758: + getName() + ");");
5759:
5760: if (!isNetscape6()) {
5761: tdLine += ("popup" + subMenuName + getName() + "Popup();");
5762: }
5763:
5764: if (showPopup
5765: && ((_showPopupStyle != null) && (!_showPopupStyle
5766: .equals("")))) {
5767: if (!bSelected) {
5768: tdLine += ("\n"
5769: + "document.getElementById('"
5770: + sName + getName()
5771: + "').className='" + getName()
5772: + SHOWPOPUPSTYLE + "';\"");
5773: } else {
5774: tdLine += ("\n"
5775: + "document.getElementById('"
5776: + sName + getName()
5777: + "').className='" + getName()
5778: + SHOWPOPUPSELECTEDSTYLE + "';\"");
5779: }
5780: } else {
5781: if ((_subHrefStyle != null)
5782: && (!_subHrefStyle.equals(""))) {
5783: tdLine += ("\n"
5784: + "document.getElementById('"
5785: + sName + getName()
5786: + "').className='" + getName()
5787: + SUBHREFSTYLE + "';\"");
5788: } else {
5789: tdLine += ("\n"
5790: + "document.getElementById('"
5791: + sName + getName()
5792: + "').className='" + getName()
5793: + HREFSTYLE + "';\"");
5794: }
5795: }
5796: }
5797:
5798: //HREF CLASS
5799: //If showPopup and a different style was given for the submenu in Navbar
5800: if (showPopup
5801: && ((_showPopupStyle != null) && (!_showPopupStyle
5802: .equals("")))) {
5803: if (!bSelected) {
5804: tdLine += (" CLASS=\"" + getName()
5805: + SHOWPOPUPSTYLE + "\">");
5806: } else {
5807: tdLine += (" CLASS=\"" + getName()
5808: + SHOWPOPUPSELECTEDSTYLE + "\">");
5809: }
5810: } else {
5811: if (!bSelected) {
5812: if ((_subHrefStyle != null)
5813: && (!_subHrefStyle.equals(""))) {
5814: tdLine += (" CLASS=\"" + getName()
5815: + SUBHREFSTYLE + "\">");
5816: } else {
5817: tdLine += (" CLASS=\"" + getName()
5818: + HREFSTYLE + "\">");
5819: }
5820: } else {
5821: tdLine += (" CLASS=\"" + getName()
5822: + SELECTEDSTYLE + "\">");
5823: }
5824: }
5825: }
5826:
5827: //
5828: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
5829: tdLine += "\n<TR><TD";
5830: tdLine += (" WIDTH =\"5" + _sPctSign + "\">");
5831:
5832: //IMAGE SOURCE MARKER IMAGE
5833: if (!isHorizontalMode() || _showSubMenuMarker
5834: || isFirstLevelSubMenu(subMenuName)) {
5835: tdLine += ("<IMG SRC=\"" + _markerImage + "\"");
5836:
5837: if (isIE6()) {
5838: tdLine = getFlyoutSubmenuMouseEvents(tdLine,
5839: showPopup, bSelected, sName, sBgColor,
5840: subMenuName);
5841: }
5842:
5843: tdLine += (" NAME=\"Marker" + sName + getName()
5844: + "\" ONLOAD=\"" + getName()
5845: + "_imageLoaded();\" BORDER=\"0\"" + " HSPACE=\"0\">");
5846: }
5847:
5848: //IMAGE SOURCE NULL IMAGE BETWEEN MARKER IMAGE AND TITLE
5849: tdLine += ("<IMG SRC=\"" + _hSpaceImage + "\"");
5850:
5851: tdLine += " BORDER=\"0\"";
5852:
5853: //If a submenu(showPopup) is being inserted into the NavBar add spacing of 3 for indentation
5854: if (showPopup) {
5855: sHpad += 3;
5856: }
5857:
5858: tdLine += (" HSPACE=\"" + (sHpad + 3) + "\">");
5859:
5860: //
5861: tdLine += "\n</TD>";
5862:
5863: //Check if Td Line is on the Navbar or is a popup submenu
5864:
5865: /*if( isHorizontalMode() && isFirstLevelSubMenu(subMenuName))
5866: tdLine += "\n<TD NOWRAP";
5867: else */
5868: if (isNavBarItem(sName)) {
5869: tdLine += "\n<TD";
5870: } else {
5871: tdLine += "\n<TD NOWRAP";
5872: }
5873:
5874: tdLine += (" WIDTH =\"95" + _sPctSign + "\">");
5875:
5876: tdLine += ("<A NAME=\"" + sName + getName() + "\" ID=\""
5877: + sName + getName() + "\"");
5878:
5879: if (isNetscape6()) {
5880: tdLine += ("ONMOUSEOVER=\"popup" + subMenuName
5881: + getName() + "ShowPopup();");
5882: ;
5883: tdLine += "\"";
5884: tdLine += "\nONMOUSEOUT=";
5885: tdLine += ("\"fnc" + getName()
5886: + "_MarkerImage(document.Marker" + sName
5887: + getName() + ");");
5888: tdLine += ("popup" + subMenuName + getName() + "Popup();");
5889:
5890: if (showPopup
5891: && ((_showPopupStyle != null) && (!_showPopupStyle
5892: .equals("")))) {
5893: if (!bSelected) {
5894: tdLine += ("\n" + "document.getElementById('"
5895: + sName + getName() + "').className='"
5896: + getName() + SHOWPOPUPSTYLE + "';\"");
5897: } else {
5898: tdLine += ("\n" + "document.getElementById('"
5899: + sName + getName() + "').className='"
5900: + getName() + SHOWPOPUPSELECTEDSTYLE + "';\"");
5901: }
5902: } else {
5903: if (!bSelected) {
5904: if ((_subHrefStyle != null)
5905: && (!_subHrefStyle.equals(""))) {
5906: tdLine += ("\n"
5907: + "document.getElementById('"
5908: + sName + getName()
5909: + "').className='" + getName()
5910: + SUBHREFSTYLE + "';\"");
5911: } else {
5912: tdLine += ("\n"
5913: + "document.getElementById('"
5914: + sName + getName()
5915: + "').className='" + getName()
5916: + HREFSTYLE + "';\"");
5917: }
5918: } else {
5919: tdLine += ("\n" + "document.getElementById('"
5920: + sName + getName() + "').className='"
5921: + getName() + SELECTEDSTYLE + "';\"");
5922: }
5923: }
5924: }
5925:
5926: if (isIE6()) {
5927: tdLine = getFlyoutSubmenuMouseEvents(tdLine, showPopup,
5928: bSelected, sName, sBgColor, subMenuName);
5929: }
5930:
5931: tdLine += " ONCLICK=\"return false;\"";
5932:
5933: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
5934: tdLine += (" HREF=\"" + sHref + "\"");
5935: }
5936:
5937: if (sTarget != null) {
5938: tdLine += (" TARGET=\"" + sTarget + "\"");
5939: }
5940:
5941: if (showPopup
5942: && ((_showPopupStyle != null) && (!_showPopupStyle
5943: .equals("")))) {
5944: if (!bSelected) {
5945: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPSTYLE + "\">");
5946: } else {
5947: tdLine += (" CLASS=\"" + getName()
5948: + SHOWPOPUPSELECTEDSTYLE + "\">");
5949: }
5950: } else {
5951: if (!bSelected) {
5952: if ((_subHrefStyle != null)
5953: && (!_subHrefStyle.equals(""))) {
5954: tdLine += (" CLASS=\"" + getName()
5955: + SUBHREFSTYLE + "\">");
5956: } else {
5957: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
5958: }
5959: } else {
5960: tdLine += (" CLASS=\"" + getName() + SELECTEDSTYLE + "\">");
5961: }
5962: }
5963:
5964: tdLine += sTitle;
5965: tdLine += "</A>";
5966: tdLine += "\n</TD>";
5967: tdLine += "\n</TR>";
5968: tdLine += "\n</TABLE>\n";
5969:
5970: if (!_dreamMode) {
5971: tdLine += "</A>";
5972: }
5973:
5974: //
5975: tdLine += "</TD>";
5976: } catch (Exception e) {
5977: MessageLog.writeErrorMessage("generateTDSubMenuLine", e,
5978: this );
5979: }
5980:
5981: return tdLine;
5982: }
5983:
5984: /**
5985: * Generates a TD lines For a NavBar item
5986: *
5987: * @param sName DOCUMENT ME!
5988: * @param sHref DOCUMENT ME!
5989: * @param sTitle DOCUMENT ME!
5990: * @param sTarget DOCUMENT ME!
5991: * @param sHpad DOCUMENT ME!
5992: * @param sBgColor DOCUMENT ME!
5993: * @param showPopup DOCUMENT ME!
5994: *
5995: * @return DOCUMENT ME!
5996: */
5997: private String generateTDLine(String sName, String sHref,
5998: String sTitle, String sTarget, int sHpad, String sBgColor,
5999: boolean showPopup) {
6000: String tdLine = "";
6001:
6002: //onmouseover and onmouse out with document.getElementByID... does not work on NS6. THerefore move it to the next anchor.
6003: StringBuffer sbNS6TDLine = new StringBuffer();
6004:
6005: //HREF GIVE EACH NAVBARITEM A UNIQUE NAME AND SAVE IT IN THE NAVBARID PARAMETER
6006: sHref = computeHref(sHref, sName);
6007:
6008: //
6009: //SET THE MOUSEOVER,MOUSEOUT AND CLASS FOR THE TD
6010: if ((sTarget != null) && (sTarget.length() > 0)) {
6011: tdLine = "<TD ONCLICK=\"window.open('" + sHref + "');\"";
6012: }
6013:
6014: // SC (10/10/02 3:12:57 PM)
6015: else if (sHref.toUpperCase().startsWith("JAVASCRIPT:")) {
6016: tdLine = "<TD ONCLICK=\"" + sHref + "\"";
6017: } else {
6018: tdLine = "<TD 922 ONCLICK=\"document.location='" + sHref
6019: + "';\"";
6020: }
6021:
6022: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
6023: if (!((getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) || (getPage()
6024: .getBrowserOS() == HtmlPage.BROWSER_OS_MAC))
6025: && !isIE6()) {
6026: tdLine = getIETDLine(tdLine, showPopup, sName, sBgColor);
6027: } else if (!isNetscapeBelowV6()) {
6028: getNS45TDLine(sbNS6TDLine, showPopup, sName, sBgColor);
6029: }
6030:
6031: //CLASS
6032: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
6033: if ((sBgColor != null) && (!sBgColor.equals(""))) {
6034: tdLine += (" BGCOLOR=\"" + sBgColor + "\" NOWRAP>");
6035: } else {
6036: if (showPopup
6037: && ((_showPopupBgColor != null) && (!_showPopupBgColor
6038: .equals("")))) {
6039: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPBGSTYLE + "\" NOWRAP>");
6040: } else {
6041: tdLine += (" CLASS=\"" + getName() + CELLBGSTYLE + "\" NOWRAP>");
6042: }
6043: }
6044:
6045: //ANCHOR
6046: if (!_dreamMode) {
6047: //HREF CLASS
6048: //LS 03/30/04
6049: //Do Not encode URL again as this was done previously by the computeHref Method
6050: // tdLine += ("\n<A HREF=\"" + encodeURL(sHref) + "\"");
6051: tdLine += ("\n<A HREF=\"" + sHref + "\"");
6052: tdLine += " ONCLICK=\"return false;\"";
6053:
6054: if (isNetscape6()) {
6055: tdLine += sbNS6TDLine.toString();
6056: }
6057:
6058: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
6059: }
6060:
6061: //
6062: if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) {
6063: if (_navWidthPercent == null) {
6064: int navTableWidth = (_navWidth - _hSpace)
6065: - _cellPadding;
6066:
6067: if (navTableWidth <= 0) {
6068: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
6069: } else {
6070: tdLine += ("\n<TABLE WIDTH=\"" + navTableWidth + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
6071: }
6072: } else {
6073: tdLine += ("\n<TABLE WIDTH=\"" + _navWidthPercent + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
6074: }
6075: } else {
6076: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
6077: }
6078:
6079: tdLine += "\n<TR><TD";
6080: tdLine += (" WIDTH =\"5" + _sPctSign + "\">");
6081:
6082: //
6083: //IMAGE SOURCE MARKER IMAGE
6084: tdLine += ("<IMG SRC=\"" + _markerImage + "\"");
6085:
6086: if (isIE6()) {
6087: tdLine = getIETDLine(tdLine, showPopup, sName, sBgColor);
6088: }
6089:
6090: tdLine += (" NAME=\"Marker" + sName + getName()
6091: + "\" ONLOAD=\"" + getName()
6092: + "_imageLoaded();\" BORDER=\"0\"" + " HSPACE=\"0\">");
6093:
6094: //IMAGE SOURCE NULL IMAGE BETWEEN MARKER IMAGE AND TITLE
6095: tdLine += ("<IMG SRC=\"" + _hSpaceImage + "\"");
6096: tdLine += " BORDER=\"0\"";
6097:
6098: //If a submenu(showPopup) is being inserted into the NavBar add spacing of 3 for indentation
6099: if (showPopup) {
6100: sHpad += 3;
6101: }
6102:
6103: tdLine += (" HSPACE=\"" + (sHpad + 3) + "\">");
6104:
6105: //
6106: tdLine += "\n</TD>";
6107:
6108: //
6109: //If the td line being generated is not on the navbar menu inforce no word wrap
6110: if (isNavBarItem(sName)) // && !isHorizontalMode())
6111: {
6112: tdLine += "\n<TD ";
6113: } else {
6114: tdLine += "\n<TD NOWRAP";
6115: }
6116:
6117: //
6118: tdLine += (" WIDTH =\"95" + _sPctSign + "\">");
6119:
6120: tdLine += ("<A NAME=\"" + sName + getName() + "\"");
6121:
6122: //LS 03/30/04
6123: //Do Not encode URL again as this was done previously by the computeHref Method
6124: // tdLine += (" HREF=\"" + encodeURL(sHref) + "\"");
6125: tdLine += (" HREF=\"" + sHref + "\"");
6126:
6127: if (!((isNetscapeBelowV6()))) {
6128: tdLine += " ONCLICK=\"return false;\"";
6129: }
6130:
6131: if (sTarget != null) {
6132: tdLine += (" TARGET=\"" + sTarget + "\"");
6133: }
6134:
6135: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
6136: if (!((isNetscapeBelowV6()) || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC))) {
6137: if (isIE6()) {
6138: tdLine = getIETDLine(tdLine, showPopup, sName, sBgColor);
6139: } else {
6140: //HREF ONMOUSEOVER
6141: if ((_markerOverImage != null)
6142: && !_markerOverImage.trim().equals("")) {
6143: tdLine += (" ONMOUSEOVER=\"fnc" + getName()
6144: + "_MarkerOverImage(document.Marker"
6145: + sName + getName() + ");\" ");
6146: }
6147:
6148: //HREF ONMOUSEOUT
6149: if ((_markerOverImage != null)
6150: && !_markerOverImage.trim().equals("")) {
6151: tdLine += (" ONMOUSEOUT=\"fnc" + getName()
6152: + "_MarkerImage(document.Marker" + sName
6153: + getName() + ");\" ");
6154: }
6155: }
6156: }
6157:
6158: //HREF CLASS
6159: //If showPopup and a different style was given for the submenu in Navbar
6160: if (showPopup
6161: && ((_showPopupStyle != null) && (!_showPopupStyle
6162: .equals("")))) {
6163: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPSTYLE + "\">");
6164: } else {
6165: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
6166: }
6167:
6168: //HREF TITLE
6169: tdLine += (sTitle + "</A>");
6170:
6171: //
6172: tdLine += "</TD>";
6173: tdLine += "</TR>";
6174: tdLine += "</TABLE>";
6175:
6176: if (!_dreamMode) {
6177: tdLine += "</A>";
6178: }
6179:
6180: tdLine += "</TD>";
6181:
6182: return tdLine;
6183: }
6184:
6185: /**
6186: * Generates a TD lines For a NavBar item and all of the Subitems associated to the Item
6187: *
6188: * @param sName DOCUMENT ME!
6189: * @param sHref DOCUMENT ME!
6190: * @param sTitle DOCUMENT ME!
6191: * @param sTarget DOCUMENT ME!
6192: * @param sHSpace DOCUMENT ME!
6193: * @param sMenuName DOCUMENT ME!
6194: * @param sBgColor DOCUMENT ME!
6195: * @param p DOCUMENT ME!
6196: *
6197: * @throws java.io.IOException DOCUMENT ME!
6198: */
6199: private void generateTDPopupInNavBarLines(String sName,
6200: String sHref, String sTitle, String sTarget, int sHSpace,
6201: String sMenuName, String sBgColor, TagWriter p)
6202: throws java.io.IOException {
6203: //PRINT OUT THE CORRECT NAVBARITEM FIRST
6204: //If The Popup Items has a background color place all items in a table and set the
6205: //BG color
6206: if (_showPopupBgColor != null) {
6207: if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) {
6208: if (_navWidthPercent == null) {
6209: int navTableWidth = (_navWidth - _hSpace)
6210: - _cellPadding;
6211: p.println("<TR BGCOLOR=\"" + _showPopupBgColor
6212: + "\">");
6213:
6214: if (navTableWidth <= 0) {
6215: p
6216: .print("<TD><TABLE BORDER=0 CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\""
6217: + _showPopupBgColor
6218: + "\" width=\"100"
6219: + _sPctSign
6220: + "\"><TR>");
6221: } else {
6222: p
6223: .print("<TD><TABLE BORDER=0 CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\""
6224: + _showPopupBgColor
6225: + "\" width=\""
6226: + navTableWidth
6227: + "\"><TR>");
6228: }
6229:
6230: sBgColor = _showPopupBgColor;
6231: sHSpace += -1;
6232: } else {
6233: p.println("<TR BGCOLOR=\"" + _showPopupBgColor
6234: + "\">");
6235: p
6236: .print("<TD><TABLE BORDER=0 CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\""
6237: + _showPopupBgColor
6238: + "\" width=\""
6239: + _navWidthPercent + "\"><TR>");
6240: sBgColor = _showPopupBgColor;
6241: sHSpace += -1;
6242: }
6243: } else {
6244: p.println("<TR BGCOLOR=\"" + _showPopupBgColor + "\">");
6245: p.print("<TD><TABLE BORDER=0 BGCOLOR=\""
6246: + _showPopupBgColor + "\" width=\"100"
6247: + _sPctSign + "\"><TR>");
6248: sBgColor = _showPopupBgColor;
6249: sHSpace += -1;
6250: }
6251: }
6252:
6253: //The (sHSpace -3) is to Prevent the first item in the ShowPopup from indenting
6254: p.println(generateTDSelectedLine(sName, sHref, sTitle, sTarget,
6255: sHSpace - 3, sBgColor, true));
6256:
6257: p.println();
6258: p.print("</TR>");
6259:
6260: //PRINT OUT THE CORRECT SUBITEM ASSOCIATED WITH THIS NAVBARITEM SUBMENU
6261: for (int k = 1; k <= _subItems.size(); k++) {
6262: boolean _sVisible = ((SubItem) _subItems.elementAt(k - 1))._visible;
6263: String subGroupName = ((SubItem) _subItems.elementAt(k - 1))._subMenuGroup;
6264:
6265: if (subGroupName.equals(sMenuName) && _sVisible) {
6266: p.println();
6267: p.print("<TR>");
6268:
6269: String subName = ((SubItem) _subItems.elementAt(k - 1))._name;
6270: String subTitle = ((SubItem) _subItems.elementAt(k - 1))._title;
6271: String subHref = ((SubItem) _subItems.elementAt(k - 1))._href;
6272: String subTarget = ((SubItem) _subItems
6273: .elementAt(k - 1))._target;
6274: String subBgColor = ((SubItem) _subItems
6275: .elementAt(k - 1))._subItemBgColor;
6276: int subHSpace = ((SubItem) _subItems.elementAt(k - 1))._horizPadding;
6277: boolean subSelected = ((SubItem) _subItems
6278: .elementAt(k - 1))._selected;
6279: String subMenuName = ((SubItem) _subItems
6280: .elementAt(k - 1))._subMenu;
6281:
6282: if ((subMenuName != subGroupName)
6283: && getSubMenuVisibility(subMenuName)
6284: && (getPage().getBrowserType() != HtmlPage.BROWSER_NETSCAPE)) {
6285: p.println(generateTDSubMenuLine(subName, subHref,
6286: subTitle, subTarget, subHSpace,
6287: subMenuName, subGroupName, subBgColor,
6288: true, subSelected));
6289: } else {
6290: if (subSelected) {
6291: p.println(generateTDSelectedLine(subName,
6292: subHref, subTitle, subTarget,
6293: subHSpace, subBgColor, true));
6294: } else if (isPage(subName) && !_oneSelected) {
6295: p.println(generateTDSelectedLine(subName,
6296: subHref, subTitle, subTarget,
6297: subHSpace, subBgColor, true));
6298: } else {
6299: if (sHref != null) {
6300: p.println(generateTDLine(subName, subHref,
6301: subTitle, subTarget, subHSpace,
6302: subBgColor, true));
6303: } else {
6304: p.println(generateTDTextLine(subName,
6305: subTitle, subHSpace));
6306: }
6307: }
6308: }
6309:
6310: p.println();
6311: p.print("</TR>");
6312: }
6313: }
6314:
6315: if (_showPopupBgColor != null) {
6316: p.println("</TABLE></TD></TR>");
6317: }
6318:
6319: return;
6320: }
6321:
6322: /**
6323: * Generates a Selected TD line inside the NavBar Table with the appropriate attributes
6324: *
6325: * @param sName DOCUMENT ME!
6326: * @param sHref DOCUMENT ME!
6327: * @param sTitle DOCUMENT ME!
6328: * @param sTarget DOCUMENT ME!
6329: * @param sHpad DOCUMENT ME!
6330: * @param sBgColor DOCUMENT ME!
6331: * @param showPopup DOCUMENT ME!
6332: *
6333: * @return DOCUMENT ME!
6334: */
6335: private String generateTDSelectedLine(String sName, String sHref,
6336: String sTitle, String sTarget, int sHpad, String sBgColor,
6337: boolean showPopup) {
6338: String tdLine = "";
6339:
6340: //HREF
6341: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
6342: sHref = computeHref(sHref, sName);
6343:
6344: if ((sTarget != null) && (sTarget.length() > 0)) {
6345: tdLine = "<TD ONCLICK=\"window.open('" + sHref
6346: + "');\"";
6347: }
6348:
6349: // SC (10/10/02 3:12:57 PM)
6350: else if (sHref.toUpperCase().startsWith("JAVASCRIPT:")) {
6351: tdLine = "<TD ONCLICK=\"" + sHref + "\"";
6352: } else {
6353: //LS 03/30/04
6354: //Do Not encode URL again as this was done previously by the computeHref Method
6355: // tdLine = "<TD 1238 ONCLICK=\"document.location='" + encodeURL(sHref) + "';\"";
6356: tdLine = "<TD 1238 ONCLICK=\"document.location='"
6357: + sHref + "';\"";
6358: }
6359: } else {
6360: tdLine = "\n<TD ONCLICK=\"return false;\"";
6361: }
6362:
6363: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
6364: if (!((isNetscapeBelowV6()) || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC))) {
6365: //ONMOUSEOVER
6366: tdLine += " ONMOUSEOVER=\"";
6367:
6368: //Selected BG Color
6369: //Check if line being generated is inside a ShowPopup menu
6370: //If so use DO NOT USE HOVER BG COLOR
6371: if (!showPopup) {
6372: if ((_selectedHoverBgColor != null)
6373: && (!_selectedHoverBgColor.equals(""))) {
6374: tdLine += ("this.className='" + getName()
6375: + SELECTEDHOVERBGSTYLE + "';");
6376: }
6377: }
6378:
6379: //
6380: //Selected Style
6381: //
6382: //Check if line being generated is inside a ShowPopup menu
6383: //If so use showpopup styles
6384: if (showPopup
6385: && ((_showPopupSelectedHoverStyle != null) && (!_showPopupSelectedHoverStyle
6386: .equals("")))) {
6387: tdLine += ("document.getElementById('" + sName
6388: + getName() + "').className='" + getName()
6389: + SHOWPOPUPSELECTEDHOVERSTYLE + "';");
6390: } else {
6391: tdLine += ("document.getElementById('" + sName
6392: + getName() + "').className='" + getName()
6393: + SELECTEDHOVERSTYLE + "';");
6394: }
6395:
6396: if ((_markerOverImage != null)
6397: && !_markerOverImage.trim().equals("")) {
6398: if ((_selectedMarkerImage != null)
6399: && !_selectedMarkerImage.trim().equals("")) {
6400: tdLine += ("fnc" + getName()
6401: + "_MarkerOverImage(document.Marker"
6402: + sName + getName() + ", true);\"");
6403: } else {
6404: tdLine += ("fnc" + getName()
6405: + "_MarkerOverImage(document.Marker"
6406: + sName + getName() + ");\"");
6407: }
6408: } else {
6409: tdLine += "\"";
6410: }
6411:
6412: //ONMOUSEOUT
6413: tdLine += " ONMOUSEOUT=\"";
6414:
6415: //Selected BG Color
6416: if ((_selectedHoverBgColor != null)
6417: && (!_selectedHoverBgColor.equals(""))) {
6418: tdLine += ("this.className='" + getName()
6419: + SELECTEDBGSTYLE + "';");
6420: }
6421:
6422: //Selected Style
6423: //STYLE
6424: if (showPopup
6425: && ((_showPopupSelectedStyle != null) && (!_showPopupSelectedStyle
6426: .equals("")))) {
6427: tdLine += ("document.getElementById('" + sName
6428: + getName() + "').className='" + getName()
6429: + SHOWPOPUPSELECTEDSTYLE + "';");
6430: } else {
6431: tdLine += ("document.getElementById('" + sName
6432: + getName() + "').className='" + getName()
6433: + SELECTEDSTYLE + "';");
6434: }
6435:
6436: if ((_selectedMarkerImage != null)
6437: && !_selectedMarkerImage.trim().equals("")) {
6438: tdLine += ("fnc" + getName()
6439: + "_SelectedMarkerImage(document.Marker"
6440: + sName + getName() + ");\"");
6441: } else {
6442: tdLine += "\"";
6443: }
6444: }
6445:
6446: //CLASS
6447: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
6448: if ((sBgColor != null) && (!sBgColor.equals(""))) {
6449: tdLine += (" BGCOLOR=\"" + sBgColor + "\" NOWRAP>");
6450: } else {
6451: if (showPopup
6452: && ((_showPopupBgColor != null) && (!_showPopupBgColor
6453: .equals("")))) {
6454: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPBGSTYLE + "\" NOWRAP>");
6455: } else if ((_selectedBgColor != null)
6456: && (!_selectedBgColor.equals(""))) {
6457: tdLine += (" CLASS=\"" + getName() + SELECTEDBGSTYLE + "\" NOWRAP>");
6458: } else {
6459: tdLine += (" CLASS=\"" + getName() + CELLBGSTYLE + "\" NOWRAP>");
6460: }
6461: }
6462:
6463: //
6464: if (!_dreamMode) {
6465: //HREF CLASS
6466: tdLine += "\n<A";
6467:
6468: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
6469: //LS 03/30/04
6470: //Do Not encode URL again as this was done previously by the computeHref Method
6471: // tdLine += (" HREF=\"" + encodeURL(sHref) + "\"");
6472: tdLine += (" HREF=\"" + sHref + "\"");
6473: }
6474:
6475: tdLine += " ONCLICK=\"return false;\"";
6476: tdLine += (" CLASS=\"" + getName() + SELECTEDSTYLE + "\">");
6477: }
6478:
6479: if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE) {
6480: if (_navWidthPercent == null) {
6481: int navTableWidth = (_navWidth - _hSpace)
6482: - _cellPadding;
6483:
6484: if (navTableWidth <= 0) {
6485: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
6486: } else {
6487: tdLine += ("\n<TABLE WIDTH=\"" + navTableWidth + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
6488: }
6489: } else {
6490: tdLine += ("\n<TABLE WIDTH=\"" + _navWidthPercent + "\" BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">");
6491: }
6492: } else {
6493: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
6494: }
6495:
6496: tdLine += "\n<TR>\n<TD";
6497: tdLine += (" WIDTH =\"5" + _sPctSign + "\">");
6498:
6499: //
6500: //IMAGE SOURCE MARKER IMAGE
6501: tdLine += ("<IMG SRC=\"" + _selectedMarkerImage + "\"");
6502: tdLine += (" NAME=\"Marker" + sName + getName()
6503: + "\" ONLOAD=\"" + getName()
6504: + "_imageLoaded();\" BORDER=\"0\"" + " HSPACE=\"0\">");
6505:
6506: //IMAGE SOURCE NULL IMAGE BETWEEN MARKER IMAGE AND TITLE
6507: tdLine += ("<IMG SRC=\"" + _hSpaceImage + "\"");
6508: tdLine += " BORDER=\"0\"";
6509:
6510: //If a submenu(showPopup) is being inserted into the NavBar add spacing of 3 for indentation
6511: if (showPopup) {
6512: sHpad += 3;
6513: }
6514:
6515: tdLine += (" HSPACE=\"" + (sHpad + 3) + "\">");
6516:
6517: tdLine += "\n</TD>";
6518:
6519: //
6520: //
6521: //IF THE TD LINE BEING GENERATED IS ON THE NAVIGATION MENU WORD WRAP ELSE NO WORD WRAP
6522: if (isNavBarItem(sName)) {
6523: tdLine += "\n<TD";
6524: } else {
6525: tdLine += "\n<TD NOWRAP";
6526: }
6527:
6528: tdLine += (" WIDTH =\"95" + _sPctSign + "\">");
6529:
6530: //HREF
6531: tdLine += ("<A NAME=\"" + sName + getName() + "\" ID=\""
6532: + sName + getName() + "\"");
6533:
6534: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
6535: //LS 03/30/04
6536: //Do Not encode URL again as this was done previously by the computeHref Method
6537: // tdLine += (" HREF=\"" + encodeURL(sHref) + "\"");
6538: tdLine += (" HREF=\"" + sHref + "\"");
6539: }
6540:
6541: if (!((isNetscapeBelowV6()))) {
6542: tdLine += " ONCLICK=\"return false;\"";
6543: }
6544:
6545: if (sTarget != null) {
6546: tdLine += (" TARGET=\"" + sTarget + "\"");
6547: }
6548:
6549: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
6550: if (!((isNetscapeBelowV6()) || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC))) {
6551: //HREF ONMOUSEOVER
6552: if ((_markerOverImage != null)
6553: && !_markerOverImage.trim().equals("")) {
6554: if ((_selectedMarkerImage != null)
6555: && !_selectedMarkerImage.trim().equals("")) {
6556: tdLine += (" ONMOUSEOVER=\"fnc" + getName()
6557: + "_MarkerOverImage(document.Marker"
6558: + sName + getName() + ", true);\" ");
6559: } else {
6560: tdLine += (" ONMOUSEOVER=\"fnc" + getName()
6561: + "_MarkerOverImage(document.Marker"
6562: + sName + getName() + ");\" ");
6563: }
6564: }
6565:
6566: //HREF ONMOUSEOUT
6567: if ((_selectedMarkerImage != null)
6568: && !_selectedMarkerImage.trim().equals("")) {
6569: tdLine += (" ONMOUSEOUT=\"fnc" + getName()
6570: + "_SelectedMarkerImage(document.Marker"
6571: + sName + getName() + ");\" ");
6572: }
6573: }
6574:
6575: //HREF CLASS
6576: if (showPopup
6577: && ((_showPopupSelectedStyle != null) && (!_showPopupSelectedStyle
6578: .equals("")))) {
6579: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPSELECTEDSTYLE + "\">");
6580: } else {
6581: tdLine += (" CLASS=\"" + getName() + SELECTEDSTYLE + "\">");
6582: }
6583:
6584: //HREF TITLE
6585: tdLine += (sTitle + "</A>");
6586:
6587: //
6588: //
6589: tdLine += "</TD>";
6590: tdLine += "</TR>";
6591: tdLine += "</TABLE>";
6592:
6593: if (!_dreamMode) {
6594: tdLine += "</A>";
6595: }
6596:
6597: tdLine += "</TD>";
6598:
6599: return tdLine;
6600: }
6601:
6602: /**
6603: * Generates a TD line For a SubMenu inside the NavBar Table with the appropriate attributes
6604: *
6605: * @param sName DOCUMENT ME!
6606: * @param sHref DOCUMENT ME!
6607: * @param sTitle DOCUMENT ME!
6608: * @param sTarget DOCUMENT ME!
6609: * @param sHpad DOCUMENT ME!
6610: * @param subMenuName DOCUMENT ME!
6611: * @param sGroupName DOCUMENT ME!
6612: * @param sBgColor DOCUMENT ME!
6613: * @param showPopup DOCUMENT ME!
6614: * @param bSelected DOCUMENT ME!
6615: *
6616: * @return DOCUMENT ME!
6617: */
6618: private String generateTDSubMenuLine(String sName, String sHref,
6619: String sTitle, String sTarget, int sHpad,
6620: String subMenuName, String sGroupName, String sBgColor,
6621: boolean showPopup, boolean bSelected) {
6622: String tdLine = "";
6623: String sAnchorName = sGroupName + sName;
6624:
6625: try {
6626: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
6627: sHref = computeHref(sHref, sName);
6628:
6629: if ((sTarget != null) && (sTarget.length() > 0)) {
6630: tdLine = "<TD ONCLICK=\"window.open('" + sHref
6631: + "');\"";
6632: }
6633:
6634: // SC (10/10/02 3:12:57 PM)
6635: else if (sHref.toUpperCase().startsWith("JAVASCRIPT:")) {
6636: tdLine = "<TD ONCLICK=\"" + sHref + "\"";
6637: } else {
6638: //LS 03/30/04
6639: //Do Not encode URL again as this was done previously by the computeHref Method
6640: // tdLine = "\n<TD 1409 ONCLICK=\"document.location='" + encodeURL(sHref) + "';\"";
6641: tdLine = "\n<TD 1409 ONCLICK=\"document.location='"
6642: + sHref + "';\"";
6643: }
6644: } else {
6645: tdLine = "\n<TD ONCLICK=\"return false;\"";
6646: }
6647:
6648: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
6649: if (!((isNetscapeBelowV6()) || (getPage().getBrowserOS() == HtmlPage.BROWSER_OS_MAC))
6650: && !isIE6()) {
6651: tdLine = getSubmenuMouseEvents(tdLine, showPopup,
6652: bSelected, sName, sBgColor, subMenuName);
6653: }
6654:
6655: //CLASS
6656: //IF A BG COLOR IS PASSED OVERIDE THE CELL BG COLOR
6657: if ((sBgColor != null) && (!sBgColor.equals(""))) {
6658: tdLine += (" BGCOLOR=\"" + sBgColor + "\" NOWRAP>");
6659: } else {
6660: if (showPopup
6661: && ((_showPopupBgColor != null) && (!_showPopupBgColor
6662: .equals("")))) {
6663: if (!bSelected) {
6664: tdLine += (" CLASS=\"" + getName()
6665: + SHOWPOPUPBGSTYLE + "\" NOWRAP>");
6666: } else {
6667: tdLine += (" CLASS=\"" + getName()
6668: + SHOWPOPUPSELECTEDSTYLE + "\" NOWRAP>");
6669: }
6670: } else if (!bSelected) {
6671: tdLine += (" CLASS=\"" + getName() + CELLBGSTYLE + "\" NOWRAP>");
6672: } else {
6673: tdLine += (" CLASS=\"" + getName()
6674: + SELECTEDBGSTYLE + "\" NOWRAP>");
6675: }
6676: }
6677:
6678: if (!_dreamMode) {
6679: tdLine += ("\n<A NAME=\"" + sAnchorName + getName()
6680: + "\" ID=\"" + sAnchorName + getName() + "\"");
6681: tdLine += " ONCLICK=\"return false;\"";
6682:
6683: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
6684: //LS 03/30/04
6685: //Do Not encode URL again as this was done previously by the computeHref Method
6686: // tdLine += (" HREF=\"" + encodeURL(sHref) + "\" ");
6687: tdLine += (" HREF=\"" + sHref + "\" ");
6688: }
6689:
6690: //If Browser Type is NETSCAPE OR OS IS MAC DO NOT CODE MOUSEOVER AND MOUSEOUT
6691: if (!((isNetscapeBelowV6()) || (getPage()
6692: .getBrowserOS() == HtmlPage.BROWSER_OS_MAC))
6693: && !isIE6()) {
6694: //HREF ONMOUSEOVER
6695: String tdMOverLine = "";
6696:
6697: if (!isNetscape6()) {
6698: tdMOverLine += ("\"popup" + subMenuName
6699: + getName() + "ShowPopup();");
6700: } else {
6701: tdLine += "\"";
6702: }
6703:
6704: if ((_markerOverImage != null)
6705: && !_markerOverImage.trim().equals("")
6706: && _showSubMenuMarker) {
6707: tdMOverLine += ("fnc" + getName()
6708: + "_MarkerOverImage(document.Marker"
6709: + sName + getName() + ");");
6710: }
6711:
6712: if (!tdMOverLine.equals("")) {
6713: tdLine += ("ONMOUSEOVER=" + tdMOverLine);
6714: tdLine += "\"";
6715: }
6716:
6717: //HREF ONMOUSEOUT
6718: tdLine += "\nONMOUSEOUT=";
6719: tdLine += ("\"fnc" + getName()
6720: + "_MarkerImage(document.Marker" + sName
6721: + getName() + ");");
6722:
6723: if (!isNetscape6()) {
6724: tdLine += ("popup" + subMenuName + getName() + "Popup();");
6725: }
6726:
6727: if (showPopup
6728: && ((_showPopupStyle != null) && (!_showPopupStyle
6729: .equals("")))) {
6730: if (!bSelected) {
6731: tdLine += ("\n"
6732: + "document.getElementById('"
6733: + sName + getName()
6734: + "').className='" + getName()
6735: + SHOWPOPUPSTYLE + "';\"");
6736: } else {
6737: tdLine += ("\n"
6738: + "document.getElementById('"
6739: + sName + getName()
6740: + "').className='" + getName()
6741: + SHOWPOPUPSELECTEDSTYLE + "';\"");
6742: }
6743: } else {
6744: tdLine += ("\n" + "document.getElementById('"
6745: + sName + getName() + "').className='"
6746: + getName() + HREFSTYLE + "';\"");
6747: }
6748: }
6749:
6750: //HREF CLASS
6751: //If showPopup and a different style was given for the submenu in Navbar
6752: if (showPopup
6753: && ((_showPopupStyle != null) && (!_showPopupStyle
6754: .equals("")))) {
6755: if (!bSelected) {
6756: tdLine += (" CLASS=\"" + getName()
6757: + SHOWPOPUPSTYLE + "\">");
6758: } else {
6759: tdLine += (" CLASS=\"" + getName()
6760: + SHOWPOPUPSELECTEDSTYLE + "\">");
6761: }
6762: } else {
6763: if (!bSelected) {
6764: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
6765: } else {
6766: tdLine += (" CLASS=\"" + getName()
6767: + SELECTEDSTYLE + "\">");
6768: }
6769: }
6770: }
6771:
6772: //
6773: tdLine += ("\n<TABLE WIDTH=\"100" + _sPctSign + "\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
6774: tdLine += "\n<TR><TD";
6775: tdLine += (" WIDTH =\"5" + _sPctSign + "\">");
6776:
6777: //IMAGE SOURCE MARKER IMAGE
6778: if (!isHorizontalMode() || _showSubMenuMarker
6779: || isFirstLevelSubMenu(subMenuName)) {
6780: tdLine += ("<IMG SRC=\"" + _markerImage + "\"");
6781:
6782: if (isIE6()) {
6783: tdLine = getSubmenuMouseEvents(tdLine, showPopup,
6784: bSelected, sName, sBgColor, subMenuName);
6785: }
6786:
6787: tdLine += (" NAME=\"Marker" + sName + getName()
6788: + "\" ONLOAD=\"" + getName()
6789: + "_imageLoaded();\" BORDER=\"0\"" + " HSPACE=\"0\">");
6790: }
6791:
6792: //IMAGE SOURCE NULL IMAGE BETWEEN MARKER IMAGE AND TITLE
6793: tdLine += ("<IMG SRC=\"" + _hSpaceImage + "\"");
6794:
6795: tdLine += " BORDER=\"0\"";
6796:
6797: //If a submenu(showPopup) is being inserted into the NavBar add spacing of 3 for indentation
6798: if (showPopup) {
6799: sHpad += 3;
6800: }
6801:
6802: tdLine += (" HSPACE=\"" + (sHpad + 3) + "\">");
6803:
6804: //
6805: tdLine += "\n</TD>";
6806:
6807: //Check if Td Line is on the Navbar or is a popup submenu
6808:
6809: /*if( isHorizontalMode() && isFirstLevelSubMenu(subMenuName))
6810: tdLine += "\n<TD NOWRAP";
6811: else */
6812: if (isNavBarItem(sName)) {
6813: tdLine += "\n<TD";
6814: } else {
6815: tdLine += "\n<TD NOWRAP";
6816: }
6817:
6818: tdLine += (" WIDTH =\"95" + _sPctSign + "\">");
6819:
6820: tdLine += ("<A NAME=\"" + sName + getName() + "\" ID=\""
6821: + sName + getName() + "\"");
6822:
6823: if (isNetscape6()) {
6824: tdLine += ("ONMOUSEOVER=\"popup" + subMenuName
6825: + getName() + "ShowPopup();");
6826: ;
6827: tdLine += "\"";
6828: tdLine += "\nONMOUSEOUT=";
6829: tdLine += ("\"fnc" + getName()
6830: + "_MarkerImage(document.Marker" + sName
6831: + getName() + ");");
6832: tdLine += ("popup" + subMenuName + getName() + "Popup();");
6833:
6834: if (showPopup
6835: && ((_showPopupStyle != null) && (!_showPopupStyle
6836: .equals("")))) {
6837: if (!bSelected) {
6838: tdLine += ("\n" + "document.getElementById('"
6839: + sName + getName() + "').className='"
6840: + getName() + SHOWPOPUPSTYLE + "';\"");
6841: } else {
6842: tdLine += ("\n" + "document.getElementById('"
6843: + sName + getName() + "').className='"
6844: + getName() + SHOWPOPUPSELECTEDSTYLE + "';\"");
6845: }
6846: } else {
6847: if (!bSelected) {
6848: tdLine += ("\n" + "document.getElementById('"
6849: + sName + getName() + "').className='"
6850: + getName() + HREFSTYLE + "';\"");
6851: } else {
6852: tdLine += ("\n" + "document.getElementById('"
6853: + sName + getName() + "').className='"
6854: + getName() + SELECTEDSTYLE + "';\"");
6855: }
6856: }
6857: }
6858:
6859: if (isIE6()) {
6860: tdLine = getSubmenuMouseEvents(tdLine, showPopup,
6861: bSelected, sName, sBgColor, subMenuName);
6862: }
6863:
6864: tdLine += " ONCLICK=\"return false;\"";
6865:
6866: if (!Util.isNull(sHref) && !Util.isEmpty(sHref)) {
6867: tdLine += (" HREF=\"" + sHref + "\"");
6868: }
6869:
6870: if (sTarget != null) {
6871: tdLine += (" TARGET=\"" + sTarget + "\"");
6872: }
6873:
6874: if (showPopup
6875: && ((_showPopupStyle != null) && (!_showPopupStyle
6876: .equals("")))) {
6877: if (!bSelected) {
6878: tdLine += (" CLASS=\"" + getName() + SHOWPOPUPSTYLE + "\">");
6879: } else {
6880: tdLine += (" CLASS=\"" + getName()
6881: + SHOWPOPUPSELECTEDSTYLE + "\">");
6882: }
6883: } else {
6884: if (!bSelected) {
6885: tdLine += (" CLASS=\"" + getName() + HREFSTYLE + "\">");
6886: } else {
6887: tdLine += (" CLASS=\"" + getName() + SELECTEDSTYLE + "\">");
6888: }
6889: }
6890:
6891: tdLine += sTitle;
6892: tdLine += "</A>";
6893: tdLine += "\n</TD>";
6894: tdLine += "\n</TR>";
6895: tdLine += "\n</TABLE>\n";
6896:
6897: if (!_dreamMode) {
6898: tdLine += "</A>";
6899: }
6900:
6901: //
6902: tdLine += "</TD>";
6903: } catch (Exception e) {
6904: MessageLog.writeErrorMessage("generateTDSubMenuLine", e,
6905: this );
6906: }
6907:
6908: return tdLine;
6909: }
6910:
6911: /**
6912: * Generates a TD That is not a Href (plain Text) line inside the NavBar Table with the appropriate attributes
6913: *
6914: * @param sName DOCUMENT ME!
6915: * @param sTitle DOCUMENT ME!
6916: * @param sHpad DOCUMENT ME!
6917: *
6918: * @return DOCUMENT ME!
6919: */
6920: private String generateTDTextLine(String sName, String sTitle,
6921: int sHpad) {
6922: String tdLine = "";
6923:
6924: tdLine = "<TD CLASS=" + getName() + CELLBGSTYLE + " NOWRAP>";
6925: tdLine += ("<IMG SRC=\"" + _textImage + "\"");
6926: tdLine += (" NAME=\"Marker" + sName + getName()
6927: + "\" BORDER=\"0\"" + " HSPACE=\"" + sHpad + "\">");
6928: tdLine += ("<SPAN CLASS=\"" + getName() + TEXTSTYLE + "\">"
6929: + sTitle + "</SPAN></TD>");
6930:
6931: return tdLine;
6932: }
6933:
6934: /**
6935: * Check if Current Item is selected
6936: *
6937: * @return boolean
6938: */
6939: private boolean oneSelected() {
6940: boolean selected = false;
6941:
6942: for (int i = 1; i <= _groups.size(); i++) {
6943: if (((Group) _groups.elementAt(i - 1))._visible == false) {
6944: continue;
6945: }
6946:
6947: for (int j = 1; j <= ((Group) _groups.elementAt(i - 1))._items
6948: .size(); j++) {
6949: if (((Item) ((Group) _groups.elementAt(i - 1))._items
6950: .elementAt(j - 1))._visible == false) {
6951: continue;
6952: }
6953:
6954: boolean sSelected = ((Item) ((Group) _groups
6955: .elementAt(i - 1))._items.elementAt(j - 1))._selected;
6956:
6957: if (sSelected) {
6958: return true;
6959: }
6960: }
6961: }
6962:
6963: return selected;
6964: }
6965:
6966: /**
6967: * DOCUMENT ME!
6968: *
6969: * @param sScript DOCUMENT ME!
6970: * @param subMenu DOCUMENT ME!
6971: *
6972: * @return DOCUMENT ME!
6973: */
6974: private StringBuffer writeNS6getPixelLeftFunc(StringBuffer sScript,
6975: String subMenu) {
6976: sScript.append("\n function popup" + subMenu + getName()
6977: + "getPixelLeft(htmlElementLeft)");
6978: sScript.append("\n { ");
6979: sScript.append("\n xPos = htmlElementLeft.offsetLeft;");
6980: sScript.append("\n tempEl = htmlElementLeft.offsetParent;");
6981: sScript.append("\n while (tempEl != null) {");
6982: sScript.append("\n xPos += tempEl.offsetLeft;");
6983: sScript.append("\n tempEl = tempEl.offsetParent;");
6984: sScript.append("\n } ");
6985: sScript.append("\n return xPos;");
6986: sScript.append("\n } ");
6987:
6988: return sScript;
6989: }
6990:
6991: /**
6992: * DOCUMENT ME!
6993: *
6994: * @param sScript DOCUMENT ME!
6995: * @param subMenu DOCUMENT ME!
6996: *
6997: * @return DOCUMENT ME!
6998: */
6999: private StringBuffer writeNS6getPixelTopFunc(StringBuffer sScript,
7000: String subMenu) {
7001: sScript.append("\n function popup" + subMenu + getName()
7002: + "getPixelTop(htmlElementTop)");
7003: sScript.append("\n { ");
7004: sScript.append("\n yPos = htmlElementTop.offsetTop;");
7005: sScript.append("\n tempEl = htmlElementTop.offsetParent;");
7006: sScript.append("\n while (tempEl != null) {");
7007: sScript.append("\n yPos += tempEl.offsetTop;");
7008: sScript.append("\n tempEl = tempEl.offsetParent;");
7009: sScript.append("\n } ");
7010: sScript.append("\n return yPos;");
7011: sScript.append("\n } ");
7012:
7013: return sScript;
7014: }
7015:
7016: /////////////
7017: public class Group implements java.io.Serializable {
7018: String _bgColor;
7019: String _groupHoverStyle;
7020:
7021: // Saqib Chowdhry Jul 30, 2003 (11:34:12 AM)
7022: // adding more variables for greater flexibility
7023: String _groupHrefStyle;
7024: String _groupTitle;
7025: String _href;
7026: String _image;
7027: String _name;
7028: Vector _items;
7029: boolean _expanded = true;
7030: boolean _selected = false;
7031: boolean _visible = true;
7032: int _vertPadding;
7033: }
7034:
7035: public class Item implements java.io.Serializable {
7036: String _href;
7037: String _itemBgcolor;
7038: String _name;
7039: String _submenu;
7040: String _target;
7041: String _title;
7042: boolean _selected = false;
7043: boolean _showPopup;
7044: boolean _visible = true;
7045: int _horizPadding;
7046: }
7047:
7048: public class SubItem implements java.io.Serializable {
7049: String _href;
7050: String _name;
7051: String _subItemBgColor;
7052: String _subMenu;
7053: String _subMenuGroup;
7054: String _target;
7055: String _title;
7056: boolean _selected = false;
7057: boolean _visible = true;
7058: int _horizPadding;
7059: }
7060: }
|