rename remove X prefix

This commit is contained in:
Timi
2026-06-17 01:14:11 +08:00
parent b55a66d6df
commit 57e6b13292
17 changed files with 91 additions and 131 deletions
@@ -40,7 +40,7 @@ import java.util.List;
* @author 夜雨
* @since 2022-05-26 14:32
*/
public class FileTreeView extends XTreeView<File> implements TimiFXUI.Colorful {
public class FileTreeView extends TreeView<File> implements TimiFXUI.Colorful {
/** 正在查找节点监听 */
protected final BooleanBinding findingItem;
@@ -21,13 +21,13 @@ import java.util.regex.Pattern;
* 超链标签
*
* <pre>
* new XHyperlink("个人博客", "<a href="https://www.imyeyu.net">https://www.imyeyu.net</a>");
* new Hyperlink("个人博客", "<a href="https://www.imyeyu.net">https://www.imyeyu.net</a>");
* </pre>
*
* @author 夜雨
* @since 2022-08-30 10:51
*/
public class XHyperlink extends Label implements TimiFXUI, TimiFXUI.Colorful {
public class Hyperlink extends Label implements TimiFXUI, TimiFXUI.Colorful {
private static final Pattern URL_PATTERN = Pattern.compile("https?://(www\\.)?[-a-zA-Z\\d@:%._+~#=]{1,256}\\.[a-zA-Z\\d()]{1,6}\\b([-a-zA-Z\\d()@:%_+.~#?&/=]*)");
@@ -35,7 +35,7 @@ public class XHyperlink extends Label implements TimiFXUI, TimiFXUI.Colorful {
protected final StringProperty url;
/** 默认构造器 */
public XHyperlink() {
public Hyperlink() {
this("", "");
}
@@ -44,7 +44,7 @@ public class XHyperlink extends Label implements TimiFXUI, TimiFXUI.Colorful {
*
* @param url 链接
*/
public XHyperlink(String url) {
public Hyperlink(String url) {
this(url, url);
}
@@ -54,7 +54,7 @@ public class XHyperlink extends Label implements TimiFXUI, TimiFXUI.Colorful {
* @param text 显示文本
* @param url 链接
*/
public XHyperlink(String text, String url) {
public Hyperlink(String text, String url) {
this(null, text, url);
}
@@ -65,7 +65,7 @@ public class XHyperlink extends Label implements TimiFXUI, TimiFXUI.Colorful {
* @param text 显示文本
* @param url 链接
*/
public XHyperlink(Node icon, String text, String url) {
public Hyperlink(Node icon, String text, String url) {
super(text);
this.url = new SimpleStringProperty(url);
@@ -24,7 +24,7 @@ import java.util.List;
/**
* 分页组件支持省略页滚动页 [&lt;][1]..[5][6][7][8][9]..[20][&gt;]
* <pre>
* XPagination pagination = new XPagination();
* Pagination pagination = new Pagination();
* pagination.setSize(10); // 单页数据量
* pagination.setLength(200); // 总数据量
* pagination.indexProperty((obs, o, newIndex) -> {
@@ -36,7 +36,7 @@ import java.util.List;
* @author 夜雨
* @since 2021-12-22 15:25
*/
public class XPagination extends HBox implements TimiFXUI {
public class Pagination extends HBox implements TimiFXUI {
private static final String STYLE_CLASS = "x-pagination";
@@ -58,7 +58,7 @@ public class XPagination extends HBox implements TimiFXUI {
private final IntegerProperty cp; // chunkProperty 页面数量 [1, N]
/** 默认构造 */
public XPagination() {
public Pagination() {
// 基本参数
lp = new SimpleLongProperty();
ip = new SimpleIntegerProperty();
@@ -329,7 +329,7 @@ public class XPagination extends HBox implements TimiFXUI {
// 选中更新激活下标
selectedProperty().addListener((obs, o, isSelected) -> {
if (isSelected) {
XPagination.this.ip.set(indexProperty.get());
Pagination.this.ip.set(indexProperty.get());
}
});
}
@@ -4,17 +4,15 @@ import com.imyeyu.fx.icon.TimiFXIcon;
import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.java.bean.CallbackArg;
import com.imyeyu.java.ref.Ref;
import javafx.animation.TranslateTransition;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Skin;
import javafx.scene.control.TabPane;
import javafx.scene.control.skin.TabPaneSkin;
import javafx.scene.layout.StackPane;
import javafx.util.Duration;
import javafx.scene.shape.Rectangle;
import lombok.Getter;
import java.util.List;
@@ -26,17 +24,7 @@ import java.util.List;
* @since 2022-07-24 10:54
*/
@Getter
public class XTabPane extends TabPane implements TimiFXUI, TimiFXUI.Colorful {
/** 添加按钮 */
protected final IconButton add;
/** 默认构造 */
public XTabPane() {
add = new IconButton(TimiFXIcon.fromName("PLUS")).withBackground();
add.getStyleClass().add(CSS.BORDER_RB);
add.setPrefWidth(20);
}
public class TabPane extends javafx.scene.control.TabPane implements TimiFXUI, TimiFXUI.Colorful {
@Override
protected Skin<?> createDefaultSkin() {
@@ -45,24 +33,7 @@ public class XTabPane extends TabPane implements TimiFXUI, TimiFXUI.Colorful {
try {
StackPane tabHeaderArea = Ref.getFieldValue(tabPaneSkin, "tabHeaderArea", StackPane.class);
StackPane headersRegion = Ref.getFieldValue(tabHeaderArea, "headersRegion", StackPane.class);
StackPane headersBackground = Ref.getFieldValue(tabHeaderArea, "headerBackground", StackPane.class);
// 添加按钮
TranslateTransition transition = new TranslateTransition();
transition.setNode(add);
transition.setDuration(Duration.millis(150));
headersRegion.widthProperty().addListener((obs, oldWidth, newWidth) -> {
if (oldWidth.doubleValue() < newWidth.doubleValue()) {
transition.setFromX(add.getTranslateX());
transition.setToX(newWidth.intValue());
transition.play();
} else {
add.setTranslateX(newWidth.intValue());
}
});
add.prefHeightProperty().bind(headersBackground.heightProperty());
StackPane.setAlignment(add, Pos.CENTER_LEFT);
headersBackground.getChildren().add(add);
Rectangle headerClip = Ref.getFieldValue(tabHeaderArea, "headerClip", Rectangle.class);
// 关闭按钮调整
CallbackArg<Node> resizeCloseButton = tabHeaderSkin -> {
@@ -82,7 +53,7 @@ public class XTabPane extends TabPane implements TimiFXUI, TimiFXUI.Colorful {
closeBtn.getChildren().add(icon);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
};
ObservableList<Node> tabList = headersRegion.getChildren();
@@ -92,8 +63,8 @@ public class XTabPane extends TabPane implements TimiFXUI, TimiFXUI.Colorful {
headersRegion.getChildren().addListener((ListChangeListener<Node>) c -> {
if (c.next()) {
List<? extends Node> list = c.getAddedSubList();
for (int i = 0; i < list.size(); i++) {
resizeCloseButton.handler(list.get(i));
for (Node node : list) {
resizeCloseButton.handler(node);
}
}
});
@@ -3,7 +3,6 @@ package com.imyeyu.fx.ui.components;
import com.imyeyu.fx.utils.SmoothScroll;
import javafx.collections.ObservableList;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
/**
* 不显示根节点的树形结构实现多个根节点
@@ -11,12 +10,12 @@ import javafx.scene.control.TreeView;
* @author 夜雨
* @since 2021-04-26 01:34
*/
public class XTreeView<T> extends TreeView<T> {
public class TreeView<T> extends javafx.scene.control.TreeView<T> {
private final TreeItem<T> dummyRoot = new TreeItem<>();
/** 默认构造 */
public XTreeView() {
public TreeView() {
dummyRoot.setExpanded(true);
setRoot(dummyRoot);
setShowRoot(false);