Search in sources :

Example 81 with Override

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);
}
Also used : ArrayList(java.util.ArrayList) AtlasElement(org.apache.atlas.repository.graphdb.AtlasElement) Override(java.lang.Override)

Example 82 with Override

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();
}
Also used : Action0(rx.functions.Action0) TestScheduler(rx.schedulers.TestScheduler) Scheduler(rx.Scheduler) TestSubscriber(rx.observers.TestSubscriber) TestScheduler(rx.schedulers.TestScheduler) Override(java.lang.Override) TimeoutException(java.util.concurrent.TimeoutException) Test(org.junit.Test)

Example 83 with Override

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);
}
Also used : View(android.view.View) Override(java.lang.Override)

Example 84 with Override

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;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) String(java.lang.String) Marker(com.vaadin.addon.charts.model.Marker) States(com.vaadin.addon.charts.model.States) StreamResource(com.vaadin.server.StreamResource) PlotOptionsArea(com.vaadin.addon.charts.model.PlotOptionsArea) ListSeries(com.vaadin.addon.charts.model.ListSeries) Button(com.vaadin.ui.Button) FileDownloader(com.vaadin.server.FileDownloader) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Override(java.lang.Override) Chart(com.vaadin.addon.charts.Chart) Override(java.lang.Override)

Example 85 with Override

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;
}
Also used : View(android.view.View) Override(java.lang.Override)

Aggregations

Override (java.lang.Override)177 StringBuilder (java.lang.StringBuilder)83 String (java.lang.String)36 NonNull (android.support.annotation.NonNull)24 ContentValues (android.content.ContentValues)12 ArrayList (java.util.ArrayList)11 View (android.view.View)10 Integer (java.lang.Integer)9 Long (java.lang.Long)9 HashMap (java.util.HashMap)9 Boolean (java.lang.Boolean)8 Double (java.lang.Double)8 Float (java.lang.Float)8 Short (java.lang.Short)8 Bitmap (android.graphics.Bitmap)5 Canvas (android.graphics.Canvas)5 Handler (android.os.Handler)5 HandlerThread (android.os.HandlerThread)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5 Map (java.util.Map)5