Fix reverted boolean value
authorBruno Sinou <bsinou@argeo.org>
Fri, 4 Dec 2015 16:46:32 +0000 (16:46 +0000)
committerBruno Sinou <bsinou@argeo.org>
Fri, 4 Dec 2015 16:46:32 +0000 (16:46 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@8681 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.cms/src/org/argeo/cms/forms/EditableLink.java
org.argeo.cms/src/org/argeo/cms/forms/EditableMultiStringProperty.java
org.argeo.cms/src/org/argeo/cms/forms/EditablePropertyDate.java
org.argeo.cms/src/org/argeo/cms/forms/EditablePropertyString.java
org.argeo.cms/src/org/argeo/cms/forms/FormPageViewer.java
org.argeo.cms/src/org/argeo/cms/forms/FormUtils.java

index 17e3255b1c12a57edf08fcda653e1ee29df91ea9..ece0be36b868b6e68649fb0525e12cd3b6cba787 100644 (file)
@@ -4,6 +4,7 @@ import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 
 import org.argeo.cms.viewers.EditablePart;
+import org.argeo.eclipse.ui.EclipseUiUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -40,7 +41,7 @@ public class EditableLink extends EditablePropertyString implements
                Control child = getControl();
                if (child instanceof Label) {
                        Label lbl = (Label) child;
-                       if (FormUtils.notEmpty(text))
+                       if (EclipseUiUtils.isEmpty(text))
                                lbl.setText(message);
                        else if (readOnly)
                                setLinkValue(lbl, text);
@@ -50,7 +51,7 @@ public class EditableLink extends EditablePropertyString implements
                                lbl.setText(text);
                } else if (child instanceof Text) {
                        Text txt = (Text) child;
-                       if (FormUtils.notEmpty(text)) {
+                       if (EclipseUiUtils.isEmpty(text)) {
                                txt.setText("");
                                txt.setMessage(message);
                        } else
index 629630b6bd110b76144d9dd86ce898410f0d9ef1..fdaa0365ca61a56c4ba55f00117356a28173c34b 100644 (file)
@@ -196,7 +196,7 @@ public class EditableMultiStringProperty extends StyledControl implements
                String value = text.getText();
                String errMsg = null;
 
-               if (FormUtils.notEmpty(value))
+               if (EclipseUiUtils.isEmpty(value))
                        return;
 
                if (values.contains(value))
index 83580df638e9dd3d305ee8060f0281133b400079..928a285083e1f9f1d8bb89c66eabdd9503895541 100644 (file)
@@ -79,13 +79,13 @@ public class EditablePropertyDate extends StyledControl implements EditablePart
                Control child = getControl();
                if (child instanceof Label) {
                        Label lbl = (Label) child;
-                       if (FormUtils.notEmpty(text))
+                       if (EclipseUiUtils.isEmpty(text))
                                lbl.setText(message);
                        else
                                lbl.setText(text);
                } else if (child instanceof Text) {
                        Text txt = (Text) child;
-                       if (FormUtils.notEmpty(text)) {
+                       if (EclipseUiUtils.isEmpty(text)) {
                                txt.setText("");
                        } else
                                txt.setText(text);
@@ -99,7 +99,7 @@ public class EditablePropertyDate extends StyledControl implements EditablePart
        }
 
        public synchronized void stopEditing() {
-               if (FormUtils.notEmpty(dateTxt.getText()))
+               if (EclipseUiUtils.isEmpty(dateTxt.getText()))
                        getControl().setData(STYLE, FormStyle.propertyMessage.style());
                else
                        getControl().setData(STYLE, FormStyle.propertyText.style());
index e8631292240aeba0b779d46f817a6d1a44ac4903..e7840396d81199f60b52cce0c4fbd429a1e18ab9 100644 (file)
@@ -8,6 +8,7 @@ import javax.jcr.RepositoryException;
 
 import org.argeo.cms.viewers.EditablePart;
 import org.argeo.cms.widgets.EditableText;
+import org.argeo.eclipse.ui.EclipseUiUtils;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
@@ -41,13 +42,13 @@ public class EditablePropertyString extends EditableText implements
                Control child = getControl();
                if (child instanceof Label) {
                        Label lbl = (Label) child;
-                       if (FormUtils.notEmpty(text))
+                       if (EclipseUiUtils.isEmpty(text))
                                lbl.setText(message + "  ");
                        else
                                lbl.setText(text);
                } else if (child instanceof Text) {
                        Text txt = (Text) child;
-                       if (FormUtils.notEmpty(text)) {
+                       if (EclipseUiUtils.isEmpty(text)) {
                                txt.setText("");
                                txt.setMessage(message + " ");
                        } else
@@ -61,7 +62,7 @@ public class EditablePropertyString extends EditableText implements
        }
 
        public synchronized void stopEditing() {
-               if (FormUtils.notEmpty(((Text) getControl()).getText()))
+               if (EclipseUiUtils.isEmpty(((Text) getControl()).getText()))
                        getControl().setData(STYLE, propertyMessage.style());
                else
                        getControl().setData(STYLE, propertyText.style());
index 7460a00fdd30bc854bdaef0cbaaa6b1d8f71f84e..7890f4710435334a5073b54b992b3f901f275869 100644 (file)
@@ -121,7 +121,7 @@ public class FormPageViewer extends AbstractPageViewer {
                        // JCR : Model
                        node = ept.getNode();
                        String propName = ept.getPropertyName();
-                       if (FormUtils.notEmpty(txt)) {
+                       if (EclipseUiUtils.isEmpty(txt)) {
                                if (node.hasProperty(propName))
                                        node.getProperty(propName).remove();
                        } else {
index f5745889e3604d8066aae59ec9745b20e892407d..cf9984b864bbb1329259d2a013e38c34ea9203f4 100644 (file)
@@ -33,15 +33,10 @@ public class FormUtils {
 
        public final static String DEFAULT_SHORT_DATE_FORMAT = "dd/MM/yyyy";
 
-       /** Simply checks if a string is not null nor empty */
-       public static boolean notEmpty(String stringToTest) {
-               return EclipseUiUtils.notEmpty(stringToTest);
-       }
-
        /** Best effort to convert a String to a calendar. Fails silently */
        public static Calendar parseDate(DateFormat dateFormat, String calStr) {
                Calendar cal = null;
-               if (notEmpty(calStr)) {
+               if (EclipseUiUtils.notEmpty(calStr)) {
                        try {
                                Date date = dateFormat.parse(calStr);
                                cal = new GregorianCalendar();