use of org.openecard.gui.definition.Step in project open-ecard by ecsec.
the class InsertCardNavigator method next.
@Override
public StepResult next() {
idx++;
Step s = uc.getSteps().get(idx);
return new AndroidResult(s, ResultStatus.OK, Collections.EMPTY_LIST);
}
use of org.openecard.gui.definition.Step in project open-ecard by ecsec.
the class EacNavigatorFactoryTest method testGivenCorrectValuesThenCreateFromShouldBeCorrect.
@Test
public void testGivenCorrectValuesThenCreateFromShouldBeCorrect() {
final List<Step> expectedSteps = createInitialSteps();
new Expectations() {
{
ucd.getDialogType();
result = "EAC";
ucd.getSteps();
result = expectedSteps;
}
};
EacNavigatorFactory sut = new EacNavigatorFactory();
final UserConsentNavigator result = sut.createFrom(ucd);
assertNotNull(result);
assertTrue(result.hasNext());
}
use of org.openecard.gui.definition.Step in project open-ecard by ecsec.
the class EacGuiImplTest method createInitialSteps.
private List<Step> createInitialSteps() {
Step step1 = new Step("PROTOCOL_EAC_GUI_STEP_CVC", "CVC");
ToggleText sub = new ToggleText();
sub.setID("SubjectName");
sub.setText("Test Subject");
step1.getInputInfoUnits().add(sub);
final Step step2 = new Step("PROTOCOL_EAC_GUI_STEP_CHAT", "CHAT");
Checkbox readBox = new Checkbox("ReadCHATCheckBoxes");
readBox.getBoxItems().add(makeBoxItem("DG04", false, false));
readBox.getBoxItems().add(makeBoxItem("RESTRICTED_IDENTIFICATION", true, true));
step2.getInputInfoUnits().add(readBox);
step1.setAction(new StepAction(step1) {
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
return new StepActionResult(StepActionResultStatus.NEXT, step2);
}
});
final Step step3 = new PINStep(eacData, true, paceMarker, EacPinStatus.RC3);
step2.setAction(new StepAction(step2) {
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
return new StepActionResult(StepActionResultStatus.NEXT, step3);
}
});
final Step step4 = new Step("PROTOCOL_GUI_STEP_PROCESSING", "Finished");
return Arrays.asList(step1, step2, step3, step4);
}
use of org.openecard.gui.definition.Step in project open-ecard by ecsec.
the class InsertCardDialog method createInsertCardUserConsent.
/**
* Create the UI dialog.
*
* @param insertCardAction A action for this step.
* @return A {@link UserConsentDescription} which may be executed by the {@link ExecutionEngine}.
*/
private UserConsentDescription createInsertCardUserConsent(StepAction insertCardAction) {
UserConsentDescription uc = new UserConsentDescription(lang.translationForKey("title", AppVersion.getName()), "insert_card_dialog");
// create step
Step s = new Step(STEP_ID, lang.translationForKey("step.title"));
s.setInstantReturn(true);
s.setAction(insertCardAction);
// create and add text instructing user
Text i1 = new Text();
if (cardNameAndType.size() == 1) {
i1.setText(lang.translationForKey("step.message.singletype"));
} else {
i1.setText(lang.translationForKey("step.message.multipletypes"));
}
s.getInputInfoUnits().add(i1);
for (String key : cardNameAndType.keySet()) {
Text item = new Text(" - " + key);
s.getInputInfoUnits().add(item);
}
// add step
uc.getSteps().add(s);
return uc;
}
use of org.openecard.gui.definition.Step in project open-ecard by ecsec.
the class PINStep method createDummy.
public static Step createDummy(String passwordType) {
Step s = new Step(STEP_ID);
String pinType = LANG_PACE.translationForKey(passwordType);
s.setTitle(LANG_PACE.translationForKey(TITLE, pinType));
s.setDescription(LANG_PACE.translationForKey(STEP_DESCRIPTION));
return s;
}
Aggregations