Runtime fixes and improvements. (#43)

* Big fixes of runtime.

* Fixed forms...
This commit is contained in:
Zaxar163 2018-11-11 09:58:22 +03:00 committed by Gravit
parent 9190fd98d0
commit 4dc275bb17
13 changed files with 30 additions and 100 deletions

View file

@ -12,7 +12,7 @@
<!-- DrLeonardo Design -->
<Pane fx:id="layout" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" visible="true" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<Pane fx:id="layout" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" visible="true" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView id="background" fitHeight="400.0" fitWidth="600.0">
<image>

View file

@ -1,19 +0,0 @@
<html>
<head>
</head>
<body style="background-color: rgba(0,0,0,0);">
<div style="color:#ffbb19; text-shadow: 1px 1px 2px black; width:300px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sodales blandit turpis et imperdiet. Nunc egestas ipsum vitae mauris euismod euismod. Curabitur ut posuere odio. Donec sagittis faucibus commodo. Aenean id nunc sem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed id nunc lorem. Mauris iaculis, felis et sollicitudin faucibus, nisi nisl dapibus libero, ac venenatis tellus nibh sit amet ex. Duis sit amet nisi vitae mi venenatis mollis semper sollicitudin tortor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent et risus in quam ornare ullamcorper nec sed arcu. Cras eget libero augue. Duis nisl tellus, pulvinar non dolor at, scelerisque vestibulum erat. Quisque eu augue aliquet, rhoncus nunc non, pellentesque est.
Vivamus ut ipsum lacinia erat faucibus interdum eget sed neque. Curabitur vestibulum quis ante ac euismod. Morbi consequat ante quam, ut hendrerit ligula sagittis nec. Fusce pretium in turpis vel aliquet. Duis malesuada nulla ut interdum maximus. Phasellus commodo enim a ligula aliquam, sed semper nisl posuere. Vestibulum gravida mi nisl, vel porta nisl sollicitudin a. Quisque dui massa, ullamcorper a dolor vel, viverra fermentum dolor. Mauris condimentum lacinia mauris at rhoncus. Nullam sed mollis ex. Sed magna purus, varius et imperdiet at, porta eu erat. Pellentesque eu ornare nibh. Quisque vel eros sit amet tellus elementum venenatis. Etiam id elit elit. Phasellus malesuada et augue sit amet consequat.
Mauris viverra ipsum at laoreet porttitor. Maecenas interdum egestas risus eget aliquet. Sed vestibulum arcu ut odio bibendum consequat. Etiam ultrices dui vitae dolor dignissim, in accumsan erat aliquet. Vivamus eu justo vitae mauris molestie suscipit. Donec dui erat, posuere eget ipsum quis, consequat porta neque. Donec hendrerit mi ac consectetur lacinia. Nullam aliquet nisi at tincidunt venenatis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque turpis nulla, consequat non volutpat id, vehicula vitae nulla. Aenean pulvinar aliquam felis, ut dictum sem pretium vel. Vestibulum eget sollicitudin justo. Fusce in erat massa. Donec imperdiet justo vitae imperdiet laoreet. Donec pretium, lacus non accumsan sollicitudin, ex nisl maximus risus, semper lacinia lectus leo vel metus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur sit amet orci iaculis, venenatis sapien vel, dignissim arcu. Etiam tincidunt ac enim nec faucibus. Nullam fringilla ultrices sagittis. Quisque ac risus augue. Etiam neque ligula, convallis ut fermentum condimentum, mattis a libero. Aenean purus leo, semper vel hendrerit quis, ornare sit amet dui. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin nisl neque, tempor eu erat at, suscipit vulputate lacus. Quisque facilisis interdum posuere. Nam tortor metus, placerat at dapibus ac, tincidunt nec est. Pellentesque consequat risus vitae condimentum pulvinar. Aenean hendrerit, magna vitae ornare dignissim, lorem ipsum venenatis ex, et auctor mauris massa a eros.
Mauris tellus augue, condimentum ut tempor eget, facilisis quis ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec fermentum in purus imperdiet feugiat. Cras vitae felis nisi. Duis sed justo condimentum, efficitur enim ut, pretium velit. Sed ac vestibulum lorem. Nullam pharetra, neque id mollis lobortis, augue odio ullamcorper quam, et dignissim nunc arcu nec arcu. Integer ac purus semper, scelerisque est sed, posuere lorem. Vivamus metus ante, placerat eget scelerisque id, dapibus ut nisi. Interdum et malesuada fames ac ante ipsum primis in faucibus.
</div>
</body>
</html>

View file

@ -7,7 +7,7 @@
<!-- DrLeonardo Design -->
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.20">
<stylesheets>
<URL value="@debug.css" />
</stylesheets>

View file

@ -10,7 +10,7 @@
<!-- DrLeonardo Design -->
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView fitHeight="400.0" fitWidth="600.0" pickOnBounds="true" preserveRatio="true">
<image>

View file

@ -67,9 +67,13 @@ var EnvHelper = EnvHelperClass.static;
var SecurityHelper = SecurityHelperClass.static;
var DigestAlgorithm = DigestAlgorithmClass.static;
var VerifyHelper = VerifyHelperClass.static;
var RingProgressIndicator = RingProgressIndicatorClass.static
var RingProgressIndicatorSkin = RingProgressIndicatorSkinClass.static
var LauncherSettings = LauncherSettingsClass.static
var CheckComboBox = CheckComboBoxClass.static;
var CheckModel = CheckModelClass.static;
var IndexedCheckModel = IndexedCheckModelClass.static;
var CheckComboBoxSkin = CheckComboBoxSkinClass.static;
var RingProgressIndicator = RingProgressIndicatorClass.static;
var RingProgressIndicatorSkin = RingProgressIndicatorSkinClass.static;
var LauncherSettings = LauncherSettingsClass.static;
// Helper JS class API imports
var JSApplication = null;

View file

@ -15,8 +15,12 @@
import javax.script.ScriptException;
import ru.gravit.launcher.client.*;
import ru.gravit.launcher.gui.buttons.RingProgressIndicator;
import ru.gravit.launcher.gui.buttons.RingProgressIndicatorSkin;
import ru.gravit.launcher.gui.choosebox.CheckComboBox;
import ru.gravit.launcher.gui.choosebox.CheckComboBoxSkin;
import ru.gravit.launcher.gui.choosebox.CheckModel;
import ru.gravit.launcher.gui.choosebox.IndexedCheckModel;
import ru.gravit.launcher.gui.indicator.RingProgressIndicator;
import ru.gravit.launcher.gui.indicator.RingProgressIndicatorSkin;
import ru.gravit.launcher.hasher.FileNameMatcher;
import ru.gravit.launcher.hasher.HashedDir;
import ru.gravit.launcher.hasher.HashedEntry;
@ -139,11 +143,15 @@ public static void addLauncherClassBindings(Map<String, Object> bindings) {
bindings.put("LauncherSettingsClass", LauncherSettings.class);
// Load JS API if available
bindings.put("RingProgressIndicatorClass", RingProgressIndicator.class);
bindings.put("RingProgressIndicatorSkinClass", RingProgressIndicatorSkin.class);
try {
Class.forName("javafx.application.Application");
bindings.put("JSApplicationClass", JSApplication.class);
bindings.put("RingProgressIndicatorClass", RingProgressIndicator.class);
bindings.put("RingProgressIndicatorSkinClass", RingProgressIndicatorSkin.class);
bindings.put("CheckComboBoxClass", CheckComboBox.class);
bindings.put("CheckModelClass", CheckModel.class);
bindings.put("IndexedCheckModelClass", IndexedCheckModel.class);
bindings.put("CheckComboBoxSkinClass", CheckComboBoxSkin.class);
} catch (ClassNotFoundException ignored) {
LogHelper.warning("JavaFX API isn't available");
}

View file

@ -11,7 +11,6 @@
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import ru.gravit.launcher.LauncherAPI;
abstract class CheckBitSetModelBase<T> implements IndexedCheckModel<T> {
private final Map<T, BooleanProperty> itemBooleanMap;
@ -104,7 +103,6 @@ public int size() {
});
}
@LauncherAPI
@Override
public void check(int index) {
if (index < 0 || index >= getItemCount())
@ -121,21 +119,18 @@ public void check(T item) {
check(index);
}
@LauncherAPI
@Override
public void checkAll() {
for (int i = 0; i < getItemCount(); i++)
check(i);
}
@LauncherAPI
@Override
public void checkIndices(int... indices) {
for (int indice : indices)
check(indice);
}
@LauncherAPI
@Override
public void clearCheck(int index) {
if (index < 0 || index >= getItemCount())
@ -147,69 +142,57 @@ public void clearCheck(int index) {
new NonIterableChange.SimpleRemovedChange<>(changeIndex, changeIndex, index, checkedIndicesList));
}
@LauncherAPI
@Override
public void clearCheck(T item) {
int index = getItemIndex(item);
clearCheck(index);
}
@LauncherAPI
@Override
public void clearChecks() {
for (int index = 0; index < checkedIndices.length(); index++)
clearCheck(index);
}
@LauncherAPI
@Override
public ObservableList<Integer> getCheckedIndices() {
return checkedIndicesList;
}
@LauncherAPI
@Override
public ObservableList<T> getCheckedItems() {
return checkedItemsList;
}
@LauncherAPI
@Override
public abstract T getItem(int index);
@LauncherAPI
BooleanProperty getItemBooleanProperty(T item) {
return itemBooleanMap.get(item);
}
@LauncherAPI
@Override
public abstract int getItemCount();
@LauncherAPI
@Override
public abstract int getItemIndex(T item);
@LauncherAPI
@Override
public boolean isChecked(int index) {
return checkedIndices.get(index);
}
@LauncherAPI
@Override
public boolean isChecked(T item) {
int index = getItemIndex(item);
return isChecked(index);
}
@LauncherAPI
@Override
public boolean isEmpty() {
return checkedIndices.isEmpty();
}
@LauncherAPI
@Override
public void toggleCheckState(int index) {
if (isChecked(index))
@ -218,14 +201,12 @@ public void toggleCheckState(int index) {
check(index);
}
@LauncherAPI
@Override
public void toggleCheckState(T item) {
int index = getItemIndex(item);
toggleCheckState(index);
}
@LauncherAPI
protected void updateMap() {
itemBooleanMap.clear();
for (int i = 0; i < getItemCount(); i++) {

View file

@ -13,16 +13,13 @@
import javafx.collections.ObservableList;
import javafx.scene.control.Skin;
import javafx.util.StringConverter;
import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.gui.choosebox.impl.CheckComboBoxSkin;
public class CheckComboBox<T> extends ControlsFXControl {
@LauncherAPI
private static class CheckComboBoxBitSetCheckModel<T> extends CheckBitSetModelBase<T> {
@LauncherAPI
private final ObservableList<T> items;
@LauncherAPI
CheckComboBoxBitSetCheckModel(final ObservableList<T> items, final Map<T, BooleanProperty> itemBooleanMap) {
super(itemBooleanMap);
@ -32,19 +29,16 @@ private static class CheckComboBoxBitSetCheckModel<T> extends CheckBitSetModelBa
updateMap();
}
@LauncherAPI
@Override
public T getItem(int index) {
return items.get(index);
}
@LauncherAPI
@Override
public int getItemCount() {
return items.size();
}
@LauncherAPI
@Override
public int getItemIndex(T item) {
return items.indexOf(item);
@ -53,17 +47,10 @@ public int getItemIndex(T item) {
private final ObservableList<T> items;
private final Map<T, BooleanProperty> itemBooleanMap;
private CheckComboBoxSkin<T> checkComboBoxSkin;
@LauncherAPI
private ObjectProperty<IndexedCheckModel<T>> checkModel = new SimpleObjectProperty<>(this, "checkModel");
@LauncherAPI
private ObjectProperty<StringConverter<T>> converter = new SimpleObjectProperty<>(this,
"converter");
@LauncherAPI
private StringProperty title = new SimpleStringProperty(null);
public CheckComboBox() {

View file

@ -1,4 +1,4 @@
package ru.gravit.launcher.gui.choosebox.impl;
package ru.gravit.launcher.gui.choosebox;
import java.util.Collections;
@ -16,8 +16,6 @@
import javafx.scene.control.cell.CheckBoxListCell;
import javafx.scene.input.KeyCode;
import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.gui.choosebox.CheckComboBox;
import ru.gravit.launcher.gui.choosebox.IndexedCheckModel;
public class CheckComboBoxSkin<T> extends BehaviorSkinBase<CheckComboBox<T>, BehaviorBase<CheckComboBox<T>>> {
@ -75,8 +73,7 @@ protected void updateItem(T item, boolean empty) {
getChildren().add(comboBox);
}
@LauncherAPI
private String buildString() {
final StringBuilder sb = new StringBuilder();
for (int i = 0, max = selectedItems.size(); i < max; i++) {
@ -133,7 +130,6 @@ protected double computePrefWidth(double height, double topInset, double rightIn
return comboBox.prefWidth(height);
}
@LauncherAPI
private Skin<?> createComboBoxListViewSkin(ComboBox<T> comboBox) {
final ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(comboBox) {
@Override

View file

@ -1,7 +1,6 @@
package ru.gravit.launcher.gui.choosebox;
import javafx.scene.control.Control;
import ru.gravit.launcher.LauncherAPI;
abstract class ControlsFXControl extends Control {
@ -11,7 +10,6 @@ public ControlsFXControl() {
}
@LauncherAPI
protected final String getUserAgentStylesheet(Class<?> clazz, String fileName) {
if (stylesheet == null)

View file

@ -1,4 +1,4 @@
package ru.gravit.launcher.gui.buttons;
package ru.gravit.launcher.gui.indicator;
import java.util.ArrayList;
import java.util.Collections;
@ -13,27 +13,17 @@
import com.sun.javafx.css.converters.SizeConverter;
import javafx.scene.control.ProgressIndicator;
import ru.gravit.launcher.LauncherAPI;
@LauncherAPI
abstract class ProgressCircleIndicator extends ProgressIndicator {
@LauncherAPI
public ProgressCircleIndicator() {
this.getStylesheets().add(ProgressCircleIndicator.class.getResource("/runtime/launcher/overlay/update/circleprogress.css").toExternalForm());
}
@LauncherAPI
public final void setInnerCircleRadius(int value) {
innerCircleRadiusProperty().set(value);
}
@LauncherAPI
public final DoubleProperty innerCircleRadiusProperty() {
return innerCircleRadius;
}
@LauncherAPI
public final double getInnerCircleRadius() {
return innerCircleRadiusProperty().get();
}
@ -82,13 +72,9 @@ public StyleableProperty<Number> getStyleableProperty(ProgressCircleIndicator n)
STYLEABLES = Collections.unmodifiableList(styleables);
}
}
@LauncherAPI
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
return StyleableProperties.STYLEABLES;
}
@LauncherAPI
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return StyleableProperties.STYLEABLES;

View file

@ -1,4 +1,4 @@
package ru.gravit.launcher.gui.buttons;
package ru.gravit.launcher.gui.indicator;
import java.util.ArrayList;
import java.util.Collections;
@ -16,7 +16,6 @@
import ru.gravit.launcher.LauncherAPI;
import ru.gravit.utils.helper.LogHelper;
@LauncherAPI
public class RingProgressIndicator extends ProgressCircleIndicator {
public RingProgressIndicator() {
LogHelper.debug("Setting JVM dir name");
@ -24,7 +23,6 @@ public RingProgressIndicator() {
this.getStyleClass().add("ringindicator");
}
@LauncherAPI
@Override
protected Skin<?> createDefaultSkin() {
return new RingProgressIndicatorSkin(this);
@ -91,7 +89,6 @@ public StyleableProperty<Number> getStyleableProperty(RingProgressIndicator n) {
}
}
@LauncherAPI
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return StyleableProperties.STYLEABLES;

View file

@ -1,4 +1,4 @@
package ru.gravit.launcher.gui.buttons;
package ru.gravit.launcher.gui.indicator;
import javafx.animation.Animation;
import javafx.animation.Interpolator;
@ -18,7 +18,6 @@
*
* @author Andrea Vacondio
*/
@LauncherAPI
public class RingProgressIndicatorSkin implements Skin<RingProgressIndicator> {
private final RingProgressIndicator indicator;
@ -29,7 +28,6 @@ public class RingProgressIndicatorSkin implements Skin<RingProgressIndicator> {
private final Arc fillerArc = new Arc();
private final RotateTransition transition = new RotateTransition(Duration.millis(2000), fillerArc);
@LauncherAPI
public RingProgressIndicatorSkin(final RingProgressIndicator indicator) {
this.indicator = indicator;
initContainer(indicator);
@ -108,20 +106,14 @@ private void initIndeterminate(boolean newVal) {
transition.stop();
}
}
@LauncherAPI
@Override
public RingProgressIndicator getSkinnable() {
return indicator;
}
@LauncherAPI
@Override
public Node getNode() {
return container;
}
@LauncherAPI
@Override
public void dispose() {
transition.stop();