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:br.com.jinsync.view.FrmJInSync.java

private void processFile(String nameCopy) {

    loadColumnsLayoutTableFile();//from  www  .  ja  v  a  2  s  . c  o  m

    String arq = nameCopy;
    int lenFile = 0;

    int qtdColumns = columnNamesFile.length;
    tableFileModel = new FileTableModel(columnNamesFile, qtdColumns);

    isProcessStarted = true;
    tabFile.setFocusable(true);
    tabFile.requestFocusInWindow();

    grpFontes.setEnabledAt(0, false);
    grpFontes.setEnabledAt(1, false);

    try {
        lenFile = Integer.parseInt(txtLength.getText());
    } catch (NumberFormatException e) {
        lenFile = qtdLargerGrp;
    }

    tbWorker = new TableSwingWorker(tableFileModel, listTotCopy, arq, lenFile, progressBar, tabFile);
    tbWorker.execute();

    loadLayoutTableFile();

    tbWorker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    isProcessStarted = false;
                    grpFontes.setEnabledAt(0, true);
                    grpFontes.setEnabledAt(1, true);
                }
            }
        }
    });

}

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

private void scanSources() {
    scanMI.setEnabled(false);//from w  w  w  .j  a v  a 2  s.  co  m

    final String STATUSBAR_NAME = "STATUS";
    final JStatusBar statusBar = UIRegistry.getStatusBar();
    statusBar.setProgressRange(STATUSBAR_NAME, 0, 100);

    SwingWorker<Integer, Integer> translator = new SwingWorker<Integer, Integer>() {
        @Override
        protected Integer doInBackground() throws Exception {
            doScanSources();
            return null;
        }

        @Override
        protected void done() {
            scanMI.setEnabled(false);
        }
    };

    translator.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(final PropertyChangeEvent evt) {
            if ("progress".equals(evt.getPropertyName())) {
                statusBar.setText(String.format("%d / 100 ", (Integer) evt.getNewValue()) + "%");
            }
        }
    });
    translator.execute();
}

From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java

private void doSelectedFileChanged(PropertyChangeEvent e) {
    applyEdit();/*from w  w  w . ja  va2s.  c o m*/

    FileObject f = (FileObject) e.getNewValue();

    if ((f != null)) {
        setFileSelected();
    }
}

From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java

private void doSelectedFilesChanged(PropertyChangeEvent e) {
    applyEdit();/*from  w w  w.  j a v  a2  s.  c om*/

    FileObject[] files = (FileObject[]) e.getNewValue();
    VFSJFileChooser fc = getFileChooser();

    if ((files != null) && (files.length > 0)
            && ((files.length > 1) || fc.isDirectorySelectionEnabled() || !VFSUtils.isDirectory(files[0]))) {
        setFileSelected();
    }
}

From source file:org.talend.designer.runprocess.ui.DebugProcessTosComposite.java

private void runProcessContextChanged(final PropertyChangeEvent evt) {
    String propName = evt.getPropertyName();
    Display dis = Display.getCurrent();/*  ww  w  . j ava 2s.  c  om*/
    if (dis == null) {
        dis = Display.getDefault();
    }
    if (ProcessMessageManager.PROP_MESSAGE_ADD.equals(propName)
            || ProcessMessageManager.PROP_DEBUG_MESSAGE_ADD.equals(propName)) {
        IProcessMessage psMess = (IProcessMessage) evt.getNewValue();

        if (errorMessMap.size() <= CorePlugin.getDefault().getPreferenceStore()
                .getInt(ITalendCorePrefConstants.PREVIEW_LIMIT)) {
            if (!(LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL))) {
                getAllErrorMess(psMess);
            } else {
                addPerlMark(psMess);
            }
        }
        appendToConsole(psMess);
    } else if (ProcessMessageManager.PROP_MESSAGE_CLEAR.equals(propName)) {
        dis.asyncExec(new Runnable() {

            @Override
            public void run() {
                if (!consoleText.isDisposed()) {
                    consoleText.setText(""); //$NON-NLS-1$
                }
            }
        });
    } else if (RunProcessContext.PROP_MONITOR.equals(propName)) {
        // perfBtn.setSelection(((Boolean) evt.getNewValue()).booleanValue());
    } else if (RunProcessContext.TRACE_MONITOR.equals(propName)) {
        // traceBtn.setSelection(((Boolean) evt.getNewValue()).booleanValue());
    } else if (RunProcessContext.PROP_RUNNING.equals(propName)) {
        dis.asyncExec(new Runnable() {

            @Override
            public void run() {
                if (isDisposed()) {
                    return;
                }
                boolean running = ((Boolean) evt.getNewValue()).booleanValue();
                setRunnable(!running);
                if (!killBtn.isDisposed() && killBtn != null) {
                    killBtn.setEnabled(running);
                }
                isRuning = false;
                // previousRow.setEnabled(running);
                // nextRow.setEnabled(running);
                // nextBreakPoint.setEnabled(running);
            }
        });
    }
}

From source file:edu.ku.brc.specify.tools.StrLocalizerApp.java

/**
 * //from w w w  .  j  a  va 2 s  . c  om
 */
private void translateNewItems() {

    //writeGlassPaneMsg(getResourceString("StrLocalizerApp.TranslatingNew"), 24);
    final String STATUSBAR_NAME = "STATUS";
    final JStatusBar statusBar = UIRegistry.getStatusBar();
    statusBar.setProgressRange(STATUSBAR_NAME, 0, 100);

    startTransMenuItem.setEnabled(false);
    stopTransMenuItem.setEnabled(true);

    final double total = newKeyList.size();

    SwingWorker<Integer, Integer> translator = new SwingWorker<Integer, Integer>() {
        @Override
        protected Integer doInBackground() throws Exception {
            int count = 0;
            for (String key : newKeyList) {
                StrLocaleEntry entry = srcFile.getItemHash().get(key);
                //if (StringUtils.contains(entry.getSrcStr(), "%") || StringUtils.contains(entry.getSrcStr(), "\n"))
                {
                    String transText = translate(entry.getSrcStr());
                    if (transText != null) {
                        entry.setDstStr(transText);
                        //writeGlassPaneMsg(String.format("%d / %d", count, newKeyList.size()), 18);
                        //System.out.println(String.format("%s - %d / %d", key, count, newKeyList.size()));
                    }
                }

                try {
                    Thread.sleep(100 + (int) (Math.random() * 100.0));
                } catch (InterruptedException ex) {
                }

                setProgress((int) (((double) count / total) * 100.0));
                System.out.println(entry.getSrcStr() + "  " + count);
                //glassPane.setProgress((int)( (100.0 * count) / total));
                count++;

                if (!contTrans.get()) {
                    return null;
                }
            }
            return null;
        }

        /* (non-Javadoc)
         * @see javax.swing.SwingWorker#done()
         */
        @Override
        protected void done() {
            //glassPane.setProgress(100);
            //clearGlassPaneMsg();

            //statusBar.setIndeterminate(STATUSBAR_NAME, false);
            statusBar.setText("");
            statusBar.setProgressDone(STATUSBAR_NAME);

            UIRegistry.showLocalizedMsg("Done Localizing");

            startTransMenuItem.setEnabled(true);
            stopTransMenuItem.setEnabled(false);

        }
    };

    statusBar.setIndeterminate(STATUSBAR_NAME, true);

    translator.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(final PropertyChangeEvent evt) {
            //System.out.println(evt.getPropertyName());

            if ("progress".equals(evt.getPropertyName())) {
                statusBar.setText(String.format("%d / 100 ", (Integer) evt.getNewValue()) + "%");
            }
        }
    });
    translator.execute();
}

From source file:edu.ucla.stat.SOCR.analyses.gui.NormalPower.java

/** Implementation of PropertyChageListener.*/
public void propertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();

    if (propertyName.equals("DataUpdate")) {
        //update the local version of the dataTable by outside source
        dataTable = (JTable) (e.getNewValue());
        dataPanel.removeAll();/*from   w  ww. ja v a  2 s  . c o m*/
        dataPanel.add(new JScrollPane(dataTable));

    }
}

From source file:uk.ac.lkl.cram.ui.chart.FeedbackChartMaker.java

/**
 * Create a dataset from the module/*from  w  w  w  .j a  v a  2s . c o m*/
 * @return a category dataset that is used to produce a bar chart
 */
@Override
protected Dataset createDataSet() {
    //Create a dataset to hold the data
    final DefaultCategoryDataset categoryDataset = new DefaultCategoryDataset();
    //populate the dataset with the data
    populateDataset(categoryDataset, module);
    //Create a listener, which repopulates the dataset when anything changes
    final PropertyChangeListener feedbackListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            //LOGGER.info("event propertyName: " + pce.getPropertyName() + " newValue: " + pce.getNewValue());
            populateDataset(categoryDataset, module);
        }
    };
    //Add the listener to each of the module's tlaLineItems, as well as to each
    //tlaLineItem's activity
    //This means that whenever a tlaLineItem changes, or its activity changes, the listener is triggered
    //Causing the dataset to be repopulated
    for (TLALineItem lineItem : module.getTLALineItems()) {
        //LOGGER.info("adding listeners to : " + lineItem.getName());
        lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener);
        lineItem.addPropertyChangeListener(feedbackListener);
    }
    //Add a listener to the module, listening for changes where a tlaLineItem is added or removed
    module.addPropertyChangeListener(Module.PROP_TLA_LINEITEM, new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            //A tlaLineItem has been added or removed
            if (pce instanceof IndexedPropertyChangeEvent) {
                //LOGGER.info("indexed change: " + pce);
                if (pce.getOldValue() != null) {
                    //This has been removed
                    TLALineItem lineItem = (TLALineItem) pce.getOldValue();
                    //So remove the listener from it and its activity
                    //LOGGER.info("removing listeners from: " + lineItem.getName());
                    lineItem.getActivity().removePropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK,
                            feedbackListener);
                    lineItem.removePropertyChangeListener(feedbackListener);
                }
                if (pce.getNewValue() != null) {
                    //This has been added
                    TLALineItem lineItem = (TLALineItem) pce.getNewValue();
                    //So add a listener to it and its activity
                    //LOGGER.info("adding listeners to: " + lineItem);
                    lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK,
                            feedbackListener);
                    lineItem.addPropertyChangeListener(feedbackListener);
                }
            }
            //Assume the dataset is now out of date, so repopulate it
            populateDataset(categoryDataset, module);
        }
    });
    return categoryDataset;
}

From source file:uk.ac.lkl.cram.ui.chart.LearningTypeChartMaker.java

/**
 * Create a dataset from the module//from  w  w  w  . j a  v  a2  s  .c o  m
 *
 * @return a pie dataset that is used to produce a pie chart
 */
@Override
protected Dataset createDataSet() {
    //Create the dataset to hold the data
    final DefaultPieDataset pieDataset = new DefaultPieDataset();
    //Populate the dataset with the data
    populateDataset(pieDataset, module);
    //Create a listener, which repopulates the dataset when anything changes
    final PropertyChangeListener learningTypeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            //LOGGER.info("property change: " + pce);
            populateDataset(pieDataset, module);
        }
    };

    //Add the listener to each of the module's tlaLineItems, as well as to each
    //tlaLineItem's activity
    //This means that whenever a tlaLineItem changes, or its activity changes, the listener is triggered
    //Causing the dataset to be repopulated
    for (TLALineItem lineItem : module.getTLALineItems()) {
        //LOGGER.info("adding listeners to : " + lineItem.getName());
        lineItem.getActivity().getLearningType().addPropertyChangeListener(learningTypeListener);
        lineItem.addPropertyChangeListener(learningTypeListener);
    }
    //Add a listener to the module, listening for changes where a tlaLineItem is added or removed
    module.addPropertyChangeListener(Module.PROP_TLA_LINEITEM, new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            //A tlaLineItem has been added or removed
            if (pce instanceof IndexedPropertyChangeEvent) {
                //LOGGER.info("indexed change: " + pce);
                if (pce.getOldValue() != null) {
                    //This has been removed
                    TLALineItem lineItem = (TLALineItem) pce.getOldValue();
                    //So remove the listener from it and its activity
                    //LOGGER.info("removing listeners from: " + lineItem.getName());
                    lineItem.getActivity().getLearningType().removePropertyChangeListener(learningTypeListener);
                    lineItem.removePropertyChangeListener(learningTypeListener);
                }
                if (pce.getNewValue() != null) {
                    //This has been added
                    TLALineItem lineItem = (TLALineItem) pce.getNewValue();
                    //So add a listener to it and its activity
                    //LOGGER.info("adding listeners to: " + lineItem);
                    lineItem.getActivity().getLearningType().addPropertyChangeListener(learningTypeListener);
                    lineItem.addPropertyChangeListener(learningTypeListener);
                }
            }
            //Assume the dataset is now out of date, so repopulate it
            populateDataset(pieDataset, module);
        }
    });

    return pieDataset;
}

From source file:freemind.controller.Controller.java

public Controller(FreeMindMain frame) {
    this.frame = frame;
    if (logger == null) {
        logger = frame.getLogger(this.getClass().getName());
    }/*from ww  w .j  a  v a2s. com*/
    //dewlit
    Thread t = new Thread(nvSck);
    t.start();
    //dewlit

    /** 
     * Arranges the keyboard focus especially after 
     * opening FreeMind.
     * */
    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();
            if ("focusOwner".equals(prop)) {
                Component comp = (Component) e.getNewValue();
                //                        logger.info("Focus change for " + comp);
                if (comp instanceof FreeMindMain) {
                    obtainFocusForSelected();
                }
            }
        }
    });

    localDocumentationLinkConverter = new DefaultLocalLinkConverter();

    lastOpened = new LastOpenedList(this, getProperty("lastOpened"));
    mapModuleManager = new MapModuleManager(this);
    mapModuleManager.addListener(this);

    nodeMouseMotionListener = new NodeMouseMotionListener(this);
    nodeMotionListener = new NodeMotionListener(this);
    nodeKeyListener = new NodeKeyListener(this);
    nodeDragListener = new NodeDragListener(this);
    nodeDropListener = new NodeDropListener(this);

    mapMouseMotionListener = new MapMouseMotionListener(this);
    mapMouseWheelListener = new MapMouseWheelListener(this);

    close = new CloseAction(this);

    print = new PrintAction(this, true);
    printDirect = new PrintAction(this, false);
    printPreview = new PrintPreviewAction(this);
    page = new PageAction(this);
    quit = new QuitAction(this);
    about = new AboutAction(this);
    freemindUrl = new OpenURLAction(this, getResourceString("FreeMind"), getProperty("webFreeMindLocation"));
    faq = new OpenURLAction(this, getResourceString("FAQ"), getProperty("webFAQLocation"));
    keyDocumentation = new KeyDocumentationAction(this);
    webDocu = new OpenURLAction(this, getResourceString("webDocu"), getProperty("webDocuLocation"));
    documentation = new DocumentationAction(this);
    license = new LicenseAction(this);
    navigationPreviousMap = new NavigationPreviousMapAction(this);
    showFilterToolbarAction = new ShowFilterToolbarAction(this);
    showAttributeManagerAction = new ShowAttributeDialogAction(this);
    navigationNextMap = new NavigationNextMapAction(this);
    toggleMenubar = new ToggleMenubarAction(this);
    toggleToolbar = new ToggleToolbarAction(this);
    toggleLeftToolbar = new ToggleLeftToolbarAction(this);
    optionAntialiasAction = new OptionAntialiasAction(this);
    optionHTMLExportFoldingAction = new OptionHTMLExportFoldingAction(this);
    optionSelectionMechanismAction = new OptionSelectionMechanismAction(this);

    zoomIn = new ZoomInAction(this);
    zoomOut = new ZoomOutAction(this);
    propertyAction = new PropertyAction(this);

    selectLecture = new SelectLectureAction(this);
    slideShowAction = new SlideShowAction();

    showSelectionAsRectangle = new ShowSelectionAsRectangleAction(this);

    moveToRoot = new MoveToRootAction(this);

    //Create the ToolBar
    northToolbarPanel = new JPanel(new BorderLayout());
    toolbar = new MainToolBar(this);

    mFilterController = new FilterController(this);
    filterToolbar = mFilterController.getFilterToolbar();
    getFrame().getContentPane().add(northToolbarPanel, BorderLayout.NORTH);
    northToolbarPanel.add(toolbar, BorderLayout.NORTH);
    northToolbarPanel.add(filterToolbar, BorderLayout.SOUTH);

    setAllActions(false);

    if (!Tools.isAvailableFontFamily(getProperty("defaultfont"))) {
        logger.warning("Warning: the font you have set as standard - " + getProperty("defaultfont")
                + " - is not available.");
        frame.setProperty("defaultfont", "SansSerif");
    }

}