Introduce @FxmlView, replace Navigation.Item

This commit is contained in:
Chris Beams 2014-11-25 00:12:57 +01:00
parent 5a5bfd0826
commit 70d9577e32
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
41 changed files with 645 additions and 601 deletions

View file

@ -17,18 +17,21 @@
package io.bitsquare.app.gui;
import io.bitsquare.BitsquareException;
import io.bitsquare.app.BitsquareEnvironment;
import io.bitsquare.gui.FxmlView;
import io.bitsquare.gui.main.funds.FundsView;
import io.bitsquare.locale.BSResources;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ResourceBundle;
import viewfx.ViewfxException;
import viewfx.view.support.fxml.FxmlViewLoader;
import viewfx.view.support.guice.GuiceViewFactory;
@ -79,13 +82,26 @@ public class ViewLoaderTests {
resourceBundle = BSResources.getResourceBundle();
}
@Test(expected = BitsquareException.class)
@Test(expected = ViewfxException.class)
public void loadingBogusFxmlResourceShouldThrow() throws MalformedURLException {
new FxmlViewLoader(viewFactory, resourceBundle).load(FxmlView.BOGUS.getLocation());
URL uri = new File("/tmp/bogus1234").toURI().toURL();
new FxmlViewLoader(viewFactory, resourceBundle).load(uri);
}
@Test
public void loadingValidFxmlResourceShouldNotThrow() {
new FxmlViewLoader(viewFactory, resourceBundle).load(FxmlView.ACCOUNT.getLocation());
public void loadingValidFxmlResourceShouldNotThrow() throws MalformedURLException {
String path = "/Users/cbeams/Desktop/bitsquare/bitsquare/build/resources/main/" +
"io/bitsquare/gui/main/account/AccountView.fxml";
new FxmlViewLoader(viewFactory, resourceBundle).load(new File(path).toURI().toURL());
}
@Test
public void loadingFromValidFxmlViewClassShouldNotThrow() {
new FxmlViewLoader(viewFactory, resourceBundle).load(FundsView.class);
}
@Test(expected = IllegalArgumentException.class)
public void loadingFromNonViewClassShouldThrow() {
new FxmlViewLoader(viewFactory, resourceBundle).load(File.class);
}
}