mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-12 15:50:41 +00:00
Fix icon bindings
This commit is contained in:
+6
@@ -8,6 +8,7 @@ import io.xpipe.app.browser.menu.BrowserMenuCategory;
|
||||
import io.xpipe.app.browser.menu.BrowserMenuLeafProvider;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
@@ -41,4 +42,9 @@ public class OpenNativeFileDetailsMenuProvider implements BrowserMenuLeafProvide
|
||||
public boolean acceptsEmptySelection() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelGraphic getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new LabelGraphic.IconGraphic("mdi2f-folder-information-outline");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,16 +56,15 @@ public class ButtonComp extends Comp<CompStructure<Button>> {
|
||||
var n = t.createGraphicNode();
|
||||
button.setGraphic(n);
|
||||
if (n instanceof FontIcon f && button.getFont() != null) {
|
||||
f.iconSizeProperty().bind(new ReadOnlyIntegerWrapper((int)
|
||||
new Size(button.getFont().getSize(), SizeUnits.PT).pixels()));
|
||||
f.setIconSize((int)
|
||||
new Size(button.getFont().getSize(), SizeUnits.PT).pixels());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
button.fontProperty().subscribe(c -> {
|
||||
if (button.getGraphic() instanceof FontIcon f) {
|
||||
f.iconSizeProperty()
|
||||
.bind(new ReadOnlyIntegerWrapper((int) new Size(c.getSize(), SizeUnits.PT).pixels()));
|
||||
f.setIconSize((int) new Size(c.getSize(), SizeUnits.PT).pixels());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,8 +54,7 @@ public class DropdownComp extends Comp<CompStructure<Button>> {
|
||||
|
||||
var graphic = new FontIcon("mdi2c-chevron-double-down");
|
||||
button.fontProperty().subscribe(c -> {
|
||||
graphic.iconSizeProperty()
|
||||
.bind(new ReadOnlyIntegerWrapper((int) new Size(c.getSize(), SizeUnits.PT).pixels()));
|
||||
graphic.setIconSize((int) new Size(c.getSize(), SizeUnits.PT).pixels());
|
||||
});
|
||||
|
||||
button.setGraphic(graphic);
|
||||
|
||||
@@ -57,15 +57,14 @@ public class IconButtonComp extends Comp<CompStructure<Button>> {
|
||||
PlatformThread.runLaterIfNeeded(() -> {
|
||||
button.setGraphic(labelGraphic.createGraphicNode());
|
||||
if (button.getGraphic() instanceof FontIcon fi) {
|
||||
fi.iconSizeProperty().bind(new ReadOnlyIntegerWrapper((int)
|
||||
new Size(button.getFont().getSize(), SizeUnits.PT).pixels()));
|
||||
fi.setIconSize((int)
|
||||
new Size(button.getFont().getSize(), SizeUnits.PT).pixels());
|
||||
}
|
||||
});
|
||||
});
|
||||
button.fontProperty().subscribe((n) -> {
|
||||
if (button.getGraphic() instanceof FontIcon fi) {
|
||||
fi.iconSizeProperty()
|
||||
.bind(new ReadOnlyIntegerWrapper((int) new Size(n.getSize(), SizeUnits.PT).pixels()));
|
||||
fi.setIconSize((int) new Size(n.getSize(), SizeUnits.PT).pixels());
|
||||
}
|
||||
});
|
||||
if (listener != null) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IntroComp extends SimpleComp {
|
||||
|
||||
var img = graphic.createGraphicNode();
|
||||
if (img instanceof FontIcon fontIcon) {
|
||||
fontIcon.iconSizeProperty().bind(new ReadOnlyIntegerWrapper(80));
|
||||
fontIcon.setIconSize(80);
|
||||
}
|
||||
var text = new VBox(title, introDesc);
|
||||
text.setSpacing(5);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class TileButtonComp extends Comp<TileButtonComp.Structure> {
|
||||
desc.heightProperty()));
|
||||
pane.prefHeightProperty().addListener((c, o, n) -> {
|
||||
var size = Math.min(n.intValue(), 100);
|
||||
fi.getIcon().iconSizeProperty().bind(new ReadOnlyDoubleWrapper(size * iconSize));
|
||||
fi.getIcon().setIconSize((int) (size * iconSize));
|
||||
});
|
||||
bt.setGraphic(hbox);
|
||||
return Structure.builder()
|
||||
|
||||
@@ -37,7 +37,7 @@ public class StoreIconComp extends SimpleComp {
|
||||
background.getStyleClass().add("background");
|
||||
|
||||
var dots = new FontIcon("mdi2d-dots-horizontal");
|
||||
dots.iconSizeProperty().bind(new ReadOnlyIntegerWrapper((int) (h * 1.3)));
|
||||
dots.setIconSize((int) (h * 1.3));
|
||||
|
||||
var stack = new StackPane(background, storeIcon, dots);
|
||||
stack.setMinHeight(w + 5);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class StoreIdentitiesIntroComp extends SimpleComp {
|
||||
introDesc.setMaxWidth(470);
|
||||
|
||||
var img = new FontIcon("mdi2a-account-group");
|
||||
img.iconSizeProperty().bind(new ReadOnlyIntegerWrapper(80));
|
||||
img.setIconSize(80);
|
||||
var text = new VBox(title, introDesc);
|
||||
text.setSpacing(5);
|
||||
text.setAlignment(Pos.CENTER_LEFT);
|
||||
@@ -90,7 +90,7 @@ public class StoreIdentitiesIntroComp extends SimpleComp {
|
||||
syncPane.setAlignment(Pos.CENTER);
|
||||
|
||||
var fi = new FontIcon("mdi2g-git");
|
||||
fi.iconSizeProperty().bind(new ReadOnlyIntegerWrapper(80));
|
||||
fi.setIconSize(80);
|
||||
var img = new StackPane(fi);
|
||||
img.setPrefWidth(100);
|
||||
img.setPrefHeight(120);
|
||||
|
||||
@@ -80,7 +80,7 @@ public class StoreIntroComp extends SimpleComp {
|
||||
importPane.setAlignment(Pos.CENTER);
|
||||
|
||||
var fi = new FontIcon("mdi2g-git");
|
||||
fi.iconSizeProperty().bind(new ReadOnlyIntegerWrapper(80));
|
||||
fi.setIconSize(80);
|
||||
var img = new StackPane(fi);
|
||||
img.setPrefWidth(100);
|
||||
img.setPrefHeight(150);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class StoreScriptsIntroComp extends SimpleComp {
|
||||
introDesc.setMaxWidth(470);
|
||||
|
||||
var img = new FontIcon("mdi2s-script-text");
|
||||
img.iconSizeProperty().bind(new ReadOnlyIntegerWrapper(80));
|
||||
img.setIconSize(80);
|
||||
var text = new VBox(title, introDesc);
|
||||
text.setSpacing(5);
|
||||
text.setAlignment(Pos.CENTER_LEFT);
|
||||
@@ -80,7 +80,7 @@ public class StoreScriptsIntroComp extends SimpleComp {
|
||||
importPane.setAlignment(Pos.CENTER);
|
||||
|
||||
var fi = new FontIcon("mdi2t-tooltip-edit");
|
||||
fi.iconSizeProperty().bind(new ReadOnlyIntegerWrapper(80));
|
||||
fi.setIconSize(80);
|
||||
var img = new StackPane(fi);
|
||||
img.setPrefWidth(100);
|
||||
img.setPrefHeight(150);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.issue;
|
||||
|
||||
import atlantafx.base.theme.Styles;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ModalButton;
|
||||
import io.xpipe.app.comp.base.ModalOverlay;
|
||||
@@ -33,7 +34,7 @@ public class ErrorHandlerDialog {
|
||||
var headerId = event.isTerminal() ? "terminalErrorOccured" : "errorOccured";
|
||||
var errorModal = ModalOverlay.of(headerId, comp, new LabelGraphic.NodeGraphic(() -> {
|
||||
var graphic = new FontIcon("mdomz-warning");
|
||||
graphic.iconColorProperty().bind(new ReadOnlyObjectWrapper<>(Color.RED));
|
||||
graphic.pseudoClassStateChanged(Styles.STATE_DANGER, true);
|
||||
return graphic;
|
||||
}));
|
||||
if (event.getThrowable() != null && event.isReportable()) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.prefs;
|
||||
|
||||
import atlantafx.base.theme.Styles;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.*;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
@@ -61,9 +62,8 @@ public class TerminalCategory extends AppPrefsCategory {
|
||||
if (item != ExternalTerminalType.CUSTOM) {
|
||||
var graphic = new FontIcon(
|
||||
item.isRecommended() ? "mdi2c-check-decagram" : "mdi2a-alert-circle-check");
|
||||
graphic.iconColorProperty()
|
||||
.bind(new ReadOnlyObjectWrapper<>(
|
||||
item.isRecommended() ? Color.GREEN : Color.ORANGE));
|
||||
graphic.getStyleClass().add("graphic");
|
||||
graphic.getStyleClass().add(item.isRecommended() ? "supported" : "unsupported");
|
||||
setGraphic(graphic);
|
||||
} else {
|
||||
setGraphic(new FontIcon("mdi2m-minus-circle"));
|
||||
|
||||
@@ -158,3 +158,10 @@
|
||||
-fx-padding: 3 10;
|
||||
}
|
||||
|
||||
.ikonli-font-icon.graphic.supported {
|
||||
-fx-icon-color: -color-success-fg;
|
||||
}
|
||||
|
||||
.ikonli-font-icon.graphic.unsupported {
|
||||
-fx-icon-color: -color-warning-fg;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user