Example usage for java.beans PropertyChangeEvent getNewValue

List of usage examples for java.beans PropertyChangeEvent getNewValue

Introduction

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

Prototype

public Object getNewValue() 

Source Link

Document

Gets the new value for the property, expressed as an Object.

Usage

From source file:org.talend.repository.generic.ui.GenericConnWizardPage.java

@Override
public void propertyChange(PropertyChangeEvent event) {
    String propertyName = event.getPropertyName();
    if (IElementParameterEventProperties.EVENT_PROPERTY_NAME_CHANGED.equals(propertyName)) {
        String newPropertyName = String.valueOf(event.getNewValue());
        updateProperty(newPropertyName);
    }/*  w  w w  .  j a v  a  2 s  .c  om*/
}

From source file:org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.ApplicationSourceFromTemplateModel.java

@SuppressWarnings("unchecked")
@Override/*w  w w .java 2 s .co m*/
public void propertyChange(PropertyChangeEvent evt) {
    switch (evt.getPropertyName()) {
    case IResourceLabelsPageModel.PROPERTY_LABELS:
        setLabels((List<Label>) evt.getNewValue());
        break;
    case IApplicationSourceListPageModel.PROPERTY_PROJECT:
        this.project = (IProject) evt.getNewValue();
        break;
    case IApplicationSourceListPageModel.PROPERTY_SELECTED_APP_SOURCE:
        handleSelectedAppSource(evt);
        break;
    case IApplicationSourceListPageModel.PROPERTY_ECLIPSE_PROJECT:
        handleEclipseProject(evt);
        break;
    }
}

From source file:dk.i2m.netbeans.modules.ldapexplorer.ui.ExplorerTopComponent.java

/**
 * Creates a new instance of {@link ExplorerTopComponent}.
 *///www  .jav  a  2 s .  c  om
public ExplorerTopComponent() {
    initComponents();
    this.addPropertyChangeListener("inQuery", new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            Boolean newValue = (Boolean) pce.getNewValue();
            assert (newValue != null);
            txtFilter.setEnabled(!newValue);
            btnFilter.setEnabled(!newValue);
            btnReset.setEnabled(!newValue);
            treePane.setEnabled(!newValue);
        }
    });
}

From source file:com.anrisoftware.mongoose.environment.EnvironmentImpl.java

private void setupLocaleHooks(LocaleHooks localeHooks) {
    localeHooks.addPropertyChangeListener(DISPLAY_LOCALE_PROPERTY, new PropertyChangeListener() {

        @Override/*ww w . j  a va2  s. co  m*/
        public void propertyChange(PropertyChangeEvent evt) {
            setLocale((Locale) evt.getNewValue());
        }
    });
    localeHooks.hookDefaultLocale();
}

From source file:gda.gui.text.parameter.EpicsPanelParameterListener.java

/**
 * @param e/*from  ww  w . j  ava  2  s  .co m*/
 * @throws PropertyVetoException
 */
public void vetoableChangeinNewThread(PropertyChangeEvent e) throws PropertyVetoException {
    Object source = e.getSource();
    if (source == null)
        throw new IllegalArgumentException("ParametersPanelListener.propertyChange - source == null ");

    if (source instanceof ParametersPanelBuilder.ParameterChangeEventSource) {

        Object newObject = e.getNewValue();
        if ((newObject == null) || !(newObject instanceof Double)) {
            throw new IllegalArgumentException(
                    "ParametersPanelListener.propertyChange -  (newObject == null ) || !(newObject instanceof Limited) ");
        }

        if (epicsChannel != null) {
            try {
                Double newVal = (Double) newObject;

                if (converter != null)
                    newVal = converter.convertValue(newVal);

                if (lastSuccessfullySentValue == null || (lastSuccessfullySentValue.compareTo(newVal) != 0)) {
                    epicsChannel.setValue(newVal);
                    lastSuccessfullySentValue = newVal;
                }
            } catch (DeviceException expt) {
                logger.error(expt.getMessage());
                throw new PropertyVetoException(expt.getMessage(), e);
            }
        } else {
            throw new IllegalArgumentException("EpicsPanelParameterListener: epicsChannel == null");
        }
    }
}

From source file:fr.crnan.videso3d.ihm.PLNSPanel.java

/**
 * /*from   ww w . j  a v  a2  s .c  o m*/
 * @param path
 *            Chemin vers la base de donnes
 */
public PLNSPanel(final String path) {
    this.setLayout(new BorderLayout());

    this.add(createToolbar(), BorderLayout.NORTH);

    desktop = new TilingDesktopPane();
    desktop.setPreferredSize(new Dimension(800, 600));
    this.add(desktop);

    chartPanels = new ArrayList<ChartPanel>();

    final ProgressMonitor progressMonitorT = new ProgressMonitor(this, "Extraction des donnes", "", 0, 100,
            false, true, false);
    progressMonitorT.setMillisToDecideToPopup(0);
    progressMonitorT.setMillisToPopup(0);
    progressMonitorT.setNote("Extraction des fichiers compresss...");

    plnsAnalyzer = new PLNSAnalyzer();

    //au cas o il faille importer les donnes, on coute le ProgressSupport et on ne lance la cration de la fentre qu' la fin
    plnsAnalyzer.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(ProgressSupport.TASK_STARTS)) {

            } else if (evt.getPropertyName().equals(ProgressSupport.TASK_PROGRESS)) {
                progressMonitorT.setProgress((Integer) evt.getNewValue());
            } else if (evt.getPropertyName().equals(ProgressSupport.TASK_INFO)) {
                progressMonitorT.setNote((String) evt.getNewValue());
            } else if (evt.getPropertyName().equals(ProgressSupport.TASK_ENDS)) {
                createIHM();
            }
        }
    });

    new SwingWorker<Void, Void>() {

        @Override
        protected Void doInBackground() throws Exception {
            plnsAnalyzer.setPath(path);
            return null;
        }
    }.execute();
}

From source file:com.jwrapper.maven.java.JavaDownloadMojo.java

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    try {/* w w w .j a v a2 s  .c o  m*/

        setupNonVerifingSSL();

        final String javaRemoteURL = javaRemoteURL();
        final String javaLocalURL = javaLocalURL();

        logger().info("javaRemoteURL: {}", javaRemoteURL);
        logger().info("javaLocalURL : {}", javaLocalURL);

        final File file = new File(javaLocalURL());

        if (!javaEveryTime() && file.exists()) {
            logger().info("Java artifact is present, skip download.");
            return;
        } else {
            logger().info("Java artifact is missing, make download.");
        }

        file.getParentFile().mkdirs();

        /** Oracle likes redirects. */
        HttpURLConnection connection = connection(javaRemoteURL());
        while (connection.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP) {
            connection = connection(connection.getHeaderField("Location"));
            logger().info("redirect: {}", connection);
        }

        final ProgressInputStream input = new ProgressInputStream(connection.getInputStream(),
                connection.getContentLengthLong());

        final PropertyChangeListener listener = new PropertyChangeListener() {
            long current = System.currentTimeMillis();

            @Override
            public void propertyChange(final PropertyChangeEvent event) {
                if (System.currentTimeMillis() - current > 1000) {
                    current = System.currentTimeMillis();
                    logger().info("progress: {}", event.getNewValue());
                }
            }
        };

        input.addPropertyChangeListener(listener);

        final OutputStream output = new FileOutputStream(file);

        IOUtils.copy(input, output);

        IOUtils.closeQuietly(input);
        IOUtils.closeQuietly(output);

        if (file.length() < 1000 * 1000) {
            throw new IllegalStateException("Download failure.");
        }

        logger().info("Java artifact downloaded: {} bytes.", file.length());

    } catch (final Throwable e) {
        logger().error("", e);
        throw new MojoExecutionException("", e);
    }
}

From source file:DragPictureDemo2.java

public void propertyChange(PropertyChangeEvent e) {
    Object o = e.getNewValue();
    if (o instanceof JComponent) {
        focusOwner = (JComponent) o;
    } else {//from w ww  .j av a  2s  . c  o m
        focusOwner = null;
    }
}

From source file:com.jidesoft.spring.richclient.docking.JideApplicationPage.java

protected DockableFrame createDockableFrame(final PageComponent pageComponent,
        JideViewDescriptor viewDescriptor) {

    if (log.isInfoEnabled()) {
        log.info("Creating dockable frame for page component " + pageComponent.getId());
    }/*w ww  .  ja va  2 s . com*/
    Icon icon = pageComponent.getIcon();
    if (icon == null) {
        IconSource iconSource = (IconSource) ApplicationServicesLocator.services().getService(IconSource.class);
        icon = iconSource.getIcon("applicationInfo.image");
    }
    DockableFrame dockableFrame = new DockableFrame(pageComponent.getId(), icon);
    dockableFrame.setTitle(pageComponent.getDisplayName());
    dockableFrame.setTabTitle(pageComponent.getDisplayName());
    dockableFrame.setFrameIcon(icon);
    if (viewDescriptor != null) {
        dockableFrame.getContext().setInitMode(viewDescriptor.getInitMode());
        dockableFrame.getContext().setInitSide(viewDescriptor.getInitSide());
        dockableFrame.getContext().setInitIndex(viewDescriptor.getInitIndex());
    } else {
        dockableFrame.getContext().setInitMode(DockContext.STATE_FRAMEDOCKED);
        dockableFrame.getContext().setInitSide(DockContext.DOCK_SIDE_EAST);
        dockableFrame.getContext().setInitIndex(0);
    }
    dockableFrame.addDockableFrameListener(new DockableFrameAdapter() {

        @Override
        public void dockableFrameRemoved(DockableFrameEvent event) {
            if (log.isDebugEnabled()) {
                log.debug("Frame removed event on " + pageComponent.getId());
            }
            fireClosed(pageComponent);
        }

        @Override
        public void dockableFrameActivated(DockableFrameEvent e) {
            if (log.isDebugEnabled()) {
                log.debug("Frame activated event on " + pageComponent.getId());
            }
            fireFocusLost(JideApplicationPage.this.workspaceComponent);
            fireFocusGained(pageComponent);
        }

        @Override
        public void dockableFrameDeactivated(DockableFrameEvent e) {
            if (log.isDebugEnabled()) {
                log.debug("Frame deactivated event on " + pageComponent.getId());
            }
            fireFocusLost(pageComponent);
        }
    });

    dockableFrame.getContentPane().setLayout(new BorderLayout());
    dockableFrame.getContentPane().add(pageComponent.getControl());

    // This is where the view specific toolbar and menu bar get added. Note,
    // that this is different from the editors. With the views they are part
    // of the dockable frame, but with editors we add them to the editor
    // pane itself in EditorComponentPane
    if (pageComponent instanceof JideAbstractView) {
        JideAbstractView view = (JideAbstractView) pageComponent;
        dockableFrame.setTitleBarComponent(view.getViewToolBar());
        dockableFrame.setJMenuBar(view.getViewMenuBar());
        final DockableFrame ff = dockableFrame;
        view.getDescriptor().addPropertyChangeListener("title", new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                ff.setTitle(evt.getNewValue().toString());
                ff.setTabTitle(pageComponent.getDisplayName());
            }

        });
    }
    return dockableFrame;
}

From source file:org.jboss.tools.openshift.internal.ui.wizard.newapp.fromimage.ApplicationSourceFromImageModel.java

@SuppressWarnings("unchecked")
@Override//  w w  w  .j  a  v  a  2s  .  com
public void propertyChange(PropertyChangeEvent evt) {
    if (evt == null)
        return;
    super.propertyChange(evt);
    switch (evt.getPropertyName()) {
    case IResourceLabelsPageModel.PROPERTY_LABELS:
        setLabels((List<Label>) evt.getNewValue());
        break;
    case IApplicationSourceListPageModel.PROPERTY_SELECTED_APP_SOURCE:
        handleSelectedAppSource(evt);
        break;
    case IApplicationSourceListPageModel.PROPERTY_PROJECT:
        setProject((IProject) evt.getNewValue());
        break;
    case IApplicationSourceListPageModel.PROPERTY_ECLIPSE_PROJECT:
        handleEclipseProject(evt);
        break;
    }
}