1 import "Simantics/Variables"
3 include "Simantics/Testing/BuiltinKeys" as BuiltinKeys
5 importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContext" where
7 BrowseContext holds all contributions related to given set of browse contexts.
13 Returns the possible children of the given NodeContext parameter.
15 browseContextChildren :: BrowseContext -> NodeContext -> <ReadGraph> Collection NodeContext
19 Returns the possible parents of the given NodeContext parameter.
21 browseContextParents:: BrowseContext -> NodeContext -> <ReadGraph> Collection NodeContext
25 Finds labels for the given NodeContext parameter.
27 browseContextLabel :: BrowseContext -> NodeContext -> <ReadGraph> Map.T String String
31 Finds @link ImageDescriptors for the given NodeContext parameter.
33 browseContextImage :: BrowseContext -> NodeContext -> <ReadGraph> Map.T String ImageDescriptor
35 @JavaName getCheckedState
37 Finds if the given NodeContext is checked or not.
39 browseContextCheckedState :: BrowseContext -> NodeContext -> <ReadGraph> CheckedState
41 @JavaName getLabelDecorator
43 Finds LabelDecorator for the given NodeContext parameter.
45 browseContextLabelDecorator :: BrowseContext -> NodeContext -> <ReadGraph> LabelDecorator
47 @JavaName getImageDecorator
49 Finds ImageDecorator for the given NodeContext parameter.
51 browseContextImageDecorator :: BrowseContext -> NodeContext -> <ReadGraph> ImageDecorator
55 Finds Modifier for the given NodeContext parameter.
57 browseContextModifier :: BrowseContext -> NodeContext -> String -> <ReadGraph> Maybe Modifier
60 create :: [Resource] -> <ReadGraph> BrowseContext
62 importJava "org.simantics.browsing.ui.NodeContext" where
64 A context used to represent a single visible UI item.
69 Finds value with the specified key or <code>null</code> if there was no value for the key
71 getConstant :: NodeContext -> BuiltinKeys.ConstantKey -> <Proc> a
73 importJava "org.eclipse.jface.resource.ImageDescriptor" where
76 importJava "org.simantics.browsing.ui.content.ImageDecorator" where
79 importJava "org.eclipse.jface.resource.DeviceResourceDescriptor" where
82 importJava "org.eclipse.jface.resource.ColorDescriptor" where
85 importJava "org.eclipse.jface.resource.FontDescriptor" where
88 createFontDescriptorFrom :: String -> Integer -> Integer -> FontDescriptor
90 importJava "org.simantics.modeling.ColorDescriptorUtil" where
91 colorDescriptorAsHex :: ColorDescriptor -> <Proc> String
92 colorDescriptorAsTuple3 :: ColorDescriptor -> <Proc> (Double, Double, Double)
93 colorDescriptor :: (Double, Double, Double) -> <Proc> ColorDescriptor
95 defaultFontDescriptor = createFontDescriptorFrom "Arial" 12 0
97 importJava "org.simantics.browsing.ui.content.LabelDecorator" where
99 An interface for decorating aesthetic properties of an UI item, including the label text, font, background color and foreground color.
104 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.
105 Returns the decorated Label
107 decorateLabel :: LabelDecorator -> String -> String -> Integer -> <Proc> Maybe String
108 decorateForeground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
109 decorateBackground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
110 decorateFont :: LabelDecorator -> Maybe a -> String -> Integer -> <Proc> Maybe a
112 importJava "org.simantics.browsing.ui.CheckedState" where
115 importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where
118 getValue :: Modifier -> <Proc> String
119 isValid :: Modifier -> String -> <Proc> Maybe String
120 modify :: Modifier -> String -> <Proc> ()
122 importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where
123 toBrowseContextG :: Vector String -> <ReadGraph> BrowseContext
124 getNodeContextForResource :: Resource -> <Proc> NodeContext
125 getNodeContextWithTypeForResource :: Resource -> <Proc, ReadGraph> NodeContext
128 Creates a new BrowseContext for the given Collection of Resources.
130 createBrowseContext :: [Resource] -> <ReadGraph> BrowseContext
131 createBrowseContext resource = do
134 importJava "org.simantics.browsing.ui.common.NodeContextBuilder" where
135 buildWithInput :: a -> <Proc> NodeContext
137 instanceOfTest :: Variable -> <ReadGraph> (Resource -> <ReadGraph> Boolean)
138 instanceOfTest self = do
139 typeResource = singleObject (represents $ parent self) MOD.InstanceOfTest.HasType
140 (\r -> isInstanceOf r typeResource)