Skip to content

Commit

Permalink
Updates to XUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Erel2 committed Jan 5, 2021
1 parent abee638 commit 70ad7f4
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import java.util.HashMap;

import com.sun.javafx.scene.web.skin.HTMLEditorSkin;

import javafx.scene.Node;
import javafx.scene.web.HTMLEditor;
import anywheresoftware.b4a.BA;
Expand Down
2 changes: 1 addition & 1 deletion Libs_jFX/src/anywheresoftware/b4j/objects/JFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
/**
* A class that holds utility methods related to JavaFX apps.
*/
@Version(8.30f)
@Version(8.80f)
@DependsOn(values = {"Json"})
@ShortName("JFX")
public class JFX {
Expand Down
9 changes: 8 additions & 1 deletion Libs_jFX/src/anywheresoftware/b4j/objects/LayoutBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,15 @@ else if (buildType == RESIZE)
if (t instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)t;
if (pt.getActualTypeArguments().length > 0) {

ParameterizedType fieldParamType = (ParameterizedType) field.getType().getGenericSuperclass();
if (((Class)fieldParamType.getActualTypeArguments()[0]).isAssignableFrom((Class)(pt.getActualTypeArguments()[0])) == false) {
Class actualType;
if (pt.getActualTypeArguments()[0] instanceof ParameterizedType) {
actualType = (Class)((ParameterizedType)pt.getActualTypeArguments()[0]).getActualTypeArguments()[0];
} else {
actualType = (Class)(pt.getActualTypeArguments()[0]);
}
if (((Class)fieldParamType.getActualTypeArguments()[0]).isAssignableFrom(actualType) == false) {
throw new RuntimeException("Cannot convert: " + ow.getClass() + ", to: " + field.getType());
}
}
Expand Down
48 changes: 47 additions & 1 deletion Libs_jXUI/src/anywheresoftware/b4a/objects/B4XViewWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
/**
* A generic view. Any view can be treated as a B4XView.
*/
@Version(2.00f)
@Version(2.10f)
@ShortName("B4XView")
public class B4XViewWrapper extends AbsObjectWrapper<Object>{
public static final int TOUCH_ACTION_DOWN = 0;
Expand Down Expand Up @@ -737,6 +737,52 @@ public double getRotation() {
public void setRotation(double f) {
getNodeObject().setRotate(f);
}

/**
* Gets or sets the selection start index.
*See also: B4XView.SetSelection.
*Supported types:
*B4A - EditText
*B4i - TextField and TextView
*B4J - TextField and TextArea
*/
public int getSelectionStart() {
return ((TextInputControl)getObject()).getSelection().getStart();
}
public void setSelectionStart(int s) {
SetSelection(s, 0);
}
/**
* Gets the selection length.
*See also: B4XView.SetSelection.
*Supported types:
*B4A - EditText
*B4i - TextField and TextView
*B4J - TextField and TextArea
*/
public int getSelectionLength() {
return ((TextInputControl)getObject()).getSelection().getLength();
}
/**
* Sets the selection.
*Supported types:
*B4A - EditText
*B4i - TextField and TextView
*B4J - TextField and TextArea
*/
public void SetSelection(int Start, int Length) {
((TextInputControl)getObject()).selectRange(Start, Start + Length);
}
/**
* Selects all text.
*Supported types:
*B4A - EditText
*B4i - TextField and TextView
*B4J - TextField and TextArea
*/
public void SelectAll() {
((TextInputControl)getObject()).selectAll();
}
/**
* Represents a loaded image. Similar to B4A Bitmap, B4i Bitmap and B4J Image.
*/
Expand Down

0 comments on commit 70ad7f4

Please sign in to comment.