use of org.openecard.gui.android.eac.types.TermsOfUsage 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);
}
Aggregations