Improved ProgressCircle
This commit is contained in:
parent
39ee336b4e
commit
32d122c351
@ -211,6 +211,11 @@ public class TimeCalcConfiguration {
|
||||
= new BooleanProperty(TimeCalcProperty.CIRCLE_HIDDEN.getKey());
|
||||
public final StringProperty circleTypeProperty
|
||||
= new StringProperty(TimeCalcProperty.CIRCLE_TYPE.getKey());
|
||||
public final BooleanProperty circleInnerCircleVisibleProperty
|
||||
= new BooleanProperty(TimeCalcProperty.CIRCLE_INNER_CIRCLE_VISIBLE.getKey());
|
||||
public final BooleanProperty circleOuterCircleOnlyBorderProperty
|
||||
= new BooleanProperty(TimeCalcProperty.CIRCLE_OUTER_CIRCLE_ONLY_BORDER.getKey());
|
||||
//
|
||||
public final BooleanProperty walkingHumanVisibleProperty
|
||||
= new BooleanProperty(
|
||||
TimeCalcProperty.WALKING_HUMAN_VISIBLE.getKey());
|
||||
@ -335,7 +340,7 @@ public class TimeCalcConfiguration {
|
||||
smileysVisibleOnlyIfMouseMovingOverProperty,
|
||||
smileysColoredProperty,
|
||||
squareVisibleProperty,squareTypeProperty,
|
||||
circleVisibleProperty,circleTypeProperty,
|
||||
circleVisibleProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleOnlyBorderProperty,
|
||||
dotVisibleProperty,dotTypeProperty,
|
||||
fuelVisibleProperty, fuelTypeProperty, fuelHiddenProperty,
|
||||
fuelIconVisibleProperty,
|
||||
|
@ -102,6 +102,9 @@ public enum TimeCalcProperty {
|
||||
CIRCLE_VISIBLE("circle.visible", "Circle"),
|
||||
CIRCLE_TYPE("circle.type", "Circle : Type"),
|
||||
CIRCLE_HIDDEN("circle.hidden", "Circle : Hidden"),
|
||||
CIRCLE_INNER_CIRCLE_VISIBLE("circle.inner-circle.visible", "Circle : Inner circle"),
|
||||
CIRCLE_OUTER_CIRCLE_ONLY_BORDER("circle.outer-circle.only-border", "Circle : Outer circle : Only border"),
|
||||
//
|
||||
WALKING_HUMAN_VISIBLE("walking-human.visible", "Walking Human"),
|
||||
WALKING_HUMAN_TYPE("walking-human.type", "Walking Human : Type"),
|
||||
WALKING_HUMAN_HIDDEN("walking-human.hidden", "Walking Human : Hidden"),
|
||||
|
@ -2,8 +2,11 @@ package org.nanoboot.utils.timecalc.swing.progress;
|
||||
|
||||
import org.nanoboot.utils.timecalc.entity.Visibility;
|
||||
import org.nanoboot.utils.timecalc.swing.common.Widget;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.battery.Battery;
|
||||
import org.nanoboot.utils.timecalc.utils.common.NumberFormats;
|
||||
import org.nanoboot.utils.timecalc.utils.property.BooleanProperty;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
@ -12,6 +15,9 @@ import java.awt.RenderingHints;
|
||||
|
||||
public class ProgressCircle extends Widget {
|
||||
|
||||
public BooleanProperty innerCircleVisibleProperty = new BooleanProperty("innerCircleVisibleProperty", true);
|
||||
public BooleanProperty outerCircleOnlyBorderProperty = new BooleanProperty("outerCircleOnlyBorderProperty", true);
|
||||
|
||||
public ProgressCircle() {
|
||||
setPreferredSize(new Dimension(200, 200));
|
||||
}
|
||||
@ -25,7 +31,8 @@ public class ProgressCircle extends Widget {
|
||||
= Visibility.valueOf(visibilityProperty.getValue());
|
||||
Graphics2D brush = (Graphics2D) g;
|
||||
brush.setColor(
|
||||
visibility.isStronglyColored() || mouseOver ? Color.darkGray
|
||||
visibility.isStronglyColored() || mouseOver ?
|
||||
Battery.getColourForProgress(donePercent(), visibility, mouseOver)/*Color.darkGray*/
|
||||
: FOREGROUND_COLOR);
|
||||
brush.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
@ -34,12 +41,19 @@ public class ProgressCircle extends Widget {
|
||||
double angleDouble2 = (angleDouble - (int) (angleDouble)) * 360;
|
||||
// System.out.println("remainingAngle=" + angleDouble2);
|
||||
|
||||
brush.fillArc(0, 0, side, side, 90, -(int) angleDouble);
|
||||
if(outerCircleOnlyBorderProperty.isEnabled()) {
|
||||
brush.setStroke(new BasicStroke(8f));
|
||||
brush.drawArc(8, 8, side - 16, side - 16, 90, -(int) angleDouble);
|
||||
} else {
|
||||
brush.fillArc(8, 8, side - 16, side - 16, 90, -(int) angleDouble);
|
||||
}
|
||||
int side2 = side / 2;
|
||||
brush.setColor(visibility.isStronglyColored() || mouseOver
|
||||
? new Color(105, 175, 236) : FOREGROUND_COLOR2);
|
||||
brush.fillArc(0 + (side2 / 2), 0 + (side2 / 2), side2, side2, 90,
|
||||
-(int) angleDouble2);
|
||||
if(innerCircleVisibleProperty.isEnabled()) {
|
||||
brush.fillArc(0 + (side2 / 2), 0 + (side2 / 2), side2, side2, 90,
|
||||
-(int) angleDouble2);
|
||||
}
|
||||
brush.setColor(visibility.isStronglyColored() || mouseOver ? Color.blue
|
||||
: FOREGROUND_COLOR);
|
||||
|
||||
|
@ -196,6 +196,10 @@ public class ConfigWindow extends TWindow {
|
||||
= new JCheckBox(TimeCalcProperty.CIRCLE_VISIBLE.getKey());
|
||||
private final JTextField circleTypeProperty
|
||||
= new JTextField(TimeCalcProperty.CIRCLE_TYPE.getKey());
|
||||
private final JCheckBox circleInnerCircleVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.CIRCLE_INNER_CIRCLE_VISIBLE.getKey());
|
||||
private final JCheckBox circleOuterCircleVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.CIRCLE_OUTER_CIRCLE_ONLY_BORDER.getKey());
|
||||
private final JCheckBox swingVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.SWING_VISIBLE.getKey());
|
||||
private final JTextField swingTypeProperty
|
||||
@ -469,6 +473,8 @@ public class ConfigWindow extends TWindow {
|
||||
}
|
||||
weatherVisibleProperty.setSelected(enable);
|
||||
circleVisibleProperty.setSelected(enable);
|
||||
circleInnerCircleVisibleProperty.setSelected(enable);
|
||||
circleOuterCircleVisibleProperty.setSelected(!enable);
|
||||
swingVisibleProperty.setSelected(enable);
|
||||
swingQuarterIconVisibleProperty.setSelected(enable);
|
||||
walkingHumanVisibleProperty.setSelected(enable);
|
||||
@ -559,7 +565,7 @@ public class ConfigWindow extends TWindow {
|
||||
commandsVisibleProperty,
|
||||
notificationsVisibleProperty,
|
||||
squareVisibleProperty,squareHiddenProperty,squareTypeProperty,
|
||||
circleVisibleProperty,circleHiddenProperty,circleTypeProperty,
|
||||
circleVisibleProperty,circleHiddenProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleVisibleProperty,
|
||||
dotVisibleProperty,dotHiddenProperty,dotTypeProperty,
|
||||
fuelVisibleProperty,fuelTypeProperty,fuelHiddenProperty,fuelIconVisibleProperty,
|
||||
rotationVisibleProperty, rotationTypeProperty, rotationHiddenProperty,
|
||||
|
@ -461,6 +461,8 @@ public class MainWindow extends TWindow {
|
||||
.bindTo(timeCalcConfiguration.dotVisibleProperty);
|
||||
progressCircle.typeProperty
|
||||
.bindTo(timeCalcConfiguration.circleTypeProperty);
|
||||
progressCircle.innerCircleVisibleProperty.bindTo(timeCalcConfiguration.circleInnerCircleVisibleProperty);
|
||||
progressCircle.outerCircleOnlyBorderProperty.bindTo(timeCalcConfiguration.circleOuterCircleOnlyBorderProperty);
|
||||
walkingHumanProgress.typeProperty
|
||||
.bindTo(timeCalcConfiguration.walkingHumanTypeProperty);
|
||||
progressSwing.typeProperty
|
||||
|
@ -58,6 +58,8 @@ square.hidden=false
|
||||
circle.visible=true
|
||||
circle.type=day
|
||||
circle.hidden=false
|
||||
circle.inner-circle.visible=true
|
||||
circle.outer-circle.only-border=false
|
||||
dot.visible=true
|
||||
dot.type=day
|
||||
dot.hidden=false
|
||||
|
Loading…
x
Reference in New Issue
Block a user