]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/base/SWTViewUtils.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.views.swt.client / src / org / simantics / views / swt / client / base / SWTViewUtils.java
index 91cc7f7a1381bf81a9f3671c5455f46365521867..ee31c224cf11af9376169501091532a04e44d6b8 100644 (file)
@@ -1,97 +1,97 @@
-package org.simantics.views.swt.client.base;\r
-\r
-import org.eclipse.jface.layout.GridLayoutFactory;\r
-import org.eclipse.jface.layout.RowLayoutFactory;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.layout.RowData;\r
-import org.eclipse.swt.layout.RowLayout;\r
-import org.eclipse.swt.widgets.Layout;\r
-import org.simantics.browsing.ui.Column;\r
-import org.simantics.browsing.ui.Column.Align;\r
-import org.simantics.views.ViewUtils.ColumnBean;\r
-import org.simantics.views.ViewUtils.GridDataBean;\r
-import org.simantics.views.ViewUtils.GridLayoutBean;\r
-import org.simantics.views.ViewUtils.LayoutBean;\r
-import org.simantics.views.ViewUtils.LayoutDataBean;\r
-import org.simantics.views.ViewUtils.RowDataBean;\r
-import org.simantics.views.ViewUtils.RowLayoutBean;\r
-\r
-public class SWTViewUtils {\r
-\r
-       public static Layout toLayout(GridLayoutBean bean) {\r
-               GridLayout result = GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).margins(0, 0).spacing(0, 0).create();\r
-               result.numColumns = bean.numColumns;\r
-               result.horizontalSpacing = bean.horizontalSpacing;\r
-               result.verticalSpacing = bean.verticalSpacing;\r
-               result.marginLeft = bean.marginLeft;\r
-               result.marginRight = bean.marginRight;\r
-               result.marginTop = bean.marginTop;\r
-               result.marginBottom = bean.marginBottom;\r
-               return result;\r
-       }\r
-\r
-       public static Layout toLayout(RowLayoutBean bean) {\r
-               RowLayout result = RowLayoutFactory.fillDefaults().create();\r
-               result.type = bean.type;\r
-               result.spacing = bean.spacing;\r
-               result.center = bean.center;\r
-               result.fill = bean.fill;\r
-               result.justify = bean.justify;\r
-               result.pack = bean.pack;\r
-               result.wrap = bean.wrap;\r
-               result.marginLeft = bean.marginLeft;\r
-               result.marginRight = bean.marginRight;\r
-               result.marginTop = bean.marginTop;\r
-               result.marginBottom = bean.marginBottom;\r
-               return result;\r
-       }\r
-\r
-       public static GridData toGridData(GridDataBean bean) {\r
-               GridData result = new GridData(SWT.FILL, SWT.FILL, true, false);\r
-               result.horizontalSpan = bean.horizontalSpan;\r
-               result.grabExcessHorizontalSpace = bean.grabExcessHorizontalSpace;\r
-               result.grabExcessVerticalSpace = bean.grabExcessVerticalSpace;\r
-               result.horizontalAlignment = bean.horizontalAlignment;\r
-               result.verticalAlignment = bean.verticalAlignment;\r
-               result.widthHint = bean.widthHint;\r
-               result.heightHint = bean.heightHint;\r
-               return result;\r
-               \r
-       }\r
-\r
-       public static RowData toRowData(RowDataBean bean) {\r
-               return new RowData(bean.width, bean.height);\r
-       }\r
-\r
-       public static Layout toLayout(LayoutBean layout) {\r
-               if (layout instanceof GridLayoutBean)\r
-                       return toLayout((GridLayoutBean) layout);\r
-               if (layout instanceof RowLayoutBean)\r
-                       return toLayout((RowLayoutBean) layout);\r
-               throw new IllegalArgumentException("unrecognized layout: " + layout);\r
-       }\r
-\r
-\r
-       public static Object toLayoutData(LayoutDataBean layoutData) {\r
-               if (layoutData instanceof GridDataBean)\r
-                       return toGridData((GridDataBean) layoutData);\r
-               if (layoutData instanceof RowDataBean)\r
-                       return toRowData((RowDataBean) layoutData);\r
-               throw new IllegalArgumentException("unrecognized layout data: " + layoutData);\r
-       }\r
-\r
-       private static Align getAlign(String alignment) {\r
-               if("LEFT".equals(alignment)) return Align.LEFT;\r
-               else if("CENTER".equals(alignment)) return Align.CENTER;\r
-               else if("RIGHT".equals(alignment)) return Align.RIGHT;\r
-               else throw new IllegalArgumentException("Align should be either LEFT, CENTER or RIGHT (was " + alignment + ")");\r
-       }\r
-       \r
-       public static Column toColumn(ColumnBean bean) {\r
-               Align align = getAlign(bean.alignment);\r
-               return new Column(bean.key, bean.label, align, bean.width, bean.tooltip, bean.grab, bean.weight);\r
-       }\r
-       \r
-}\r
+package org.simantics.views.swt.client.base;
+
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.layout.RowLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Layout;
+import org.simantics.browsing.ui.Column;
+import org.simantics.browsing.ui.Column.Align;
+import org.simantics.views.ViewUtils.ColumnBean;
+import org.simantics.views.ViewUtils.GridDataBean;
+import org.simantics.views.ViewUtils.GridLayoutBean;
+import org.simantics.views.ViewUtils.LayoutBean;
+import org.simantics.views.ViewUtils.LayoutDataBean;
+import org.simantics.views.ViewUtils.RowDataBean;
+import org.simantics.views.ViewUtils.RowLayoutBean;
+
+public class SWTViewUtils {
+
+       public static Layout toLayout(GridLayoutBean bean) {
+               GridLayout result = GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).margins(0, 0).spacing(0, 0).create();
+               result.numColumns = bean.numColumns;
+               result.horizontalSpacing = bean.horizontalSpacing;
+               result.verticalSpacing = bean.verticalSpacing;
+               result.marginLeft = bean.marginLeft;
+               result.marginRight = bean.marginRight;
+               result.marginTop = bean.marginTop;
+               result.marginBottom = bean.marginBottom;
+               return result;
+       }
+
+       public static Layout toLayout(RowLayoutBean bean) {
+               RowLayout result = RowLayoutFactory.fillDefaults().create();
+               result.type = bean.type;
+               result.spacing = bean.spacing;
+               result.center = bean.center;
+               result.fill = bean.fill;
+               result.justify = bean.justify;
+               result.pack = bean.pack;
+               result.wrap = bean.wrap;
+               result.marginLeft = bean.marginLeft;
+               result.marginRight = bean.marginRight;
+               result.marginTop = bean.marginTop;
+               result.marginBottom = bean.marginBottom;
+               return result;
+       }
+
+       public static GridData toGridData(GridDataBean bean) {
+               GridData result = new GridData(SWT.FILL, SWT.FILL, true, false);
+               result.horizontalSpan = bean.horizontalSpan;
+               result.grabExcessHorizontalSpace = bean.grabExcessHorizontalSpace;
+               result.grabExcessVerticalSpace = bean.grabExcessVerticalSpace;
+               result.horizontalAlignment = bean.horizontalAlignment;
+               result.verticalAlignment = bean.verticalAlignment;
+               result.widthHint = bean.widthHint;
+               result.heightHint = bean.heightHint;
+               return result;
+               
+       }
+
+       public static RowData toRowData(RowDataBean bean) {
+               return new RowData(bean.width, bean.height);
+       }
+
+       public static Layout toLayout(LayoutBean layout) {
+               if (layout instanceof GridLayoutBean)
+                       return toLayout((GridLayoutBean) layout);
+               if (layout instanceof RowLayoutBean)
+                       return toLayout((RowLayoutBean) layout);
+               throw new IllegalArgumentException("unrecognized layout: " + layout);
+       }
+
+
+       public static Object toLayoutData(LayoutDataBean layoutData) {
+               if (layoutData instanceof GridDataBean)
+                       return toGridData((GridDataBean) layoutData);
+               if (layoutData instanceof RowDataBean)
+                       return toRowData((RowDataBean) layoutData);
+               throw new IllegalArgumentException("unrecognized layout data: " + layoutData);
+       }
+
+       private static Align getAlign(String alignment) {
+               if("LEFT".equals(alignment)) return Align.LEFT;
+               else if("CENTER".equals(alignment)) return Align.CENTER;
+               else if("RIGHT".equals(alignment)) return Align.RIGHT;
+               else throw new IllegalArgumentException("Align should be either LEFT, CENTER or RIGHT (was " + alignment + ")");
+       }
+       
+       public static Column toColumn(ColumnBean bean) {
+               Align align = getAlign(bean.alignment);
+               return new Column(bean.key, bean.label, align, bean.width, bean.tooltip, bean.grab, bean.weight);
+       }
+       
+}