Search in sources :

Example 1 with Checkbox

use of org.openecard.gui.definition.Checkbox in project open-ecard by ecsec.

the class RunGUI method requestedDataStep.

private Step requestedDataStep() throws Exception {
    Step requestedData_Step1 = new Step("Angefragte Daten");
    requestedData_Step1.setAction(new RequestedDataAction(requestedData_Step1));
    Text requestedDataDescription = new Text();
    requestedDataDescription.setText("Der Anbieter \"Test-Diensteanbieter\"  fordert zum Zweck \"Entwicklung und Test von Software\" die folgenden Daten von Ihnen an:");
    requestedData_Step1.getInputInfoUnits().add(requestedDataDescription);
    // Hyperlink dataPrivacyDescriptionLink = new Hyperlink();
    // dataPrivacyDescriptionLink.setHref("http://www.dataprivacy.eu");
    // pinInputStep.getInputInfoUnits().add(dataPrivacyDescriptionLink);
    Checkbox dataToSendSelection = new Checkbox("c1");
    BoxItem vornameBoxItem = new BoxItem();
    vornameBoxItem.setName("vornameBoxItem");
    vornameBoxItem.setChecked(true);
    vornameBoxItem.setDisabled(false);
    vornameBoxItem.setText("Vorname");
    BoxItem nameBoxItem = new BoxItem();
    nameBoxItem.setName("nameBoxItem");
    nameBoxItem.setChecked(true);
    nameBoxItem.setDisabled(false);
    nameBoxItem.setText("Name");
    BoxItem doctordegreeBoxItem = new BoxItem();
    doctordegreeBoxItem.setName("doctordegreeBoxItem");
    doctordegreeBoxItem.setChecked(true);
    doctordegreeBoxItem.setDisabled(true);
    doctordegreeBoxItem.setText("Doktorgrad");
    BoxItem addressBoxItem = new BoxItem();
    addressBoxItem.setName("addressBoxItem");
    addressBoxItem.setChecked(true);
    addressBoxItem.setDisabled(false);
    addressBoxItem.setText("Anschrift");
    BoxItem birthdayBoxItem = new BoxItem();
    birthdayBoxItem.setName("birthdayBoxItem");
    birthdayBoxItem.setChecked(false);
    birthdayBoxItem.setDisabled(false);
    birthdayBoxItem.setText("Geburtstag");
    BoxItem birthplaceBoxItem = new BoxItem();
    birthplaceBoxItem.setName("birthplaceBoxItem");
    birthplaceBoxItem.setChecked(false);
    birthplaceBoxItem.setDisabled(false);
    birthplaceBoxItem.setText("Geburtsort");
    // BoxItem pseudonymBoxItem = new BoxItem();
    // pseudonymBoxItem.setName("pseudonymBoxItem");
    // pseudonymBoxItem.setChecked(false);
    // pseudonymBoxItem.setDisabled(true);
    // pseudonymBoxItem.setText("Ordens-oder Künstlername");
    BoxItem identiycardtypeBoxItem = new BoxItem();
    identiycardtypeBoxItem.setName("identiycardtypeBoxItem");
    identiycardtypeBoxItem.setChecked(false);
    identiycardtypeBoxItem.setDisabled(true);
    identiycardtypeBoxItem.setText("Ausweistyp");
    BoxItem certificationcountryBoxItem = new BoxItem();
    certificationcountryBoxItem.setName("certificationcountryBoxItem");
    certificationcountryBoxItem.setChecked(false);
    certificationcountryBoxItem.setDisabled(true);
    certificationcountryBoxItem.setText("Ausstellendes Land");
    BoxItem habitationBoxItem = new BoxItem();
    habitationBoxItem.setName("habitationBoxItem");
    habitationBoxItem.setChecked(false);
    habitationBoxItem.setDisabled(true);
    habitationBoxItem.setText("Wohnort");
    BoxItem ageverificationBoxItem = new BoxItem();
    ageverificationBoxItem.setName("ageverificationBoxItem");
    ageverificationBoxItem.setChecked(false);
    ageverificationBoxItem.setDisabled(true);
    // 
    // Text sendAgreement_Text = new Text ();
    // sendAgreement_Text.setText("Wenn Sie mit der Übermittlung der ausgewählten Daten einverstanden sind  , geben Sie bitte Ihre 6/stellige PIN ein.");
    // ageverificationBoxItem.setText("Alterverifikation");
    // Passwordfield p1 = new Passwordfield();
    // p1.setName("pass input1");
    // p1.setText("PIN:");
    dataToSendSelection.getBoxItems().add(vornameBoxItem);
    dataToSendSelection.getBoxItems().add(nameBoxItem);
    dataToSendSelection.getBoxItems().add(doctordegreeBoxItem);
    // dataToSendSelection.getBoxItems().add(addressBoxItem);
    // dataToSendSelection.getBoxItems().add(birthdayBoxItem);
    // dataToSendSelection.getBoxItems().add(birthplaceBoxItem);
    // dataToSendSelection.getBoxItems().add(identiycardtypeBoxItem);
    // dataToSendSelection.getBoxItems().add(certificationcountryBoxItem);
    // dataToSendSelection.getBoxItems().add(habitationBoxItem);
    // dataToSendSelection.getBoxItems().add(ageverificationBoxItem);
    requestedData_Step1.getInputInfoUnits().add(dataToSendSelection);
    ToggleText requestedDataDescription1 = new ToggleText();
    requestedDataDescription1.setTitle("Hinweis");
    requestedDataDescription1.setText("Die markierten Elemente benötigt der Anbieter zur Durchführung seiner Dienstleistung. Optionale Daten können Sie hinzufügen.");
    requestedDataDescription1.setCollapsed(!true);
    requestedData_Step1.getInputInfoUnits().add(requestedDataDescription1);
    return requestedData_Step1;
}
Also used : ToggleText(org.openecard.gui.definition.ToggleText) Checkbox(org.openecard.gui.definition.Checkbox) ToggleText(org.openecard.gui.definition.ToggleText) Text(org.openecard.gui.definition.Text) Step(org.openecard.gui.definition.Step) BoxItem(org.openecard.gui.definition.BoxItem)

Example 2 with Checkbox

use of org.openecard.gui.definition.Checkbox in project open-ecard by ecsec.

the class EacGuiImpl method loadValuesFromSteps.

public void loadValuesFromSteps(Step step1, Step step2) {
    String subject = "", subjectUrl = "";
    TermsOfUsage termsOfUsage = new TermsOfUsage("text/plain", new byte[0]);
    String validity = "";
    String issuer = "", issuerUrl = "";
    for (InputInfoUnit next : step1.getInputInfoUnits()) {
        if ("SubjectName".equals(next.getID()) && next instanceof ToggleText) {
            ToggleText tt = (ToggleText) next;
            subject = tt.getText();
        } else if ("SubjectURL".equals(next.getID()) && next instanceof ToggleText) {
            ToggleText tt = (ToggleText) next;
            subjectUrl = tt.getText();
        } else if ("TermsOfUsage".equals(next.getID()) && next instanceof ToggleText) {
            ToggleText tt = (ToggleText) next;
            Document d = tt.getDocument();
            termsOfUsage = new TermsOfUsage(d.getMimeType(), d.getValue());
        } else if ("Validity".equals(next.getID()) && next instanceof ToggleText) {
            ToggleText tt = (ToggleText) next;
            validity = tt.getText();
        } else if ("IssuerName".equals(next.getID()) && next instanceof ToggleText) {
            ToggleText tt = (ToggleText) next;
            issuer = tt.getText();
        } else if ("IssuerURL".equals(next.getID()) && next instanceof ToggleText) {
            ToggleText tt = (ToggleText) next;
            issuerUrl = tt.getText();
        }
    }
    ArrayList<BoxItem> readAccess = new ArrayList<>();
    ArrayList<BoxItem> writeAccess = new ArrayList<>();
    for (InputInfoUnit next : step2.getInputInfoUnits()) {
        if ("ReadCHATCheckBoxes".equals(next.getID()) && next instanceof Checkbox) {
            Checkbox cb = (Checkbox) next;
            this.readAccessBox = cb;
            for (org.openecard.gui.definition.BoxItem nb : cb.getBoxItems()) {
                BoxItem bi = new BoxItem(nb.getName(), nb.isChecked(), nb.isDisabled(), nb.getText());
                readAccess.add(bi);
            }
        } else if ("WriteCHATCheckBoxes".equals(next.getID()) && next instanceof Checkbox) {
            Checkbox cb = (Checkbox) next;
            this.writeAccessBox = cb;
            for (org.openecard.gui.definition.BoxItem nb : cb.getBoxItems()) {
                BoxItem bi = new BoxItem(nb.getName(), nb.isChecked(), nb.isDisabled(), nb.getText());
                writeAccess.add(bi);
            }
        }
    }
    ServerData sd = new ServerData(subject, subjectUrl, termsOfUsage, validity, issuer, issuerUrl, readAccess, writeAccess);
    serverData.deliver(sd);
}
Also used : TermsOfUsage(org.openecard.gui.android.eac.types.TermsOfUsage) ToggleText(org.openecard.gui.definition.ToggleText) ArrayList(java.util.ArrayList) Document(org.openecard.gui.definition.Document) InputInfoUnit(org.openecard.gui.definition.InputInfoUnit) Checkbox(org.openecard.gui.definition.Checkbox) ServerData(org.openecard.gui.android.eac.types.ServerData) BoxItem(org.openecard.gui.android.eac.types.BoxItem)

Example 3 with Checkbox

use of org.openecard.gui.definition.Checkbox 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);
}
Also used : ToggleText(org.openecard.gui.definition.ToggleText) StepAction(org.openecard.gui.executor.StepAction) Checkbox(org.openecard.gui.definition.Checkbox) ExecutionResults(org.openecard.gui.executor.ExecutionResults) PINStep(org.openecard.sal.protocol.eac.gui.PINStep) PINStep(org.openecard.sal.protocol.eac.gui.PINStep) Step(org.openecard.gui.definition.Step) StepResult(org.openecard.gui.StepResult) StepActionResult(org.openecard.gui.executor.StepActionResult)

Example 4 with Checkbox

use of org.openecard.gui.definition.Checkbox in project open-ecard by ecsec.

the class RunGUI method pinInputStep.

private Step pinInputStep(Step requestedDataStep) throws Exception {
    Step pinInputStep = new Step("PIN-Eingabe");
    pinInputStep.setAction(new PinInputAction(pinInputStep, requestedDataStep));
    Text t = new Text();
    t.setText("Durch die Eingabe Ihrer PIN bestätigen Sie, dass folgende markierte Daten an den Anbieter übermittelt werden.");
    pinInputStep.getInputInfoUnits().add(t);
    Checkbox dataToSendSelection = new Checkbox("c1");
    BoxItem vornameBoxItem = new BoxItem();
    vornameBoxItem.setName("vornameBoxItem");
    vornameBoxItem.setChecked(true);
    vornameBoxItem.setDisabled(true);
    vornameBoxItem.setText("Vorname");
    BoxItem nameBoxItem = new BoxItem();
    nameBoxItem.setName("nameBoxItem");
    nameBoxItem.setChecked(true);
    nameBoxItem.setDisabled(true);
    nameBoxItem.setText("Name");
    BoxItem doctordegreeBoxItem = new BoxItem();
    doctordegreeBoxItem.setName("doctordegreeBoxItem");
    doctordegreeBoxItem.setChecked(false);
    doctordegreeBoxItem.setDisabled(true);
    doctordegreeBoxItem.setText("Doktorgrad");
    BoxItem addressBoxItem = new BoxItem();
    addressBoxItem.setName("addressBoxItem");
    addressBoxItem.setChecked(true);
    addressBoxItem.setDisabled(true);
    addressBoxItem.setText("Anschrift");
    BoxItem birthdayBoxItem = new BoxItem();
    birthdayBoxItem.setName("birthdayBoxItem");
    birthdayBoxItem.setChecked(false);
    birthdayBoxItem.setDisabled(true);
    birthdayBoxItem.setText("Geburtstag");
    BoxItem birthplaceBoxItem = new BoxItem();
    birthplaceBoxItem.setName("birthplaceBoxItem");
    birthplaceBoxItem.setChecked(false);
    birthplaceBoxItem.setDisabled(true);
    birthplaceBoxItem.setText("Geburtsort");
    BoxItem pseudonymBoxItem = new BoxItem();
    pseudonymBoxItem.setName("pseudonymBoxItem");
    pseudonymBoxItem.setChecked(false);
    pseudonymBoxItem.setDisabled(true);
    pseudonymBoxItem.setText("Ordens-oder Künstlername");
    BoxItem identiycardtypeBoxItem = new BoxItem();
    identiycardtypeBoxItem.setName("identiycardtypeBoxItem");
    identiycardtypeBoxItem.setChecked(false);
    identiycardtypeBoxItem.setDisabled(true);
    identiycardtypeBoxItem.setText("Ausweistyp");
    BoxItem certificationcountryBoxItem = new BoxItem();
    certificationcountryBoxItem.setName("certificationcountryBoxItem");
    certificationcountryBoxItem.setChecked(false);
    certificationcountryBoxItem.setDisabled(true);
    certificationcountryBoxItem.setText("Ausstellendes Land");
    BoxItem habitationBoxItem = new BoxItem();
    habitationBoxItem.setName("habitationBoxItem");
    habitationBoxItem.setChecked(false);
    habitationBoxItem.setDisabled(true);
    habitationBoxItem.setText("Wohnort");
    BoxItem ageverificationBoxItem = new BoxItem();
    ageverificationBoxItem.setName("ageverificationBoxItem");
    ageverificationBoxItem.setChecked(false);
    ageverificationBoxItem.setDisabled(true);
    ageverificationBoxItem.setText("Altersverifikation");
    Text sendAgreement_Text = new Text();
    sendAgreement_Text.setText("Wenn Sie mit der Übermittlung der ausgewählten\n" + "Daten einverstanden sind, geben Sie bitte\n" + "Ihre 6-stellige PIN ein.");
    PasswordField p1 = new PasswordField("pf1");
    p1.setDescription("pass input1");
    p1.setDescription("PIN:");
    p1.setMaxLength(6);
    dataToSendSelection.getBoxItems().add(vornameBoxItem);
    dataToSendSelection.getBoxItems().add(nameBoxItem);
    // dataToSendSelection.getBoxItems().add(doctordegreeBoxItem);
    // dataToSendSelection.getBoxItems().add(addressBoxItem);
    // dataToSendSelection.getBoxItems().add(birthdayBoxItem);
    // dataToSendSelection.getBoxItems().add(birthplaceBoxItem);
    // dataToSendSelection.getBoxItems().add(identiycardtypeBoxItem);
    // dataToSendSelection.getBoxItems().add(certificationcountryBoxItem);
    // dataToSendSelection.getBoxItems().add(habitationBoxItem);
    // dataToSendSelection.getBoxItems().add(ageverificationBoxItem);
    pinInputStep.getInputInfoUnits().add(dataToSendSelection);
    // pinInputStep.getInputInfoUnits().add(sendAgreement_Text);
    pinInputStep.getInputInfoUnits().add(p1);
    return pinInputStep;
}
Also used : Checkbox(org.openecard.gui.definition.Checkbox) ToggleText(org.openecard.gui.definition.ToggleText) Text(org.openecard.gui.definition.Text) Step(org.openecard.gui.definition.Step) PasswordField(org.openecard.gui.definition.PasswordField) BoxItem(org.openecard.gui.definition.BoxItem)

Example 5 with Checkbox

use of org.openecard.gui.definition.Checkbox in project open-ecard by ecsec.

the class EacGuiImpl method copyBox.

private void copyBox(List<OutputInfoUnit> outInfos, Checkbox oldBox, List<BoxItem> items) {
    if (oldBox != null) {
        // create copy of the checkbox
        Checkbox newBox = new Checkbox(oldBox.getID());
        newBox.copyContentFrom(oldBox);
        // copy changed values
        for (org.openecard.gui.definition.BoxItem next : newBox.getBoxItems()) {
            String name = next.getName();
            BoxItem receivedItem = getItem(name, items);
            if (receivedItem != null) {
                next.setChecked(receivedItem.isSelected());
            }
        }
        outInfos.add(newBox);
    }
}
Also used : Checkbox(org.openecard.gui.definition.Checkbox) BoxItem(org.openecard.gui.android.eac.types.BoxItem)

Aggregations

Checkbox (org.openecard.gui.definition.Checkbox)7 ToggleText (org.openecard.gui.definition.ToggleText)5 BoxItem (org.openecard.gui.definition.BoxItem)3 Step (org.openecard.gui.definition.Step)3 Text (org.openecard.gui.definition.Text)3 CHAT (org.openecard.crypto.common.asn1.cvc.CHAT)2 BoxItem (org.openecard.gui.android.eac.types.BoxItem)2 ExecutionResults (org.openecard.gui.executor.ExecutionResults)2 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 StepResult (org.openecard.gui.StepResult)1 ServerData (org.openecard.gui.android.eac.types.ServerData)1 TermsOfUsage (org.openecard.gui.android.eac.types.TermsOfUsage)1 Document (org.openecard.gui.definition.Document)1 InputInfoUnit (org.openecard.gui.definition.InputInfoUnit)1 PasswordField (org.openecard.gui.definition.PasswordField)1 StepAction (org.openecard.gui.executor.StepAction)1 StepActionResult (org.openecard.gui.executor.StepActionResult)1 PINStep (org.openecard.sal.protocol.eac.gui.PINStep)1