Search in sources :

Example 41 with Observable

use of java.util.Observable in project AutoRefactor by JnRouvignac.

the class ObsoleteGenericMapRatherThanRawMapSample method refactorWithMethod.

public void refactorWithMethod() {
    // Keep this comment
    java.util.TreeMap<Observable, Observable> map = new java.util.TreeMap<Observable, Observable>();
    // Keep this comment too
    map.put(new Observable(), new Observable());
}
Also used : TreeMap(java.util.TreeMap) Observable(java.util.Observable)

Example 42 with Observable

use of java.util.Observable in project xtext-xtend by eclipse.

the class LineWrapTab method doCreatePreviewPane.

@Override
protected Composite doCreatePreviewPane(Composite composite, int numColumns) {
    super.doCreatePreviewPane(composite, numColumns);
    formatterPreview.moveMarginToColumn(previewLineWidth.toString());
    final NumberPreference previewLineWidth = new NumberPreference(composite, numColumns / 2, fPreviewPreferences, PREF_PREVIEW_LINE_WIDTH, 0, 999, "Line width for preview");
    fDefaultFocusManager.add(previewLineWidth);
    previewLineWidth.addObserver(fUpdater);
    previewLineWidth.addObserver(new Observer() {

        @Override
        public void update(Observable o, Object arg) {
            if (fDialogSettings != null)
                fDialogSettings.put(PREF_PREVIEW_LINE_WIDTH, fPreviewPreferences.get(PREF_PREVIEW_LINE_WIDTH));
        }
    });
    return composite;
}
Also used : Observer(java.util.Observer) Observable(java.util.Observable)

Example 43 with Observable

use of java.util.Observable in project tcom-poi by ai-coders.

the class ObserverTest method testObserver.

@Test
public void testObserver() {
    Watched watched = new Watched();
    WatcherDemo watcherDemo = new WatcherDemo();
    watched.addObserver(watcherDemo);
    watched.addObserver(new Observer() {

        @Override
        public void update(Observable o, Object arg) {
            if (arg.toString().equals("closeWindows")) {
                System.out.println("已经关闭窗口");
            }
        }
    });
    // 触发打开窗口事件,通知观察者
    watched.notifyObservers("openWindows");
    // 触发关闭窗口事件,通知观察者
    watched.notifyObservers("closeWindows");
}
Also used : Observer(java.util.Observer) Observable(java.util.Observable) Test(org.junit.Test)

Example 44 with Observable

use of java.util.Observable in project clusterMaker2 by RBVI.

the class KnnDendroView method setupViews.

/**
 *  This method should be called only during initial setup of the modelview
 *
 *  It sets up the views and binds them all to config nodes.
 */
protected void setupViews() {
    DataModel knnModel = getDataModel();
    hintpanel = new MessagePanel("Usage Hints");
    statuspanel = new MessagePanel("View Status");
    colorPresets = new ColorPresets(root);
    cpresetEditor = new ColorPresetEditor(colorPresets);
    ColorExtractor colorExtractor = new ColorExtractor();
    colorExtractor.setDefaultColorSet(colorPresets.getDefaultColorSet());
    colorExtractor.bindConfig(root);
    colorExtractor.setMissing(DataModel.NODATA, DataModel.EMPTY);
    KnnArrayDrawer kArrayDrawer = new KnnArrayDrawer();
    kArrayDrawer.setColorExtractor(colorExtractor);
    arrayDrawer = kArrayDrawer;
    // XXX shouldn't need to observer, should be immuable?
    ((Observable) getDataModel()).addObserver(arrayDrawer);
    globalview = new GlobalView();
    // scrollbars, mostly used by maps
    globalXscrollbar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 1);
    globalYscrollbar = new JScrollBar(JScrollBar.VERTICAL, 0, 1, 0, 1);
    zoomXscrollbar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 1);
    zoomYscrollbar = new JScrollBar(JScrollBar.VERTICAL, 0, 1, 0, 1);
    zoomXmap = new MapContainer();
    zoomXmap.setDefaultScale(12.0);
    zoomXmap.setScrollbar(zoomXscrollbar);
    zoomYmap = new MapContainer();
    zoomYmap.setDefaultScale(12.0);
    zoomYmap.setScrollbar(zoomYscrollbar);
    // globalmaps tell globalview, atrview, and gtrview
    // where to draw each data point.
    // the scrollbars "scroll" by communicating with the maps.
    globalXmap = new MapContainer();
    globalXmap.setDefaultScale(2.0);
    globalXmap.setScrollbar(globalXscrollbar);
    globalYmap = new MapContainer();
    globalYmap.setDefaultScale(2.0);
    globalYmap.setScrollbar(globalYscrollbar);
    globalview.setXMap(globalXmap);
    globalview.setYMap(globalYmap);
    globalview.setZoomYMap(getZoomYmap());
    globalview.setZoomXMap(getZoomXmap());
    arraynameview = new ArrayNameView(getDataModel().getArrayHeaderInfo());
    leftTreeDrawer = new LeftTreeDrawer();
    gtrview = new GTRView();
    gtrview.setMap(globalYmap);
    gtrview.setLeftTreeDrawer(leftTreeDrawer);
    invertedTreeDrawer = new InvertedTreeDrawer();
    atrview = new ATRView();
    atrview.setMap(globalXmap);
    atrview.setInvertedTreeDrawer(invertedTreeDrawer);
    atrzview = new ATRZoomView();
    atrzview.setZoomMap(getZoomXmap());
    atrzview.setInvertedTreeDrawer(invertedTreeDrawer);
    zoomview = new ZoomView();
    zoomview.setYMap(getZoomYmap());
    zoomview.setXMap(getZoomXmap());
    zoomview.setArrayDrawer(arrayDrawer);
    globalview.setArrayDrawer(arrayDrawer);
    arraynameview.setMapping(getZoomXmap());
    textview = new TextViewManager(getDataModel().getGeneHeaderInfo());
    textview.setMap(getZoomYmap());
    doDoubleLayout();
    // reset persistent popups
    settingsFrame = null;
    // color extractor
    colorExtractor.bindConfig(getFirst("ColorExtractor"));
    // set data first to avoid adding auto-genereated contrast to documentConfig.
    kArrayDrawer.setDataMatrix(knnModel.getDataMatrix());
    kArrayDrawer.bindConfig(getFirst("ArrayDrawer"));
    // responsible for adding and removing components...
    bindTrees();
    globalXmap.bindConfig(getFirst("GlobalXMap"));
    globalYmap.bindConfig(getFirst("GlobalYMap"));
    getZoomXmap().bindConfig(getFirst("ZoomXMap"));
    getZoomYmap().bindConfig(getFirst("ZoomYMap"));
    textview.bindConfig(getFirst("TextViewParent"));
    arraynameview.bindConfig(getFirst("ArrayNameView"));
    // perhaps I could remember this stuff in the MapContainer...
    DataMatrix dataMatrix = getDataModel().getDataMatrix();
    globalXmap.setIndexRange(0, dataMatrix.getNumCol() - 1);
    globalYmap.setIndexRange(0, dataMatrix.getNumRow() - 1);
    getZoomXmap().setIndexRange(-1, -1);
    getZoomYmap().setIndexRange(-1, -1);
    globalXmap.notifyObservers();
    globalYmap.notifyObservers();
    getZoomXmap().notifyObservers();
    getZoomYmap().notifyObservers();
}
Also used : DataMatrix(edu.ucsf.rbvi.clusterMaker2.internal.treeview.DataMatrix) Observable(java.util.Observable) JScrollBar(javax.swing.JScrollBar) DataModel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.DataModel) MessagePanel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel)

Example 45 with Observable

use of java.util.Observable in project mockito by mockito.

the class SubclassByteBuddyMockMakerTest method is_type_mockable_allow_anonymous.

@Test
public void is_type_mockable_allow_anonymous() {
    Observer anonymous = new Observer() {

        @Override
        public void update(Observable o, Object arg) {
        }
    };
    MockMaker.TypeMockability mockable = mockMaker.isTypeMockable(anonymous.getClass());
    assertThat(mockable.mockable()).isTrue();
    assertThat(mockable.nonMockableReason()).contains("");
}
Also used : Observer(java.util.Observer) MockMaker(org.mockito.plugins.MockMaker) Observable(java.util.Observable) Test(org.junit.Test)

Aggregations

Observable (java.util.Observable)52 Observer (java.util.Observer)30 Test (org.junit.Test)8 ContentQueryMap (android.content.ContentQueryMap)6 ContentResolver (android.content.ContentResolver)6 ContentValues (android.content.ContentValues)6 Cursor (android.database.Cursor)6 Handler (android.os.Handler)6 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 LinkedList (java.util.LinkedList)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 MessagePanel (edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)2 IJobChangeListener (org.eclipse.core.runtime.jobs.IJobChangeListener)2 Job (org.eclipse.core.runtime.jobs.Job)2 KeyStoreAlias (org.jcryptool.crypto.keystore.backend.KeyStoreAlias)2 WithDumpException (com.github.mob41.osumer.debug.WithDumpException)1 OsuDownloader (com.github.mob41.osumer.io.OsuDownloader)1