Search in sources :

Example 6 with Event

use of net.parostroj.timetable.model.events.Event in project grafikon by jub77.

the class TrainTypeCategory method addRow.

public void addRow(PenaltyTableRow row) {
    ListIterator<PenaltyTableRow> i = penaltyRows.listIterator();
    while (i.hasNext()) {
        PenaltyTableRow currentRow = i.next();
        if (row.getSpeed() < currentRow.getSpeed()) {
            i.previous();
            i.add(row);
            listenerSupport.fireEvent(new Event(this, Event.Type.ADDED, row));
            return;
        } else if (row.getSpeed() == currentRow.getSpeed()) {
            i.set(row);
            listenerSupport.fireEvent(new Event(this, Event.Type.REPLACED, row, ListData.createData(currentRow, row)));
            return;
        }
    }
    penaltyRows.add(row);
    listenerSupport.fireEvent(new Event(this, Event.Type.ADDED, row));
}
Also used : Event(net.parostroj.timetable.model.events.Event)

Example 7 with Event

use of net.parostroj.timetable.model.events.Event in project grafikon by jub77.

the class TrainTypeCategory method removeRowForSpeed.

public PenaltyTableRow removeRowForSpeed(int speed) {
    for (Iterator<PenaltyTableRow> i = penaltyRows.iterator(); i.hasNext(); ) {
        PenaltyTableRow row = i.next();
        if (row.getSpeed() == speed) {
            i.remove();
            listenerSupport.fireEvent(new Event(this, Event.Type.REMOVED, row));
            return row;
        }
    }
    return null;
}
Also used : Event(net.parostroj.timetable.model.events.Event)

Example 8 with Event

use of net.parostroj.timetable.model.events.Event in project grafikon by jub77.

the class TrainTypeCategory method removeRow.

public PenaltyTableRow removeRow(int position) {
    PenaltyTableRow row = penaltyRows.remove(position);
    listenerSupport.fireEvent(new Event(this, Event.Type.REMOVED, row));
    return row;
}
Also used : Event(net.parostroj.timetable.model.events.Event)

Example 9 with Event

use of net.parostroj.timetable.model.events.Event in project grafikon by jub77.

the class TrainNameDelegate method refreshName.

private void refreshName() {
    String oldName = _cachedName.getValue();
    String newName = this.getNameImpl(NameType.NORMAL);
    if (_cachedName.set(newName)) {
        train.fireEvent(new Event(train, new AttributeChange(ATTR_NAME, oldName, newName)));
    }
}
Also used : AttributeChange(net.parostroj.timetable.model.events.AttributeChange) Event(net.parostroj.timetable.model.events.Event)

Example 10 with Event

use of net.parostroj.timetable.model.events.Event in project grafikon by jub77.

the class TrainsData method setTrainSortPattern.

public void setTrainSortPattern(SortPattern trainSortPattern) {
    SortPattern oldValue = this.trainSortPattern;
    this.trainSortPattern = trainSortPattern;
    this.trainComparator = null;
    this.diagram.fireEvent(new Event(diagram, new AttributeChange(TrainDiagram.ATTR_TRAIN_SORT_PATTERN, oldValue, this.trainSortPattern)));
}
Also used : AttributeChange(net.parostroj.timetable.model.events.AttributeChange) Event(net.parostroj.timetable.model.events.Event)

Aggregations

Event (net.parostroj.timetable.model.events.Event)21 AttributeChange (net.parostroj.timetable.model.events.AttributeChange)12 Color (java.awt.Color)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ItemEvent (java.awt.event.ItemEvent)1 MouseEvent (java.awt.event.MouseEvent)1 JComponent (javax.swing.JComponent)1 PopupMenuEvent (javax.swing.event.PopupMenuEvent)1 PopupMenuListener (javax.swing.event.PopupMenuListener)1 TCDetailsViewDialog (net.parostroj.timetable.gui.dialogs.TCDetailsViewDialog)1 TCDelegate (net.parostroj.timetable.gui.views.TCDelegate)1 Wrapper (net.parostroj.timetable.gui.wrappers.Wrapper)1 GTEventsReceiverColleague (net.parostroj.timetable.mediator.GTEventsReceiverColleague)1 Route (net.parostroj.timetable.model.Route)1 Train (net.parostroj.timetable.model.Train)1 TrainColorChooser (net.parostroj.timetable.output2.gt.TrainColorChooser)1 AbstractEventVisitor (net.parostroj.timetable.visitors.AbstractEventVisitor)1