Source Code Cross Referenced for NavigationMenu.java in  » J2EE » Sofia » com » salmonllc » gui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Sofia » com.salmonllc.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.gui;
0021:
0022:        /////////////////////////
0023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/gui/NavigationMenu.java $
0024:        //$Author: Dan $
0025:        //$Revision: 83 $
0026:        //$Modtime: 6/11/03 4:37p $
0027:        /////////////////////////
0028:
0029:        /**
0030:         * Licensed Material - Property of Salmon LLC
0031:         * (C) Copyright Salmon LLC. 1999 - All Rights Reserved
0032:         * For more information go to www.salmonllc.com
0033:         *
0034:         * *************************************************************************
0035:         * DISCLAIMER:
0036:         * The following code has been created by Salmon LLC. The code is provided
0037:         * 'AS IS' , without warranty of any kind unless covered in another agreement
0038:         * between your corporation and Salmon LLC.  Salmon LLC shall not be liable
0039:         * for any damages arising out of your use of this, even if they have been
0040:         * advised of the possibility of such damages.
0041:         * *************************************************************************
0042:         *
0043:         */
0044:
0045:        import java.util.*;
0046:
0047:        import com.salmonllc.html.*;
0048:        import com.salmonllc.properties.Props;
0049:
0050:        /**
0051:         * Creates a navigation menu for a web site
0052:         */
0053:        public class NavigationMenu extends HtmlContainer {
0054:            // If a new mode is added be sure to define it sequentially.
0055:            Hashtable _nav;
0056:            String _groupname;
0057:            HtmlTable _table;
0058:            HtmlStyle _linkstyle, _linkhoverstyle, _linkcellhoverstyle,
0059:                    _cellStyle, _cellHoverStyle, _selectedCellStyle,
0060:                    _selectedStyle, _selectedHoverStyle,
0061:                    _selectedCellHoverStyle, _fontStyle;
0062:            HtmlStyle _linkfontstyle, _linkfonthoverstyle, _selectedFontStyle,
0063:                    _selectedFontHoverStyle;
0064:            int _selectedGroupIndex = -1;
0065:            int _selectedItemIndex = -1;
0066:            int _sizeOption = 0;
0067:            int _width = 100;
0068:            int _layerwidth = 100;
0069:            String _selectedItemMarkerImg, _selectedItemMarkerMouseOverImg,
0070:                    _itemMarkerImg, _itemTitleMarkerImg,
0071:                    _itemMarkerMouserOverImg;
0072:            HtmlLayer _layer;
0073:            boolean _enableLayer = false;
0074:            Vector _groups;
0075:            int _NavTableBorder, _NavTableCellSpacing, _NavTableCellPadding,
0076:                    _NavTableLayerWidth, _NavTableLayerHeight,
0077:                    _NavTableLayerTop, _NavTableLayerLeft;
0078:            String _NavTableBackgroundColor;
0079:            String _cellAlign;
0080:            String _cellVertAlign;
0081:            boolean _wrap;
0082:            boolean _disableCellLink;
0083:            String _cellBackgroundColor;
0084:            Vector _popups = new Vector();
0085:            private String _parentgroup;
0086:            private boolean _useParentAttributes = false;
0087:
0088:            private class Group implements  NavigationGroupInterface {
0089:                String _image;
0090:                int _vertPadding;
0091:                Vector _items = new Vector();
0092:                boolean _visible = true;
0093:                String _href;
0094:
0095:                public String getImage() {
0096:                    return _image;
0097:                }
0098:
0099:                public void setImage(String sImage) {
0100:                    _image = sImage;
0101:                }
0102:
0103:                public int getVertPadding() {
0104:                    return _vertPadding;
0105:                }
0106:
0107:                public void setVertPadding(int iVertPadding) {
0108:                    _vertPadding = iVertPadding;
0109:                }
0110:
0111:                public boolean getVisible() {
0112:                    return _visible;
0113:                }
0114:
0115:                public void setVisible(boolean bVisible) {
0116:                    _visible = bVisible;
0117:                }
0118:
0119:                public NavigationItemInterface[] getItems() {
0120:                    if (_items == null || _items.size() == 0)
0121:                        return null;
0122:                    NavigationItemInterface[] aNii = new NavigationItemInterface[_items
0123:                            .size()];
0124:                    _items.toArray(aNii);
0125:                    return aNii;
0126:                }
0127:
0128:                public NavigationItemInterface addItem(String submenu,
0129:                        String title, String href, String target,
0130:                        int horizPadding) {
0131:                    Item item = new Item();
0132:                    item._title = title;
0133:                    item._horizPadding = horizPadding;
0134:                    item._href = href;
0135:                    item._target = target;
0136:                    item._submenu = submenu;
0137:                    _items.addElement(item);
0138:                    return item;
0139:                }
0140:
0141:                public NavigationItemInterface insertItemAt(String submenu,
0142:                        String title, String href, String target,
0143:                        int horizPadding, int iLocation) {
0144:                    Item item = new Item();
0145:                    item._title = title;
0146:                    item._horizPadding = horizPadding;
0147:                    item._href = href;
0148:                    item._target = target;
0149:                    item._submenu = submenu;
0150:                    _items.insertElementAt(item, iLocation - 1);
0151:                    return item;
0152:                }
0153:
0154:                public NavigationItemInterface insertItemAt(String submenu,
0155:                        String title, String href, String target,
0156:                        int horizPadding,
0157:                        NavigationItemInterface niiInsertBefore) {
0158:                    Item item = new Item();
0159:                    item._title = title;
0160:                    item._horizPadding = horizPadding;
0161:                    item._href = href;
0162:                    item._target = target;
0163:                    item._submenu = submenu;
0164:                    _items.insertElementAt(item, _items
0165:                            .indexOf((Item) niiInsertBefore));
0166:                    return item;
0167:                }
0168:
0169:                public String getHRef() {
0170:                    return _href;
0171:                }
0172:
0173:                public void setHRef(String sHRef) {
0174:                    _href = sHRef;
0175:                }
0176:
0177:                public void collapse() {
0178:                    for (int i = 0; i < _items.size(); i++)
0179:                        ((Item) _items.elementAt(i))._visible = false;
0180:                }
0181:
0182:                public void contract() {
0183:                    collapse();
0184:                }
0185:
0186:                public void expand() {
0187:                    for (int i = 0; i < _items.size(); i++)
0188:                        ((Item) _items.elementAt(i))._visible = true;
0189:                }
0190:
0191:            }
0192:
0193:            private class Item implements  NavigationItemInterface {
0194:                String _title;
0195:                String _target;
0196:                String _href;
0197:                String _submenu;
0198:                int _horizPadding;
0199:                boolean _visible = true;
0200:
0201:                public String getTitle() {
0202:                    return _title;
0203:                }
0204:
0205:                public void setTitle(String sTitle) {
0206:                    _title = sTitle;
0207:                }
0208:
0209:                public String getTarget() {
0210:                    return _target;
0211:                }
0212:
0213:                public void setTarget(String sTarget) {
0214:                    _target = sTarget;
0215:                }
0216:
0217:                public String getHRef() {
0218:                    return _href;
0219:                }
0220:
0221:                public void setHRef(String sHRef) {
0222:                    _href = sHRef;
0223:                }
0224:
0225:                public String getSubMenu() {
0226:                    return _submenu;
0227:                }
0228:
0229:                public void setSubMenu(String sSubMenu) {
0230:                    _submenu = sSubMenu;
0231:                }
0232:
0233:                public int getHorizPadding() {
0234:                    return _horizPadding;
0235:                }
0236:
0237:                public void setHorizPadding(int iHorizPadding) {
0238:                    _horizPadding = iHorizPadding;
0239:                }
0240:
0241:                public boolean getVisible() {
0242:                    return _visible;
0243:                }
0244:
0245:                public void setVisible(boolean bVisible) {
0246:                    _visible = bVisible;
0247:                }
0248:
0249:            }
0250:
0251:            HtmlScript _imagesScript;
0252:
0253:            /**
0254:             * NavigationMenu Constructor.
0255:             * @param name java.lang.String
0256:             * @param p com.salmonllc.html.HtmlPage
0257:             * @param groupname java.lang.String Name of group in properties files for generating menu.
0258:             */
0259:            public NavigationMenu(HtmlPage p) throws Exception {
0260:                super ("", p);
0261:                _nav = new Hashtable();
0262:            }
0263:
0264:            /**
0265:             * This constructor creates a NavigationMenu using properties from a group with a groupname of default.
0266:             * @param name java.lang.String
0267:             * @param p com.salmonllc.html.HtmlPage
0268:             */
0269:            public NavigationMenu(String name, HtmlPage p) throws Exception {
0270:                this (name, p, "default");
0271:
0272:            }
0273:
0274:            /**
0275:             * NavigationMenu Constructor.
0276:             * @param name java.lang.String
0277:             * @param p com.salmonllc.html.HtmlPage
0278:             * @param groupname java.lang.String Name of group in properties files for generating menu.
0279:             */
0280:            public NavigationMenu(String name, HtmlPage p, String groupname)
0281:                    throws Exception {
0282:                super (name, p);
0283:                _nav = new Hashtable();
0284:                _groupname = groupname;
0285:                Props pr = p.getPageProperties();
0286:                String NavTableIsLayer = pr
0287:                        .getProperty(_groupname + ".IsLayer");
0288:                if (NavTableIsLayer != null
0289:                        && !NavTableIsLayer.trim().equals("")
0290:                        && NavTableIsLayer.toUpperCase().charAt(0) == 'Y')
0291:                    _enableLayer = true;
0292:                initNavigationProperties();
0293:                createTable();
0294:            }
0295:
0296:            /**
0297:             * NavigationMenu Constructor.
0298:             * @param name java.lang.String
0299:             * @param p com.salmonllc.html.HtmlPage
0300:             * @param groupname java.lang.String Name of group in properties files for generating menu.
0301:             */
0302:            public NavigationMenu(String name, HtmlPage p, String groupname,
0303:                    String parentgroup) throws Exception {
0304:                super (name, p);
0305:                _nav = new Hashtable();
0306:                _groupname = groupname;
0307:                _parentgroup = parentgroup;
0308:                Props pr = p.getPageProperties();
0309:                String NavTableIsLayer = pr
0310:                        .getProperty(_groupname + ".IsLayer");
0311:                if (NavTableIsLayer != null
0312:                        && !NavTableIsLayer.trim().equals("")
0313:                        && NavTableIsLayer.toUpperCase().charAt(0) == 'Y')
0314:                    _enableLayer = true;
0315:                initNavigationProperties();
0316:                createTable();
0317:            }
0318:
0319:            /**
0320:             * NavigationMenu Constructor.
0321:             * @param name java.lang.String
0322:             * @param p com.salmonllc.html.HtmlPage
0323:             * @param groupname java.lang.String Name of group in properties files for generating menu.
0324:             */
0325:            public NavigationMenu(String name, HtmlPage p, String groupname,
0326:                    boolean bSubmenu) throws Exception {
0327:                super (name, p);
0328:                _nav = new Hashtable();
0329:                _groupname = groupname;
0330:                Props pr = p.getPageProperties();
0331:                String NavTableIsLayer = pr
0332:                        .getProperty(_groupname + ".IsLayer");
0333:                if (NavTableIsLayer != null
0334:                        && !NavTableIsLayer.trim().equals("")
0335:                        && NavTableIsLayer.toUpperCase().charAt(0) == 'Y')
0336:                    _enableLayer = true;
0337:                initNavigationProperties();
0338:                createTable();
0339:                if (bSubmenu)
0340:                    bSubmenu = false;
0341:            }
0342:
0343:            /**
0344:             * Adds a new html component to the container
0345:             * @param comp com.salmonllc.html.HtmlComponent
0346:             */
0347:            public void add(HtmlComponent comp) {
0348:                if (_enableLayer)
0349:                    _layer.add(comp);
0350:                else
0351:                    super .add(comp);
0352:            }
0353:
0354:            /**
0355:             * Adds a group to the NavigationMenu
0356:             * @param image java.lang.String Filename of the Image
0357:             * @param vertPadding int The number of pixels providing vertical padding for the group
0358:             */
0359:            public NavigationGroupInterface addGroup(String image,
0360:                    int vertPadding) {
0361:                Group group = new Group();
0362:                group._image = image;
0363:                group._vertPadding = vertPadding;
0364:                _groups.addElement(group);
0365:                return group;
0366:            }
0367:
0368:            /**
0369:             * Adds a menu item to Navigation Menu
0370:             * @param menu int Index of the group menu to add to.
0371:             * @param title java.lang.String title displayed of the item added
0372:             * @param href java.lang.String href link of the item added
0373:             * @param target java.lang.String target window of the href link
0374:             * @param horizPadding int The number of pixels to pad the item by.
0375:             */
0376:            public int addMenuItem(int menu, String title, String href,
0377:                    String target, int horizPadding) throws Exception {
0378:                return addMenuItem(menu, title, href, target, horizPadding,
0379:                        true);
0380:            }
0381:
0382:            /**
0383:             * Adds a menu item to Navigation Menu
0384:             * @param menu int Index of the group menu to add to.
0385:             * @param title java.lang.String title displayed of the item added
0386:             * @param href java.lang.String href link of the item added
0387:             * @param target java.lang.String target window of the href link
0388:             * @param horizPadding int The number of pixels to pad the item by.
0389:             * @param createTable boolean Indicates whether to regenerate the html for the navigation menu.
0390:             */
0391:            public int addMenuItem(int menu, String title, String href,
0392:                    String target, int horizPadding, boolean createTable)
0393:                    throws Exception {
0394:                Item item = new Item();
0395:                item._title = title;
0396:                item._horizPadding = horizPadding;
0397:                item._href = href;
0398:                item._target = target;
0399:                ((Group) _groups.elementAt(menu - 1))._items.addElement(item);
0400:                if (createTable)
0401:                    createTable();
0402:                return ((Group) _groups.elementAt(menu - 1))._items
0403:                        .indexOf(item) + 1;
0404:            }
0405:
0406:            /**
0407:             * Adds a menu item to Navigation Menu
0408:             * @param menu int Index of the group menu to add to.
0409:             * @param submenu java.lang.String submenu name of the item added. Indicates item is a submenu.
0410:             * @param title java.lang.String title displayed of the item added
0411:             * @param href java.lang.String href link of the item added
0412:             * @param target java.lang.String target window of the href link
0413:             * @param horizPadding int The number of pixels to pad the item by.
0414:             */
0415:            public int addMenuItem(int menu, String submenu, String title,
0416:                    String href, String target, int horizPadding)
0417:                    throws Exception {
0418:                return addMenuItem(menu, submenu, title, href, target,
0419:                        horizPadding, true);
0420:            }
0421:
0422:            /**
0423:             * Adds a menu item to Navigation Menu
0424:             * @param menu int Index of the group menu to add to.
0425:             * @param submenu java.lang.String submenu name of the item added. Indicates item is a submenu.
0426:             * @param title java.lang.String title displayed of the item added
0427:             * @param href java.lang.String href link of the item added
0428:             * @param target java.lang.String target window of the href link
0429:             * @param horizPadding int The number of pixels to pad the item by.
0430:             * @param createTable boolean Indicates whether to regenerate the html for the navigation menu.
0431:             */
0432:            public int addMenuItem(int menu, String submenu, String title,
0433:                    String href, String target, int horizPadding,
0434:                    boolean createTable) throws Exception {
0435:                Item item = new Item();
0436:                item._title = title;
0437:                item._horizPadding = horizPadding;
0438:                item._href = href;
0439:                item._target = target;
0440:                item._submenu = submenu;
0441:                ((Group) _groups.elementAt(menu - 1))._items.addElement(item);
0442:                if (createTable)
0443:                    createTable();
0444:                return ((Group) _groups.elementAt(menu - 1))._items
0445:                        .indexOf(item) + 1;
0446:            }
0447:
0448:            /**
0449:             * This method clears the selected menu item.
0450:             */
0451:            public void clearSelectedItem() {
0452:        if (_selectedGroupIndex <= 0)
0453:            return;
0454:        if (_selectedItemIndex <= 0)
0455:            return;
0456:        String sItemContainerKey = _groupname + ".Group" + _selectedGroupIndex + ".Item" + _selectedItemIndex;
0457:        String sItemCellPropKey = _groupname + ".Group" + _selectedGroupIndex + ".Item" + _selectedItemIndex + "CELLPROP";
0458:        HtmlContainer hc = (HtmlContainer) _nav.get(sItemContainerKey);
0459:        if (hc == null)
0460:            return;
0461:        HtmlTableCellProperties htcp = (HtmlTableCellProperties) _nav.get(sItemCellPropKey);
0462:        HtmlLink hl = null;
0463:        HtmlImage hi = null;
0464:        Enumeration enum = hc.getComponents();
0465:        while (enum.hasMoreElements()) {
0466:            HtmlComponent hcp = (HtmlComponent) enum.nextElement();
0467:            if (hcp instanceof  HtmlLink) {
0468:                hl = (HtmlLink) hcp;
0469:            }
0470:            if (hcp instanceof  HtmlImage) {
0471:                if (hcp.getName().startsWith("itemMarker")) {
0472:                    hi = (HtmlImage) hcp;
0473:                }
0474:            }
0475:        }
0476:        if (hi != null) {
0477:            if (_itemMarkerImg != null)
0478:                hi.setSource(_itemMarkerImg);
0479:        }
0480:        if (hl != null) {
0481:            if (_selectedStyle != null)
0482:                hl.setStyle(_linkstyle);
0483:            if (_itemMarkerImg != null && hi != null && _itemMarkerMouserOverImg != null)
0484:                hl.setOnMouseOut("fnc" + getFullName() + "_ItemMarkerImage(document." + hi.getFullName() + ");");
0485://	  hl.setOnMouseOut("document."+hi.getFullName()+".src='"+_itemMarkerImg+"';");
0486:            if (_itemMarkerMouserOverImg != null && hi != null)
0487:                hl.setOnMouseOver("fnc" + getFullName() + "_ItemMarkerMouseOverImage(document." + hi.getFullName() + ");");
0488://	  hl.setOnMouseOver("document."+hi.getFullName()+".src='"+_itemMarkerMouserOverImg+"';");
0489:        }
0490:        if (htcp != null) {
0491:            htcp.setStyle(_cellStyle);
0492:            if (hl != null) {
0493:                String sMouseOver = "this .className='" + _cellHoverStyle.getStyleName() + "';" + hl.getFullName() + ".className='" + _linkcellhoverstyle.getStyleName() + "';";
0494:                String sMouseOut = "this .className='" + _cellStyle.getStyleName() + "';" + hl.getFullName() + ".className='" + _linkstyle.getStyleName() + "';";
0495:                if (hi != null) {
0496:                    sMouseOver += hl.getOnMouseOver();
0497:                    sMouseOut += hl.getOnMouseOut();
0498:                }
0499:                htcp.setOnMouseOver(sMouseOver);
0500:                htcp.setOnMouseOut(sMouseOut);
0501:                htcp.setOnClick("document.location='" + hl.getHref() + "';");
0502:            }
0503:        }
0504:        _selectedGroupIndex = -1;
0505:        _selectedItemIndex = -1;
0506:    }
0507:
0508:            /**
0509:             * Creates a group menu in the Navigation Menu.
0510:             * @param image java.lang.String The filename of the image to represent the group
0511:             * @param vertPadding int The vertical padding for the group
0512:             */
0513:            public int createMenu(String image, int vertPadding)
0514:                    throws Exception {
0515:                return createMenu(image, vertPadding, true);
0516:            }
0517:
0518:            /**
0519:             * Creates a group menu in the Navigation Menu.
0520:             * @param image java.lang.String The filename of the image to represent the group
0521:             * @param vertPadding int The vertical padding for the group
0522:             * @param createTable boolean Indicates whether to regenerate the html for the navigation menu.
0523:             */
0524:            public int createMenu(String image, int vertPadding,
0525:                    boolean createTable) throws Exception {
0526:                Group group = new Group();
0527:                group._image = image;
0528:                group._vertPadding = vertPadding;
0529:                _groups.addElement(group);
0530:                if (createTable)
0531:                    createTable();
0532:                return _groups.indexOf(group) + 1;
0533:            }
0534:
0535:            private void createTable() throws Exception {
0536:        // get NavTable Properties
0537:        HtmlPage page = getPage();
0538:        removeAll();
0539:        removePopups();
0540:        if (_parentgroup == null) {
0541:            if (_linkstyle != null)
0542:                super .add(_linkstyle);
0543:            if (_linkhoverstyle != null)
0544:                super .add(_linkhoverstyle);
0545:            if (_linkfontstyle != null)
0546:                super .add(_linkfontstyle);
0547:            if (_linkfonthoverstyle != null)
0548:                super .add(_linkfonthoverstyle);
0549:            if (_linkcellhoverstyle != null)
0550:                super .add(_linkcellhoverstyle);
0551:            if (_cellStyle != null)
0552:                super .add(_cellStyle);
0553:            if (_cellHoverStyle != null)
0554:                super .add(_cellHoverStyle);
0555:            if (_selectedStyle != null)
0556:                super .add(_selectedStyle);
0557:            if (_selectedHoverStyle != null)
0558:                super .add(_selectedHoverStyle);
0559:            if (_selectedFontStyle != null)
0560:                super .add(_selectedFontStyle);
0561:            if (_selectedFontHoverStyle != null)
0562:                super .add(_selectedFontHoverStyle);
0563:            if (_selectedCellStyle != null)
0564:                super .add(_selectedCellStyle);
0565:            if (_selectedCellHoverStyle != null)
0566:                super .add(_selectedCellHoverStyle);
0567:            if (_fontStyle != null)
0568:                super .add(_fontStyle);
0569:        }
0570:        _imagesScript = new HtmlScript(getImagesScript(), "JavaScript1.2", getPage());
0571:        super .add(_imagesScript);
0572:
0573:        HtmlContainer cont = this ;
0574:        if (_enableLayer) {
0575:            HtmlStyle layerStyle = newStyle(_groupname + "Layer", "#", _groupname + ".LayerStyle");
0576:            super .add(layerStyle);
0577:            _layer = new HtmlLayer(_groupname, layerStyle, getPage());
0578:            int height = _NavTableLayerHeight;
0579:            _layer.setHeight(height);
0580:            _layerwidth = _NavTableLayerWidth;
0581:            _layer.setWidth(_layerwidth);
0582:            int top = _NavTableLayerTop;
0583:            _layer.setTop(top);
0584:            int left = _NavTableLayerLeft;
0585:            _layer.setLeft(left);
0586:            getPage().add(_layer);
0587:            cont = _layer;
0588:        }
0589:        _table = new HtmlTable("tbl", page);
0590:        _table.setBorder(_NavTableBorder);
0591:        _table.setCellSpacing(_NavTableCellSpacing);
0592:        _table.setCellPadding(_NavTableCellPadding);
0593:        _table.setBackgroundColor(_NavTableBackgroundColor);
0594:        cont.add(_table);
0595:
0596:        // NavTable Cell Properties
0597:        HtmlTableCellProperties navTableCellProp = new HtmlTableCellProperties();
0598:        navTableCellProp.setAlign(_cellAlign);
0599:        navTableCellProp.setVertAlign(_cellVertAlign);
0600:        navTableCellProp.setWrap(_wrap);
0601:        navTableCellProp.setBackgroundColor(_cellBackgroundColor);
0602:        navTableCellProp.setStyle(_cellStyle);
0603:
0604:        int row = 0;
0605:        HtmlTable t = _table;
0606:        int i = 1;
0607:        for (; i <= _groups.size(); i++) {
0608:            if (((Group) _groups.elementAt(i - 1))._visible == false)
0609:                continue;
0610:            String sNavTableImg = ((Group) _groups.elementAt(i - 1))._image;
0611:            String sNavTableImgHref = ((Group) _groups.elementAt(i - 1))._href;
0612:            int NavTableVertPadding = ((Group) _groups.elementAt(i - 1))._vertPadding;
0613:            
0614:           
0615:            HtmlImage img;
0616:            img = newVerticalSpacer(NavTableVertPadding);
0617:            if (img != null)
0618:                t.setComponentAt(row++, 0, img);
0619:            if (sNavTableImg != null && !sNavTableImg.equals("")) {
0620:                img = new HtmlImage(sNavTableImg, page);
0621:                if (sNavTableImgHref != null && !sNavTableImgHref.equals("")) {
0622:                    HtmlLink hlImg = new HtmlLink(_groupname + "GroupLink" + i, sNavTableImgHref, page);
0623:                    hlImg.add(img);
0624:                    t.setComponentAt(row++, 0, hlImg);
0625:                } else
0626:                    t.setComponentAt(row++, 0, img);
0627:                img.setVerticalSpace(0);
0628:                img.setHorizontalSpace(0);
0629:                String sImageKey = _groupname + ".Group" + i + ".Image";
0630:                _nav.put(sImageKey, img);
0631:            }
0632:            int j = 1;
0633:            for (; j <= ((Group) _groups.elementAt(i - 1))._items.size(); j++) {
0634:                if (((Item) ((Group) _groups.elementAt(i - 1))._items.elementAt(j - 1))._visible == false)
0635:                    continue;
0636:                String sItemKey = _groupname + ".Group" + i + ".Item" + j;
0637:                String sNavGroupEntryTitle = ((Item) ((Group) _groups.elementAt(i - 1))._items.elementAt(j - 1))._title;
0638:                String sNavGroupEntryHref = ((Item) ((Group) _groups.elementAt(i - 1))._items.elementAt(j - 1))._href;
0639:                String sNavGroupEntrySubmenu = ((Item) ((Group) _groups.elementAt(i - 1))._items.elementAt(j - 1))._submenu;
0640:                String sNavGroupEntryTarget = ((Item) ((Group) _groups.elementAt(i - 1))._items.elementAt(j - 1))._target;
0641:                HtmlContainer hc;
0642:                if (isPage(sNavGroupEntryHref) && _selectedGroupIndex == -1 && _selectedItemIndex == -1) {
0643:                    _selectedGroupIndex = i;
0644:                    _selectedItemIndex = j;
0645:                }
0646:                int iNavGroupEntrySpacer = ((Item) ((Group) _groups.elementAt(i - 1))._items.elementAt(j - 1))._horizPadding;
0647:                if (sNavGroupEntrySubmenu != null && !sNavGroupEntrySubmenu.trim().equals(""))
0648:                    if (iNavGroupEntrySpacer > 0)
0649:                        hc = newEntry(sNavGroupEntrySubmenu, sNavGroupEntryHref, sNavGroupEntryTarget, sNavGroupEntryTitle, _groupname + "Group" + i + "Mark" + j, iNavGroupEntrySpacer);
0650:                    else
0651:                        hc = newEntry(sNavGroupEntrySubmenu, sNavGroupEntryHref, sNavGroupEntryTarget, sNavGroupEntryTitle, _groupname + "Group" + i + "Mark" + j);
0652:                else {
0653:                    if (iNavGroupEntrySpacer > 0)
0654:                        hc = newEntry(sNavGroupEntryHref, sNavGroupEntryTarget, sNavGroupEntryTitle, _groupname + "Group" + i + "Mark" + j, iNavGroupEntrySpacer);
0655:                    else
0656:                        hc = newEntry(sNavGroupEntryHref, sNavGroupEntryTarget, sNavGroupEntryTitle, _groupname + "Group" + i + "Mark" + j);
0657:                }
0658:                HtmlTableCellProperties navLinkTableCellProp = new HtmlTableCellProperties();
0659:                if (!_cellHoverStyle.getStyleName().trim().equals("")) {
0660:                    HtmlLink hlLink = null;
0661:                    Enumeration enum = hc.getComponents();
0662:                    while (enum.hasMoreElements()) {
0663:                        HtmlComponent hcp = (HtmlComponent) enum.nextElement();
0664:                        if (hcp instanceof  HtmlLink) {
0665:                            hlLink = (HtmlLink) hcp;
0666:                            Enumeration enumLink = hlLink.getComponents();
0667:                            outer:
0668:                            while (enumLink.hasMoreElements()) {
0669:                                HtmlComponent hcpLink = (HtmlComponent) enumLink.nextElement();
0670:                                if (hcpLink instanceof  HtmlTable) {
0671:                                    HtmlContainer hcCont = (HtmlContainer) ((HtmlTable) hcpLink).getComponents().nextElement();
0672:                                    Enumeration enumCont = hcCont.getComponents();
0673:                                    while (enumCont.hasMoreElements()) {
0674:                                        HtmlComponent hcpCont = (HtmlComponent) enumCont.nextElement();
0675:                                        if (hcpCont instanceof  HtmlLink) {
0676:                                            hlLink = (HtmlLink) hcpCont;
0677:                                            break outer;
0678:                                        }
0679:                                    }
0680:                                }
0681:                            }
0682:                        }
0683:
0684:                    }
0685:                    navLinkTableCellProp.setAlign(_cellAlign);
0686:                    navLinkTableCellProp.setVertAlign(_cellVertAlign);
0687:                    navLinkTableCellProp.setWrap(_wrap);
0688:                    navLinkTableCellProp.setBackgroundColor(_cellBackgroundColor);
0689:                    navLinkTableCellProp.setStyle(_cellStyle);
0690:                    if (hlLink != null) {
0691:                        String sMouseOver = "this .className='" + _cellHoverStyle.getStyleName() + "';" + hlLink.getFullName() + ".className='" + _linkcellhoverstyle.getStyleName() + "';";
0692:                        String sMouseOut = "this .className='" + _cellStyle.getStyleName() + "';" + hlLink.getFullName() + ".className='" + _linkstyle.getStyleName() + "';";
0693:                        if (hlLink.getOnMouseOver() != null)
0694:                            sMouseOver += hlLink.getOnMouseOver();
0695:                        if (hlLink.getOnMouseOut() != null)
0696:                            sMouseOut += hlLink.getOnMouseOut();
0697:                        if (!_disableCellLink) {
0698:                            navLinkTableCellProp.setOnMouseOver(sMouseOver);
0699:                            navLinkTableCellProp.setOnMouseOut(sMouseOut);
0700:                            if (sNavGroupEntrySubmenu == null || sNavGroupEntrySubmenu.trim().equals(""))
0701:                                navLinkTableCellProp.setOnClick("document.location='" + hlLink.getHref() + "';");
0702:                        }
0703:                    }
0704:                } else
0705:                    navLinkTableCellProp = navTableCellProp;
0706:
0707:                t.setComponentAt(row++, 0, hc, navLinkTableCellProp);
0708:                _nav.put(sItemKey, hc);
0709:                _nav.put(sItemKey + "CELLPROP", navLinkTableCellProp);
0710:            }
0711:        }
0712:        if (_selectedGroupIndex > 0 && _selectedItemIndex > 0)
0713:            setSelectedItem(_selectedGroupIndex, _selectedItemIndex);
0714:        _table.setSizeOption(_sizeOption);
0715:        _table.setWidth(_width);
0716:        if (_popups.size() > 0) {
0717:            for (int j = 0; j < _popups.size(); j++)
0718:                page.addPopup((HtmlPopup) _popups.elementAt(j));
0719:        }
0720:        if (_enableLayer) {
0721:            super .add(getScrollScript());
0722:        }
0723:
0724:    }
0725:
0726:            /**
0727:             * Returns whether the cell of the Navigation Menu can act as a link.
0728:             * @return boolean Indicates whether cells in the Navigation Menu act as links.
0729:             */
0730:            public boolean getDisableCellLink() {
0731:                return _disableCellLink;
0732:            }
0733:
0734:            /**
0735:             * Returns an array Group Objects representing the Groups in the Navigation Menu.
0736:             * @return NavigationGroupInterface[] Array of groups in NavigationMenu.
0737:             */
0738:            public NavigationGroupInterface[] getGroups() {
0739:                if (_groups == null || _groups.size() == 0)
0740:                    return null;
0741:                NavigationGroupInterface[] aNgi = new NavigationGroupInterface[_groups
0742:                        .size()];
0743:                _groups.toArray(aNgi);
0744:
0745:                return aNgi;
0746:            }
0747:
0748:            private String getImagesScript() {
0749:                String sScript = "var " + getFullName() + "_loading=false;";
0750:                sScript += "function " + getFullName() + "_imageLoaded(e) {";
0751:                sScript += getFullName() + "_loading=false;";
0752:                sScript += "}";
0753:                if (_itemMarkerImg != null && !_itemMarkerImg.equals("")) {
0754:                    sScript += "\nvar " + getFullName()
0755:                            + "_ItemMarkerImage=new Image();\n";
0756:                    sScript += getFullName() + "_ItemMarkerImage.onload=this."
0757:                            + getFullName() + "_imageLoaded;";
0758:                    sScript += getFullName() + "_ItemMarkerImage.onerror=this."
0759:                            + getFullName() + "_imageLoaded;";
0760:                    sScript += getFullName() + "_ItemMarkerImage.onabort=this."
0761:                            + getFullName() + "_imageLoaded;";
0762:                    sScript += getFullName() + "_ItemMarkerImage.src=\""
0763:                            + _itemMarkerImg + "\";\n";
0764:                    sScript += "function fnc" + getFullName()
0765:                            + "_ItemMarkerImage(source) {\n";
0766:                    if (getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT) {
0767:                        sScript += "if(" + getFullName() + "_loading) {";
0768:                        sScript += "if (source!=null) \n";
0769:                        sScript += "setTimeout('fnc"
0770:                                + getFullName()
0771:                                + "_ItemMarkerImage(document.'+source.name+');',100);";
0772:                        sScript += "return;";
0773:                        sScript += "}";
0774:                        sScript += "if (source==null) \n";
0775:                        sScript += "return;\n";
0776:                        sScript += getFullName() + "_loading=true;\n";
0777:                    }
0778:                    sScript += "source.src=" + getFullName()
0779:                            + "_ItemMarkerImage.src;\n";
0780:                    sScript += "};\n";
0781:                }
0782:                if (_itemMarkerMouserOverImg != null
0783:                        && !_itemMarkerMouserOverImg.equals("")) {
0784:                    sScript += "\nvar " + getFullName()
0785:                            + "_ItemMarkerMouseOverImage=new Image();\n";
0786:                    sScript += getFullName()
0787:                            + "_ItemMarkerMouseOverImage.onload=this."
0788:                            + getFullName() + "_imageLoaded;";
0789:                    sScript += getFullName()
0790:                            + "_ItemMarkerMouseOverImage.onerror=this."
0791:                            + getFullName() + "_imageLoaded;";
0792:                    sScript += getFullName()
0793:                            + "_ItemMarkerMouseOverImage.onabort=this."
0794:                            + getFullName() + "_imageLoaded;";
0795:                    sScript += getFullName()
0796:                            + "_ItemMarkerMouseOverImage.src=\""
0797:                            + _itemMarkerMouserOverImg + "\";\n";
0798:                    sScript += "function fnc" + getFullName()
0799:                            + "_ItemMarkerMouseOverImage(source) {\n";
0800:                    if (getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT) {
0801:                        sScript += "if(" + getFullName() + "_loading) {";
0802:                        sScript += "if (source!=null) \n";
0803:                        sScript += "setTimeout('fnc"
0804:                                + getFullName()
0805:                                + "_ItemMarkerMouseOverImage(document.'+source.name+');',100);";
0806:                        sScript += "return;";
0807:                        sScript += "}";
0808:                        sScript += "if (source==null) \n";
0809:                        sScript += "return;\n";
0810:                        sScript += getFullName() + "_loading=true;\n";
0811:                    }
0812:                    sScript += "source.src=" + getFullName()
0813:                            + "_ItemMarkerMouseOverImage.src;\n";
0814:                    sScript += "};\n";
0815:                }
0816:                if (_itemTitleMarkerImg != null
0817:                        && !_itemTitleMarkerImg.equals("")) {
0818:                    sScript += "\nvar " + getFullName()
0819:                            + "_ItemTitleMarkerImage=new Image();\n";
0820:                    sScript += getFullName()
0821:                            + "_ItemTitleMarkerImage.onload=this."
0822:                            + getFullName() + "_imageLoaded;";
0823:                    sScript += getFullName()
0824:                            + "_ItemTitleMarkerImage.onerror=this."
0825:                            + getFullName() + "_imageLoaded;";
0826:                    sScript += getFullName()
0827:                            + "_ItemTitleMarkerImage.onabort=this."
0828:                            + getFullName() + "_imageLoaded;";
0829:                    sScript += getFullName() + "_ItemTitleMarkerImage.src=\""
0830:                            + _itemTitleMarkerImg + "\";\n";
0831:                    sScript += "function fnc" + getFullName()
0832:                            + "_ItemTitleMarkerImage(source) {\n";
0833:                    if (getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT) {
0834:                        sScript += "if(" + getFullName() + "_loading) {";
0835:                        sScript += "if (source!=null) \n";
0836:                        sScript += "setTimeout('fnc"
0837:                                + getFullName()
0838:                                + "_ItemTitleMarkerImage(document.'+source.name+');',100);";
0839:                        sScript += "return;";
0840:                        sScript += "}";
0841:                        sScript += "if (source==null) \n";
0842:                        sScript += "return;\n";
0843:                        sScript += getFullName() + "_loading=true;\n";
0844:                    }
0845:                    sScript += "source.src=" + getFullName()
0846:                            + "_ItemTitleMarkerImage.src;\n";
0847:                    sScript += "};\n";
0848:                }
0849:                if (_selectedItemMarkerImg != null
0850:                        && !_selectedItemMarkerImg.equals("")) {
0851:                    sScript += "\nvar " + getFullName()
0852:                            + "_SelectedItemMarkerImage=new Image();\n";
0853:                    sScript += getFullName()
0854:                            + "_SelectedItemMarkerImage.onload=this."
0855:                            + getFullName() + "_imageLoaded;";
0856:                    sScript += getFullName()
0857:                            + "_SelectedItemMarkerImage.onerror=this."
0858:                            + getFullName() + "_imageLoaded;";
0859:                    sScript += getFullName()
0860:                            + "_SelectedItemMarkerImage.onabort=this."
0861:                            + getFullName() + "_imageLoaded;";
0862:                    sScript += getFullName()
0863:                            + "_SelectedItemMarkerImage.src=\""
0864:                            + _selectedItemMarkerImg + "\";\n";
0865:                    sScript += "function fnc" + getFullName()
0866:                            + "_SelectedItemMarkerImage(source) {\n";
0867:                    if (getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT) {
0868:                        sScript += "if(" + getFullName() + "_loading) {";
0869:                        sScript += "if (source!=null) \n";
0870:                        sScript += "setTimeout('fnc"
0871:                                + getFullName()
0872:                                + "_SelectedItemMarkerImage(document.'+source.name+');',100);";
0873:                        sScript += "return;";
0874:                        sScript += "}";
0875:                        sScript += "if (source==null) \n";
0876:                        sScript += "return;\n";
0877:                        sScript += getFullName() + "_loading=true;\n";
0878:                    }
0879:                    sScript += "source.src=" + getFullName()
0880:                            + "_SelectedItemMarkerImage.src;\n";
0881:                    sScript += "};\n";
0882:                }
0883:                if (_selectedItemMarkerMouseOverImg != null
0884:                        && !_selectedItemMarkerMouseOverImg.equals("")) {
0885:                    sScript += "\nvar "
0886:                            + getFullName()
0887:                            + "_SelectedItemMarkerMouseOverImage=new Image();\n";
0888:                    sScript += getFullName()
0889:                            + "_SelectedItemMarkerMouseOverImage.onload=this."
0890:                            + getFullName() + "_imageLoaded;";
0891:                    sScript += getFullName()
0892:                            + "_SelectedItemMarkerMouseOverImage.onerror=this."
0893:                            + getFullName() + "_imageLoaded;";
0894:                    sScript += getFullName()
0895:                            + "_SelectedItemMarkerMouseOverImage.onabort=this."
0896:                            + getFullName() + "_imageLoaded;";
0897:                    sScript += getFullName()
0898:                            + "_SelectedItemMarkerMouseOverImage.src=\""
0899:                            + _selectedItemMarkerMouseOverImg + "\";\n";
0900:                    sScript += "function fnc" + getFullName()
0901:                            + "_SelectedItemMarkerMouseOverImage() {\n";
0902:                    if (getPage().getBrowserType() == HtmlPageBase.BROWSER_MICROSOFT) {
0903:                        sScript += "if(" + getFullName() + "_loading) {";
0904:                        sScript += "if (source!=null) \n";
0905:                        sScript += "setTimeout('fnc"
0906:                                + getFullName()
0907:                                + "_SelectedItemMarkerMouseOverImage(document.'+source.name+');',100);";
0908:                        sScript += "return;";
0909:                        sScript += "}";
0910:                        sScript += "if (source==null) \n";
0911:                        sScript += "return;\n";
0912:                        sScript += getFullName() + "_loading=true;\n";
0913:                    }
0914:                    sScript += "source.src=" + getFullName()
0915:                            + "_SelectedItemMarkerMouseOverImage.src;\n";
0916:                    sScript += "};\n";
0917:                }
0918:                return sScript;
0919:            }
0920:
0921:            private String getLayerName() {
0922:                return _layer.getFullName();
0923:            }
0924:
0925:            private int getLayerShowXCoord() {
0926:                if (getPage().getBrowserType() == HtmlPage.BROWSER_MICROSOFT
0927:                        && getPage().getBrowserVersion() >= 4)
0928:                    return 1;
0929:                if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE
0930:                        && getPage().getBrowserVersion() >= 4)
0931:                    return 2;
0932:                return 0;
0933:            }
0934:
0935:            private int getLayerWidth() {
0936:                return _layerwidth;
0937:            }
0938:
0939:            /**
0940:             * Returns a vector of com.salmonllc.html.HtmlPopups belonging to this navigation menu.
0941:             * Creation date: (8/16/01 4:01:16 PM)
0942:             * @return java.util.Vector Vector of com.salmonllc.html.HtmlPopups
0943:             */
0944:            public Vector getPopups() {
0945:                return _popups;
0946:            }
0947:
0948:            private HtmlScript getScrollScript() {
0949:                String sScript = "\n\r\tvar hideFlag=0;\n\r\tvar showFlag=0;\n\r\tvar xCoord=0;";
0950:                sScript += "\n\r\tvar yCoord=0;\n\r\tvar yMenuCoord=0;\n\r\tfunction mouseTracker(e) {\n\r\te = e || window.Event || window.event;";
0951:                sScript += "\n\r\txCoord = e.pageX || e.clientX;\n\r\tyCoord = e.pageY || e.clientY;\n\r\tif (xCoord<"
0952:                        + getLayerShowXCoord() + " && hideFlag==0) {";
0953:                sScript += "\n\r\tyMenuCoord=yCoord;\n\r\tshowmenu();}\n\r\tif (document.all) {\n\r\tif (xCoord>"
0954:                        + getLayerName() + ".style.pixelWidth && showFlag==0)";
0955:                sScript += "\n\r\thidemenu();\n\r\tif ("
0956:                        + getLayerName()
0957:                        + ".style.pixelLeft>=0 && showFlag==1)\n\r\tshowFlag=0;";
0958:                sScript += "\n\r\tif ("
0959:                        + getLayerName()
0960:                        + ".style.pixelLeft<=-"
0961:                        + getLayerName()
0962:                        + ".style.pixelWidth && hideFlag==1)\n\r\thideFlag=0;\n\r\t}";
0963:                sScript += "\n\r\telse {\n\r\tif (xCoord>" + getLayerWidth()
0964:                        + " && showFlag==0)\n\r\thidemenu();";
0965:                sScript += "\n\r\tif (document." + getLayerName()
0966:                        + ".left>=0 && showFlag==1)\n\r\tshowFlag=0;";
0967:                sScript += "\n\r\tif (document." + getLayerName() + ".left<=-"
0968:                        + getLayerWidth()
0969:                        + " && hideFlag==1)\n\r\thideFlag=0;\n\r\t}\n\r\t}";
0970:                sScript += "\n\r\tfunction setMouseTracker() {\n\r\tif (document.captureEvents) {";
0971:                sScript += "\n\r\tdocument.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);\n\r\t}";
0972:                sScript += "\n\r\tdocument.onmousemove = this.mouseTracker;\n\r\t}\n\r\tfunction hidemenu(){\n\r\tif (document.all) {";
0973:                sScript += "\n\r\tif (" + getLayerName() + ".style.pixelLeft>-"
0974:                        + getLayerName()
0975:                        + ".style.pixelWidth && showFlag==0) {";
0976:                sScript += "\n\r\tshowFlag=0;\n\r\thideFlag=1;\n\r\tsetTimeout(\""
0977:                        + getLayerName()
0978:                        + ".style.pixelLeft-=1;hidemenu();\",10);";
0979:                sScript += "\n\r\t}\n\r\telse {\n\r\thideFlag=0;\n\r\tshowFlag=0;\n\r\t}\n\r\t}\n\r\telse {";
0980:                sScript += "\n\r\tif (document." + getLayerName() + ".left>-"
0981:                        + getLayerWidth()
0982:                        + " && showFlag==0) {\n\r\tshowFlag=0;";
0983:                sScript += "\n\r\thideFlag=1;\n\r\tsetTimeout(\"document."
0984:                        + getLayerName()
0985:                        + ".left-=1;hidemenu();\",10);\n\r\t}\n\r\telse {";
0986:                sScript += "\n\r\thideFlag=0;\n\r\tshowFlag=0;\n\r\t}\n\r\t}\n\r\t}\n\r\tfunction showmenu(){\n\r\tif (document.all) {";
0987:                sScript += "\n\r\tif ("
0988:                        + getLayerName()
0989:                        + ".style.pixelLeft<0 && hideFlag==0) {\n\r\thideFlag=0;\n\r\tshowFlag=1;";
0990:                sScript += "\n\r\t"
0991:                        + getLayerName()
0992:                        + ".style.pixelTop=yMenuCoord;\n\r\tsetTimeout(\""
0993:                        + getLayerName()
0994:                        + ".style.pixelLeft+=1;showmenu();\",10);\n\r\t}\n\r\telse {";
0995:                sScript += "\n\r\tshowFlag==0;\n\r\thideFlag=0;\n\r\t}\n\r\t}\n\r\telse {";
0996:                sScript += "\n\r\tif (document."
0997:                        + getLayerName()
0998:                        + ".left<0 && hideFlag==0) {\n\r\thideFlag=0;\n\r\tshowFlag=1;";
0999:                sScript += "\n\r\tdocument."
1000:                        + getLayerName()
1001:                        + ".top=yMenuCoord;\n\r\tsetTimeout(\"document."
1002:                        + getLayerName()
1003:                        + ".left+=1;showmenu();\",10);\n\r\t}\n\r\telse {\n\r\tshowFlag=0;";
1004:                sScript += "\n\r\thideFlag=0;\n\r\t}\n\r\t}\n\r\t}";
1005:                sScript += "\n\r\tfunction initNavPosition() {\n\r\tif(document.all)\n\r\t"
1006:                        + getLayerName()
1007:                        + ".style.pixelLeft=-"
1008:                        + getLayerName()
1009:                        + ".style.pixelWidth;\n\r\telse\n\r\tdocument."
1010:                        + getLayerName()
1011:                        + ".left=-document."
1012:                        + getLayerName()
1013:                        + ".width;\n\r\t}";
1014:                sScript += "\n\r\tsetMouseTracker();\n\r\tsetTimeout(\"initNavPosition()\",100);";
1015:                return new HtmlScript(sScript, "JavaScript1.2", getPage());
1016:            }
1017:
1018:            /**
1019:             * Returns a Navigation Menu representing a submenu.
1020:             * @param groupIndex is the group index of the submenu entry.
1021:             * @param itemIndex is the item index of the submenu entry.
1022:             */
1023:            public NavigationMenu getSubMenu(int groupIndex, int itemIndex) {
1024:        NavigationMenu nmReturn = null;
1025:        try {
1026:            for (int i = 0; i < _popups.size(); i++) {
1027:                HtmlPopup hpPop = (HtmlPopup) _popups.elementAt(i);
1028:                String name = "popup" + _groupname + "Group" + groupIndex + "Mark" + itemIndex;
1029:                if (hpPop.getName().equals(name)) {
1030:                    Enumeration enum = hpPop.getComponents();
1031:                    nmReturn = (NavigationMenu) enum.nextElement();
1032:                    break;
1033:                }
1034:            }
1035:        } catch (Exception e) {
1036:            e.printStackTrace();
1037:        }
1038:        return nmReturn;
1039:    }
1040:
1041:            private void initNavigationProperties() throws Exception {
1042:                // get NavTable Properties
1043:                HtmlPage page = getPage();
1044:                Props pr = page.getPageProperties();
1045:                String sGroupName = _groupname;
1046:                String sStyleGroupName = _groupname;
1047:                if (pr.getProperty(_groupname + ".UseParentAttributes") != null)
1048:                    _useParentAttributes = new Boolean(pr
1049:                            .getProperty(_groupname + ".UseParentAttributes"))
1050:                            .booleanValue();
1051:                if (_parentgroup != null && !_parentgroup.trim().equals("")) {
1052:                    sStyleGroupName = _parentgroup;
1053:                    if (_useParentAttributes)
1054:                        sGroupName = _parentgroup;
1055:                }
1056:                if (pr.getProperty(sGroupName + ".Border") == null)
1057:                    sGroupName = _parentgroup;
1058:                _NavTableBorder = new Integer(pr.getProperty(sGroupName
1059:                        + ".Border")).intValue();
1060:                _NavTableCellSpacing = new Integer(pr.getProperty(sGroupName
1061:                        + ".CellSpacing")).intValue();
1062:                _NavTableCellPadding = new Integer(pr.getProperty(sGroupName
1063:                        + ".CellPadding")).intValue();
1064:                _NavTableBackgroundColor = pr.getProperty(sGroupName
1065:                        + ".BackgroundColor");
1066:                _selectedItemMarkerImg = pr.getProperty(sGroupName
1067:                        + ".Group.SelectedItemMarkerImage");
1068:                _selectedItemMarkerMouseOverImg = pr.getProperty(sGroupName
1069:                        + ".Group.SelectedItemMarkerMouseOverImage");
1070:                _itemMarkerImg = pr.getProperty(sGroupName
1071:                        + ".Group.ItemMarkerImage");
1072:                _itemMarkerMouserOverImg = pr.getProperty(sGroupName
1073:                        + ".Group.ItemMarkerMouseOverImage");
1074:                _itemTitleMarkerImg = pr.getProperty(sGroupName
1075:                        + ".Group.ItemTitleMarkerImage");
1076:                _linkstyle = newStyle(sStyleGroupName, "A", sStyleGroupName
1077:                        + ".LinkStyle");
1078:                _linkhoverstyle = newStyle(sStyleGroupName + ":hover", "A",
1079:                        sStyleGroupName + ".HoverStyle");
1080:                _linkfontstyle = newStyle(sStyleGroupName, "", sStyleGroupName
1081:                        + ".LinkStyle");
1082:                _linkfonthoverstyle = newStyle(sStyleGroupName + "hover", "",
1083:                        sStyleGroupName + ".HoverStyle");
1084:                _linkcellhoverstyle = newStyle(sStyleGroupName + "hover", "A",
1085:                        sStyleGroupName + ".HoverStyle");
1086:                _cellStyle = newStyle(sStyleGroupName + "CELL", "TD",
1087:                        sStyleGroupName + ".CellStyle");
1088:                _cellHoverStyle = newStyle(sStyleGroupName + "CELLhover", "TD",
1089:                        sStyleGroupName + ".CellHoverStyle");
1090:                _selectedStyle = newStyle(sStyleGroupName + "SELECTED", "A",
1091:                        sStyleGroupName + ".SelectedStyle");
1092:                _selectedHoverStyle = newStyle(sStyleGroupName
1093:                        + "SELECTEDhover", "A", sStyleGroupName
1094:                        + ".SelectedHoverStyle");
1095:                _selectedFontStyle = newStyle(sStyleGroupName + "SELECTED", "",
1096:                        sStyleGroupName + ".SelectedStyle");
1097:                _selectedFontHoverStyle = newStyle(sStyleGroupName
1098:                        + "SELECTEDhover", "", sStyleGroupName
1099:                        + ".SelectedHoverStyle");
1100:                _selectedCellStyle = newStyle(sStyleGroupName + "SELECTEDCELL",
1101:                        "TD", sStyleGroupName + ".SelectedCellStyle");
1102:                _selectedCellHoverStyle = newStyle(sStyleGroupName
1103:                        + "SELECTEDCELLhover", "TD", sStyleGroupName
1104:                        + ".SelectedCellHoverStyle");
1105:                _fontStyle = newStyle(sStyleGroupName + "Font", "",
1106:                        sStyleGroupName + ".FontStyle");
1107:
1108:                String sCellAlign = pr.getProperty(sGroupName + ".CellAlign");
1109:                String sCellVertAlign = pr.getProperty(sGroupName
1110:                        + ".CellVertAlign");
1111:                boolean bCellWrap = new Boolean(pr.getProperty(sGroupName
1112:                        + ".CellWrap")).booleanValue();
1113:                String sCellBackgroundColor = pr.getProperty(sGroupName
1114:                        + ".CellBackgroundColor");
1115:
1116:                _cellAlign = sCellAlign;
1117:                _cellVertAlign = sCellVertAlign;
1118:                _wrap = bCellWrap;
1119:                _cellBackgroundColor = sCellBackgroundColor;
1120:
1121:                try {
1122:                    _NavTableLayerWidth = new Integer(pr.getProperty(sGroupName
1123:                            + ".LayerWidth")).intValue();
1124:                    _NavTableLayerHeight = new Integer(pr
1125:                            .getProperty(sGroupName + ".LayerHeight"))
1126:                            .intValue();
1127:                    _NavTableLayerTop = new Integer(pr.getProperty(sGroupName
1128:                            + ".LayerTop")).intValue();
1129:                    _NavTableLayerLeft = new Integer(pr.getProperty(sGroupName
1130:                            + ".LayerLeft")).intValue();
1131:                } catch (Exception e) {
1132:                    ;
1133:                }
1134:
1135:                _groups = new Vector();
1136:                int i = 1;
1137:                while (true) {
1138:                    if (pr.getProperty(_groupname + ".Group" + i + ".Title1") == null)
1139:                        break;
1140:                    String sNavTableImg = pr.getProperty(_groupname + ".Group"
1141:                            + i + ".Image");
1142:                    String sNavTableImgHref = pr.getProperty(_groupname
1143:                            + ".Group" + i + ".HREF");
1144:                    int NavTableVertPadding = 0;
1145:                    try {
1146:                        NavTableVertPadding = new Integer(pr
1147:                                .getProperty(_groupname + ".Group" + i
1148:                                        + ".VertPadding")).intValue();
1149:                    } catch (Exception e) {
1150:                        ;
1151:                    }
1152:                    Group group = new Group();
1153:                    group._image = sNavTableImg;
1154:                    group._href = sNavTableImgHref;
1155:                    group._vertPadding = NavTableVertPadding;
1156:                    _groups.addElement(group);
1157:                    int j = 1;
1158:                    while (true) {
1159:                        String sNavGroupEntryTitle = pr.getProperty(_groupname
1160:                                + ".Group" + i + ".Title" + j);
1161:                        if (sNavGroupEntryTitle == null)
1162:                            break;
1163:                        String sNavGroupEntryHref = pr.getProperty(_groupname
1164:                                + ".Group" + i + ".HREF" + j);
1165:                        String sNavGroupEntrySubmenu = pr
1166:                                .getProperty(_groupname + ".Group" + i
1167:                                        + ".SUBMENU" + j);
1168:                        int iNavGroupEntrySpacer = 0;
1169:                        try {
1170:                            iNavGroupEntrySpacer = Integer.parseInt(pr
1171:                                    .getProperty(_groupname + ".Group" + i
1172:                                            + ".Title" + j + ".HorizPadding"));
1173:                        } catch (Exception e) {
1174:                            ;
1175:                        }
1176:                        Item item = new Item();
1177:                        item._title = sNavGroupEntryTitle;
1178:                        item._href = sNavGroupEntryHref;
1179:                        item._submenu = sNavGroupEntrySubmenu;
1180:                        item._horizPadding = iNavGroupEntrySpacer;
1181:                        group._items.addElement(item);
1182:                        j++;
1183:                    }
1184:                    i++;
1185:                }
1186:
1187:            }
1188:
1189:            /**
1190:             * Inserts a group into the NavigationMenu at specified location
1191:             * @param image java.lang.String Filename of the Image
1192:             * @param vertPadding int The number of pixels providing vertical padding for the group
1193:             * @param iLocation int The index at which to Insert the Group
1194:             */
1195:            public NavigationGroupInterface insertGroupAt(String image,
1196:                    int vertPadding, int iLocation) {
1197:                Group group = new Group();
1198:                group._image = image;
1199:                group._vertPadding = vertPadding;
1200:                _groups.insertElementAt(group, iLocation - 1);
1201:                return group;
1202:            }
1203:
1204:            /**
1205:             * Inserts a group into the NavigationMenu at specified location
1206:             * @param image java.lang.String Filename of the Image
1207:             * @param vertPadding int The number of pixels providing vertical padding for the group
1208:             * @param ngiInsertBefore NavigationGroupInterface The group at which to Insert the Group before.
1209:             */
1210:            public NavigationGroupInterface insertGroupAt(String image,
1211:                    int vertPadding, NavigationGroupInterface ngiInsertBefore) {
1212:                Group group = new Group();
1213:                group._image = image;
1214:                group._vertPadding = vertPadding;
1215:                _groups.insertElementAt(group, _groups
1216:                        .indexOf((Group) ngiInsertBefore));
1217:                return group;
1218:            }
1219:
1220:            /**
1221:             * Inserts a menu item into Navigation Menu at specified location
1222:             * @param menu int Index of the group menu to add to.
1223:             * @param title java.lang.String title displayed of the item added
1224:             * @param href java.lang.String href link of the item added
1225:             * @param target java.lang.String target window of the href link
1226:             * @param horizPadding int The number of pixels to pad the item by.
1227:             * @param iLocation int The index at which to Insert the Item
1228:             */
1229:            public int insertMenuItemAt(int menu, String title, String href,
1230:                    String target, int horizPadding, int iLocation)
1231:                    throws Exception {
1232:                return insertMenuItemAt(menu, title, href, target,
1233:                        horizPadding, true, iLocation);
1234:            }
1235:
1236:            /**
1237:             * Inserts a menu item into Navigation Menu at specified location
1238:             * @param menu int Index of the group menu to add to.
1239:             * @param title java.lang.String title displayed of the item added
1240:             * @param href java.lang.String href link of the item added
1241:             * @param target java.lang.String target window of the href link
1242:             * @param horizPadding int The number of pixels to pad the item by.
1243:             * @param createTable boolean Indicates whether to regenerate the html for the navigation menu.
1244:             * @param iLocation int The index at which to Insert the Item
1245:             */
1246:            public int insertMenuItemAt(int menu, String title, String href,
1247:                    String target, int horizPadding, boolean createTable,
1248:                    int iLocation) throws Exception {
1249:                Item item = new Item();
1250:                item._title = title;
1251:                item._horizPadding = horizPadding;
1252:                item._href = href;
1253:                item._target = target;
1254:                ((Group) _groups.elementAt(menu - 1))._items.insertElementAt(
1255:                        item, iLocation - 1);
1256:                if (createTable)
1257:                    createTable();
1258:                return ((Group) _groups.elementAt(menu - 1))._items
1259:                        .indexOf(item) + 1;
1260:            }
1261:
1262:            /**
1263:             * Inserts a menu item into Navigation Menu at specified location
1264:             * @param menu int Index of the group menu to add to.
1265:             * @param submenu java.lang.String submenu name of the item added. Indicates item is a submenu.
1266:             * @param title java.lang.String title displayed of the item added
1267:             * @param href java.lang.String href link of the item added
1268:             * @param target java.lang.String target window of the href link
1269:             * @param horizPadding int The number of pixels to pad the item by.
1270:             * @param iLocation int The index at which to Insert the Item
1271:             */
1272:            public int insertMenuItemAt(int menu, String submenu, String title,
1273:                    String href, String target, int horizPadding, int iLocation)
1274:                    throws Exception {
1275:                return insertMenuItemAt(menu, submenu, title, href, target,
1276:                        horizPadding, true, iLocation);
1277:            }
1278:
1279:            /**
1280:             * Inserts a menu item into Navigation Menu at specified location
1281:             * @param menu int Index of the group menu to add to.
1282:             * @param submenu java.lang.String submenu name of the item added. Indicates item is a submenu.
1283:             * @param title java.lang.String title displayed of the item added
1284:             * @param href java.lang.String href link of the item added
1285:             * @param target java.lang.String target window of the href link
1286:             * @param horizPadding int The number of pixels to pad the item by.
1287:             * @param createTable boolean Indicates whether to regenerate the html for the navigation menu.
1288:             * @param iLocation int The index at which to Insert the Item
1289:             */
1290:            public int insertMenuItemAt(int menu, String submenu, String title,
1291:                    String href, String target, int horizPadding,
1292:                    boolean createTable, int iLocation) throws Exception {
1293:                Item item = new Item();
1294:                item._title = title;
1295:                item._horizPadding = horizPadding;
1296:                item._href = href;
1297:                item._target = target;
1298:                item._submenu = submenu;
1299:                ((Group) _groups.elementAt(menu - 1))._items.insertElementAt(
1300:                        item, iLocation - 1);
1301:                if (createTable)
1302:                    createTable();
1303:                return ((Group) _groups.elementAt(menu - 1))._items
1304:                        .indexOf(item) + 1;
1305:            }
1306:
1307:            private boolean isPage(String sHref) {
1308:                if (sHref == null)
1309:                    return false;
1310:                String pageName = getPage().getPageName();
1311:                int qindex = sHref.indexOf('?');
1312:                if (qindex > -1)
1313:                    sHref = sHref.substring(0, qindex);
1314:                int sindex = sHref.indexOf('/');
1315:                if (sindex >= 0 && sHref.endsWith("/" + pageName))
1316:                    return true;
1317:                if (sHref.equals(pageName))
1318:                    return true;
1319:                return false;
1320:            }
1321:
1322:            private boolean isPage(String sHref, String pageName) {
1323:                if (sHref == null)
1324:                    return false;
1325:                int qindex = sHref.indexOf('?');
1326:                if (qindex > -1)
1327:                    sHref = sHref.substring(0, qindex);
1328:                if (sHref.endsWith(pageName))
1329:                    return true;
1330:                return false;
1331:            }
1332:
1333:            /**
1334:             * Constructs an HtmlLink component containing a text caption.
1335:             * @return HtmlContainer
1336:             * @param href		The URL for the link.
1337:             * @param target	The target associated with the link.
1338:             * @param caption	The text caption for the link.
1339:             * @param unique	A unique string to identify different entries in HTML for naming purposes.
1340:             */
1341:            protected HtmlContainer newEntry(String href, String target,
1342:                    String caption, String unique) throws Exception {
1343:                HtmlPage page = getPage();
1344:                HtmlComponent c;
1345:                HtmlContainer ret = new HtmlContainer("", page);
1346:                HtmlImage spacer = null;
1347:                if (_itemMarkerImg != null && !_itemMarkerImg.trim().equals("")
1348:                        && href != null && !href.trim().equals("")) {
1349:                    spacer = new HtmlImage("itemMarker" + unique,
1350:                            _itemMarkerImg, page);
1351:                    spacer.setHorizontalSpace(3);
1352:                    spacer.setOnLoad(getFullName() + "_imageLoaded();");
1353:                    ret.add(spacer);
1354:                }
1355:                if (_itemTitleMarkerImg != null
1356:                        && !_itemTitleMarkerImg.trim().equals("")
1357:                        && (href == null || href.trim().equals(""))) {
1358:                    spacer = new HtmlImage("itemTitleMarker" + unique,
1359:                            _itemTitleMarkerImg, page);
1360:                    spacer.setHorizontalSpace(3);
1361:                    spacer.setOnLoad(getFullName() + "_imageLoaded();");
1362:                    ret.add(spacer);
1363:                }
1364:                if (href != null && !href.trim().equals("")) {
1365:                    HtmlRaw hrSpan = new HtmlRaw("<SPAN CLASS=\""
1366:                            + _linkfontstyle.getStyleName() + "\">", page);
1367:                    ret.add(hrSpan);
1368:                    HtmlLink link = new HtmlLink("link" + unique, href, null,
1369:                            page);
1370:                    link.add(new HtmlRaw(caption, page));
1371:                    if (_itemMarkerImg != null
1372:                            && _itemMarkerMouserOverImg != null) {
1373:                        //		  link.setOnMouseOver("document."+spacer.getFullName()+".src='"+_itemMarkerMouserOverImg+"';");
1374:                        //		  link.setOnMouseOut("document."+spacer.getFullName()+".src='"+_itemMarkerImg+"';");
1375:                        link.setOnMouseOver("fnc" + getFullName()
1376:                                + "_ItemMarkerMouseOverImage(document."
1377:                                + spacer.getFullName() + ");");
1378:                        link.setOnMouseOut("fnc" + getFullName()
1379:                                + "_ItemMarkerImage(document."
1380:                                + spacer.getFullName() + ");");
1381:                    }
1382:                    if (target != null && !target.trim().equals(""))
1383:                        link.setTarget(target);
1384:                    link.setStyle(_linkstyle);
1385:                    c = link;
1386:                } else if (_fontStyle != null)
1387:                    c = new HtmlText(caption, _fontStyle, page);
1388:                else
1389:                    c = new HtmlText(caption, _groupname + ".CellFont", page);
1390:                ret.add(c);
1391:                if (c instanceof  HtmlLink) {
1392:                    HtmlRaw hrEndSpan = new HtmlRaw("</SPAN", page);
1393:                    ret.add(hrEndSpan);
1394:                }
1395:                return ret;
1396:            }
1397:
1398:            /**
1399:             * Constructs an HtmlLink component containing a text caption.
1400:             * @return HtmlContainer
1401:             * @param href		The URL for the link.
1402:             * @param target	The target associated with the link.
1403:             * @param caption	The text caption for the link.
1404:             * @param unique	A unique string to identify different entries in HTML for naming purposes.
1405:             * @param iHorSpacer The horizontal tabing of an entry.
1406:             */
1407:            protected HtmlContainer newEntry(String href, String target,
1408:                    String caption, String unique, int iHorSpacer)
1409:                    throws Exception {
1410:                HtmlPage page = getPage();
1411:                HtmlComponent c;
1412:                HtmlContainer ret = new HtmlContainer("", page);
1413:                HtmlImage spacer = null;
1414:
1415:                if (_itemMarkerImg != null && !_itemMarkerImg.trim().equals("")
1416:                        && href != null && !href.trim().equals("")) {
1417:                    spacer = new HtmlImage("itemMarker" + unique,
1418:                            _itemMarkerImg, page);
1419:                    spacer.setHorizontalSpace(3);
1420:                    spacer.setOnLoad(getFullName() + "_imageLoaded();");
1421:                    ret.add(spacer);
1422:                }
1423:                if (_itemTitleMarkerImg != null
1424:                        && !_itemTitleMarkerImg.trim().equals("")
1425:                        && (href == null || href.trim().equals(""))) {
1426:                    spacer = new HtmlImage("itemTitleMarker" + unique,
1427:                            _itemTitleMarkerImg, page);
1428:                    spacer.setHorizontalSpace(3);
1429:                    spacer.setOnLoad(getFullName() + "_imageLoaded();");
1430:                    ret.add(spacer);
1431:                }
1432:                if (iHorSpacer > 0) {
1433:                    HtmlImage img = newHorizontalSpacer(iHorSpacer);
1434:                    if (img != null)
1435:                        ret.add(newHorizontalSpacer(iHorSpacer));
1436:                }
1437:
1438:                if (href != null && !href.trim().equals("")) {
1439:                    HtmlRaw hrSpan = new HtmlRaw("<SPAN CLASS=\""
1440:                            + _linkfontstyle.getStyleName() + "\">", page);
1441:                    ret.add(hrSpan);
1442:                    HtmlLink link = new HtmlLink("link" + unique, href, null,
1443:                            page);
1444:                    link.add(new HtmlRaw(caption, page));
1445:                    if (_itemMarkerImg != null
1446:                            && _itemMarkerMouserOverImg != null) {
1447:                        //	  link.setOnMouseOver("document."+spacer.getFullName()+".src='"+_itemMarkerMouserOverImg+"';");
1448:                        //	  link.setOnMouseOut("document."+spacer.getFullName()+".src='"+_itemMarkerImg+"';");
1449:                        link.setOnMouseOver("fnc" + getFullName()
1450:                                + "_ItemMarkerMouseOverImage(document."
1451:                                + spacer.getFullName() + ");");
1452:                        link.setOnMouseOut("fnc" + getFullName()
1453:                                + "_ItemMarkerImage(document."
1454:                                + spacer.getFullName() + ");");
1455:                    }
1456:                    if (target != null && !target.trim().equals(""))
1457:                        link.setTarget(target);
1458:                    link.setStyle(_linkstyle);
1459:                    c = link;
1460:                } else if (_fontStyle != null)
1461:                    c = new HtmlText(caption, _fontStyle, page);
1462:                else
1463:                    c = new HtmlText(caption, _groupname + ".CellFont", page);
1464:                ret.add(c);
1465:                if (c instanceof  HtmlLink) {
1466:                    HtmlRaw hrEndSpan = new HtmlRaw("</SPAN", page);
1467:                    ret.add(hrEndSpan);
1468:                }
1469:                return ret;
1470:            }
1471:
1472:            /**
1473:             * Constructs an HtmlLink component containing a text caption.
1474:             * @return HtmlContainer
1475:             * @param submenu	The Name of another group for SubMenu.
1476:             * @param caption	The text caption for the link.
1477:             * @param unique	A unique string to identify different entries in HTML for naming purposes.
1478:             */
1479:            protected HtmlContainer newEntry(String submenu, String href, String target, String caption, String unique) throws Exception {
1480:        HtmlPage page = getPage();
1481:        HtmlComponent c;
1482:        HtmlContainer ret = new HtmlContainer("submenuCell" + unique, page);
1483:        HtmlLink anchor = new HtmlLink("submenu" + getName() + unique, href, page);
1484:        HtmlTable tbl = new HtmlTable("submenuTable" + unique, page);
1485:        tbl.setCellPadding(0);
1486:        tbl.setSizeOption(HtmlTable.SIZE_PERCENT);
1487:        tbl.setWidth(100);
1488:/*	HtmlTableCellProperties navLinkTableCellProp = new HtmlTableCellProperties();
1489:	navLinkTableCellProp.setAlign(_cellAlign);
1490:	navLinkTableCellProp.setVertAlign(_cellVertAlign);
1491:	navLinkTableCellProp.setWrap(_wrap);
1492:	navLinkTableCellProp.setBackgroundColor(_cellBackgroundColor);
1493:	navLinkTableCellProp.setStyle(_cellStyle);*/
1494:        anchor.add(tbl);
1495:        HtmlContainer cont = new HtmlContainer("", getPage());
1496:        HtmlImage spacer = null;
1497:        if (_itemMarkerImg != null && !_itemMarkerImg.trim().equals("") && submenu != null && !submenu.trim().equals("")) {
1498:            spacer = new HtmlImage("itemMarker" + unique, _itemMarkerImg, page);
1499:            spacer.setHorizontalSpace(3);
1500:            spacer.setOnLoad(getFullName() + "_imageLoaded();");
1501:            cont.add(spacer);
1502:            //tbl.setComponentAt(0,col++,spacer/*,navLinkTableCellProp*/);
1503:        }
1504:        if (submenu != null && !submenu.trim().equals("")) {
1505:            String sParentGroup = _groupname;
1506:            if (_parentgroup != null)
1507:                sParentGroup = _parentgroup;
1508:            HtmlPopup htPop = null;
1509:            String sPopName = "popup" + getName() + unique;
1510:            boolean bPopupAllReadyAdded = false;
1511:            Enumeration enum = getPage().getComponents();
1512:            while (enum.hasMoreElements()) {
1513:                HtmlComponent hc = (HtmlComponent) enum.nextElement();
1514:                if (hc instanceof  HtmlPopup) {
1515:                    HtmlPopup hpPop = (HtmlPopup) hc;
1516:                    if (hpPop.getName().equals(sPopName)) {
1517:                        bPopupAllReadyAdded = true;
1518:                        htPop = hpPop;
1519:                        break;
1520:                    }
1521:                }
1522:            }
1523:            if (!bPopupAllReadyAdded) {
1524:                htPop = new HtmlPopup(sPopName, anchor, 150, true, false, true, page);
1525:                htPop.setCellPadding(_NavTableCellPadding);
1526:                NavigationMenu nmPopup;
1527:                htPop.add(nmPopup = new NavigationMenu(submenu + unique, page, submenu, sParentGroup));
1528:                Vector vPopups = nmPopup.getPopups();
1529:                if (vPopups != null && vPopups.size() > 0) {
1530:                    String sHideCondition = "";
1531:                    String sHideScript = "";
1532:                    for (int j = 0; j < vPopups.size(); j++) {
1533:                        sHideCondition += ((HtmlPopup) vPopups.elementAt(j)).getName() + ".style.visibility=='hidden' && ";
1534:                        sHideScript += ((HtmlPopup) vPopups.elementAt(j)).getName() + ".style.visibility='hidden';\n";
1535:                    }
1536:                    if (sHideCondition.endsWith("&& "))
1537:                        sHideCondition = sHideCondition.substring(0, sHideCondition.length() - 4);
1538:                    htPop.setHideCondition(sHideCondition);
1539:                    htPop.setHideScript(sHideScript);
1540:                    for (int j = 0; j < vPopups.size(); j++) {
1541:                        String sVisibleScript = "";
1542:                        HtmlPopup hpChildPop = (HtmlPopup) vPopups.elementAt(j);
1543:                        for (int k = 0; k < vPopups.size(); k++) {
1544:                            if (j == k)
1545:                                continue;
1546:                            sVisibleScript += ((HtmlPopup) vPopups.elementAt(k)).getName() + ".style.visibility='hidden';\n";
1547:                        }
1548:                        hpChildPop.setVisibleScript(sVisibleScript);
1549:                    }
1550:                }
1551:                _popups.addElement(htPop);
1552:            }
1553:            HtmlRaw hrSpan = new HtmlRaw("<SPAN CLASS=\"" + _linkfontstyle.getStyleName() + "\">", page);
1554:            cont.add(hrSpan);
1555:            HtmlLink lnk = new HtmlLink("submenuitem", href, page);
1556:            if (href == null || href.equals(""))
1557:                lnk.setOnClick("return false;");
1558:            lnk.setStyle(_linkstyle);
1559:            lnk.setTarget(target);
1560:            lnk.add(new HtmlRaw(caption, page));
1561:            cont.add(lnk);
1562:            HtmlRaw hrEndSpan = new HtmlRaw("</SPAN", page);
1563:            cont.add(hrEndSpan);
1564:            //tbl.setComponentAt(0,col++,lnk/*,navLinkTableCellProp*/);
1565:            if (_itemMarkerImg != null && _itemMarkerMouserOverImg != null) {
1566://		  link.setOnMouseOver("document."+spacer.getFullName()+".src='"+_itemMarkerMouserOverImg+"';");
1567://		  link.setOnMouseOut("document."+spacer.getFullName()+".src='"+_itemMarkerImg+"';");
1568:                anchor.setOnMouseOver("fnc" + getFullName() + "_ItemMarkerMouseOverImage(document." + spacer.getFullName() + ");" + htPop.getPopupShowScript());
1569:                anchor.setOnMouseOut("fnc" + getFullName() + "_ItemMarkerImage(document." + spacer.getFullName() + ");" + htPop.getPopupScript());
1570:/*		  String sMouseOver="this.className='"+_cellHoverStyle.getStyleName()+"';"+anchor.getFullName()+".className='"+_linkcellhoverstyle.getStyleName()+"';";
1571:		  String sMouseOut="this.className='"+_cellStyle.getStyleName()+"';"+anchor.getFullName()+".className='"+_linkstyle.getStyleName()+"';";
1572:		  navLinkTableCellProp.setOnMouseOver(sMouseOver+anchor.getOnMouseOver());
1573:	      navLinkTableCellProp.setOnMouseOut(sMouseOut+anchor.getOnMouseOut());*/
1574:            } else {
1575:                anchor.setOnMouseOver(htPop.getPopupShowScript());
1576:                anchor.setOnMouseOut(htPop.getPopupScript());
1577:            }
1578:            if (href == null || href.equals(""))
1579:                anchor.setOnClick("return false;");
1580:            anchor.setTarget(target);
1581:            anchor.setStyle(_linkstyle);
1582:            c = anchor;
1583:        } else if (_fontStyle != null)
1584:            c = new HtmlText(caption, _fontStyle, page);
1585:        else
1586:            c = new HtmlText(caption, _groupname + ".CellFont", page);
1587:        tbl.setComponentAt(0, 0, cont);
1588:        ret.add(c);
1589:        return ret;
1590:    }
1591:
1592:            /**
1593:             * Constructs an HtmlLink component containing a text caption.
1594:             * @return HtmlContainer
1595:             * @param submenu	The Name of another group for SubMenu.
1596:             * @param caption	The text caption for the link.
1597:             * @param unique	A unique string to identify different entries in HTML for naming purposes.
1598:             */
1599:            protected HtmlContainer newEntry(String submenu, String href, String target, String caption, String unique, int iHorSpacer) throws Exception {
1600:        HtmlPage page = getPage();
1601:        HtmlComponent c;
1602:        HtmlContainer ret = new HtmlContainer("submenuCell" + unique, page);
1603:        HtmlLink anchor = new HtmlLink("submenu" + getName() + unique, href, page);
1604:        HtmlTable tbl = new HtmlTable("submenuTable" + unique, page);
1605:        tbl.setCellPadding(0);
1606:        tbl.setSizeOption(HtmlTable.SIZE_PERCENT);
1607:        tbl.setWidth(100);
1608:/*	HtmlTableCellProperties navLinkTableCellProp = new HtmlTableCellProperties();
1609:	navLinkTableCellProp.setAlign(_cellAlign);
1610:	navLinkTableCellProp.setVertAlign(_cellVertAlign);
1611:	navLinkTableCellProp.setWrap(_wrap);
1612:	navLinkTableCellProp.setBackgroundColor(_cellBackgroundColor);
1613:	navLinkTableCellProp.setStyle(_cellStyle);*/
1614:        anchor.add(tbl);
1615:        HtmlContainer cont = new HtmlContainer("", getPage());
1616:        HtmlImage spacer = null;
1617:        if (_itemMarkerImg != null && !_itemMarkerImg.trim().equals("") && submenu != null && !submenu.trim().equals("")) {
1618:            spacer = new HtmlImage("itemMarker" + unique, _itemMarkerImg, page);
1619:            spacer.setHorizontalSpace(3);
1620:            spacer.setOnLoad(getFullName() + "_imageLoaded();");
1621:            cont.add(spacer);
1622:            //tbl.setComponentAt(0,col++,spacer/*,navLinkTableCellProp*/);
1623:        }
1624:        if (iHorSpacer > 0) {
1625:            HtmlImage img = newHorizontalSpacer(iHorSpacer);
1626:            if (img != null)
1627:                cont.add(newHorizontalSpacer(iHorSpacer));
1628:        }
1629:        if (submenu != null && !submenu.trim().equals("")) {
1630:            String sParentGroup = _groupname;
1631:            if (_parentgroup != null)
1632:                sParentGroup = _parentgroup;
1633:            HtmlPopup htPop = null;
1634:            String sPopName = "popup" + getName() + unique;
1635:            boolean bPopupAllReadyAdded = false;
1636:            Enumeration enum = getPage().getComponents();
1637:            while (enum.hasMoreElements()) {
1638:                HtmlComponent hc = (HtmlComponent) enum.nextElement();
1639:                if (hc instanceof  HtmlPopup) {
1640:                    HtmlPopup hpPop = (HtmlPopup) hc;
1641:                    if (hpPop.getName().equals(sPopName)) {
1642:                        bPopupAllReadyAdded = true;
1643:                        htPop = hpPop;
1644:                        break;
1645:                    }
1646:                }
1647:            }
1648:            if (!bPopupAllReadyAdded) {
1649:                htPop = new HtmlPopup(sPopName, anchor, 150, true, false, true, page);
1650:                htPop.setCellPadding(_NavTableCellPadding);
1651:                NavigationMenu nmPopup;
1652:                htPop.add(nmPopup = new NavigationMenu(submenu + unique, page, submenu, sParentGroup));
1653:                Vector vPopups = nmPopup.getPopups();
1654:                if (vPopups != null && vPopups.size() > 0) {
1655:                    String sHideCondition = "";
1656:                    String sHideScript = "";
1657:                    for (int j = 0; j < vPopups.size(); j++) {
1658:                        sHideCondition += ((HtmlPopup) vPopups.elementAt(j)).getName() + ".style.visibility=='hidden' && ";
1659:                        sHideScript += ((HtmlPopup) vPopups.elementAt(j)).getName() + ".style.visibility='hidden';\n";
1660:                    }
1661:                    if (sHideCondition.endsWith("&& "))
1662:                        sHideCondition = sHideCondition.substring(0, sHideCondition.length() - 4);
1663:                    htPop.setHideCondition(sHideCondition);
1664:                    htPop.setHideScript(sHideScript);
1665:                    for (int j = 0; j < vPopups.size(); j++) {
1666:                        String sVisibleScript = "";
1667:                        HtmlPopup hpChildPop = (HtmlPopup) vPopups.elementAt(j);
1668:                        for (int k = 0; k < vPopups.size(); k++) {
1669:                            if (j == k)
1670:                                continue;
1671:                            sVisibleScript += ((HtmlPopup) vPopups.elementAt(k)).getName() + ".style.visibility='hidden';\n";
1672:                        }
1673:                        hpChildPop.setVisibleScript(sVisibleScript);
1674:                    }
1675:                }
1676:                _popups.addElement(htPop);
1677:            }
1678:            HtmlRaw hrSpan = new HtmlRaw("<SPAN CLASS=\"" + _linkfontstyle.getStyleName() + "\">", page);
1679:            cont.add(hrSpan);
1680:            HtmlLink lnk = new HtmlLink("submenuitem", href, page);
1681:            if (href == null || href.equals(""))
1682:                lnk.setOnClick("return false;");
1683:            lnk.setStyle(_linkstyle);
1684:            lnk.setTarget(target);
1685:            lnk.add(new HtmlRaw(caption, page));
1686:            cont.add(lnk);
1687:            HtmlRaw hrEndSpan = new HtmlRaw("</SPAN", page);
1688:            cont.add(hrEndSpan);
1689:            //tbl.setComponentAt(0,col++,lnk/*,navLinkTableCellProp*/);
1690:            if (_itemMarkerImg != null && _itemMarkerMouserOverImg != null) {
1691://		  link.setOnMouseOver("document."+spacer.getFullName()+".src='"+_itemMarkerMouserOverImg+"';");
1692://		  link.setOnMouseOut("document."+spacer.getFullName()+".src='"+_itemMarkerImg+"';");
1693:                anchor.setOnMouseOver("fnc" + getFullName() + "_ItemMarkerMouseOverImage(document." + spacer.getFullName() + ");" + htPop.getPopupShowScript());
1694:                anchor.setOnMouseOut("fnc" + getFullName() + "_ItemMarkerImage(document." + spacer.getFullName() + ");" + htPop.getPopupScript());
1695:/*		  String sMouseOver="this.className='"+_cellHoverStyle.getStyleName()+"';"+anchor.getFullName()+".className='"+_linkcellhoverstyle.getStyleName()+"';";
1696:		  String sMouseOut="this.className='"+_cellStyle.getStyleName()+"';"+anchor.getFullName()+".className='"+_linkstyle.getStyleName()+"';";
1697:		  navLinkTableCellProp.setOnMouseOver(sMouseOver+anchor.getOnMouseOver());
1698:	      navLinkTableCellProp.setOnMouseOut(sMouseOut+anchor.getOnMouseOut());*/
1699:            } else {
1700:                anchor.setOnMouseOver(htPop.getPopupShowScript());
1701:                anchor.setOnMouseOut(htPop.getPopupScript());
1702:            }
1703:            if (href == null || href.equals(""))
1704:                anchor.setOnClick("return false;");
1705:            anchor.setTarget(target);
1706:            anchor.setStyle(_linkstyle);
1707:            c = anchor;
1708:        } else if (_fontStyle != null)
1709:            c = new HtmlText(caption, _fontStyle, page);
1710:        else
1711:            c = new HtmlText(caption, _groupname + ".CellFont", page);
1712:        tbl.setComponentAt(0, 0, cont);
1713:        ret.add(c);
1714:        return ret;
1715:    }
1716:
1717:            protected HtmlImage newHorizontalSpacer(int pixels) {
1718:                HtmlPage page = getPage();
1719:                Props pr = page.getPageProperties();
1720:                String sGroupName = _groupname;
1721:                if (_parentgroup != null && !_parentgroup.trim().equals("")
1722:                        && _useParentAttributes)
1723:                    sGroupName = _parentgroup;
1724:                String sHorizSpacerImage = pr.getProperty(sGroupName
1725:                        + ".Group.HorizSpacerImage");
1726:                if (sHorizSpacerImage == null
1727:                        || sHorizSpacerImage.trim().equals(""))
1728:                    return null;
1729:                HtmlImage img = new HtmlImage(sHorizSpacerImage, page);
1730:                img.setHorizontalSpace(pixels);
1731:                return img;
1732:            }
1733:
1734:            /**
1735:             * Creates a HtmlStyle object with the given name,type & property string containing the style information
1736:             * @return com.salmonllc.html.HtmlStyle
1737:             * @param name java.lang.String The name to be given to the style so that it can be reference in HTML
1738:             * @param type java.lang.String The type of style to generate e.g. A an anchor style, TD a table cell style etc.
1739:             * @param styleprop java.lang.String References a property in the properties file giving the style information for the HtmlStyle
1740:             */
1741:            public HtmlStyle newStyle(String name, String type, String styleprop) {
1742:                Props pr = getPage().getPageProperties();
1743:                String sStyle = "\t";
1744:                int i = 1;
1745:                while (true) {
1746:                    String StyleAttribute = pr.getProperty(styleprop + i);
1747:                    if (StyleAttribute == null)
1748:                        break;
1749:                    sStyle += StyleAttribute + ";\n\t";
1750:                    i++;
1751:                }
1752:                sStyle += "\n";
1753:                HtmlStyle ret = null;
1754:                if (i != 1)
1755:                    ret = new HtmlStyle(name, type, sStyle, getPage());
1756:                return ret;
1757:            }
1758:
1759:            protected HtmlImage newVerticalSpacer(int pixels) {
1760:                HtmlPage page = getPage();
1761:                Props pr = page.getPageProperties();
1762:                String sGroupName = _groupname;
1763:                if (_parentgroup != null && !_parentgroup.trim().equals("")
1764:                        && _useParentAttributes)
1765:                    sGroupName = _parentgroup;
1766:                String sVertSpacerImage = pr.getProperty(sGroupName
1767:                        + ".Group.VertSpacerImage");
1768:                if (sVertSpacerImage == null
1769:                        || sVertSpacerImage.trim().equals(""))
1770:                    return null;
1771:                HtmlImage img = new HtmlImage(sVertSpacerImage, page);
1772:                img.setVerticalSpace(pixels);
1773:                return img;
1774:            }
1775:
1776:            /**
1777:             * Causes the Navigation Menu to be regenerated.
1778:             */
1779:            public void refresh() throws Exception {
1780:                createTable();
1781:            }
1782:
1783:            /**
1784:             * Removes the HtmlPopups from the NavigationMenu.
1785:             * Creation date: (8/17/01 6:08:43 PM)
1786:             */
1787:            public void removePopups() {
1788:        for (int i = 0; i < _popups.size(); i++) {
1789:            HtmlPopup hpPop = (HtmlPopup) _popups.elementAt(i);
1790:            Enumeration enum = hpPop.getComponents();
1791:            NavigationMenu nm = (NavigationMenu) enum.nextElement();
1792:            nm.removePopups();
1793:            getPage().remove((HtmlPopup) _popups.elementAt(i));
1794:        }
1795:        _popups.removeAllElements();
1796:
1797:    }
1798:
1799:            /**
1800:             * Specifies whether to disable/enable the cell in a Navigation Menu to be a link or not.
1801:             * @param bDisable boolean Indicates to whether to disable/enable the link ability of cells within this Navigation Menu.
1802:             */
1803:            public void setDisableCellLink(boolean bDisable) {
1804:                _disableCellLink = bDisable;
1805:            }
1806:
1807:            /**
1808:             * Specifies whether the Navigation Menu is to be in its own layer.
1809:             * @param enable boolean Indicate whether the Navigation Menu is to be in its own layer
1810:             */
1811:            public void setEnableLayer(boolean enable) throws Exception {
1812:                _enableLayer = enable;
1813:                initNavigationProperties();
1814:                createTable();
1815:            }
1816:
1817:            /**
1818:             * Specifies the Group Name in the Properties File for the Navigation Menu to be built from.
1819:             * @param groupname the name of the group in the properties file describing the menu.
1820:             */
1821:            public void setGroup(String groupname) throws Exception {
1822:                _groupname = groupname;
1823:                initNavigationProperties();
1824:                createTable();
1825:            }
1826:
1827:            /**
1828:             * Changes the Href of an item in the Navigation Menu.
1829:             * @param groupIndex is the group index of the entry to change the HRef of.
1830:             * @param itemIndex is the item index of the entry to change the HRef of.
1831:             * @param href is the new URL for the HREF of the link.
1832:             */
1833:            public void setHref(int groupIndex, int itemIndex, String href) {
1834:                try {
1835:                    Group group = (Group) _groups.elementAt(groupIndex - 1);
1836:                    Item item = (Item) group._items.elementAt(itemIndex - 1);
1837:                    item._href = href;
1838:                    createTable();
1839:                } catch (Exception e) {
1840:                    e.printStackTrace();
1841:                }
1842:                /*  String sItemKey=_groupname+".Group"+groupIndex+".Item"+itemIndex;
1843:                 HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
1844:                 Enumeration enum=hc.getComponents();
1845:                 while(enum.hasMoreElements()) {
1846:                 HtmlComponent hcp=(HtmlComponent)enum.nextElement();
1847:                 if (hcp instanceof HtmlLink) {
1848:                 HtmlLink hl=(HtmlLink)hcp;
1849:                 hl.setHref(href);
1850:                 }
1851:                 }*/
1852:            }
1853:
1854:            /**
1855:             * This selects the current page shown if it has a reference in the menu.
1856:             */
1857:            public void setSelectedItem() {
1858:        clearSelectedItem();
1859:        outer_loop:
1860:        for (int i = 1; ; i++) {
1861:            for (int j = 1; ; j++) {
1862:                String sItemContainerKey = _groupname + ".Group" + i + ".Item" + j;
1863:                HtmlContainer hc = (HtmlContainer) _nav.get(sItemContainerKey);
1864:                if (hc == null) {
1865:                    if (j == 1) break outer_loop;
1866:                    break;
1867:                }
1868:                HtmlLink hl = null;
1869:                Enumeration enum = hc.getComponents();
1870:                while (enum.hasMoreElements()) {
1871:                    HtmlComponent hcp = (HtmlComponent) enum.nextElement();
1872:                    if (hcp instanceof  HtmlLink) {
1873:                        hl = (HtmlLink) hcp;
1874:                        String sHref = hl.getHref();
1875:                        if (isPage(sHref)) {
1876:                            _selectedGroupIndex = i;
1877:                            _selectedItemIndex = j;
1878:                            break outer_loop;
1879:                        }
1880:                    }
1881:                }
1882:            }
1883:        }
1884:        if (_selectedGroupIndex > 0 && _selectedItemIndex > 0)
1885:            setSelectedItem(_selectedGroupIndex, _selectedItemIndex);
1886:
1887:    }
1888:
1889:            /**
1890:             * Specify which item in the Navigation Menu is to be highlighted as selected..
1891:             * @param groupIndex int group index of item to select in menu.
1892:             * @param itemIndex int item index of item to select in menu.
1893:             */
1894:            public void setSelectedItem(int groupIndex, int itemIndex) {
1895:        clearSelectedItem();
1896:        String sItemContainerKey = _groupname + ".Group" + groupIndex + ".Item" + itemIndex;
1897:        String sItemCellPropKey = _groupname + ".Group" + groupIndex + ".Item" + itemIndex + "CELLPROP";
1898:        HtmlContainer hc = (HtmlContainer) _nav.get(sItemContainerKey);
1899:        if (hc == null)
1900:            return;
1901:        HtmlTableCellProperties htcp = (HtmlTableCellProperties) _nav.get(sItemCellPropKey);
1902:        HtmlLink hl = null;
1903:        HtmlImage hi = null;
1904:        Enumeration enum = hc.getComponents();
1905:        while (enum.hasMoreElements()) {
1906:            HtmlComponent hcp = (HtmlComponent) enum.nextElement();
1907:            if (hcp instanceof  HtmlLink) {
1908:                hl = (HtmlLink) hcp;
1909:                Enumeration enumLink = hl.getComponents();
1910:                outer:
1911:                while (enumLink.hasMoreElements()) {
1912:                    HtmlComponent hcpLink = (HtmlComponent) enumLink.nextElement();
1913:                    if (hcpLink instanceof  HtmlTable) {
1914:                        HtmlContainer hcCont = (HtmlContainer) ((HtmlTable) hcpLink).getComponents().nextElement();
1915:                        Enumeration enumCont = hcCont.getComponents();
1916:                        while (enumCont.hasMoreElements()) {
1917:                            HtmlComponent hcpCont = (HtmlComponent) enumCont.nextElement();
1918:                            if (hcpCont instanceof  HtmlLink) {
1919:                                hl = (HtmlLink) hcpCont;
1920:                                break outer;
1921:                            }
1922:                        }
1923:                    }
1924:                }
1925:
1926:            }
1927:            if (hcp instanceof  HtmlImage) {
1928:                if (hcp.getName().startsWith("itemMarker")) {
1929:                    hi = (HtmlImage) hcp;
1930:                }
1931:            }
1932:        }
1933:        if (hi != null) {
1934:            if (_selectedItemMarkerImg != null)
1935:                hi.setSource(_selectedItemMarkerImg);
1936:        }
1937:        if (hl != null) {
1938:            if (_selectedStyle != null)
1939:                hl.setStyle(_selectedStyle);
1940:            if (_selectedItemMarkerImg != null && hi != null && _itemMarkerMouserOverImg != null)
1941:                hl.setOnMouseOut("fnc" + getFullName() + "_SelectedItemMarkerImage(document." + hi.getFullName() + ");");
1942://	  hl.setOnMouseOut("document."+hi.getFullName()+".src='"+_selectedItemMarkerImg+"';");
1943:            if (_selectedItemMarkerMouseOverImg != null && hi != null && _itemMarkerMouserOverImg != null)
1944:                hl.setOnMouseOver("fnc" + getFullName() + "_SelectedItemMarkerMouseOverImage(document." + hi.getFullName() + ");");
1945://	  hl.setOnMouseOver("document."+hi.getFullName()+".src='"+_selectedItemMarkerMouseOverImg+"';");
1946:        }
1947:
1948:        if (htcp != null) {
1949:            htcp.setStyle(_selectedCellStyle);
1950:            if (hl != null) {
1951:                String sMouseOver;
1952:                String sMouseOut;
1953:                if (_selectedCellHoverStyle != null && _selectedHoverStyle != null)
1954:                    sMouseOver = "this .className='" + _selectedCellHoverStyle.getStyleName() + "';" + hl.getFullName() + ".className='" + _selectedHoverStyle.getStyleName() + "';";
1955:                else
1956:                    sMouseOver = "this .className='" + _cellHoverStyle.getStyleName() + "';" + hl.getFullName() + ".className='" + _linkcellhoverstyle.getStyleName() + "';";
1957:                if (_selectedStyle != null && _selectedCellStyle != null)
1958:                    sMouseOut = "this .className='" + _selectedCellStyle.getStyleName() + "';" + hl.getFullName() + ".className='" + _selectedStyle.getStyleName() + "';";
1959:                else
1960:                    sMouseOut = "this .className='" + _cellStyle.getStyleName() + "';" + hl.getFullName() + ".className='" + _linkstyle.getStyleName() + "';";
1961:                if (hi != null) {
1962:                    sMouseOver += hl.getOnMouseOver();
1963:                    sMouseOut += hl.getOnMouseOut();
1964:                }
1965:                htcp.setOnMouseOver(sMouseOver);
1966:                htcp.setOnMouseOut(sMouseOut);
1967:                htcp.setOnClick("document.location='" + hl.getHref() + "';");
1968:            }
1969:            _selectedGroupIndex = groupIndex;
1970:            _selectedItemIndex = itemIndex;
1971:        }
1972:    }
1973:
1974:            /**
1975:             * This selects the item via pagename if it exists in the menu.
1976:             */
1977:            public void setSelectedItem(String pageName) {
1978:        clearSelectedItem();
1979:        outer_loop:
1980:        for (int i = 1; ; i++) {
1981:            for (int j = 1; ; j++) {
1982:                String sItemContainerKey = _groupname + ".Group" + i + ".Item" + j;
1983:                HtmlContainer hc = (HtmlContainer) _nav.get(sItemContainerKey);
1984:                if (hc == null) {
1985:                    if (j == 1) break outer_loop;
1986:                    break;
1987:                }
1988:                HtmlLink hl = null;
1989:                Enumeration enum = hc.getComponents();
1990:                while (enum.hasMoreElements()) {
1991:                    HtmlComponent hcp = (HtmlComponent) enum.nextElement();
1992:                    if (hcp instanceof  HtmlLink) {
1993:                        hl = (HtmlLink) hcp;
1994:                        String sHref = hl.getHref();
1995:                        if (isPage(sHref, pageName)) {
1996:                            _selectedGroupIndex = i;
1997:                            _selectedItemIndex = j;
1998:                            break outer_loop;
1999:                        }
2000:                    }
2001:                }
2002:            }
2003:        }
2004:        if (_selectedGroupIndex > 0 && _selectedItemIndex > 0)
2005:            setSelectedItem(_selectedGroupIndex, _selectedItemIndex);
2006:
2007:    }
2008:
2009:            /**
2010:             * Specifies how the Navigation Menu is to be sized, via percatage or pixels.
2011:             * @param sizeoption int A constant representing the type of size option.
2012:             */
2013:            public void setSizeOption(int sizeoption) {
2014:                _sizeOption = sizeoption;
2015:                _table.setSizeOption(sizeoption);
2016:            }
2017:
2018:            /**
2019:             * Sets the target window for the link of an item in the Navigation Menu.
2020:             * @param groupIndex is the group index of the entry to change the target of.
2021:             * @param itemIndex is the item index of the entry to change the target of.
2022:             * @param target is the new target associated with the link.
2023:             */
2024:            public void setTarget(int groupIndex, int itemIndex, String target) {
2025:                try {
2026:                    Group group = (Group) _groups.elementAt(groupIndex - 1);
2027:                    Item item = (Item) group._items.elementAt(itemIndex - 1);
2028:                    item._target = target;
2029:                    createTable();
2030:                } catch (Exception e) {
2031:                    e.printStackTrace();
2032:                }
2033:                /*  String sItemKey=_groupname+".Group"+groupIndex+".Item"+itemIndex;
2034:                 HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
2035:                 Enumeration enum=hc.getComponents();
2036:                 while(enum.hasMoreElements()) {
2037:                 HtmlComponent hcp=(HtmlComponent)enum.nextElement();
2038:                 if (hcp instanceof HtmlLink) {
2039:                 HtmlLink hl=(HtmlLink)hcp;
2040:                 hl.setTarget(target);
2041:                 }
2042:                 }*/
2043:            }
2044:
2045:            /**
2046:             * Sets the title displayed of an item in the Navigation Menu.
2047:             * @param groupIndex is the group index of the entry to change the caption of.
2048:             * @param itemIndex is the item index of the entry to change the caption of.
2049:             * @param title is the new caption for the item.
2050:             */
2051:            public void setTitle(int groupIndex, int itemIndex, String title) {
2052:                try {
2053:                    Group group = (Group) _groups.elementAt(groupIndex - 1);
2054:                    Item item = (Item) group._items.elementAt(itemIndex - 1);
2055:                    item._title = title;
2056:                    createTable();
2057:                } catch (Exception e) {
2058:                    e.printStackTrace();
2059:                }
2060:
2061:                /*  String sItemKey=_groupname+".Group"+groupIndex+".Item"+itemIndex;
2062:                 HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
2063:                 Enumeration enum=hc.getComponents();
2064:                 while(enum.hasMoreElements()) {
2065:                 HtmlComponent hcp=(HtmlComponent)enum.nextElement();
2066:                 if (hcp instanceof HtmlText) {
2067:                 HtmlText ht=(HtmlText)hcp;
2068:                 ht.setText(title);
2069:                 }
2070:                 if (hcp instanceof HtmlRaw) {
2071:                 HtmlRaw hr=(HtmlRaw)hcp;
2072:                 hr.setHtml(title);
2073:                 }
2074:                 if (hcp instanceof HtmlLink) {
2075:                 Enumeration linkEnum=((HtmlLink)hcp).getComponents();
2076:                 while(linkEnum.hasMoreElements()) {
2077:                 HtmlComponent hcpLink=(HtmlComponent)enum.nextElement();
2078:                 if (hcpLink instanceof HtmlText) {
2079:                 HtmlText ht=(HtmlText)hcp;
2080:                 ht.setText(title);
2081:                 }
2082:                 if (hcpLink instanceof HtmlRaw) {
2083:                 HtmlRaw hr=(HtmlRaw)hcp;
2084:                 hr.setHtml(title);
2085:                 }
2086:                 }
2087:                 }
2088:                 }*/
2089:            }
2090:
2091:            /**
2092:             * Sets whether the item is visible or not.
2093:             * @param groupIndex is the group index of the entry to hide/show.
2094:             * @param itemIndex is the item index of the entry to hide/show.
2095:             * @param visible is to indicate whether the item should be shown or not.
2096:             */
2097:            public void setVisible(int groupIndex, int itemIndex,
2098:                    boolean visible) {
2099:                /*  String sItemKey=_groupname+".Group"+groupIndex+".Item"+itemIndex;
2100:                 HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
2101:                 hc.setVisible(visible);
2102:                 String sItemCellPropKey=_groupname+".Group"+groupIndex+".Item"+itemIndex+"CELLPROP";
2103:                 HtmlTableCellProperties htcp=(HtmlTableCellProperties)_nav.get(sItemCellPropKey);
2104:                 HtmlLink hl=null;
2105:                 HtmlImage hi=null;
2106:                 Enumeration enum=hc.getComponents();
2107:                 while(enum.hasMoreElements()) {
2108:                 HtmlComponent hcp=(HtmlComponent)enum.nextElement();
2109:                 if (hcp instanceof HtmlLink) {
2110:                 hl=(HtmlLink)hcp;
2111:                 }
2112:                 if (hcp instanceof HtmlImage) {
2113:                 if (hcp.getName().startsWith("itemMarker")) {
2114:                 hi=(HtmlImage)hcp;
2115:                 }
2116:                 }
2117:                 }
2118:                 if (htcp!=null) {
2119:                 if (visible==false) {
2120:                 htcp.setOnMouseOver(null);
2121:                 htcp.setOnMouseOut(null);
2122:                 }
2123:                 else
2124:                 if (hl!=null && visible==true) {
2125:                 String sMouseOver="this.className='"+_cellHoverStyle.getStyleName()+"';"+hl.getFullName()+".className='"+_linkcellhoverstyle.getStyleName()+"';";
2126:                 String sMouseOut="this.className='"+_cellStyle.getStyleName()+"';"+hl.getFullName()+".className='"+_linkstyle.getStyleName()+"';";
2127:                 if (hi!=null) {
2128:                 sMouseOver+=hl.getOnMouseOver();
2129:                 sMouseOut+=hl.getOnMouseOut();
2130:                 }
2131:                 htcp.setOnMouseOver(sMouseOver);
2132:                 htcp.setOnMouseOut(sMouseOut);
2133:                 htcp.setOnClick("document.location='"+hl.getHref()+"';");
2134:                 }
2135:                 }*/
2136:                try {
2137:                    Group group = (Group) _groups.elementAt(groupIndex - 1);
2138:                    Item item = (Item) group._items.elementAt(itemIndex - 1);
2139:                    item._visible = visible;
2140:                    createTable();
2141:                } catch (Exception e) {
2142:                    e.printStackTrace();
2143:                }
2144:            }
2145:
2146:            /**
2147:             * Sets whether the group is visible or not.
2148:             * @param groupIndex is the group index of the entry to hide/show.
2149:             * @param visible is to indicate whether the item should be shown or not.
2150:             */
2151:            public void setVisible(int groupIndex, boolean visible) {
2152:                /*  for (int i=1;;i++)
2153:                 {
2154:                 String sItemKey=_groupname+".Group"+groupIndex+".Item"+ i;
2155:                 HtmlContainer hc=(HtmlContainer)_nav.get(sItemKey);
2156:                 if (hc==null)
2157:                 break;
2158:                 setVisible(groupIndex,i,visible);
2159:                 //	   hc.setVisible(visible);
2160:                 }
2161:                 String sImageKey=_groupname+".Group"+groupIndex+".Image";
2162:                 HtmlImage hi=(HtmlImage)_nav.get(sImageKey);
2163:                 if (hi!=null)
2164:                 hi.setVisible(visible);*/
2165:                try {
2166:                    Group group = (Group) _groups.elementAt(groupIndex - 1);
2167:                    group._visible = visible;
2168:                    createTable();
2169:                } catch (Exception e) {
2170:                    e.printStackTrace();
2171:                }
2172:            }
2173:
2174:            /**
2175:             * This hides/shows the item via pagename if it exists in the menu.
2176:             */
2177:            public void setVisible(String pageName, boolean visible) {
2178:        outer_loop:
2179:        for (int i = 1; ; i++) {
2180:            for (int j = 1; ; j++) {
2181:                String sItemContainerKey = _groupname + ".Group" + i + ".Item" + j;
2182:                HtmlContainer hc = (HtmlContainer) _nav.get(sItemContainerKey);
2183:                if (hc == null) {
2184:                    if (j == 1) break outer_loop;
2185:                    break;
2186:                }
2187:                HtmlLink hl = null;
2188:                Enumeration enum = hc.getComponents();
2189:                while (enum.hasMoreElements()) {
2190:                    HtmlComponent hcp = (HtmlComponent) enum.nextElement();
2191:                    if (hcp instanceof  HtmlLink) {
2192:                        hl = (HtmlLink) hcp;
2193:                        String sHref = hl.getHref();
2194:                        if (isPage(sHref, pageName)) {
2195:                            setVisible(i, j, visible);
2196:                            break outer_loop;
2197:                        }
2198:                    }
2199:                }
2200:            }
2201:        }
2202:
2203:    }
2204:
2205:            /**
2206:             * Sets the width of the Navigation Menu.
2207:             * @param width int The Width of the Navigation Menu
2208:             */
2209:            public void setWidth(int width) {
2210:                _width = width;
2211:                _table.setWidth(width);
2212:            }
2213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.