summaryrefslogtreecommitdiffstats
path: root/scilab/modules
diff options
context:
space:
mode:
authorVincent COUVERT <vincent.couvert@scilab.org>2010-05-18 17:26:29 +0200
committerYann Collette <yann.collette@scilab.org>2010-05-19 08:51:31 +0200
commit39bdba1e1e00ccfbe1015a0074a527ca1805eda9 (patch)
treed7c48fe34a1b87987d8c871088f7570f7ebff6f0 /scilab/modules
parent58840187403357420468bc38f9cf5d84c2fc3cd1 (diff)
downloadscilab-39bdba1e1e00ccfbe1015a0074a527ca1805eda9.zip
scilab-39bdba1e1e00ccfbe1015a0074a527ca1805eda9.tar.gz
Bug 6535 fixed
Change-Id: I10c8dcee929fdc3d0cbc2aaad960216271df10b3
Diffstat (limited to 'scilab/modules')
-rw-r--r--scilab/modules/gui/src/cpp/GetUicontrolListboxTop.cpp12
-rw-r--r--scilab/modules/gui/src/cpp/SetUicontrolListboxTop.cpp6
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java19
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java19
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java20
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ListBox.java12
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java16
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBoxBridge.java19
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/SimpleListBox.java13
-rw-r--r--scilab/modules/gui/src/jni/CallScilabBridge.cpp38
-rw-r--r--scilab/modules/gui/src/jni/CallScilabBridge.giws.xml7
-rw-r--r--scilab/modules/gui/src/jni/CallScilabBridge.hxx6
-rw-r--r--scilab/modules/gui/tests/nonreg_tests/bug_6535.tst35
13 files changed, 220 insertions, 2 deletions
diff --git a/scilab/modules/gui/src/cpp/GetUicontrolListboxTop.cpp b/scilab/modules/gui/src/cpp/GetUicontrolListboxTop.cpp
index a1bebba..aa3a70d 100644
--- a/scilab/modules/gui/src/cpp/GetUicontrolListboxTop.cpp
+++ b/scilab/modules/gui/src/cpp/GetUicontrolListboxTop.cpp
@@ -1,6 +1,8 @@
1/* 1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007 - INRIA - Vincent COUVERT 3 * Copyright (C) 2007 - INRIA - Vincent COUVERT
4 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 *
4 * Get the listbox top property of an uicontrol 6 * Get the listbox top property of an uicontrol
5 * 7 *
6 * This file must be used under the terms of the CeCILL. 8 * This file must be used under the terms of the CeCILL.
@@ -25,7 +27,15 @@ int GetUicontrolListboxTop(sciPointObj* sciObj)
25 } 27 }
26 else 28 else
27 { 29 {
28 return sciReturnRowVectorFromInt(pUICONTROL_FEATURE(sciObj)->listboxTop, 1); 30 switch(pUICONTROL_FEATURE(sciObj)->style)
31 {
32 case SCI_LISTBOX:
33 return sciReturnInt(CallScilabBridge::getListBoxListBoxTop(getScilabJavaVM(),
34 pUICONTROL_FEATURE(sciObj)->hashMapIndex));
35 default:
36 /* No Java attribute to set or method to call */
37 return sciReturnRowVectorFromInt(pUICONTROL_FEATURE(sciObj)->listboxTop, 1);
38 }
29 } 39 }
30 } 40 }
31 else 41 else
diff --git a/scilab/modules/gui/src/cpp/SetUicontrolListboxTop.cpp b/scilab/modules/gui/src/cpp/SetUicontrolListboxTop.cpp
index ec9e6f0..001a615 100644
--- a/scilab/modules/gui/src/cpp/SetUicontrolListboxTop.cpp
+++ b/scilab/modules/gui/src/cpp/SetUicontrolListboxTop.cpp
@@ -1,6 +1,8 @@
1/* 1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007 - INRIA - Vincent COUVERT 3 * Copyright (C) 2007 - INRIA - Vincent COUVERT
4 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 *
4 * Sets the listbox top property of an uicontrol object 6 * Sets the listbox top property of an uicontrol object
5 * 7 *
6 * This file must be used under the terms of the CeCILL. 8 * This file must be used under the terms of the CeCILL.
@@ -73,7 +75,9 @@ int SetUicontrolListboxTop(sciPointObj* sciObj, size_t stackPointer, int valueTy
73 switch(pUICONTROL_FEATURE(sciObj)->style) 75 switch(pUICONTROL_FEATURE(sciObj)->style)
74 { 76 {
75 case SCI_LISTBOX: 77 case SCI_LISTBOX:
76 // TODO Set the Java property if necessary 78 CallScilabBridge::setListBoxListBoxTop(getScilabJavaVM(),
79 pUICONTROL_FEATURE(sciObj)->hashMapIndex,
80 value);
77 return SET_PROPERTY_SUCCEED; 81 return SET_PROPERTY_SUCCEED;
78 default: 82 default:
79 /* No Java attribute to set or method to call */ 83 /* No Java attribute to set or method to call */
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
index 0ffea97..4166bd1 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
@@ -3,6 +3,7 @@
3 * Copyright (C) 2007-2008 - INRIA - Vincent COUVERT 3 * Copyright (C) 2007-2008 - INRIA - Vincent COUVERT
4 * Copyright (C) 2008 - DIGITEO - Sylvestre KOUMAR 4 * Copyright (C) 2008 - DIGITEO - Sylvestre KOUMAR
5 * Copyright (C) 2010 - DIGITEO - Manuel JULIACHS 5 * Copyright (C) 2010 - DIGITEO - Manuel JULIACHS
6 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
6 * 7 *
7 * This file must be used under the terms of the CeCILL. 8 * This file must be used under the terms of the CeCILL.
8 * This source file is licensed as described in the file COPYING, which 9 * This source file is licensed as described in the file COPYING, which
@@ -1782,6 +1783,24 @@ public class CallScilabBridge {
1782 public static void setListBoxText(int id, String[] text) { 1783 public static void setListBoxText(int id, String[] text) {
1783 ((ListBox) UIElementMapper.getCorrespondingUIElement(id)).setText(text); 1784 ((ListBox) UIElementMapper.getCorrespondingUIElement(id)).setText(text);
1784 } 1785 }
1786
1787 /**
1788 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
1789 * @param id the id of the ListBox
1790 * @param index the index of the element to be displayed at the top of the ListBox.
1791 */
1792 public static void setListBoxListBoxTop(int id, int index) {
1793 ((ListBox) UIElementMapper.getCorrespondingUIElement(id)).setListBoxTop(index);
1794 }
1795
1796 /**
1797 * Gets the index of the element displayed at the top of the ListBox
1798 * @param id the id of the ListBox
1799 * @return the index of the element displayed at the top of the ListBox
1800 */
1801 public static int getListBoxListBoxTop(int id) {
1802 return ((ListBox) UIElementMapper.getCorrespondingUIElement(id)).getListBoxTop();
1803 }
1785 1804
1786 /********************/ 1805 /********************/
1787 /* */ 1806 /* */
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
index bb310ef..878082a 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
@@ -2,6 +2,7 @@
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007 - INRIA - Vincent Couvert 3 * Copyright (C) 2007 - INRIA - Vincent Couvert
4 * Copyright (C) 2007 - INRIA - Bruno Jofret 4 * Copyright (C) 2007 - INRIA - Bruno Jofret
5 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 * 6 *
6 * This file must be used under the terms of the CeCILL. 7 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which 8 * This source file is licensed as described in the file COPYING, which
@@ -4445,6 +4446,24 @@ public class ScilabBridge {
4445 ScilabListBoxBridge.requestFocus(listBox); 4446 ScilabListBoxBridge.requestFocus(listBox);
4446 } 4447 }
4447 4448
4449 /**
4450 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
4451 * @param listBox the ListBox
4452 * @param index the index of the element to be displayed at the top of the ListBox.
4453 */
4454 public static void setListBoxTop(ListBox listBox, int index) {
4455 ScilabListBoxBridge.setListBoxTop(listBox, index);
4456 }
4457
4458 /**
4459 * Gets the index of the element displayed at the top of the ListBox
4460 * @param listBox the ListBox
4461 * @return the index of the element displayed at the top of the ListBox
4462 */
4463 public static int getListBoxTop(ListBox listBox) {
4464 return ScilabListBoxBridge.getListBoxTop(listBox);
4465 }
4466
4448 /********************/ 4467 /********************/
4449 /* PopupMenu Bridge */ 4468 /* PopupMenu Bridge */
4450 /********************/ 4469 /********************/
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
index ef0310b..430bd2a 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
@@ -2,6 +2,7 @@
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007 - INRIA - Vincent Couvert 3 * Copyright (C) 2007 - INRIA - Vincent Couvert
4 * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL 4 * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
5 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 * 6 *
6 * This file must be used under the terms of the CeCILL. 7 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which 8 * This source file is licensed as described in the file COPYING, which
@@ -425,5 +426,24 @@ public class SwingScilabListBox extends JScrollPane implements SimpleListBox {
425 /* Unimplemented for ListBoxes */ 426 /* Unimplemented for ListBoxes */
426 throw new UnsupportedOperationException(); 427 throw new UnsupportedOperationException();
427 } 428 }
429
430 /**
431 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
432 * @param index the index of the element to be displayed at the top of the ListBox.
433 */
434 public void setListBoxTop(int index) {
435 if (index > 0) {
436 getViewport().setViewPosition(getList().getUI().indexToLocation(getList(), index - 1));
437 doLayout();
438 }
439 }
440
441 /**
442 * Gets the index of the element displayed at the top of the ListBox
443 * @return the index of the element displayed at the top of the ListBox
444 */
445 public int getListBoxTop() {
446 return getList().getUI().locationToIndex(getList(), getViewport().getViewPosition()) + 1;
447 }
428 448
429} 449}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ListBox.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ListBox.java
index d10e991..41db3f1 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ListBox.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ListBox.java
@@ -2,6 +2,7 @@
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007 - INRIA - Vincent Couvert 3 * Copyright (C) 2007 - INRIA - Vincent Couvert
4 * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL 4 * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
5 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 * 6 *
6 * This file must be used under the terms of the CeCILL. 7 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which 8 * This source file is licensed as described in the file COPYING, which
@@ -70,4 +71,15 @@ public interface ListBox extends Widget {
70 */ 71 */
71 void setText(String[] text); 72 void setText(String[] text);
72 73
74 /**
75 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
76 * @param index the index of the element to be displayed at the top of the ListBox.
77 */
78 void setListBoxTop(int index);
79
80 /**
81 * Gets the index of the element displayed at the top of the ListBox
82 * @return the index of the element displayed at the top of the ListBox
83 */
84 int getListBoxTop();
73} 85}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java
index df1a724..f480963 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java
@@ -1,6 +1,7 @@
1/* 1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008 - INRIA - Vincent Couvert 3 * Copyright (C) 2008 - INRIA - Vincent Couvert
4 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
4 * 5 *
5 * This file must be used under the terms of the CeCILL. 6 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which 7 * This source file is licensed as described in the file COPYING, which
@@ -297,4 +298,19 @@ public class ScilabListBox extends ScilabWidget implements ListBox {
297 ScilabBridge.requestFocus(this); 298 ScilabBridge.requestFocus(this);
298 } 299 }
299 300
301 /**
302 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
303 * @param index the index of the element to be displayed at the top of the ListBox.
304 */
305 public void setListBoxTop(int index) {
306 ScilabBridge.setListBoxTop(this, index);
307 }
308
309 /**
310 * Gets the index of the element displayed at the top of the ListBox
311 * @return the index of the element displayed at the top of the ListBox
312 */
313 public int getListBoxTop() {
314 return ScilabBridge.getListBoxTop(this);
315 }
300} 316}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBoxBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBoxBridge.java
index 8f527c3..38122ae 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBoxBridge.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBoxBridge.java
@@ -2,6 +2,7 @@
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007 - INRIA - Vincent Couvert 3 * Copyright (C) 2007 - INRIA - Vincent Couvert
4 * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL 4 * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
5 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 * 6 *
6 * This file must be used under the terms of the CeCILL. 7 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which 8 * This source file is licensed as described in the file COPYING, which
@@ -319,5 +320,23 @@ public class ScilabListBoxBridge {
319 public static void requestFocus(ListBox listBox) { 320 public static void requestFocus(ListBox listBox) {
320 listBox.getAsSimpleListBox().requestFocus(); 321 listBox.getAsSimpleListBox().requestFocus();
321 } 322 }
323
324 /**
325 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
326 * @param listBox the ListBox
327 * @param index the index of the element to be displayed at the top of the ListBox.
328 */
329 public static void setListBoxTop(ListBox listBox, int index) {
330 listBox.getAsSimpleListBox().setListBoxTop(index);
331 }
332
333 /**
334 * Gets the index of the element displayed at the top of the ListBox
335 * @param listBox the ListBox
336 * @return the index of the element displayed at the top of the ListBox
337 */
338 public static int getListBoxTop(ListBox listBox) {
339 return listBox.getAsSimpleListBox().getListBoxTop();
340 }
322 341
323} 342}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/SimpleListBox.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/SimpleListBox.java
index a2b509e..189ea41 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/SimpleListBox.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/SimpleListBox.java
@@ -1,6 +1,7 @@
1/* 1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008 - INRIA - Vincent COUVERT 3 * Copyright (C) 2008 - INRIA - Vincent COUVERT
4 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
4 * 5 *
5 * This file must be used under the terms of the CeCILL. 6 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which 7 * This source file is licensed as described in the file COPYING, which
@@ -61,4 +62,16 @@ public interface SimpleListBox extends Widget {
61 * @param text the text of the items 62 * @param text the text of the items
62 */ 63 */
63 void setText(String[] text); 64 void setText(String[] text);
65
66 /**
67 * Adjusts the view so that the element given by index is displayed at the top of the ListBox.
68 * @param index the index of the element to be displayed at the top of the ListBox.
69 */
70 void setListBoxTop(int index);
71
72 /**
73 * Gets the index of the element displayed at the top of the ListBox
74 * @return the index of the element displayed at the top of the ListBox
75 */
76 int getListBoxTop();
64} 77}
diff --git a/scilab/modules/gui/src/jni/CallScilabBridge.cpp b/scilab/modules/gui/src/jni/CallScilabBridge.cpp
index 6e1d434..744ad8f 100644
--- a/scilab/modules/gui/src/jni/CallScilabBridge.cpp
+++ b/scilab/modules/gui/src/jni/CallScilabBridge.cpp
@@ -194,6 +194,8 @@ voidsetListBoxMultipleSelectionEnabledjintjbooleanID=NULL;
194jobjectArray_getListBoxAllItemsTextjintID=NULL; 194jobjectArray_getListBoxAllItemsTextjintID=NULL;
195jintgetListBoxNumberOfItemsjintID=NULL; 195jintgetListBoxNumberOfItemsjintID=NULL;
196voidsetListBoxTextjintjobjectArray_ID=NULL; 196voidsetListBoxTextjintjobjectArray_ID=NULL;
197voidsetListBoxListBoxTopjintjintID=NULL;
198jintgetListBoxListBoxTopjintID=NULL;
197jobjectArray_getPopupMenuAllItemsTextjintID=NULL; 199jobjectArray_getPopupMenuAllItemsTextjintID=NULL;
198jintgetPopupMenuNumberOfItemsjintID=NULL; 200jintgetPopupMenuNumberOfItemsjintID=NULL;
199voidsetPopupMenuTextjintjobjectArray_ID=NULL; 201voidsetPopupMenuTextjintjobjectArray_ID=NULL;
@@ -398,6 +400,8 @@ voidsetListBoxMultipleSelectionEnabledjintjbooleanID=NULL;
398jobjectArray_getListBoxAllItemsTextjintID=NULL; 400jobjectArray_getListBoxAllItemsTextjintID=NULL;
399jintgetListBoxNumberOfItemsjintID=NULL; 401jintgetListBoxNumberOfItemsjintID=NULL;
400voidsetListBoxTextjintjobjectArray_ID=NULL; 402voidsetListBoxTextjintjobjectArray_ID=NULL;
403voidsetListBoxListBoxTopjintjintID=NULL;
404jintgetListBoxListBoxTopjintID=NULL;
401jobjectArray_getPopupMenuAllItemsTextjintID=NULL; 405jobjectArray_getPopupMenuAllItemsTextjintID=NULL;
402jintgetPopupMenuNumberOfItemsjintID=NULL; 406jintgetPopupMenuNumberOfItemsjintID=NULL;
403voidsetPopupMenuTextjintjobjectArray_ID=NULL; 407voidsetPopupMenuTextjintjobjectArray_ID=NULL;
@@ -2313,6 +2317,40 @@ throw GiwsException::JniCallMethodException(curEnv);
2313} 2317}
2314} 2318}
2315 2319
2320void CallScilabBridge::setListBoxListBoxTop (JavaVM * jvm_, int objID, int index){
2321
2322JNIEnv * curEnv = NULL;
2323jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
2324jclass cls = curEnv->FindClass( className().c_str() );
2325
2326jmethodID voidsetListBoxListBoxTopjintjintID = curEnv->GetStaticMethodID(cls, "setListBoxListBoxTop", "(II)V" ) ;
2327if (voidsetListBoxListBoxTopjintjintID == NULL) {
2328throw GiwsException::JniMethodNotFoundException(curEnv, "setListBoxListBoxTop");
2329}
2330
2331 curEnv->CallStaticVoidMethod(cls, voidsetListBoxListBoxTopjintjintID ,objID, index);if (curEnv->ExceptionCheck()) {
2332throw GiwsException::JniCallMethodException(curEnv);
2333}
2334}
2335
2336int CallScilabBridge::getListBoxListBoxTop (JavaVM * jvm_, int objID){
2337
2338JNIEnv * curEnv = NULL;
2339jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
2340jclass cls = curEnv->FindClass( className().c_str() );
2341
2342jmethodID jintgetListBoxListBoxTopjintID = curEnv->GetStaticMethodID(cls, "getListBoxListBoxTop", "(I)I" ) ;
2343if (jintgetListBoxListBoxTopjintID == NULL) {
2344throw GiwsException::JniMethodNotFoundException(curEnv, "getListBoxListBoxTop");
2345}
2346
2347 jint res = static_cast<jint>( curEnv->CallStaticIntMethod(cls, jintgetListBoxListBoxTopjintID ,objID));if (curEnv->ExceptionCheck()) {
2348throw GiwsException::JniCallMethodException(curEnv);
2349}
2350return res;
2351
2352}
2353
2316char ** CallScilabBridge::getPopupMenuAllItemsText (JavaVM * jvm_, int objID){ 2354char ** CallScilabBridge::getPopupMenuAllItemsText (JavaVM * jvm_, int objID){
2317 2355
2318JNIEnv * curEnv = NULL; 2356JNIEnv * curEnv = NULL;
diff --git a/scilab/modules/gui/src/jni/CallScilabBridge.giws.xml b/scilab/modules/gui/src/jni/CallScilabBridge.giws.xml
index 5911a8b..bcd3790 100644
--- a/scilab/modules/gui/src/jni/CallScilabBridge.giws.xml
+++ b/scilab/modules/gui/src/jni/CallScilabBridge.giws.xml
@@ -335,6 +335,13 @@
335 <parameter type="int" name="objID"/> 335 <parameter type="int" name="objID"/>
336 <parameter type="String[]" name="text"/> 336 <parameter type="String[]" name="text"/>
337 </method> 337 </method>
338 <method name="setListBoxListBoxTop" returnType="void" modifier="static">
339 <parameter type="int" name="objID"/>
340 <parameter type="int" name="index"/>
341 </method>
342 <method name="getListBoxListBoxTop" returnType="int" modifier="static">
343 <parameter type="int" name="objID"/>
344 </method>
338<!-- PopupMenu setting --> 345<!-- PopupMenu setting -->
339 <method name="getPopupMenuAllItemsText" returnType="String[]" modifier="static"> 346 <method name="getPopupMenuAllItemsText" returnType="String[]" modifier="static">
340 <parameter type="int" name="objID"/> 347 <parameter type="int" name="objID"/>
diff --git a/scilab/modules/gui/src/jni/CallScilabBridge.hxx b/scilab/modules/gui/src/jni/CallScilabBridge.hxx
index f4eea0b..fa083db 100644
--- a/scilab/modules/gui/src/jni/CallScilabBridge.hxx
+++ b/scilab/modules/gui/src/jni/CallScilabBridge.hxx
@@ -158,6 +158,8 @@ jmethodID voidsetListBoxMultipleSelectionEnabledjintjbooleanID; // cache method
158jmethodID jobjectArray_getListBoxAllItemsTextjintID; // cache method id 158jmethodID jobjectArray_getListBoxAllItemsTextjintID; // cache method id
159jmethodID jintgetListBoxNumberOfItemsjintID; // cache method id 159jmethodID jintgetListBoxNumberOfItemsjintID; // cache method id
160jmethodID voidsetListBoxTextjintjobjectArray_ID; // cache method id 160jmethodID voidsetListBoxTextjintjobjectArray_ID; // cache method id
161jmethodID voidsetListBoxListBoxTopjintjintID; // cache method id
162jmethodID jintgetListBoxListBoxTopjintID; // cache method id
161jmethodID jobjectArray_getPopupMenuAllItemsTextjintID; // cache method id 163jmethodID jobjectArray_getPopupMenuAllItemsTextjintID; // cache method id
162jmethodID jintgetPopupMenuNumberOfItemsjintID; // cache method id 164jmethodID jintgetPopupMenuNumberOfItemsjintID; // cache method id
163jmethodID voidsetPopupMenuTextjintjobjectArray_ID; // cache method id 165jmethodID voidsetPopupMenuTextjintjobjectArray_ID; // cache method id
@@ -473,6 +475,10 @@ static int getListBoxNumberOfItems(JavaVM * jvm_, int objID);
473 475
474static void setListBoxText(JavaVM * jvm_, int objID, char ** text, int textSize); 476static void setListBoxText(JavaVM * jvm_, int objID, char ** text, int textSize);
475 477
478static void setListBoxListBoxTop(JavaVM * jvm_, int objID, int index);
479
480static int getListBoxListBoxTop(JavaVM * jvm_, int objID);
481
476static char ** getPopupMenuAllItemsText(JavaVM * jvm_, int objID); 482static char ** getPopupMenuAllItemsText(JavaVM * jvm_, int objID);
477 483
478static int getPopupMenuNumberOfItems(JavaVM * jvm_, int objID); 484static int getPopupMenuNumberOfItems(JavaVM * jvm_, int objID);
diff --git a/scilab/modules/gui/tests/nonreg_tests/bug_6535.tst b/scilab/modules/gui/tests/nonreg_tests/bug_6535.tst
new file mode 100644
index 0000000..453257f
--- /dev/null
+++ b/scilab/modules/gui/tests/nonreg_tests/bug_6535.tst
@@ -0,0 +1,35 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Vincent COUVERT
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- Non-regression test for bug 6535 -->
9// <-- INTERACTIVE TEST -->
10//
11// <-- Bugzilla URL -->
12// http://bugzilla.scilab.org/show_bug.cgi?id=6535
13//
14// <-- Short Description -->
15// The property ListboxTop of the graphic user interface object listbox have no effect.
16
17// Create the test figure
18x=string([1:20]');
19h=figure();
20g=uicontrol(h, ...
21 "Style", "listbox", ...
22 "String", x, ...
23 "Position", [10,10,100,100], ...
24 "Fontsize", 15, ...
25 "BackgroundColor", [1,0,0]);
26
27// Check that item with label '1' is the top item in the listbox
28
29set(g, "ListboxTop", 4);
30
31// Check that item with label '4' is the top item in the listbox
32
33get(g, "Listboxtop")
34
35// Check that the value returned is 4 \ No newline at end of file