mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Fix confirmation progress indicator
This commit is contained in:
parent
a64d695c10
commit
fbb3020506
2 changed files with 64 additions and 58 deletions
|
@ -797,6 +797,15 @@ bg color of non edit textFields: fafafa
|
||||||
-fx-underline: true;
|
-fx-underline: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Confirmation Indicator */
|
||||||
|
|
||||||
|
.progress-indicator > .determinate-indicator > .indicator {
|
||||||
|
-fx-background-color: -fx-control-inner-background;
|
||||||
|
-fx-border-color: -fx-box-border;
|
||||||
|
-fx-border-width: 1;
|
||||||
|
-fx-padding: 0.166667em; /* 2px */
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* *
|
* *
|
||||||
* Icons *
|
* Icons *
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
* The colour of the progress segment.
|
* The colour of the progress segment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private final ObjectProperty<Paint> progressColor = new StyleableObjectProperty<Paint>(null) {
|
private final ObjectProperty<Paint> progressColor = new StyleableObjectProperty<>(null) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(Paint newProgressColor) {
|
public void set(Paint newProgressColor) {
|
||||||
|
@ -352,8 +352,8 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
// only update pie arc to nearest degree
|
// only update pie arc to nearest degree
|
||||||
private int degProgress;
|
private int degProgress;
|
||||||
|
|
||||||
public DeterminateIndicator(TxConfidenceIndicator control, StaticProgressIndicatorSkin s,
|
DeterminateIndicator(TxConfidenceIndicator control, StaticProgressIndicatorSkin s,
|
||||||
Paint fillOverride) {
|
Paint fillOverride) {
|
||||||
this.control = control;
|
this.control = control;
|
||||||
|
|
||||||
getStyleClass().add("determinate-indicator");
|
getStyleClass().add("determinate-indicator");
|
||||||
|
@ -430,10 +430,10 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
// Position and size the circular background
|
// Position and size the circular background
|
||||||
//double doneTextHeight = doneText.getLayoutBounds().getHeight();
|
//double doneTextHeight = doneText.getLayoutBounds().getHeight();
|
||||||
final Insets controlInsets = control.getInsets();
|
final Insets controlInsets = control.getInsets();
|
||||||
final double left = snapSize(controlInsets.getLeft());
|
final double left = snapSizeX(controlInsets.getLeft());
|
||||||
final double right = snapSize(controlInsets.getRight());
|
final double right = snapSizeX(controlInsets.getRight());
|
||||||
final double top = snapSize(controlInsets.getTop());
|
final double top = snapSizeY(controlInsets.getTop());
|
||||||
final double bottom = snapSize(controlInsets.getBottom());
|
final double bottom = snapSizeY(controlInsets.getBottom());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** use the min of width, or height, keep it a circle
|
** use the min of width, or height, keep it a circle
|
||||||
|
@ -443,16 +443,16 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
final double radiusW = areaW / 2;
|
final double radiusW = areaW / 2;
|
||||||
final double radiusH = areaH / 2;
|
final double radiusH = areaH / 2;
|
||||||
final double radius = Math.round(Math.min(radiusW, radiusH)); // use round instead of floor
|
final double radius = Math.round(Math.min(radiusW, radiusH)); // use round instead of floor
|
||||||
final double centerX = snapPosition(left + radiusW);
|
final double centerX = snapPositionX(left + radiusW);
|
||||||
final double centerY = snapPosition(top + radius);
|
final double centerY = snapPositionY(top + radius);
|
||||||
|
|
||||||
// find radius that fits inside radius - insetsPadding
|
// find radius that fits inside radius - insetsPadding
|
||||||
final Insets indicatorInsets = indicator.getInsets();
|
final Insets indicatorInsets = indicator.getInsets();
|
||||||
final double iLeft = snapSize(indicatorInsets.getLeft());
|
final double iLeft = snapSizeX(indicatorInsets.getLeft());
|
||||||
final double iRight = snapSize(indicatorInsets.getRight());
|
final double iRight = snapSizeX(indicatorInsets.getRight());
|
||||||
final double iTop = snapSize(indicatorInsets.getTop());
|
final double iTop = snapSizeY(indicatorInsets.getTop());
|
||||||
final double iBottom = snapSize(indicatorInsets.getBottom());
|
final double iBottom = snapSizeY(indicatorInsets.getBottom());
|
||||||
final double progressRadius = snapSize(Math.min(Math.min(radius - iLeft, radius - iRight),
|
final double progressRadius = snapSizeX(Math.min(Math.min(radius - iLeft, radius - iRight),
|
||||||
Math.min(radius - iTop, radius - iBottom)));
|
Math.min(radius - iTop, radius - iBottom)));
|
||||||
|
|
||||||
indicatorCircle.setRadius(radius);
|
indicatorCircle.setRadius(radius);
|
||||||
|
@ -466,11 +466,11 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
|
|
||||||
// find radius that fits inside progressRadius - progressInsets
|
// find radius that fits inside progressRadius - progressInsets
|
||||||
final Insets progressInsets = progress.getInsets();
|
final Insets progressInsets = progress.getInsets();
|
||||||
final double pLeft = snapSize(progressInsets.getLeft());
|
final double pLeft = snapSizeX(progressInsets.getLeft());
|
||||||
final double pRight = snapSize(progressInsets.getRight());
|
final double pRight = snapSizeX(progressInsets.getRight());
|
||||||
final double pTop = snapSize(progressInsets.getTop());
|
final double pTop = snapSizeY(progressInsets.getTop());
|
||||||
final double pBottom = snapSize(progressInsets.getBottom());
|
final double pBottom = snapSizeY(progressInsets.getBottom());
|
||||||
final double indicatorRadius = snapSize(Math.min(Math.min(progressRadius - pLeft,
|
final double indicatorRadius = snapSizeX(Math.min(Math.min(progressRadius - pLeft,
|
||||||
progressRadius - pRight), Math.min(progressRadius - pTop, progressRadius - pBottom)));
|
progressRadius - pRight), Math.min(progressRadius - pTop, progressRadius - pBottom)));
|
||||||
|
|
||||||
// find size of spare box that fits inside indicator radius
|
// find size of spare box that fits inside indicator radius
|
||||||
|
@ -486,23 +486,23 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
@Override
|
@Override
|
||||||
protected double computePrefWidth(double height) {
|
protected double computePrefWidth(double height) {
|
||||||
final Insets controlInsets = control.getInsets();
|
final Insets controlInsets = control.getInsets();
|
||||||
final double left = snapSize(controlInsets.getLeft());
|
final double left = snapSizeX(controlInsets.getLeft());
|
||||||
final double right = snapSize(controlInsets.getRight());
|
final double right = snapSizeX(controlInsets.getRight());
|
||||||
final Insets indicatorInsets = indicator.getInsets();
|
final Insets indicatorInsets = indicator.getInsets();
|
||||||
final double iLeft = snapSize(indicatorInsets.getLeft());
|
final double iLeft = snapSizeX(indicatorInsets.getLeft());
|
||||||
final double iRight = snapSize(indicatorInsets.getRight());
|
final double iRight = snapSizeX(indicatorInsets.getRight());
|
||||||
final double iTop = snapSize(indicatorInsets.getTop());
|
final double iTop = snapSizeY(indicatorInsets.getTop());
|
||||||
final double iBottom = snapSize(indicatorInsets.getBottom());
|
final double iBottom = snapSizeY(indicatorInsets.getBottom());
|
||||||
final double indicatorMax = snapSize(Math.max(Math.max(iLeft, iRight), Math.max(iTop, iBottom)));
|
final double indicatorMax = snapSizeX(Math.max(Math.max(iLeft, iRight), Math.max(iTop, iBottom)));
|
||||||
final Insets progressInsets = progress.getInsets();
|
final Insets progressInsets = progress.getInsets();
|
||||||
final double pLeft = snapSize(progressInsets.getLeft());
|
final double pLeft = snapSizeX(progressInsets.getLeft());
|
||||||
final double pRight = snapSize(progressInsets.getRight());
|
final double pRight = snapSizeX(progressInsets.getRight());
|
||||||
final double pTop = snapSize(progressInsets.getTop());
|
final double pTop = snapSizeY(progressInsets.getTop());
|
||||||
final double pBottom = snapSize(progressInsets.getBottom());
|
final double pBottom = snapSizeY(progressInsets.getBottom());
|
||||||
final double progressMax = snapSize(Math.max(Math.max(pLeft, pRight), Math.max(pTop, pBottom)));
|
final double progressMax = snapSizeX(Math.max(Math.max(pLeft, pRight), Math.max(pTop, pBottom)));
|
||||||
final Insets tickInsets = tick.getInsets();
|
final Insets tickInsets = tick.getInsets();
|
||||||
final double tLeft = snapSize(tickInsets.getLeft());
|
final double tLeft = snapSizeX(tickInsets.getLeft());
|
||||||
final double tRight = snapSize(tickInsets.getRight());
|
final double tRight = snapSizeX(tickInsets.getRight());
|
||||||
final double indicatorWidth = indicatorMax + progressMax + tLeft + tRight + progressMax + indicatorMax;
|
final double indicatorWidth = indicatorMax + progressMax + tLeft + tRight + progressMax + indicatorMax;
|
||||||
return left + indicatorWidth + /*Math.max(indicatorWidth, doneText.getLayoutBounds().getWidth()) + */right;
|
return left + indicatorWidth + /*Math.max(indicatorWidth, doneText.getLayoutBounds().getWidth()) + */right;
|
||||||
}
|
}
|
||||||
|
@ -510,23 +510,23 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
@Override
|
@Override
|
||||||
protected double computePrefHeight(double width) {
|
protected double computePrefHeight(double width) {
|
||||||
final Insets controlInsets = control.getInsets();
|
final Insets controlInsets = control.getInsets();
|
||||||
final double top = snapSize(controlInsets.getTop());
|
final double top = snapSizeY(controlInsets.getTop());
|
||||||
final double bottom = snapSize(controlInsets.getBottom());
|
final double bottom = snapSizeY(controlInsets.getBottom());
|
||||||
final Insets indicatorInsets = indicator.getInsets();
|
final Insets indicatorInsets = indicator.getInsets();
|
||||||
final double iLeft = snapSize(indicatorInsets.getLeft());
|
final double iLeft = snapSizeX(indicatorInsets.getLeft());
|
||||||
final double iRight = snapSize(indicatorInsets.getRight());
|
final double iRight = snapSizeX(indicatorInsets.getRight());
|
||||||
final double iTop = snapSize(indicatorInsets.getTop());
|
final double iTop = snapSizeY(indicatorInsets.getTop());
|
||||||
final double iBottom = snapSize(indicatorInsets.getBottom());
|
final double iBottom = snapSizeY(indicatorInsets.getBottom());
|
||||||
final double indicatorMax = snapSize(Math.max(Math.max(iLeft, iRight), Math.max(iTop, iBottom)));
|
final double indicatorMax = snapSizeX(Math.max(Math.max(iLeft, iRight), Math.max(iTop, iBottom)));
|
||||||
final Insets progressInsets = progress.getInsets();
|
final Insets progressInsets = progress.getInsets();
|
||||||
final double pLeft = snapSize(progressInsets.getLeft());
|
final double pLeft = snapSizeX(progressInsets.getLeft());
|
||||||
final double pRight = snapSize(progressInsets.getRight());
|
final double pRight = snapSizeX(progressInsets.getRight());
|
||||||
final double pTop = snapSize(progressInsets.getTop());
|
final double pTop = snapSizeY(progressInsets.getTop());
|
||||||
final double pBottom = snapSize(progressInsets.getBottom());
|
final double pBottom = snapSizeY(progressInsets.getBottom());
|
||||||
final double progressMax = snapSize(Math.max(Math.max(pLeft, pRight), Math.max(pTop, pBottom)));
|
final double progressMax = snapSizeX(Math.max(Math.max(pLeft, pRight), Math.max(pTop, pBottom)));
|
||||||
final Insets tickInsets = tick.getInsets();
|
final Insets tickInsets = tick.getInsets();
|
||||||
final double tTop = snapSize(tickInsets.getTop());
|
final double tTop = snapSizeY(tickInsets.getTop());
|
||||||
final double tBottom = snapSize(tickInsets.getBottom());
|
final double tBottom = snapSizeY(tickInsets.getBottom());
|
||||||
final double indicatorHeight = indicatorMax + progressMax + tTop + tBottom + progressMax + indicatorMax;
|
final double indicatorHeight = indicatorMax + progressMax + tTop + tBottom + progressMax + indicatorMax;
|
||||||
return top + indicatorHeight /*+ textGap + doneText.getLayoutBounds().getHeight()*/ + bottom;
|
return top + indicatorHeight /*+ textGap + doneText.getLayoutBounds().getHeight()*/ + bottom;
|
||||||
}
|
}
|
||||||
|
@ -558,15 +558,13 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
private final IndicatorPaths pathsG;
|
private final IndicatorPaths pathsG;
|
||||||
|
|
||||||
private final List<Double> opacities = new ArrayList<>();
|
private final List<Double> opacities = new ArrayList<>();
|
||||||
private boolean spinEnabled = false;
|
|
||||||
|
|
||||||
private Paint fillOverride = null;
|
private Paint fillOverride = null;
|
||||||
|
|
||||||
public IndeterminateSpinner(TxConfidenceIndicator control, StaticProgressIndicatorSkin s,
|
IndeterminateSpinner(TxConfidenceIndicator control, StaticProgressIndicatorSkin s,
|
||||||
boolean spinEnabled, Paint fillOverride) {
|
boolean spinEnabled, Paint fillOverride) {
|
||||||
this.control = control;
|
this.control = control;
|
||||||
this.skin = s;
|
this.skin = s;
|
||||||
this.spinEnabled = spinEnabled;
|
|
||||||
this.fillOverride = fillOverride;
|
this.fillOverride = fillOverride;
|
||||||
|
|
||||||
setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
|
setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
|
||||||
|
@ -578,13 +576,12 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFillOverride(Paint fillOverride) {
|
void setFillOverride(Paint fillOverride) {
|
||||||
this.fillOverride = fillOverride;
|
this.fillOverride = fillOverride;
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpinEnabled(boolean spinEnabled) {
|
void setSpinEnabled(boolean spinEnabled) {
|
||||||
this.spinEnabled = spinEnabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -694,10 +691,10 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"deprecation", "unchecked", "ConstantConditions"})
|
@SuppressWarnings({"deprecation", "unchecked", "ConstantConditions"})
|
||||||
private static class StyleableProperties {
|
private static class StyleableProperties {
|
||||||
public static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
|
static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
|
||||||
|
|
||||||
private static final CssMetaData<TxConfidenceIndicator, Paint> PROGRESS_COLOR =
|
private static final CssMetaData<TxConfidenceIndicator, Paint> PROGRESS_COLOR =
|
||||||
new CssMetaData<TxConfidenceIndicator, Paint>(
|
new CssMetaData<>(
|
||||||
"-fx-progress-color", PaintConverter.getInstance(), null) {
|
"-fx-progress-color", PaintConverter.getInstance(), null) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -716,7 +713,7 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
|
|
||||||
|
|
||||||
private static final CssMetaData<TxConfidenceIndicator, Number> INDETERMINATE_SEGMENT_COUNT =
|
private static final CssMetaData<TxConfidenceIndicator, Number> INDETERMINATE_SEGMENT_COUNT =
|
||||||
new CssMetaData<TxConfidenceIndicator, Number>(
|
new CssMetaData<>(
|
||||||
"-fx-indeterminate-segment-count", SizeConverter.getInstance(), 8) {
|
"-fx-indeterminate-segment-count", SizeConverter.getInstance(), 8) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -739,7 +736,7 @@ public class StaticProgressIndicatorSkin extends SkinBase<TxConfidenceIndicator>
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final CssMetaData<TxConfidenceIndicator, Boolean> SPIN_ENABLED = new
|
private static final CssMetaData<TxConfidenceIndicator, Boolean> SPIN_ENABLED = new
|
||||||
CssMetaData<TxConfidenceIndicator, Boolean>("-fx-spin-enabled",
|
CssMetaData<>("-fx-spin-enabled",
|
||||||
BooleanConverter.getInstance(),
|
BooleanConverter.getInstance(),
|
||||||
Boolean.FALSE) {
|
Boolean.FALSE) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue