mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Style fixes
This commit is contained in:
parent
a02d40cab6
commit
125d1ddbaf
3 changed files with 12 additions and 18 deletions
|
@ -2,7 +2,6 @@ package io.xpipe.app.fxcomps.impl;
|
|||
|
||||
import atlantafx.base.layout.InputGroup;
|
||||
import io.xpipe.app.comp.base.ButtonComp;
|
||||
import io.xpipe.app.core.AppFont;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.CompStructure;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
|
@ -18,6 +17,8 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Getter;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SecretFieldComp extends Comp<SecretFieldComp.Structure> {
|
||||
|
@ -37,12 +38,17 @@ public class SecretFieldComp extends Comp<SecretFieldComp.Structure> {
|
|||
|
||||
private final Property<InPlaceSecretValue> value;
|
||||
private final boolean allowCopy;
|
||||
private final List<Comp<?>> additionalButtons = new ArrayList<>();
|
||||
|
||||
public SecretFieldComp(Property<InPlaceSecretValue> value, boolean allowCopy) {
|
||||
this.value = value;
|
||||
this.allowCopy = allowCopy;
|
||||
}
|
||||
|
||||
public void addButton(Comp<?> button) {
|
||||
this.additionalButtons.add(button);
|
||||
}
|
||||
|
||||
public static SecretFieldComp ofString(Property<String> s) {
|
||||
var prop = new SimpleObjectProperty<>(s.getValue() != null ? InPlaceSecretValue.of(s.getValue()) : null);
|
||||
prop.addListener((observable, oldValue, newValue) -> {
|
||||
|
@ -61,7 +67,6 @@ public class SecretFieldComp extends Comp<SecretFieldComp.Structure> {
|
|||
@Override
|
||||
public Structure createBase() {
|
||||
var text = new PasswordField();
|
||||
text.getStyleClass().add("secret-field-comp");
|
||||
text.setText(value.getValue() != null ? value.getValue().getSecretValue() : null);
|
||||
text.textProperty().addListener((c, o, n) -> {
|
||||
value.setValue(n != null && n.length() > 0 ? encrypt(n.toCharArray()) : null);
|
||||
|
@ -84,10 +89,11 @@ public class SecretFieldComp extends Comp<SecretFieldComp.Structure> {
|
|||
}).grow(false, true).tooltipKey("copyPassword").createRegion();
|
||||
|
||||
var ig = new InputGroup(text);
|
||||
AppFont.small(ig);
|
||||
ig.getStyleClass().add("secret-field-comp");
|
||||
if (allowCopy) {
|
||||
ig.getChildren().add(copyButton);
|
||||
}
|
||||
additionalButtons.forEach(comp -> ig.getChildren().add(comp.createRegion()));
|
||||
|
||||
ig.focusedProperty().addListener((c, o, n) -> {
|
||||
if (n) {
|
||||
|
|
|
@ -18,23 +18,12 @@
|
|||
-fx-border-color: derive(-color-border-default, -10%);
|
||||
}
|
||||
|
||||
|
||||
.root:pretty:dark .color-box.gray {
|
||||
-fx-background-color: linear-gradient(from 100% 0% to 0% 100%, derive(-color-bg-default, 13%) 40%, derive(-color-bg-default, 11%) 50%, derive(-color-bg-default, 14%) 100%);
|
||||
-fx-border-color: -color-border-default;
|
||||
}
|
||||
|
||||
.root:performance:dark .color-box.gray {
|
||||
.root:dark .color-box.gray {
|
||||
-fx-background-color: derive(-color-bg-default, 13%);
|
||||
-fx-border-color: -color-border-default;
|
||||
}
|
||||
|
||||
.root:pretty:light .color-box.gray {
|
||||
-fx-background-color: linear-gradient(from 100% 0% to 0% 100%, derive(-color-bg-default, -2%) 40%, derive(-color-bg-default, 0%) 50%, derive(-color-bg-default, -3%) 100%);
|
||||
-fx-border-color: derive(-color-border-default, -10%);
|
||||
}
|
||||
|
||||
.root:performance:light .color-box.gray {
|
||||
.root:light .color-box.gray {
|
||||
-fx-background-color: derive(-color-bg-default, -2%);
|
||||
-fx-border-color: derive(-color-border-default, -10%);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
}
|
||||
|
||||
.root:dark.background {
|
||||
-fx-background-color: derive(-color-bg-default, 5%);
|
||||
-fx-background-color: derive(-color-bg-default, 1%);
|
||||
}
|
||||
|
||||
.root:light.background {
|
||||
|
@ -59,4 +59,3 @@
|
|||
.root:dark .loading-comp {
|
||||
-fx-background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue