diff --git a/src/java/field.cc b/src/java/field.cc index c6aed65..f486509 100644 --- a/src/java/field.cc +++ b/src/java/field.cc @@ -91,3 +91,42 @@ JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1next_1unprotected(JNIEnv *env, } + +JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1is_1protected(JNIEnv *env, jobject obj, jint baddr) { + + jint rc = -1; + + try { + + rc = java::getHandle(env,obj)->get_is_protected((int) baddr); + + + } catch(std::exception &e) { + + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); + + } + + return rc; + + +} + +JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1is_1protected_1at(JNIEnv *env, jobject obj, jint row, jint col) { + + jint rc = -1; + + try { + + rc = java::getHandle(env,obj)->get_is_protected_at((int) row, (int) col); + + } catch(std::exception &e) { + + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); + + } + + return rc; + + +} diff --git a/src/java/plugin.cc b/src/java/plugin.cc index d952178..f25b3a9 100644 --- a/src/java/plugin.cc +++ b/src/java/plugin.cc @@ -235,11 +235,11 @@ } int get_is_protected(int baddr = -1) { - return lib3270_is_protected(hSession,baddr); + return lib3270_get_is_protected(hSession,baddr); } int get_is_protected_at(int row, int col) { - return lib3270_is_protected_at(hSession,row,col); + return lib3270_get_is_protected_at(hSession,row,col); } int set_copy(const char *text) { diff --git a/src/java/sample/prot.java b/src/java/sample/prot.java new file mode 100755 index 0000000..fae4073 --- /dev/null +++ b/src/java/sample/prot.java @@ -0,0 +1,26 @@ + +import pw3270.*; + +public class prot +{ + public static void main (String[] args) + { + System.out.println("Begin"); + + try { + + terminal host = new terminal(); + + host.popup_dialog(0,"19,39","Testing","Position 19,39 is " + (host.get_is_protected_at(19,39) == 0 ? "un" : "") + "protected"); + host.popup_dialog(0,"20,39","Testing","Position 19,39 is " + (host.get_is_protected_at(20,39) == 0 ? "un" : "") + "protected"); + + + } catch( Exception e ) { + + System.out.println("Error: " + e); + + } + + System.out.println("End"); + } +}; diff --git a/src/java/terminal.java b/src/java/terminal.java index 96652a9..ce737f4 100644 --- a/src/java/terminal.java +++ b/src/java/terminal.java @@ -316,6 +316,17 @@ public class terminal public native int get_is_protected(int baddr); /** + * Check if the address is protected. + * + * @param row Screen row. + * @param col Screen col. + * + * @return Protect state. + * + */ + public native int get_is_protected_at(int row, int col); + + /** * Get next field address. * * @return Address of the next field. diff --git a/ui/80javasamples.xml b/ui/80javasamples.xml index 5e96298..04e54b3 100644 --- a/ui/80javasamples.xml +++ b/ui/80javasamples.xml @@ -38,7 +38,7 @@ + - -- libgit2 0.21.2