Skip to content

Commit

Permalink
Modify ERMD2WEditToOneTypeAhead to make use of ERMD2WAttributeQueryDe…
Browse files Browse the repository at this point in the history
…legate. The default behaviour remains unchanged.
  • Loading branch information
fbarthez authored and darkv committed Jan 14, 2016
1 parent 03582e2 commit 4a5d2d8
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import er.extensions.foundation.ERXValueUtilities;
import er.modern.directtoweb.components.ERMDAjaxNotificationCenter;
import er.modern.directtoweb.components.buttons.ERMDActionButton;
import er.modern.directtoweb.delegates.ERMD2WAttributeQueryDelegate;
import er.modern.directtoweb.delegates.ERMD2WAttributeQueryDelegate.ERMD2WQueryComponent;

/**
* <p>A to-one relationship edit component that allows a user to select from a list by typing in the text field</p>
Expand All @@ -62,18 +64,22 @@
* @d2wKey createConfigurationName
* @d2wKey keyWhenRelationship
* @d2wKey newButtonLabel
* @d2wKey searchKey
*
* @author davidleber
*/

public class ERMD2WEditToOneTypeAhead extends ERDCustomEditComponent {
public class ERMD2WEditToOneTypeAhead extends ERDCustomEditComponent implements ERMD2WQueryComponent{

public interface Keys extends ERDCustomEditComponent.Keys {
private static final long serialVersionUID = 1L;

public interface Keys extends ERDCustomEditComponent.Keys {
public static final String newButtonLabel = "newButtonLabel";
public static final String classForNewObjButton = "classForNewObjButton";
public static final String pageConfiguration = "pageConfiguration";
public static final String createConfigurationName = "createConfigurationName";
public static final String propertyKey = "propertyKey";
public static final String searchKey = "searchKey";
public static final String sortKey = "sortKey";
public static final String destinationEntityName = "destinationEntityName";
public static final String restrictedChoiceKey = "restrictedChoiceKey";
Expand Down Expand Up @@ -185,7 +191,8 @@ public NSArray<EOEnterpriseObject> currentObjects() {
if (searchTemplate() != null) {
value = ERXSimpleTemplateParser.parseTemplatedStringWithObject(searchTemplate(), this);
}
EOQualifier qual = ERXQ.likeInsensitive(keyWhenRelationship(), value);
EOQualifier qual = ERMD2WAttributeQueryDelegate.instance
.buildQualifier(this);
result = destinationObjectsWithQualifier(qual);
}
return result;
Expand Down Expand Up @@ -436,4 +443,5 @@ public boolean isEntityInspectable() {
return ERXValueUtilities.booleanValueWithDefault(d2wContext()
.valueForKey("isDestinationEntityInspectable"), true);
}

}

0 comments on commit 4a5d2d8

Please sign in to comment.