Config: add an isPrimary property
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
452641a0eb
commit
8f0dcd0a32
@ -30,6 +30,7 @@ public class Config extends BaseObservable
|
|||||||
|
|
||||||
private final Interface iface = new Interface();
|
private final Interface iface = new Interface();
|
||||||
private boolean isEnabled;
|
private boolean isEnabled;
|
||||||
|
private boolean isPrimary;
|
||||||
private String name;
|
private String name;
|
||||||
private final ObservableList<Peer> peers = new ObservableArrayList<>();
|
private final ObservableList<Peer> peers = new ObservableArrayList<>();
|
||||||
|
|
||||||
@ -73,6 +74,11 @@ public class Config extends BaseObservable
|
|||||||
return isEnabled;
|
return isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bindable
|
||||||
|
public boolean isPrimary() {
|
||||||
|
return isPrimary;
|
||||||
|
}
|
||||||
|
|
||||||
public void parseFrom(final InputStream stream)
|
public void parseFrom(final InputStream stream)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
peers.clear();
|
peers.clear();
|
||||||
@ -102,6 +108,11 @@ public class Config extends BaseObservable
|
|||||||
notifyPropertyChanged(BR.enabled);
|
notifyPropertyChanged(BR.enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsPrimary(final boolean isPrimary) {
|
||||||
|
this.isPrimary = isPrimary;
|
||||||
|
notifyPropertyChanged(BR.primary);
|
||||||
|
}
|
||||||
|
|
||||||
public void setName(final String name) {
|
public void setName(final String name) {
|
||||||
if (name != null && !name.isEmpty() && !isNameValid(name))
|
if (name != null && !name.isEmpty() && !isNameValid(name))
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
Loading…
Reference in New Issue
Block a user