Add support for generic arguments in Window objects
This commit is contained in:
@@ -11,7 +11,7 @@ public interface Window extends Widget {
|
|||||||
|
|
||||||
<T extends Component> T reference(String ref, Class<T> type);
|
<T extends Component> T reference(String ref, Class<T> type);
|
||||||
|
|
||||||
default void onOpen(WindowManager manager) {
|
default void onOpen(WindowManager manager, Object[] args) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public final class WindowManager extends BaseWidget {
|
|||||||
throw new UnsupportedOperationException("Window Manager is hardcoded to be of MATCH_PARENT mode");
|
throw new UnsupportedOperationException("Window Manager is hardcoded to be of MATCH_PARENT mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(Window window) {
|
public void open(Window window, Object... args) {
|
||||||
requireNonNull(window, "Window cannot be null");
|
requireNonNull(window, "Window cannot be null");
|
||||||
|
|
||||||
if (windows.isEmpty()) {
|
if (windows.isEmpty()) {
|
||||||
@@ -72,7 +72,7 @@ public final class WindowManager extends BaseWidget {
|
|||||||
|
|
||||||
windows.addLast(window);
|
windows.addLast(window);
|
||||||
window.setParent(this);
|
window.setParent(this);
|
||||||
window.onOpen(this);
|
window.onOpen(this, args != null ? args : new Object[] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forwardKeyEventToTopWindow(KeyEvent event) {
|
private void forwardKeyEventToTopWindow(KeyEvent event) {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public abstract class BaseWindow extends BaseWidget implements Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOpen(WindowManager manager) {
|
public void onOpen(WindowManager manager, Object[] args) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user