jdplus.tramoseats.desktop.plugin.anomalydetection.TramoSpecPropertyEditor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdplus-tramoseats-desktop-plugin Show documentation
Show all versions of jdplus-tramoseats-desktop-plugin Show documentation
${project.parent.artifactId} - ${project.artifactId}
The newest version!
/*
* Copyright 2013 National Bank of Belgium
*
* Licensed under the EUPL, Version 1.1 or – as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package jdplus.tramoseats.desktop.plugin.anomalydetection;
import jdplus.tramoseats.base.api.tramo.TramoSpec;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
import org.openide.explorer.propertysheet.ExPropertyEditor;
import org.openide.explorer.propertysheet.InplaceEditor;
import org.openide.explorer.propertysheet.PropertyEnv;
import org.openide.explorer.propertysheet.PropertyModel;
import org.openide.nodes.PropertyEditorRegistration;
/**
* Custom property editor for TramoSpecification
* @author Mats Maggi
*/
@PropertyEditorRegistration(targetType = TramoSpec.class)
public class TramoSpecPropertyEditor extends PropertyEditorSupport implements ExPropertyEditor, InplaceEditor.Factory {
private InplaceEditor ed = null;
@Override
public void attachEnv(PropertyEnv pe) {
pe.registerInplaceEditorFactory(this);
}
@Override
public InplaceEditor getInplaceEditor() {
if (ed == null) {
ed = new TramoSpecEditor();
}
return ed;
}
@Override
public String getAsText(){
Object val = this.getValue();
if (val == null || ! (val instanceof TramoSpec))
return null;
TramoSpec spec=(TramoSpec) val;
return spec.display();
}
private static class TramoSpecEditor implements InplaceEditor {
private static String[] allSpecs(){
TramoSpec[] all = TramoSpec.allSpecifications();
String[] n=new String[all.length];
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy