Skip to content

Commit

Permalink
Preparations to allow Editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vogel612 committed Jun 24, 2015
1 parent f097965 commit f16748a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/de/vogel612/helper/ui/OverviewPresenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.nio.file.Path;

import de.vogel612.helper.data.Translation;

public interface OverviewPresenter {

public static final String DEFAULT_TARGET_LOCALE = "de";
Expand All @@ -16,4 +18,8 @@ public interface OverviewPresenter {
void onException(Exception e, String message);

void onParseCompletion();

void onTranslationSubmit(Translation t);

void onTranslateRequest(String key);
}
40 changes: 40 additions & 0 deletions src/main/java/de/vogel612/helper/ui/TranslationPresenter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package de.vogel612.helper.ui;

import de.vogel612.helper.data.Translation;

/**
* <p>
* Presenter for editing a single Translation. This part of the Program does not
* require a model, since {@link Translation} <b>is</b> the model. The default
* workflow is simple. From an OverviewPresenter call:
* </p>
*
* <pre>
* TranslationPresenter tp = new TranslationPresenterImpl();
* tp.register(this);
* tp.setRequestedTranslation(translation);
* </pre>
*
* <p>
* And handle the onTranslate-Event like the following
* </p>
*
* <pre>
* onTranslationSubmit((t) -> tp.hide(); /* use translation *\/);
* </pre>
*
* @implNote Implementation will not happen with an additional separated View
* interface, since there is in no way enough View-Logic to justify it
*
* @author vogel612<<a href="mailto:vogel612@gmx.de">vogel612@gmx.de</a>>
*/
public interface TranslationPresenter {

public void register(OverviewPresenter p);

public void show();

public void hide();

public void setRequestedTranslation(Translation t);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.nio.file.Path;

import de.vogel612.helper.data.Translation;
import de.vogel612.helper.ui.OverviewModel;
import de.vogel612.helper.ui.OverviewPresenter;
import de.vogel612.helper.ui.OverviewView;
Expand Down Expand Up @@ -55,4 +56,15 @@ public void loadFiles(final Path resxFolder, final String rootLocale,
model.loadFromDirectory(resxFolder, targetLocale);
}

@Override
public void onTranslationSubmit(final Translation t) {
// TODO Auto-generated method stub
}

@Override
public void onTranslateRequest(final String key) {
// TODO Auto-generated method stub

}

}

0 comments on commit f16748a

Please sign in to comment.