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:com.l2fprod.common.springrcp.JDirectoryChooserBinding.java

protected JComponent doBindControl() {
    component.setSelectedFile((File) getValue());
    component.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            String prop = evt.getPropertyName();
            if (JDirectoryChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
                File file = (File) evt.getNewValue();
                controlValueChanged(file);
            }/*  ww  w  . ja  v  a2  s  .c  o m*/
        }
    });
    return component;
}

From source file:com.googlecode.vfsjfilechooser2.filechooser.AbstractVFSFileSystemView.java

public static AbstractVFSFileSystemView getFileSystemView() {
    useSystemExtensionsHiding = UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding");
    UIManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName().equals("lookAndFeel")) {
                useSystemExtensionsHiding = UIManager.getDefaults()
                        .getBoolean("FileChooser.useSystemExtensionHiding");
            }//from   w ww.ja v  a  2s.  c o m
        }
    });

    if (genericFileSystemView == null) {
        genericFileSystemView = new GenericFileSystemView();
    }

    return genericFileSystemView;
}

From source file:Main.java

PrintHelloAction() {
    super("Print");
    putValue(Action.SHORT_DESCRIPTION, "Hello, World");
    super.addPropertyChangeListener(new PropertyChangeListener() {

        @Override//from  w  w w .ja  va2 s.c  o m
        public void propertyChange(PropertyChangeEvent e) {
            System.out.println(e.getNewValue());

        }
    });
}

From source file:Main.java

PrintHelloAction() {
    super("Print");
    putValue(Action.SHORT_DESCRIPTION, "Hello, World");
    PropertyChangeListener listener = new PropertyChangeListener() {
        @Override/*from   w  w w.  ja  v  a 2 s  . c o  m*/
        public void propertyChange(PropertyChangeEvent evt) {
            System.out.println(evt);
        }
    };
    super.addPropertyChangeListener(listener);
    super.firePropertyChange(Action.SHORT_DESCRIPTION, "value1", "value2");
}

From source file:com.codecrate.shard.ui.binding.JFileChooserBinding.java

protected JComponent doBindControl() {
    File value = (File) getValue();

    component.setSelectedFile(value);/*  w w  w  .  j a va2 s  .c  om*/
    component.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            String prop = evt.getPropertyName();
            if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
                File file = (File) evt.getNewValue();
                controlValueChanged(file);

                updateLabel(file);
            }
        }
    });

    updateLabel(value);

    JPanel panel = new JPanel();
    panel.add(label);

    JButton browseButton = new JButton("Browse");
    browseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            component.showDialog(getActiveWindow().getControl(), "Ok");
        }
    });
    panel.add(browseButton);
    return panel;
}

From source file:org.drugis.mtc.summary.TransformedMultivariateNormalSummary.java

public TransformedMultivariateNormalSummary(MultivariateNormalSummary nested, double[][] matrix) {
    d_nested = nested;/*from   www.  j  a  v a 2 s. co  m*/
    d_transform = new Array2DRowRealMatrix(matrix, true);
    d_nested.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            transform();
        }
    });
    transform();
}

From source file:org.jcurl.model.ComputedPathsTest.java

public void testNoneMoving() throws FunctionEvaluationException, InterruptedException {
    final ComputedPaths cp = new ComputedPaths();
    assertEquals(0, ec);//from   www . j av a 2 s. com
    cp.getCurrentPos().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            assertEquals("rock", e.getPropertyName());
            assertTrue(e.getSource() instanceof PositionSet);
            ec += pos;
        }
    });
    cp.getCurrentSpeed().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            assertEquals("rock", e.getPropertyName());
            assertTrue(e.getSource() instanceof SpeedSet);
            ec += vel;
        }
    });
    assertEquals(0, ec);
    assertEquals("", 0.0, cp.getCurrentT(), 1e-9);
    cp.setCurrentT(1);
    // Strange! Eclipse fails here, but maven does it right!
    assertEquals((vel + pos), ec);
    assertEquals("", 1.0, cp.getCurrentT(), 1e-9);
    cp.setCurrentT(Double.MAX_VALUE);
    assertEquals((vel + pos) * 2, ec);
    assertEquals("", Double.MAX_VALUE, cp.getCurrentT(), 1e-9);
    cp.setCurrentT(Double.POSITIVE_INFINITY);
    assertEquals((vel + pos) * 3, ec);
    assertEquals("", Double.POSITIVE_INFINITY, cp.getCurrentT(), 1e-9);
}

From source file:com.emr.mappings.MappingsForm.java

/**
 * Creates new form MappingsForm//from w  w  w.ja v  a2 s  . co m
 * SQliteDataLoadWorker is a SwingWorker that fetches the saved mappings from the sqlite database,
 * and populates this to the mappings table
 * 
 */
public MappingsForm() {
    //model=new DefaultTableModel(new Object[]{"Source Value","Map To"}, 25);

    final SQliteDataLoadWorker dl = new SQliteDataLoadWorker(tblMappings,
            "select sourceValue,dataMapping from mappings");
    dl.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            switch (event.getPropertyName()) {
            case "progress":
                System.out.println("Fetching data from db");
                break;
            case "state":
                switch ((SwingWorker.StateValue) event.getNewValue()) {
                case DONE:
                    try {
                        model = dl.get();
                        tblMappings.setModel(model);
                    } catch (final CancellationException ex) {
                        Logger.getLogger(SourceDataPreview.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(SourceDataPreview.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (ExecutionException ex) {
                        Logger.getLogger(SourceDataPreview.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    break;
                }
                break;
            }
        }

    });
    dl.execute();
    initComponents();
    //todo: get already added mappings and use their count to initilize model
    this.setClosable(true);

    /*TextBoxTableCellEditor sourceValEditor=new TextBoxTableCellEditor(new JTextField());
    tblMappings.getColumnModel().getColumn(0).setCellEditor(sourceValEditor);
    TextBoxTableCellEditor mappingValEditor=new TextBoxTableCellEditor(new JTextField());
    tblMappings.getColumnModel().getColumn(1).setCellEditor(mappingValEditor);*/
}

From source file:org.nekorp.workflow.desktop.view.binding.SimpleBindableJDateChooser.java

@Override
public void bindListener(final Object target, final String property) {
    listener = new PropertyChangeListener() {
        @Override//from  w  w w . jav a 2 s  .co  m
        public void propertyChange(PropertyChangeEvent evt) {
            try {
                if (StringUtils.equals(evt.getPropertyName(), "date")) {
                    Object value = getModelValue();
                    ignoreUpdate(value);
                    BeanUtils.setProperty(target, property, value);
                }
            } catch (IllegalAccessException | InvocationTargetException ex) {
                SimpleBindableJDateChooser.LOGGER.error("crash", ex);
            }
        }
    };
    this.addPropertyChangeListener(listener);
}

From source file:org.wings.resource.ReloadResource.java

/**
 * Create a code resource for the specified frame.
 * <p>The MIME-type for this frame will be <code>text/html; charset=<i>current encoding</i></code>
 *//*from   ww  w.  j a  v a  2  s .c  o  m*/
public ReloadResource(final SFrame f) {
    super(f, "html", provideMimeType(f));
    // update session encoding if manually updated in the session.
    changeListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            mimeType = provideMimeType(f);
        }
    };
    f.getSession().addPropertyChangeListener(changeListener);
}