Search in sources :

Example 1 with Install

use of com.haulmont.cuba.gui.screen.Install in project cuba by cuba-platform.

the class UiControllerReflectionInspector method getAnnotatedInstallMethodsNotCached.

protected List<AnnotatedMethod<Install>> getAnnotatedInstallMethodsNotCached(@SuppressWarnings("unused") Class<?> clazz, Method[] uniqueDeclaredMethods) {
    MethodHandles.Lookup lookup = MethodHandles.lookup();
    List<AnnotatedMethod<Install>> annotatedMethods = new ArrayList<>();
    for (Method m : uniqueDeclaredMethods) {
        Install installAnnotation = findMergedAnnotation(m, Install.class);
        if (installAnnotation != null) {
            if (!m.isAccessible()) {
                m.setAccessible(true);
            }
            MethodHandle methodHandle;
            try {
                methodHandle = lookup.unreflect(m);
            } catch (IllegalAccessException e) {
                throw new RuntimeException("unable to get method handle " + m);
            }
            annotatedMethods.add(new AnnotatedMethod<>(installAnnotation, m, methodHandle));
        }
    }
    return ImmutableList.copyOf(annotatedMethods);
}
Also used : Install(com.haulmont.cuba.gui.screen.Install)

Example 2 with Install

use of com.haulmont.cuba.gui.screen.Install in project cuba by cuba-platform.

the class SourceCodeEditorScreenTest method sourceCodeEditorSuggester.

@Install(to = "sourceCodeEditor", subject = "suggester")
private List<Suggestion> sourceCodeEditorSuggester(AutoCompleteSupport source, String text, int cursorPosition) {
    List<String> options = Arrays.asList("___");
    List<Suggestion> suggestions = new ArrayList<>();
    for (String item : options) {
        suggestions.add(new Suggestion(source, item, item, null, startPosition, endPosition));
    }
    return suggestions;
}
Also used : Suggestion(com.haulmont.cuba.gui.components.autocomplete.Suggestion) ArrayList(java.util.ArrayList) Install(com.haulmont.cuba.gui.screen.Install)

Aggregations

Install (com.haulmont.cuba.gui.screen.Install)2 Suggestion (com.haulmont.cuba.gui.components.autocomplete.Suggestion)1 ArrayList (java.util.ArrayList)1