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 2010/05/25 16:37:57 UTC
svn commit: r948063 [2/2] - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ta...
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Tue May 25 14:37:55 2010
@@ -20,7 +20,6 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.CreateComponentUtils;
import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UIMenu;
import org.apache.myfaces.tobago.component.UIMenuSelectOne;
import org.apache.myfaces.tobago.component.UISelectBooleanCommand;
import org.apache.myfaces.tobago.component.UISelectOneCommand;
@@ -29,9 +28,10 @@ import org.apache.myfaces.tobago.context
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
import org.apache.myfaces.tobago.context.ResourceManagerUtils;
import org.apache.myfaces.tobago.internal.component.UICommandBase;
-import org.apache.myfaces.tobago.internal.util.AccessKeyMap;
+import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
+import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
@@ -43,7 +43,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
@@ -69,50 +68,58 @@ public abstract class ToolBarRendererBas
return (String) component.getAttributes().get(Attributes.ICON_SIZE);
}
+ protected boolean isRightAligned(UIToolBar toolBar) {
+ return UIToolBar.ORIENTATION_RIGHT.equals(toolBar.getOrientation());
+ }
+
@Override
- public void encodeEnd(FacesContext context, UIComponent uiComponent) throws IOException {
- UIPanel toolbar = (UIPanel) uiComponent;
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+ UIToolBar toolBar = (UIToolBar) component;
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(context);
- List children = toolbar.getChildren();
+ List children = toolBar.getChildren();
+ Measure width = Measure.valueOf(-1);
boolean first = true;
for (Iterator iter = children.iterator(); iter.hasNext();) {
- UIComponent component = (UIComponent) iter.next();
- if (component instanceof UICommandBase) {
+ UIComponent command = (UIComponent) iter.next();
+ if (command instanceof UICommandBase) {
boolean last = !iter.hasNext();
- renderToolbarCommand(context, (UICommandBase) component, writer, first, last);
+ width = renderToolbarCommand(context, toolBar, (UICommandBase) command, writer, first, last, width);
first = false;
} else {
- LOG.error("Illegal UIComponent class in toolbar (not UICommandBase):" + component.getClass().getName());
+ LOG.error("Illegal UIComponent class in toolbar (not UICommandBase):" + command.getClass().getName());
}
}
}
- private void renderToolbarCommand(FacesContext facesContext,
- final UICommandBase command, TobagoResponseWriter writer, boolean first, boolean last)
+ private Measure renderToolbarCommand(FacesContext facesContext, final UIToolBar toolBar,
+ final UICommandBase command, TobagoResponseWriter writer, boolean first, boolean last, Measure width)
throws IOException {
if (command instanceof UISelectBooleanCommand) {
- renderSelectBoolean(facesContext, command, writer, first, last);
+ return renderSelectBoolean(facesContext, toolBar, command, writer, first, last, width);
} else if (command instanceof UISelectOneCommand) {
- renderSelectOne(facesContext, command, writer, first, last);
+ return renderSelectOne(facesContext, toolBar, command, writer, first, last, width);
} else {
if (command.getFacet(Facets.RADIO) != null) {
- renderSelectOne(facesContext, command, writer, first, last);
+ return renderSelectOne(facesContext, toolBar, command, writer, first, last, width);
} else if (command.getFacet(Facets.CHECKBOX) != null) {
- renderSelectBoolean(facesContext, command, writer, first, last);
+ return renderSelectBoolean(facesContext, toolBar, command, writer, first, last, width);
} else {
- String onClick = createOnClick(facesContext, command);
- renderToolbarButton(facesContext, command, writer, first, last, false, onClick);
+ String onCommandClick = createCommandOnClick(facesContext, command);
+ String onMenuClick = createMenuOnClick(command);
+ return renderToolbarButton(
+ facesContext, toolBar, command, writer, first, last, false, onCommandClick, onMenuClick, width);
}
}
}
- private void renderSelectOne(FacesContext facesContext, UICommandBase command,
- TobagoResponseWriter writer, boolean first, boolean last)
+ private Measure renderSelectOne(
+ FacesContext facesContext, UIToolBar toolBar, UICommandBase command,
+ TobagoResponseWriter writer, boolean first, boolean last, Measure width)
throws IOException {
- String onclick = createOnClick(facesContext, command);
+ String onclick = createCommandOnClick(facesContext, command);
List<SelectItem> items;
@@ -125,21 +132,19 @@ public abstract class ToolBarRendererBas
items = RenderUtils.getSelectItems(radio);
}
-
if (radio != null) {
Object value = radio.getValue();
boolean markFirst = !ComponentUtils.hasSelectedValue(items, value);
String radioId = radio.getClientId(facesContext);
- String onClickPrefix = "menuSetRadioValue('" + radioId + "', '";
+ String onClickPrefix = "tobago_toolBarSetRadioValue('" + radioId + "', '";
String onClickPostfix = onclick != null ? "') ; " + onclick : "";
for (SelectItem item : items) {
final String labelText = item.getLabel();
if (labelText != null) {
command.getAttributes().put(Attributes.LABEL, labelText);
} else {
- LOG.warn("Menu item has label=null. UICommand.getClientId()="
- + command.getClientId(facesContext));
+ LOG.warn("Menu item has label=null. UICommand.getClientId()=" + command.getClientId(facesContext));
}
String image = null;
@@ -157,9 +162,7 @@ public abstract class ToolBarRendererBas
command.getAttributes().put(Attributes.TIP, item.getDescription());
}
-
- String formattedValue
- = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
+ String formattedValue = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
onclick = onClickPrefix + formattedValue + onClickPostfix;
final boolean checked;
if (item.getValue().equals(value) || markFirst) {
@@ -170,15 +173,16 @@ public abstract class ToolBarRendererBas
checked = false;
}
- renderToolbarButton(facesContext, command, writer, first, last, checked, onclick);
+ width = renderToolbarButton(facesContext, toolBar, command, writer, first, last, checked, onclick, null, width);
}
}
-
+ return width;
}
- private void renderSelectBoolean(FacesContext facesContext, UICommandBase command,
- TobagoResponseWriter writer, boolean first, boolean last)
+ private Measure renderSelectBoolean(
+ FacesContext facesContext, UIToolBar toolBar, UICommandBase command, TobagoResponseWriter writer,
+ boolean first, boolean last, Measure width)
throws IOException {
UIComponent checkbox = command.getFacet(Facets.CHECKBOX);
@@ -187,170 +191,250 @@ public abstract class ToolBarRendererBas
}
final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.VALUE);
+ final String clientId = checkbox.getClientId(facesContext);
- String onClick = createOnClick(facesContext, command);
+ String onClick = createCommandOnClick(facesContext, command);
+ onClick = "tobago_toolBarCheckToggle('" + clientId + "');" + (onClick != null ? onClick : "");
- String clientId = checkbox.getClientId(facesContext);
- onClick = RenderUtils.addMenuCheckToggle(clientId, onClick);
if (checked) {
- writer.writeJavascript(" menuCheckToggle('" + clientId + "');\n");
+ // to initialize the client state
+ writer.writeJavascript(" tobago_toolBarCheckToggle('" + clientId + "');\n");
}
- renderToolbarButton(facesContext, command, writer, first, last, checked, onClick);
+ return renderToolbarButton(facesContext, toolBar, command, writer, first, last, checked, onClick, null, width);
}
- private void renderToolbarButton(
- FacesContext facesContext, UICommandBase command, TobagoResponseWriter writer,
- boolean first, boolean last, boolean selected, String onClick)
+
+ private Measure renderToolbarButton(
+ FacesContext facesContext, UIToolBar toolBar, UICommandBase command, TobagoResponseWriter writer,
+ boolean first, boolean last, boolean selected, String commandClick, String menuClick, Measure width)
throws IOException {
if (!command.isRendered()) {
- return;
+ return width;
}
final String clientId = command.getClientId(facesContext);
final boolean disabled = ComponentUtils.getBooleanAttribute(command, Attributes.DISABLED);
final LabelWithAccessKey label = new LabelWithAccessKey(command);
final UIComponent popupMenu = command.getFacet(Facets.MENUPOPUP);
+ final ResourceManager resources = getResourceManager();
+
+ final String labelPosition = getLabelPosition(command.getParent());
+ final String iconSize = getIconSize(command.getParent());
+ final String iconName = (String) command.getAttributes().get(Attributes.IMAGE);
+ final String image;
+ final boolean lackImage = iconName == null;
+ if (lackImage) {
+ image = ResourceManagerUtils.getImageWithPath(facesContext, "image/1x1.gif");
+ } else {
+ image = getImage(facesContext, iconName, iconSize, disabled, selected);
+ }
+ final String graphicId = clientId + ComponentUtils.SUB_SEPARATOR + "icon";
- String labelPosition = getLabelPosition(command.getParent());
- String iconSize = getIconSize(command.getParent());
+ final boolean showIcon = !UIToolBar.ICON_OFF.equals(iconSize);
+ final boolean iconBig = UIToolBar.ICON_BIG.equals(iconSize);
+ final boolean showLabelBottom = UIToolBar.LABEL_BOTTOM.equals(labelPosition);
+ final boolean showLabelRight = UIToolBar.LABEL_RIGHT.equals(labelPosition);
+ final boolean showLabel = showLabelBottom || showLabelRight;
+ final boolean separateButtons;
+ if (popupMenu != null && command.getAttributes().get(Attributes.ONCLICK) != null) { // todo: also action, link, etc.
+ // two separate buttons for the command and the sub menu
+ separateButtons = true;
+ } else {
+ separateButtons = false;
+ }
- String iconName = (String) command.getAttributes().get(Attributes.IMAGE);
- String image = getImage(facesContext, iconName, iconSize, disabled, selected);
- String graphicId = clientId + ComponentUtils.SUB_SEPARATOR + "icon";
-
- final String hover = getHoverClasses(first, last);
- final String mouseOverScript = "Tobago.toolbarMousesover(this, '" + hover + "', '" + graphicId + "');";
- final String mouseOutScript = "Tobago.toolbarMousesout(this, '" + hover + "', '" + graphicId + "');";
-
- writer.startElement(HtmlConstants.DIV, null);
- writer.writeIdAttribute(command.getClientId(facesContext));
- String divClasses = getDivClasses(selected, disabled);
-
- writer.writeClassAttribute(divClasses);
- if (!disabled) {
- writer.writeAttribute(HtmlAttributes.ONMOUSEOVER, mouseOverScript, null);
- writer.writeAttribute(HtmlAttributes.ONMOUSEOUT, mouseOutScript, null);
- writer.writeAttribute(HtmlAttributes.ONCLICK, onClick, null);
- }
- writer.startElement(HtmlConstants.TABLE, null);
- writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
- writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
- writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
- writer.writeAttribute(HtmlAttributes.BORDER, 0);
- String tableClasses = getTableClasses(selected, disabled);
- writer.writeClassAttribute(tableClasses);
- writer.startElement(HtmlConstants.TR, null);
-
- boolean anchorOnLabel = label.getText() != null && !UIToolBar.LABEL_OFF.equals(labelPosition);
-
- if (!UIToolBar.ICON_OFF.equals(iconSize)) {
- HtmlRendererUtils.addImageSources(facesContext, writer,
- iconName != null ? iconName : "image/1x1.gif", graphicId);
-
- writer.startElement(HtmlConstants.TD, command);
- writer.writeAttribute(HtmlAttributes.ALIGN, "center", false);
- HtmlRendererUtils.renderTip(command, writer);
-
- boolean render1pxImage = (iconName == null
- && (!UIToolBar.LABEL_BOTTOM.equals(labelPosition)
- && label.getText() != null));
-
- if (((!UIToolBar.LABEL_OFF.equals(labelPosition)
- && label.getText() != null)
- || popupMenu != null)
- && !render1pxImage) {
- writer.writeStyleAttribute("padding-right: 3px;");
- // TODO: make this '3px' configurable
- }
- String className = getIconClass(iconSize);
+ final Measure paddingTop = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-top");
+ final Measure paddingMiddle = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle");
+ final Measure paddingBottom = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-bottom");
+ final Measure paddingLeft = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-left");
+ final Measure paddingCenter = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-center");
+ final Measure paddingRight = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-right");
+
+ // label style
+ final Style labelStyle;
+ if (showLabel) {
+ labelStyle = new Style();
+ labelStyle.setLeft(paddingLeft);
+ labelStyle.setTop(paddingTop);
+ labelStyle.setWidth(RenderUtils.calculateStringWidth(facesContext, toolBar, label.getText()));
+ labelStyle.setHeight(resources.getThemeMeasure(facesContext, toolBar, "custom.label-height"));
+ } else {
+ labelStyle = null;
+ }
- if (!anchorOnLabel) {
- renderAnchorBegin(facesContext, writer, command, label, disabled);
+ // button style
+ final Style buttonStyle = new Style();
+ buttonStyle.setLeft(Measure.ZERO);
+ buttonStyle.setTop(Measure.ZERO);
+ buttonStyle.setWidth(paddingLeft.add(paddingRight));
+ buttonStyle.setHeight(paddingBottom.add(paddingTop));
+
+ // icon style
+ final Style iconStyle;
+
+ if (showIcon) {
+ iconStyle = new Style();
+ iconStyle.setLeft(paddingLeft);
+ iconStyle.setTop(paddingTop);
+ iconStyle.setHeight(resources.getThemeMeasure(
+ facesContext, toolBar, iconBig ? "custom.icon-big-height" : "custom.icon-small-height"));
+ if (lackImage) {
+ iconStyle.setWidth(Measure.valueOf(1));
+ } else {
+ iconStyle.setWidth(resources.getThemeMeasure(
+ facesContext, toolBar, iconBig ? "custom.icon-big-width" : "custom.icon-small-width"));
}
- writer.startElement(HtmlConstants.IMG, command);
- writer.writeIdAttribute(graphicId);
- writer.writeAttribute(HtmlAttributes.SRC, image, false);
- writer.writeAttribute(HtmlAttributes.ALT, "", false);
- HtmlRendererUtils.renderTip(command, writer);
- writer.writeAttribute(HtmlAttributes.BORDER, 0);
- writer.writeClassAttribute(className);
- if (render1pxImage) {
- writer.writeStyleAttribute("width: 1px;");
+ if (showLabelBottom) {
+ labelStyle.setTop(labelStyle.getTop().add(iconStyle.getHeight()).add(paddingMiddle));
+ if (labelStyle.getWidth().lessThan(iconStyle.getWidth())) {
+ // label smaller than icon
+ labelStyle.setLeft(labelStyle.getLeft().add(iconStyle.getWidth().subtract(labelStyle.getWidth()).divide(2)));
+ buttonStyle.setWidth(buttonStyle.getWidth().add(iconStyle.getWidth()));
+ } else {
+ // label bigger than icon
+ iconStyle.setLeft(iconStyle.getLeft().add(labelStyle.getWidth().subtract(iconStyle.getWidth()).divide(2)));
+ buttonStyle.setWidth(buttonStyle.getWidth().add(labelStyle.getWidth()));
+ }
+ buttonStyle.setHeight(
+ buttonStyle.getHeight().add(iconStyle.getHeight()).add(paddingMiddle).add(labelStyle.getHeight()));
+ } else if (showLabelRight) {
+ labelStyle.setTop(labelStyle.getTop().add(iconStyle.getHeight().subtract(labelStyle.getHeight()).divide(2)));
+ labelStyle.setLeft(labelStyle.getLeft().add(iconStyle.getWidth()).add(paddingCenter));
+ buttonStyle.setWidth(
+ buttonStyle.getWidth().add(iconStyle.getWidth()).add(paddingCenter).add(labelStyle.getWidth()));
+ buttonStyle.setHeight(buttonStyle.getHeight().add(iconStyle.getHeight()));
+ } else {
+ buttonStyle.setWidth(buttonStyle.getWidth().add(iconStyle.getWidth()));
+ buttonStyle.setHeight(buttonStyle.getHeight().add(iconStyle.getHeight()));
}
-
- writer.endElement(HtmlConstants.IMG);
- if (!anchorOnLabel) {
- writer.endElement(HtmlConstants.A);
+ } else {
+ iconStyle = null;
+ if (showLabel) {
+ // only label
+ buttonStyle.setWidth(buttonStyle.getWidth().add(labelStyle.getWidth()));
+ buttonStyle.setHeight(buttonStyle.getHeight().add(labelStyle.getHeight()));
+ } else {
+ // both off: use some reasonable defaults
+ buttonStyle.setWidth(buttonStyle.getWidth().add(16));
+ buttonStyle.setHeight(buttonStyle.getHeight().add(16));
}
- writer.endElement(HtmlConstants.TD);
}
- boolean popupOn2 = UIToolBar.LABEL_BOTTOM.equals(labelPosition)
- && !UIToolBar.ICON_OFF.equals(iconSize);
- if (popupOn2) {
- if (popupMenu != null) {
- renderPopupTd(facesContext, writer, command, popupMenu, true);
- }
- writer.endElement(HtmlConstants.TR);
- writer.startElement(HtmlConstants.TR, null);
- }
+ // opener style (for menu popup)
+ final Style openerStyle = new Style();
+ openerStyle.setWidth(resources.getThemeMeasure(facesContext, toolBar, "custom.opener-width"));
+ openerStyle.setHeight(resources.getThemeMeasure(facesContext, toolBar, "custom.opener-height"));
+
+ final Style menuStyle = new Style();
+ menuStyle.setLeft(buttonStyle.getWidth());
+ menuStyle.setTop(Measure.ZERO);
+ menuStyle.setWidth(paddingLeft.add(openerStyle.getWidth()).add(paddingRight));
+ menuStyle.setHeight(buttonStyle.getHeight());
+
+ // opener style (for menu popup)
+ openerStyle.setLeft(menuStyle.getWidth().subtract(openerStyle.getWidth()).divide(2));
+ openerStyle.setTop(menuStyle.getHeight().subtract(openerStyle.getHeight()).divide(2));
+
+ // item style
+ final Style itemStyle = new Style();
+ if (isRightAligned(toolBar)) { // overrides the default in the CSS file.
+ itemStyle.setLeft(resources.getThemeMeasure(facesContext, toolBar, "css.border-right-width"));
+ }
+ itemStyle.setWidth(popupMenu != null ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
+ itemStyle.setHeight(buttonStyle.getHeight());
+
+ // change values when only have one button
+ if (popupMenu != null && !separateButtons) {
+ openerStyle.setLeft(openerStyle.getLeft().add(buttonStyle.getWidth()));
+ buttonStyle.setWidth(buttonStyle.getWidth().add(menuStyle.getWidth()));
+ }
+
+ // start rendering
+ writer.startElement(HtmlConstants.SPAN, command);
+ writer.writeClassAttribute(
+ selected ? "tobago-toolBar-item tobago-toolBar-item-selected" : "tobago-toolBar-item");
+ HtmlRendererUtils.renderTip(command, writer);
+ writer.writeStyleAttribute(itemStyle);
- if (!UIToolBar.LABEL_OFF.equals(labelPosition)) {
- writer.startElement(HtmlConstants.TD, null);
- writer.writeClassAttribute("tobago-toolBar-label-td");
- writer.writeAttribute(HtmlAttributes.ALIGN, "center", false);
- if (popupMenu != null) {
- writer.writeAttribute(HtmlAttributes.STYLE, "padding-right: 3px;", false);
- // TODO: make this '3px' configurable
- }
+ writer.startElement(HtmlConstants.SPAN, command);
+ writer.writeClassAttribute(
+ selected ? "tobago-toolBar-button tobago-toolBar-button-selected" : "tobago-toolBar-button");
+ writer.writeStyleAttribute(buttonStyle);
+ writer.writeAttribute(HtmlAttributes.ONCLICK, commandClick != null ? commandClick : menuClick, true);
+ // render icon
+ if (showIcon) {
+ HtmlRendererUtils.addImageSources(facesContext, writer, iconName != null ? iconName : "image/1x1.gif", graphicId);
+ writer.startElement(HtmlConstants.IMG, command);
+ writer.writeAttribute(HtmlAttributes.SRC, image, false);
+ writer.writeAttribute(HtmlAttributes.ALT, label.getText(), true);
+// writer.writeClassAttribute("tobago-toolBar-icon");
+ writer.writeStyleAttribute(iconStyle);
+ writer.endElement(HtmlConstants.IMG);
+ }
+ // render label
+ if (showLabel) {
+ writer.startElement(HtmlConstants.SPAN, command);
+ writer.writeClassAttribute("tobago-toolBar-label");
+ writer.writeStyleAttribute(labelStyle);
if (label.getText() != null) {
- renderAnchorBegin(facesContext, writer, command, label, disabled);
HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
- writer.endElement(HtmlConstants.A);
}
- writer.endElement(HtmlConstants.TD);
- }
- if (!popupOn2 && popupMenu != null) {
- renderPopupTd(facesContext, writer, command, popupMenu,
- false);
+ writer.endElement(HtmlConstants.SPAN);
}
- writer.endElement(HtmlConstants.TR);
- writer.endElement(HtmlConstants.TABLE);
- writer.endElement(HtmlConstants.DIV);
- }
-
- protected String getIconClass(String iconSize) {
- return "tobago-image tobago-toolBar-button-image tobago-toolBar-button-image-" + iconSize;
- }
+ if (separateButtons) {
+ writer.endElement(HtmlConstants.SPAN);
- protected abstract String getHoverClasses(boolean first, boolean last);
+ writer.startElement(HtmlConstants.SPAN, command);
+ writer.writeClassAttribute("tobago-toolBar-menu");
+ writer.writeStyleAttribute(menuStyle);
+ writer.writeAttribute(HtmlAttributes.TYPE, "button", false);
+ writer.writeAttribute(HtmlAttributes.ONCLICK, menuClick, true);
+ }
- protected abstract String getTableClasses(boolean selected, boolean disabled);
+ // render sub menu popup button
+ if (popupMenu != null) {
+ writer.startElement(HtmlConstants.IMG, command);
+ String menuImage = ResourceManagerUtils.getImageWithPath(facesContext, "image/toolbarButtonMenu.gif");
+ writer.writeAttribute(HtmlAttributes.SRC, menuImage, false);
+ writer.writeStyleAttribute(openerStyle);
+ writer.endElement(HtmlConstants.IMG);
+ renderPopup(facesContext, writer, popupMenu);
+ }
+ writer.endElement(HtmlConstants.SPAN);
+ writer.endElement(HtmlConstants.SPAN);
- protected abstract String getDivClasses(boolean selected, boolean disabled);
+ return width.add(itemStyle.getWidth()).add(2); // XXX
+ // computation of the width of the toolBar will not be used in the moment.
+ }
- private String createOnClick(FacesContext facesContext, UICommandBase command) {
- if (command.getFacet(Facets.MENUPOPUP) != null
- && command.getAction() == null
+ private String createCommandOnClick(FacesContext facesContext, UICommandBase command) {
+ if (command.getAction() == null
&& command.getActionListener() == null
- && command.getActionListeners().length == 0) {
- String searchId = command.getClientId(facesContext) + MenuBarRenderer.SEARCH_ID_POSTFIX;
- return "tobagoButtonOpenMenu(this, '" + searchId + "')";
+ && command.getActionListeners().length == 0
+ && command.getLink() == null
+ && command.getAttributes().get(Attributes.ONCLICK) == null
+ && command.getFacet(Facets.MENUPOPUP) != null) {
+ return null;
} else {
CommandRendererHelper helper = new CommandRendererHelper(facesContext, command);
return helper.getOnclick();
}
}
- private String getImage(FacesContext facesContext, String name,
- String iconSize, boolean disabled, boolean selected) {
- if (name == null) {
- return ResourceManagerUtils.getImageWithPath(facesContext, "image/1x1.gif");
+ private String createMenuOnClick(UICommandBase command) {
+ if (command.getFacet(Facets.MENUPOPUP) != null) {
+ return "jQuery(this).find('a').click();event.stopPropagation();";
+ } else {
+ return null;
}
+ }
+
+ private String getImage(
+ FacesContext facesContext, String name, String iconSize, boolean disabled, boolean selected) {
int pos = name.lastIndexOf('.');
if (pos == -1) {
pos = name.length(); // avoid exception if no '.' in name
@@ -368,32 +452,25 @@ public abstract class ToolBarRendererBas
ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
UIViewRoot viewRoot = facesContext.getViewRoot();
if (disabled && selected) {
- image = resourceManager.getImage(
- viewRoot, key + "SelectedDisabled" + size + ext, true);
+ image = resourceManager.getImage(viewRoot, key + "SelectedDisabled" + size + ext, true);
if (image == null) {
- image = resourceManager.getImage(
- viewRoot, key + "SelectedDisabled" + ext, true);
+ image = resourceManager.getImage(viewRoot, key + "SelectedDisabled" + ext, true);
}
}
if (image == null && disabled) {
- image = resourceManager.getImage(
- viewRoot, key + "Disabled" + size + ext, true);
+ image = resourceManager.getImage(viewRoot, key + "Disabled" + size + ext, true);
if (image == null) {
- image = resourceManager.getImage(
- viewRoot, key + "Disabled" + ext, true);
+ image = resourceManager.getImage(viewRoot, key + "Disabled" + ext, true);
}
}
if (image == null && selected) {
- image = resourceManager.getImage(
- viewRoot, key + "Selected" + size + ext, true);
+ image = resourceManager.getImage(viewRoot, key + "Selected" + size + ext, true);
if (image == null) {
- image = resourceManager.getImage(
- viewRoot, key + "Selected" + ext, true);
+ image = resourceManager.getImage(viewRoot, key + "Selected" + ext, true);
}
}
if (image == null) {
- image
- = resourceManager.getImage(viewRoot, key + size + ext, true);
+ image = resourceManager.getImage(viewRoot, key + size + ext, true);
if (image == null) {
image = resourceManager.getImage(viewRoot, key + ext, true);
}
@@ -403,68 +480,14 @@ public abstract class ToolBarRendererBas
return contextPath + image;
}
- private void renderAnchorBegin(
- FacesContext facesContext, TobagoResponseWriter writer, UICommandBase command,
- final LabelWithAccessKey label, final boolean disabled)
+ private void renderPopup(FacesContext facesContext, TobagoResponseWriter writer, UIComponent popupMenu)
throws IOException {
- writer.startElement(HtmlConstants.A, command);
- // TODO use StyleClasses
- writer.writeClassAttribute(getAnchorClass(disabled));
- HtmlRendererUtils.renderTip(command, writer);
- if (!disabled) {
- writer.writeAttribute(HtmlAttributes.HREF, "#", false);
- writer.writeAttribute(HtmlAttributes.ONFOCUS, "Tobago.toolbarFocus(this, event)", false);
- String id = command.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "link";
- writer.writeIdAttribute(id);
- if (label.getAccessKey() != null) {
- if (LOG.isInfoEnabled()
- && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
- LOG.info("dublicated accessKey : " + label.getAccessKey());
- }
- HtmlRendererUtils.addClickAcceleratorKey(
- facesContext, id, label.getAccessKey());
- }
- }
- }
-
- protected String getAnchorClass(boolean disabled) {
- return "tobago-toolBar-button-link" + (disabled ? " tobago-toolBar-button-link-disabled" : "");
- }
-
- private void renderPopupTd(
- FacesContext facesContext, TobagoResponseWriter writer, UIComponent command, UIComponent popupMenu,
- boolean labelBottom) throws IOException {
- writer.startElement(HtmlConstants.TD, null);
- if (labelBottom) {
- writer.writeAttribute(HtmlAttributes.ROWSPAN, 2);
- }
-
- if (popupMenu != null) {
- String backgroundImage = ResourceManagerUtils.getImageWithPath(facesContext, "image/1x1.gif");
- writer.startElement(HtmlConstants.DIV, null);
- writer.writeIdAttribute(command.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "popup");
- writer.writeClassAttribute("tobago-toolBar-button-menu");
- writer.startElement(HtmlConstants.IMG, null);
- writer.writeAttribute(HtmlAttributes.SRC, backgroundImage, false);
- writer.writeClassAttribute("tobago-toolBar-button-menu-background-image");
- writer.endElement(HtmlConstants.IMG);
- writer.endElement(HtmlConstants.DIV);
- if (popupMenu instanceof UIMenu) {
- ((UIMenu) popupMenu).setLabel(null);
- } else {
- popupMenu.getAttributes().remove(Attributes.LABEL);
- }
- String image = ResourceManagerUtils.getImageWithPath(facesContext, "image/toolbarButtonMenu.gif");
- popupMenu.getAttributes().put(Attributes.IMAGE, image);
- popupMenu.getAttributes().put(Attributes.LABEL, "\u00a0\u00a0"); // non breaking space
- writer.startElement(HtmlConstants.OL, popupMenu);
- writer.writeClassAttribute("tobago-menuBar");
- writer.writeStyleAttribute("position:relative;"); // FIXME: use a different style class
- RenderUtils.encode(facesContext, popupMenu);
- writer.endElement(HtmlConstants.OL);
- }
-
- writer.endElement(HtmlConstants.TD);
+ writer.startElement(HtmlConstants.OL, popupMenu);
+ writer.writeClassAttribute("tobago-menuBar");
+ // TODO: use a different style class
+ writer.writeStyleAttribute("display:inline;width:0;height:0;position:absolute;visibility:hidden;");
+ RenderUtils.encode(facesContext, popupMenu);
+ writer.endElement(HtmlConstants.OL);
}
@Override
@@ -476,5 +499,4 @@ public abstract class ToolBarRendererBas
public boolean getRendersChildren() {
return true;
}
-
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/property/tobago-theme-config.properties?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/property/tobago-theme-config.properties Tue May 25 14:37:55 2010
@@ -23,7 +23,3 @@ Box.extraPaddingHeightWhenToolbar=23
# IE can't have td with 0px height
Messages.fixedHeight=1
-
-ToolBar.small_bottom_Height=56
-ToolBar.big_bottom_Height=73
-ToolBar.fixedHeight=31
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.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/msie/style/style.css?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css Tue May 25 14:37:55 2010
@@ -57,30 +57,3 @@ textarea.tobago-richTextEditor-body {
.tobago-file {
height: 23px;
}
-
-.tobago-toolBar {
- height: 31px;
-}
-.tobago-toolBar-button-hover-first {
- padding-left: 6px;
-}
-.tobago-box-toolBar-button-hover-last {
- padding-right: 6px;
-}
-
-.tobago-toolBar-button-image {
- margin-bottom: 0px;
- position: relative;
- top: -1px;
-}
-
-.tobago-toolBar-button-popup-span {
- padding-right: 10px;
-}
-
-.tobago-toolBar-button-menu {
-}
-
-a:link.tobago-toolBar-button-link, a:visited.tobago-toolBar-button-link, a:active.tobago-toolBar-button-link {
- color: #000000;
-}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/toolbarButtonMenu.gif
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/image/toolbarButtonMenu.gif?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
Binary files - no diff available.
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
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/property/tobago-theme-config.properties?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Tue May 25 14:37:55 2010
@@ -172,7 +172,8 @@ TabGroup.paddingWidth=24
TabGroup.paddingHeight=25
TabGroup.headerHeight=24
TabGroup.tabLabelExtraWidth=20
-TabGroup.navigationBarWidth=60
+TabGroup.toolBarWidth=48
+TabGroup.toolBarExtra=2
TabGroup.offsetLeft=1
TabGroup.offsetTop=0
TabGroup.offsetRight=2
@@ -202,14 +203,55 @@ Time.css.padding-top=2
Time.css.padding-right=2
Time.css.padding-bottom=2
-ToolBar.small_off_Height=36
-ToolBar.small_bottom_Height=53
-ToolBar.small_right_Height=36
-ToolBar.big_off_Height=50
-ToolBar.big_bottom_Height=70
-ToolBar.big_right_Height=50
-ToolBar.off_off_Height=36
-ToolBar.off_bottom_Height=36
-ToolBar.off_right_Height=36
-ToolBar.fixedHeight=30
-ToolBar.buttonMenuWidth=15
+ToolBar.css.border-left-width=2
+ToolBar.css.border-top-width=2
+ToolBar.css.border-right-width=2
+ToolBar.css.border-bottom-width=2
+
+ToolBar.custom.icon-big-width=32
+ToolBar.custom.icon-big-height=32
+ToolBar.custom.icon-small-width=16
+ToolBar.custom.icon-small-height=16
+ToolBar.custom.opener-width=11
+ToolBar.custom.opener-height=6
+ToolBar.custom.padding-top=3
+ToolBar.custom.padding-middle=3
+ToolBar.custom.padding-bottom=3
+ToolBar.custom.padding-left=3
+ToolBar.custom.padding-center=3
+ToolBar.custom.padding-right=3
+ToolBar.custom.label-height=14
+
+BoxToolBar.css.border-left-width=2
+BoxToolBar.css.border-top-width=2
+BoxToolBar.css.border-right-width=2
+BoxToolBar.css.border-bottom-width=2
+
+BoxToolBar.height=21
+BoxToolBar.custom.icon-small-width=16
+BoxToolBar.custom.icon-small-height=16
+BoxToolBar.custom.opener-width=11
+BoxToolBar.custom.opener-height=6
+BoxToolBar.custom.padding-top=2
+BoxToolBar.custom.padding-bottom=1
+BoxToolBar.custom.padding-left=3
+BoxToolBar.custom.padding-center=3
+BoxToolBar.custom.padding-right=3
+BoxToolBar.custom.label-height=14
+
+TabGroupToolBar.css.border-left-width=0
+TabGroupToolBar.css.border-top-width=0
+TabGroupToolBar.css.border-right-width=0
+TabGroupToolBar.css.border-bottom-width=1
+
+TabGroupToolBar.height=19
+TabGroupToolBar.custom.icon-small-width=16
+TabGroupToolBar.custom.icon-small-height=16
+TabGroupToolBar.custom.opener-width=11
+TabGroupToolBar.custom.opener-height=6
+TabGroupToolBar.custom.padding-top=0
+TabGroupToolBar.custom.padding-bottom=0
+TabGroupToolBar.custom.padding-left=0
+TabGroupToolBar.custom.padding-center=0
+TabGroupToolBar.custom.padding-right=0
+TabGroupToolBar.custom.label-height=14
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js
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/script/tobago-menu.js?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js Tue May 25 14:37:55 2010
@@ -231,7 +231,14 @@ function xxx_tobagoMenuInit() {
event.stopPropagation();
});
-
+
+ // a click on toolBar menu opener -> forward to .tobago-menu-top
+ jQuery(".tobago-toolBar-menu").click(function(event) {
+
+ $(this).next().find('a').click();
+ event.stopPropagation();
+ });
+
// IE6 select-tag fix
// put a iframe inside the div, so that a <select> tag doesn't shine through.
// the iframe must be resized (see above)
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.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/style.css?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Tue May 25 14:37:55 2010
@@ -102,15 +102,17 @@ html, body {
padding: 11px 11px;
}
-div.tobago-tabnavigationbar {
- border-bottom-color: #DDEEFF;
- border-bottom-style: solid;
- border-bottom-width: 1px;
- height: 25px;
- top: 0;
- width: 59px;
+div.tobago-tabGroup-toolBar {
+ border-color: #DDEEFF;
+ border-style: solid;
+ border-width: 1px;
+ height: 16px;
+ bottom: 0;
+/* width: 59px; */
margin-right: 0;
position: absolute;
+ overflow: hidden;
+ white-space: nowrap;
}
a:link.tab, a:visited.tab, a:active.tab {
@@ -923,154 +925,48 @@ hr.tobago-separator {
left: 92px;
}
-/* Toolbar ----------------------------------------------------------------- */
+/* ToolBar ----------------------------------------------------------------- */
.tobago-toolBar {
- border: 2px groove #f6faff;
+ border: 2px groove #F6FAFF;
position: relative;
overflow: hidden;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
-}
-
-.tobago-toolBar-div-inner {
- padding: 4px;
-}
-
-.tobago-toolBar-orientation-right {
- right: 0;
- position: absolute;
-}
-
-.tobago-toolBar-button {
- float: left;
- font-weight: normal;
- font-family: arial, helvetica, sans-serif;
- padding-top: 2px;
- padding-right: 5px;
- padding-bottom: 2px;
- padding-left: 5px;
- margin: 1px;
- border: 0 solid #bbccdd;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
-}
-
-.tobago-toolBar-button-table {
- font-weight: normal;
- font-family: arial, helvetica, sans-serif;
-}
-
-.tobago-toolBar-button-box-facet {
- float: left;
}
-.tobago-toolBar-button-enabled {
- cursor: pointer;
-}
-
-.tobago-toolBar-button-selected-enabled {
- cursor: pointer;
+.tobago-toolBar-item {
+ position: relative;
+ display: inline-block;
+ border-width: 0;
+ border-style: solid;
margin: 0;
- border-right: 1px solid #ddeeff;
- border-left: 1px solid #6688aa;
- border-bottom: 1px solid #ddeeff;
- border-top: 1px solid #6688aa;
- background: #c2d3e4;
+ left: 0;
+ top: 0;
}
-.tobago-toolBar-button-box-facet-selected-enabled {
- cursor: pointer;
+.tobago-toolBar-button, .tobago-toolBar-menu {
+ position: absolute;
+ border-width: 0;
+ padding: 0;
margin: 0;
- border-right: 1px solid #ddeeff;
- border-left: 1px solid #6688aa;
- border-bottom: 1px solid #ddeeff;
- border-top: 1px solid #6688aa;
- background: #c2d3e4;
-}
-
-.tobago-toolBar-button-disabled {
- color: #778899;
-}
-
-.tobago-toolBar-button-table-disabled {
- color: #778899;
+ background-color: transparent;
}
-.tobago-toolBar-button-table-box-facet-disabled {
- color: #778899;
+.tobago-toolBar-item img {
+ position: absolute;
}
-.tobago-toolBar-label-td {
- height: 19px; /* background: lime;*/
+.tobago-toolBar-label {
+ position: absolute;
+ font: bold 12px arial,helvetica,sans-serif;
white-space: nowrap;
}
-.tobago-toolBar-button-menu {
- position: relative;
- width: 20px;
- height: 20px;
- top: 0;
- left: 0; /* background: yellow;*/
+.tobago-toolBar-button-selected {
+ background-color: #CCDDEE;
}
-/*
- ! css classes tobago-toolBar-button-hover and tobago-toolBar-button-menu-focus
- should have the same content, but needs different names !
-*/
.tobago-toolBar-button-hover {
- margin: 0;
- border-left: 1px solid #ddeeff;
- border-right: 1px solid #6688aa;
- border-top: 1px solid #ddeeff;
- border-bottom: 1px solid #6688aa;
- background: #ccddee;
-}
-
-.tobago-toolBar-button-menu-focus {
- margin: 0;
- border-left: 1px solid #ddeeff;
- border-right: 1px solid #6688aa;
- border-top: 1px solid #ddeeff;
- border-bottom: 1px solid #6688aa;
- background: #ccddee;
-}
-
-.tobago-toolBar-button-image {
- border-width: 0;
-/* vertical-align: bottom;*/
-/* margin-bottom: 2px;*/
-/* background: red;*/
-}
-
-.tobago-toolBar-button-image-small {
- width: 16px;
- height: 16px;
-}
-
-.tobago-toolBar-button-image-big {
- width: 32px;
- height: 32px;
-}
-
-a:link.tobago-toolBar-button-link, a:visited.tobago-toolBar-button-link, a:active.tobago-toolBar-button-link {
- text-decoration: none;
- font: inherit;
- color: inherit;
-}
-
-/*
-.tobago-tab-link {
- text-decoration: none;
-}
-*/
-
-.tobago-tab-disabled {
- color: #778899;
-}
-
-.tobago-toolBar-button-label {
- padding-left: 5px;
+ background-color: #CCDDEE;
}
/* MenuBar, Menu, etc. ------------------------------------------------------------------ */
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java Tue May 25 14:37:55 2010
@@ -19,6 +19,7 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.UIBox;
import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.layout.Measure;
@@ -173,7 +174,7 @@ without shadow
}
writer.startElement(HtmlConstants.DIV, null);
writer.writeClassAttribute(className);
- toolbar.setRendererType("BoxToolBar");
+ toolbar.setRendererType(RendererTypes.BOX_TOOL_BAR);
RenderUtils.encode(facesContext, toolbar);
writer.endElement(HtmlConstants.DIV);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/mozilla/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/mozilla/style/style.css?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/mozilla/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/mozilla/style/style.css Tue May 25 14:37:55 2010
@@ -50,10 +50,3 @@ label.tobago-label {
.tobago-selectOneChoice {
margin-bottom: -1px;
}
-
-/* toolBar ----------------------------------------------------------------- */
-
-.tobago-toolBar-button-menu-background-image {
- width: 15px;
- height: 12px;
-}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/property/tobago-theme-config.properties?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/property/tobago-theme-config.properties Tue May 25 14:37:55 2010
@@ -21,7 +21,3 @@
Box.paddingHeight=11
File.fixedHeight=24
-
-ToolBar.small_right_Height=27
-ToolBar.off_bottom_Height=27
-ToolBar.off_right_Height=27
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/style/style.css?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/style/style.css Tue May 25 14:37:55 2010
@@ -23,23 +23,3 @@
label.tobago-label {
margin-top: 2px;
}
-
-.tobago-box-header-toolbar-div {
- top: -1px;
- right: -2px;
-}
-
-/*
-.tobago-toolBar-div-inner {
- margin-top: -1px;
-}
-*/
-/*
-
-.tobago-toolBar-button-menu {
- top: -7px;
-}*/
-
-a:link.tobago-toolBar-button-link, a:visited.tobago-toolBar-button-link, a:active.tobago-toolBar-button-link {
- color: #660000;
-}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/toolbarButtonMenu.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/toolbarButtonMenu.gif?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
Binary files - no diff available.
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties Tue May 25 14:37:55 2010
@@ -108,7 +108,8 @@ TabGroup.paddingHeight=22
TabGroup.paddingWidth=23
TabGroup.headerHeight=19
TabGroup.tabLabelExtraWidth=20
-TabGroup.navigationBarWidth=60
+TabGroup.toolBarWidth=48
+TabGroup.toolBarExtra=2
TabGroup.offsetLeft=1
TabGroup.offsetTop=19
TabGroup.offsetRight=2
@@ -134,13 +135,12 @@ Time.css.padding-top=2
Time.css.padding-right=2
Time.css.padding-bottom=2
-ToolBar.small_off_Height=24
-ToolBar.small_bottom_Height=43
-ToolBar.small_right_Height=27
-ToolBar.big_off_Height=40
-ToolBar.big_bottom_Height=59
-ToolBar.big_right_Height=40
-ToolBar.off_off_Height=27
-ToolBar.off_bottom_Height=27
-ToolBar.off_right_Height=27
-ToolBar.fixedHeight=20
+ToolBar.css.border-left-width=1
+ToolBar.css.border-top-width=1
+ToolBar.css.border-right-width=1
+ToolBar.css.border-bottom-width=1
+
+BoxToolBar.css.border-left-width=1
+BoxToolBar.css.border-top-width=1
+BoxToolBar.css.border-right-width=1
+BoxToolBar.css.border-bottom-width=1
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=948063&r1=948062&r2=948063&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Tue May 25 14:37:55 2010
@@ -142,15 +142,8 @@ span.tobago-tab-fulfill {
border-left: 0px solid transparent;
}
-div.tobago-tabnavigationbar {
- border-right-color: transparent;
- border-right-style: solid;
- border-right-width: 1px;
- border-bottom-color: #000000;
- border-bottom-style: solid;
- border-bottom-width: 1px;
- height: 18px;
- position: absolute;
+div.tobago-tabGroup-toolBar {
+ border-color: #000000;
}
a:link.tab, a:visited.tab, a:active.tab {
@@ -371,8 +364,7 @@ reason they are not defined as a:link
.tobago-box-header-toolbar-div {
position: absolute;
- top: -2px;
- bottom: -2px;
+ top: 0;
right: -1px;
}
@@ -626,7 +618,7 @@ tobago-selectOneChoice-readonly {
.tobago-time-input-selected {
border-color: #E8E8E8;
background: #E8E8E8;
-}
+}
.tobago-time-inc-image {
left: 60px;
@@ -638,100 +630,39 @@ tobago-selectOneChoice-readonly {
left: 88px;
}
-/* toolbar ----------------------------------------------------------------- */
+/* ToolBar ----------------------------------------------------------------- */
.tobago-toolBar {
border: 1px solid #000000;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
-}
-
-.tobago-toolBar-div-inner {
-/* margin-left: -1px;*/
- padding: 0px;
-}
-
-.tobago-toolBar-button {
- font: bold 12px arial, helvetica, sans-serif;
- color: #660000;
+ background-color: #FFFFFF;
}
-
-.tobago-toolBar-button-table {
- font: bold 12px arial, helvetica, sans-serif;
- color: #660000;
-}
-
-.tobago-toolBar-button-table-disabled {
- color: #808080;
-}
-
-.tobago-toolBar-button-table-box-facet-disabled {
- color: #808080;
-}
-
-.tobago-toolBar-button-span {
- font: bold 12px arial, helvetica, sans-serif;
- color: #660000;
- border: 1px solid #ffffff;
-}
-
-.tobago-toolBar-button-selected-enabled {
- cursor: pointer;
- margin: 0px;
- border-top: 1px solid #808080;
- border-right: 1px solid #FFFFFF;
- border-bottom: 1px solid #FFFFFF;
- border-left: 1px solid #808080;
- background: #dddddd;
-}
-
-.tobago-toolBar-button-box-facet {
- padding-top: 1px;
- padding-bottom: 1px;
-}
-
-.tobago-toolBar-button-box-facet-selected-enabled {
- cursor: pointer;
- margin: 0px;
- border: 1px solid #999999;
- background: #cccccc url(../image/toolbarButtonBoxFacetSelectEnabled.gif) repeat-x top;
+.tobago-toolBar-item {
+ position: relative;
+ display: inline-block;
+ border-width: 0;
+ border-style: solid;
+ margin: 0 1px;
+ left: -1px;
+ top: 0;
}
-
-.tobago-toolBar-button-disabled {
- color: #808080;
+.tobago-toolBar-item-selected {
+ border-width: 0 1px;
+ border-color: #aaaaaa;
+ margin: 0;
}
-.tobago-toolBar-button-selected-disabled {
- margin: 0px;
- border-top: 1px solid #808080;
- border-right: 1px solid #FFFFFF;
- border-bottom: 1px solid #FFFFFF;
- border-left: 1px solid #808080;
- background: #dddddd;
+.tobago-toolBar-item-hover {
+ border-width: 0 1px;
+ border-color: #000000;
+ margin: 0;
}
-.tobago-toolBar-button-menu {
- width: 15px;
- height: 15px;
+.tobago-toolBar-button-selected {
+ background-color: #EEEEEE;
}
-/*
- ! css classes tobago-toolBar-button-hover and tobago-toolBar-button-menu-focus
- should have the same content, but needs different names !
-*/
.tobago-toolBar-button-hover {
- border: 1px solid black;
- background: #c5c5c5;
- margin: 0px;
-}
-.tobago-toolBar-button-menu-focus {
- border: 1px solid black;
- background: #bbbbbb;
- margin: 0px;
-}
-
-.tobago-toolBar-button-label {
- padding-left: 5px;
+ background-color: #DDDDDD;
}
/* Validation --------------------------------------------------------------- */
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=948063&r1=948062&r2=948063&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 Tue May 25 14:37:55 2010
@@ -2441,4 +2441,53 @@ Tobago.Updater = {
};
+// -------- ToolBar ----------------------------------------------------
+// todo: namespace etc.
+
+$(document).ready(function() {
+ $(".tobago-toolBar-item")
+ .mouseenter(function() {
+ $(this).addClass("tobago-toolBar-item-hover");
+ })
+ .mouseleave(function() {
+ $(this).removeClass("tobago-toolBar-item-hover");
+ });
+ $(".tobago-toolBar-button, .tobago-toolBar-menu")
+ .mouseenter(function() {
+ $(this).addClass("tobago-toolBar-button-hover");})
+ .mouseleave(function() {
+ $(this).removeClass("tobago-toolBar-button-hover");
+ });
+});
+
+function tobago_toolBarCheckToggle(id) {
+ var element = document.getElementById(id);
+ var form = document.forms[0];
+ if (element) {
+ //LOG.debug("remove " + id);
+ form.removeChild(element);
+ }
+ else {
+ //LOG.debug("adding " + id);
+ element = document.createElement('INPUT');
+ element.type = 'hidden';
+ element.name = id;
+ element.id = id;
+ element.value = 'true';
+ form.appendChild(element);
+ }
+}
+
+function tobago_toolBarSetRadioValue(id, value) {
+ var element = document.getElementById(id);
+ if (! element) {
+ element = document.createElement('INPUT');
+ element.type = 'hidden';
+ element.name = id;
+ element.id = id;
+ document.forms[0].appendChild(element);
+ }
+ element.value = value;
+}
+
TbgTimer.endTbgJs = new Date();