mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Allow ViewCB's generic M parameter to be of any type
... and begin implementing CachedViewCB#EMPTY_MODEL support
This commit is contained in:
parent
21b4fc7019
commit
a157c09997
3 changed files with 17 additions and 5 deletions
|
@ -24,21 +24,34 @@ import java.util.ResourceBundle;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If caching is used for loader we use the CachedViewController for turning the controller into sleep mode if not
|
* If caching is used for loader we use the CachedViewController for turning the controller into sleep mode if not
|
||||||
* active and awake it at reactivation.
|
* active and awake it at reactivation.
|
||||||
*/
|
*/
|
||||||
public class CachedViewCB<M extends Activatable & Model> extends ViewCB<M> {
|
public class CachedViewCB<M extends Activatable> extends ViewCB<M> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CachedViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(CachedViewCB.class);
|
||||||
|
|
||||||
|
protected static final Activatable EMPTY_MODEL = new Activatable() {
|
||||||
|
@Override
|
||||||
|
public void activate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivate() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public CachedViewCB(M model) {
|
public CachedViewCB(M model) {
|
||||||
super(model);
|
super(checkNotNull(model, "Model must not be null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedViewCB() {
|
public CachedViewCB() {
|
||||||
this(null);
|
this((M) EMPTY_MODEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get called form GUI framework when the UI is ready.
|
* Get called form GUI framework when the UI is ready.
|
||||||
* In caching controllers the initialize is only used for static UI setup.
|
* In caching controllers the initialize is only used for static UI setup.
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Non caching version for code behind classes using the PM pattern
|
* Non caching version for code behind classes using the PM pattern
|
||||||
*/
|
*/
|
||||||
public class ViewCB<M extends Model> implements Initializable {
|
public class ViewCB<M> implements Initializable {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(ViewCB.class);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class FundsViewCB extends CachedViewCB {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
FundsViewCB(ViewLoader viewLoader, Navigation navigation) {
|
FundsViewCB(ViewLoader viewLoader, Navigation navigation) {
|
||||||
super();
|
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue