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());
}
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;
}
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");
}
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();
}
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("");
}
Aggregations