Search in sources :

Example 41 with EventObject

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);
}
Also used : ProjectController(org.apache.cayenne.modeler.ProjectController) EventObject(java.util.EventObject)

Example 42 with EventObject

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);
}
Also used : EventObject(java.util.EventObject) Test(org.junit.Test)

Example 43 with EventObject

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);
}
Also used : EventObject(java.util.EventObject) Test(org.junit.Test)

Example 44 with EventObject

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();
    }
}
Also used : ConfigurationNode(org.apache.cayenne.configuration.ConfigurationNode) ProjectStatePreferences(org.apache.cayenne.modeler.pref.ProjectStatePreferences) BackingStoreException(java.util.prefs.BackingStoreException) EventObject(java.util.EventObject)

Example 45 with EventObject

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());
    }
}
Also used : OutColumnField(org.knime.core.node.util.dialog.field.OutColumnField) MouseEvent(java.awt.event.MouseEvent) EventObject(java.util.EventObject) DefaultCellEditor(javax.swing.DefaultCellEditor) FieldType(org.knime.core.node.util.dialog.OutFieldsTableModel.FieldType) JCheckBox(javax.swing.JCheckBox) DefaultOutFlowVariableField(org.knime.core.node.util.dialog.field.DefaultOutFlowVariableField) OutFlowVariableField(org.knime.core.node.util.dialog.field.OutFlowVariableField) JTable(javax.swing.JTable) EventObject(java.util.EventObject) Component(java.awt.Component)

Aggregations

EventObject (java.util.EventObject)111 EventFactory (org.apache.camel.spi.EventFactory)25 EventNotifier (org.apache.camel.spi.EventNotifier)25 ManagementStrategy (org.apache.camel.spi.ManagementStrategy)25 AlertHandler (edu.cmu.cs.hcii.cogtool.util.AlertHandler)21 EventNotifierSupport (org.apache.camel.support.EventNotifierSupport)15 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)10 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)9 Hashtable (java.util.Hashtable)8 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)7 ProgressDialogListener (org.vcell.util.ProgressDialogListener)7 Test (org.junit.Test)6 MouseEvent (java.awt.event.MouseEvent)4 File (java.io.File)4 ExchangeCompletedEvent (org.apache.camel.management.event.ExchangeCompletedEvent)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 Design (edu.cmu.cs.hcii.cogtool.model.Design)3 TaskGroup (edu.cmu.cs.hcii.cogtool.model.TaskGroup)3 DesignEditorFrame (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame)3 PreferencesHandler (jmri.plaf.macosx.PreferencesHandler)3