use of org.openecard.gui.definition.Radiobox in project open-ecard by ecsec.
the class CardSelectionAction method perform.
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
if (result.isOK()) {
ExecutionResults results = oldResults.get(getStepID());
OutputInfoUnit out = results.getResult("credentialSelectionBox");
Radiobox rBox = (Radiobox) out;
for (BoxItem item : rBox.getBoxItems()) {
if (item.isChecked()) {
this.resultCardTypetName = item.getName();
break;
}
}
if (resultCardTypetName != null) {
return new StepActionResult(StepActionResultStatus.NEXT);
} else {
return new StepActionResult(StepActionResultStatus.REPEAT);
}
} else {
// user has added or removed a card
if (result.isReload()) {
updateCards();
step.update(avCard);
if (avCard.isEmpty()) {
return new StepActionResult(StepActionResultStatus.CANCEL);
}
return new StepActionResult(StepActionResultStatus.REPEAT);
}
// user has canceled the dialog so return that
return new StepActionResult(StepActionResultStatus.CANCEL);
}
}
use of org.openecard.gui.definition.Radiobox in project open-ecard by ecsec.
the class CardSelectionStep method addElements.
/**
* Add the UI elements to the step.
*/
private void addElements() {
Text description = new Text();
description.setText(lang.translationForKey("card.selection.message"));
Radiobox radioBox = new Radiobox("credentialSelectionBox");
radioBox.setGroupText("Available Credentials");
for (String cardName : avCardWithName.keySet()) {
BoxItem item = new BoxItem();
item.setName(avCardWithName.get(cardName).getRecognitionInfo().getCardType());
item.setText(cardName);
radioBox.getBoxItems().add(item);
}
getInputInfoUnits().add(description);
getInputInfoUnits().add(radioBox);
}
Aggregations