More NVT stuff
Build and Test j3270 / Build JAR & Run Tests (push) Successful in 1m24s

This commit is contained in:
2026-08-31 15:54:26 -04:00
parent 7b5bc7ec11
commit a56aa5f059
82 changed files with 7319 additions and 203 deletions
@@ -129,14 +129,27 @@ public class ConnectDialog extends JDialog {
"870 - Eastern Europe / Latin-2",
"871 - Iceland",
"875 - Greece (Greek)",
"1026 - Turkey (Turkish)",
"1026 - Turkey (Turkish Latin-5)",
"1155 - Turkey (Turkish Latin-5 Euro \u20AC)",
"905 - Turkey (Turkish Latin-3)",
"420 - Arabic Bilingual",
"424 - Hebrew (with Lowercase)",
"803 - Hebrew Old / Standard",
"838 - Thai",
"1160 - Thai (Euro \u20AC)",
"1025 - Cyrillic Multilingual",
"1123 - Cyrillic Ukraine",
"1154 - Cyrillic Multilingual (Euro \u20AC)",
"880 - Cyrillic Russian",
"1140 - US / Canada (Euro \u20AC)",
"1141 - Germany / Austria (Euro \u20AC)",
"1148 - International (Euro \u20AC)",
"930 - Japanese Katakana Mixed DBCS",
"939 - Japanese Latin Mixed DBCS",
"935 - Simplified Chinese Mixed DBCS",
"1388 - Simplified Chinese Extended Mixed DBCS",
"937 - Traditional Chinese Mixed DBCS",
"1371 - Traditional Chinese Extended Mixed DBCS",
"933 - Korean Mixed DBCS"
};
codePageCombo = new JComboBox<>(commonCodePages);
@@ -730,6 +730,16 @@ public class TerminalPanel extends JPanel implements java.awt.print.Printable {
}
}
} else if (e.getID() == KeyEvent.KEY_PRESSED) {
if (client.getNvtProcessor() != null && client.getNvtProcessor().isApplicationKeypad()) {
String kp = client.getNvtProcessor().mapKeypadKey(e.getKeyCode());
if (kp != null) {
try {
client.sendNVTString(kp);
} catch (Exception ignored) {}
e.consume();
return;
}
}
if (e.isControlDown() && !e.isAltDown() && !e.isMetaDown()) {
int code = e.getKeyCode();
if (code >= KeyEvent.VK_A && code <= KeyEvent.VK_Z) {
@@ -838,12 +848,20 @@ public class TerminalPanel extends JPanel implements java.awt.print.Printable {
if (client != null && client.getConnectionState().isFullSession()) {
if (client.getConnectionState().isNvt()) {
try {
switch (dir) {
case "up": client.sendNVTString("\u001B[A"); break;
case "down": client.sendNVTString("\u001B[B"); break;
case "left": client.sendNVTString("\u001B[D"); break;
case "right": client.sendNVTString("\u001B[C"); break;
case "home": client.sendNVTString("\u001B[H"); break;
int vk = KeyEvent.VK_UP;
if ("down".equals(dir)) vk = KeyEvent.VK_DOWN;
else if ("left".equals(dir)) vk = KeyEvent.VK_LEFT;
else if ("right".equals(dir)) vk = KeyEvent.VK_RIGHT;
else if ("home".equals(dir)) vk = KeyEvent.VK_HOME;
boolean handled = client.sendNVTKey(vk, '\0', false, false, false);
if (!handled) {
switch (dir) {
case "up": client.sendNVTString("\u001B[A"); break;
case "down": client.sendNVTString("\u001B[B"); break;
case "left": client.sendNVTString("\u001B[D"); break;
case "right": client.sendNVTString("\u001B[C"); break;
case "home": client.sendNVTString("\u001B[H"); break;
}
}
} catch (Exception ignored) {}
return;
@@ -863,7 +881,11 @@ public class TerminalPanel extends JPanel implements java.awt.print.Printable {
if (client != null && client.getConnectionState().isFullSession()) {
if (client.getConnectionState().isNvt()) {
try {
client.sendNVTString(getNvtFunctionKeySequence(n));
if (client.getNvtProcessor() != null) {
client.sendNVTString(client.getNvtProcessor().getFunctionKeySequence(n));
} else {
client.sendNVTString(getNvtFunctionKeySequence(n));
}
} catch (Exception ignored) {}
return;
}
@@ -1093,6 +1115,37 @@ public class TerminalPanel extends JPanel implements java.awt.print.Printable {
if (client != null) {
setupGraphicsPlaneRenderer();
updateCellSize();
client.setNvtClipboardHandler(new haus.nightmare.lib3270j.nvt.NvtProcessor.ClipboardHandler() {
@Override
public String getClipboardText() {
try {
return (String) Toolkit.getDefaultToolkit().getSystemClipboard()
.getData(DataFlavor.stringFlavor);
} catch (Exception e) {
return "";
}
}
@Override
public void setClipboardText(String text) {
if (text != null) {
try {
StringSelection ss = new StringSelection(text);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
} catch (Exception ignored) {}
}
}
});
client.addNvtTitleListener(title -> {
SwingUtilities.invokeLater(() -> {
Container top = getTopLevelAncestor();
if (top instanceof JFrame) {
((JFrame) top).setTitle(title != null && !title.isEmpty() ? ("j3270 - " + title) : "j3270");
}
});
});
}
}