use of java.beans.PropertyChangeListener in project knime-core by knime.
the class FixedWidthFRNodeDialog method createPreviewPanel.
/**
* @return jpanel with all the preview components
*/
private JPanel createPreviewPanel() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Preview"));
Box tableBox = Box.createHorizontalBox();
PreviewTableContentView ptcv = new PreviewTableContentView();
m_previewTableView = new TableView(ptcv);
tableBox.add(m_previewTableView);
panel.add(Box.createGlue());
panel.add(tableBox);
ptcv.addPropertyChangeListener(PreviewTableContentView.PROPERTY_SPEC_CHANGED, new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent evt) {
m_colIdx = (int) evt.getNewValue();
m_colIdx = m_nodeSettings.getColIdxIncluded(m_colIdx);
if (m_colIdx < m_nodeSettings.getNumberOfColumns() - 1) {
// don't open edit dialog if clicked column equals
// remaining characters column
onEdit(m_colIdx);
}
}
});
return panel;
}
use of java.beans.PropertyChangeListener in project knime-core by knime.
the class ParallelCoordinatesViewPanel method createViewTypeMenu.
/**
* @return - a JMenu entry handling the view type.
*/
public JMenu createViewTypeMenu() {
JMenu menu = new JMenu("View Type");
menu.setMnemonic('V');
ActionListener actL = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (e.getActionCommand().equals(POPUP_ALL_VISIBLE)) {
// set view to ALL VISIBLE
setViewType(ALL_VISIBLE);
((JRadioButtonMenuItem) e.getSource()).firePropertyChange(POPUP_ALL_VISIBLE, false, true);
repaint();
} else if (e.getActionCommand().equals(POPUP_HIDE_UNHILITED)) {
// set view to HIDE_UNHILITED
setViewType(HIDE_UNHILITED);
unselectUnhilited();
((JRadioButtonMenuItem) e.getSource()).firePropertyChange(POPUP_HIDE_UNHILITED, false, true);
repaint();
} else if (e.getActionCommand().equals(POPUP_FADE_UNHILITED)) {
// set view to FADE_UNHILITED
setViewType(FADE_UNHILITED);
unselectUnhilited();
((JRadioButtonMenuItem) e.getSource()).firePropertyChange(POPUP_FADE_UNHILITED, false, true);
repaint();
}
}
};
ButtonGroup group = new ButtonGroup();
// JMenuItem item
JMenuItem item = new JRadioButtonMenuItem(POPUP_ALL_VISIBLE);
item.setSelected(m_viewType == ALL_VISIBLE);
item.addActionListener(actL);
item.setMnemonic('A');
item.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent e) {
((JRadioButtonMenuItem) e.getSource()).setSelected(m_viewType == ALL_VISIBLE);
}
});
group.add(item);
menu.add(item);
item = new JRadioButtonMenuItem(POPUP_HIDE_UNHILITED);
item.setSelected(m_viewType == HIDE_UNHILITED);
item.addActionListener(actL);
item.setMnemonic('H');
item.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent e) {
((JRadioButtonMenuItem) e.getSource()).setSelected(m_viewType == HIDE_UNHILITED);
}
});
group.add(item);
menu.add(item);
item = new JRadioButtonMenuItem(POPUP_FADE_UNHILITED);
item.setSelected(m_viewType == FADE_UNHILITED);
item.addActionListener(actL);
item.setMnemonic('F');
item.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent e) {
((JRadioButtonMenuItem) e.getSource()).setSelected(m_viewType == FADE_UNHILITED);
}
});
group.add(item);
menu.add(item);
return menu;
}
use of java.beans.PropertyChangeListener in project vcell by virtualcell.
the class VCDocumentDbTreePanel method initialize.
/**
* Initialize the class.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
protected void initialize() {
try {
initializeNotCalled = false;
// user code begin {1}
// user code end
setName("BioModelTreePanel");
setLayout(new BorderLayout());
getDatabaseSearchPanel().addActionListener(ivjEventHandler);
getDatabaseSearchPanel().addCollapsiblePropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() == getDatabaseSearchPanel() && evt.getPropertyName().equals(CollapsiblePanel.SEARCHPPANEL_EXPANDED)) {
boolean bSearchPanelExpanded = (Boolean) evt.getNewValue();
if (!bSearchPanelExpanded) {
search(true);
}
}
}
});
treeCellRenderer = createTreeCellRenderer();
treeModel = createTreeModel();
getJTree1().setModel(getTreeModel());
getJTree1().setCellRenderer(treeCellRenderer);
getTreeModel().addTreeModelListener(ivjEventHandler);
getJTree1().getSelectionModel().addTreeSelectionListener(ivjEventHandler);
getJTree1().addMouseListener(ivjEventHandler);
add(getDatabaseSearchPanel(), BorderLayout.NORTH);
JComponent topPanel = new JScrollPane(getJTree1());
JComponent centerPanel = topPanel;
if (bShowMetadata) {
JSplitPane splitPane = new javax.swing.JSplitPane(javax.swing.JSplitPane.VERTICAL_SPLIT);
splitPane.setDividerLocation(150);
splitPane.setResizeWeight(0.7);
getBottomPanel().setMinimumSize(new Dimension(150, 150));
topPanel.setMinimumSize(new Dimension(150, 150));
splitPane.setTopComponent(topPanel);
splitPane.setBottomComponent(getBottomPanel());
centerPanel = splitPane;
}
add(centerPanel, BorderLayout.CENTER);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
use of java.beans.PropertyChangeListener in project vcell by virtualcell.
the class PropertyChangeListenerProxyVCell method addProxyListener.
public static void addProxyListener(PropertyChangeSupport pcs, PropertyChangeListener listener) {
if (listener instanceof PropertyChangeListenerProxyVCell) {
throw new IllegalArgumentException("listener already proxy");
}
PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners();
for (PropertyChangeListener pcl : listeners) {
if (pcl == listener || (pcl instanceof PropertyChangeListenerProxyVCell && ((PropertyChangeListenerProxyVCell) pcl).listener == listener)) {
throw new IllegalArgumentException("duplicate listener " + listener);
}
}
pcs.addPropertyChangeListener(new PropertyChangeListenerProxyVCell(listener));
}
use of java.beans.PropertyChangeListener in project drools by kiegroup.
the class PropertyListenerTest method runTest.
@Test
public void runTest() {
final KieServices kieServices = KieServices.Factory.get();
final Resource drlResource = kieServices.getResources().newClassPathResource("propertyListenerTest.drl", getClass());
final KieBase kieBase = KieBaseUtil.getKieBaseAndBuildInstallModule(TestConstants.PACKAGE_REGRESSION, kieBaseTestConfiguration, drlResource);
final KieSession session = kieBase.newKieSession();
final ArrayList<Person> people = new ArrayList<Person>();
people.add(new Person("Test 1"));
people.add(new Person("Test 2"));
LOGGER.info("== Listeners attached before rules ==");
for (Person person : people) {
for (PropertyChangeListener listener : person.getBoundSupport().getPropertyChangeListeners()) {
LOGGER.info("Listener attached of type: " + listener);
}
}
// call rules
final List<Command<?>> commands = new ArrayList<Command<?>>();
commands.add(kieServices.getCommands().newInsert(people));
commands.add(kieServices.getCommands().newFireAllRules());
session.execute(kieServices.getCommands().newBatchExecution(commands, null));
session.dispose();
LOGGER.info("Session disposed");
LOGGER.info("== Listeners attached after rules (should be none) ==");
printAndAssertListenersFromPeople(people);
// update name to trigger update
people.get(0).setName("Test 3");
LOGGER.info("== Listeners attached after updating name (should be none) ==");
printAndAssertListenersFromPeople(people);
}
Aggregations