Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrushforth committed Apr 14, 2020
2 parents d299465 + 9d50c4c commit bb5ce2c
Show file tree
Hide file tree
Showing 50 changed files with 1,152 additions and 641 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@
* questions.
*/

package com.sun.javafx.scene.control.skin;
package javafx.scene.control.skin;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
Expand All @@ -40,12 +40,16 @@ public void changed(ObservableValue<? extends Boolean> observable,
Boolean wasFocused, Boolean isFocused) {
if (textArea.isEditable()) {
if (isFocused) {
com.sun.glass.ui.android.SoftwareKeyboard.show();
showSoftwareKeyboard();
} else {
com.sun.glass.ui.android.SoftwareKeyboard.hide();
hideSoftwareKeyboard();
}
}
}
});
}

native void showSoftwareKeyboard();
native void hideSoftwareKeyboard();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@
* questions.
*/

package com.sun.javafx.scene.control.skin;
package javafx.scene.control.skin;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
Expand All @@ -42,16 +42,16 @@ public void changed(ObservableValue<? extends Boolean> observable,
Boolean wasFocused, Boolean isFocused) {
if (textField.isEditable()) {
if (isFocused) {
com.sun.glass.ui.android.SoftwareKeyboard.show();
showSoftwareKeyboard();
} else {
com.sun.glass.ui.android.SoftwareKeyboard.hide();
hideSoftwareKeyboard();
}
}
}
});
}

public TextFieldSkinAndroid(final TextField textField, final TextFieldBehavior behavior) {
super(textField, behavior);
}
native void showSoftwareKeyboard();
native void hideSoftwareKeyboard();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,7 +37,7 @@
******************************************************************************/

.text-field {
-fx-skin: "com.sun.javafx.scene.control.skin.TextFieldSkinAndroid";
-fx-skin: "javafx.scene.control.skin.TextFieldSkinAndroid";
}


Expand All @@ -48,6 +48,6 @@
******************************************************************************/

.text-area {
-fx-skin: "com.sun.javafx.scene.control.skin.TextAreaSkinAndroid";
-fx-skin: "javafx.scene.control.skin.TextAreaSkinAndroid";
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,7 +37,7 @@
******************************************************************************/

.text-field {
-fx-skin: "com.sun.javafx.scene.control.skin.TextFieldSkinAndroid";
-fx-skin: "javafx.scene.control.skin.TextFieldSkinAndroid";
}


Expand All @@ -48,6 +48,6 @@
******************************************************************************/

.text-area {
-fx-skin: "com.sun.javafx.scene.control.skin.TextAreaSkinAndroid";
-fx-skin: "javafx.scene.control.skin.TextAreaSkinAndroid";
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,18 +23,33 @@
* questions.
*/

#import <Cocoa/Cocoa.h>
package javafx.scene.control.skin;

#import "GlassView.h"
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.TextArea;
import javafx.scene.control.skin.TextAreaSkin;

// 2D version of Glass providing Quartz context
@interface GlassView2D : NSView <GlassView>
{
GlassViewDelegate *delegate;
public class TextAreaSkinIos extends TextAreaSkin {

NSTrackingArea *trackingArea;
}
public TextAreaSkinIos(final TextArea textArea) {
super(textArea);

textArea.focusedProperty().addListener(new ChangeListener<Boolean>() {
public void changed(ObservableValue<? extends Boolean> observable,
Boolean wasFocused, Boolean isFocused) {
if (textArea.isEditable()) {
if (isFocused) {
showSoftwareKeyboard();
} else {
hideSoftwareKeyboard();
}
}
}
});
}

- (void)setFrameOrigin:(NSPoint)newOrigin;
native void showSoftwareKeyboard();
native void hideSoftwareKeyboard();

@end
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package javafx.scene.control.skin;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.TextField;

import com.sun.javafx.scene.control.behavior.TextFieldBehavior;
import javafx.scene.control.skin.TextFieldSkin;

public class TextFieldSkinIos extends TextFieldSkin {

public TextFieldSkinIos(final TextField textField) {
super(textField);

textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
public void changed(ObservableValue<? extends Boolean> observable,
Boolean wasFocused, Boolean isFocused) {
if (textField.isEditable()) {
if (isFocused) {
showSoftwareKeyboard();
} else {
hideSoftwareKeyboard();
}
}
}
});
}

native void showSoftwareKeyboard();
native void hideSoftwareKeyboard();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*******************************************************************************
* *
* Ios specific css *
* *
******************************************************************************/


/*******************************************************************************
* *
* TextField *
* *
******************************************************************************/

.text-field {
-fx-skin: "javafx.scene.control.skin.TextFieldSkinIos";
}


/*******************************************************************************
* *
* TextArea *
* *
******************************************************************************/

.text-area {
-fx-skin: "javafx.scene.control.skin.TextAreaSkinIos";
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*******************************************************************************
* *
* Ios specific css *
* *
******************************************************************************/


/*******************************************************************************
* *
* TextField *
* *
******************************************************************************/

.text-field {
-fx-skin: "javafx.scene.control.skin.TextFieldSkinIos";
}


/*******************************************************************************
* *
* TextArea *
* *
******************************************************************************/

.text-area {
-fx-skin: "javafx.scene.control.skin.TextAreaSkinIos";
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -650,6 +650,11 @@ private void processRightKey(KeyEvent ke) {

private void showMenu(Menu menu) {
menu.show();

if (submenu == null) {
return;
}

// request focus on the first item of the submenu after it is shown
ContextMenuContent cmContent = (ContextMenuContent)submenu.getSkin().getNode();
if (cmContent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,33 +149,11 @@ public void changed(ObservableValue<? extends Boolean> observable, Boolean oldVa
// TextArea doesn't lose selection on focus lost, whereas the TextField does.
final TextArea textArea = getNode();
if (textArea.isFocused()) {
if (PlatformUtil.isIOS()) {
// Special handling of focus on iOS is required to allow to
// control native keyboard, because native keyboard is popped-up only when native
// text component gets focus. When we have JFX keyboard we can remove this code
final Bounds bounds = textArea.getBoundsInParent();
double w = bounds.getWidth();
double h = bounds.getHeight();
Affine3D trans = TextFieldBehavior.calculateNodeToSceneTransform(textArea);
String text = textArea.textProperty().getValueSafe();

// we need to display native text input component on the place where JFX component is drawn
// all parameters needed to do that are passed to native impl. here
WindowHelper.getPeer(textArea.getScene().getWindow()).requestInput(
text, TextFieldBehavior.TextInputTypes.TEXT_AREA.ordinal(), w, h,
trans.getMxx(), trans.getMxy(), trans.getMxz(), trans.getMxt(),
trans.getMyx(), trans.getMyy(), trans.getMyz(), trans.getMyt(),
trans.getMzx(), trans.getMzy(), trans.getMzz(), trans.getMzt());
}
if (!focusGainedByMouseClick) {
setCaretAnimating(true);
}
} else {
// skin.hideCaret();
if (PlatformUtil.isIOS() && textArea.getScene() != null) {
// releasing the focus => we need to hide the native component and also native keyboard
WindowHelper.getPeer(textArea.getScene().getWindow()).releaseInput();
}
focusGainedByMouseClick = false;
setCaretAnimating(false);
}
Expand Down
Loading

0 comments on commit bb5ce2c

Please sign in to comment.