GOCA fixing
Build and Test j3270 / Build JAR & Run Tests (push) Successful in 1m22s

This commit is contained in:
2026-09-04 14:34:01 -04:00
parent 6296cf4341
commit cbb310b889
12 changed files with 943 additions and 238 deletions
@@ -37,7 +37,7 @@ public class StatusBar extends JPanel {
connectionStatus = createLabel("Not Connected", oiaFont, ThemeManager.getOiaFgDim());
tlsStatus = createLabel("", oiaFont, ThemeManager.getOiaFgNormal());
luName = createLabel("", oiaFont, ThemeManager.getOiaFgNormal());
lockStatus = createLabel("", oiaFont, ThemeManager.getOiaFgAlert());
lockStatus = createLabel("", oiaFont, ThemeManager.getOiaInputInhibited());
fieldTypeStatus = createLabel("", oiaFont, ThemeManager.getOiaFgDim());
codePageInfo = createLabel("", oiaFont, ThemeManager.getOiaFgDim());
modelInfo = createLabel("", oiaFont, ThemeManager.getOiaFgDim());
@@ -89,10 +89,12 @@ public class StatusBar extends JPanel {
tlsStatus.setText("");
luName.setText("");
lockStatus.setText("");
lockStatus.setForeground(ThemeManager.getOiaInputInhibited(theme));
fieldTypeStatus.setText("");
codePageInfo.setText("");
modelInfo.setText("");
cursorPosition.setText("001/001");
cursorPosition.setForeground(ThemeManager.getOiaFgNormal(theme));
return;
}
@@ -110,25 +112,25 @@ public class StatusBar extends JPanel {
break;
case CONNECTED_3270:
connectionStatus.setText("TN3270");
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail());
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
break;
case CONNECTED_TN3270E:
connectionStatus.setText("TN3270E");
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail());
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
break;
case CONNECTED_SSCP:
connectionStatus.setText("SSCP-LU");
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail());
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
break;
case CONNECTED_NVT:
case CONNECTED_NVT_CHAR:
case CONNECTED_E_NVT:
connectionStatus.setText("NVT");
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail());
connectionStatus.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
break;
case CONNECTED_UNBOUND:
connectionStatus.setText("Unbound");
connectionStatus.setForeground(ThemeManager.getOiaAttention());
connectionStatus.setForeground(ThemeManager.getOiaAttention(theme));
break;
default:
connectionStatus.setText(state.name());
@@ -144,11 +146,11 @@ public class StatusBar extends JPanel {
String protocol = session != null ? session.getProtocol() : "TLS";
if (verified) {
tlsStatus.setText("🔒 TLS");
tlsStatus.setForeground(ThemeManager.getOiaStatusSysAvail());
tlsStatus.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
tlsStatus.setToolTipText(protocol + " / " + cipher + " (Verified)");
} else {
tlsStatus.setText("🔓 TLS (Unverified)");
tlsStatus.setForeground(ThemeManager.getOiaAttention());
tlsStatus.setForeground(ThemeManager.getOiaAttention(theme));
tlsStatus.setToolTipText(protocol + " / " + cipher + " (Verification Bypassed)");
}
} else {
@@ -164,46 +166,46 @@ public class StatusBar extends JPanel {
lu = "LU:" + client.getConfig().getLuName();
}
luName.setText(lu);
luName.setForeground(ThemeManager.getOiaStatusSysAvail());
luName.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
// Lock / Inhibit status
int inhibit = client.getOIA().getInputInhibited();
if (inhibit != ECLConstants.INHIBIT_NOT_INHIBITED) {
Color lockFg = ThemeManager.getOiaInputInhibited(); // White (oII)
Color lockFg = ThemeManager.getOiaInputInhibited(theme);
switch (inhibit) {
case ECLConstants.INHIBIT_SYSTEM_LOCK:
lockStatus.setText("X SYSTEM");
lockFg = ThemeManager.getOiaInputInhibited(); // White (oII)
lockFg = ThemeManager.getOiaInputInhibited(theme);
break;
case ECLConstants.INHIBIT_COMM_CHECK:
lockStatus.setText("X COMM");
lockFg = ThemeManager.getOiaCommCheck(); // Red (oEI)
lockFg = ThemeManager.getOiaCommCheck(theme);
break;
case ECLConstants.INHIBIT_NUMERIC_ONLY:
lockStatus.setText("X NUM");
lockFg = ThemeManager.getOiaAttention(); // Yellow (oAI)
lockFg = ThemeManager.getOiaAttention(theme);
break;
case ECLConstants.INHIBIT_PROTECTED_FIELD:
lockStatus.setText("X PROT");
lockFg = ThemeManager.getOiaInputInhibited(); // White (oII)
lockFg = ThemeManager.getOiaInputInhibited(theme);
break;
case ECLConstants.INHIBIT_OVERFLOW:
lockStatus.setText("X >");
lockFg = ThemeManager.getOiaAttention(); // Yellow (oAI)
lockFg = ThemeManager.getOiaAttention(theme);
break;
case ECLConstants.INHIBIT_OPERATOR_DUE:
lockStatus.setText("X OP");
lockFg = ThemeManager.getOiaAttention(); // Yellow (oAI)
lockFg = ThemeManager.getOiaAttention(theme);
break;
default:
lockStatus.setText("X LOCKED");
lockFg = ThemeManager.getOiaInputInhibited(); // White (oII)
lockFg = ThemeManager.getOiaInputInhibited(theme);
break;
}
lockStatus.setForeground(lockFg);
} else if (client.getInputProcessor().isInsertMode()) {
lockStatus.setText("INSERT");
lockStatus.setForeground(ThemeManager.getOiaStatusSysAvail());
lockStatus.setForeground(ThemeManager.getOiaStatusSysAvail(theme));
} else {
lockStatus.setText("");
}
@@ -251,11 +251,30 @@ public final class ThemeManager {
public static final Color HOD_OIA_COMM_CHECK_ERROR = new Color(255, 0, 0); // oEI: Red
public static final Color HOD_OIA_BG_BLACK = new Color(0, 0, 0); // oOB: Black
public static Color getOiaStatusSysAvail() { return HOD_OIA_STATUS_SYS_AVAIL; }
public static Color getOiaInputInhibited() { return HOD_OIA_INPUT_INHIBITED; }
public static Color getOiaAttention() { return HOD_OIA_ATTENTION_WARN; }
public static Color getOiaCommCheck() { return HOD_OIA_COMM_CHECK_ERROR; }
public static Color getOiaBackground() { return HOD_OIA_BG_BLACK; }
public static Color getOiaStatusSysAvail() { return getOiaStatusSysAvail(currentTheme); }
public static Color getOiaStatusSysAvail(UITheme t) {
return t == UITheme.DARK ? HOD_OIA_STATUS_SYS_AVAIL : new Color(0, 90, 200);
}
public static Color getOiaInputInhibited() { return getOiaInputInhibited(currentTheme); }
public static Color getOiaInputInhibited(UITheme t) {
return t == UITheme.DARK ? HOD_OIA_INPUT_INHIBITED : new Color(20, 20, 20);
}
public static Color getOiaAttention() { return getOiaAttention(currentTheme); }
public static Color getOiaAttention(UITheme t) {
return t == UITheme.DARK ? HOD_OIA_ATTENTION_WARN : new Color(180, 100, 0);
}
public static Color getOiaCommCheck() { return getOiaCommCheck(currentTheme); }
public static Color getOiaCommCheck(UITheme t) {
return t == UITheme.DARK ? HOD_OIA_COMM_CHECK_ERROR : new Color(190, 20, 20);
}
public static Color getOiaBackground() { return getOiaBackground(currentTheme); }
public static Color getOiaBackground(UITheme t) {
return t == UITheme.DARK ? HOD_OIA_BG_BLACK : getStatusBarBg(t);
}
// =========================================================================
// Button Variants & Color helpers
@@ -647,6 +666,16 @@ public final class ThemeManager {
return;
}
if (comp instanceof StatusBar) {
((StatusBar) comp).applyTheme(theme);
return;
}
if (comp instanceof TerminalPanel) {
comp.repaint();
return;
}
if (comp instanceof JMenuBar) {
styleMenuBar((JMenuBar) comp);
for (int i = 0; i < ((JMenuBar) comp).getMenuCount(); i++) {
@@ -37,6 +37,7 @@ public class Phase1UiOverlayTest {
@Test
@DisplayName("Item 1.5: ThemeManager HoD OIA category colors match specification")
public void testThemeManagerOiaColors() {
ThemeManager.setTheme(UITheme.DARK);
// oSI: Status / System Available -> CUSTOMBLUE (120, 144, 240)
assertEquals(new Color(120, 144, 240), ThemeManager.getOiaStatusSysAvail());
@@ -51,6 +52,15 @@ public class Phase1UiOverlayTest {
// oOB: OIA Separator / Background -> Black (0, 0, 0)
assertEquals(new Color(0, 0, 0), ThemeManager.getOiaBackground());
// Light mode OIA colors should be legible and not white on grey
ThemeManager.setTheme(UITheme.LIGHT);
assertNotEquals(Color.WHITE, ThemeManager.getOiaInputInhibited());
assertEquals(new Color(20, 20, 20), ThemeManager.getOiaInputInhibited());
assertEquals(new Color(0, 90, 200), ThemeManager.getOiaStatusSysAvail());
assertEquals(new Color(180, 100, 0), ThemeManager.getOiaAttention());
assertEquals(new Color(190, 20, 20), ThemeManager.getOiaCommCheck());
assertEquals(ThemeManager.getStatusBarBg(UITheme.LIGHT), ThemeManager.getOiaBackground());
}
@Test
@@ -62,8 +62,33 @@ public class ThemeManagerTest {
// Verify Status Bar colors
Color sbBg = ThemeManager.getStatusBarBg(theme);
Color sbNormal = ThemeManager.getOiaFgNormal(theme);
Color sbInhibited = ThemeManager.getOiaInputInhibited(theme);
Color sbSysAvail = ThemeManager.getOiaStatusSysAvail(theme);
Color sbAttention = ThemeManager.getOiaAttention(theme);
Color sbCommCheck = ThemeManager.getOiaCommCheck(theme);
assertNotNull(sbBg);
assertNotNull(sbNormal);
assertNotNull(sbInhibited);
assertNotNull(sbSysAvail);
assertNotNull(sbAttention);
assertNotNull(sbCommCheck);
// Verify status bar contrast: ensure NO white on grey in light mode
double sbBgLum = (0.299 * sbBg.getRed() + 0.587 * sbBg.getGreen() + 0.114 * sbBg.getBlue());
double sbInhibitedLum = (0.299 * sbInhibited.getRed() + 0.587 * sbInhibited.getGreen() + 0.114 * sbInhibited.getBlue());
double sbInhibitedDiff = Math.abs(sbBgLum - sbInhibitedLum);
assertTrue(sbInhibitedDiff > 120, "Status bar input inhibited (X PROT) contrast in " + theme + " must be > 120 (was " + sbInhibitedDiff + ")");
double sbSysAvailLum = (0.299 * sbSysAvail.getRed() + 0.587 * sbSysAvail.getGreen() + 0.114 * sbSysAvail.getBlue());
assertTrue(Math.abs(sbBgLum - sbSysAvailLum) > 100, "Status bar sys avail contrast in " + theme + " must be > 100");
double sbAttentionLum = (0.299 * sbAttention.getRed() + 0.587 * sbAttention.getGreen() + 0.114 * sbAttention.getBlue());
assertTrue(Math.abs(sbBgLum - sbAttentionLum) > 100, "Status bar attention contrast in " + theme + " must be > 100");
if (theme == UITheme.LIGHT) {
assertNotEquals(Color.WHITE, sbInhibited, "Status bar input inhibited text must not be pure white in light mode");
assertNotEquals(Color.WHITE, sbNormal, "Status bar normal text must not be pure white in light mode");
}
// Verify Button colors
Color btnDefBg = ThemeManager.getButtonBg(ThemeManager.ButtonVariant.DEFAULT, theme);
@@ -218,4 +243,23 @@ public class ThemeManagerTest {
tmpIni.delete();
}
}
@Test
public void testStatusBarLightModeLegibility() {
try {
ThemeManager.setTheme(UITheme.LIGHT);
StatusBar sb = new StatusBar();
sb.applyTheme(UITheme.LIGHT);
assertEquals(ThemeManager.getStatusBarBg(UITheme.LIGHT), sb.getBackground());
assertNotEquals(Color.WHITE, ThemeManager.getOiaInputInhibited());
assertNotEquals(Color.WHITE, ThemeManager.getOiaInputInhibited(UITheme.LIGHT));
// Verify recursive applyTheme does not break StatusBar background
ThemeManager.applyTheme(sb, UITheme.LIGHT);
assertEquals(ThemeManager.getStatusBarBg(UITheme.LIGHT), sb.getBackground());
} catch (HeadlessException e) {
// Handled in headless CI
}
}
}