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:org.eclipse.php.composer.ui.editor.composer.AuthorSection.java

@Override
public void propertyChange(PropertyChangeEvent e) {
    if (e.getPropertyName().startsWith("authors")) { //$NON-NLS-1$
        // refresh();
    }//from   ww w . j a va 2  s.co m
}

From source file:org.lunifera.runtime.common.state.impl.GlobalDataState.java

@Override
public void propertyChange(PropertyChangeEvent event) {
    Object object = event.getSource();
    Class<?> objClass = object.getClass();
    try {/* ww  w . j a  va 2 s.c  o m*/
        if (DtoUtils.isDisposeField(objClass, event.getPropertyName())) {
            handleDispose(event);
            return;
        }
    } catch (SecurityException ignoreIt) {
        LOGGER.error("{}", ignoreIt);
    }

    handleDirty(event);
}

From source file:wsattacker.sso.openid.attacker.server.OpenIdServer.java

@Override
public void propertyChange(PropertyChangeEvent pce) {
    String propertyName = pce.getPropertyName();
    Object newValue = pce.getNewValue();
    Object oldValue = pce.getOldValue();
    switch (propertyName) {
    case OpenIdServerConfiguration.PROP_HTMLCONFIGURATION:
        HtmlDiscoveryConfiguration oldHtmlConfig = (HtmlDiscoveryConfiguration) oldValue;
        HtmlDiscoveryConfiguration newHtmlConfig = (HtmlDiscoveryConfiguration) newValue;
        LOG.info("Changed HTML Discovery Configuration");
        oldHtmlConfig.removePropertyChangeListener(this);
        newHtmlConfig.addPropertyChangeListener(this);
        processor.setHtmlConfiguration(newHtmlConfig);
        break;//from   w  w w. j  a v a 2s.  c  o m
    case OpenIdServerConfiguration.PROP_XRDSCONFIGURATION:
        XrdsConfiguration oldConfig = (XrdsConfiguration) oldValue;
        XrdsConfiguration newConfig = (XrdsConfiguration) newValue;
        LOG.info("Changed XRDS Configuration");
        oldConfig.removePropertyChangeListener(this);
        newConfig.addPropertyChangeListener(this);
        processor.setXrdsConfiguration(newConfig);
        processor.setEndpoint(newConfig.getBaseUrl());
        break;
    case XrdsConfiguration.PROP_BASEURL:
        LOG.info(String.format("Changed Endpoint URI from '%s' to '%s'", oldValue, newValue));
        processor.setEndpoint((String) pce.getNewValue());
        break;
    case OpenIdServerConfiguration.PROP_ASSOCIATIONEXPIRATIONINSECONDS:
        LOG.info(String.format("Changed Association expiration time from %ss to %ss", oldValue, newValue));
        processor.setExpiresIn((int) pce.getNewValue());
        break;
    case OpenIdServerConfiguration.PROP_VALIDUSER:
        LOG.info("Changed valid user!");
        processor.setValidUser((User) newValue);
        break;
    case OpenIdServerConfiguration.PROP_ASSOCIATIONPREFIX:
        LOG.info(String.format("Association Prefix changed from '%s' to '%s'", oldValue, newValue));
        store.setAssociationPrefix((String) newValue);
        break;
    default:
        break;
    }
}

From source file:org.polymap.core.project.ui.project.MapStatusDecorator.java

public MapStatusDecorator() {
    decorated = new MapMaker().weakValues().initialCapacity(128).makeMap();

    EventManager.instance().subscribe(this, new EventFilter<PropertyChangeEvent>() {
        public boolean apply(PropertyChangeEvent ev) {
            try {
                String prop = ev.getPropertyName();
                return ev.getSource() instanceof IMap && decorated.containsKey(((IMap) ev.getSource()).id())
                        && (prop.equals(IMap.PROP_LAYERS) || prop.equals(Visible.PROP_VISIBLE));
            } catch (NoSuchEntityException e) {
                return false;
            }/*from w ww  .  j a va  2s. c o  m*/
        }
    });

    //        Polymap.getSessionDisplay().asyncExec( new Runnable() {
    //            public void run() {
    //                page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    //                // init activeMaps
    //                for (IEditorReference editor : page.getEditorReferences()) {
    //                    try {
    //                        IMap map = (IMap)editor.getEditorInput().getAdapter( IMap.class );
    //                        if (map != null) {
    //                            activeMaps.put( map.id(), map );
    //                        }
    //                    }
    //                    catch (PartInitException e) {
    //                        throw new RuntimeException( e );
    //                    }
    //                }
    //                // install listener
    //                assert partListener == null;
    //                page.addPartListener( partListener = new PartListenerAdapter() {
    //                    @Override
    //                    public void partClosed( IWorkbenchPart part ) {
    //                        if (part instanceof IEditorPart) {
    //                            IMap map = (IMap)((IEditorPart)part).getEditorInput().getAdapter( IMap.class );
    //                            if (map != null) {
    //                                activeMaps.remove( map.id() );
    //                                fireLabelProviderChanged( new LabelProviderChangedEvent( MapStatusDecorator.this ) );
    //                            }
    //                        }
    //                    }
    //                    @Override
    //                    public void partOpened( IWorkbenchPart part ) {
    //                        if (part instanceof IEditorPart) {
    //                            IMap map = (IMap)((IEditorPart)part).getEditorInput().getAdapter( IMap.class );
    //                            if (map != null) {
    //                                activeMaps.put( map.id(), map );
    //                                fireLabelProviderChanged( new LabelProviderChangedEvent( MapStatusDecorator.this ) );
    //                            }
    //                        }
    //                    }
    //                });
    //            }
    //        });
}

From source file:edu.ku.brc.specify.tasks.WebSearchTask.java

/**
 * //from   w ww .  j  a  v  a 2s  .  c om
 */
public void createAndSendBackup() {
    BackupServiceFactory.getInstance().doBackUp(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("Done")) {
                startCompression((String) evt.getNewValue());
            }
        }
    });
}

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

/**
 * // w w w  .j  a  v  a  2  s  .  co 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:de.tudarmstadt.ukp.clarin.webanno.webapp.standalone.StandaloneShutdownDialog.java

private void displayShutdownDialog() {
    String serverId = ServerDetector.getServerId();
    log.info("Running in: " + (serverId != null ? serverId : "unknown server"));
    log.info("Console: " + ((System.console() != null) ? "available" : "not available"));
    log.info("Headless: " + (GraphicsEnvironment.isHeadless() ? "yes" : "no"));

    // Show this only when run from the standalone JAR via a double-click
    if (System.console() == null && !GraphicsEnvironment.isHeadless() && ServerDetector.isWinstone()) {
        log.info("If you are running WebAnno in a server environment, please use '-Djava.awt.headless=true'");

        EventQueue.invokeLater(new Runnable() {
            @Override//from   w  w w .ja v a2s .  c  om
            public void run() {
                final JOptionPane optionPane = new JOptionPane(new JLabel(
                        "<HTML>WebAnno is running now and can be accessed via <a href=\"http://localhost:8080\">http://localhost:8080</a>.<br>"
                                + "WebAnno works best with the browsers Google Chrome or Safari.<br>"
                                + "Use this dialog to shut WebAnno down.</HTML>"),
                        JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_OPTION, null,
                        new String[] { "Shutdown" });

                final JDialog dialog = new JDialog((JFrame) null, "WebAnno", true);
                dialog.setContentPane(optionPane);
                dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
                dialog.addWindowListener(new WindowAdapter() {
                    @Override
                    public void windowClosing(WindowEvent we) {
                        // Avoid closing window by other means than button
                    }
                });
                optionPane.addPropertyChangeListener(new PropertyChangeListener() {
                    @Override
                    public void propertyChange(PropertyChangeEvent aEvt) {
                        if (dialog.isVisible() && (aEvt.getSource() == optionPane)
                                && (aEvt.getPropertyName().equals(JOptionPane.VALUE_PROPERTY))) {
                            System.exit(0);
                        }
                    }
                });
                dialog.pack();
                dialog.setVisible(true);
            }
        });
    } else {
        log.info("Running in server environment or from command line: disabling interactive shutdown dialog.");
    }
}

From source file:com.hexidec.ekit.component.PropertiesDialog.java

public PropertiesDialog(Window parent, String[] fields, String[] types, String[] values, String title,
        boolean bModal) {
    super(parent, title);
    setModal(bModal);/*ww w  . ja  v  a 2 s.co  m*/
    htInputFields = new Hashtable<String, JComponent>();
    final Object[] buttonLabels = { Translatrix.getTranslationString("DialogAccept"),
            Translatrix.getTranslationString("DialogCancel") };
    List<Object> panelContents = new ArrayList<Object>();
    for (int iter = 0; iter < fields.length; iter++) {
        String fieldName = fields[iter];
        String fieldType = types[iter];
        JComponent fieldComponent;
        JComponent panelComponent = null;
        if (fieldType.equals("text") || fieldType.equals("integer")) {
            fieldComponent = new JTextField(3);
            if (values[iter] != null && values[iter].length() > 0) {
                ((JTextField) (fieldComponent)).setText(values[iter]);
            }

            if (fieldType.equals("integer")) {
                ((AbstractDocument) ((JTextField) (fieldComponent)).getDocument())
                        .setDocumentFilter(new DocumentFilter() {

                            @Override
                            public void insertString(FilterBypass fb, int offset, String text,
                                    AttributeSet attrs) throws BadLocationException {
                                replace(fb, offset, 0, text, attrs);
                            }

                            @Override
                            public void replace(FilterBypass fb, int offset, int length, String text,
                                    AttributeSet attrs) throws BadLocationException {

                                if (StringUtils.isNumeric(text)) {
                                    super.replace(fb, offset, length, text, attrs);
                                }

                            }

                        });
            }
        } else if (fieldType.equals("bool")) {
            fieldComponent = new JCheckBox(fieldName);
            if (values[iter] != null) {
                ((JCheckBox) (fieldComponent)).setSelected(values[iter] == "true");
            }
            panelComponent = fieldComponent;
        } else if (fieldType.equals("combo")) {
            fieldComponent = new JComboBox();
            if (values[iter] != null) {
                StringTokenizer stParse = new StringTokenizer(values[iter], ",", false);
                while (stParse.hasMoreTokens()) {
                    ((JComboBox) (fieldComponent)).addItem(stParse.nextToken());
                }
            }
        } else {
            fieldComponent = new JTextField(3);
        }
        htInputFields.put(fieldName, fieldComponent);
        if (panelComponent == null) {
            panelContents.add(fieldName);
            panelContents.add(fieldComponent);
        } else {
            panelContents.add(panelComponent);
        }
    }
    jOptionPane = new JOptionPane(panelContents.toArray(), JOptionPane.QUESTION_MESSAGE,
            JOptionPane.OK_CANCEL_OPTION, null, buttonLabels, buttonLabels[0]);

    setContentPane(jOptionPane);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

    jOptionPane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();
            if (isVisible() && (e.getSource() == jOptionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY)
                    || prop.equals(JOptionPane.INPUT_VALUE_PROPERTY))) {
                Object value = jOptionPane.getValue();
                if (value == JOptionPane.UNINITIALIZED_VALUE) {
                    return;
                }
                if (value.equals(buttonLabels[0])) {
                    setVisible(false);
                } else {
                    setVisible(false);
                }
            }
        }
    });
    this.pack();
    setLocation(SwingUtilities.getPointForCentering(this, parent));
}

From source file:org.polymap.core.mapeditor.tooling.edit.RegularPolygonTool.java

/**
 * Called when selected layer of parent tool has changed (during init or
 * by the user)./* w  ww  .  j  a  va2  s . co  m*/
 */
@Override
public void propertyChange(PropertyChangeEvent ev) {
    if (ev.getPropertyName().equals(BaseLayerEditorTool.PROP_LAYER_ACTIVATED)) {
        // delay triggerTool() until UI has been created
        Polymap.getSessionDisplay().asyncExec(new Runnable() {
            public void run() {
                boolean activate = false;
                boolean enable = false;
                // Polygone?
                if (parentTool.getDrawControl().getHandler() instanceof PolygonHandler) {
                    enable = true;
                    activate = Objects
                            .firstNonNull(getSite().getMemento().getBoolean(PROP_ACTIVE), Boolean.FALSE)
                            .booleanValue();
                }

                // reset tool if layer of parentTool has changed
                if (isActive() && activate) {
                    getSite().triggerTool(getSite().getToolPath(), false);
                }

                getSite().enableTool(getSite().getToolPath(), enable);
                getSite().triggerTool(getSite().getToolPath(), activate);
            }
        });
    }
}

From source file:com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel.java

public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals("script") && !updating) {
        updating = true;/*from w  w w .j a v  a  2s  .co m*/
        editor.getEditArea().setText((String) evt.getNewValue());
        updating = false;
    }

    super.propertyChange(evt);
}