Sets a new failure drawable with scale type.
973356
public void setFailureImage(Drawable drawable, ScalingUtils.ScaleType scaleType) {
    setChildDrawableAtIndex(FAILURE_IMAGE_INDEX, drawable);
    getScaleTypeDrawableAtIndex(FAILURE_IMAGE_INDEX).setScaleType(scaleType);
  }
1323370
def create_failure(self, exception=None):
        
        if exception:
            return FailedFuture(type(exception), exception, None)
        return FailedFuture(*sys.exc_info())
727702
private void setChildDrawableAtIndex(int index, @Nullable Drawable drawable) {
    if (drawable == null) {
      mFadeDrawable.setDrawable(index, null);
      return;
    }
    drawable = WrappingUtils.maybeApplyLeafRounding(drawable, mRoundingParams, mResources);
    getParentDrawableAtIndex(index).setDrawable(drawable);
  }
695654
private static void tryLayout(
            final Graphics2D graphics2D, final DistanceUnit scaleUnit, final double scaleDenominator,
            final double intervalLengthInWorldUnits, final ScaleBarRenderSettings settings,
            final int tryNumber) {
        if (tryNumber > MAX_NUMBER_LAYOUTING_TRIES) {
            // if no good layout can be found, stop. an empty scalebar graphic will be shown.
            LOGGER.error("layouting the scalebar failed (unit: {}, scale: {})", scaleUnit, scaleDenominator);
            return;
        }

        final ScalebarAttributeValues scalebarParams = settings.getParams();
        final DistanceUnit intervalUnit =
                bestUnit(scaleUnit, intervalLengthInWorldUnits, scalebarParams.lockUnits);
        final float intervalLengthInPixels = (float) scaleUnit.convertTo(
                intervalLengthInWorldUnits / scaleDenominator, DistanceUnit.PX);

        //compute the label positions
        final List<Label> labels = new ArrayList<>(scalebarParams.intervals + 1);
        final float leftLabelMargin;
        final float rightLabelMargin;
        final float topLabelMargin;
        final float bottomLabelMargin;

        final Font font = new Font(scalebarParams.font, Font.PLAIN, getFontSize(settings));
        final FontRenderContext frc = new FontRenderContext(null, true, true);

        if (scalebarParams.intervals > 1 || scalebarParams.subIntervals) {
            //the label will be centered under each tick mark
            for (int i = 0; i <= scalebarParams.intervals; i++) {
                String labelText = createLabelText(scaleUnit, intervalLengthInWorldUnits * i, intervalUnit);
                if (i == scalebarParams.intervals) {
                    // only show unit for the last label
                    labelText += intervalUnit;
                }
                TextLayout labelLayout = new TextLayout(labelText, font, frc);
                labels.add(new Label(intervalLengthInPixels * i, labelLayout, graphics2D));
            }
            leftLabelMargin = labels.get(0).getRotatedWidth(scalebarParams.getLabelRotation()) / 2.0f;
            rightLabelMargin =
                    labels.get(labels.size() - 1).getRotatedWidth(scalebarParams.getLabelRotation()) / 2.0f;
            topLabelMargin = labels.get(0).getRotatedHeight(scalebarParams.getLabelRotation()) / 2.0f;
            bottomLabelMargin =
                    labels.get(labels.size() - 1).getRotatedHeight(scalebarParams.getLabelRotation()) / 2.0f;
        } else {
            //if there is only one interval, place the label centered between the two tick marks
            String labelText =
                    createLabelText(scaleUnit, intervalLengthInWorldUnits, intervalUnit) + intervalUnit;
            TextLayout labelLayout = new TextLayout(labelText, font, frc);
            final Label label = new Label(intervalLengthInPixels / 2.0f, labelLayout, graphics2D);
            labels.add(label);
            rightLabelMargin = 0;
            leftLabelMargin = 0;
            topLabelMargin = 0;
            bottomLabelMargin = 0;
        }

        if (fitsAvailableSpace(scalebarParams, intervalLengthInPixels,
                               leftLabelMargin, rightLabelMargin, topLabelMargin, bottomLabelMargin,
                               settings)) {
            //the layout fits the maxSize
            settings.setLabels(labels);
            settings.setScaleUnit(scaleUnit);
            settings.setIntervalLengthInPixels(intervalLengthInPixels);
            settings.setIntervalLengthInWorldUnits(intervalLengthInWorldUnits);
            settings.setIntervalUnit(intervalUnit);
            settings.setLeftLabelMargin(leftLabelMargin);
            settings.setRightLabelMargin(rightLabelMargin);
            settings.setTopLabelMargin(topLabelMargin);
            settings.setBottomLabelMargin(bottomLabelMargin);

            doLayout(graphics2D, scalebarParams, settings);
        } else {
            //not enough room because of the labels, try a smaller bar
            double nextIntervalDistance = getNearestNiceValue(
                    intervalLengthInWorldUnits * 0.9, scaleUnit, scalebarParams.lockUnits);
            tryLayout(graphics2D, scaleUnit, scaleDenominator, nextIntervalDistance, settings,
                      tryNumber + 1);
        }
    }
673762
protected void setMapScaleBar() {
        String value = this.sharedPreferences.getString(SETTING_SCALEBAR, SETTING_SCALEBAR_BOTH);

        if (SETTING_SCALEBAR_NONE.equals(value)) {
            AndroidUtil.setMapScaleBar(this.mapView, null, null);
        } else {
            if (SETTING_SCALEBAR_BOTH.equals(value)) {
                AndroidUtil.setMapScaleBar(this.mapView, MetricUnitAdapter.INSTANCE, ImperialUnitAdapter.INSTANCE);
            } else if (SETTING_SCALEBAR_METRIC.equals(value)) {
                AndroidUtil.setMapScaleBar(this.mapView, MetricUnitAdapter.INSTANCE, null);
            } else if (SETTING_SCALEBAR_IMPERIAL.equals(value)) {
                AndroidUtil.setMapScaleBar(this.mapView, ImperialUnitAdapter.INSTANCE, null);
            } else if (SETTING_SCALEBAR_NAUTICAL.equals(value)) {
                AndroidUtil.setMapScaleBar(this.mapView, NauticalUnitAdapter.INSTANCE, null);
            }
        }
    }
947339
public void setScale(double scale)
    {
        if(scale <= 0 || Double.isNaN(scale) || Double.isInfinite(scale))
            throw new ArithmeticException("Scale must be a positive value, not " + scale);
        this.scale = scale;
        this.logScale = log(scale);
    }
117578
def resetScale(self):
        """"""
        self.img.scale(1./self.imgScale[0], 1./self.imgScale[1])
        self.imgScale = (1.,1.)
764335
public void setScale(final float scale) {
        if (equal(mScale, scale) != true) {
            Log.d(TAG, "setScale(): old: %.2f, new: %.2f", mScale, scale);
            mScale = scale;
            setScale(mSceneRootObject, scale);
            setScale(mMainCameraRootObject, scale);
            setScale(mLeftCameraRootObject, scale);
            setScale(mRightCameraRootObject, scale);
            for (OnScaledListener listener : mOnScaledListeners) {
                try {
                    listener.onScaled(scale);
                } catch (Exception e) {
                    e.printStackTrace();
                    Log.e(TAG, e, "setScale()");
                }
            }
        }
    }
77700
public void setErrorText(FailedTaskReport failedTaskReport) {
		Point p = this.scrollPaneText.getViewport().getViewPosition();
		
		final String failedTaskReportString = failedTaskReport == null ? 
				"Failed Task Report is null" : failedTaskReport.toString();

		SwingUtilities.invokeLater(
			new Runnable(){
				public void run(){
					if(!scrollPaneText.isVisible())
					{
						topWrapper.remove(scrollPaneTable);
						scrollPaneTable.setVisible(false);
						topWrapper.add(scrollPaneText, BorderLayout.CENTER);
						scrollPaneText.setVisible(true);
						topWrapper.validate();
					}
					errorTextField.setText(failedTaskReportString);
					errorTextField.repaint();
				}
			}
		);

		this.scrollPaneText.getViewport().setViewPosition(p);
		this.exportButton.setEnabled(failedTaskReport != null);
	}
192167
public void setIconSize(int size){
        mEmptyIconSize = size;
        int width = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize;
        int height = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize;
        LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(width, height);
        mIcon.setLayoutParams(iconParams);
    }
1130290
public void setIgnore(Collection<Class<? extends Throwable>> ignore) {
        FailureInterpreter fi = getFailureInterpreter();
        if (!(fi instanceof DefaultFailureInterpreter)) {
            throw new IllegalStateException("setIgnore() not supported: this CircuitBreaker's FailureInterpreter isn't a DefaultFailureInterpreter.");
        }

        @SuppressWarnings("unchecked")
        Class<? extends Throwable>[] classes = new Class[ignore.size()];
        int i = 0;
        for(Class<? extends Throwable> c : ignore) {
            classes[i] = c;
            i++;
        }
        ((DefaultFailureInterpreter)fi).setIgnore(classes);
    }
115076
public void setRetryImage(Drawable drawable, ScalingUtils.ScaleType scaleType) {
    setChildDrawableAtIndex(RETRY_IMAGE_INDEX, drawable);
    getScaleTypeDrawableAtIndex(RETRY_IMAGE_INDEX).setScaleType(scaleType);
  }
1296746
public void failure(Throwable failure) {
        try {
            lock.lock();
            this.failure = failure;
            notifyHaveResult();
        }
        finally {
            lock.unlock();
        }
    }
10780
public void notifyFailure(final Callback<?> callback, final Throwable error) {
    invokeLater(new Runnable() {
      public void run() {
        callback.onFailure(error);
      }
    });
  }
1147061
@Override
  public FutureResultImpl<T> setFailure(Throwable throwable) {
    this.throwable = throwable;
    failed = true;
    checkCallHandler();
    return this;
  }
1100209
function onFailure(/*callable*/$callable)
    {
        if ($callable === null) {
            $this->failure = $callable;
            return $this;
        }

        if (!is_callable($callable))
            throw new \Exception(sprintf(
                'The argument given is not callable; given: (%s).'
                , \Poirot\Std\flatten($callable)
            ));

        
        $this->failure = $callable;
        return $this;
    }
1301685
public static void setDrawableProperties(
      @Nullable Drawable drawable, @Nullable DrawableProperties properties) {
    if (drawable == null || properties == null) {
      return;
    }
    properties.applyTo(drawable);
  }