Skip to content

Commit

Permalink
Enable attribution of ID to inputs via d2wContext. Use field ID in "f…
Browse files Browse the repository at this point in the history
…or" attribute of label. This allows for easier functional testing and enables the user to click on a field label to put focus on the field.

Localize "Required field" title.
  • Loading branch information
fbarthez committed Nov 11, 2015
1 parent 9c62945 commit c2734c6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<webobject name=HasPropertyName>
<webobject name = "FieldLabel">
<webobject name="PropertyName" />
<webobject name="DisplayMandatory"><abbr title="Required field">*</abbr></webobject>
<webobject name="DisplayMandatory"><webobject name = "abbr">*</webobject></webobject>
</webobject>
</webobject><webobject name=DebuggingEnabled><a onmouseout="this.innerHTML=this.innerHTML.replace('visibility: visible;','visibility: hidden;');" onmouseover="this.innerHTML=this.innerHTML.replace('visibility: hidden;','visibility: visible;');">?<span onclick="this.style.visibility='hidden'; return false;" style="position:absolute;visibility: hidden;">
</webobject>
<webobject name=DebuggingEnabled><a onmouseout="this.innerHTML=this.innerHTML.replace('visibility: visible;','visibility: hidden;');" onmouseover="this.innerHTML=this.innerHTML.replace('visibility: hidden;','visibility: visible;');">?<span onclick="this.style.visibility='hidden'; return false;" style="position:absolute;visibility: hidden;">
<table class="D2WPropertyDebugInfo" onclick="this.style.visibility='hidden'; return false;">
<webobject name="ContextDictionaryRepetition">
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ PropertyName: WOString {
escapeHTML = false;
}

abbr: WOGenericContainer {
elementName = "abbr";
title = localizedTitle;
}

ContextDictionaryRepetition : WORepetition {
list = contextDictionaryForPropertyKey.allKeys.@sortAsc.toString; //VALID
item = currentKey;
Expand Down
1 change: 1 addition & 0 deletions Frameworks/D2W/ERModernDirectToWeb/Resources/d2w.d2wmodel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{"author" = "0"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "typeAheadSearchTemplate"; "value" = "*@@searchValue@@*"; }; },
{"author" = "0"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "useAjaxControls"; "value" = "true"; }; },
{"author" = "10"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "allowInlineEditing"; "value" = "false"; }; },
{"author" = "10"; "class" = "com.webobjects.directtoweb.Rule"; "documentation" = "Sets the key \"id\" to the value returned for \"idForPropertyContainer\". \"id\" is used e.g. on ERD2WEditString and allows to click on the property name label to set focus on the field."; "rhs" = {"class" = "er.directtoweb.ERDDelayedKeyValueAssignment"; "keyPath" = "id"; "value" = "idForPropertyContainer"; }; },
{"author" = "10"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "busyIndicatorImageFramework"; "value" = "Ajax"; }; },
{"author" = "10"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "includeBusyIndicator"; "value" = "true"; }; },
{"author" = "10"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "busyIndicatorImageName"; "value" = "busyBigSpinner.gif"; }; },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
0 : *true* => typeAheadSearchTemplate = "*@@searchValue@@*" [com.webobjects.directtoweb.Assignment],
0 : pageConfiguration like '*Embedded*' => useAjaxControls = "true" [com.webobjects.directtoweb.BooleanAssignment],
10 : *true* => allowInlineEditing = "false" [com.webobjects.directtoweb.BooleanAssignment],
10 : *true* => id = "idForPropertyContainer" [er.directtoweb.ERDDelayedKeyValueAssignment],
10 : *true* => busyIndicatorImageFramework = "Ajax" [com.webobjects.directtoweb.Assignment],
10 : *true* => includeBusyIndicator = "true" [com.webobjects.directtoweb.BooleanAssignment],
10 : *true* => busyIndicatorImageName = "busyBigSpinner.gif" [com.webobjects.directtoweb.Assignment],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import er.directtoweb.components.ERD2WPropertyName;
import er.extensions.foundation.ERXStringUtilities;
import er.extensions.localization.ERXLocalizer;

/**
* Modern property name component.
Expand All @@ -17,14 +18,17 @@
* @d2wKey hidePropertyName
* @d2wKey displayRequiredMarker
* @d2wKey keyPathsWithValidationExceptions
* @d2wKey idForPropertyContainer
*
*
* @author davidleber
*
*/
public class ERMD2WPropertyName extends ERD2WPropertyName {

public ERMD2WPropertyName(WOContext context) {
private static final long serialVersionUID = 1L;

public ERMD2WPropertyName(WOContext context) {
super(context);
}

Expand All @@ -43,15 +47,20 @@ public String fieldLabelClass() {
return result;
}

public String fieldLabelForValue() {
return isEditing() ? d2wContext().displayNameForProperty() : null;
}

public String fieldLabelForValue() {
return isEditing() ? (String) d2wContext().valueForKey("idForPropertyContainer")
: null;
}

public String localizedTitle() {
return ERXLocalizer.currentLocalizer().localizedStringForKeyWithDefault(
"Required field");
}

@Override
public boolean isEditing() {
String task = d2wContext().task();
return "edit".equals(task) || "query".equals(task);
}


}

0 comments on commit c2734c6

Please sign in to comment.