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 boolean isEnabled; | ||||
|     private boolean isPrimary; | ||||
|     private String name; | ||||
|     private final ObservableList<Peer> peers = new ObservableArrayList<>(); | ||||
| 
 | ||||
| @ -73,6 +74,11 @@ public class Config extends BaseObservable | ||||
|         return isEnabled; | ||||
|     } | ||||
| 
 | ||||
|     @Bindable | ||||
|     public boolean isPrimary() { | ||||
|         return isPrimary; | ||||
|     } | ||||
| 
 | ||||
|     public void parseFrom(final InputStream stream) | ||||
|             throws IOException { | ||||
|         peers.clear(); | ||||
| @ -102,6 +108,11 @@ public class Config extends BaseObservable | ||||
|         notifyPropertyChanged(BR.enabled); | ||||
|     } | ||||
| 
 | ||||
|     public void setIsPrimary(final boolean isPrimary) { | ||||
|         this.isPrimary = isPrimary; | ||||
|         notifyPropertyChanged(BR.primary); | ||||
|     } | ||||
| 
 | ||||
|     public void setName(final String name) { | ||||
|         if (name != null && !name.isEmpty() && !isNameValid(name)) | ||||
|             throw new IllegalArgumentException(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user