コード例 #1
0
 /**
  *
  * @param _itemsToDeselect
  */
 @Override
 public void deselectItems(IVItem[] _itemsToDeselect) {
     if (_itemsToDeselect == null) {
         return;
     }
     for (int i = 0; i < _itemsToDeselect.length; i++) {
         IVItem item = _itemsToDeselect[i];
         if (item != null) {
             item.deselectBorder();
         }
     }
     if (observeSelectionChanges.isBeingObserved()) {
         observeSelectionChanges.change(this);
     }
 }
コード例 #2
0
 /**
  *
  * @return
  */
 @Override
 public IVItem[] getSelectedItems() {
      IVItem[] _items = items;
     if (_items == null) {
         return new IVItem[0];
     }
     CArray selectedItems = new CArray(IVItem.class);
     for (int i = 0; i < _items.length; i++) {
         IVItem item = _items[i];
         if (item != null && item.isSelected()) {
             selectedItems.insertLast(item);
         }
     }
     return (IVItem[]) selectedItems.getAll();
 }
コード例 #3
0
 /**
  *
  * @param _itemToSelect
  */
 @Override
 public void selectOneItem(IVItem _itemToSelect) {
     if (_itemToSelect == null) {
         return;
     }
     deselectAllItems();
     IVItem _selectedItem = selectedItem;
     if (_selectedItem != null) {
         _selectedItem.deselectBorder();
     }
     selectedItem = _itemToSelect;
     _itemToSelect.selectBorder();
     if (observeSelectionChanges.isBeingObserved()) {
         observeSelectionChanges.change(this);
     }
 }
コード例 #4
0
 /**
  *
  * @param _value
  * @return
  */
 public IVItem getItem(Object _value) {
     if (_value == null) {
         return null;
     }
     if (items == null) {
         getItems();
     }
     IVItem[] _rawItems = rawItems;
     for (int i = 0; i < _rawItems.length; i++) {
         IVItem item = _rawItems[i];
         if (item.getValue() == _value) {
             return item;
         }
     }
     return null;
 }
コード例 #5
0
 @Override
 public void deselectAllItems() {
      IVItem[] _items = items;
     if (_items == null) {
         return;
     }
     selectedItem = null;
     for (int i = 0; i < _items.length; i++) {
         IVItem item = _items[i];
         if (item != null) {
             item.deselectBorder();
         }
     }
     if (observeSelectionChanges.isBeingObserved()) {
         observeSelectionChanges.change(this);
     }
 }
コード例 #6
0
 /**
  *
  * @param _item
  * @return
  */
 public static IListController getListController(IVItem _item) {
     IView parent = _item.getParentView();
     if (!(parent instanceof VList)) {
         return NullListController.cNull;
     }
     VList list = (VList) parent;
     IListController lc = list.getListController();
     return lc;
 }
コード例 #7
0
 /**
  *
  * @return
  */
 @Override
 public boolean hasMultiSelect() {
      IVItem[] _items = items;
     if (_items == null) {
         return false;
     }
     int selectedCount = 0;
     for (int i = 0; i < _items.length; i++) {
         IVItem item = _items[i];
         if (item != null && item.isSelected()) {
             selectedCount++;
             if (selectedCount > 1) {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #8
0
 /**
  *
  * @param _itemsToToggle
  */
 @Override
 public void toggleItems(IVItem[] _itemsToToggle) {
     if (_itemsToToggle == null) {
         return;
     }
     for (int i = 0; i < _itemsToToggle.length; i++) {
         IVItem item = _itemsToToggle[i];
         if (item != null) {
             if (item.isSelected()) {
                 item.deselectBorder();
             } else {
                 item.selectBorder();
             }
         }
     }
     if (observeSelectionChanges.isBeingObserved()) {
         observeSelectionChanges.change(this);
     }
 }
コード例 #9
0
 /**
  *
  * @param _itemToDeselect
  */
 @Override
 public void deselectItem(IVItem _itemToDeselect) {
     if (_itemToDeselect == null) {
         return;
     }
     _itemToDeselect.deselectBorder();
     if (observeSelectionChanges.isBeingObserved()) {
         observeSelectionChanges.change(this);
     }
 }
コード例 #10
0
    /**
     *
     * @param _itemToToggle
     */
    @Override
    public void toggleItem(IVItem _itemToToggle) {
        if (_itemToToggle == null) {
            return;
        }
        if (_itemToToggle.isSelected()) {
            deselectItem(_itemToToggle);
        } else {
            selectItem(_itemToToggle);
        }

    }
コード例 #11
0
 /**
  *
  * @param _instance
  * @param _pattern
  * @return
  */
 public IVItem filter(IVItem _instance, Pattern _pattern) {
     if (_instance == null || filter == null) {
         return null;
     }
     if (_pattern == null) {
         return _instance;
     }
     String b = _instance.toString();
     boolean found = _pattern.matcher(b).find();
     if (found) {
         return _instance;
     } else {
         return null;
     }
 }