Search in sources :

Example 1 with IEditListEditor

use of com.servoy.j2db.util.editlist.IEditListEditor in project servoy-client by Servoy.

the class ListView method getReadOnlyAwareComponents.

private List<HasRuntimeReadOnly> getReadOnlyAwareComponents() {
    List<HasRuntimeReadOnly> readOnlyAwareComponents = new ArrayList<HasRuntimeReadOnly>();
    ListCellRenderer cellRenderer = getCellRenderer();
    if (cellRenderer instanceof DataRenderer) {
        DataRenderer dr = (DataRenderer) cellRenderer;
        for (int i = 0; i < dr.getComponentCount(); i++) {
            Component c = dr.getComponent(i);
            if (c instanceof IScriptableProvider && ((IScriptableProvider) c).getScriptObject() instanceof HasRuntimeReadOnly) {
                readOnlyAwareComponents.add((HasRuntimeReadOnly) ((IScriptableProvider) c).getScriptObject());
            }
        }
    }
    IEditListEditor editorComponent = getCellEditor();
    if (editorComponent instanceof FormBodyEditor) {
        FormBodyEditor formBodyEditor = (FormBodyEditor) editorComponent;
        DataRenderer dataRenderer = formBodyEditor.getDataRenderer();
        for (int i = 0; i < dataRenderer.getComponentCount(); i++) {
            Component c = dataRenderer.getComponent(i);
            if (c instanceof IScriptableProvider && ((IScriptableProvider) c).getScriptObject() instanceof HasRuntimeReadOnly) {
                readOnlyAwareComponents.add((HasRuntimeReadOnly) ((IScriptableProvider) c).getScriptObject());
            }
        }
    }
    return readOnlyAwareComponents;
}
Also used : HasRuntimeReadOnly(com.servoy.j2db.ui.runtime.HasRuntimeReadOnly) IEditListEditor(com.servoy.j2db.util.editlist.IEditListEditor) DataRenderer(com.servoy.j2db.smart.dataui.DataRenderer) FormBodyEditor(com.servoy.j2db.smart.dataui.FormBodyEditor) ArrayList(java.util.ArrayList) ListCellRenderer(javax.swing.ListCellRenderer) Component(java.awt.Component) IScriptableProvider(com.servoy.j2db.scripting.IScriptableProvider) Point(java.awt.Point)

Aggregations

IScriptableProvider (com.servoy.j2db.scripting.IScriptableProvider)1 DataRenderer (com.servoy.j2db.smart.dataui.DataRenderer)1 FormBodyEditor (com.servoy.j2db.smart.dataui.FormBodyEditor)1 HasRuntimeReadOnly (com.servoy.j2db.ui.runtime.HasRuntimeReadOnly)1 IEditListEditor (com.servoy.j2db.util.editlist.IEditListEditor)1 Component (java.awt.Component)1 Point (java.awt.Point)1 ArrayList (java.util.ArrayList)1 ListCellRenderer (javax.swing.ListCellRenderer)1