Examples of PriorityComboBoxModel


Examples of org.japura.gui.model.PriorityComboBoxModel

  private static class PriorityKeySelectionManager implements
    KeySelectionManager, Serializable{

  @Override
  public int selectionForKey(char aKey, ComboBoxModel aModel) {
    PriorityComboBoxModel model = (PriorityComboBoxModel) aModel;
    int i, c;
    int currentSelection = -1;
    Object selectedItem = aModel.getSelectedItem();
    String v;
    String pattern;

    if (selectedItem != null) {
    for (i = 0, c = aModel.getSize(); i < c; i++) {
      if (selectedItem == aModel.getElementAt(i)
        && i > model.getPriorityItemsSize()) {
      currentSelection = i;
      break;
      }
    }
    }

    pattern = ("" + aKey).toLowerCase();
    aKey = pattern.charAt(0);

    for (i = ++currentSelection, c = aModel.getSize(); i < c; i++) {
    Object elem = aModel.getElementAt(i);
    if (elem != null && elem.toString() != null) {
      v = elem.toString().toLowerCase();
      if (v.length() > 0 && v.charAt(0) == aKey
        && i > model.getPriorityItemsSize())
      return i;
    }
    }

    for (i = 0; i < currentSelection; i++) {
    Object elem = aModel.getElementAt(i);
    if (elem != null && elem.toString() != null) {
      v = elem.toString().toLowerCase();
      if (v.length() > 0 && v.charAt(0) == aKey
        && i > model.getPriorityItemsSize())
      return i;
    }
    }
    return -1;
  }
View Full Code Here

Examples of org.japura.gui.model.PriorityComboBoxModel

  protected void applyChangesForPriorityComboBox(JList list, Object value,
                         int index, boolean isSelected,
                         boolean cellHasFocus) {
  if (list.getModel() instanceof PriorityComboBoxModel) {
    PriorityComboBoxModel model = (PriorityComboBoxModel) list.getModel();
    if (model.isPriorityAvailable() == false) {
    return;
    }

    if (model.getPriorityItemsSize() > 0
      && index == model.getPriorityItemsSize() - 1) {
    setBorder(separatorBorder);
    } else {
    setBorder(emptyBorder);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.