use of net.parostroj.timetable.gui.dialogs.TCDetailsViewDialog in project grafikon by jub77.
the class TrainUnitCycleDelegate method showEditDialog.
@Override
public void showEditDialog(JComponent component) {
if (editDialog == null) {
editDialog = new TCDetailsViewDialog(GuiComponentUtils.getWindow(component), true);
}
editDialog.setLocationRelativeTo(component);
editDialog.updateValues(this, model.get());
editDialog.setVisible(true);
}
use of net.parostroj.timetable.gui.dialogs.TCDetailsViewDialog in project grafikon by jub77.
the class DriverCycleDelegate method showEditDialog.
@Override
public void showEditDialog(JComponent component) {
if (editDialog == null) {
editDialog = new TCDetailsViewDialog(GuiComponentUtils.getWindow(component), true);
}
editDialog.setLocationRelativeTo(component);
editDialog.updateValues(this, model.get());
editDialog.setVisible(true);
}
use of net.parostroj.timetable.gui.dialogs.TCDetailsViewDialog in project grafikon by jub77.
the class EngineCycleDelegate method showEditDialog.
@Override
public void showEditDialog(JComponent component) {
if (editDialog == null) {
editDialog = new TCDetailsViewDialog(GuiComponentUtils.getWindow(component), true);
}
editDialog.setLocationRelativeTo(component);
editDialog.updateValues(this, model.get());
editDialog.setVisible(true);
}
use of net.parostroj.timetable.gui.dialogs.TCDetailsViewDialog in project grafikon by jub77.
the class CirculationPane method setModel.
public void setModel(ApplicationModel model) {
this.delegate = new TCDelegate(model) {
private TCDetailsViewDialog editDialog;
@Override
public void showEditDialog(JComponent component) {
if (editDialog == null) {
editDialog = new TCDetailsViewDialog(GuiComponentUtils.getWindow(component), true);
}
editDialog.setLocationRelativeTo(component);
editDialog.updateValues(this, diagram);
editDialog.setVisible(true);
}
@Override
public TrainsCycleType getType() {
return type;
}
@Override
public void handleEvent(Action action, TrainsCycle cycle, Train train) {
if (action == Action.DIAGRAM_CHANGE) {
diagram = delegate.getTrainDiagram();
updateTypes();
this.fireEvent(Action.REFRESH, null);
}
}
};
trainsCyclesPane.setModel(this.delegate, new TrainColorChooser() {
@Override
public Color getIntervalColor(TimeInterval interval) {
if (!interval.getTrain().isCovered(type, interval)) {
return Color.black;
} else {
return Color.gray;
}
}
});
model.getMediator().addColleague(new GTEventsReceiverColleague() {
@Override
public void processTrainDiagramEvent(Event event) {
if (event.getType() == Event.Type.ADDED && event.getObject() instanceof TrainsCycleType) {
Wrapper<TrainsCycleType> wrapper = new Wrapper<>((TrainsCycleType) event.getObject());
typesComboBox.addItem(wrapper);
typesComboBox.setSelectedItem(wrapper);
} else if (event.getType() == Event.Type.REMOVED && event.getObject() instanceof TrainsCycleType) {
typesComboBox.removeItem(new Wrapper<>((TrainsCycleType) event.getObject()));
}
}
});
}
Aggregations