@@ -504,6 +504,8 @@ protected void restoreCellNodes(DOMNode td) {
504504 *
505505 */
506506 protected boolean isSimpleButton , isLabel ;
507+
508+ protected boolean isMenuBarLabel ;
507509
508510 protected int x , y ;
509511
@@ -1734,7 +1736,7 @@ public Dimension getHTMLSize(DOMNode obj) {
17341736 }
17351737
17361738 private Dimension getIconSize (AbstractButton b ) {
1737-
1739+ //
17381740 return (iconNode == null || imageNode == null || b .getIcon () == null ? null
17391741 : new Dimension (b .getIcon ().getIconWidth (), b .getIcon ().getIconHeight ()));
17401742 }
@@ -3035,10 +3037,10 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
30353037 itop = 70 ;
30363038 iscale = "scale(0.8,0.8)" ;
30373039 }
3038-
30393040 break ;
30403041 }
30413042 if (itop >= 0 ) {
3043+ if (!isLabel || !isMenuBarLabel )
30423044 addJSKeyVal (cssTxt , "top" , top + "%" , "transform" ,
30433045 "translateY(" + (yoff == null ? "-" + top + "%" : yoff ) + ")" + voff );
30443046 addJSKeyVal (cssIcon , "top" , top + "%" , "transform" , "translateY(-" + itop + "%)" + voff + iscale );
@@ -3067,6 +3069,10 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
30673069 }
30683070
30693071 private void setMenuAnchorAndAccelerator (AbstractButton b , int wCtr , boolean ltr , Insets margins ) {
3072+ if (isLabel ) {
3073+ // allowing label here -- not nec AbstractButton
3074+ return ;
3075+ }
30703076 int wAccel = 0 ;
30713077 if (isMenu ) {
30723078 // Correct for dimText calc losing position:absolute
@@ -3847,5 +3853,40 @@ public void setPasteHandler(JSFunction handler) {
38473853 }
38483854 }
38493855
3856+ public boolean createItemNode (String type , Icon icon , int gap , String text , DOMNode buttonNode ) {
3857+ itemNode = newDOMObject ("li" , id );
3858+ if (text == null && icon == null )
3859+ return false ;
3860+ DOMNode .setStyle (itemNode , "outline" , "none" );
3861+ menuAnchorNode = newDOMObject ("div" , id + "_a" );// this needed? , "tabindex", "8");
3862+ if (type != "_bar" ) {
3863+ addClass (menuAnchorNode , "a" );
3864+ // DOMNode.setStyles(menuAnchorNode, "margin", "1px 2px 1px 2px", "height", "1em");
3865+ }
3866+ itemNode .appendChild (menuAnchorNode );
3867+ setDoPropagate ();
3868+ if (buttonNode == null ) {
3869+ // not a radio or checkbox
3870+ addCentering (menuAnchorNode );
3871+ enableNode = itemNode ;
3872+ setIconAndText ("btn" , icon , gap , text );
3873+ } else {
3874+ menuAnchorNode .appendChild (buttonNode );
3875+ setMenuItem (buttonNode );
3876+ }
3877+ setMenuItem (menuAnchorNode );
3878+ setMenuItem ();
3879+ return true ;
3880+ }
3881+
3882+ protected void setMenuItem () {
3883+ setMenuItem (itemNode );
3884+ setMenuItem (iconNode );
3885+ if (actionNode != null && actionNode != iconNode )
3886+ setMenuItem (actionNode );
3887+ setMenuItem (textNode );
3888+ setMenuItem (centeringNode );
3889+ }
3890+
38503891
38513892}
0 commit comments