commit 09/04/2025
This commit is contained in:
@@ -413,7 +413,7 @@ public class SomeCodes {
|
||||
*/
|
||||
public static boolean ValidString(String x){
|
||||
if (x!=null){
|
||||
return !x.isEmpty();
|
||||
return !x.isBlank();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -490,7 +490,7 @@ public class SomeCodes {
|
||||
* @return true if valid, false if not valid
|
||||
*/
|
||||
public static boolean ValidMedicalRecordId(String patientid){
|
||||
if (patientid!=null && !patientid.isEmpty()){
|
||||
if (patientid!=null && !patientid.isBlank()){
|
||||
boolean valid = true;
|
||||
for(int i=0; i<patientid.length(); i++){
|
||||
if (!Character.isDigit(patientid.charAt(i))){
|
||||
@@ -605,23 +605,29 @@ public class SomeCodes {
|
||||
}
|
||||
|
||||
public static void SetText(Object obj, String text){
|
||||
if (obj!=null && text!=null){
|
||||
if (obj!=null && ValidString(text)){
|
||||
if (Platform.isFxApplicationThread()){
|
||||
if (obj instanceof Label){
|
||||
((Label) obj).setText(text);
|
||||
} else if (obj instanceof TextArea){
|
||||
((TextArea) obj).setText(text);
|
||||
} else if (obj instanceof TextField){
|
||||
((TextField) obj).setText(text);
|
||||
if (obj instanceof Label lbl){
|
||||
if (text.equals(lbl.getText())) return;
|
||||
lbl.setText(text);
|
||||
} else if (obj instanceof TextArea ta){
|
||||
if (text.equals(ta.getText())) return;
|
||||
ta.setText(text);
|
||||
} else if (obj instanceof TextField tf){
|
||||
if (text.equals(tf.getText())) return;
|
||||
tf.setText(text);
|
||||
}
|
||||
} else{
|
||||
Platform.runLater(()->{
|
||||
if (obj instanceof Label){
|
||||
((Label) obj).setText(text);
|
||||
} else if (obj instanceof TextArea){
|
||||
((TextArea) obj).setText(text);
|
||||
} else if (obj instanceof TextField){
|
||||
((TextField) obj).setText(text);
|
||||
if (obj instanceof Label lbl){
|
||||
if (text.equals(lbl.getText())) return;
|
||||
lbl.setText(text);
|
||||
} else if (obj instanceof TextArea ta){
|
||||
if (text.equals(ta.getText())) return;
|
||||
ta.setText(text);
|
||||
} else if (obj instanceof TextField tf){
|
||||
if (text.equals(tf.getText())) return;
|
||||
tf.setText(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user