org.valkyriercp.dialog.control.VetoableSingleSelectionModel Maven / Gradle / Ivy
package org.valkyriercp.dialog.control;
import javax.swing.*;
/**
* Custom SingleSelectionModel
implementation that allows for
* vetoing the selection of tabs.
*
* The {@link #selectionAllowed(int)} method must return true
if
* the tab at the index can be selected, or false
if not.
*
* @author Peter De Bruycker
*/
public abstract class VetoableSingleSelectionModel extends DefaultSingleSelectionModel {
public final void setSelectedIndex(int index) {
if (selectionAllowed(index)) {
super.setSelectedIndex(index);
}
}
protected abstract boolean selectionAllowed(int index);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy