]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl
Merge "SLF2J logging from SCL"
[simantics/platform.git] / bundles / org.simantics.modeling.ui / scl / Simantics / Testing / BrowseContext.scl
1 import "Simantics/DB"
2 import "Map" as Map
3 import "Simantics/Testing/BuiltinKeys"
4
5 importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContext" where
6     """
7     BrowseContext holds all contributions related to given set of browse contexts.
8     """
9     data BrowseContext
10     
11     @JavaName getChildren
12     """
13     Returns the possible children of the given NodeContext parameter.
14     """
15     browseContextChildren :: BrowseContext -> NodeContext -> <ReadGraph> Collection NodeContext
16     
17     @JavaName getParents
18     """
19     Returns the possible parents of the given NodeContext parameter.
20     """
21     browseContextParents:: BrowseContext -> NodeContext -> <ReadGraph> Collection NodeContext
22     
23     @JavaName getLabel
24     """
25     Finds labels for the given NodeContext parameter.
26     """
27     browseContextLabel :: BrowseContext -> NodeContext -> <ReadGraph> Map.T String String
28     
29     @JavaName getImage
30     """
31     Finds @link ImageDescriptors for the given NodeContext parameter.
32     """
33     browseContextImage :: BrowseContext -> NodeContext -> <ReadGraph> Map.T String ImageDescriptor
34     
35     @JavaName getCheckedState
36     """
37     Finds if the given NodeContext is checked or not.
38     """
39     browseContextCheckedState :: BrowseContext -> NodeContext -> <ReadGraph> CheckedState
40     
41     @JavaName getLabelDecorator
42     """
43     Finds LabelDecorator for the given NodeContext parameter.
44     """
45     browseContextLabelDecorator :: BrowseContext -> NodeContext -> <ReadGraph> LabelDecorator
46     
47     @JavaName getImageDecorator
48     """
49     Finds ImageDecorator for the given NodeContext parameter.
50     """
51     browseContextImageDecorator :: BrowseContext -> NodeContext -> <ReadGraph> ImageDecorator
52     
53     @JavaName getModifier
54     """
55     Finds Modifier for the given NodeContext parameter.
56     """
57     browseContextModifier :: BrowseContext -> NodeContext -> String -> <ReadGraph> Maybe Modifier
58     
59     @private
60     create :: [Resource] -> <ReadGraph> BrowseContext
61
62 importJava "org.simantics.browsing.ui.NodeContext" where
63     """
64     A context used to represent a single visible UI item. 
65     """
66     data NodeContext
67     
68     """
69     Finds value with the specified key or <code>null</code> if there was no value for the key
70     """
71     getConstant :: NodeContext -> ConstantKey -> <Proc> a
72
73 importJava "org.eclipse.jface.resource.ImageDescriptor" where
74     data ImageDescriptor
75
76 importJava "org.simantics.browsing.ui.content.ImageDecorator" where
77     data ImageDecorator
78
79 importJava "org.eclipse.jface.resource.JFaceResources" where
80     getDefaultFontDescriptor :: FontDescriptor
81
82 importJava "org.eclipse.jface.resource.DeviceResourceDescriptor" where
83     data FontDescriptor
84     data ColorDescriptor
85
86 importJava "org.simantics.browsing.ui.content.LabelDecorator" where
87     """
88     An interface for decorating aesthetic properties of an UI item, including the label text, font, background color and foreground color.
89     """
90     data LabelDecorator
91     
92     """
93     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.
94     Returns the decorated Label 
95     """
96     decorateLabel :: LabelDecorator -> String -> String -> Integer -> <Proc> String
97     decorateForeground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
98     decorateBackground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
99     decorateFont :: LabelDecorator -> Maybe a -> String -> Integer -> <Proc> Maybe a
100
101 importJava "org.simantics.browsing.ui.CheckedState" where
102     data CheckedState
103
104 importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where
105     data Modifier
106     
107     getValue :: Modifier -> <Proc> String
108     isValid :: Modifier -> String -> <Proc> Maybe String
109     modify :: Modifier -> String -> <Proc> ()
110
111 importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where
112     toBrowseContextG :: Vector String -> <ReadGraph> BrowseContext
113     getNodeContextForResource :: Resource -> <Proc> NodeContext
114
115 """
116 Creates a new BrowseContext for the given Collection of Resources.
117 """
118 createBrowseContext :: [Resource] -> <ReadGraph> BrowseContext
119 createBrowseContext resource = do
120     create resource
121
122 importJava "org.simantics.browsing.ui.common.NodeContextBuilder" where
123     buildWithInput :: a -> <Proc> NodeContext
124