Package javax.swing

Examples of javax.swing.DefaultListSelectionModel$Segment


    /**
     * Creates a new instance of DefaultTreeSelectionModel that is
     * empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION.
     */
    public DefaultTreeSelectionModel() {
        listSelectionModel = new DefaultListSelectionModel();
        selectionMode = DISCONTIGUOUS_TREE_SELECTION;
        leadIndex = leadRow = -1;
        uniquePaths = new Hashtable<TreePath, Boolean>();
        lastPaths = new Hashtable<TreePath, Boolean>();
        tempPaths = new TreePath[1];
View Full Code Here


     * contain the first path currently selected.
     */
    protected void insureRowContinuity() {
        if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
           selection != null && rowMapper != null) {
            DefaultListSelectionModel lModel = listSelectionModel;
            int                       min = lModel.getMinSelectionIndex();

            if(min != -1) {
                for(int counter = min,
                        maxCounter = lModel.getMaxSelectionIndex();
                        counter <= maxCounter; counter++) {
                    if(!lModel.isSelectedIndex(counter)) {
                        if(counter == min) {
                            clearSelection();
                        }
                        else {
                            TreePath[] newSel = new TreePath[counter - min];
View Full Code Here

           selection == null || selectionMode ==
           TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
            return true;
        else {
            BitSet                       bitSet = new BitSet();
            DefaultListSelectionModel    lModel = listSelectionModel;
            int                          anIndex;
            int                          counter;
            int                          min = lModel.getMinSelectionIndex();
            int                          max = lModel.getMaxSelectionIndex();
            TreePath[]                   tempPath = new TreePath[1];

            if(min != -1) {
                for(counter = min; counter <= max; counter++) {
                    if(lModel.isSelectedIndex(counter))
                        bitSet.set(counter);
                }
            }
            else {
                tempPath[0] = paths[0];
View Full Code Here

        assertEquals(100, model.getTotalColumnWidth());
    }

    public void testGetSetSelectionModel() throws Exception {
        assertTrue(model.getSelectionModel() instanceof DefaultListSelectionModel);
        DefaultListSelectionModel oldModel = (DefaultListSelectionModel) model.selectionModel;
        assertEquals(1, oldModel.getListSelectionListeners().length);
        assertEquals(model, oldModel.getListSelectionListeners()[0]);
        DefaultListSelectionModel newModel = new DefaultListSelectionModel();
        model.setSelectionModel(newModel);
        assertEquals(newModel, model.getSelectionModel());
        assertEquals(1, newModel.getListSelectionListeners().length);
        assertEquals(model, newModel.getListSelectionListeners()[0]);
        assertEquals(0, oldModel.getListSelectionListeners().length);
    }
View Full Code Here

                   new Insets(2, 2, 2, 0), 0, 0);
        layout.add(_arrowButton, 1, 0, 1, 1, 0.0, 0.0,
                   GridBagConstraints.BOTH, GridBagConstraints.EAST,
                   new Insets(2, 0, 2, 2), 0, 0);

        _selectionModel = new DefaultListSelectionModel();
        _selectionModel.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                _updateSelection();
            }
        });
View Full Code Here

          }
          {
            topPanel.add(new JScrollPane(nameList = new JList()));
            nameList.setModel(new DefaultListModel());
          }
          DefaultListSelectionModel disableSelections = new DefaultListSelectionModel() {
            public void setSelectionInterval (int index0, int index1) {
            }
          };
          messageList.setSelectionModel(disableSelections);
          nameList.setSelectionModel(disableSelections);
View Full Code Here

          }
          {
            topPanel.add(new JScrollPane(nameList = new JList()));
            nameList.setModel(new DefaultListModel());
          }
          DefaultListSelectionModel disableSelections = new DefaultListSelectionModel() {
            public void setSelectionInterval (int index0, int index1) {
            }
          };
          messageList.setSelectionModel(disableSelections);
          nameList.setSelectionModel(disableSelections);
View Full Code Here

    */
   private static ListSelectionModel getListSelectionModel()
   {
      if (listSelectionModel == null)
      {
         listSelectionModel = new DefaultListSelectionModel();
         listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      }
      return listSelectionModel;
   }
View Full Code Here

        // is enabled we need to cache the selection in terms of the
        // underlying model, this will allow us to correctly restore
        // the selection even if rows are filtered out.
        if (modelSelection == null &&
                sorter.getViewRowCount() != sorter.getModelRowCount()) {
            modelSelection = new DefaultListSelectionModel();
            ListSelectionModel viewSelection = getViewSelectionModel();
            int min = viewSelection.getMinSelectionIndex();
            int max = viewSelection.getMaxSelectionIndex();
            int modelIndex;
            for (int viewIndex = min; viewIndex <= max; viewIndex++) {
View Full Code Here

        rootOptionGroup = new FormRootOptionGroup(this);
        this.selectionModel = selectionModel;
    }

    public FormSelectListModel(final Form form, final AttributeSet attr) {
        this(form, attr, new DefaultListSelectionModel());
    }
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.