
jdplus.toolkit.desktop.plugin.ui.options.BehaviourOptionsPanelController Maven / Gradle / Ivy
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/NetBeansModuleDevelopment-files/template_mypluginOptionsPanelController.java to edit this template
*/
package jdplus.toolkit.desktop.plugin.ui.options;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
@OptionsPanelController.SubRegistration(
location = "Demetra",
displayName = "#AdvancedOption_DisplayName_Behaviour",
keywords = "#AdvancedOption_Keywords_Behaviour",
keywordsCategory = "Demetra/Behaviour",
position=20
)
@org.openide.util.NbBundle.Messages({"AdvancedOption_DisplayName_Behaviour=Behaviour", "AdvancedOption_Keywords_Behaviour=Behaviour"})
public final class BehaviourOptionsPanelController extends OptionsPanelController {
private BehaviourPanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed;
@Override
public void update() {
getPanel().load();
changed = false;
}
@Override
public void applyChanges() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
getPanel().store();
changed = false;
}
});
}
public void cancel() {
// need not do anything special, if no changes have been persisted yet
}
public boolean isValid() {
return getPanel().valid();
}
public boolean isChanged() {
return changed;
}
public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set
}
public JComponent getComponent(Lookup masterLookup) {
return getPanel();
}
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
private BehaviourPanel getPanel() {
if (panel == null) {
panel = new BehaviourPanel(this);
}
return panel;
}
void changed() {
if (!changed) {
changed = true;
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
}
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy