You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/04/04 19:13:30 UTC
svn commit: r391367 - in /incubator/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/
tobago-core/src/main/ja...
Author: weber
Date: Tue Apr 4 10:13:28 2006
New Revision: 391367
URL: http://svn.apache.org/viewcvs?rev=391367&view=rev
Log:
fix for TOBAGO-10 (Combine the attributes label, labelWithAccessKey and accessKey to one attribute label)
Modified:
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LabelWithAccessKey.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectBooleanCommandTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTag.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Tue Apr 4 10:13:28 2006
@@ -20,7 +20,7 @@
public static final String SUBCOMPONENT_SEP = "::";
- public static final String ATTR_ACCESS_KEY = "accessKey";
+// public static final String ATTR_ACCESS_KEY = "accessKey";
public static final String ATTR_ACTION_STRING = "actionString";
public static final String ATTR_ACTION_LISTENER = "actionListener";
public static final String ATTR_ALIGN = "align";
@@ -60,7 +60,7 @@
public static final String ATTR_INNER_WIDTH = "innerWidth";
public static final String ATTR_LABEL = "label";
public static final String ATTR_LABEL_POSITION = "labelPosition";
- public static final String ATTR_LABEL_WITH_ACCESS_KEY = "labelWithAccessKey";
+// public static final String ATTR_LABEL_WITH_ACCESS_KEY = "labelWithAccessKey";
public static final String ATTR_LAYOUT_HEIGHT = "layoutHeight";
public static final String ATTR_LAYOUT_MARGIN = "layoutMargin";
public static final String ATTR_LAYOUT_MARGIN_BOTTOM = "layoutMarginBottom";
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java Tue Apr 4 10:13:28 2006
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_STRING;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALIGN;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CREATE_SPAN;
@@ -32,7 +31,6 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOR;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HOVER;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDER_RANGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDER_RANGE_EXTERN;
@@ -772,17 +770,7 @@
labelText = attributes.get(ATTR_LABEL);
}
- Object labelWithAccessKey = component.getValueBinding(ATTR_LABEL_WITH_ACCESS_KEY);
- if (labelWithAccessKey == null) {
- labelWithAccessKey = attributes.get(ATTR_LABEL_WITH_ACCESS_KEY);
- }
-
- Object accessKey = component.getValueBinding(ATTR_ACCESS_KEY);
- if (accessKey == null) {
- accessKey = attributes.get(ATTR_ACCESS_KEY);
- }
-
- if (labelText != null || labelWithAccessKey != null || accessKey != null) {
+ if (labelText != null) {
Application application = FacesContext.getCurrentInstance().getApplication();
label = application.createComponent(UIOutput.COMPONENT_TYPE);
label.setRendererType("Label");
@@ -794,16 +782,6 @@
label.setValueBinding(ATTR_VALUE, (ValueBinding) labelText);
} else if (labelText != null) {
label.getAttributes().put(ATTR_VALUE, labelText);
- }
- if (labelWithAccessKey instanceof ValueBinding) {
- label.setValueBinding(ATTR_LABEL_WITH_ACCESS_KEY, (ValueBinding) labelWithAccessKey);
- } else if (labelWithAccessKey != null) {
- label.getAttributes().put(ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
- }
- if (accessKey instanceof ValueBinding) {
- label.setValueBinding(ATTR_ACCESS_KEY, (ValueBinding) accessKey);
- } else if (accessKey != null) {
- label.getAttributes().put(ATTR_ACCESS_KEY, accessKey);
}
component.getFacets().put(FACET_LABEL, label);
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LabelWithAccessKey.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LabelWithAccessKey.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LabelWithAccessKey.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LabelWithAccessKey.java Tue Apr 4 10:13:28 2006
@@ -18,12 +18,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_LABEL;
-import org.apache.myfaces.tobago.component.ComponentUtil;
import javax.faces.component.UIComponent;
@@ -44,37 +41,24 @@
text = (String) component.getAttributes().get(ATTR_LABEL);
}
- accessKey = ComponentUtil.getCharakterAttribute(
- component, ATTR_ACCESS_KEY);
- String labelWithAccessKey = (String) component.getAttributes().get(
- ATTR_LABEL_WITH_ACCESS_KEY);
-
- setup(labelWithAccessKey);
+ setup(text);
}
- public void setup(String labelWithAccessKey) {
- if (labelWithAccessKey != null && (accessKey != null || text != null)) {
- LOG.warn("labelWithAccessKey overwrites accessKey or label: "
- + "labelWithAccessKey='" + labelWithAccessKey + "', "
- + "accessKey ='" + accessKey + "', "
- + "label='" + text + "'.");
- }
+ public void setup(String label) {
- if (labelWithAccessKey != null) {
- pos = labelWithAccessKey.indexOf(INDICATOR);
+ if (label != null) {
+ pos = label.indexOf(INDICATOR);
if (pos == -1) {
- LOG.warn("no "+INDICATOR +" in labelWithAccessKey"
- + "labelWithAccessKey='" + labelWithAccessKey + "'.");
- text = labelWithAccessKey;
- } else if (pos == labelWithAccessKey.length() - 1) {
- LOG.warn(INDICATOR + " in labelWithAccessKey is last char, this is not allowed"
- + "labelWithAccessKey='" + labelWithAccessKey + "'.");
- text = labelWithAccessKey.substring(0, labelWithAccessKey.length() - 1);
+ text = label;
+ } else if (pos == label.length() - 1) {
+ LOG.warn(INDICATOR + " in label is last char, this is not allowed"
+ + "label='" + label + "'.");
+ text = label.substring(0, label.length() - 1);
pos = -1;
} else {
- text = labelWithAccessKey.substring(0, pos)
- + labelWithAccessKey.substring(pos + 1);
+ text = label.substring(0, pos)
+ + label.substring(pos + 1);
accessKey = new Character(text.charAt(pos));
}
} else {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java Tue Apr 4 10:13:28 2006
@@ -21,11 +21,9 @@
* $Id$
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DEFAULT_COMMAND;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.commons.logging.Log;
@@ -44,8 +42,6 @@
private String label;
private String image;
- private String accessKey;
- private String labelWithAccessKey;
private String tip;
private String defaultCommand;
@@ -55,8 +51,6 @@
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
ComponentUtil.setStringProperty(component, ATTR_IMAGE, image);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
ComponentUtil.setBooleanProperty(component, ATTR_DEFAULT_COMMAND, defaultCommand);
}
@@ -66,19 +60,17 @@
super.release();
label = null;
image = null;
- accessKey = null;
- labelWithAccessKey = null;
tip = null;
defaultCommand = null;
}
-
public String getAccessKey() {
- return accessKey;
+ return null;
}
public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
public String getImage() {
@@ -100,11 +92,13 @@
}
public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ return null;
}
public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
public void setTip(String tip) {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTag.java Tue Apr 4 10:13:28 2006
@@ -16,21 +16,20 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOCUS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCHANGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
public abstract class InputTag extends BeanTag implements InputTagDeclaration {
-
+ private final Log LOG = LogFactory.getLog(InputTag.class);
+
private String onchange;
private String focus;
- private String accessKey;
- private String labelWithAccessKey;
private String tip;
private String validator;
@@ -38,8 +37,6 @@
super.release();
this.onchange = null;
this.focus = null;
- accessKey = null;
- labelWithAccessKey = null;
tip = null;
validator = null;
}
@@ -48,8 +45,6 @@
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_ONCHANGE, onchange);
ComponentUtil.setBooleanProperty(component, ATTR_FOCUS, focus);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
ComponentUtil.setValidator(component, validator);
}
@@ -71,19 +66,22 @@
}
public String getAccessKey() {
- return accessKey;
+ return null;
}
public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ return null;
}
public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
public String getTip() {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTag.java Tue Apr 4 10:13:28 2006
@@ -16,20 +16,19 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOR;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UILabel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
public class LabelTag extends BeanTag implements LabelTagDeclaration {
+ private final Log LOG = LogFactory.getLog(LabelTag.class);
private String forComponent;
- private String labelWithAccessKey;
- private String accessKey;
private String tip;
@Override
@@ -44,8 +43,6 @@
@Override
public void release() {
super.release();
- accessKey = null;
- labelWithAccessKey = null;
tip = null;
forComponent = null;
}
@@ -58,25 +55,26 @@
protected void setProperties(UIComponent component) {
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_FOR, forComponent);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
}
- public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ public String getAccessKey() {
+ return null;
}
- public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ public void setAccessKey(String accessKey) {
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
- public String getAccessKey() {
- return accessKey;
+ public String getLabelWithAccessKey() {
+ return null;
}
- public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ public void setLabelWithAccessKey(String labelWithAccessKey) {
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
public String getTip() {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTag.java Tue Apr 4 10:13:28 2006
@@ -18,11 +18,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DEFAULT_COMMAND;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
@@ -37,8 +35,6 @@
private String target;
private String label;
private String image;
- private String accessKey;
- private String labelWithAccessKey;
private String tip;
private String defaultCommand;
@@ -48,8 +44,6 @@
ComponentUtil.setStringProperty(component, ATTR_TARGET, target);
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
ComponentUtil.setStringProperty(component, ATTR_IMAGE, image);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
ComponentUtil.setBooleanProperty(component, ATTR_DEFAULT_COMMAND, defaultCommand);
}
@@ -59,8 +53,6 @@
target = null;
label = null;
image = null;
- accessKey = null;
- labelWithAccessKey = null;
tip = null;
}
@@ -89,19 +81,22 @@
}
public String getAccessKey() {
- return accessKey;
+ return null;
}
public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ return null;
}
public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
public void setTip(String tip) {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTag.java Tue Apr 4 10:13:28 2006
@@ -16,26 +16,25 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_MENUCOMMAND;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIMenuCommand;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
public class MenuCommandTag extends CommandTag
implements MenuCommandTagDeclaration {
+ private final Log LOG = LogFactory.getLog(MenuCommandTag.class);
//public static final String COMMAND_TYPE = "menuCommand";
private String image;
private String label;
- private String accessKey;
- private String labelWithAccessKey;
public String getComponentType() {
return UIMenuCommand.COMPONENT_TYPE;
@@ -45,8 +44,6 @@
super.release();
image = null;
label = null;
- accessKey = null;
- labelWithAccessKey = null;
}
protected void setProperties(UIComponent component) {
@@ -55,8 +52,6 @@
ComponentUtil.setStringProperty(component, ATTR_IMAGE, image);
//ComponentUtil.setStringProperty(component, ATTR_COMMAND_TYPE, COMMAND_TYPE);
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
}
public String getImage() {
@@ -71,15 +66,22 @@
this.label = label;
}
+ public String getAccessKey() {
+ return null;
+ }
+
public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ return null;
}
public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
}
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTag.java Tue Apr 4 10:13:28 2006
@@ -16,12 +16,12 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIMenu;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
@@ -29,20 +29,18 @@
public class MenuTag extends TobagoTag
implements MenuTagDeclaration {
+ private final Log LOG = LogFactory.getLog(MenuTag.class);
+
//public static final String MENU_TYPE = "menu";
private String label;
private String image;
- private String accessKey;
- private String labelWithAccessKey;
// private String disabled;
protected void setProperties(UIComponent component) {
super.setProperties(component);
component.setRendererType(null);
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_IMAGE, image);
//ComponentUtil.setStringProperty(component, ATTR_COMMAND_TYPE, "menu");
}
@@ -55,8 +53,6 @@
public void release() {
super.release();
label = null;
- accessKey = null;
- labelWithAccessKey = null;
}
public String getLabel() {
@@ -67,23 +63,30 @@
this.label = label;
}
- public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ public String getImage() {
+ return image;
}
- public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ public void setImage(String image) {
+ this.image = image;
}
- public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ public String getAccessKey() {
+ return null;
}
- public String getImage() {
- return image;
+ public void setAccessKey(String accessKey) {
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
- public void setImage(String image) {
- this.image = image;
+ public String getLabelWithAccessKey() {
+ return null;
+ }
+
+ public void setLabelWithAccessKey(String labelWithAccessKey) {
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
}
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectBooleanCommandTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectBooleanCommandTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectBooleanCommandTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectBooleanCommandTag.java Tue Apr 4 10:13:28 2006
@@ -16,14 +16,14 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_MENUCOMMAND;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UISelectBooleanCommand;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
@@ -34,10 +34,10 @@
*/
public class SelectBooleanCommandTag extends CommandTag {
+ private final Log LOG = LogFactory.getLog(SelectBooleanCommandTag.class);
+
//public static final String COMMAND_TYPE = "commandSelectBoolean";
private String label;
- private String accessKey;
- private String labelWithAccessKey;
private String value;
private String tip;
@@ -52,8 +52,6 @@
ComponentUtil.setStringProperty(component, ATTR_VALUE, value);
//ComponentUtil.setStringProperty(component, ATTR_COMMAND_TYPE, COMMAND_TYPE);
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
}
@@ -61,8 +59,6 @@
super.release();
value = null;
label = null;
- accessKey = null;
- labelWithAccessKey = null;
}
public String getValue() {
@@ -77,12 +73,23 @@
this.label = label;
}
+ public String getAccessKey() {
+ return null;
+ }
+
public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
+ }
+
+ public String getLabelWithAccessKey() {
+ return null;
}
public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
public String getTip() {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java Tue Apr 4 10:13:28 2006
@@ -16,21 +16,20 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIPanel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
public class TabTag extends TobagoBodyTag
implements TabTagDeclaration {
+ private final Log LOG = LogFactory.getLog(TabTag.class);
private String label;
- private String accessKey;
- private String labelWithAccessKey;
private String tip;
@@ -41,16 +40,12 @@
protected void setProperties(UIComponent component) {
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
}
public void release() {
super.release();
label = null;
- accessKey = null;
- labelWithAccessKey = null;
tip = null;
}
@@ -63,19 +58,22 @@
}
public String getAccessKey() {
- return accessKey;
+ return null;
}
public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
}
public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ return label;
}
public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
public String getTip() {
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTag.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTag.java Tue Apr 4 10:13:28 2006
@@ -16,10 +16,8 @@
* limitations under the License.
*/
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BUTTON;
import org.apache.myfaces.tobago.apt.annotation.Tag;
@@ -33,6 +31,8 @@
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
import org.apache.myfaces.tobago.taglib.decl.IsImmediateCommand;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.component.UIComponent;
@@ -45,10 +45,10 @@
IsDisabled, HasAction, HasActionListener, HasCommandType,
HasTip, IsImmediateCommand {
+ private final Log LOG = LogFactory.getLog(ToolBarCommandTag.class);
+
private String label;
private String image;
- private String accessKey;
- private String labelWithAccessKey;
private String tip;
protected void setProperties(UIComponent component) {
@@ -58,8 +58,6 @@
ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
ComponentUtil.setStringProperty(component, ATTR_IMAGE, image);
- ComponentUtil.setStringProperty(component, ATTR_ACCESS_KEY, accessKey);
- ComponentUtil.setStringProperty(component, ATTR_LABEL_WITH_ACCESS_KEY, labelWithAccessKey);
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
}
@@ -67,20 +65,9 @@
super.release();
label = null;
image = null;
- accessKey = null;
- labelWithAccessKey = null;
tip = null;
}
-
- public String getAccessKey() {
- return accessKey;
- }
-
- public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
- }
-
public String getImage() {
return image;
}
@@ -97,16 +84,27 @@
this.label = label;
}
- public String getLabelWithAccessKey() {
- return labelWithAccessKey;
+ public void setTip(String tip) {
+ this.tip = tip;
}
- public void setLabelWithAccessKey(String labelWithAccessKey) {
- this.labelWithAccessKey = labelWithAccessKey;
+ public String getAccessKey() {
+ return null;
}
- public void setTip(String tip) {
- this.tip = tip;
+ public void setAccessKey(String accessKey) {
+ LOG.warn("Attibute 'accessKey' is deprecated, " +
+ "and will removed soon!");
+ }
+
+ public String getLabelWithAccessKey() {
+ return null;
+ }
+
+ public void setLabelWithAccessKey(String labelWithAccessKey) {
+ LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " +
+ "and will removed soon! Please use 'label' instead.");
+ setLabel(labelWithAccessKey);
}
}
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java Tue Apr 4 10:13:28 2006
@@ -83,13 +83,6 @@
}
writer.writeAttribute("style", null, ATTR_STYLE);
writer.writeComponentClass();
- if (label.getAccessKey() != null) {
- if (LOG.isInfoEnabled()
- && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
- LOG.info("dublicated accessKey : " + label.getAccessKey());
- }
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
- }
writer.writeText("", null); // force closing the start tag
// image
@@ -114,6 +107,17 @@
writer.writeText(" ", null); // separator: e.g.
}
HtmlRendererUtil.writeLabelWithAccessKey(writer, label);
+ }
+
+// AcceleratorKey
+
+ if (label.getAccessKey() != null) {
+ if (LOG.isInfoEnabled()
+ && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
+ LOG.info("dublicated accessKey : " + label.getAccessKey());
+ }
+ HtmlRendererUtil.addClickAcceleratorKey(
+ facesContext, clientId, label.getAccessKey());
}
}
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java Tue Apr 4 10:13:28 2006
@@ -96,17 +96,12 @@
writer.startElement("a", output);
writer.writeComponentClass();
writer.startElement("label", output);
+ String clientId = output.getClientId(facesContext);
+ writer.writeIdAttribute(clientId);
if (forValue != null) {
writer.writeAttribute("for", forValue, null);
}
writer.writeComponentClass();
- if (label.getAccessKey() != null) {
- if (LOG.isInfoEnabled()
- && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
- LOG.info("dublicated accessKey : " + label.getAccessKey());
- }
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
- }
if (width != null) {
writer.writeAttribute("style", "width: " + width + "px;", null);
}
@@ -117,6 +112,15 @@
}
writer.endElement("label");
writer.endElement("a");
+
+ if (label.getAccessKey() != null) {
+ if (LOG.isInfoEnabled()
+ && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
+ LOG.info("dublicated accessKey : " + label.getAccessKey());
+ }
+ HtmlRendererUtil.addClickAcceleratorKey(
+ facesContext, clientId, label.getAccessKey());
+ }
writer.endElement("div");
}
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java Tue Apr 4 10:13:28 2006
@@ -27,7 +27,6 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TYPE;
@@ -60,11 +59,12 @@
String type = (String) component.getAttributes().get(ATTR_TYPE);
String action = (String) component.getAttributes().get(ATTR_ACTION_STRING);
+ String clientId = component.getClientId(facesContext);
if (COMMAND_TYPE_NAVIGATE.equals(type)) {
if (action == null) {
- LOG.warn("keine Action in Link : id " + component.getClientId(facesContext)
- + " label = " + component.getAttributes().get(ATTR_LABEL)
- + " labelwithkey = " + component.getAttributes().get(ATTR_LABEL_WITH_ACCESS_KEY));
+ LOG.warn("keine Action in Link : id " + clientId
+ + " label = " + component.getAttributes().get(ATTR_LABEL));
+// + " labelwithkey = " + component.getAttributes().get(ATTR_LABEL_WITH_ACCESS_KEY));
action = "";
}
href = HtmlUtils.generateUrl(facesContext, action);
@@ -75,7 +75,7 @@
onclick = action;
} else { // default: Action.TYPE_SUBMIT
href = "javascript:Tobago.submitAction('"
- + component.getClientId(facesContext) + "')";
+ + clientId + "')";
}
onclick =
@@ -96,16 +96,10 @@
writer.writeAttribute("onclick", onclick, null);
}
writer.writeAttribute("target", null, ATTR_TARGET);
- if (label.getAccessKey() != null) {
- if (LOG.isInfoEnabled()
- && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
- LOG.info("dublicated accessKey : " + label.getAccessKey());
- }
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
- }
}
writer.writeComponentClass();
- writer.writeNameAttribute(component.getClientId(facesContext));
+ writer.writeIdAttribute(clientId);
+ writer.writeNameAttribute(clientId);
writer.writeAttribute("title", null, ATTR_TIP);
//TODO: check if this is still needed
@@ -129,6 +123,15 @@
}
HtmlRendererUtil.writeLabelWithAccessKey(writer, label);
}
+
+ if (label.getAccessKey() != null) {
+ if (LOG.isInfoEnabled()
+ && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
+ LOG.info("dublicated accessKey : " + label.getAccessKey());
+ }
+
+ HtmlRendererUtil.addClickAcceleratorKey(
+ facesContext, clientId, label.getAccessKey());}
}
public void encodeEndTobago(FacesContext facesContext, UIComponent component)
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java Tue Apr 4 10:13:28 2006
@@ -69,26 +69,30 @@
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
+import java.util.Map;
public class MenuBarRenderer extends RendererBase {
private static final Log LOG = LogFactory.getLog(MenuBarRenderer.class);
public static final String SEARCH_ID_POSTFIX = SUBCOMPONENT_SEP + "popup";
+ private static final String MENU_ACCELERATOR_KEYS = "menuAcceleratorKeys";
public void encodeEndTobago(FacesContext facesContext,
- UIComponent component) throws IOException {
+ UIComponent component) throws IOException {
String clientId;
+ Map attributes = component.getAttributes();
if (ComponentUtil.getBooleanAttribute(component, ATTR_MENU_POPUP)) {
clientId = component.getParent().getClientId(facesContext);
} else {
clientId = component.getClientId(facesContext);
- TobagoResponseWriter writer = (TobagoResponseWriter) facesContext.getResponseWriter();
+ TobagoResponseWriter writer
+ = (TobagoResponseWriter) facesContext.getResponseWriter();
writer.startElement("div", component);
writer.writeIdAttribute(clientId);
- String cssClasses = (String) component.getAttributes().get(
+ String cssClasses = (String) attributes.get(
ATTR_STYLE_CLASS);
if (ComponentUtil.getBooleanAttribute(component, ATTR_PAGE_MENU)) {
cssClasses += "tobago-menuBar-page-facet";
@@ -98,17 +102,23 @@
writer.writeClassAttribute(cssClasses);
writer.endElement("div");
}
-
+ attributes.put(MENU_ACCELERATOR_KEYS, new ArrayList<String>());
StringBuffer scriptBuffer = new StringBuffer();
String setupFunction
= createSetupFunction(facesContext, component, clientId, scriptBuffer);
addScriptsAndStyles(facesContext, component, clientId, setupFunction,
scriptBuffer.toString());
+ List<String> accKeyFunctions
+ = (List<String>) attributes.remove(MENU_ACCELERATOR_KEYS);
+ if (!accKeyFunctions.isEmpty()) {
+ HtmlRendererUtil.writeScriptLoader(facesContext, null,
+ accKeyFunctions.toArray(new String[accKeyFunctions.size()]));
+ }
}
protected void addScriptsAndStyles(FacesContext facesContext,
- UIComponent component, final String clientId, String setupFunction,
- String scriptBlock) throws IOException {
+ UIComponent component, final String clientId, String setupFunction,
+ String scriptBlock) throws IOException {
final UIPage page = ComponentUtil.findPage(component);
page.getScriptFiles().add("script/tobago-menu.js");
page.getStyleFiles().add("style/tobago-menu.css");
@@ -135,7 +145,7 @@
}
protected String createSetupFunction(FacesContext facesContext,
- UIComponent component, final String clientId, StringBuffer sb)
+ UIComponent component, final String clientId, StringBuffer sb)
throws IOException {
String setupFunction = "setupMenu"
+
@@ -180,7 +190,7 @@
}
private int addMenu(StringBuffer sb, String var, FacesContext facesContext,
- UIPanel menu, int i) throws IOException {
+ UIPanel menu, int i) throws IOException {
if (!menu.isRendered()) {
return i;
}
@@ -232,7 +242,10 @@
&& !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
LOG.info("dublicated accessKey : " + label.getAccessKey());
}
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
+ if (! disabled) {
+ writer.writeIdAttribute(uiPanel.getClientId(facesContext));
+ addAcceleratorKey(facesContext, uiPanel, label.getAccessKey());
+ }
}
HtmlRendererUtil.writeLabelWithAccessKey(writer, label);
}
@@ -250,6 +263,23 @@
return "new MenuItem('" + removeLFs(stringWriter.toString()) + "', null)";
}
+ private void addAcceleratorKey(
+ FacesContext facesContext, UIComponent component, Character accessKey) {
+ String clientId = component.getClientId(facesContext);
+ while (component != null && !component.getAttributes().containsKey(MENU_ACCELERATOR_KEYS)) {
+ component = component.getParent();
+ }
+ if (component != null) {
+ List<String> keys
+ = (List<String>) component.getAttributes().get(MENU_ACCELERATOR_KEYS);
+ String jsStatement = HtmlRendererUtil.createOnclickAcceleratorKeyJsStatement(
+ clientId, accessKey, null).toString();
+ keys.add(jsStatement);
+ } else {
+ LOG.warn("Can't find menu root component!");
+ }
+ }
+
private void addImage(TobagoResponseWriter writer, FacesContext facesContext,
String image, boolean disabled) throws IOException {
if (image != null) {
@@ -272,7 +302,7 @@
}
private void addMenuEntrys(StringBuffer sb, String var,
- FacesContext facesContext, UIComponent component, boolean warn)
+ FacesContext facesContext, UIComponent component, boolean warn)
throws IOException {
int i = 0;
for (Object o : component.getChildren()) {
@@ -291,7 +321,7 @@
}
private void addMenuEntry(StringBuffer sb, String var, FacesContext facesContext,
- UICommand command) throws IOException {
+ UICommand command) throws IOException {
String onClick = createOnClick(facesContext, command);
if (command instanceof UIMenuCommand) {
addCommand(sb, var, facesContext, command, onClick);
@@ -303,7 +333,7 @@
}
private String createOnClick(FacesContext facesContext,
- UIComponent component) {
+ UIComponent component) {
String type = (String) component.getAttributes().get(ATTR_TYPE);
String command = (String) component.getAttributes().get(ATTR_ACTION_STRING);
String clientId = component.getClientId(facesContext);
@@ -323,13 +353,13 @@
}
private void addCommand(StringBuffer sb, String var, FacesContext facesContext,
- UICommand command, String onClick) throws IOException {
+ UICommand command, String onClick) throws IOException {
String image = (String) command.getAttributes().get(ATTR_IMAGE);
addMenuItem(sb, var, facesContext, command, image, onClick);
}
private void addSelectBoolean(StringBuffer sb, String var,
- FacesContext facesContext, UICommand command, String onClick)
+ FacesContext facesContext, UICommand command, String onClick)
throws IOException {
UIComponent checkbox = command.getFacet(FACET_CHECKBOX);
@@ -350,7 +380,7 @@
}
private void addMenuItem(StringBuffer sb, String var, FacesContext facesContext,
- UICommand command, String image, String onClick) throws IOException {
+ UICommand command, String image, String onClick) throws IOException {
final LabelWithAccessKey label = new LabelWithAccessKey(command);
onClick = CommandRendererBase.appendConfirmationScript(onClick, command,
facesContext);
@@ -358,7 +388,7 @@
}
private void addSelectOne(StringBuffer sb, String var,
- FacesContext facesContext, UICommand command, String onClick)
+ FacesContext facesContext, UICommand command, String onClick)
throws IOException {
onClick = CommandRendererBase.appendConfirmationScript(onClick, command,
facesContext);
@@ -410,9 +440,9 @@
}
private void addMenuItem(StringBuffer sb, String var,
- FacesContext facesContext,
- UICommand command, LabelWithAccessKey label, String image,
- String onClick) throws IOException {
+ FacesContext facesContext,
+ UICommand command, LabelWithAccessKey label, String image,
+ String onClick) throws IOException {
if (!command.isRendered()) {
return;
}
@@ -437,7 +467,11 @@
&& !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
LOG.info("dublicated accessKey : " + label.getAccessKey());
}
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
+
+ if (! disabled) {
+ writer.writeIdAttribute(command.getClientId(facesContext));
+ addAcceleratorKey(facesContext, command, label.getAccessKey());
+ }
}
writer.writeAttribute("href", "#", null);
writer.writeAttribute("onfocus", "tobagoMenuFocus(event)", null);
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Tue Apr 4 10:13:28 2006
@@ -280,6 +280,7 @@
= new String[]{"new LOG.LogArea({hide: " + hideClientLogging + "});"};
HtmlRendererUtil.writeScriptLoader(facesContext, jsFiles, jsCommand);
}
+ HtmlRendererUtil.writeJavascript(writer, "TbgTimer.startBody = new Date();");
writer.startElement("form", page);
writer.writeNameAttribute(
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Tue Apr 4 10:13:28 2006
@@ -206,18 +206,18 @@
for (int i = 0; i < tabs.length; i++) {
UIPanel tab = tabs[i];
- String url;
+ String onclick;
if (TobagoConfig.getInstance(facesContext).isAjaxEnabled()
&& SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
- url = "#";
+ onclick = null;
} else if (SWITCH_TYPE_RELOAD_PAGE.equals(switchType)
|| SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
- url = "javascript:tobago_requestTab('"
+ onclick = "tobago_requestTab('"
+ clientId + "'," + i + ",'"
+ ComponentUtil.findPage(component).getFormId(facesContext) + "')";
} else { // SWITCH_TYPE_CLIENT
- url = "javascript:tobago_selectTab('"
+ onclick = "tobago_selectTab('"
+ clientId + "'," + i + ','
+ tabs.length + ')';
}
@@ -244,25 +244,28 @@
writer.startElement("div", null);
writer.writeClassAttribute(innerClass);
- writer.startElement("a", null);
+ writer.startElement("span", null);
writer.writeClassAttribute("tobago-tab-link");
- writer.writeIdAttribute(clientId + "." + virtualTab + SUBCOMPONENT_SEP + i);
- writer.writeAttribute("href", url, null);
- if (label.getAccessKey() != null) {
- if (LOG.isWarnEnabled()
- && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
- LOG.warn("dublicated accessKey : " + label.getAccessKey());
- }
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
-// writer.writeAttribute("onfocus", "this.click();", null);
+ String tabId = clientId + "." + virtualTab + SUBCOMPONENT_SEP + i;
+ writer.writeIdAttribute(tabId);
+ if (onclick != null) {
+ writer.writeAttribute("onclick", onclick, null);
}
if (label.getText() != null) {
HtmlRendererUtil.writeLabelWithAccessKey(writer, label);
} else {
writer.writeText(Integer.toString(i+1), null);
}
- writer.endElement("a");
+ writer.endElement("span");
+ if (label.getAccessKey() != null) {
+ if (LOG.isWarnEnabled()
+ && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
+ LOG.warn("dublicated accessKey : " + label.getAccessKey());
+ }
+ HtmlRendererUtil.addClickAcceleratorKey(
+ facesContext, tabId, label.getAccessKey());
+ }
writer.endElement("div");
writer.endElement("div");
writer.endElement("td");
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java Tue Apr 4 10:13:28 2006
@@ -28,7 +28,6 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_POSITION;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_WITH_ACCESS_KEY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MENU_POPUP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MENU_POPUP_TYPE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
@@ -174,11 +173,7 @@
for (SelectItem item : items) {
final String labelText = item.getLabel();
if (labelText != null) {
- if (labelText.indexOf(LabelWithAccessKey.INDICATOR) > -1) {
- command.getAttributes().put(ATTR_LABEL_WITH_ACCESS_KEY, labelText);
- } else {
- command.getAttributes().put(ATTR_LABEL, labelText);
- }
+ command.getAttributes().put(ATTR_LABEL, labelText);
} else {
LOG.warn("Menu item has label=null. UICommand.getClientId()="
+ command.getClientId(facesContext));
@@ -482,7 +477,10 @@
&& !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
LOG.info("dublicated accessKey : " + label.getAccessKey());
}
- writer.writeAttribute("accesskey", label.getAccessKey(), null);
+ String id = command.getClientId(facesContext) + SUBCOMPONENT_SEP + "link";
+ writer.writeIdAttribute(id);
+ HtmlRendererUtil.addClickAcceleratorKey(
+ facesContext, id, label.getAccessKey());
}
}
}
@@ -512,7 +510,6 @@
popupMenu.getAttributes().put(ATTR_MENU_POPUP_TYPE, "ToolBarButton");
popupMenu.setRendererType(RENDERER_TYPE_MENUBAR);
popupMenu.getAttributes().remove(ATTR_LABEL);
- popupMenu.getAttributes().remove(ATTR_LABEL_WITH_ACCESS_KEY);
popupMenu.getAttributes().put(ATTR_IMAGE, "image/toolbarButtonMenu.gif");
RenderUtil.encode(facesContext, popupMenu);
}
Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js Tue Apr 4 10:13:28 2006
@@ -51,7 +51,8 @@
reload: function(event) {
if (event) {
- var aId = Event.findElement(event, 'A').id;
+ var element = Tobago.element(event);
+ var aId = Tobago.findAnchestorWithTagName(element, 'span').id;
this.activeIndex = aId.substring(aId.lastIndexOf(Tobago.SUB_COMPONENT_SEP) + Tobago.SUB_COMPONENT_SEP.length);
LOG.debug("Request tab with index " + this.activeIndex);
@@ -64,11 +65,24 @@
LOG.warn("aId = " + aId);
}
+ this.removeRelatedAcceleratorKeys(aId.substring(0, aId.lastIndexOf(Tobago.SUB_COMPONENT_SEP) + Tobago.SUB_COMPONENT_SEP.length));
+
Tobago.Updater.update(this.parent, this.page, this.tabGroupId, this.tabGroupId, this.options);
} else {
LOG.info("No reload Event");
}
+ },
+
+ removeRelatedAcceleratorKeys: function(idPrefix) {
+ var regex = new RegExp("Tobago.clickOnElement\\(\"" + idPrefix);
+ for (var name in Tobago.acceleratorKeys) {
+ if (typeof Tobago.acceleratorKeys[name] == 'object'
+ && typeof Tobago.acceleratorKeys[name].func == 'function'
+ && regex.test(Tobago.acceleratorKeys[name].func.valueOf())) {
+ Tobago.acceleratorKeys.remove(Tobago.acceleratorKeys[name]);
+ }
+ }
},
onComplete: function(request) {
Modified: incubator/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/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=391367&r1=391366&r2=391367&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Tue Apr 4 10:13:28 2006
@@ -14,6 +14,24 @@
* limitations under the License.
*/
+var TbgTimer = {
+ startTbgJs: new Date(),
+
+ log: function() {
+ var tbgjs = this.endTbgJs.getTime() - this.startTbgJs.getTime();
+// var htmljs = this.endBody.getTime() - this.startHtml.getTime();
+ var bodyjs = this.endBody.getTime() - this.startBody.getTime();
+ var onloadjs = this.endOnload.getTime() - this.startOnload.getTime();
+ var totaljs = this.endOnload.getTime() - this.startTbgJs.getTime();
+ LOG.show();
+ LOG.debug("parse tobago.js " + tbgjs);
+// LOG.debug("parse htmltotal " + htmljs);
+ LOG.debug("parse body " + bodyjs);
+ LOG.debug("execute onload " + onloadjs);
+ LOG.debug("total " + totaljs);
+ }
+};
+
var Tobago = {
// -------- Constants -------------------------------------------------------
@@ -62,6 +80,69 @@
images: {},
+ acceleratorKeys: {
+ set: function(keyAccelerator) {
+ var key = keyAccelerator.modifier + keyAccelerator.key;
+ if (this[key]) {
+ LOG.warn("Ignoring dublicate key: " + keyAccelerator.modifier + "-" + keyAccelerator.key + " with function :" + keyAccelerator.func.valueOf());
+ } else {
+// LOG.debug("add accelerator for " + keyAccelerator.modifier + "-" + keyAccelerator.key);
+ this[key] = keyAccelerator;
+ }
+ },
+
+ get: function(event) {
+ if (!event.type == "keypress") {
+ return;
+ }
+ var keyCode = event.which ? event.which : event.keyCode;
+ if (keyCode == 0) {
+ return;
+ }
+ var key = String.fromCharCode(keyCode).toLowerCase();
+ var mod = "";
+ if (event.altKey) {
+ mod += "alt";
+ }
+ if (event.ctrlKey) {
+ mod += "ctrl";
+ }
+ if (event.shiftKey) {
+ mod += "shift";
+ }
+ if (mod.length == 0) {
+ mod = "none";
+ }
+// LOG.debug("event for " + mod + "-" + key);
+ return this[mod + key];
+ },
+
+ remove: function(keyAccelerator) {
+ var key = keyAccelerator.modifier + keyAccelerator.key;
+ if (this[key]) {
+// LOG.debug("delete accelerator for " + keyAccelerator.modifier + "-" + keyAccelerator.key);
+ delete this[key];
+ }
+ },
+
+ observe: function(event) {
+ if (! event) {
+ event = window.event;
+ }
+// LOG.debug("keypress: keycode " + (event.which ? event.which : event.keyCode));
+ var keyAccelerator = this.get(event);
+ if (keyAccelerator) {
+// LOG.debug("accelerator found!");
+ event.cancelBubble = true;
+ if (event.stopPropagation) {
+ event.stopPropagation(); // this is DOM2
+ event.preventDefault();
+ }
+ return keyAccelerator.func(event);
+ }
+ }
+ },
+
/**
* Object to store already loaded scriptfiles.
* to prevent multiple loading via ajax requests.
@@ -95,6 +176,7 @@
init: function(pageId) {
// new LOG.LogArea({hide: false});
// LOG.show();
+ TbgTimer.startOnload = new Date();
this.page = this.element(pageId);
this.form = this.element(this.page.id + this.SUB_COMPONENT_SEP + "form");
this.addBindEventListener(this.form, "submit", this, "onSubmit");
@@ -108,9 +190,13 @@
this.setFocus();
+ this.addBindEventListener(document, "keypress", this.acceleratorKeys, "observe");
+
this.pageIsComplete = true;
this.registerCurrentScripts();
this.startScriptLoaders();
+ TbgTimer.endOnload = new Date();
+ TbgTimer.log();
},
onSubmit: function() {
@@ -473,7 +559,30 @@
},
// -------- Util functions ----------------------------------------------------
- // TODO move util function in Tobago.Utils object
+
+ clickOnElement: function(id) {
+ var element = this.element(id);
+// LOG.debug("id = " + id + " element = " + typeof element);
+ if (element) {
+ if (element.click) {
+// LOG.debug("click on element");
+ element.click()
+ } else {
+// LOG.debug("click on new button");
+ var a = document.createElement("input")
+ a.type = "button";
+ a.style.width = "0px;";
+ a.style.height = "0px;";
+ a.style.border = "0px;";
+ a.style.padding = "0px;";
+ a.style.margin = "0px;";
+// a.addEventListener("click", function(event) {LOG.debug("button onclick : event " + typeof event);}, false);
+ element.appendChild(a);
+ a.click();
+ element.removeChild(a);
+ }
+ }
+ },
/**
* Sets the focus to the requested element or to the first possible if
@@ -609,6 +718,7 @@
*/
// TODO what if no anchestor found?
findAnchestorWithTagName: function(element, tagName) {
+ element = this.element(element);
while (element.parentNode && (!element.tagName ||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
@@ -879,6 +989,33 @@
Tobago.images[id] = this;
};
+Tobago.AcceleratorKey = function(func, key, modifier) {
+ this.func = func;
+ this.key = key.toLowerCase();
+ if (! modifier) {
+ modifier = "alt";
+ }
+ this.modifier = modifier;
+ if (document.all && (modifier == "alt" || modifier == "ctrl")) {
+ // keys with modifier 'alt' and 'ctrl' are not catched in IE
+ // so special code needed
+ if (modifier == "alt") {
+ // can't make document.createElement("span").accesskey = key working
+ // so need to create a element via innerHTML
+ var span = document.createElement("span");
+ document.body.appendChild(span);
+ var aPrefix = "<A href=\"javascript:;\" tabindex=\"-1\" accesskey=\"";
+ var aPostfix = "\" onclick=\"return false;\" ></a>";
+ span.innerHTML = aPrefix + key.toLowerCase() + aPostfix;
+ span.firstChild.attachEvent("onfocus", function(event) {func(event);});
+ } else {
+ LOG.warn("Can't observe key event for " + modifier + "-" + key);
+ }
+ } else {
+ Tobago.acceleratorKeys.set(this);
+ }
+};
+
Tobago.ScriptLoader = function(names, doAfter) {
this.scriptIndex = 0;
this.names = names;
@@ -985,3 +1122,4 @@
};
}
+TbgTimer.endTbgJs = new Date();
\ No newline at end of file