Example usage for java.beans PropertyChangeEvent getPropertyName

List of usage examples for java.beans PropertyChangeEvent getPropertyName

Introduction

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

Prototype

public String getPropertyName() 

Source Link

Document

Gets the programmatic name of the property that was changed.

Usage

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");
            }/*  w  w  w  . j  av a2 s.c  om*/
        }
    });

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

    return genericFileSystemView;
}

From source file:edu.ku.brc.specify.config.SpecifyGUIDGeneratorFactory.java

/**
 * @param pcl// ww w .  j a v a  2 s.com
 * @param classes
 */
public static void buildAllGUIDsAynch(final PropertyChangeListener pcl, final ArrayList<Class<?>> classes) {
    final String COUNT = "COUNT";

    final GhostGlassPane glassPane = UIRegistry.writeGlassPaneMsg(getResourceString("SETTING_GUIDS"),
            UIRegistry.STD_FONT_SIZE);
    glassPane.setProgress(0);

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (SubPaneMgr.getInstance().aboutToShutdown()) {
                Taskable task = TaskMgr.getTask("Startup");
                if (task != null) {
                    SubPaneIFace splash = edu.ku.brc.specify.tasks.StartUpTask
                            .createFullImageSplashPanel(task.getTitle(), task);
                    SubPaneMgr.getInstance().addPane(splash);
                    SubPaneMgr.getInstance().showPane(splash);
                }

                final GUIDWorker worker = new GUIDWorker() {
                    protected Integer doInBackground() throws Exception {
                        if (getInstance() instanceof SpecifyGUIDGeneratorFactory) {
                            SpecifyGUIDGeneratorFactory guidGen = (SpecifyGUIDGeneratorFactory) getInstance();
                            guidGen.buildGUIDs(this);
                        }
                        return null;
                    }

                    @Override
                    public void propertyChange(PropertyChangeEvent evt) {
                        if (evt.getPropertyName().equals("COUNT")) {
                            firePropertyChange("COUNT", 0, evt.getNewValue());
                        }
                    }

                    @Override
                    protected void done() {
                        glassPane.setProgress(100);
                        UIRegistry.clearGlassPaneMsg();
                        if (pcl != null) {
                            pcl.propertyChange(new PropertyChangeEvent(this, "complete", "true", "true"));
                        }
                    }
                };

                worker.addPropertyChangeListener(new PropertyChangeListener() {
                    public void propertyChange(final PropertyChangeEvent evt) {
                        if (COUNT.equals(evt.getPropertyName())) {
                            glassPane.setProgress((int) (((Integer) evt.getNewValue() * 100.0)
                                    / (double) CATEGORY_TYPE.values().length));
                        }
                    }
                });
                worker.execute();
            }
        }
    });

}

From source file:net.ftb.minecraft.MCInstaller.java

public static void setupNewStyle(final String installPath, final ModPack pack, final boolean isLegacy,
        final LoginResponse RESPONSE) {
    List<DownloadInfo> assets = gatherAssets(new File(installPath),
            pack.getMcVersion(Settings.getSettings().getPackVer(pack.getDir())), installPath);
    if (assets != null && assets.size() > 0) {
        Logger.logInfo("Checking/Downloading " + assets.size() + " assets, this may take a while...");

        final ProgressMonitor prog = new ProgressMonitor(LaunchFrame.getInstance(), "Downloading Files...", "",
                0, 100);/*ww  w . ja  v  a2  s.  c  om*/
        prog.setMaximum(assets.size() * 100);

        final AssetDownloader downloader = new AssetDownloader(prog, assets) {
            @Override
            public void done() {
                try {
                    prog.close();
                    if (get()) {
                        Logger.logInfo("Asset downloading complete");
                        launchMinecraft(installPath, pack, RESPONSE, isLegacy);
                    } else {
                        ErrorUtils.tossError("Error occurred during downloading the assets");
                    }
                } catch (CancellationException e) {
                    Logger.logInfo("Asset download interrupted by user");
                } catch (Exception e) {
                    ErrorUtils.tossError("Failed to download files.", e);
                } finally {
                    LaunchFrame.getInstance().getEventBus().post(new EnableObjectsEvent());
                }
            }
        };

        downloader.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (prog.isCanceled()) {
                    downloader.cancel(false);
                    prog.close();
                } else if (!downloader.isCancelled()) {
                    if ("ready".equals(evt.getPropertyName()))
                        prog.setProgress(downloader.getReady());
                    if ("status".equals(evt.getPropertyName()))
                        prog.setNote(downloader.getStatus());
                }
            }
        });

        downloader.execute();
    } else if (assets == null) {
        LaunchFrame.getInstance().getEventBus().post(new EnableObjectsEvent());
    } else {
        launchMinecraft(installPath, pack, RESPONSE, isLegacy);
    }
}

From source file:MainClass.java

public void propertyChange(PropertyChangeEvent changeEvent) {
    String changeName = changeEvent.getPropertyName();
    if (changeName.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
        File file = (File) changeEvent.getNewValue();
        if (file != null) {
            setText(file.getName());//from  w ww.ja  v a2s. co  m
        }
    }
}

From source file:AbstractButtonPropertyChangeListener.java

License:asdf

public void propertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();
    System.out.println("Property Name: " + propertyName);
    if (e.getPropertyName().equals(AbstractButton.TEXT_CHANGED_PROPERTY)) {
        String newText = (String) e.getNewValue();
        String oldText = (String) e.getOldValue();
        System.out.println(oldText + " changed to " + newText);
    } else if (e.getPropertyName().equals(AbstractButton.ICON_CHANGED_PROPERTY)) {
        Icon icon = (Icon) e.getNewValue();
        if (icon instanceof ImageIcon) {
            System.out.println("New icon is an image");
        }//from www  . j av a2 s .  c om
    }
}

From source file:MainClass.java

public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
    String propertyName = propertyChangeEvent.getPropertyName();
    if (propertyName.equals(JInternalFrame.IS_ICON_PROPERTY)) {
        System.out.println("Icon property changed. React.");
    }// ww  w  . ja v  a 2 s . c  o m
}

From source file:PackProgressMonitor.java

public void propertyChange(PropertyChangeEvent event) {
    if (event.getPropertyName().equals(Pack200.Packer.PROGRESS)) {
        String newValue = (String) event.getNewValue();
        int value = Integer.parseInt(newValue);
        this.setProgress(value);
    }/*from   ww  w . j  a v a2  s  .  c  o  m*/
}

From source file:ActionChangedListener.java

public void propertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();
    System.out.println(propertyName);
    if (e.getPropertyName().equals(Action.NAME)) {
        String text = (String) e.getNewValue();
        button.setText(text);/*  w w  w .  j a  v a 2s  . co m*/
        button.repaint();
    } else if (propertyName.equals("enabled")) {
        Boolean enabledState = (Boolean) e.getNewValue();
        button.setEnabled(enabledState.booleanValue());
        button.repaint();
    } else if (e.getPropertyName().equals(Action.SMALL_ICON)) {
        Icon icon = (Icon) e.getNewValue();
        button.setIcon(icon);
        button.invalidate();
        button.repaint();
    }
}

From source file:VetoableChangeListenerDemo.java

public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
    String name = ev.getPropertyName();
    if (name.equals(JInternalFrame.IS_ICON_PROPERTY) && (ev.getNewValue() == Boolean.TRUE)) {
        System.out.println("JInternalFrame.IS_ICON_PROPERTY");
    }/* w w w .j a  v a2  s.  co m*/
}

From source file:Main.java

public void propertyChange(PropertyChangeEvent evt) {
    System.out.println("Name      = " + evt.getPropertyName());
    System.out.println("Old Value = " + evt.getOldValue());
    System.out.println("New Value = " + evt.getNewValue());
}