-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
2ec372e
commit 3052672
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/net/bootsfaces/expressions/AllExpressionResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/net/bootsfaces/expressions/NoneExpressionResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/net/bootsfaces/expressions/ParentExpressionResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/net/bootsfaces/expressions/ThisExpressionResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |