Example usage for java.beans PropertyChangeListener PropertyChangeListener

List of usage examples for java.beans PropertyChangeListener PropertyChangeListener

Introduction

In this page you can find the example usage for java.beans PropertyChangeListener PropertyChangeListener.

Prototype

PropertyChangeListener

Source Link

Usage

From source file:org.protempa.LowLevelAbstractionValueDefinition.java

public LowLevelAbstractionValueDefinition(LowLevelAbstractionDefinition lowLevelAbstractionDefinition,
        String id) {// w  ww  .  j  av a 2  s  . c om
    if (lowLevelAbstractionDefinition == null) {
        throw new IllegalArgumentException("A low level abstraction definition must be specified");
    }
    this.lowLevelAbstractionDefinition = lowLevelAbstractionDefinition;
    if (id == null) {
        throw new IllegalArgumentException("id cannot be null");
    }
    this.id = id.intern();
    this.lowLevelAbstractionDefinition.addValueDefinition(this);
    this.lowLevelAbstractionDefinition.addPropertyChangeListener("algorithmId", new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            LowLevelAbstractionValueDefinition.this.algorithmArguments = null;
        }
    });
    this.parameterValues = new HashMap<>();
    this.parameterValueComps = new HashMap<>();
}

From source file:org.openeos.services.ui.form.abstractform.UIBeanSelectorProvider.java

public UIBeanSelectorProvider(SessionFactory sessionFactory, Class<T> beanClass, FormInstance formInstance,
        String sqlRestriction) {/*  ww w.j  ava  2  s .  c  o m*/
    this.sessionFactory = sessionFactory;
    this.beanClass = beanClass;
    this.formInstance = formInstance;
    this.sqlRestriction = sqlRestriction;
    if (sqlRestriction != null && formInstance instanceof BFormInstance<?, ?>) {

        this.formInstance.addFieldChangeListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                // TODO This is not good idea, maybe cached query, check if query changed and fire if it changed. 
                fireElementsChanged();
            }
        });
    }
}

From source file:com.anrisoftware.prefdialog.miscswing.actions.Actions.java

Actions() {
    this.actions = new HashMap<String, List<ActionEntry>>();
    this.awtActions = new HashMap<String, List<Runnable>>();
    this.actionListener = new PropertyChangeListener() {

        @Override/*from w w  w .  j  a v  a 2 s. c om*/
        public void propertyChange(PropertyChangeEvent evt) {
            Future<?> future = (Future<?>) evt.getSource();
            try {
                future.get();
            } catch (InterruptedException e) {
                log.taskInterrupted(future, e);
            } catch (ExecutionException e) {
                log.taskError(future, e.getCause());
            }
        }
    };
}

From source file:com.facultyshowcase.app.ui.PictureEditor.java

/**
 * Create an instance./*w w w  .j  a v a 2  s. c o m*/
 */
public PictureEditor() {
    super();
    addClassName("prop");
    _picture.setImageCaching(false);
    _fileField.setAccept("image/*");
    _fileField.addPropertyChangeListener(FileField.PROP_FILE_ITEMS, new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            final List<FileItem> files = (List<FileItem>) evt.getNewValue();
            if (files != null && files.size() > 0) {
                _uiValue = files.get(0);
                _picture.setImage(new Image(_uiValue));
                _modified = true;
            }
            _fileField.resetFile();
        }
    });

    final ClassPathResourceLibraryHelper helper = ClassPathResourceLibraryHelper.getInstance();
    _defaultProfilePicture = helper.createResource(helper.createLibrary("default-profile-picture.png"));
}

From source file:EnrollFingerprint.Verify.java

/**
 * Creates new form Enroll// www  . j a va  2s.  co m
 */
public Verify() {
    initComponents();
    //updateStatus();

    // Event listener actived when fingerprint template is ready
    this.addPropertyChangeListener(TEMPLATE_PROPERTY, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getNewValue() == evt.getOldValue()) {
                return;
            }
            if (template != null) {
                JOptionPane.showMessageDialog(Verify.this, "La huella capturada esta lista para ser guardada.",
                        "Captura y Registro de huellas", JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });
}

From source file:org.eclipse.php.composer.api.entities.JsonEntity.java

protected void listen() {
    try {/*from  w  w w.j  av a2s . c om*/
        for (Field field : getFields(this.getClass())) {
            if (JsonCollection.class.isAssignableFrom(field.getType())) {
                final String prop = getFieldName(field);
                final JsonEntity sender = this;

                if (listening.contains(prop)) {
                    continue;
                }

                field.setAccessible(true);
                JsonEntity obj = (JsonEntity) field.get(this);

                if (obj != null) {
                    obj.addPropertyChangeListener(new PropertyChangeListener() {
                        public void propertyChange(PropertyChangeEvent e) {
                            firePropertyChange(prop + "." + e.getPropertyName(), e.getOldValue(), //$NON-NLS-1$
                                    e.getNewValue());

                            // append to sort order - use reflection
                            if (sender instanceof AbstractJsonObject) {
                                try {
                                    Method mtd = JsonEntity.class.getDeclaredMethod("appendSortOrder", //$NON-NLS-1$
                                            String.class);
                                    mtd.setAccessible(true);
                                    mtd.invoke(sender, prop);
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                }
                            }
                        }
                    });

                    listening.add(prop);
                }
            }
        }
    } catch (Exception e) {
        log.error(e);
    }
}

From source file:io.github.gsteckman.doorcontroller.DoorRestInterface.java

/**
 * Create a new DoorRestInterface using the provided SubscriptionManager and DoorController.
 * @param sm SubscriptionManager for supporting UPnP subscriptions.
 * @param doorController The DoorController to use for activating the door.
 *///from ww  w.  jav  a2 s  .co m
public DoorRestInterface(final SubscriptionManager sm, final DoorController doorController) {
    subMgr = sm;
    dc = doorController;

    dc.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent arg0) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                subMgr.fireEvent(SUBSCRIPTION_KEY, "application/JSON",
                        mapper.writeValueAsString(getDoorState()));
            } catch (JsonProcessingException e) {
                LOG.error(e);
            }
        }
    });
}

From source file:VASSAL.preferences.Prefs.java

public Prefs(PrefsEditor editor, String name) {
    this.editor = editor;
    this.name = name;
    this.changeListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            changed.add(evt.getPropertyName());
        }/*from ww  w  .j  a v a  2 s . c o m*/
    };
    editor.addPrefs(this);
    init(name);
}

From source file:org.pentaho.aggdes.ui.ext.impl.MondrianFileSchemaProvider.java

@Override
public void onLoad() {
    super.onLoad();

    bindingFactory.createBinding("mondrianSelector", "selected", this, "selected");

    bindingFactory.createBinding(this, "selectedEnabled", "mondrianSchemaFileName", "!disabled");
    bindingFactory.createBinding(this, "selectedEnabled", "fileSelector", "!disabled");
    bindingFactory.createBinding(this, "mondrianSchemaFilename", "mondrianSchemaFileName", "value");
    bindingFactory.setBindingType(Binding.Type.ONE_WAY);
    bindingFactory.createBinding(this, "enabled", "mondrianSelector", "!disabled");

    addPropertyChangeListener("mondrianSchemaFilename", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            String val = (String) evt.getNewValue();
            setSchemaDefined(!StringUtils.isEmpty(val));
        }//from w  ww.ja v  a  2s . com
    });

    BindingConvertor<Boolean, Boolean> isDefinedConverter = new BindingConvertor<Boolean, Boolean>() {

        @Override
        public Boolean sourceToTarget(Boolean value) {
            if (Boolean.TRUE.equals(value)) {
                return !StringUtils.isEmpty(getMondrianSchemaFilename());
            }
            return false;
        }

        @Override
        public Boolean targetToSource(Boolean value) {
            return null;
        }
    };

    bindingFactory.setBindingType(Binding.Type.ONE_WAY);
    bindingFactory.createBinding(this, "selected", this, "schemaDefined", isDefinedConverter);

    // special binding based on type of database meta
    BindingConvertor<Boolean, Boolean> converter = new BindingConvertor<Boolean, Boolean>() {
        @Override
        public Boolean sourceToTarget(Boolean value) {
            DatabaseMeta databaseMeta = connectionModel.getDatabaseMeta();
            boolean disabled = connectionModel.isSchemaLocked();

            if (disabled && isSelected()) {
                setSelected(false);
            }
            return disabled;
        }

        @Override
        public Boolean targetToSource(Boolean value) {
            // TODO Auto-generated method stub
            return null;
        }
    };
    bindingFactory.createBinding(connectionModel, "schemaSourceSelectionEnabled", "mondrianSelector",
            "disabled", converter);

}

From source file:org.drugis.addis.presentation.NodeSplitResultsTableModel.java

public NodeSplitResultsTableModel(NetworkMetaAnalysisPresentation pm) {
    d_pm = pm;//from ww w  .j  av a 2  s . com

    d_listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            fireTableDataChanged();
        }
    };

    if (d_pm.getSplitParameters().size() > 0) {
        initializeTable();
    }
}