Package nextapp.echo2.app.list

Examples of nextapp.echo2.app.list.ListSelectionModel


        colMain.add(label);
    }
   
    public void addBlankLine() {
        Row row = new Row();
        ColumnLayoutData layout = new ColumnLayoutData();
        layout.setHeight(new JbsExtent(15,JbsExtent.PX));
        row.setLayoutData(layout);
        colMain.add(row);
    }
View Full Code Here


                    break;
                default :
                    align = Alignment.LEFT;
            }
           
            TableLayoutData layoutData = (TableLayoutData)((Label)component).getLayoutData();
            layoutData.setAlignment(new Alignment(align, Alignment.CENTER));
            ((Label)component).setLayoutData(layoutData);
        }
        return component;
    }
View Full Code Here

                testTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_SELECTION);
            }
        });
        controlsColumn.addButton("Toggle Selection of Row #2", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ListSelectionModel selectionModel = testTable.getSelectionModel();
                selectionModel.setSelectedIndex(2, !selectionModel.isSelectedIndex(2));
            }
        });
        controlsColumn.addButton("Toggle Selection of Row #500 (there isn't one)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ListSelectionModel selectionModel = testTable.getSelectionModel();
                selectionModel.setSelectedIndex(500, !selectionModel.isSelectedIndex(500));
            }
        });
        controlsColumn.addButton("Set Selection Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testTable.setSelectionForeground(StyleUtil.randomColor());
View Full Code Here

     * @param selectedIndices the indices to select
     */
    private void setSelectedIndices(int[] selectedIndices) {
        // Temporarily suppress the Tables selection event notifier.
        suppressChangeNotifications = true;
        ListSelectionModel selectionModel = getSelectionModel();
        selectionModel.clearSelection();
        for (int i = 0; i < selectedIndices.length; ++i) {
            selectionModel.setSelectedIndex(selectedIndices[i], true);
        }
        // End temporary suppression.
        suppressChangeNotifications = false;
        firePropertyChange(SELECTION_CHANGED_PROPERTY, null, selectedIndices);
    }
View Full Code Here

     */
    public void setSelectionModel(ListSelectionModel newValue) {
        if (newValue == null) {
            throw new IllegalArgumentException("Selection model may not be null.");
        }
        ListSelectionModel oldValue = selectionModel;
        if (oldValue != null) {
            oldValue.removeChangeListener(changeHandler);
        }
        newValue.addChangeListener(changeHandler);
        selectionModel = newValue;
        firePropertyChange(SELECTION_MODEL_CHANGED_PROPERTY, oldValue, newValue);
    }
View Full Code Here

     * Selects only the given index.
     *
     * @param index the index
     */
    public void setSelectedIndex(int index) {
        ListSelectionModel selectionModel = getSelectionModel();
        selectionModel.clearSelection();
        selectionModel.setSelectedIndex(index, true);   
    }
View Full Code Here

     * Selects the specified indices, deselecting any other indices.
     *
     * @param indices the indices to be selected
     */
    public void setSelectedIndices(int[] indices) {
        ListSelectionModel selectionModel = getSelectionModel();
        selectionModel.clearSelection();
        for (int i = 0; i < indices.length; ++i) {
            selectionModel.setSelectedIndex(indices[i], true);
        }
    }
View Full Code Here

            itemElement.setAttribute("rollover-enabled", "true");
        }
       
        if (selectionEnabled) {
            itemElement.setAttribute("selection-enabled", "true");
            ListSelectionModel selectionModel = table.getSelectionModel();
            if (selectionModel.getSelectionMode() == ListSelectionModel.MULTIPLE_SELECTION) {
                itemElement.setAttribute("selection-mode", "multiple");
            }
            if (selectionModel.getMinSelectedIndex() != -1) {
                Element selectionElement = document.createElement("selection");
                int minimumIndex = selectionModel.getMinSelectedIndex();
                int maximumIndex = selectionModel.getMaxSelectedIndex();
                if (maximumIndex > table.getModel().getRowCount() - 1) {
                    maximumIndex = table.getModel().getRowCount() - 1;
                }
                for (int i = minimumIndex; i <= maximumIndex; ++i) {
                    if (selectionModel.isSelectedIndex(i)) {
                        Element rowElement = document.createElement("row");
                        rowElement.setAttribute("index", Integer.toString(i));
                        selectionElement.appendChild(rowElement);
                    }
                }
View Full Code Here

        if (toolTipText != null) {
            initElement.setAttribute("tool-tip", toolTipText);
        }
       
        // Render selection state.
        ListSelectionModel selectionModel = listComponent.getSelectionModel();
        int minIndex = selectionModel.getMinSelectedIndex();
        if (minIndex >= 0) {
            if (multipleSelect) {
                Element selectionElement = document.createElement("selection");
                int maxIndex = selectionModel.getMaxSelectedIndex();
                for (int i = minIndex; i <= maxIndex; ++i) {
                    if (selectionModel.isSelectedIndex(i)) {
                        Element itemElement = document.createElement("item");
                        itemElement.setAttribute("index", Integer.toString(i));
                        selectionElement.appendChild(itemElement);
                    }
                }
View Full Code Here

        //If nor group is found then create a new one:
        if (newColumn == null) {
            newColumn = new Column();
            newColumn.setId(groupName);
            newColumn.setStyleName("Default");
            AccordionPaneLayoutData layoutData = new AccordionPaneLayoutData();
            layoutData.setTitle(groupTitle);
            newColumn.setLayoutData(layoutData);
            this.add(newColumn);
        }
        return newColumn;
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.list.ListSelectionModel

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.