Skip to content

Commit

Permalink
Merge pull request wocommunity#2 from fbarthez/NestedRelationshipEdit…
Browse files Browse the repository at this point in the history
…ableList

Nested relationship editable list
  • Loading branch information
fbarthez committed Sep 22, 2015
2 parents bd9b03a + 5a76430 commit 61e4926
Show file tree
Hide file tree
Showing 20 changed files with 844 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Frameworks/D2W/ERModernDefaultSkin/Resources/d2w.d2wmodel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "printerButtonComponentName"; "value" = "ERXEmptyComponent"; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "defaultMainPrintStylesheet"; "value" = {"filename" = "default_print_stylesheet.css"; "media" = "print"; }; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "defaultMainScreenStylesheet"; "value" = {"filename" = "default_screen_stylesheet.css"; "media" = "screen"; }; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "editRelationship"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "list"; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showHeader"; "value" = "true"; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "editRelationship"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "list"; }, {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "edit"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "subTask"; "selectorName" = "isNotEqualTo"; "value" = "list"; }); }); }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showHeader"; "value" = "true"; }; },
{"author" = "30"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showBottomBatchCount"; "value" = "true"; }; },
{"author" = "30"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "parentPageConfiguration"; "selectorName" = "isNotEqualTo"; "value" = {"class" = "com.webobjects.foundation.NSKeyValueCoding$Null"; }; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showBottomActionBlock"; "value" = "true"; }; }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
20 : pageConfiguration like '*Embedded*' => printerButtonComponentName = "ERXEmptyComponent" [com.webobjects.directtoweb.Assignment],
20 : *true* => defaultMainPrintStylesheet = {"filename" = "default_print_stylesheet.css"; "media" = "print"; } [com.webobjects.directtoweb.Assignment],
20 : *true* => defaultMainScreenStylesheet = {"filename" = "default_screen_stylesheet.css"; "media" = "screen"; } [com.webobjects.directtoweb.Assignment],
20 : (pageConfiguration like '*Embedded*' and task != 'editRelationship' and task != 'list') => showHeader = "true" [com.webobjects.directtoweb.BooleanAssignment],
20 : (pageConfiguration like '*Embedded*' and task != 'editRelationship' and task != 'list' and (task != 'edit' and subTask != 'list')) => showHeader = "true" [com.webobjects.directtoweb.BooleanAssignment],
30 : pageConfiguration like '*Embedded*' => showBottomBatchCount = "true" [com.webobjects.directtoweb.BooleanAssignment],
30 : (pageConfiguration like '*Embedded*' and parentPageConfiguration != null) => showBottomActionBlock = "true" [com.webobjects.directtoweb.BooleanAssignment]
)
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,12 @@ span.ErrorLabel {
background-color: #e6e9ef;
}

/* hide empty children row */
.ObjRow.NestedObjRow .hidden {
line-height: 0px;
padding: 0px;
}

.ComboTHLink .Label{
text-decoration: none;
color: #c2c6cf;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<webobject name = "ObjectTable">
<webobject name = "ObjectsRepetition">
<webobject name = "IsRenderTableHeader">
<webobject name = "ObjectTableHeaderRow">
<webobject name = "HasLeftActionsConditional"><th class="ActionCell LftActionCell">&nbsp;</th></webobject>
<webobject name = "SectionRepetition">
<webobject name = "ColumnLabelRepetition">
<webobject name = "IsNotOmitted">
<webobject name = "AttColumnHeader">
<webobject name = "TableHeaderSwitchComponent"/>
</webobject>
</webobject>
</webobject>
</webobject>
<webobject name = "HasRightActionsConditional"><th class="ActionCell RtActionCell">&nbsp;</th></webobject>
</webobject>
</webobject>
<webobject name = "ListTableRow">
<webobject name = "HasLeftActionsConditional">
<td class="ActionCell LftActionCell">
<ul class="ObjActionList LftObjActionList">
<webobject name = "HasNestedRelationship">
<li><webobject name = "ToggleNestedRelationshipEditor">Show Nested</webobject></li>
</webobject>
<webobject name = "LeftActions">
<li><webobject name = "LeftAction" /></li>
</webobject>
</ul>
</td>
</webobject>
<webobject name = "SectionRepetition">
<webobject name = "AttributeRepetition">
<webobject name = "IsNotOmitted"><webobject name = "AttColumnCell"><webobject name = "AttributeDisplay" /></webobject></webobject>
</webobject>
</webobject>
<webobject name = "HasRightActionsConditional">
<td class="ActionCell RtActionCell">
<ul class="ObjActionList RtObjActionList">
<webobject name = "RightActions">
<li><webobject name = "RightAction" /></li>
</webobject>
</ul>
</td>
</webobject>
</webobject>
<!-- optional child relationship drill-down -->
<webobject name = "HasNestedRelationship">
<webobject name = "NestedUC">
<webobject name = "showNestedRelationshipEditor">
<webobject name = "NestedRelationshipField"><webobject name = "NestedRelationshipEditor"></webobject></webobject>
</webobject>
<webobject name = "hideNestedRelationshipEditor">
<webobject name = "HiddenNestedRelationshipField">&nbsp;</webobject>
</webobject>
</webobject>
</webobject>
</webobject>
</webobject>
<p class="ERMDebugText" style="font-size:10px;"><webobject name = "D2wContextEntityName"/>-><webobject name = "D2wContextParentPageConfiguration"/>/<webobject name = "D2wContextPageConfiguration"/>/<webobject name = "D2wContextParentProperytKey"/></p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
AttributeDisplay: WOSwitchComponent {
WOComponentName = d2wContext.componentName;
localContext = d2wContext;
object = d2wContext.object;
}

AttributeRepetition: WORepetition {
_unroll = true;
item = propertyKey;
list = currentSectionKeys;
}

IsNotOmitted : WOConditional {
condition = isKeyOmitted;
negate = true;
}

ColumnLabelRepetition: WORepetition {
_unroll = true;
item = propertyKey;
list = currentSectionKeys;
}

ObjectsRepetition: WORepetition {
item = d2wContext.object;
list = ^displayGroup.displayedObjects;
index = rowIndex;
checkHashCodes = true;
eoSupport = true;
}

IsRenderTableHeader : ERXEqualConditional {
value1 = rowIndex;
value2 = 0;
}

LeftAction: WOSwitchComponent {
WOComponentName = d2wContext.componentName;
localContext = d2wContext;
object = d2wContext.object;
displayGroup = displayGroup;
updateContainerID = d2wContext.updateContainerID;
}

LeftActions: WORepetition {
item = propertyKey;
list = leftActions;
}

ObjectTableHeaderRow: WOGenericContainer {
_unroll = true;
elementName = "tr";
class = d2wContext.classForObjectTableHeader;
}

ListTableRow: WOGenericContainer {
elementName = "tr";
class = objectRowClass;
}

HasNestedRelationship : WOConditional {
condition = hasNestedRelationship;
}

NestedUC : AjaxUpdateContainer {
id = idForNestedUpdateContainer;
elementName = "tr";
class = nestedRowClass;
}

showNestedRelationshipEditor : WOConditional {
condition = showNestedRelationshipEditor;
}

NestedRelationshipField : WOGenericContainer {
elementName = "td";
colspan = columnCount;
}

HiddenNestedRelationshipField : WOGenericContainer {
elementName = "td";
colspan = columnCount;
class = "hidden";
}

NestedRelationshipEditor : WOSwitchComponent {
WOComponentName = childContext.componentName;
localContext = childContext;
object = childContext.object; // VALID
}

hideNestedRelationshipEditor : WOConditional {
condition = showNestedRelationshipEditor;
negate = true;
}

TableHeaderSwitchComponent : WOSwitchComponent {
WOComponentName = d2wContext.tableHeaderComponentName;
displayGroup = displayGroup;
d2wContext = d2wContext;
updateContainerID = ^updateContainerID;
}

RightAction: WOSwitchComponent {
WOComponentName = d2wContext.componentName;
localContext = d2wContext;
object = d2wContext.object;
displayGroup = displayGroup;
}

RightActions: WORepetition {
item = propertyKey;
list = rightActions;
}

SectionRepetition: ERXWORepetition {
list = sectionsContents;
item = currentSection;
}

ObjectTable : WOGenericContainer {
elementName = "table";
class = d2wContext.classForObjectTable;
}

AttColumnHeader : WOGenericContainer {
elementName = "th";
class = d2wContext.classForAttributeColumn;
}

AttColumnCell : WOGenericContainer {
elementName = "td";
class = d2wContext.classForAttributeColumn;
data-label = d2wContext.displayNameForProperty;
}

HasLeftActionsConditional : WOConditional {
condition = hasLeftActions;
}

ToggleNestedRelationshipEditor : AjaxUpdateLink {
action = toggleNestedRelationshipEditor;
updateContainerID = idForNestedUpdateContainer;
}

HasRightActionsConditional : WOConditional {
condition = hasRightActions;
}
D2wContextEntityName : WOString {
value = d2wContext.entity.name;
}

D2wContextParentPageConfiguration : WOString {
value = d2wContext.parentPageConfiguration;
}

D2wContextPageConfiguration : WOString {
value = d2wContext.pageConfiguration;
}

D2wContextParentProperytKey : WOString {
value = d2wContext.parentProperytKey;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"WebObjects Release" = "WebObjects 5.0";
encoding = "UTF-8";
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<webobject name = "ObjectTable">
<webobject name = "ObjectTableHeaderRow">
<webobject name = "HasLeftActionsConditional"><th class="ActionCell LftActionCell">&nbsp;</th></webobject>
<webobject name = "SectionRepetition">
<webobject name = "ColumnLabelRepetition">
<webobject name = "IsNotOmitted">
<webobject name = "AttColumnHeader">
<webobject name = "TableHeaderSwitchComponent"/>
<webobject name = "ObjectsRepetition">
<webobject name = "IsRenderTableHeader">
<webobject name = "ObjectTableHeaderRow">
<webobject name = "HasLeftActionsConditional"><th class="ActionCell LftActionCell">&nbsp;</th></webobject>
<webobject name = "SectionRepetition">
<webobject name = "ColumnLabelRepetition">
<webobject name = "IsNotOmitted">
<webobject name = "AttColumnHeader">
<webobject name = "TableHeaderSwitchComponent"/>
</webobject>
</webobject>
</webobject>
</webobject>
<webobject name = "HasRightActionsConditional"><th class="ActionCell RtActionCell">&nbsp;</th></webobject>
</webobject>
</webobject>
<webobject name = "HasRightActionsConditional"><th class="ActionCell RtActionCell">&nbsp;</th></webobject>
</webobject>
<webobject name = "ObjectsRepetition">
<webobject name = "ListTableRow">
<webobject name = "HasLeftActionsConditional">
<td class="ActionCell LftActionCell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ ObjectsRepetition: WORepetition {
eoSupport = true;
}

IsRenderTableHeader : ERXEqualConditional {
value1 = rowIndex;
value2 = 0;
}

LeftAction: WOSwitchComponent {
WOComponentName = d2wContext.componentName;
localContext = d2wContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ERMDDefaultConfigurationNameAssignment extends ERDDefaultConfigurat
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "createEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "selectEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "pickEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "subTask", "object.entityName", "entity.name"}), "editListEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "editRelationshipEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name", "inlineTask"}), "inlineConfigurationName"
});
Expand Down Expand Up @@ -100,6 +101,17 @@ public Object selectEmbeddedConfigurationName(D2WContext c) {
return "SelectEmbedded" + entityNameForContext(c);
}

/**
* Generates a default embedded edit list page configuration
* based on the current entity name. Default format
* is 'EditListEmbedded' + entity name.
* @param c current D2W context
* @return default edit list page configuration name
*/
public Object editListEmbeddedConfigurationName(D2WContext c) {
return "EditListEmbedded" + entityNameForContext(c);
}

/**
* Generates a default embedded create page configuration
* based on the current entity name. Default format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,23 @@ public ERXLocalizer localizer() {
* Defaults to the first parent update container id.
*/
public String updateContainerID() {
if (_updateContainerID == null) {
_updateContainerID = (String) valueForBinding(Keys.updateContainerID);
if (_updateContainerID == null) {
_updateContainerID = AjaxUpdateContainer.currentUpdateContainerID();
}
}
return _updateContainerID;
if (_updateContainerID == null) {
_updateContainerID = (String) valueForBinding(Keys.updateContainerID);
if (_updateContainerID == null) {
_updateContainerID = AjaxUpdateContainer.currentUpdateContainerID();
}
}
return _updateContainerID;
}

/**
* Returns a unique id for this batch size control
*/
public String batchSizeFieldID() {
if (_batchSizeFieldID == null) {
_batchSizeFieldID = "BSIF" + ERXStringUtilities.safeIdentifierName(context().contextID());;
}
return _batchSizeFieldID;
if (_batchSizeFieldID == null) {
_batchSizeFieldID = updateContainerID() + "_BSIF";
}
return _batchSizeFieldID;
}

public void setBatchSizeFieldID(String fieldID) {
Expand Down
Loading

0 comments on commit 61e4926

Please sign in to comment.