Search in sources :

Example 1 with Radiobox

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);
    }
}
Also used : ExecutionResults(org.openecard.gui.executor.ExecutionResults) OutputInfoUnit(org.openecard.gui.definition.OutputInfoUnit) Radiobox(org.openecard.gui.definition.Radiobox) BoxItem(org.openecard.gui.definition.BoxItem) StepActionResult(org.openecard.gui.executor.StepActionResult)

Example 2 with Radiobox

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);
}
Also used : Text(org.openecard.gui.definition.Text) Radiobox(org.openecard.gui.definition.Radiobox) BoxItem(org.openecard.gui.definition.BoxItem)

Aggregations

BoxItem (org.openecard.gui.definition.BoxItem)2 Radiobox (org.openecard.gui.definition.Radiobox)2 OutputInfoUnit (org.openecard.gui.definition.OutputInfoUnit)1 Text (org.openecard.gui.definition.Text)1 ExecutionResults (org.openecard.gui.executor.ExecutionResults)1 StepActionResult (org.openecard.gui.executor.StepActionResult)1