Skip to content

Commit

Permalink
Added ErrorMsg and Loop to Example
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Downarowicz committed Feb 27, 2022
1 parent 8413a88 commit cfc2252
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/main/java/at/downardo/j3270Server/example/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ public void run() {
new Field(2, 13, "", true, false, true, "password"),
new Field(3,0, "Test", false, true, false, ""),
new Field(4,0, "Test", false, false, false, ""),
new Field(22,0, "", false, true, false, "errormsg"),
new Field(23,0, "PF3 Exit", false, true, false, "")

};

Field[] fields2 = {
new Field(0,0,"HALLO WELT TEST WORLD 2", false, true, false, ""),
new Field(1,0, "Name ....", false, true, false, ""),
new Field(22,0, "", false, true, false, "errormsg"),
new Field(1,13, "", false, false, false, "")
};

Expand All @@ -62,10 +64,11 @@ public void run() {
System.out.println(EBCDIC.CODEPAGE);

HashMap<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put("name", "Vorname Nachname");
fieldValues.put("name", "");
fieldValues.put("errormsg", "");
while(true) {
Response r = Screen.ShowScreen(screen, fieldValues, 1, 14, out, in);
System.out.println(r.AID);
System.out.println(fieldValues.get("errormsg"));

if(r.AID == AID.AIDPF3) {
break;
Expand All @@ -76,8 +79,20 @@ public void run() {
System.out.println(fieldValues.get("password"));
System.out.println(EBCDIC.CODEPAGE);



if(r.AID == AID.AIDEnter) {
r = Screen.ShowScreen(screen2, fieldValues, 0, 0, out, in);
if(!fieldValues.get("name").trim().equals("")) {
while(true) {
r = Screen.ShowScreen(screen2, fieldValues, 0, 0, out, in);
if(r.AID == AID.AIDPF1) {
break;
}
}
}else {
fieldValues.put("errormsg", "Name field is required");
continue;
}
}

continue;
Expand Down

0 comments on commit cfc2252

Please sign in to comment.