use of java.beans.PropertyChangeListener in project Botnak by Gocnak.
the class BaseTitlePane method maximize.
protected void maximize() {
Frame frame = getFrame();
if (frame != null) {
PropertyChangeListener[] pcl = frame.getPropertyChangeListeners();
for (PropertyChangeListener aPcl : pcl) {
aPcl.propertyChange(new PropertyChangeEvent(this, "windowMaximize", Boolean.FALSE, Boolean.FALSE));
}
DecorationHelper.setExtendedState(frame, state | BaseRootPaneUI.MAXIMIZED_BOTH);
for (PropertyChangeListener aPcl : pcl) {
aPcl.propertyChange(new PropertyChangeEvent(this, "windowMaximized", Boolean.FALSE, Boolean.FALSE));
}
}
}
use of java.beans.PropertyChangeListener in project ACS by ACS-Community.
the class BeanUtils method addWeakListenerByReflection.
/**
* Add a weak PropertyChangeListener to an object, using reflection to look up the addPropertyChangeListener method
* @param listener the listener to add
* @param source the object to which a PCL shall be added
*/
public static void addWeakListenerByReflection(PropertyChangeListener listener, Object source) {
try {
PropertyChangeListener pcl = WeakListener.propertyChange(listener, source);
Method addPCL = source.getClass().getMethod("addPropertyChangeListener", new Class[] { java.beans.PropertyChangeListener.class });
addPCL.invoke(source, new Object[] { pcl });
} catch (Exception ex) {
// [PENDING] should use logging API here
System.err.println("Warning: unable to add a property change listener to object " + source);
//ex.printStackTrace();
}
}
use of java.beans.PropertyChangeListener in project ACS by ACS-Community.
the class BeanNode method getCustomizer.
/**
* Returns the customizer component.
* @return the component or <code>null</code> if there is no customizer
*/
public java.awt.Component getCustomizer() {
Class clazz = _beanInfo.getBeanDescriptor().getCustomizerClass();
if (clazz == null)
return null;
Object o;
try {
o = clazz.newInstance();
} catch (InstantiationException e) {
exception(e);
return null;
} catch (IllegalAccessException e) {
exception(e);
return null;
}
if (!(o instanceof Customizer))
return null;
Customizer cust = ((java.beans.Customizer) o);
attachCustomizer(this, cust);
// looking for the component
java.awt.Component comp = null;
if (o instanceof java.awt.Component) {
comp = (java.awt.Component) o;
} else {
// create the dialog from descriptor
comp = createDialog(o);
}
if (comp == null) {
// no component provided
return null;
}
cust.setObject(_bean);
if (!_guiUpdater.hasRegisteredListenerInternal()) {
cust.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
firePropertyChange(e.getPropertyName(), e.getOldValue(), e.getNewValue());
}
});
}
return comp;
}
use of java.beans.PropertyChangeListener in project ACS by ACS-Community.
the class WorkspaceSwitchListenerSupport method startListening.
/**
* tell this object to start listening again. This method is called in the constructor.
* It is not necessary (but not harmful either) to call this menthod again even if we are
* already listening. Precautions are taken to avoid adding a second listener.
* This method is thread safe with regards to its counterpart
* @see #stopListening
*/
public void startListening() {
if (!listening) {
synchronized (listeningLock) {
if (!listening) {
// double-check condition
PropertyChangeListener propL = WeakListener.propertyChange(this, WindowManager.getDefault());
WindowManager.getDefault().addPropertyChangeListener(propL);
listening = !listening;
}
}
}
}
use of java.beans.PropertyChangeListener in project EnrichmentMapApp by BaderLab.
the class PostAnalysisKnownSignaturePanel method createKnownSignatureGMTPanel.
/**
* @return Panel for choosing and loading GMT and SignatureGMT Geneset-Files
*/
private JPanel createKnownSignatureGMTPanel() {
knownSignatureGMTFileNameTextField = new JFormattedTextField();
knownSignatureGMTFileNameTextField.setColumns(15);
knownSignatureGMTFileNameTextField.setToolTipText(Messages.GMT_INSTRUCTION);
final Color textFieldForeground = knownSignatureGMTFileNameTextField.getForeground();
knownSignatureGMTFileNameTextField.addPropertyChangeListener("value", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
// if the text is red set it back to black as soon as the user starts typing
knownSignatureGMTFileNameTextField.setForeground(textFieldForeground);
}
});
JButton selectSigGMTFileButton = new JButton("Browse...");
selectSigGMTFileButton.setToolTipText(Messages.GMT_INSTRUCTION);
selectSigGMTFileButton.setActionCommand("Known Signature");
selectSigGMTFileButton.addActionListener(e -> {
parentPanel.chooseGMTFile(knownSignatureGMTFileNameTextField);
});
makeSmall(knownSignatureGMTFileNameTextField, selectSigGMTFileButton);
JPanel panel = new JPanel();
panel.setBorder(LookAndFeelUtil.createTitledBorder("SigGMT File (contains signature-genesets)"));
final GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(knownSignatureGMTFileNameTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectSigGMTFileButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(knownSignatureGMTFileNameTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(selectSigGMTFileButton));
if (LookAndFeelUtil.isAquaLAF())
panel.setOpaque(false);
return panel;
}
Aggregations