Skip to content

Commit

Permalink
started to implement advanced search expressions (#153, #135)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanrauh committed Aug 8, 2015
1 parent 2ec372e commit 3052672
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.bootsfaces.expressions;

import java.util.ArrayList;
import java.util.List;

import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;

public class AllExpressionResolver implements AbstractExpressionResolver {
public List<UIComponent> resolve(UIComponent component, String parentId, String currentId, String originalExpression) {

UIComponent c = component;

while (c.getParent() != null) {
c = c.getParent();
}
List<UIComponent> result = new ArrayList<UIComponent>();
result.add(c);
return result;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package net.bootsfaces.expressions;

import java.util.ArrayList;
import java.util.List;

import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;

public class NoneExpressionResolver implements AbstractExpressionResolver {
public List<UIComponent> resolve(UIComponent component, String parentId, String currentId,
String originalExpression) {

List<UIComponent> result = new ArrayList<UIComponent>();
return result;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.bootsfaces.expressions;

import java.util.ArrayList;
import java.util.List;

import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;

public class ParentExpressionResolver implements AbstractExpressionResolver {
public List<UIComponent> resolve(UIComponent component, String parentId, String currentId,
String originalExpression) {
if (component.getParent() != null) {
List<UIComponent> result = new ArrayList<UIComponent>();
result.add(component.getParent());
return result;
}
throw new FacesException("Invalid search expression - the component isn't inside a form " + originalExpression);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.bootsfaces.expressions;

import java.util.ArrayList;
import java.util.List;

import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;

public class ThisExpressionResolver implements AbstractExpressionResolver {
public List<UIComponent> resolve(UIComponent component, String parentId, String currentId,
String originalExpression) {

List<UIComponent> result = new ArrayList<UIComponent>();
result.add(component);
return result;
}
}

0 comments on commit 3052672

Please sign in to comment.