use of java.util.EventObject in project cayenne by apache.
the class NavigateBackwardAction method performAction.
/**
* Moves to the next element in the navigation history
*/
public void performAction(ActionEvent e) {
ProjectController mediator = getProjectController();
EventObject newEvent = new EventObject(this);
mediator.fireNavigationEvent(newEvent);
}
use of java.util.EventObject in project cayenne by apache.
the class MyCayenneEvent method testSubjectListenerWouldRegisterListener.
@Test
public void testSubjectListenerWouldRegisterListener() {
MockListener listener = new MockListener(eventManager);
eventManager.addListener(listener, "processEvent", EventObject.class, MockListener.mockSubject);
// test concurrent modification of the queue ... on event listener would attempt
// adding another listener
// add more than one listener to see that dispatch can proceed after one of the
// listeners recats to event
eventManager.addListener(new MockListener(eventManager), "processEvent", EventObject.class, MockListener.mockSubject);
eventManager.postEvent(new EventObject(this), MockListener.mockSubject);
}
use of java.util.EventObject in project cayenne by apache.
the class MyCayenneEvent method testWrongRegisteredEventClass.
@Test
public void testWrongRegisteredEventClass() throws Exception {
EventSubject subject = EventSubject.getSubject(this.getClass(), "XXX");
// we register a method that takes a CayenneEvent or subclass thereof..
eventManager.addListener(this, "seeNotification", CayenneEvent.class, subject);
// ..but post a subclass of EventObject that is not compatible with CayenneEvent
eventManager.postEvent(new EventObject(this), subject);
assertReceivedEvents(0, this);
}
use of java.util.EventObject in project cayenne by apache.
the class ProjectStateUtil method saveLastState.
public void saveLastState(ProjectController controller) {
EventObject displayEvent = controller.getLastDisplayEvent();
ConfigurationNode[] multiplyObjects = controller.getCurrentPaths();
if (displayEvent == null && multiplyObjects == null) {
return;
}
ProjectStatePreferences preferences = controller.getProjectStatePreferences();
if (preferences.getCurrentPreference() == null) {
return;
}
try {
preferences.getCurrentPreference().clear();
} catch (BackingStoreException e) {
// ignore exception
}
if (displayEvent != null) {
DisplayEventTypes.valueOf(displayEvent.getClass().getSimpleName()).createDisplayEventType(controller).saveLastDisplayEvent();
} else if (multiplyObjects.length != 0) {
new MultipleObjectsDisplayEventType(controller).saveLastDisplayEvent();
}
}
use of java.util.EventObject in project knime-core by knime.
the class OutFieldsTable method updateData.
/**
* Set the table data.
*
* @param fields the fields
* @param spec the input spec
* @param flowVars the flow variables
*/
public void updateData(final FieldCollection fields, final DataTableSpec spec, final Map<String, FlowVariable> flowVars) {
m_spec = spec;
m_flowVars = flowVars;
m_model.clear();
for (int r = 0; r < fields.getOutColumnList().size(); r++) {
OutColumnField field = fields.getOutColumnList().get(r);
addRow(field);
}
for (int r = 0; r < fields.getOutFlowVariableList().size(); r++) {
OutFlowVariableField field = fields.getOutFlowVariableList().get(r);
addRow(field);
}
JTable table = getTable();
table.getColumnModel().getColumn(m_model.getIndex(Column.REPLACE_EXISTING)).setCellRenderer(new BooleanRenderer());
table.getColumnModel().getColumn(m_model.getIndex(Column.REPLACE_EXISTING)).setCellEditor(new DefaultCellEditor(new JCheckBox()));
if (!m_flowVarsOnly) {
table.getColumnModel().getColumn(m_model.getIndex(Column.FIELD_TYPE)).setCellEditor(createFieldTypeCellEditor());
}
table.getColumnModel().getColumn(m_model.getIndex(Column.COLUMN)).setCellRenderer(new InputTableCellRenderer());
table.getColumnModel().getColumn(m_model.getIndex(Column.COLUMN)).setCellEditor(new InputTableCellEditor(this, m_spec, m_flowVars));
table.getColumnModel().getColumn(m_model.getIndex(Column.DATA_TYPE)).setCellRenderer(new DataTypeTableCellRenderer());
table.getColumnModel().getColumn(m_model.getIndex(Column.DATA_TYPE)).setCellEditor(new DataTypeTableCellEditor(this, m_spec, m_flowVars));
if (!m_flowVarsOnly) {
table.getColumnModel().getColumn(m_model.getIndex(Column.IS_COLLECTION)).setCellRenderer(new BooleanRenderer() {
/**
* {@inheritDoc}
*/
@Override
public Component getTableCellRendererComponent(final JTable fooTable, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
Component comp = super.getTableCellRendererComponent(fooTable, value, isSelected, hasFocus, row, column);
FieldType fieldType = getFieldType(row);
comp.setEnabled(fieldType.equals(FieldType.Column));
return comp;
}
});
table.getColumnModel().getColumn(m_model.getIndex(Column.IS_COLLECTION)).setCellEditor(new DefaultCellEditor(new JCheckBox()) {
/**
* {@inheritDoc}
*/
@Override
public boolean isCellEditable(final EventObject anEvent) {
int row = getTable().rowAtPoint(((MouseEvent) anEvent).getPoint());
FieldType fieldType = getFieldType(row);
return fieldType.equals(FieldType.Column);
}
});
}
if (m_defineDefaultValues) {
table.getColumnModel().getColumn(m_model.getIndex(Column.DEFAULT_VALUE)).setCellRenderer(new DefaultFieldTableCellRenderer());
}
}
Aggregations