List of usage examples for java.beans PropertyChangeEvent getSource
public Object getSource()
From source file:org.polymap.wbv.ui.WaldbesitzerTableViewer.java
public WaldbesitzerTableViewer(UnitOfWork uow, Composite parent, Iterable<Waldbesitzer> rs, int style) { super(parent, /* SWT.VIRTUAL | SWT.V_SCROLL | SWT.FULL_SELECTION | */style); this.uow = uow; BatikApplication.instance().getContext().propagate(this); try {/* ww w . j a va 2s . c o m*/ // suppress deferred loading to fix "empty table" issue // setContent( fs.getFeatures( this.baseFilter ) ); setContentProvider(new CompositesFeatureContentProvider()); addColumn(new NameColumn()).sort(SWT.DOWN); addColumn(new EigentumColumn()); addColumn(new FlurstueckColumn()); setInput(rs); /* Register for property change events */ EventManager.instance().subscribe(this, new EventFilter<PropertyChangeEvent>() { public boolean apply(PropertyChangeEvent input) { return input.getSource() instanceof Waldbesitzer; } }); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:org.polymap.core.mapeditor.tooling.select.SelectionTool.java
/** * Listen to feature selection changes from {@link LayerFeatureSelectionManager}. *//*from w w w.j a va 2s . c o m*/ @Override @EventHandler public void propertyChange(PropertyChangeEvent ev) { assert fsm == ev.getSource(); //select if (ev.getPropertyName().equals(LayerFeatureSelectionManager.PROP_FILTER)) { vectorLayer.selectFeatures(fsm.getFeatureCollection()); } // hover else if (ev.getPropertyName().equals(LayerFeatureSelectionManager.PROP_HOVER)) { selectControl.unselectAll(); selectControl.selectFids(Collections.singletonList((String) ev.getNewValue())); } }
From source file:org.oyrm.kobo.postproc.KoboBatchTranscriber.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource().equals(srd)) { if (evt.getPropertyName() == Constants.CHANGEPROP_NAME_NCOMPLETED) { this.setnTranscribed((Integer) evt.getNewValue()); } else if (evt.getPropertyName() == Constants.CHANGEPROP_NAME_PROGRESS) { this.setSubProgress((Integer) evt.getNewValue()); } else if (evt.getPropertyName() == Constants.CHANGEPROP_NAME_STATE) { this.getPropertyChangeSupport().firePropertyChange(evt); }//from w w w. j ava 2 s . c om } }
From source file:gda.gui.text.parameter.EpicsPanelParameterListener.java
@Override public void vetoableChange(final PropertyChangeEvent e) throws PropertyVetoException { if (putTimeOut != null) { java.awt.Component c = null; Object obj = e.getSource(); if (obj instanceof ParametersPanelBuilder.ParameterChangeEventSource) { Object field = ((ParametersPanelBuilder.ParameterChangeEventSource) obj).parameterField.field; if (field instanceof java.awt.Component) { c = (java.awt.Component) field; }// ww w.ja va 2 s . c o m } if (c != null) c.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); vetoableChangeinNewThread(e); if (c != null) c.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); } else { Thread t = uk.ac.gda.util.ThreadManager.getThread(new Runnable() { @Override public void run() { try { vetoableChangeinNewThread(e); } catch (Exception ex) { exceptionUtils.logException(logger, "vetoableChange", ex); } } }); t.setPriority(java.lang.Thread.MIN_PRIORITY); t.start(); } }
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 v a2s.co 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:org.polymap.core.project.ui.layer.LayerStatusDecorator.java
public LayerStatusDecorator() { decorated = new MapMaker().weakValues().initialCapacity(128).makeMap(); EventManager.instance().subscribe(this, new EventFilter<PropertyChangeEvent>() { public boolean apply(PropertyChangeEvent ev) { try { return ev.getSource() instanceof ILayer && decorated.containsKey(((ILayer) ev.getSource()).id()) && (ev.getPropertyName().equals(Visible.PROP_VISIBLE) || ev.getPropertyName().equals(ILayer.PROP_LAYERSTATUS)); } catch (NoSuchEntityException e) { return false; }/*from w w w .java2 s. com*/ } }); }
From source file:org.rifidi.designer.entities.databinding.ObservableTreeContentProvider.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getOldValue() != null) { viewer.remove(evt.getSource(), new Object[] { evt.getOldValue() }); }//from ww w. j a v a 2s . c o m viewer.add(evt.getSource(), evt.getNewValue()); viewer.refresh(evt.getSource()); }
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);// w w w. j a va 2 s. com 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.BaseVectorLayer.java
/** * Listen to feature selection changes from {@link LayerFeatureSelectionManager}. */// ww w. ja va2 s. c o m @Override @EventHandler public void propertyChange(PropertyChangeEvent ev) { if (fsm == ev.getSource()) { //select if (ev.getPropertyName().equals(LayerFeatureSelectionManager.PROP_FILTER)) { selectFeatures(fsm.getFeatureCollection()); } // // hover // else if (ev.getPropertyName().equals( LayerFeatureSelectionManager.PROP_HOVER )) { // selectControl.unselectAll(); // selectControl.selectFids( Collections.singletonList( (String)ev.getNewValue() ) ); // } } }
From source file:org.netflux.core.task.AbstractTask.java
/** * Creates a new task with the given name, and initializes its input and output ports using the given names. * /*w w w . j a v a 2s . c o m*/ * @param name the name of the task to be created. * @param inputPortNames the name of the input ports this task will use to read records. * @param outputPortNames the name of the output ports this task will use to write records. */ protected AbstractTask(String name, Set<String> inputPortNames, Set<String> outputPortNames) { this.name = name; Iterator<String> inputPortNamesIterator = inputPortNames.iterator(); while (inputPortNamesIterator.hasNext()) { String inputPortName = inputPortNamesIterator.next(); InputPort currentInputPort = new SimpleInputPort(this.name + ":" + inputPortName); this.inputPorts.put(inputPortName, currentInputPort); currentInputPort.addPropertyChangeListener("metadata", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { AbstractTask.this.updateMetadata((InputPort) event.getSource(), (RecordMetadata) event.getNewValue()); } }); } Iterator<String> outputPortNamesIterator = outputPortNames.iterator(); while (outputPortNamesIterator.hasNext()) { String outputPortName = outputPortNamesIterator.next(); this.outputPorts.put(outputPortName, new SimpleOutputPort(this.name + ":" + outputPortName)); } }