Search in sources :

Example 66 with EventObject

use of java.util.EventObject in project robovm by robovm.

the class EventObjectTest method testGetSource.

public void testGetSource() {
    Object source = new Object();
    assertSame(source, new EventObject(source).getSource());
}
Also used : EventObject(java.util.EventObject) EventObject(java.util.EventObject)

Example 67 with EventObject

use of java.util.EventObject in project robovm by robovm.

the class EventObjectTest method testSerializationNullsOutSource.

public void testSerializationNullsOutSource() {
    String s = "aced0005737200156a6176612e7574696c2e4576656e744f626a6563744" + "c8d094e186d7da80200007870";
    Object source = new Object();
    EventObject eventObject = new EventObject(source);
    new SerializationTester<EventObject>(eventObject, s) {

        @Override
        protected boolean equals(EventObject a, EventObject b) {
            return a.getSource() == null || b.getSource() == null || a.getSource() == b.getSource();
        }
    }.test();
}
Also used : EventObject(java.util.EventObject) EventObject(java.util.EventObject)

Example 68 with EventObject

use of java.util.EventObject in project intellij-community by JetBrains.

the class LineStatusMarkerPopup method showHintAt.

public void showHintAt(@Nullable Point mousePosition) {
    if (!myTracker.isValid())
        return;
    final Disposable disposable = Disposer.newDisposable();
    FileType fileType = getFileType();
    List<DiffFragment> wordDiff = computeWordDiff();
    installMasterEditorHighlighters(wordDiff, disposable);
    JComponent editorComponent = createEditorComponent(fileType, wordDiff);
    ActionToolbar toolbar = buildToolbar(mousePosition, disposable);
    // we need valid ActionToolbar.getPreferredSize() to calc size of popup
    toolbar.updateActionsImmediately();
    toolbar.setReservePlaceAutoPopupIcon(false);
    PopupPanel popupPanel = new PopupPanel(myEditor, toolbar, editorComponent);
    LightweightHint hint = new LightweightHint(popupPanel);
    HintListener closeListener = new HintListener() {

        public void hintHidden(final EventObject event) {
            Disposer.dispose(disposable);
        }
    };
    hint.addHintListener(closeListener);
    int line = myEditor.getCaretModel().getLogicalPosition().line;
    Point point = HintManagerImpl.getHintPosition(hint, myEditor, new LogicalPosition(line, 0), HintManager.UNDER);
    if (mousePosition != null) {
        // show right after the nearest line
        int lineHeight = myEditor.getLineHeight();
        int delta = (point.y - mousePosition.y) % lineHeight;
        if (delta < 0)
            delta += lineHeight;
        point.y = mousePosition.y + delta;
    }
    // align main editor with the one in popup
    point.x -= popupPanel.getEditorTextOffset();
    int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING;
    HintManagerImpl.getInstanceImpl().showEditorHint(hint, myEditor, point, flags, -1, false, new HintHint(myEditor, point));
    if (!hint.isVisible()) {
        closeListener.hintHidden(null);
    }
}
Also used : Disposable(com.intellij.openapi.Disposable) LightweightHint(com.intellij.ui.LightweightHint) EventObject(java.util.EventObject) HintHint(com.intellij.ui.HintHint) LightweightHint(com.intellij.ui.LightweightHint) HintListener(com.intellij.ui.HintListener) HintHint(com.intellij.ui.HintHint) DiffFragment(com.intellij.diff.fragments.DiffFragment) PlainTextFileType(com.intellij.openapi.fileTypes.PlainTextFileType) FileType(com.intellij.openapi.fileTypes.FileType)

Example 69 with EventObject

use of java.util.EventObject in project intellij-community by JetBrains.

the class TrafficTooltipRendererImpl method show.

@Override
public LightweightHint show(@NotNull Editor editor, @NotNull Point p, boolean alignToRight, @NotNull TooltipGroup group, @NotNull HintHint hintHint) {
    myTrafficLightRenderer = (TrafficLightRenderer) ((EditorMarkupModelImpl) editor.getMarkupModel()).getErrorStripeRenderer();
    myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint);
    repaintTooltipWindow();
    LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth());
    LightweightHint hint = new LightweightHint(myPanel);
    HintManagerImpl hintManager = (HintManagerImpl) HintManager.getInstance();
    hintManager.showEditorHint(hint, editor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
    hint.addHintListener(new HintListener() {

        @Override
        public void hintHidden(EventObject event) {
            //double hide?
            if (myPanel == null)
                return;
            myPanel = null;
            onHide.run();
        }
    });
    return hint;
}
Also used : HintListener(com.intellij.ui.HintListener) HintManagerImpl(com.intellij.codeInsight.hint.HintManagerImpl) LightweightHint(com.intellij.ui.LightweightHint) EditorMarkupModelImpl(com.intellij.openapi.editor.impl.EditorMarkupModelImpl) EventObject(java.util.EventObject)

Example 70 with EventObject

use of java.util.EventObject in project camel by apache.

the class EventNotifierFailureHandledEventsTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    DefaultCamelContext context = new DefaultCamelContext(createRegistry());
    context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {

        public void notify(EventObject event) throws Exception {
            events.add(event);
        }

        public boolean isEnabled(EventObject event) {
            return true;
        }

        @Override
        protected void doStart() throws Exception {
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) EventObject(java.util.EventObject)

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