Java Code Examples for java.beans.PropertyChangeEvent

The following are top voted examples for showing how to use java.beans.PropertyChangeEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: VariablesPanel.java   View source code 6 votes vote down vote up
private Variable showDialog() {
    JPanel inset = new JPanel(new BorderLayout());
    inset.setBorder(new EmptyBorder(12,12,0,12));
    inset.add(this);
    inset.getAccessibleContext().setAccessibleName(NbBundle.getMessage(VariablesPanel.class, "AN_Manage_Variables"));
    inset.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VariablesPanel.class, "AD_Manage_Variables"));
    DialogDescriptor dd = new DialogDescriptor(inset, NbBundle.getMessage(VariablesPanel.class, "TITLE_Manage_Variables")); // NOI18N
    dd.setModal(true);
    final JButton ok = new JButton(NbBundle.getMessage(VariablesPanel.class, "BUTTON_OK")); // NOI18N
    ok.setDefaultCapable(true);
    explorer.addPropertyChangeListener(new PropertyChangeListener() {
       public void propertyChange(PropertyChangeEvent evt) {
           removeButton.setEnabled(explorer.getSelectedNodes().length > 0);
           editButton.setEnabled(explorer.getSelectedNodes().length == 1);
       }
    });
    dd.setOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
    dd.setClosingOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
    if (DialogDisplayer.getDefault().notify(dd) == ok) {
        model.save();
        if (explorer.getSelectedNodes().length == 1) {
            return explorer.getSelectedNodes()[0].getLookup().lookup(Variable.class);
        }
    }
    return null;
}
 
Example 2
Project: openjdk-jdk10   File: Toolkit.java   View source code 6 votes vote down vote up
@Override
public void firePropertyChange(final PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
    }
    Runnable updater = new Runnable() {
        public void run() {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.firePropertyChange(evt);
            }
        }
    };
    final AppContext currentAppContext = AppContext.getAppContext();
    for (AppContext appContext : AppContext.getAppContexts()) {
        if (null == appContext || appContext.isDisposed()) {
            continue;
        }
        if (currentAppContext == appContext) {
            updater.run();
        } else {
            final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
            SunToolkit.postEvent(appContext, e);
        }
    }
}
 
Example 3
Project: incubator-netbeans   File: ProxyNode.java   View source code 6 votes vote down vote up
private void realPropertyChange(PropertyChangeEvent pce) {
    String nm = pce.getPropertyName();
    Node.PropertySet[] pss = getPropertySets();
    boolean exists = false;

    for (int i = 0; i < pss.length && !exists; i++) {
        Node.Property[] ps = pss[i].getProperties();

        for (int j = 0; j < ps.length && !exists; j++) {
            if (ps[j].getName().equals(nm)) {
                exists = true;
            }
        }
    }
    if( exists ) {
        firePropertyChange(pce.getPropertyName(), pce.getOldValue(), pce.getNewValue());
    }
}
 
Example 4
Project: FxTreeMap   File: FxTreeMap.java   View source code 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (TreeMapUtils.ITEM_CLICKED.equals(evt.getPropertyName())) {
        MapData data = (MapData) evt.getNewValue();
        if (!mapLevels.containsKey(data)) {
            FxMapModel newDataModel = new FxMapModel(this, data, 0, 0);
            newDataModel.setTreeMapStyle(style);
            mapLevels.put(data, newDataModel);
            currentModel = newDataModel;
        } else {
            currentModel = mapLevels.get(data);
        }
        currentData = data;
        updateBreadCrumbBar();
        pane.getChildren().setAll(currentModel.getFxItems().stream().map(i -> i.getNode()).collect(Collectors.toList()));
        requestLayoutUpdate();
    }
}
 
Example 5
Project: intellij-deps-ini4j   File: BeanEventSample.java   View source code 6 votes vote down vote up
public static void main(String[] args) throws Exception
{
    String filename = (args.length > 0) ? args[0] : FILENAME;
    Ini ini = new Ini(new FileInputStream(filename));
    Dwarf sneezy = ini.get("sneezy").as(Dwarf.class);

    sneezy.addPropertyChangeListener("age", new PropertyChangeListener()
        {
            public void propertyChange(PropertyChangeEvent event)
            {
                System.out.println("property " + event.getPropertyName() + " change");
                System.out.println(event.getOldValue() + " -> " + event.getNewValue());
            }
        });
    System.out.println("Sneezy's age: " + sneezy.getAge());
    sneezy.setAge(44);
    System.out.println("Sneezy's age: " + sneezy.getAge());
}
 
Example 6
Project: OpenJSharp   File: MotifInternalFrameTitlePane.java   View source code 6 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    JInternalFrame f = (JInternalFrame)evt.getSource();
    boolean value = false;
    if (JInternalFrame.IS_SELECTED_PROPERTY.equals(prop)) {
        repaint();
    } else if (prop.equals("maximizable")) {
        if ((Boolean)evt.getNewValue() == Boolean.TRUE)
            add(maximizeButton);
        else
            remove(maximizeButton);
        revalidate();
        repaint();
    } else if (prop.equals("iconable")) {
        if ((Boolean)evt.getNewValue() == Boolean.TRUE)
            add(minimizeButton);
        else
            remove(minimizeButton);
        revalidate();
        repaint();
    } else if (prop.equals(JInternalFrame.TITLE_PROPERTY)) {
        repaint();
    }
    enableActions();
}
 
Example 7
Project: incubator-netbeans   File: AXIComponent.java   View source code 6 votes vote down vote up
/**
 * The proxy component receives an event notification.
 */
public void propertyChange(PropertyChangeEvent evt) {
    AXIComponent source = (AXIComponent)evt.getSource();
    String property = evt.getPropertyName();
    if(!isInModel()) {
        //Ideally it shouldn't come here. Remove this as listener
        //and make shared as null, so that it'll be GCed.
        source.removeListener(this);
        //setSharedComponent(null);
        return;
    }
    //if(evt.getOldValue() == null && evt.getNewValue() != null) {
    if(PROP_CHILD_ADDED.equals(property)) {            
        onChildAdded(evt);
        return;
    }
    //if(evt.getOldValue() != null && evt.getNewValue() == null) {
    if(PROP_CHILD_REMOVED.equals(property)) {
        onChildDeleted(evt);
        return;
    }
            
    firePropertyChangeEvent(evt.getPropertyName(),
            evt.getOldValue(), evt.getNewValue());
}
 
Example 8
Project: incubator-netbeans   File: ToggleBreakpointActionProvider.java   View source code 6 votes vote down vote up
@Override
public void propertyChange (PropertyChangeEvent evt) {
    String url = EditorContextBridge.getContext().getCurrentURL();
    FileObject fo;
    try {
        fo = URLMapper.findFileObject(new URL(url));
    } catch (MalformedURLException muex) {
        fo = null;
    }
    setEnabled (
        ActionsManager.ACTION_TOGGLE_BREAKPOINT,
        (EditorContextBridge.getContext().getCurrentLineNumber () >= 0) && 
        (fo != null && "text/x-java".equals(fo.getMIMEType()))  // NOI18N
        //(EditorContextBridge.getCurrentURL ().endsWith (".java"))
    );
    if ( debugger != null && 
         debugger.getState () == JPDADebugger.STATE_DISCONNECTED
    ) 
        destroy ();
}
 
Example 9
Project: OpenJSharp   File: FileSystemView.java   View source code 6 votes vote down vote up
public FileSystemView() {
    final WeakReference<FileSystemView> weakReference = new WeakReference<FileSystemView>(this);

    UIManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            FileSystemView fileSystemView = weakReference.get();

            if (fileSystemView == null) {
                // FileSystemView was destroyed
                UIManager.removePropertyChangeListener(this);
            } else {
                if (evt.getPropertyName().equals("lookAndFeel")) {
                    fileSystemView.useSystemExtensionHiding =
                            UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding");
                }
            }
        }
    });
}
 
Example 10
Project: incubator-netbeans   File: OpenSupport.java   View source code 6 votes vote down vote up
/** Accepts property changes from DataObject and fires them to
* own listeners.
*/
public void propertyChange(PropertyChangeEvent ev) {
    if (DataObject.PROP_MODIFIED.equals (ev.getPropertyName())) {
        if (getDataObject ().isModified ()) {
            getDataObject ().addVetoableChangeListener(this);
        } else {
            getDataObject ().removeVetoableChangeListener(this);
        }
    }
    
    firePropertyChange (
        ev.getPropertyName (),
        ev.getOldValue (),
        ev.getNewValue ()
    );
}
 
Example 11
Project: incubator-netbeans   File: PersistenceUnitWizardDescriptor.java   View source code 6 votes vote down vote up
@Override
public java.awt.Component getComponent() {
    if (panel == null) {
        if (isContainerManaged) {
            datasourcePanel = new PersistenceUnitWizardPanelDS(project, this, true);
            panel = datasourcePanel;
        } else {
            jdbcPanel= new PersistenceUnitWizardPanelJdbc(project, this, true);
            panel = jdbcPanel;
        }
        panel.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals(PersistenceUnitWizardPanel.IS_VALID)) {
                    Object newvalue = evt.getNewValue();
                    if ((newvalue != null) && (newvalue instanceof Boolean)) {
                        stateChanged(null);
                    }
                }
            }
        });
    }
    return panel;
}
 
Example 12
Project: incubator-netbeans   File: JPDAStart.java   View source code 6 votes vote down vote up
@Override
public void propertyChange (final PropertyChangeEvent e) {
    if (JPDADebugger.PROP_STATE.equals(e.getPropertyName ())) {
        int state = ((Integer) e.getNewValue ()).intValue ();
        if (state == JPDADebugger.STATE_STOPPED || state == JPDADebugger.STATE_DISCONNECTED) {
            rp.post(new Runnable() {
                @Override
                public void run() {
                    if (first != null) {
                        DebuggerManager.getDebuggerManager().removeBreakpoint(first);
                        first = null;
                        ((JPDADebugger) e.getSource()).removePropertyChangeListener(JPDADebugger.PROP_STATE, pcl);
                    }
                }
            });
        }
    }
}
 
Example 13
Project: incubator-netbeans   File: EditorContextDispatcher.java   View source code 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName();
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("EditorRegistryListener.propertyChange("+propertyName+": "+evt.getOldValue()+" => "+evt.getNewValue()+")");
    }
    if (propertyName.equals(EditorRegistry.FOCUS_LOST_PROPERTY)) {
        Object newFocused = evt.getNewValue();
        if (newFocused instanceof JRootPane) {
            JRootPane root = (JRootPane) newFocused;
            if (root.isAncestorOf((Component) evt.getOldValue())) {
                logger.fine("Focused root.");
                root.addFocusListener(this);
                return;
            }
        }
    }
    if (propertyName.equals(EditorRegistry.FOCUS_GAINED_PROPERTY) ||
        propertyName.equals(EditorRegistry.FOCUS_LOST_PROPERTY) ||
        propertyName.equals(EditorRegistry.FOCUSED_DOCUMENT_PROPERTY)) {
        
        update(true);
    }
}
 
Example 14
Project: incubator-netbeans   File: JPDAStart.java   View source code 6 votes vote down vote up
@Override
        public void propertyChange(PropertyChangeEvent e) {
            if (JPDADebugger.PROP_STATE.equals(e.getPropertyName())) {
                int state = ((Integer) e.getNewValue()).intValue();
                if ( (state == JPDADebugger.STATE_DISCONNECTED) ||
                        (state == JPDADebugger.STATE_STOPPED)
                        ) {
//                    RequestProcessor.getDefault ().post (new Runnable () {
//                        public void run () {
                    if (breakpoint != null) {
                        DebuggerManager.getDebuggerManager().
                                removeBreakpoint(breakpoint);
                        breakpoint = null;
                    }
//                        }
//                    });
                    dispose();
                }
            }
        }
 
Example 15
Project: openjdk-jdk10   File: TitledBorder.java   View source code 6 votes vote down vote up
private void installPropertyChangeListeners() {
    final WeakReference<TitledBorder> weakReference = new WeakReference<TitledBorder>(this);
    final PropertyChangeListener listener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (weakReference.get() == null) {
                UIManager.removePropertyChangeListener(this);
                UIManager.getDefaults().removePropertyChangeListener(this);
            } else {
                String prop = evt.getPropertyName();
                if ("lookAndFeel".equals(prop) || "LabelUI".equals(prop)) {
                    label.updateUI();
                }
            }
        }
    };

    UIManager.addPropertyChangeListener(listener);
    UIManager.getDefaults().addPropertyChangeListener(listener);
}
 
Example 16
Project: incubator-netbeans   File: ChooseCategoryWizardPanel.java   View source code 6 votes vote down vote up
@Override
public java.awt.Component getComponent() {
    if (categorySelector == null) { // create the UI component for the wizard step
        categorySelector = new CategorySelector();

        // wizard API: set the caption and index of this panel
        categorySelector.setName(PaletteUtils.getBundleString("CTL_SelectCategory_Caption")); // NOI18N
        categorySelector.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, // NOI18N
                                           Integer.valueOf(2));

        categorySelector.getExplorerManager().addPropertyChangeListener(
            new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent ev) {
                    if (ExplorerManager.PROP_SELECTED_NODES.equals(ev.getPropertyName()))
                        cs.fireChange();
                }
            });
    }

    return categorySelector;
}
 
Example 17
Project: incubator-netbeans   File: RepositoryInfo.java   View source code 6 votes vote down vote up
private void setActiveBranch (Map<String, GitBranch> branches) throws GitException {
    for (Map.Entry<String, GitBranch> e : branches.entrySet()) {
        if (e.getValue().isActive()) {
            GitBranch oldActiveBranch = activeBranch;
            activeBranch = e.getValue();
            if (oldActiveBranch == null || !oldActiveBranch.getName().equals(activeBranch.getName())) {
                LOG.log(Level.FINE, "active branch changed: {0} --- {1}", new Object[] { rootRef, activeBranch.getName() }); //NOI18N
                firePropertyChange(new PropertyChangeEvent(this, PROPERTY_ACTIVE_BRANCH, oldActiveBranch, activeBranch));
            }
            if (oldActiveBranch == null || !oldActiveBranch.getId().equals(activeBranch.getId())) {
                LOG.log(Level.FINE, "current HEAD changed: {0} --- {1}", new Object[] { rootRef, activeBranch.getId() }); //NOI18N
                firePropertyChange(new PropertyChangeEvent(this, PROPERTY_HEAD, oldActiveBranch, activeBranch));
            }
        }
    }
}
 
Example 18
Project: VASSAL-src   File: ShowServerStatusAction.java   View source code 6 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
  MessageBoard server = null;
  String name = null;
  if (evt.getNewValue() instanceof ServerStatus.ModuleSummary) {
    final String moduleName = ((ServerStatus.ModuleSummary) evt.getNewValue()).getModuleName();
    server = new HttpMessageServer(new PeerPoolInfo() {
      public String getModuleName() {
        return moduleName;
      }

      public String getUserName() {
        return ((ChatServerConnection) GameModule.getGameModule().getServer()).getUserInfo().getName();
      }
    });
  }
  if (messageMgr != null) {
    messageMgr.setServer(server, name);
  }
}
 
Example 19
Project: incubator-netbeans   File: ResourceTable.java   View source code 6 votes vote down vote up
private void fireEventAndCleanList(ArrayList <WeakReference<PropertyChangeListener>> refListeners,
                                   PropertyChangeEvent event)
{
    for(int index = refListeners.size() - 1; index >= 0; index--)
    {
        WeakReference<PropertyChangeListener> ref = refListeners.get(index);
        PropertyChangeListener refListener = ref.get();
        if(refListener != null)
        {   
            refListener.propertyChange(event);
        }
        else
        {
            refListeners.remove(index);
        }
    }
}
 
Example 20
Project: openjdk-jdk10   File: MotifScrollPaneUI.java   View source code 6 votes vote down vote up
private PropertyChangeListener createPropertyChangeHandler() {
    return new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
              String propertyName = e.getPropertyName();

              if (propertyName.equals("componentOrientation")) {
                    JScrollPane pane = (JScrollPane)e.getSource();
                    JScrollBar vsb = pane.getVerticalScrollBar();
                    if (vsb != null && vsbBorder != null &&
                        vsb.getBorder() == vsbBorder) {
                        // The Border on the verticall scrollbar matches
                        // what we installed, reset it.
                        if (MotifGraphicsUtils.isLeftToRight(pane)) {
                            vsbBorder = new CompoundBorder(vsbMarginBorderR,
                                            vsbBorder.getInsideBorder());
                        } else {
                            vsbBorder = new CompoundBorder(vsbMarginBorderL,
                                            vsbBorder.getInsideBorder());
                        }
                        vsb.setBorder(vsbBorder);
                    }
              }
    }};
}
 
Example 21
Project: incubator-netbeans   File: RepositoryNode.java   View source code 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(RepositoryImpl.EVENT_QUERY_LIST_CHANGED)) {
        updateContent(false);
    } else if (evt.getPropertyName().equals(RepositoryImpl.EVENT_ATTRIBUTES_CHANGED)) {
        if (evt.getNewValue() instanceof Map) {
            Map<String, String> attributes = (Map<String, String>) evt.getNewValue();
            String displayName = attributes.get(RepositoryImpl.ATTRIBUTE_DISPLAY_NAME);
            if (displayName != null && !displayName.isEmpty()) {
                if (lblName != null) {
                    lblName.setText(displayName);
                    fireContentChanged();
                }
            }
        }
    }
}
 
Example 22
Project: VASSAL-src   File: BooleanPreference.java   View source code 5 votes vote down vote up
public Configurer getPreferenceConfigurer() {
  if (config == null) {
    config = new BooleanConfigurer(getVariableName(), getDescription(), defaultValue);
    config.addPropertyChangeListener(new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent e) {
        updateGlobalProperty(config.getValueString());
      }});
  }
  return config;
}
 
Example 23
Project: jaer   File: SyncPlayer.java   View source code 5 votes vote down vote up
/** JAERViewer gets PropertyChangeEvent from the AEPlayer in the AEViewers. This method presently only logs this event.
 */
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(AEInputStream.EVENT_REWIND)) {
        // comes from AEFileInputStream when file reaches end and AEViewer rewinds the file
        for (AEViewer v : outer.getViewers()) {
            v.getChip().getRenderer().resetFrame(v.getChip().getRenderer().getGrayValue());
        }
        log.info("rewind PropertyChangeEvent received by " + this + " from " + evt.getSource());
    }
}
 
Example 24
Project: incubator-netbeans   File: CustomCodeEditor.java   View source code 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())
            && evt.getNewValue() == PropertyEnv.STATE_VALID) {
        propertyEditor.setValue(codeEditorPane.getText());
    }
}
 
Example 25
Project: openjdk-jdk10   File: AncestorNotifier.java   View source code 5 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
    String s = evt.getPropertyName();

    if (s!=null && (s.equals("parent") || s.equals("ancestor"))) {
        JComponent component = (JComponent)evt.getSource();

        if (evt.getNewValue() != null) {
            if (component == firstInvisibleAncestor) {
                addListeners(component, false);
                if (firstInvisibleAncestor == null) {
                    fireAncestorAdded(root, AncestorEvent.ANCESTOR_ADDED,
                                      component, component.getParent());
                }
            }
        } else {
            boolean needsNotify = firstInvisibleAncestor == null;
            Container oldParent = (Container)evt.getOldValue();

            removeListeners(oldParent);
            firstInvisibleAncestor = component;
            if (needsNotify) {
                fireAncestorRemoved(root, AncestorEvent.ANCESTOR_REMOVED,
                                    component, oldParent);
            }
        }
    }
}
 
Example 26
Project: rapidminer   File: FileChooserUI.java   View source code 5 votes vote down vote up
private void doSelectedFileChanged(PropertyChangeEvent e) {
	File f = (File) e.getNewValue();
	JFileChooser fc = getFileChooser();
	if (f != null && (fc.isFileSelectionEnabled() && !f.isDirectory()
			|| f.isDirectory() && fc.isDirectorySelectionEnabled())) {
		setFileName(fileNameString(f));
		setFileSelected();
	}
}
 
Example 27
Project: incubator-netbeans   File: AddPropertyDialog.java   View source code 5 votes vote down vote up
/** Creates new form AddPropertyDialog */
public AddPropertyDialog(NbMavenProjectImpl prj, String goalsText) {
    initComponents();
    manager = new ExplorerManager();
    //project can be null when invoked from Tools/Options
    project = prj;
    okbutton = new JButton(NbBundle.getMessage(AddPropertyDialog.class, "BTN_OK"));
    manager.setRootContext(Node.EMPTY);        
    tpDesc.setEditorKit(new HTMLEditorKit());
    tpDesc.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
    
    manager.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Node[] nds = getExplorerManager().getSelectedNodes();
            if (nds.length != 1) {
                okbutton.setEnabled(false);
            } else {
                PluginIndexManager.ParameterDetail plg = nds[0].getLookup().lookup(PluginIndexManager.ParameterDetail.class);
                if (plg != null) {
                    okbutton.setEnabled(true);
                    tpDesc.setText(plg.getHtmlDetails(false));
                } else {
                    okbutton.setEnabled(false);
                    tpDesc.setText("");
                }
            }
        }
    });
    ((BeanTreeView)tvExpressions).setRootVisible(false);
    ((BeanTreeView)tvExpressions).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.goalsText = goalsText;
    RequestProcessor.getDefault().post(new Loader());
}
 
Example 28
Project: incubator-netbeans   File: BasicSlidingTabDisplayerUI.java   View source code 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent e) {
    super.propertyChange(e);
    if (TabDisplayer.PROP_ORIENTATION.equals(e.getPropertyName())) {
        displayer.revalidate();
    }
}
 
Example 29
Project: VASSAL-src   File: RegularGridNumbering.java   View source code 5 votes vote down vote up
public Configurer getConfigurer() {
  AutoConfigurer c = (AutoConfigurer) super.getConfigurer();
  String[] s = getAttributeNames();
  for (int i = 0; i < s.length; ++i) {
    c.getConfigurer(s[i]).addPropertyChangeListener(new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        visualizer.repaint();
      }
    });
  }
  ((Container) c.getControls()).add(getGridVisualizer());
  return c;
}
 
Example 30
Project: VASSAL-src   File: FileConfigurer.java   View source code 5 votes vote down vote up
public static void main(String args[]) {
  final JFrame f = new JFrame();
  final FileConfigurer c =
    new ImageConfigurer(null, "Test file", new ArchiveWriter("testArchive"));
  c.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {
      System.err.println(String.valueOf(evt.getNewValue()));
    }
  });
  f.getContentPane().add(c.getControls());
  f.pack();
  f.setVisible(true);
}
 
Example 31
Project: neoscada   File: AbstractRenderer.java   View source code 5 votes vote down vote up
public AbstractRenderer ( final ChartRenderer chart )
{
    this.chart = chart;
    this.realm = chart.getRealm ();

    this.propertyChangeListener = new PropertyChangeListener () {

        @Override
        public void propertyChange ( final PropertyChangeEvent evt )
        {
            handlePropertyChange ( evt );
        }
    };
}
 
Example 32
Project: incubator-netbeans   File: ConnectManager.java   View source code 5 votes vote down vote up
private boolean propertyChangeNeedsReconnect(PropertyChangeEvent evt) {
    String property = evt.getPropertyName();
    if (property.equals(MySQLOptions.PROP_ADMINUSER) ||
        property.equals(MySQLOptions.PROP_HOST)       ||
        property.equals(MySQLOptions.PROP_PORT)) {
            return true;
    }

    return false;
}
 
Example 33
Project: incubator-netbeans   File: Install.java   View source code 5 votes vote down vote up
public synchronized void propertyChange(PropertyChangeEvent evt) {
    JTextComponent jtc = EditorRegistry.focusedComponent();
    if (jtc == null) return;
    
    Document active = jtc.getDocument();
    Object sourceProperty = active.getProperty(Document.StreamDescriptionProperty);
    if (!(sourceProperty instanceof DataObject)) return;

    FileObject activeFile = ((DataObject)sourceProperty).getPrimaryFile();
    TimesCollectorPeer.getDefault().select(activeFile);
}
 
Example 34
Project: incubator-netbeans   File: MergeDialogComponent.java   View source code 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
    if (MergePanel.PROP_CAN_BE_SAVED.equals(propertyChangeEvent.getPropertyName())) {
        activateSave();
    } else if (MergePanel.PROP_CAN_NOT_BE_SAVED.equals(propertyChangeEvent.getPropertyName())) {
        deactivateSave();
    }
    MergeDialogComponent.this.refreshName();
}
 
Example 35
Project: VASSAL-src   File: DynamicProperty.java   View source code 5 votes vote down vote up
public Ed(final DynamicProperty m) {
  keyCommandListConfig = new ListConfigurer(null, "Key Commands") {
    protected Configurer buildChildConfigurer() {
      return new DynamicKeyCommandConfigurer(m);
    }
  };
  keyCommandListConfig.setValue(
    new ArrayList<DynamicKeyCommand>(Arrays.asList(m.keyCommands)));
  PropertyChangeListener l = new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {
      boolean isNumeric = numericConfig.booleanValue().booleanValue();
      minConfig.getControls().setVisible(isNumeric);
      maxConfig.getControls().setVisible(isNumeric);
      wrapConfig.getControls().setVisible(isNumeric);
      keyCommandListConfig.repack();
    }
  };
  controls = Box.createVerticalBox();
  nameConfig = new StringConfigurer(null, "Name:  ", m.getKey());
  controls.add(nameConfig.getControls());
  initialValueConfig = new StringConfigurer(null, "Value:  ", m.getValue());
  controls.add(initialValueConfig.getControls());
  numericConfig =
    new BooleanConfigurer(null, "Is numeric:  ", m.isNumeric());
  controls.add(numericConfig.getControls());
  minConfig =
    new IntConfigurer(null, "Minimum value:  ", m.getMinimumValue());
  controls.add(minConfig.getControls());
  maxConfig =
    new IntConfigurer(null, "Maximum value:  ", m.getMaximumValue());
  controls.add(maxConfig.getControls());
  wrapConfig = new BooleanConfigurer(null, "Wrap?", m.isWrap());
  controls.add(wrapConfig.getControls());
  controls.add(keyCommandListConfig.getControls());

  numericConfig.addPropertyChangeListener(l);
  numericConfig.fireUpdate();
}
 
Example 36
Project: incubator-netbeans   File: RepositoryInfo.java   View source code 5 votes vote down vote up
private void firePropertyChange (PropertyChangeEvent event) {
    List<PropertyChangeEvent> events = eventsToFire.get();
    if (events != null) {
        events.add(event);
    } else {
        propertyChangeSupport.firePropertyChange(event);
    }
}
 
Example 37
Project: incubator-netbeans   File: M2ConfigProvider.java   View source code 5 votes vote down vote up
public M2ConfigProvider(NbMavenProjectImpl proj, AuxiliaryConfiguration aux, ProjectProfileHandler prof) {
    project = proj;
    this.aux = aux;
    profileHandler = prof;
    DEFAULT = M2Configuration.createDefault(project.getProjectDirectory());           
    active = DEFAULT;
    propertyChange = new PropertyChangeListener() {
        public @Override void propertyChange(PropertyChangeEvent evt) {
            if (NbMavenProject.PROP_PROJECT.equals(evt.getPropertyName())) {
                synchronized (M2ConfigProvider.this) {
                    profiles = null;
                    shared = null;
                    nonshared = null;
                    initialActive = active != null ? active.getId() : null; //#241337
                    active = DEFAULT;
                }
                RP.post(new Runnable() {
                    public @Override void run() {
                        checkActiveAgainstAll(getConfigurations(), false);
                        firePropertyChange();
                    }

                });
            }
        }
    };
}
 
Example 38
Project: jaer   File: AEPlayer.java   View source code 5 votes vote down vote up
/**
 * is called when the file selection is changed. Bound to the
 * SELECTED_FILE_CHANGED_PROPERTY.
 */
@Override
public void propertyChange(PropertyChangeEvent evt) {
    // comes from chooser when new file is selected
    if (evt.getNewValue() instanceof File) {
        file = (File) evt.getNewValue();
    } else {
        file = null;
    }
}
 
Example 39
Project: incubator-netbeans   File: TodoTaskScanner.java   View source code 5 votes vote down vote up
public void propertyChange( PropertyChangeEvent e ) {
    if( Settings.PROP_PATTERN_LIST.equals( e.getPropertyName() )
     || Settings.PROP_SCAN_COMMENTS_ONLY.equals( e.getPropertyName() )
     || Settings.PROP_IDENTIFIERS_LIST.equals( e.getPropertyName() )){
        regexp = null;
        if( null != callback )
            callback.refreshAll();
    }
}
 
Example 40
Project: Pogamut3   File: SimpleCompetenceElementWidget.java   View source code 5 votes vote down vote up
@Override
public void elementPropertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(CompetenceElement.caName)) {
        this.setHeadlineText((String) evt.getNewValue());
        this.doRepaint();
    }
}