Profile: Make name modifiable

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland 2017-08-08 05:54:12 -05:00
parent 0685d4a159
commit c59b3e1230

View File

@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets;
public class Profile extends BaseObservable implements Copyable<Profile>, Observable { public class Profile extends BaseObservable implements Copyable<Profile>, Observable {
private final Interface iface = new Interface(); private final Interface iface = new Interface();
private boolean isConnected; private boolean isConnected;
private final String name; private String name;
private final ObservableList<Peer> peers = new ObservableArrayList<>(); private final ObservableList<Peer> peers = new ObservableArrayList<>();
public Profile(String name) { public Profile(String name) {
@ -55,6 +55,7 @@ public class Profile extends BaseObservable implements Copyable<Profile>, Observ
return isConnected; return isConnected;
} }
@Bindable
public String getName() { public String getName() {
return name; return name;
} }
@ -89,6 +90,11 @@ public class Profile extends BaseObservable implements Copyable<Profile>, Observ
notifyPropertyChanged(BR.isConnected); notifyPropertyChanged(BR.isConnected);
} }
public void setName(String name) {
this.name = name;
notifyPropertyChanged(BR.name);
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder().append(iface.toString()); StringBuilder sb = new StringBuilder().append(iface.toString());