r2075 - trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean
Author: tchemit Date: 2010-09-07 13:04:40 +0200 (Tue, 07 Sep 2010) New Revision: 2075 Url: http://nuiton.org/repositories/revision/jaxx/2075 Log: improve model notification Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java 2010-09-07 10:47:16 UTC (rev 2074) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java 2010-09-07 11:04:40 UTC (rev 2075) @@ -103,14 +103,14 @@ // build popup popupHandler.preparePopup(ui.getSelectedToolTipText(), - ui.getNotSelectedToolTipText(), - ui.getI18nPrefix(), - ui.getPopupTitleText(), - indexes, - ui.getPopupLabel(), - ui.getSortUp(), - ui.getSortDown(), - this.decorator); + ui.getNotSelectedToolTipText(), + ui.getI18nPrefix(), + ui.getPopupTitleText(), + indexes, + ui.getPopupLabel(), + ui.getSortUp(), + ui.getSortDown(), + this.decorator); ui.addPropertyChangeListener(this); @@ -188,31 +188,38 @@ log.warn(e.getMessage(), e); } - // reload the model - ui.getList().setListData(datas.toArray(new Object[datas.size()])); + ui.getList().setValueIsAdjusting(true); + try { + + // reload the model + ui.getList().setListData(datas.toArray(new Object[datas.size()])); - // re-apply selection - if (selection.length > 0) { + // re-apply selection + if (selection.length > 0) { - // re compute selection (the new data could not contains some - // previously selected items) - IntList newSelection = new ArrayIntList(); - for (Object o : selection) { - if (datas.contains(o)) { + // re compute selection (the new data could not contains some + // previously selected items) + IntList newSelection = new ArrayIntList(); + for (Object o : selection) { + if (datas.contains(o)) { - newSelection.add(datas.indexOf(o)); + newSelection.add(datas.indexOf(o)); + } } - } - if (!newSelection.isEmpty()) { + if (!newSelection.isEmpty()) { - // there is still a selection to re-apply - int[] ints = newSelection.toArray(new int[newSelection.size()]); - newSelection.clear(); - ui.getList().setSelectedIndices(ints); + // there is still a selection to re-apply + int[] ints = newSelection.toArray(new int[newSelection.size()]); + newSelection.clear(); + ui.getList().setSelectedIndices(ints); + } } + + } finally { + ui.getList().setValueIsAdjusting(false); } - + ui.getList().requestFocus(); }
participants (1)
-
tchemit@users.nuiton.org