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