javax.swing.event.ListDataEvent Java Examples

The following examples show how to use javax.swing.event.ListDataEvent. 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: ChannelFilterSinkJPanel.java    From clearvolume with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void intervalAdded(final ListDataEvent pE)
{
	SwingUtilities.invokeLater(new Runnable()
	{

		@Override
		public void run()
		{
			final TIntArrayList lSelectedIndices = new TIntArrayList(mActiveChannelJList.getSelectedIndices());
			for (int i = pE.getIndex0(); i < pE.getIndex1(); i++)
				lSelectedIndices.add(i);
			mActiveChannelJList.setSelectedIndices(lSelectedIndices.toArray());

		}
	});
}
 
Example #2
Source File: MultiColumnListUI.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
public void intervalAdded(ListDataEvent e) {
     updateLayoutStateNeeded = modelChanged;

     int minIndex = Math.min(e.getIndex0(), e.getIndex1());
     int maxIndex = Math.max(e.getIndex0(), e.getIndex1());

     /* Sync the SelectionModel with the DataModel.
      */

     ListSelectionModel sm = list.getSelectionModel();
     if (sm != null) {
sm.insertIndexInterval(minIndex, maxIndex - minIndex, true);
     }

     /* Repaint the entire list, from the origin of
      * the first added cell, to the bottom of the
      * component.
      */

     Rectangle r = getCellBounds(list, minIndex, list.getModel().getSize());
     list.revalidate();
     list.repaint(r);
   }
 
Example #3
Source File: LogDevicesComboBoxSupport.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
/**
 * Add a new device serial to this data model, if it doesn't already exist.
 */
private void add(String device) {
    int insertIndex = devices.size();

    // check, if this serial already exists.
    for (int i = devices.size(); --i >= 0;) {
        if (devices.get(i).equals(device)) {

            // refresh this item (the label may changed)
            fireListDataEvent(ListDataEvent.INTERVAL_REMOVED, i);
            fireListDataEvent(ListDataEvent.INTERVAL_ADDED, i);

            return;
        }
    }

    if (insertIndex != -1) {
        devices.add(insertIndex, device);

        // send notification
        fireListDataEvent(ListDataEvent.INTERVAL_ADDED, insertIndex);
    }
}
 
Example #4
Source File: ParameterDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void contentsChanged( final ListDataEvent e ) {
  final ParameterType type = (ParameterType) parameterTypeModel.getSelectedItem();
  final boolean visible = ( type != null ) && type.isHasVisibleItems();

  visibleItemsTextField.setVisible( visible );
  visibleItemsLabel.setVisible( visible );

  final boolean displayFormulaVisible = ( type != null ) && !type.isQueryOptional();
  displayFormulaField.setVisible( displayFormulaVisible );
  displayFormulaLabel.setVisible( displayFormulaVisible );
  displayValueLabel.setVisible( displayFormulaVisible );
  displayValueComboBox.setVisible( displayFormulaVisible );

  final String selectedQuery = (String) queryComboBoxModel.getSelectedItem();
  final boolean querySelected = !StringUtils.isEmpty( selectedQuery, false );
  strictValuesCheckBox.setVisible( querySelected );
  reevaluateOnInvalidStrictParamCheckBox.setVisible( querySelected );
  autofillSelectionCheckBox.setVisible( querySelected );
}
 
Example #5
Source File: LegacyChartEditModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void contentsChanged( final ListDataEvent e ) {
  final ExpressionMetaData o = (ExpressionMetaData) getPrimaryDataSourcesModel().getSelectedItem();
  if ( o == null ) {
    setPrimaryDataSource( null );
    return;
  }
  final Expression primaryDataSourceExpression = getPrimaryDataSource();
  if ( primaryDataSourceExpression != null && primaryDataSourceExpression.getClass()
    .equals( o.getExpressionType() ) ) {
    // no need to change anything ..
    return;
  }

  try {
    final Expression expression = (Expression) o.getExpressionType().newInstance();
    if ( primaryDataSourceExpression != null ) {
      propagateExpressionSettings( primaryDataSourceExpression, expression );
    }

    setPrimaryDataSource( expression.getInstance() );
  } catch ( final Exception e1 ) {
    // ignore the exception ..
    UncaughtExceptionsModel.getInstance().addException( e1 );
    setPrimaryDataSource( null );
  }
}
 
Example #6
Source File: RowHeaderList.java    From CXTouch with GNU General Public License v3.0 6 votes vote down vote up
private void mainModelChanged(ListDataEvent e) {
    RowNumberListModel listModel = (RowNumberListModel) getModel();
    int listRowCount = listModel.getSize();
    int mainRowCount = RowHeaderList.this.getModel().getSize();
    if (mainRowCount == listRowCount) {
        if ( e.getType() == ListDataEvent.CONTENTS_CHANGED ) {
            listModel.fireContentsChanged(e.getIndex0(), e.getIndex1());
        }
        return;
    }

    listModel.setSize(mainRowCount);
    if (mainRowCount == 0) {
        return;
    }

    Insets insets = getInsets();
    ListCellRenderer cellRender = getCellRenderer();
    int with = (int) cellRender.getListCellRendererComponent(this, null, mainRowCount - 1, false, false)
            .getPreferredSize().getWidth() + insets.left + insets.right;
    setFixedCellWidth(with);
}
 
Example #7
Source File: KeyedComboBoxModel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Removes all entries from the model.
 */
public void clear()
{
  final int size = getSize();
  this.data.clear();
  final ListDataEvent evt = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 0, size - 1);
  fireListDataEvent(evt);
}
 
Example #8
Source File: ListComboBoxModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addListDataListener(ListDataListener l) {
    if (listeners == null) {
        listeners = new ArrayList<ListDataListener>(3);
        event = new ListDataEvent(this, CONTENTS_CHANGED, -1, -1);
    }
    listeners.add(l);
}
 
Example #9
Source File: FilteredListModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void intervalAdded (ListDataEvent listDataEvent) {
    if (external == null) {
        return;
    }

    updateYourAssumeptions ();

    int first = listDataEvent.getIndex0 ();
    int end = listDataEvent.getIndex1 () + 1;
    int len = end - first;

    int newOriginalSize = originalSize + len;
    int newSize = size + len;

    int insert = findExternalIndex (first);
    int[] newExternal = new int[newSize];
    System.arraycopy (external, 0, newExternal, 0, insert);
    for (int i = 0; i < len; i++) {
        newExternal[insert + i] = NOT_TESTED;
    }
    for (int i = insert + len; i < newExternal.length; i++) {
        int v = external[i - len];
        newExternal[i] = v < 0 ? v : v + len;
    }
    external = newExternal;
    size = newSize;
    originalSize = newOriginalSize;

    regenerateCheckedBitSet ();

    fireChange (new ListDataEvent (this, ListDataEvent.INTERVAL_ADDED, insert, insert + len - 1));
    assert externalContraints () : "Constraints failed"; // NOI18N
}
 
Example #10
Source File: MondrianDataSourceEditor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #11
Source File: JMultiSelectionList.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void intervalAdded(final ListDataEvent e) {
	int index0 = e.getIndex0();
	int index1 = e.getIndex1();
	if (index0 == index1) {
		updateList(index0, 1);
	}
}
 
Example #12
Source File: KeyedComboBoxModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Notifies all registered list data listener of the given event.
 *
 * @param evt the event.
 */
protected synchronized void fireListDataEvent( final ListDataEvent evt ) {
  if ( tempListeners == null ) {
    tempListeners = listdatalistener.toArray
      ( new ListDataListener[ listdatalistener.size() ] );
  }

  final ListDataListener[] listeners = tempListeners;
  for ( int i = 0; i < listeners.length; i++ ) {
    final ListDataListener l = listeners[ i ];
    l.contentsChanged( evt );
  }
}
 
Example #13
Source File: FilteredListModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Notifies removal of inteval from (inclusive) to (exclusive) and
 * updates its structures.
 *
 * !!! as a side effect updates size !!!
 *
 * @return s - number of removals
 */
private void notifyRemoval (int from, int to) {
    ListDataEvent ev = new ListDataEvent (
        this, ListDataEvent.INTERVAL_REMOVED, from, to - 1
    );
    removeInterval (external, from, to);
    int cnt = to - from;
    size -= cnt;

    regenerateCheckedBitSet ();
    fireChange (ev);
}
 
Example #14
Source File: CDebuggerComboModel.java    From binnavi with Apache License 2.0 5 votes vote down vote up
@Override
public void addedDebugger(
    final IDebuggerContainer container, final DebuggerTemplate debugger) {
  updateElements();

  for (final ListDataListener listener : modelListeners) {
    listener.contentsChanged(new ListDataEvent(
        CDebuggerComboModel.this, ListDataEvent.CONTENTS_CHANGED, 0, getSize()));
  }
}
 
Example #15
Source File: DefaultTabbedContainerUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 #16
Source File: LogDevicesComboBoxSupport.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
/**
 * Remove a device from the data model, except it has messages in the log
 * cache.
 */
private void remove(String device) {
    // do we have log events for this device?
    if (reader.getLogEventsForDevice(device) != null) {
        // if true, we want to keep it
        return;
    }

    for (int i = devices.size(); --i >= 0;) {
        if (devices.get(i).equals(device)) {
            devices.remove(i);
            fireListDataEvent(ListDataEvent.INTERVAL_REMOVED, i);
        }
    }
}
 
Example #17
Source File: SWFListModel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called when data in a replacement changed
 *
 * @param index Index of which SWF changed
 */
public void dataChanged(int index) {
    if (index == -1) {
        return;
    }
    for (ListDataListener l : listeners) {
        l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
    }
}
 
Example #18
Source File: DefaultTabDataModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Remove a range of tabs from <code>start</code> up to <i>and including</i> 
 * <code>finish</code>.
 */
@Override
public void removeTabs(int start, int end) {
    java.util.List affected = new ArrayList(list.subList(start, end));
    if (start == end) {
        list.remove(start);
    } else {
        list.removeRange(start, end);
    }
    ComplexListDataEvent lde = new ComplexListDataEvent(this,
                                                        ListDataEvent.INTERVAL_REMOVED,
                                                        start, end);
    lde.setAffectedItems((TabData[]) affected.toArray(new TabData[0]));
    fireIntervalRemoved(lde);
}
 
Example #19
Source File: Olap4JDataSourceEditor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #20
Source File: AndroidPlatformCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void fireJavadocAdded() {
    for (ListDataListener listener : javadocListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, aPackage.getJavadocPaths().size() - 2, aPackage.getJavadocPaths().size() - 1));
    }
}
 
Example #21
Source File: QueryNameTextFieldDocumentListener.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void intervalRemoved( final ListDataEvent e ) {
}
 
Example #22
Source File: CustomizerLibraries.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void intervalAdded(ListDataEvent e) {
}
 
Example #23
Source File: ViewTooltips.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void intervalRemoved(ListDataEvent e) {
    change();
}
 
Example #24
Source File: Models.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void contentsChanged(ListDataEvent e) {
    fireContentsChanged(this, e.getIndex0(), e.getIndex1());
}
 
Example #25
Source File: QuickSearchPopup.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void contentsChanged(ListDataEvent e) {
    updatePopup();
}
 
Example #26
Source File: PathsCustomizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void contentsChanged(ListDataEvent e) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
Example #27
Source File: CustomizerSources.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void intervalAdded(ListDataEvent e) {
    revalidate();
}
 
Example #28
Source File: CustomizerDataSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void intervalAdded(ListDataEvent e) {
    modelChanged();
}
 
Example #29
Source File: ListDataAdapter.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void contentsChanged(ListDataEvent e)
{
	listDataChanged(e);
}
 
Example #30
Source File: SimpleDataSourceDialogModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void intervalAdded(final ListDataEvent e)
{
  contentsChanged(e);
}