]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16882 ac1ea38d-2e2b...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 30 Jul 2010 11:50:59 +0000 (11:50 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 30 Jul 2010 11:50:59 +0000 (11:50 +0000)
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/PointerInteractor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ModuleFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java
sysdyn_ontologies/sysdyn.graph

index 4bbf2ebc455a3e3690d7a56b72e999ad049ad044..f7994265453b85fdf97791b02a276048d655c7cd 100644 (file)
@@ -27,6 +27,7 @@ import org.simantics.g2d.diagram.participant.TerminalPainter;
 import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil;\r
 import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil.TerminalInfo;\r
 import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.IElement;\r
 import org.simantics.g2d.element.IElementClassProvider;\r
 import org.simantics.g2d.event.MouseEvent;\r
 import org.simantics.g2d.event.EventHandlerReflection.EventHandler;\r
@@ -79,17 +80,18 @@ public class PointerInteractor extends org.simantics.g2d.diagram.participant.poi
         // Pick Terminal\r
         TerminalInfo ti = pickTerminal(me.controlPosition);\r
         \r
-        if(elementClassProvider != null) {\r
+        if(ti != null && elementClassProvider != null) {\r
             \r
-            ElementClass connectionClass = null;\r
+            IElement terminalElement = ti.e;\r
             \r
+            ElementClass connectionClass = null;\r
             if( me.button == MouseEvent.LEFT_BUTTON && (me.stateMask & MouseEvent.ALT_MASK) != 0) {\r
-                if(ti.e.getElementClass().getId().equals(CloudFactory.class.getSimpleName())) return false;\r
+                if(terminalElement.getElementClass().getId().equals(CloudFactory.class.getSimpleName())) return false;\r
                 diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(false, false));\r
                 connectionClass = elementClassProvider.get(ConnectionClasses.DEPENDENCY);\r
                 \r
             } else if (me.button == MouseEvent.RIGHT_BUTTON && (me.stateMask & MouseEvent.ALT_MASK) != 0) {\r
-                if(ti.e.getElementClass().getId().equals(AuxiliaryFactory.class.getSimpleName())) return false;\r
+                if(terminalElement.getElementClass().getId().equals(AuxiliaryFactory.class.getSimpleName())) return false;\r
                 diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(true, true));\r
                 connectionClass = elementClassProvider.get(ConnectionClasses.FLOW);\r
             } else {\r
index b73b3f15ce1e61c843bba113eea0d5c69313d286..c542c1a26310ddc01957249e4f59d78c2bd83a23 100644 (file)
@@ -12,6 +12,7 @@
 package org.simantics.sysdyn.ui.elements2;\r
 \r
 import java.awt.BasicStroke;\r
+import java.awt.Font;\r
 import java.awt.geom.Rectangle2D;\r
 import java.util.Collection;\r
 \r
@@ -44,12 +45,12 @@ public class ModuleFactory extends SysdynElementFactory {
                 OutlinePick.INSTANCE,\r
                 TextImpl.INSTANCE,\r
                 TextColorImpl.BLACK,\r
-                TextFontImpl.DEFAULT,\r
+                new TextFontImpl(new Font("arial", Font.PLAIN, 25)),\r
                 DefaultTransform.INSTANCE,\r
                 new StaticObjectAdapter(elementType),\r
                 new StaticSymbolImpl(DEFAULT_IMAGE),\r
                 StaticSymbolImageInitializer.INSTANCE,\r
-                new HoverTextElementHandler(0, 0, Alignment.LEADING, 0.2f),\r
+                new HoverTextElementHandler(0, 0, Alignment.LEADING, 1f , 7, 7, false),\r
                 BoundsOutline.INSTANCE,\r
                 new WholeElementTerminals(terminals)\r
         ).setId(ModuleFactory.class.getSimpleName());\r
index 5d6d72b7a5d9a8880accc9ed2d2d632617fd2d7e..1e9fdc0f17a6eb63db86d00c3ffd65e0ed9ee4c6 100644 (file)
@@ -40,6 +40,7 @@ public class NewModuleNodeHandler extends AbstractHandler {
                 ModelingUtils mu = new ModelingUtils(g);\r
                 \r
                 Resource moduleType = g.newResource();\r
+                g.claimValue(moduleType, mu.b.HasName, "New Module Type");\r
                 g.claimValue(moduleType, mu.b.HasLabel, "New Module Type");\r
                 g.claim(moduleType, mu.b.Inherits, sr.Module);\r
                 g.claim(moduleType, mu.b.PartOf, model);\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java
new file mode 100644 (file)
index 0000000..ef01992
--- /dev/null
@@ -0,0 +1,29 @@
+package org.simantics.sysdyn.ui.properties;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.PropertyTabContributorImpl;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.management.ISessionContext;\r
+\r
+public class ModuleTypeTab extends PropertyTabContributorImpl {\r
+\r
+    @Override\r
+    public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
+        Composite composite = new Composite(body, SWT.NONE);\r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite);\r
+        TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
+        nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName));\r
+        nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName));\r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget());\r
+    }\r
+\r
+}\r
index 1ecd329c981a136bbf28ec69b86b3f826a80fd19..cf6fd21679784eb5937d0a411b94d1da7077d098 100644 (file)
@@ -128,6 +128,13 @@ public class ResourceSelectionProcessor implements SelectionProcessor<ISelection
                                     0,\r
                                     r,\r
                             "Dependency Properties"));\r
+            if (backend.isInheritedFrom(r, sr.Module))\r
+                return Collections.singleton(\r
+                        new ComparableTabContributor(\r
+                                new ModuleTypeTab(),\r
+                                0,\r
+                                r,\r
+                        "Module Type Properties"));\r
         } catch (ServiceException e) {\r
             e.printStackTrace();\r
         } catch (ManyObjectsForFunctionalRelationException e) {\r
index 22793451bc677fb95147fffc205e2ee40cd9e9bf..ce87242493010c8d978b9d3a3782556c5b02ace9 100644 (file)
@@ -650,10 +650,10 @@ RootConfigurationDiagram : ConfigurationDiagram <R L0.HasNext
   %list_elements\r
     CustomersElement : CustomersSymbol\r
         MOD.ElementToComponent Customers\r
-        DIA.HasTransform "3.5, 0.0, 0.0, 3.5, 89.0, 133.0" : G2D.Transform\r
+        DIA.HasTransform "1.0, 0.0, 0.0, 1.0, 89.0, 133.0" : G2D.Transform\r
     CapacityElement : CapacitySymbol\r
         MOD.ElementToComponent Capacity\r
-        DIA.HasTransform "3.5, 0.0, 0.0, 3.5, 87.0, 65.0" : G2D.Transform\r
+        DIA.HasTransform "1.0, 0.0, 0.0, 1.0, 87.0, 65.0" : G2D.Transform\r
     SalesRevenueElement : ValveSymbol\r
         MOD.ElementToComponent SalesRevenue\r
         DIA.HasTransform "1.0, 0.0, 0.0, 1.0, 100.0, 90.0" : G2D.Transform\r