Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"disabled" feature #379

Merged
merged 2 commits into from
Feb 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
<validation message="'item' must be bound to a settable value">
<unsettable name="item"/>
</validation>
<binding name="disabled"/>
<binding defaults="Boolean" name="disabled"/>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<webobject name=RadioButtonRepetition><table border=0 cellpadding=0 cellspacing=0 class="ERXMatrixTable"><tr><td><webobject name=RadioButton></webobject></td><td class="ERXMatrixTableCell"><webobject name=Content></webobject></td></tr></table></webobject>
<webobject name=RadioButtonRepetition><table border=0 cellpadding=0 cellspacing=0 class="ERXMatrixTable"><tr><td><wo:if condition="$disabled"><webobject name="RadioButtonDisabled"/></wo:if><wo:else><webobject name="RadioButton"/></wo:else></td><td class="ERXMatrixTableCell"><webobject name=Content></webobject></td></tr></table></webobject>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ RadioButton: WOGenericElement {
value = index;
}

RadioButtonDisabled: WOGenericElement {
elementName = "input";
name = uniqueID;
otherTagString = isCurrentItemSelected;
type = "radio";
value = index;
disabled = true;
}

RadioButtonRepetition: ERXTable {
cellpadding = cellpadding;
cellspacing = cellspacing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public void setCurrentItem(Object aValue) {
public Number index() {
return index;
}

public boolean disabled() {
return booleanValueForBinding("disabled", false);
}

public void setIndex(Number newIndex) {
index = newIndex;
Expand Down Expand Up @@ -107,10 +111,6 @@ public String otherTagStringForRadioButton() {
return (isDisabled ? "disabled" : "") + (isDisabled && isChecked? " " : "") + (isChecked ? "checked" : "");
}

public boolean disabled() {
return booleanValueForBinding("disabled", false);
}

@Override
public void awake() {
super.awake();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<webobject name=CheckBoxWrapper>
<webobject name=CheckBoxRepetition>
<table border=0 cellpadding=0 cellspacing=0><tr><td><webobject name=CheckBox></webobject></td><td><webobject name=Content></webobject></td></tr></table>
<table border=0 cellpadding=0 cellspacing=0><tr><td><webobject name = "isDisabledConditional"><webobject name="disabledCheckBox"></webobject></webobject><webobject name = "isEnabledConditional"><webobject name="CheckBox"></webobject></webobject></td><td><webobject name=Content></webobject></td></tr></table>
</webobject>
</webobject>
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

isDisabledConditional : WOConditional {
condition = ^disabled;
}

isEnabledConditional : WOConditional {
condition = ^disabled;
negate = true;
}

CheckBox: WOGenericElement {
elementName = "input";
name = wrapperElementID;
Expand All @@ -7,6 +15,15 @@ CheckBox: WOGenericElement {
value = index;
}

disabledCheckBox: WOGenericElement {
elementName = "input";
name = wrapperElementID;
otherTagString = isCurrentItemChecked;
type = "checkbox";
value = index;
disabled = "disabled";
}

CheckBoxRepetition: WOTable {
cellpadding = 0;
cellspacing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8"?>
<wodefinitions>
<wo class="WOCheckboxMatrix" wocomponentcontent="true">
<image path="WOCheckboxMatrix.tiff"/>
Expand All @@ -15,5 +15,6 @@
<validation message="'item' is a required binding">
<unbound name="item"/>
</validation>
</wo>
</wodefinitions>
<binding name="disabled"/>
</wo>
</wodefinitions>