-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
114 changed files
with
14,798 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
HMCL/src/main/java/com/jfoenix/adapters/VirtualFlowAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters; | ||
|
||
import javafx.scene.Node; | ||
import javafx.scene.control.IndexedCell; | ||
import javafx.scene.control.skin.VirtualFlow; | ||
|
||
public final class VirtualFlowAdapter<T extends IndexedCell<?>> { | ||
@SuppressWarnings("unchecked") | ||
public static <T extends IndexedCell<?>> VirtualFlowAdapter<T> wrap(Node node) { | ||
return new VirtualFlowAdapter<>((VirtualFlow<T>) node); | ||
} | ||
|
||
private final VirtualFlow<T> flow; | ||
|
||
VirtualFlowAdapter(VirtualFlow<T> flow) { | ||
this.flow = flow; | ||
} | ||
|
||
public Node getFlow() { | ||
return flow; | ||
} | ||
|
||
public int getCellCount() { | ||
return flow.getCellCount(); | ||
} | ||
|
||
public T getCell(int index) { | ||
return flow.getCell(index); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
HMCL/src/main/java/com/jfoenix/adapters/VirtualFlowHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters; | ||
|
||
import javafx.scene.Node; | ||
import javafx.scene.control.IndexedCell; | ||
import javafx.scene.control.skin.VirtualFlow; | ||
|
||
import java.util.function.BiFunction; | ||
|
||
public final class VirtualFlowHelper { | ||
private VirtualFlowHelper() { | ||
} | ||
|
||
|
||
|
||
public static <T extends IndexedCell<?>, R extends Number> R forEach(Node virtualFlow, R init, BiFunction<T, R, R> func) { | ||
@SuppressWarnings("unchecked") | ||
VirtualFlow<T> flow = (VirtualFlow<T>) virtualFlow; | ||
|
||
for (int i = 0; i < flow.getCellCount(); ++i) { | ||
T cell = flow.getCell(i); | ||
init = func.apply(cell, init); | ||
} | ||
return init; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// TODO: Multi-Release | ||
package com.jfoenix.adapters; |
26 changes: 26 additions & 0 deletions
26
HMCL/src/main/java/com/jfoenix/adapters/skins/ButtonSkinAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters.skins; | ||
|
||
import javafx.scene.control.Button; | ||
|
||
public class ButtonSkinAdapter extends javafx.scene.control.skin.ButtonSkin { | ||
public ButtonSkinAdapter(Button control) { | ||
super(control); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
HMCL/src/main/java/com/jfoenix/adapters/skins/CheckBoxSkinAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters.skins; | ||
|
||
import javafx.beans.value.ObservableValue; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.skin.CheckBoxSkin; | ||
|
||
public class CheckBoxSkinAdapter extends CheckBoxSkin { | ||
public CheckBoxSkinAdapter(CheckBox control) { | ||
super(control); | ||
} | ||
|
||
protected final void __registerChangeListener(ObservableValue<?> property, String key) { | ||
this.registerChangeListener(property, ignored -> __handleControlPropertyChanged(key)); | ||
} | ||
|
||
protected void __handleControlPropertyChanged(String key) { | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
HMCL/src/main/java/com/jfoenix/adapters/skins/ListViewSkinAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters.skins; | ||
|
||
import javafx.scene.control.ListView; | ||
import javafx.scene.control.skin.ListViewSkin; | ||
|
||
public class ListViewSkinAdapter<T> extends ListViewSkin<T> { | ||
public ListViewSkinAdapter(ListView<T> control) { | ||
super(control); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
HMCL/src/main/java/com/jfoenix/adapters/skins/ProgressBarSkinAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters.skins; | ||
|
||
import javafx.animation.Animation; | ||
import javafx.beans.value.ObservableValue; | ||
import javafx.scene.control.ProgressBar; | ||
import javafx.scene.control.skin.ProgressBarSkin; | ||
import javafx.scene.control.skin.ProgressIndicatorSkin; | ||
|
||
import java.lang.invoke.MethodHandles; | ||
import java.lang.invoke.VarHandle; | ||
|
||
public class ProgressBarSkinAdapter extends ProgressBarSkin { | ||
private static final VarHandle indeterminateTransitionFieldHandle; | ||
|
||
static { | ||
try { | ||
MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(ProgressIndicatorSkin.class, MethodHandles.lookup()); | ||
indeterminateTransitionFieldHandle = lookup.findVarHandle(ProgressIndicatorSkin.class, "indeterminateTransition", Animation.class); | ||
} catch (IllegalAccessException | NoSuchFieldException e) { | ||
throw new ExceptionInInitializerError(e); | ||
} | ||
} | ||
|
||
public ProgressBarSkinAdapter(ProgressBar control) { | ||
super(control); | ||
} | ||
|
||
protected void __registerChangeListener(ObservableValue<?> property, String key) { | ||
this.registerChangeListener(property, (property2) -> __handleControlPropertyChanged(key)); | ||
} | ||
|
||
protected void __handleControlPropertyChanged(String p) { | ||
|
||
} | ||
|
||
protected Animation __getIndeterminateTransition() { | ||
return (Animation) indeterminateTransitionFieldHandle.get(this); | ||
} | ||
|
||
protected void __setIndeterminateTransition(Animation animation) { | ||
indeterminateTransitionFieldHandle.set(this, animation); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
HMCL/src/main/java/com/jfoenix/adapters/skins/RadioButtonSkinAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.jfoenix.adapters.skins; | ||
|
||
import javafx.beans.value.ObservableValue; | ||
import javafx.scene.control.RadioButton; | ||
import javafx.scene.control.skin.RadioButtonSkin; | ||
|
||
public class RadioButtonSkinAdapter extends RadioButtonSkin { | ||
public RadioButtonSkinAdapter(RadioButton control) { | ||
super(control); | ||
} | ||
|
||
protected void __registerChangeListener(ObservableValue<?> property, String key) { | ||
this.registerChangeListener(property, ignored -> __handleControlPropertyChanged(key)); | ||
} | ||
|
||
protected void __handleControlPropertyChanged(String key) { | ||
} | ||
} |
Oops, something went wrong.