You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/03/14 13:57:56 UTC
svn commit: r1577508 - in /myfaces/tobago/trunk/tobago-theme:
tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/
tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/...
Author: lofwyr
Date: Fri Mar 14 12:57:56 2014
New Revision: 1577508
URL: http://svn.apache.org/r1577508
Log:
TOBAGO-1279: Menu: Icons and arrow are miss on items with submenu
- fix icon position
- using background-image
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1577508&r1=1577507&r2=1577508&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Fri Mar 14 12:57:56 2014
@@ -548,15 +548,6 @@ li.tobago-menu-markup-selected {
border-style: solid;
}
-.tobago-menu-subitem-ancor {
- margin-right: 20px;
-}
-
-.tobago-menu-subitem-arrow {
- float: right;
- margin-top: -17px;
-}
-
.tobago-menu-contextMenu, .tobago-menu-dropDownMenu {
display: inline;
width: 0;
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less?rev=1577508&r1=1577507&r2=1577508&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less Fri Mar 14 12:57:56 2014
@@ -384,15 +384,6 @@ li.tobago-menu-markup-selected {
border-color: #888888;
}
-.tobago-menu-subitem-ancor {
- margin-right: 16px;
-}
-
-.tobago-menu-subitem-arrow {
- float: right;
- margin-top: -16px;
-}
-
/* messages --------------------------------------------------------------- */
.tobago-messages {
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuRenderer.java?rev=1577508&r1=1577507&r2=1577508&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuRenderer.java Fri Mar 14 12:57:56 2014
@@ -67,18 +67,41 @@ public class MenuRenderer extends Layout
writer.startElement(HtmlElements.LI, menu);
writer.writeClassAttribute(Classes.create(menu));
+ StringBuilder backgroundImage = null;
+ StringBuilder backgroundPosition = null;
if (menu.getImage() != null) {
+ backgroundImage = new StringBuilder();
+ backgroundPosition = new StringBuilder();
+
+ backgroundImage.append("url('");
+ backgroundImage.append(
+ ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, menu.getImage(), menu.isDisabled()));
+ backgroundImage.append( "')");
+ backgroundPosition.append("left center");
+ }
+ if (isParentMenu && !firstLevel) {
+ if (backgroundImage == null) {
+ backgroundImage = new StringBuilder();
+ backgroundPosition = new StringBuilder();
+ } else {
+ backgroundImage.append(",");
+ backgroundPosition.append(",");
+ }
+
+ backgroundImage.append("url('");
+ backgroundImage.append(
+ ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, "image/MenuArrow.gif", menu.isDisabled()));
+ backgroundImage.append( "')");
+ backgroundPosition.append("right center");
+ }
+ if (backgroundImage != null) {
final Style style = new Style();
- style.setBackgroundImage("url('"
- + ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, menu.getImage(), menu.isDisabled())
- + "')");
+ style.setBackgroundImage(backgroundImage.toString());
+ style.setBackgroundPosition(backgroundPosition.toString());
writer.writeStyleAttribute(style);
}
writer.startElement(HtmlElements.A, menu);
writer.writeAttribute(HtmlAttributes.HREF, "#", false);
- if (isParentMenu && !firstLevel) {
- writer.writeClassAttribute(Classes.create(menu, "subitem-ancor"));
- }
if (component != null && !component.isTransient()) {
writer.writeIdAttribute(component.getClientId(facesContext));
}
@@ -98,14 +121,6 @@ public class MenuRenderer extends Layout
}
writer.endElement(HtmlElements.A);
if (isParentMenu) {
- if (!firstLevel) {
- writer.startElement(HtmlElements.IMG, menu);
- final String arrow = ResourceManagerUtils
- .getImageOrDisabledImageWithPath(facesContext, "image/MenuArrow.gif", menu.isDisabled());
- writer.writeAttribute(HtmlAttributes.SRC, arrow, false);
- writer.writeClassAttribute(Classes.create(menu, "subitem-arrow"));
- writer.endElement(HtmlElements.IMG);
- }
writer.startElement(HtmlElements.OL, menu);
}
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1577508&r1=1577507&r2=1577508&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Mar 14 12:57:56 2014
@@ -996,10 +996,53 @@ var Tobago = {
// element styles
Tobago.Utils.selectWidthJQuery(elements, "[data-tobago-style]").each(function () {
var element = jQuery(this);
+ if (Tobago.browser.isMsie678) { // IE before 9 doen't support multiple backgrounds, so we use only the first.
+ Tobago.fixMultiBackgroundIE8(element);
+ }
element.css(element.data("tobago-style"));
});
},
+ /* supports only two background images in the moment */
+ fixMultiBackgroundIE8: function (element) {
+ var style = element.data("tobago-style");
+ var index;
+ var backgroundImage = style.backgroundImage;
+ var backgroundImage2;
+ if (backgroundImage) {
+ index = backgroundImage.indexOf(",");
+ if (index > -1) {
+ style.backgroundImage = backgroundImage.substring(0, index);
+ backgroundImage2 = backgroundImage.substring(index + 1);
+ }
+ }
+ var backgroundPosition = style.backgroundPosition;
+ var backgroundPosition2;
+ if (backgroundPosition) {
+ index = backgroundPosition.indexOf(",");
+ if (index > -1) {
+ style.backgroundPosition = backgroundPosition.substring(0, index);
+ backgroundPosition2 = backgroundPosition.substring(index + 1);
+ }
+ }
+ if (backgroundImage2) {
+ var extra = jQuery("<span>").appendTo(element);
+ extra.css({
+ backgroundImage: backgroundImage2,
+ backgroundPosition: backgroundPosition2,
+ backgroundRepeat: "no-repeat",
+ position: "absolute",
+ left: "0",
+ right: "0",
+ top: "0",
+ bottom: "0"
+ });
+ element.css({
+ position: "relative"
+ });
+ }
+ },
+
preventFrameAttacks: function() {
if (self == top) {
jQuery(".tobago-page-preventFrameAttacks").removeClass("tobago-page-preventFrameAttacks");