-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#8 - refactored way of iterating component children, other fixes
- Loading branch information
Showing
21 changed files
with
450 additions
and
153 deletions.
There are no files selected for viewing
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
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
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
24 changes: 0 additions & 24 deletions
24
licket-framework-surface/src/test/java/org/licket/core/id/CompositeIdTest.java
This file was deleted.
Oops, something went wrong.
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
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
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
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
52 changes: 52 additions & 0 deletions
52
licket-framework/src/main/java/org/licket/core/view/ComponentChildLocator.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,52 @@ | ||
package org.licket.core.view; | ||
|
||
import org.licket.core.id.CompositeId; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
|
||
import static java.util.Optional.ofNullable; | ||
|
||
/** | ||
* @author activey | ||
*/ | ||
public class ComponentChildLocator { | ||
|
||
private LicketComponent<?> startingComponent; | ||
|
||
public ComponentChildLocator(LicketComponent<?> startingComponent) { | ||
this.startingComponent = startingComponent; | ||
} | ||
|
||
public final Optional<LicketComponent<?>> findByCompositeId(CompositeId compositeId) { | ||
ChildrenTraverse traverse = new ChildrenTraverse(compositeId); | ||
startingComponent.traverseDown(traverse); | ||
return traverse.getFound(); | ||
} | ||
|
||
private class ChildrenTraverse implements Predicate<LicketComponent<?>> { | ||
|
||
private CompositeId compositeId; | ||
private LicketComponent<?> found; | ||
|
||
public ChildrenTraverse(CompositeId compositeId) { | ||
this.compositeId = compositeId; | ||
} | ||
|
||
public Optional<LicketComponent<?>> getFound() { | ||
return ofNullable(found); | ||
} | ||
|
||
@Override | ||
public boolean test(LicketComponent<?> component) { | ||
if (compositeId.hasMore() && compositeId.current().equals(component.getId())) { | ||
compositeId.forward(); | ||
return true; | ||
} | ||
if (compositeId.current().equals(component.getId())) { | ||
this.found = component; | ||
} | ||
return false; | ||
} | ||
} | ||
} |
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
7 changes: 1 addition & 6 deletions
7
licket-framework/src/main/java/org/licket/core/view/container/LicketComponentContainer.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 |
---|---|---|
@@ -1,16 +1,11 @@ | ||
package org.licket.core.view.container; | ||
|
||
import org.licket.core.id.CompositeId; | ||
import org.licket.core.view.LicketComponent; | ||
|
||
import java.util.function.Predicate; | ||
|
||
/** | ||
* @author grabslu | ||
*/ | ||
public interface LicketComponentContainer<T> extends LicketComponent<T> { | ||
|
||
LicketComponent<?> findChild(CompositeId compositeId); | ||
|
||
void traverseDownContainers(Predicate<LicketComponentContainer<?>> containerConsumer); | ||
void add(LicketComponent<?> licketComponent); | ||
} |
Oops, something went wrong.