Example usage for javax.swing.event ListDataEvent ListDataEvent

List of usage examples for javax.swing.event ListDataEvent ListDataEvent

Introduction

In this page you can find the example usage for javax.swing.event ListDataEvent ListDataEvent.

Prototype

public ListDataEvent(Object source, int type, int index0, int index1) 

Source Link

Document

Constructs a ListDataEvent object.

Usage

From source file:blue.automation.ParameterIdList.java

public void addParameterId(String parameterId) {
    parameters.add(parameterId);//w  ww .j  a va  2 s.co  m

    String current = null;

    if (getSelectedIndex() > 0) {
        current = getParameterId(getSelectedIndex());
    }

    Collections.sort(parameters, comparator);

    int index = parameters.indexOf(parameterId);

    ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index);

    fireAddDataEvent(lde);

    if (size() == 1) {
        setSelectedIndex(0);
    } else if (current != null) {
        setSelectedIndex(parameters.indexOf(current));
    }
}

From source file:blue.mixer.ChannelList.java

public void addChannel(Channel channel) {
    int index = channels.size();
    channels.add(channel);/*  w ww .  j  av  a  2s.  c o  m*/

    ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index);

    fireListEvent(lde);

    fireChannelAdded(channel);
}

From source file:FilterGUIListModel.java

void notifyListeners() {
    // no attempt at optimziation
    ListDataEvent le = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED, 0, getSize());
    for (int i = 0; i < listeners.size(); i++) {
        ((ListDataListener) listeners.get(i)).contentsChanged(le);
    }/*from   w w w.  j av  a 2s  . co m*/
}

From source file:blue.soundObject.jmask.Field.java

public void pushUp(int index) {
    if (index > 0 && index < parameters.size()) {
        Parameter val = parameters.remove(index);
        parameters.add(index - 1, val);

        ListDataEvent lde = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index - 1, index);
        fireContentsChangedEvent(lde);// www  .j av  a 2 s .  c o m
    }
}

From source file:blue.automation.ParameterIdList.java

public void removeParameterId(String parameterId) {
    if (parameters.contains(parameterId)) {
        int index = parameters.indexOf(parameterId);
        parameters.remove(parameterId);/*  w w w .  ja va2  s .  c  o m*/

        ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index);

        fireRemoveDataEvent(lde);

        if (size() == 0) {
            setSelectedIndex(-1);
        } else if (index == selectedIndex) {
            if (selectedIndex >= size()) {
                setSelectedIndex(size() - 1);
            }
        } else if (index < selectedIndex) {
            setSelectedIndex(selectedIndex - 1);
        }
    }
}

From source file:blue.mixer.ChannelList.java

public void removeChannel(Channel channel) {
    int index = channels.indexOf(channel);

    if (index == -1) {
        return;//from   w ww .j  ava2s.co m
    }

    channels.remove(channel);

    ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index);

    fireListEvent(lde);
    fireChannelRemoved(channel);
}

From source file:blue.mixer.EffectsChain.java

public void addEffect(Effect effect) {
    effects.add(effect);/*from   w  w w  . j ava  2s .c om*/
    int val = effects.indexOf(effect);

    ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, val, val);

    fireAddDataEvent(lde);

    fireAutomatableAdded(effect);
}

From source file:blue.soundObject.jmask.Field.java

public void pushDown(int index) {
    if (index >= 0 && index < parameters.size() - 1) {
        Parameter val = parameters.remove(index + 1);
        parameters.add(index, val);

        ListDataEvent lde = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index + 1);
        fireContentsChangedEvent(lde);//from  w w w  . ja v  a  2  s  .  c  o  m
    }
}

From source file:edu.harvard.mcz.imagecapture.data.AgentNameComboBoxModel.java

private void notifyListeners() {
    Iterator<ListDataListener> i = dataListeners.iterator();
    while (i.hasNext()) {
        i.next().contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, model.size()));
    }/*from  w  w w.j  ava  2s  .  c o m*/
}

From source file:blue.mixer.EffectsChain.java

public void addSend(Send send) {
    effects.add(send);//from  w  w w .  ja va2  s. co m
    int val = effects.indexOf(send);

    ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, val, val);

    fireAddDataEvent(lde);

    fireAutomatableAdded(send);

    send.addPropertyChangeListener(this);
}