Javadocs and unit tests, God help me.

This commit is contained in:
akwizgran
2011-06-27 13:01:31 +01:00
parent d193f23e4c
commit 5281113f24
34 changed files with 169 additions and 54 deletions

View File

@@ -2,10 +2,8 @@ package net.sf.briar.ui.invitation;
import java.io.File;
import net.sf.briar.api.i18n.FontManager;
import net.sf.briar.api.invitation.InvitationParameters;
import com.google.inject.Inject;
import net.sf.briar.util.FileUtils;
class InvitationParametersImpl implements InvitationParameters {
@@ -13,17 +11,14 @@ class InvitationParametersImpl implements InvitationParameters {
private final OperatingSystemPanel osPanel;
private final PasswordPanel passwordPanel;
private final LocationPanel locationPanel;
private final FontManager fontManager;
@Inject
InvitationParametersImpl(ExistingUserPanel existingUserPanel,
OperatingSystemPanel osPanel, PasswordPanel passwordPanel,
LocationPanel locationPanel, FontManager fontManager) {
LocationPanel locationPanel) {
this.existingUserPanel = existingUserPanel;
this.osPanel = osPanel;
this.passwordPanel = passwordPanel;
this.locationPanel = locationPanel;
this.fontManager = fontManager;
}
public boolean shouldCreateExe() {
@@ -44,7 +39,7 @@ class InvitationParametersImpl implements InvitationParameters {
return locationPanel.getChosenDirectory();
}
public String[] getBundledFontFilenames() {
return fontManager.getBundledFontFilenames();
public File getSetupDat() {
return FileUtils.getBriarDirectory();
}
}

View File

@@ -5,13 +5,10 @@ import net.sf.briar.api.i18n.Stri18ng;
import net.sf.briar.ui.wizard.DirectoryChooserPanel;
import net.sf.briar.ui.wizard.Wizard;
import com.google.inject.Inject;
class LocationPanel extends DirectoryChooserPanel {
private static final long serialVersionUID = 3788640725729516888L;
@Inject
LocationPanel(Wizard wizard, I18n i18n) {
super(wizard, "Location", "Password", "InvitationWorker",
new Stri18ng("INVITATION_LOCATION_TITLE", i18n),

View File

@@ -15,8 +15,6 @@ import net.sf.briar.api.i18n.Stri18ng;
import net.sf.briar.ui.wizard.Wizard;
import net.sf.briar.ui.wizard.WizardPanel;
import com.google.inject.Inject;
class OperatingSystemPanel extends WizardPanel {
private static final long serialVersionUID = -8370132633634629466L;
@@ -26,7 +24,6 @@ class OperatingSystemPanel extends WizardPanel {
private final JRadioButton windowsButton, macButton, linuxButton;
private final JRadioButton unknownButton;
@Inject
OperatingSystemPanel(Wizard wizard, I18n i18n) {
super(wizard, "OperatingSystem");
question = new Stri18ng("INVITATION_OPERATING_SYSTEM", i18n);

View File

@@ -17,8 +17,6 @@ import net.sf.briar.api.i18n.Stri18ng;
import net.sf.briar.ui.wizard.Wizard;
import net.sf.briar.ui.wizard.WizardPanel;
import com.google.inject.Inject;
public class PasswordPanel extends WizardPanel {
private static final long serialVersionUID = -1012132977732308293L;
@@ -28,7 +26,6 @@ public class PasswordPanel extends WizardPanel {
private final JLabel introLabel, enterPasswordLabel, confirmPasswordLabel;
private final JPasswordField password1, password2;
@Inject
PasswordPanel(Wizard wizard, ExistingUserPanel existingUserPanel,
I18n i18n) {
super(wizard, "Password");

View File

@@ -1,6 +1,5 @@
package net.sf.briar.ui.invitation;
import net.sf.briar.api.i18n.FontManager;
import net.sf.briar.api.i18n.I18n;
import net.sf.briar.api.invitation.InvitationParameters;
import net.sf.briar.api.invitation.InvitationWorkerFactory;
@@ -15,7 +14,7 @@ public class UiInvitationModule extends AbstractModule {
protected void configure() {}
@Provides @Singleton
InvitationWizard getInvitationWizard(I18n i18n, FontManager fontManager,
InvitationWizard getInvitationWizard(I18n i18n,
InvitationWorkerFactory workerFactory) {
InvitationWizard wizard = new InvitationWizard(i18n);
new IntroPanel(wizard, i18n);
@@ -25,7 +24,7 @@ public class UiInvitationModule extends AbstractModule {
new PasswordPanel(wizard, userPanel, i18n);
LocationPanel locationPanel = new LocationPanel(wizard, i18n);
InvitationParameters parameters = new InvitationParametersImpl(
userPanel, osPanel, passwordPanel, locationPanel, fontManager);
userPanel, osPanel, passwordPanel, locationPanel);
new InvitationWorkerPanel(wizard, workerFactory, parameters, i18n);
return wizard;
}

View File

@@ -2,7 +2,6 @@ package net.sf.briar.ui.setup;
import java.io.File;
import net.sf.briar.api.i18n.FontManager;
import net.sf.briar.api.setup.SetupParameters;
class SetupParametersImpl implements SetupParameters {
@@ -10,21 +9,15 @@ class SetupParametersImpl implements SetupParameters {
private static final int EXE_HEADER_SIZE = 62976;
private final LocationPanel locationPanel;
private final FontManager fontManager;
SetupParametersImpl(LocationPanel locationPanel, FontManager fontManager) {
SetupParametersImpl(LocationPanel locationPanel) {
this.locationPanel = locationPanel;
this.fontManager = fontManager;
}
public File getChosenLocation() {
return locationPanel.getChosenDirectory();
}
public String[] getBundledFontFilenames() {
return fontManager.getBundledFontFilenames();
}
public long getExeHeaderSize() {
return EXE_HEADER_SIZE;
}

View File

@@ -22,8 +22,7 @@ public class UiSetupModule extends AbstractModule {
new AlreadyInstalledPanel(wizard, i18n);
new InstructionsPanel(wizard, i18n);
LocationPanel locationPanel = new LocationPanel(wizard, i18n);
SetupParameters parameters =
new SetupParametersImpl(locationPanel, fontManager);
SetupParameters parameters = new SetupParametersImpl(locationPanel);
new SetupWorkerPanel(wizard, workerFactory, parameters, i18n);
return wizard;
}