Java Code Examples for javax.swing.event.ListDataEvent#getIndex0()
The following examples show how to use
javax.swing.event.ListDataEvent#getIndex0() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryNameTextFieldDocumentListener.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void contentsChanged( final ListDataEvent e ) { if ( inUpdate ) { return; } if ( e.getIndex0() != -1 ) { return; } try { inUpdate = true; final DataSetQuery<T> selectedQuery = dialogModel.getQueries().getSelectedQuery(); if ( selectedQuery == null ) { setEditorQuery( null ); return; } setEditorQuery( selectedQuery ); } finally { inUpdate = false; } }
Example 2
Source File: BaseList.java From bigtable-sql with Apache License 2.0 | 6 votes |
private void onIntervalRemoved(ListDataEvent evt) { int nextIdx = evt.getIndex0(); int lastIdx = _list.getModel().getSize() - 1; if (nextIdx > lastIdx) { nextIdx = lastIdx; } _list.setSelectedIndex(nextIdx); for (ListDataListener listener : _listeners.toArray(new ListDataListener[0])) { listener.intervalRemoved(evt); } }
Example 3
Source File: JMultiSelectionList.java From jeveassets with GNU General Public License v2.0 | 5 votes |
@Override public void intervalRemoved(final ListDataEvent e) { int index0 = e.getIndex0(); int index1 = e.getIndex1(); if (index0 == index1) { selectedList.remove((Integer) index0); updateList(index0, -1); } else { selectedList.clear(); } ensureIndexIsVisible(index1); }
Example 4
Source File: JdbcDataSourceDialog.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void contentsChanged( final ListDataEvent e ) { if ( inUpdate ) { return; } if ( e.getIndex0() != -1 ) { return; } final NamedDataSourceDialogModel dialogModel = getDialogModel(); try { inUpdate = true; final DataSetQuery<String> selectedQuery = dialogModel.getQueries().getSelectedQuery(); if ( selectedQuery == null ) { setQueryName( null ); queryTextArea.setText( null ); queryTextArea.setEnabled( false ); queryLanguageField.setSelectedItem( null ); queryScriptTextArea.setText( null ); return; } setQueryName( selectedQuery.getQueryName() ); setEnabled( true ); queryTextArea.setText( selectedQuery.getQuery() ); queryScriptTextArea.setText( selectedQuery.getScript() ); setScriptingLanguage( selectedQuery.getScriptLanguage(), queryLanguageField ); } finally { inUpdate = false; } }
Example 5
Source File: Olap4JDataSourceEditor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void contentsChanged( final ListDataEvent e ) { if ( inUpdate ) { return; } if ( e.getIndex0() != -1 ) { return; } final NamedDataSourceDialogModel dialogModel = getDialogModel(); try { inUpdate = true; final DataSetQuery<String> selectedQuery = dialogModel.getQueries().getSelectedQuery(); if ( selectedQuery == null ) { setQueryName( null ); queryTextArea.setText( null ); queryScriptTextArea.setText( null ); queryLanguageField.setSelectedItem( null ); return; } setQueryName( selectedQuery.getQueryName() ); queryTextArea.setText( selectedQuery.getQuery() ); queryScriptTextArea.setText( selectedQuery.getScript() ); setScriptingLanguage( selectedQuery.getScriptLanguage(), queryLanguageField ); } finally { inUpdate = false; } }
Example 6
Source File: SkillInfoTab.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void listDataChanged(ListDataEvent e) { if (e.getIndex0() == -1 && e.getIndex1() == -1) { SkillFilter filter = (SkillFilter) skillFilterBox.getSelectedItem(); character.setSkillFilter(filter); skillSheetHandler.support.refresh(); } }
Example 7
Source File: SkillInfoTab.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void listDataChanged(ListDataEvent e) { if (e.getIndex0() == -1 && e.getIndex1() == -1) { SkillFilter filter = (SkillFilter) skillFilterBox.getSelectedItem(); character.setSkillFilter(filter); skillSheetHandler.support.refresh(); } }
Example 8
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void intervalAdded(ListDataEvent e) { for (int i = e.getIndex1(); i >= e.getIndex0(); i--) { Object obj = listModel.getElementAt(i); if (obj instanceof ClassPathSupport.Item) { DefaultMutableTreeNode node = toTreeNode(obj); treeModel.insertNodeInto(node, (MutableTreeNode)treeModel.getRoot(), e.getIndex0()); TreePath path = new TreePath(node.getPath()); tree.setSelectionPath(path); tree.makeVisible(path); } } }
Example 9
Source File: JMultiSelectionList.java From jeveassets with GNU General Public License v2.0 | 5 votes |
@Override public void intervalAdded(final ListDataEvent e) { int index0 = e.getIndex0(); int index1 = e.getIndex1(); if (index0 == index1) { updateList(index0, 1); } }
Example 10
Source File: ListHoverHelper.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void intervalRemoved(ListDataEvent e) { if (hoverIndex() >= e.getIndex0()) { setHoverIndex(-1); } updateLater(); }
Example 11
Source File: ListHoverHelper.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void intervalAdded(ListDataEvent e) { if (hoverIndex() >= e.getIndex0()) { setHoverIndex(-1); } updateLater(); }
Example 12
Source File: MondrianDataSourceEditor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void contentsChanged( final ListDataEvent e ) { if ( inUpdate ) { return; } if ( e.getIndex0() != -1 ) { return; } final NamedDataSourceDialogModel dialogModel = getDialogModel(); try { inUpdate = true; final DataSetQuery<String> selectedQuery = dialogModel.getQueries().getSelectedQuery(); if ( selectedQuery == null ) { setQueryName( null ); queryTextArea.setText( null ); queryScriptTextArea.setText( null ); queryLanguageField.setSelectedItem( null ); return; } setQueryName( selectedQuery.getQueryName() ); queryTextArea.setText( selectedQuery.getQuery() ); queryScriptTextArea.setText( selectedQuery.getScript() ); setScriptingLanguage( selectedQuery.getScriptLanguage(), queryLanguageField ); } finally { inUpdate = false; } }
Example 13
Source File: DefaultTabbedContainerUI.java From netbeans with Apache License 2.0 | 5 votes |
public void intervalAdded(ListDataEvent e) { if (container.getContentPolicy() == TabbedContainer.CONTENT_POLICY_ADD_ALL) { Component curC = null; for (int i = e.getIndex0(); i <= e.getIndex1(); i++) { curC = toComp(container.getModel().getTab(i)); contentDisplayer.add(curC, ""); } } }
Example 14
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void intervalAdded(ListDataEvent e) { for (int i = e.getIndex1(); i >= e.getIndex0(); i--) { Object obj = listModel.getElementAt(i); if (obj instanceof ClassPathSupport.Item) { DefaultMutableTreeNode node = toTreeNode(obj); treeModel.insertNodeInto(node, (MutableTreeNode)treeModel.getRoot(), e.getIndex0()); TreePath path = new TreePath(node.getPath()); tree.setSelectionPath(path); tree.makeVisible(path); } } }
Example 15
Source File: BuddyListModelTest.java From stendhal with GNU General Public License v2.0 | 4 votes |
@Override public void contentsChanged(ListDataEvent e) { contentsChangedFlag = true; index0 = e.getIndex0(); index1 = e.getIndex1(); }
Example 16
Source File: BuddyListModelTest.java From stendhal with GNU General Public License v2.0 | 4 votes |
@Override public void intervalAdded(ListDataEvent e) { intervalAddedFlag = true; index0 = e.getIndex0(); index1 = e.getIndex1(); }
Example 17
Source File: BuddyListModelTest.java From stendhal with GNU General Public License v2.0 | 4 votes |
@Override public void intervalRemoved(ListDataEvent e) { intervalRemovedFlag = true; index0 = e.getIndex0(); index1 = e.getIndex1(); }
Example 18
Source File: SearchAutoCompleteSupport.java From cuba with Apache License 2.0 | 4 votes |
public void contentsChanged(ListDataEvent e) { final int newItemCount = comboBox.getItemCount(); // if the size of the model didn't change, the popup size won't change if (previousItemCount != newItemCount) { final int maxPopupItemCount = comboBox.getMaximumRowCount(); // if the popup is showing, check if it must be resized if (popupMenu.isShowing()) { if (comboBox.isShowing()) { // if either the previous or new item count is less than the max, // hide and show the popup to recalculate its new height if (newItemCount < maxPopupItemCount || previousItemCount < maxPopupItemCount) { // don't bother unfiltering the popup since we'll redisplay the popup immediately doNotClearFilterOnPopupHide = true; try { comboBox.hidePopup(); } finally { doNotClearFilterOnPopupHide = false; } comboBox.showPopup(); } } else { // if the comboBox is not showing, simply hide the popup to avoid: // "java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location" // this case can occur when the comboBox is used as a TableCellEditor // and is uninstalled (removed from the component hierarchy) before // receiving this callback comboBox.hidePopup(); } } previousItemCount = newItemCount; } // if the comboBoxModel was changed and it wasn't due to the filter changing // (i.e. !isFiltering) and it wasn't because the user selected a new // selectedItem (i.e. !userSelectedNewItem) then those changes may have // invalidated the invariant that strict mode places on the text in the // JTextField, so we must either: // // a) locate the text within the model (proving that the strict mode invariant still holds) // b) set the text to that of the first element in the model (to reestablish the invariant) final boolean userSelectedNewItem = e.getIndex0() == -1 || e.getIndex1() == -1; if (isStrict() && !userSelectedNewItem && !isFiltering) { // notice that instead of doing the work directly, we post a Runnable here // to check the strict mode invariant and repair it if it is broken. That's // important. It's necessary because we must let the current ListEvent // finish its dispatching before we attempt to change the filter of the // filteredItems list by setting new text into the comboBoxEditorComponent SwingUtilities.invokeLater(checkStrictModeInvariantRunnable); } }
Example 19
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void intervalRemoved(ListDataEvent e) { for (int i = e.getIndex1(); i >= e.getIndex0(); i--) { treeModel.removeNodeFromParent((MutableTreeNode)treeModel.getChild(treeModel.getRoot(), i)); } }
Example 20
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void intervalRemoved(ListDataEvent e) { for (int i = e.getIndex1(); i >= e.getIndex0(); i--) { treeModel.removeNodeFromParent((MutableTreeNode)treeModel.getChild(treeModel.getRoot(), i)); } }