-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
157 additions
and
13 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
45 changes: 45 additions & 0 deletions
45
domino-brix-client/src/main/java/org/dominokit/brix/api/CompositeFilter.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,45 @@ | ||
/* | ||
* Copyright © 2019 Dominokit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.dominokit.brix.api; | ||
|
||
import org.dominokit.domino.history.HistoryToken; | ||
import org.dominokit.domino.history.NormalizedToken; | ||
import org.dominokit.domino.history.TokenFilter; | ||
|
||
public class CompositeFilter implements TokenFilter { | ||
|
||
private final TokenFilter root; | ||
private final TokenFilter[] subFilters; | ||
|
||
public static CompositeFilter of(TokenFilter root, TokenFilter... subFilters) { | ||
return new CompositeFilter(root, subFilters); | ||
} | ||
|
||
public CompositeFilter(TokenFilter root, TokenFilter... subFilters) { | ||
this.root = root; | ||
this.subFilters = subFilters; | ||
} | ||
|
||
@Override | ||
public boolean filter(HistoryToken token) { | ||
return root.filter(token) && TokenFilter.and(subFilters).filter(token); | ||
} | ||
|
||
@Override | ||
public NormalizedToken normalizeToken(String rootPath, String token) { | ||
return root.normalizeToken(rootPath, token); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
domino-brix-client/src/main/java/org/dominokit/brix/api/HasContext.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,45 @@ | ||
/* | ||
* Copyright © 2019 Dominokit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.dominokit.brix.api; | ||
|
||
import java.util.Set; | ||
|
||
public interface HasContext<T> { | ||
|
||
default void update(T context) { | ||
getContextListeners() | ||
.forEach( | ||
contextListener -> { | ||
contextListener.onContextUpdated(context); | ||
}); | ||
} | ||
|
||
Set<ContextListener<? super T>> getContextListeners(); | ||
|
||
default T registerContextListener(ContextListener<? super T> contextListener) { | ||
getContextListeners().add(contextListener); | ||
return (T) this; | ||
} | ||
|
||
default T removeChangeListener(ContextListener<? super T> contextListener) { | ||
getContextListeners().remove(contextListener); | ||
return (T) this; | ||
} | ||
|
||
interface ContextListener<T> { | ||
void onContextUpdated(T context); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
domino-brix-client/src/main/java/org/dominokit/brix/api/HasUiHandlers.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 @@ | ||
/* | ||
* Copyright © 2019 Dominokit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.dominokit.brix.api; | ||
|
||
public interface HasUiHandlers<U extends UiHandlers> { | ||
U getUiHandlers(); | ||
} |
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