]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling.ui / scl / Simantics / Testing / BrowseContext.scl
diff --git a/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl b/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl
new file mode 100644 (file)
index 0000000..485f886
--- /dev/null
@@ -0,0 +1,120 @@
+import "Simantics/DB"\r
+import "Map" as Map\r
+import "Simantics/Testing/BuiltinKeys"\r
+\r
+importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContext" where\r
+    """\r
+    BrowseContext holds all contributions related to given set of browse contexts.\r
+    """\r
+    data BrowseContext\r
+    \r
+    @JavaName getChildren\r
+    """\r
+    Returns the possible children of the given NodeContext parameter.\r
+    """\r
+    browseContextChildren :: BrowseContext -> NodeContext -> <ReadGraph> Collection NodeContext\r
+    \r
+    @JavaName getParents\r
+    """\r
+    Returns the possible parents of the given NodeContext parameter.\r
+    """\r
+    browseContextParents:: BrowseContext -> NodeContext -> <ReadGraph> Collection NodeContext\r
+    \r
+    @JavaName getLabel\r
+    """\r
+    Finds labels for the given NodeContext parameter.\r
+    """\r
+    browseContextLabel :: BrowseContext -> NodeContext -> <ReadGraph> Map.T String String\r
+    \r
+    @JavaName getImage\r
+    """\r
+    Finds @link ImageDescriptors for the given NodeContext parameter.\r
+    """\r
+    browseContextImage :: BrowseContext -> NodeContext -> <ReadGraph> Map.T String ImageDescriptor\r
+    \r
+    @JavaName getCheckedState\r
+    """\r
+    Finds if the given NodeContext is checked or not.\r
+    """\r
+    browseContextCheckedState :: BrowseContext -> NodeContext -> <ReadGraph> CheckedState\r
+    \r
+    @JavaName getLabelDecorator\r
+    """\r
+    Finds LabelDecorator for the given NodeContext parameter.\r
+    """\r
+    browseContextLabelDecorator :: BrowseContext -> NodeContext -> <ReadGraph> LabelDecorator\r
+    \r
+    @JavaName getImageDecorator\r
+    """\r
+    Finds ImageDecorator for the given NodeContext parameter.\r
+    """\r
+    browseContextImageDecorator :: BrowseContext -> NodeContext -> <ReadGraph> ImageDecorator\r
+    \r
+    @JavaName getModifier\r
+    """\r
+    Finds Modifier for the given NodeContext parameter.\r
+    """\r
+    browseContextModifier :: BrowseContext -> NodeContext -> String -> <ReadGraph> Maybe Modifier\r
+    \r
+    @private\r
+    create :: [Resource] -> <ReadGraph> BrowseContext\r
+\r
+importJava "org.simantics.browsing.ui.NodeContext" where\r
+    """\r
+    A context used to represent a single visible UI item. \r
+    """\r
+    data NodeContext\r
+    \r
+    """\r
+    Finds value with the specified key or <code>null</code> if there was no value for the key\r
+    """\r
+    getConstant :: NodeContext -> ConstantKey -> <Proc> a\r
+\r
+importJava "org.eclipse.jface.resource.ImageDescriptor" where\r
+    data ImageDescriptor\r
+\r
+importJava "org.simantics.browsing.ui.content.ImageDecorator" where\r
+    data ImageDecorator\r
+\r
+importJava "org.eclipse.jface.resource.JFaceResources" where\r
+    getDefaultFontDescriptor :: FontDescriptor\r
+\r
+importJava "org.eclipse.jface.resource.DeviceResourceDescriptor" where\r
+    data FontDescriptor\r
+    data ColorDescriptor\r
+\r
+importJava "org.simantics.browsing.ui.content.LabelDecorator" where\r
+    """\r
+    An interface for decorating aesthetic properties of an UI item, including the label text, font, background color and foreground color.\r
+    """\r
+    data LabelDecorator\r
+    \r
+    """\r
+    Decorates the given label with the name of the UI column which the label is for and  the index of this label within its parenting INodeContext.\r
+    Returns the decorated Label \r
+    """\r
+    decorateLabel :: LabelDecorator -> String -> String -> Integer -> <Proc> String\r
+    decorateForeground :: LabelDecorator -> a -> String -> Integer -> <Proc> a\r
+    decorateBackground :: LabelDecorator -> a -> String -> Integer -> <Proc> a\r
+    decorateFont :: LabelDecorator -> a -> String -> Integer -> <Proc> a\r
+\r
+importJava "org.simantics.browsing.ui.CheckedState" where\r
+    data CheckedState\r
+\r
+importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where\r
+    data Modifier\r
+    \r
+    getValue :: Modifier -> <Proc> String\r
+    isValid :: Modifier -> String -> <Proc> String\r
+\r
+importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where\r
+    toBrowseContextG :: Vector String -> <ReadGraph> BrowseContext\r
+    getNodeContextForResource :: Resource -> <Proc> NodeContext\r
+\r
+"""\r
+Creates a new BrowseContext for the given Collection of Resources.\r
+"""\r
+createBrowseContext :: [Resource] -> <ReadGraph> BrowseContext\r
+createBrowseContext resource = do\r
+    create resource\r
+\r