use of java.lang.Override in project incubator-atlas by apache.
the class Titan0Element method setPropertyFromElementsIds.
@Override
public void setPropertyFromElementsIds(String propertyName, List<AtlasElement> values) {
List<String> propertyValue = new ArrayList<>(values.size());
for (AtlasElement element : values) {
propertyValue.add(element.getId().toString());
}
setProperty(propertyName, propertyValue);
}
use of java.lang.Override in project AnDevCon-RxPatterns by colintheshots.
the class Example16Test method test_anomalous_network_event.
@Test
public void test_anomalous_network_event() {
// TestScheduler lets you advance time by hand
TestScheduler scheduler = Schedulers.test();
TestSubscriber<NetworkResponse> subscriber = new TestSubscriber<>();
// Scheduler.Worker lets you schedule events in time
Scheduler.Worker worker = scheduler.createWorker();
// Subjects allow both input and output, so they can be swapped in for
// Retrofit calls to unit test your code.
final PublishSubject<NetworkResponse> networkSubject = PublishSubject.create();
// schedule a first observable event to occur at 1000 ms
worker.schedule(new Action0() {
@Override
public void call() {
networkSubject.onError(new TimeoutException());
}
}, 10000, TimeUnit.MILLISECONDS);
// subscribing so events appear
networkSubject.subscribeOn(scheduler).subscribe(subscriber);
scheduler.advanceTimeBy(20000, TimeUnit.MILLISECONDS);
subscriber.awaitTerminalEvent();
// we use the class-based assertError method, since it's easier to match
subscriber.assertError(TimeoutException.class);
subscriber.assertValueCount(0);
subscriber.assertUnsubscribed();
}
use of java.lang.Override in project android_frameworks_base by crdroidandroid.
the class KeyguardSecurityViewFlipper method onMeasure.
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
final int widthMode = MeasureSpec.getMode(widthSpec);
final int heightMode = MeasureSpec.getMode(heightSpec);
if (DEBUG && widthMode != MeasureSpec.AT_MOST) {
Log.w(TAG, "onMeasure: widthSpec " + MeasureSpec.toString(widthSpec) + " should be AT_MOST");
}
if (DEBUG && heightMode != MeasureSpec.AT_MOST) {
Log.w(TAG, "onMeasure: heightSpec " + MeasureSpec.toString(heightSpec) + " should be AT_MOST");
}
final int widthSize = MeasureSpec.getSize(widthSpec);
final int heightSize = MeasureSpec.getSize(heightSpec);
int maxWidth = widthSize;
int maxHeight = heightSize;
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (lp.maxWidth > 0 && lp.maxWidth < maxWidth) {
maxWidth = lp.maxWidth;
}
if (lp.maxHeight > 0 && lp.maxHeight < maxHeight) {
maxHeight = lp.maxHeight;
}
}
final int wPadding = getPaddingLeft() + getPaddingRight();
final int hPadding = getPaddingTop() + getPaddingBottom();
maxWidth = Math.max(0, maxWidth - wPadding);
maxHeight = Math.max(0, maxHeight - hPadding);
int width = widthMode == MeasureSpec.EXACTLY ? widthSize : 0;
int height = heightMode == MeasureSpec.EXACTLY ? heightSize : 0;
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int childWidthSpec = makeChildMeasureSpec(maxWidth, lp.width);
final int childHeightSpec = makeChildMeasureSpec(maxHeight, lp.height);
child.measure(childWidthSpec, childHeightSpec);
width = Math.max(width, Math.min(child.getMeasuredWidth(), widthSize - wPadding));
height = Math.max(height, Math.min(child.getMeasuredHeight(), heightSize - hPadding));
}
setMeasuredDimension(width + wPadding, height + hPadding);
}
use of java.lang.Override in project charts by vaadin.
the class SVGGeneratorExample method getChart.
@Override
protected Component getChart() {
final Chart chart;
chart = new Chart();
chart.setHeight("450px");
chart.setWidth("100%");
Configuration configuration = chart.getConfiguration();
configuration.getChart().setZoomType(ZoomType.X);
configuration.getChart().setSpacingRight(20);
configuration.getTitle().setText("USD to EUR exchange rate from 2006 through 2008");
String title = Page.getCurrent().getWebBrowser().isTouchDevice() ? "Drag your finger over the plot to zoom in" : "Click and drag in the plot area to zoom in";
configuration.getSubTitle().setText(title);
configuration.getxAxis().setType(AxisType.DATETIME);
configuration.getxAxis().setMinRange(TWO_WEEKS);
configuration.getxAxis().setTitle(new AxisTitle(""));
configuration.getLegend().setEnabled(false);
YAxis yAxis = configuration.getyAxis();
yAxis.setTitle(new AxisTitle("Exchange rate"));
yAxis.setMin(0.6);
yAxis.setStartOnTick(false);
yAxis.setShowFirstLabel(false);
configuration.getTooltip().setShared(true);
PlotOptionsArea plotOptions = new PlotOptionsArea();
GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
fillColor.addColorStop(0, SolidColor.AQUA);
fillColor.addColorStop(1, SolidColor.BLACK);
plotOptions.setFillColor(fillColor);
plotOptions.setLineWidth(1);
plotOptions.setShadow(false);
Marker marker = new Marker();
marker.setEnabled(false);
Hover hoverState = new Hover(true);
hoverState.setRadius(5);
States states = new States();
states.setHover(hoverState);
plotOptions.setStates(states);
plotOptions.setMarker(marker);
plotOptions.setShadow(false);
configuration.setPlotOptions(plotOptions);
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
ListSeries ls = new ListSeries();
PlotOptionsArea options = new PlotOptionsArea();
options.setPointInterval(DAY_IN_MILLIS);
ls.setPlotOptions(options);
ls.setName("USD to EUR");
try {
options.setPointStart(df.parse("2006/01/02").getTime());
} catch (ParseException e) {
e.printStackTrace();
}
ls.setData(USD_TO_EUR_EXCHANGE_RATES);
configuration.setSeries(ls);
chart.drawChart(configuration);
Button export = new Button("Export");
StreamResource.StreamSource svgStreamSource = createSVGStreamSource(chart);
FileDownloader fileDownloader = new FileDownloader(new StreamResource(svgStreamSource, "chart.svg"));
fileDownloader.extend(export);
Button timelineToggle = new Button("Timeline toggle");
timelineToggle.addClickListener(new Button.ClickListener() {
boolean timeline = false;
@Override
public void buttonClick(Button.ClickEvent event) {
timeline = !timeline;
chart.setTimeline(timeline);
}
});
HorizontalLayout controls = new HorizontalLayout(export, timelineToggle);
controls.setSpacing(true);
addComponent(controls);
setSpacing(true);
return chart;
}
use of java.lang.Override in project android_frameworks_base by crdroidandroid.
the class KeyguardSecurityViewFlipper method onTouchEvent.
@Override
public boolean onTouchEvent(MotionEvent ev) {
boolean result = super.onTouchEvent(ev);
mTempRect.set(0, 0, 0, 0);
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.VISIBLE) {
offsetRectIntoDescendantCoords(child, mTempRect);
ev.offsetLocation(mTempRect.left, mTempRect.top);
result = child.dispatchTouchEvent(ev) || result;
ev.offsetLocation(-mTempRect.left, -mTempRect.top);
}
}
return result;
}
Aggregations