Skip to content

Commit

Permalink
Merge pull request #230 from sialcasa/develop
Browse files Browse the repository at this point in the history
merge version 1.2.0 into stable branch #229
  • Loading branch information
manuel-mauky committed May 4, 2015
2 parents 5cfc304 + a7eb622 commit a0875e1
Show file tree
Hide file tree
Showing 74 changed files with 2,586 additions and 773 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
language: java

sudo: required

jdk:
- oraclejdk8
- oraclejdk8

install: true

script:
- sudo apt-get update && sudo apt-get install oracle-java8-installer
- java -version

before_install:
- export DISPLAY=:99.0
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ __MVVM__ is the enhanced version of the [Presentation Model](http://martinfowler
<dependency>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```

Expand All @@ -24,7 +24,7 @@ __MVVM__ is the enhanced version of the [Presentation Model](http://martinfowler
<dependency>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
```

Expand All @@ -36,9 +36,9 @@ If you need help you can use the forums on [Google Groups](https://groups.google
### Links

- [Project Page](http://sialcasa.github.io/mvvmFX/)
- [javadoc mvvmfx core](http://sialcasa.github.io/mvvmFX/javadoc/1.1.0/mvvmfx/)
- [javadoc mvvmfx-cdi](http://sialcasa.github.io/mvvmFX/javadoc/1.1.0/mvvmfx-cdi/)
- [javadoc mvvmfx-guice](http://sialcasa.github.io/mvvmFX/javadoc/1.1.0/mvvmfx-guice/)
- [javadoc mvvmfx-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.1.0/mvvmfx-utils/)
- [javadoc mvvmfx-testing-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.1.0/mvvmfx-testing-utils/)
- [javadoc mvvmfx core](http://sialcasa.github.io/mvvmFX/javadoc/1.2.0/mvvmfx/)
- [javadoc mvvmfx-cdi](http://sialcasa.github.io/mvvmFX/javadoc/1.2.0/mvvmfx-cdi/)
- [javadoc mvvmfx-guice](http://sialcasa.github.io/mvvmFX/javadoc/1.2.0/mvvmfx-guice/)
- [javadoc mvvmfx-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.2.0/mvvmfx-utils/)
- [javadoc mvvmfx-testing-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.2.0/mvvmfx-testing-utils/)

2 changes: 1 addition & 1 deletion examples/mvvmfx-books-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mvvmfx-examples</artifactId>
<groupId>de.saxsys</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ public void initialize() {

viewModel.selectedBookProperty().bind(bookList.getSelectionModel().selectedItemProperty());
errorLabel.textProperty().bind(viewModel.errorProperty());

searchButton.disableProperty().bind(viewModel.getSearchCommand().executableProperty().not());

}

public void searchButtonPressed() {
viewModel.search();
viewModel.getSearchCommand().execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import de.saxsys.mvvmfx.examples.books.backend.Book;
import de.saxsys.mvvmfx.examples.books.backend.Error;
import de.saxsys.mvvmfx.examples.books.backend.LibraryService;
import de.saxsys.mvvmfx.utils.commands.Action;
import de.saxsys.mvvmfx.utils.commands.Command;
import de.saxsys.mvvmfx.utils.commands.DelegateCommand;
import eu.lestard.advanced_bindings.api.ObjectBindings;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

Expand All @@ -32,17 +32,29 @@ public class MainViewModel implements ViewModel {
private ObjectProperty<BookListItemViewModel> selectedBook = new SimpleObjectProperty<>();

private StringProperty error = new SimpleStringProperty();

private Command searchCommand;

public MainViewModel(LibraryService libraryService) {
this.libraryService = libraryService;

searchCommand = new DelegateCommand(() -> new Action() {
@Override
protected void action() throws Exception {
search();
}
});

bookTitle.bind(ObjectBindings.map(selectedBook, bookItem -> bookItem.getBook().getTitle()));
bookAuthor.bind(ObjectBindings.map(selectedBook, bookItem -> bookItem.getBook().getAuthor()));
bookDescription.bind(ObjectBindings.map(selectedBook, bookItem -> bookItem.getBook().getDesc()));
}


public void search() {
public Command getSearchCommand() {
return searchCommand;
}

void search() {
Consumer<Error> errorHandler = err -> error.set(err.getMessage());

final List<Book> result = libraryService.search(searchString.get(), errorHandler);
Expand Down
2 changes: 1 addition & 1 deletion examples/mvvmfx-cdi-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-examples</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion examples/mvvmfx-complex-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-examples</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ProgressIndicator;
import de.saxsys.jfx.exampleapplication.viewmodel.personlogin.PersonLoginViewModel;
import de.saxsys.jfx.exampleapplication.viewmodel.personlogin.PersonLoginViewModelNotifications;
import de.saxsys.mvvmfx.FxmlView;
import de.saxsys.mvvmfx.InjectViewModel;
import de.saxsys.mvvmfx.utils.commands.Command;
Expand Down Expand Up @@ -43,8 +46,17 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
loginCommand = getViewModel().getLoginCommand();
initChoiceBox();
loginButton.disableProperty()
.bind(loginCommand.executableProperty().not());
.bind(loginCommand.notExecutableProperty());
loginProgressIndicator.visibleProperty().bind(loginCommand.runningProperty());

viewModel.subscribe(PersonLoginViewModelNotifications.OK.getId(), (key, payload) -> {
String message = (String) payload[0];
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle(message);
alert.setContentText(message);
alert.show();
});

}

@FXML
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.saxsys.jfx.exampleapplication.viewmodel.personlogin;

import de.saxsys.mvvmfx.utils.commands.Action;
import javafx.application.Platform;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.ReadOnlyIntegerProperty;
Expand Down Expand Up @@ -73,7 +74,12 @@ public ReadOnlyIntegerProperty loggedInPersonIdProperty() {

public Command getLoginCommand() {
if (loginCommand == null) {
loginCommand = new DelegateCommand(() -> performLogin(), createLoginPossibleBinding(), true);
loginCommand = new DelegateCommand(()-> new Action() {
@Override
protected void action() throws Exception {
performLogin();
}
}, createLoginPossibleBinding(), true);
}
return loginCommand;
}
Expand All @@ -88,6 +94,6 @@ private void performLogin() {
Platform.runLater(() -> {
loggedInPersonId.set(selectablePersons.getSelectedItem().getId());
});
publish(PersonLoginViewModelNotifications.OK.getId(), PersonLoginViewModelNotifications.OK.getMessage());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package de.saxsys.jfx.exampleapplication.viewmodel.personlogin;

public enum PersonLoginViewModelNotifications {
OK("Das Einloggen war erfolgreich");

private String message;

PersonLoginViewModelNotifications(String message) {
this.message = message;
}

public String getMessage() {
return message;
}

public String getId() {
return toString();
}
}
2 changes: 1 addition & 1 deletion examples/mvvmfx-contacts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>mvvmfx-examples</artifactId>
<groupId>de.saxsys</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>
<artifactId>mvvmfx-contacts</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,39 +78,39 @@ public ReadOnlyBooleanProperty validProperty() {



public Property<String> firstnameProperty() {
public StringProperty firstnameProperty() {
return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname);
}

public Property<String> titleProperty() {
public StringProperty titleProperty() {
return contactWrapper.field("title", Contact::getTitle, Contact::setTitle);
}

public Property<String> lastnameProperty() {
public StringProperty lastnameProperty() {
return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname);
}

public Property<String> roleProperty() {
public StringProperty roleProperty() {
return contactWrapper.field("role", Contact::getRole, Contact::setRole);
}

public Property<String> departmentProperty() {
public StringProperty departmentProperty() {
return contactWrapper.field("department", Contact::getDepartment, Contact::setDepartment);
}

public Property<LocalDate> birthdayProperty() {
return contactWrapper.field("birthday", Contact::getBirthday, Contact::setBirthday);
}

public Property<String> emailProperty() {
public StringProperty emailProperty() {
return contactWrapper.field("email", Contact::getEmailAddress, Contact::setEmailAddress);
}

public Property<String> mobileNumberProperty() {
public StringProperty mobileNumberProperty() {
return contactWrapper.field("mobileNumber", Contact::getMobileNumber, Contact::setMobileNumber);
}

public Property<String> phoneNumberProperty() {
public StringProperty phoneNumberProperty() {
return contactWrapper.field("phoneNumber", Contact::getPhoneNumber, Contact::setPhoneNumber);
}
}
Loading

0 comments on commit a0875e1

Please sign in to comment.