Refactor UX
[gpl/argeo-suite.git] / swt / org.argeo.app.ui / src / org / argeo / app / ui / SuiteUiUtils.java
index 59d11343285ed30c6e605906ffe9752cc8258e68..c98847a0dd8b143f93c89fa63778d1c715fb6fd5 100644 (file)
@@ -5,6 +5,8 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Objects;
 
 import javax.jcr.Node;
@@ -19,6 +21,8 @@ import org.argeo.api.cms.ux.CmsIcon;
 import org.argeo.api.cms.ux.CmsStyle;
 import org.argeo.app.api.EntityNames;
 import org.argeo.app.api.EntityType;
+import org.argeo.app.ux.SuiteStyle;
+import org.argeo.app.ux.SuiteUxEvent;
 import org.argeo.cms.LocaleUtils;
 import org.argeo.cms.Localized;
 import org.argeo.cms.jcr.acr.JcrContent;
@@ -242,7 +246,8 @@ public class SuiteUiUtils {
                boolean test = false;
                if (test) {
                        try (InputStream in = JcrUtils.getFileAsStream(fileNode);
-                                       OutputStream out = Files.newOutputStream(Paths.get("/home/mbaudier/tmp/" + fileNode.getName()));) {
+                                       OutputStream out = Files.newOutputStream(
+                                                       Paths.get(System.getProperty("user.home") + "/tmp/" + fileNode.getName()));) {
 //                             BufferedImage img = ImageIO.read(in);
 //                             System.out.println(fileNode.getName() + ": width=" + img.getWidth() + ", height=" + img.getHeight());
                                IOUtils.copy(in, out);
@@ -427,6 +432,14 @@ public class SuiteUiUtils {
                return button;
        }
 
+       @Deprecated
+       public static Map<String, Object> eventProperties(Node node) {
+               Map<String, Object> properties = new HashMap<>();
+               String contentPath = '/' + Jcr.getWorkspaceName(node) + Jcr.getPath(node);
+               properties.put(SuiteUxEvent.CONTENT_PATH, contentPath);
+               return properties;
+       }
+
 //     public static String createAndConfigureEntity(Shell shell, Session referenceSession, String mainMixin,
 //                     String... additionnalProps) {
 //