Package javax.swing

Examples of javax.swing.DefaultListSelectionModel$Segment


  }

  public void testSingleInterval(TestHarness harness)
  {
    harness.checkPoint("SINGLE_INTERVAL_SELECTION");
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
   
    // check 1 - remove the middle of a selection interval
    m.addSelectionInterval(2, 6);
    harness.check(m.isSelectedIndex(1), false);
    harness.check(m.isSelectedIndex(2), true);
    harness.check(m.isSelectedIndex(3), true);
    harness.check(m.isSelectedIndex(4), true);
    harness.check(m.isSelectedIndex(5), true);
    harness.check(m.isSelectedIndex(6), true);
    harness.check(m.isSelectedIndex(7), false);
    m.addListSelectionListener(this);
    m.removeIndexInterval(3, 5);
    harness.check(m.isSelectedIndex(1), false);
    harness.check(m.isSelectedIndex(2), true);
    harness.check(m.isSelectedIndex(3), true);
    harness.check(m.isSelectedIndex(4), false);
    harness.check(m.isSelectedIndex(5), false);
    harness.check(m.isSelectedIndex(6), false);
    harness.check(m.isSelectedIndex(7), false);
    harness.check(m.getLeadSelectionIndex(), 3);
    harness.check(m.getAnchorSelectionIndex(), 2);
   
    harness.check(lastEvent.getSource(), m);
    harness.check(lastEvent.getFirstIndex(), 3);
    harness.check(lastEvent.getLastIndex(), 6);
  }
View Full Code Here


  }

  public void testMultipleInterval(TestHarness harness)
  {
    harness.checkPoint("MULTIPLE_INTERVAL_SELECTION");
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    m.addSelectionInterval(2, 6);
    harness.check(m.isSelectedIndex(1), false);
    harness.check(m.isSelectedIndex(2), true);
    harness.check(m.isSelectedIndex(3), true);
    harness.check(m.isSelectedIndex(4), true);
    harness.check(m.isSelectedIndex(5), true);
    harness.check(m.isSelectedIndex(6), true);
    harness.check(m.isSelectedIndex(7), false);
    m.addListSelectionListener(this);
    m.removeIndexInterval(3, 5);
    harness.check(m.isSelectedIndex(1), false);
    harness.check(m.isSelectedIndex(2), true);
    harness.check(m.isSelectedIndex(3), true);
    harness.check(m.isSelectedIndex(4), false);
    harness.check(m.isSelectedIndex(5), false);
    harness.check(m.isSelectedIndex(6), false);
    harness.check(m.isSelectedIndex(7), false);
   
    harness.check(lastEvent.getSource(), m);
    harness.check(lastEvent.getFirstIndex(), 3);
    harness.check(lastEvent.getLastIndex(), 6);
  }
View Full Code Here

public class getAnchorSelectionIndex implements Testlet
{
  public void test(TestHarness harness)
  {
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    harness.check(m.getAnchorSelectionIndex(), -1);
    m.setAnchorSelectionIndex(99);
    harness.check(m.getAnchorSelectionIndex(), 99);
    m.clearSelection();
    harness.check(m.getAnchorSelectionIndex(), 99);
    m.addSelectionInterval(15, 11);
    harness.check(m.getAnchorSelectionIndex(), 15);
  }
View Full Code Here

public class getMaxSelectionIndex implements Testlet
{
  public void test(TestHarness harness)
  {
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    harness.check(m.getMaxSelectionIndex(), -1);
    m.addSelectionInterval(99, 101);
    harness.check(m.getMaxSelectionIndex(), 101);
    m.clearSelection();
    harness.check(m.getMaxSelectionIndex(), -1);
  }
View Full Code Here

    // ignore
  }

  public void test(TestHarness harness)
  {
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    ListSelectionListener[] listeners
        = (ListSelectionListener[]) m.getListeners(ListSelectionListener.class);
    harness.check(listeners.length, 0);
   
    m.addListSelectionListener(this);
    listeners = (ListSelectionListener[])
        m.getListeners(ListSelectionListener.class);
    harness.check(listeners[0], this);
   
  /* Doesn't compile with 1.5
    boolean pass = false;
    try
View Full Code Here

    lastEvent = e;
  }

  public void test(TestHarness harness)
  {
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.addListSelectionListener(this);
    harness.check(m.getValueIsAdjusting(), false);
    m.setValueIsAdjusting(true);
    harness.check(lastEvent, null);
   
    m.addSelectionInterval(3, 5);
    harness.check(lastEvent.getValueIsAdjusting(), true);
   
    m.setValueIsAdjusting(false);
    m.addSelectionInterval(1, 2);
    harness.check(lastEvent.getValueIsAdjusting(), false);
  }
View Full Code Here

            listeners[i].columnMarginChanged(getChangeEvent());
        }
    }

    protected ListSelectionModel createSelectionModel() {
        return new DefaultListSelectionModel();
    }
View Full Code Here

     */
    private class FilteredSelectionAdapter extends DefaultTreeSelectionModel
            implements ListSelectionListener {

        public FilteredSelectionAdapter() {
            ListSelectionModel lsm = new DefaultListSelectionModel();
            lsm.addListSelectionListener(this);
            JFilterableTreeTable.this.setSelectionModel(lsm);
            getTree().setSelectionModel(this);
        }
View Full Code Here

         
          String selectionBelow = (String) attributeNames.get(selection-1);
          attributeNames.set(selection-1, (String)attributeNames.get(selection));
          attributeNames.set(selection, selectionBelow);
          this.fireTableDataChanged();
          DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
          selectionModel.setSelectionInterval(selection-1, selection-1);
          orderTable.setSelectionModel(selectionModel);
         
         
          if (listener != null)
            listener.handleNewAttributeOrder(attributeNames);
View Full Code Here

       
        public void addBlank(int selection) {
          attributeNames.add(selection+1, "");
          this.fireTableDataChanged();
         
           DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
          selectionModel.setSelectionInterval(selection, selection);
          orderTable.setSelectionModel(selectionModel);
         
          if (listener != null)
            listener.handleNewAttributeOrder(attributeNames);      
        }
View Full Code Here

TOP

Related Classes of javax.swing.DefaultListSelectionModel$Segment

Copyright © 2018 www.massapicom. 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.